diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..06abdf66 --- /dev/null +++ b/.clang-format @@ -0,0 +1,71 @@ +--- +AccessModifierOffset: -4 +Language: Cpp +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: InlineOnly +AllowShortIfStatementsOnASingleLine: Never +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterControlStatement: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeTernaryOperators: false +BreakConstructorInitializersBeforeComma: false +ColumnLimit: 150 +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ForEachMacros: [] +IncludeCategories: + - Regex: '^"' + Priority: 1 + - Regex: '^<' + Priority: 2 +IndentAccessModifiers: false +IndentCaseLabels: true +IndentWidth: 4 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: All +ObjCBlockIndentWidth: 4 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Left +ReflowComments: true +SortIncludes: true +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +TabWidth: 4 +UseTab: Never diff --git a/.gitignore b/.gitignore index c6bf683c..960a0d88 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,6 @@ orig/*/* build/ .ninja_* build.ninja -.private/* # decompctx output ctx.* @@ -33,6 +32,8 @@ objdiff.json compile_commands.json # Miscellaneous +.private/* +.ghidra/* progress/* hbprojs/* /*.txt diff --git a/.vscode/settings.json b/.vscode/settings.json index 720d1589..a8ac55a4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,6 +11,7 @@ "editor.defaultFormatter": "ms-python.black-formatter" }, "editor.tabSize": 4, + "editor.formatOnSave": true, "files.autoSave": "onFocusChange", "files.insertFinalNewline": true, "files.trimFinalNewlines": true, diff --git a/config/43E/symbols.txt b/config/43E/symbols.txt index 486cf6bf..83d460d2 100644 --- a/config/43E/symbols.txt +++ b/config/43E/symbols.txt @@ -6679,7 +6679,7 @@ CHANSVmConvertToIntFromArray = .text:0x8144B524; // type:function size:0x8 CHANSVm_8144B430 = .text:0x8144B52C; // type:function size:0x40 CHANSVm_8144B470 = .text:0x8144B56C; // type:function size:0x64 CHANSVm_8144B4D4 = .text:0x8144B5D0; // type:function size:0x14C -CHANSVmConvertToStrFromUnd = .text:0x8144B71C; // type:function size:0xC +CHANSVmConvertToStrFromUndefined = .text:0x8144B71C; // type:function size:0xC CHANSVm_8144B62C = .text:0x8144B728; // type:function size:0x58 scope:local CHANSVmConvertToStrFromInt = .text:0x8144B780; // type:function size:0xB0 CHANSVm_8144B734 = .text:0x8144B830; // type:function size:0xDC @@ -6879,10 +6879,10 @@ CHANSVm_81455654 = .text:0x81455750; // type:function size:0x8C VmPushFuncReturnInfo = .text:0x814557DC; // type:function size:0x1AC scope:local VmReturnWithValue = .text:0x81455988; // type:function size:0x1D4 scope:local CHANSVmLinkModules = .text:0x81455B5C; // type:function size:0x2F4 -VmGetOperandp = .text:0x81455E50; // type:function size:0x34 scope:local +VmGetOperand = .text:0x81455E50; // type:function size:0x34 scope:local VmLoadImmInteger = .text:0x81455E84; // type:function size:0x44 scope:local VmStore = .text:0x81455EC8; // type:function size:0x94 scope:local -VmDelCommon = .text:0x81455F5C; // type:function size:0x80 scope:local +VmDeleteCommon = .text:0x81455F5C; // type:function size:0x80 scope:local VmCallMethod = .text:0x81455FDC; // type:function size:0x464 scope:local CHANSVmSetSignal = .text:0x81456440; // type:function size:0x10 CHANSVmStep = .text:0x81456450; // type:function size:0x1394 diff --git a/config/43J/symbols.txt b/config/43J/symbols.txt index 495ba2a5..ee959e9b 100644 --- a/config/43J/symbols.txt +++ b/config/43J/symbols.txt @@ -6443,7 +6443,7 @@ CHANSVmConvertToIntFromArray = .text:0x8144BA98; // type:function size:0x8 CHANSVm_8144B430 = .text:0x8144BAA0; // type:function size:0x40 CHANSVm_8144B470 = .text:0x8144BAE0; // type:function size:0x64 CHANSVm_8144B4D4 = .text:0x8144BB44; // type:function size:0x14C -CHANSVmConvertToStrFromUnd = .text:0x8144BC90; // type:function size:0xC +CHANSVmConvertToStrFromUndefined = .text:0x8144BC90; // type:function size:0xC CHANSVm_8144B62C = .text:0x8144BC9C; // type:function size:0x58 scope:local CHANSVmConvertToStrFromInt = .text:0x8144BCF4; // type:function size:0xB0 CHANSVm_8144B734 = .text:0x8144BDA4; // type:function size:0xDC @@ -6643,10 +6643,10 @@ CHANSVm_81455654 = .text:0x81455CC4; // type:function size:0x8C VmPushFuncReturnInfo = .text:0x81455D50; // type:function size:0x1AC scope:local VmReturnWithValue = .text:0x81455EFC; // type:function size:0x1D4 scope:local CHANSVmLinkModules = .text:0x814560D0; // type:function size:0x2F4 -VmGetOperandp = .text:0x814563C4; // type:function size:0x34 scope:local +VmGetOperand = .text:0x814563C4; // type:function size:0x34 scope:local VmLoadImmInteger = .text:0x814563F8; // type:function size:0x44 scope:local VmStore = .text:0x8145643C; // type:function size:0x94 scope:local -VmDelCommon = .text:0x814564D0; // type:function size:0x80 scope:local +VmDeleteCommon = .text:0x814564D0; // type:function size:0x80 scope:local VmCallMethod = .text:0x81456550; // type:function size:0x464 scope:local CHANSVmSetSignal = .text:0x814569B4; // type:function size:0x10 CHANSVmStep = .text:0x814569C4; // type:function size:0x1394 diff --git a/config/43K/symbols.txt b/config/43K/symbols.txt index a7940adc..c8cdfdb3 100644 --- a/config/43K/symbols.txt +++ b/config/43K/symbols.txt @@ -6422,7 +6422,7 @@ CHANSVmConvertToIntFromArray = .text:0x8144B1B8; // type:function size:0x8 CHANSVm_8144B430 = .text:0x8144B1C0; // type:function size:0x40 CHANSVm_8144B470 = .text:0x8144B200; // type:function size:0x64 CHANSVm_8144B4D4 = .text:0x8144B264; // type:function size:0x14C -CHANSVmConvertToStrFromUnd = .text:0x8144B3B0; // type:function size:0xC +CHANSVmConvertToStrFromUndefined = .text:0x8144B3B0; // type:function size:0xC CHANSVm_8144B62C = .text:0x8144B3BC; // type:function size:0x58 scope:local CHANSVmConvertToStrFromInt = .text:0x8144B414; // type:function size:0xB0 CHANSVm_8144B734 = .text:0x8144B4C4; // type:function size:0xDC @@ -6622,10 +6622,10 @@ CHANSVm_81455654 = .text:0x814553E4; // type:function size:0x8C VmPushFuncReturnInfo = .text:0x81455470; // type:function size:0x1AC scope:local VmReturnWithValue = .text:0x8145561C; // type:function size:0x1D4 scope:local CHANSVmLinkModules = .text:0x814557F0; // type:function size:0x2F4 -VmGetOperandp = .text:0x81455AE4; // type:function size:0x34 scope:local +VmGetOperand = .text:0x81455AE4; // type:function size:0x34 scope:local VmLoadImmInteger = .text:0x81455B18; // type:function size:0x44 scope:local VmStore = .text:0x81455B5C; // type:function size:0x94 scope:local -VmDelCommon = .text:0x81455BF0; // type:function size:0x80 scope:local +VmDeleteCommon = .text:0x81455BF0; // type:function size:0x80 scope:local VmCallMethod = .text:0x81455C70; // type:function size:0x464 scope:local CHANSVmSetSignal = .text:0x814560D4; // type:function size:0x10 CHANSVmStep = .text:0x814560E4; // type:function size:0x1394 diff --git a/config/43U/symbols.txt b/config/43U/symbols.txt index 3026c9f7..ef459bb5 100644 --- a/config/43U/symbols.txt +++ b/config/43U/symbols.txt @@ -6679,7 +6679,7 @@ CHANSVmConvertToIntFromArray = .text:0x8144B428; // type:function size:0x8 CHANSVm_8144B430 = .text:0x8144B430; // type:function size:0x40 CHANSVm_8144B470 = .text:0x8144B470; // type:function size:0x64 CHANSVm_8144B4D4 = .text:0x8144B4D4; // type:function size:0x14C -CHANSVmConvertToStrFromUnd = .text:0x8144B620; // type:function size:0xC +CHANSVmConvertToStrFromUndefined = .text:0x8144B620; // type:function size:0xC CHANSVm_8144B62C = .text:0x8144B62C; // type:function size:0x58 scope:local CHANSVmConvertToStrFromInt = .text:0x8144B684; // type:function size:0xB0 CHANSVm_8144B734 = .text:0x8144B734; // type:function size:0xDC @@ -6879,10 +6879,10 @@ CHANSVm_81455654 = .text:0x81455654; // type:function size:0x8C VmPushFuncReturnInfo = .text:0x814556E0; // type:function size:0x1AC scope:local VmReturnWithValue = .text:0x8145588C; // type:function size:0x1D4 scope:local CHANSVmLinkModules = .text:0x81455A60; // type:function size:0x2F4 -VmGetOperandp = .text:0x81455D54; // type:function size:0x34 scope:local +VmGetOperand = .text:0x81455D54; // type:function size:0x34 scope:local VmLoadImmInteger = .text:0x81455D88; // type:function size:0x44 scope:local VmStore = .text:0x81455DCC; // type:function size:0x94 scope:local -VmDelCommon = .text:0x81455E60; // type:function size:0x80 scope:local +VmDeleteCommon = .text:0x81455E60; // type:function size:0x80 scope:local VmCallMethod = .text:0x81455EE0; // type:function size:0x464 scope:local CHANSVmSetSignal = .text:0x81456344; // type:function size:0x10 CHANSVmStep = .text:0x81456354; // type:function size:0x1394 diff --git a/include/SoftKeyboard.h b/include/SoftKeyboard.h index e9c7a70d..4d60e81a 100644 --- a/include/SoftKeyboard.h +++ b/include/SoftKeyboard.h @@ -1,8 +1,10 @@ #ifndef SOFT_KEYBOARD_H #define SOFT_KEYBOARD_H +// clang-format off #include "keyboard/MyTiManager.h" #include "keyboard/tiManager.h" #include "keyboard/tiUtil.h" +// clang-format on -#endif // SOFT_KEYBOARD_H +#endif // SOFT_KEYBOARD_H diff --git a/include/channelScript/CHANSVm.h b/include/channelScript/CHANSVm.h index 2f629c47..a2cd4ea5 100644 --- a/include/channelScript/CHANSVm.h +++ b/include/channelScript/CHANSVm.h @@ -55,8 +55,6 @@ CHANSVmObjHdr* CHANSVmNewArrayObject(CHANSVm* vm, CHANSVmObjHdr* object, vm CHANSVmObjHdr* CHANSVmGetArrayElement2D(CHANSVm* vm, vmPtr array, vmS32 dimension0, vmS32 dimension1); CHANSVmObjHdr* CHANSVmGetArrayElement2DFloat(CHANSVm* vm, vmFloat* array, vmS32 dimension0, vmS32 dimension1); - - /************************/ /*** CHANS Method ***/ /************************/ diff --git a/include/channelScript/CHANSVm/VmTypes.h b/include/channelScript/CHANSVm/VmTypes.h index 7d7da2ab..c3ed0d57 100644 --- a/include/channelScript/CHANSVm/VmTypes.h +++ b/include/channelScript/CHANSVm/VmTypes.h @@ -60,7 +60,7 @@ typedef enum CHANSVmObjType { typedef struct CHANSVmObjHdr CHANSVmObjHdr; typedef struct CHANSVmNativeClass CHANSVmNativeClass; -#include + struct CHANSVmObjHdr { union { vmInteger int_v; diff --git a/include/channelScript/iplCSLibrary.h b/include/channelScript/iplCSLibrary.h index 54f1d019..24c94619 100644 --- a/include/channelScript/iplCSLibrary.h +++ b/include/channelScript/iplCSLibrary.h @@ -7,8 +7,6 @@ #include #include -// messy but so as CHANS - #define EXTERN_IPL_LIB(l) namespace l { BOOL init(CHANSVm* vm); } #define EXTERN_IPL_LIB_CTOR(l) namespace l { BOOL _ctor(CHANSVm* VmInst, CHANSVmObjHdr* VmObj); } diff --git a/include/iplBannerSound.h b/include/iplBannerSound.h index eb7a2821..0cb5eb5c 100644 --- a/include/iplBannerSound.h +++ b/include/iplBannerSound.h @@ -1,6 +1,8 @@ #ifndef BANNER_SOUND_H #define BANNER_SOUND_H +// clang-format off #include "bannerSound/BannerSoundPlayer.h" +// clang-format on -#endif // BANNER_SOUND_H +#endif // BANNER_SOUND_H diff --git a/include/iplLayoutUI.h b/include/iplLayoutUI.h index 5742721b..f29fa51f 100644 --- a/include/iplLayoutUI.h +++ b/include/iplLayoutUI.h @@ -1,8 +1,10 @@ #ifndef LAYOUT_AND_UI_H #define LAYOUT_AND_UI_H -#include "layout/iplLayout.h" +// clang-format off #include "layout/GUIManager.h" #include "layout/iplGuiManager.h" +#include "layout/iplLayout.h" +// clang-format on -#endif // LAYOUT_AND_UI_H +#endif // LAYOUT_AND_UI_H diff --git a/include/iplMath.h b/include/iplMath.h index 64ebdeaf..c1021b4e 100644 --- a/include/iplMath.h +++ b/include/iplMath.h @@ -1,8 +1,10 @@ #ifndef IPL_MATH_H #define IPL_MATH_H -#include "math/iplMathTypes.h" +// clang-format off #include "math/iplInterporation.h" #include "math/iplMathRandom.h" +#include "math/iplMathTypes.h" +// clang-format on -#endif // IPL_MATH_H +#endif // IPL_MATH_H diff --git a/include/iplScene.h b/include/iplScene.h index d1b71eb7..3f455454 100644 --- a/include/iplScene.h +++ b/include/iplScene.h @@ -1,10 +1,10 @@ #ifndef SCENE_H #define SCENE_H +// clang-format off #include "layout/iplLayout.h" - #include "sound/iplSound.h" - #include "scene/iplSceneManager.h" +// clang-format on -#endif // SCENE_H +#endif // SCENE_H diff --git a/include/iplSceneHeader.h b/include/iplSceneHeader.h index acb66e62..79455ab2 100644 --- a/include/iplSceneHeader.h +++ b/include/iplSceneHeader.h @@ -1,9 +1,11 @@ #ifndef SCENE_HEADER_H #define SCENE_HEADER_H -#include "scene/iplSceneBase.h" +// clang-format off #include "scene/iplFaderSceneBase.h" +#include "scene/iplSceneBase.h" #include "layout/iplLayout.h" +// clang-format on -#endif // SCENE_HEADER_H +#endif // SCENE_HEADER_H diff --git a/include/iplSceneUI.h b/include/iplSceneUI.h index aea3bea8..ac0f49a6 100644 --- a/include/iplSceneUI.h +++ b/include/iplSceneUI.h @@ -1,12 +1,14 @@ #ifndef SCENE_FOR_UI_H #define SCENE_FOR_UI_H -#include "layout/iplLayout.h" +// clang-format off #include "layout/GUIManager.h" #include "layout/iplGuiManager.h" +#include "layout/iplLayout.h" #include "sound/iplSound.h" #include "scene/iplSceneManager.h" +// clang-format on -#endif // SCENE_FOR_UI_H +#endif // SCENE_FOR_UI_H diff --git a/include/iplSceneUIHeader.h b/include/iplSceneUIHeader.h index c8e34713..9e5f56b5 100644 --- a/include/iplSceneUIHeader.h +++ b/include/iplSceneUIHeader.h @@ -1,14 +1,16 @@ #ifndef SCENE_HEADER_FOR_UI_H #define SCENE_HEADER_FOR_UI_H -#include "scene/iplSceneBase.h" +// clang-format off #include "scene/iplFaderSceneBase.h" +#include "scene/iplSceneBase.h" -#include "layout/iplLayout.h" #include "layout/GUIManager.h" +#include "layout/iplLayout.h" #include "system/iplController.h" SCENE_USING_GUI +// clang-format on -#endif // SCENE_HEADER_H +#endif // SCENE_HEADER_H diff --git a/include/iplSound.h b/include/iplSound.h index 3933c9a1..7fcd4c1a 100644 --- a/include/iplSound.h +++ b/include/iplSound.h @@ -1,6 +1,8 @@ #ifndef SOUND_H #define SOUND_H +// clang-format off #include "sound/iplSound.h" +// clang-format on -#endif // SOUND_H +#endif // SOUND_H diff --git a/include/iplSystem.h b/include/iplSystem.h index b85dd34c..56038421 100644 --- a/include/iplSystem.h +++ b/include/iplSystem.h @@ -1,10 +1,12 @@ #ifndef SYSTEM_H #define SYSTEM_H +// clang-format off #include "system/RIPL_BoardRecord.h" #include "system/rvl_dec.h" #include "system/odh.h" #include "system/iplSystem.h" +// clang-format on -#endif // SYSTEM_H +#endif // SYSTEM_H diff --git a/include/iplUtility.h b/include/iplUtility.h index 5004c43b..4af2de12 100644 --- a/include/iplUtility.h +++ b/include/iplUtility.h @@ -1,6 +1,7 @@ #ifndef UTILITY_H #define UTILITY_H +// clang-format off #include "utility/iplTree.h" #include "utility/iplQueue.h" #include "utility/iplTimer.h" @@ -19,5 +20,6 @@ #include "utility/iplScroller.h" #include "utility/iplMisc.h" +// clang-format on -#endif // UTILITY_H +#endif // UTILITY_H diff --git a/include/iplWWW.h b/include/iplWWW.h index 4fffac7b..94957630 100644 --- a/include/iplWWW.h +++ b/include/iplWWW.h @@ -1,8 +1,10 @@ #ifndef WWW_H #define WWW_H +// clang-format off #include "iplwww/www_message.h" #include "iplwww/www_print.h" #include "iplwww/www_thread.h" +// clang-format on -#endif // WWW_H +#endif // WWW_H diff --git a/include/layout/iplLayout.h b/include/layout/iplLayout.h index 5716b549..46ab9cd3 100644 --- a/include/layout/iplLayout.h +++ b/include/layout/iplLayout.h @@ -13,7 +13,7 @@ #include "utility/iplFrameController.h" #include "utility/iplGraphics.h" -// TODO?: Should reduce the amount of inline functions which just call SetVisible. +// TODO?: reduce the amount of inline functions which just call SetVisible for matching purposes. namespace ipl { namespace layout { diff --git a/include/scene/address/iplAddress.h b/include/scene/address/iplAddress.h index 79ed96a3..67b5d334 100644 --- a/include/scene/address/iplAddress.h +++ b/include/scene/address/iplAddress.h @@ -8,33 +8,37 @@ namespace ipl { namespace scene { class FriendListCache { - public: - const NWC24FriendInfo& getInfo(int index) const { return mInfos[index]; } + public: + const NWC24FriendInfo& getInfo(int index) const { return mInfos[index]; } - private: - NWC24FriendInfo mInfos[100]; + private: + NWC24FriendInfo mInfos[100]; }; FADER_SCENE_CLASS(Address) { - public: - Address(EGG::Heap* heap, int); + public: + Address(EGG::Heap * heap, int); - enum { - SCENE_ADD_WII = 1, - SCENE_ADD_EMAIL, - }; + enum { + SCENE_ADD_WII = 1, + SCENE_ADD_EMAIL, + }; - int getChosenFriendIndex() { return unk_0xC0; } - FriendListCache* getFriendCache() { return unk_0x274; } + int getChosenFriendIndex() { + return unk_0xC0; + } + FriendListCache* getFriendCache() { + return unk_0x274; + } - private: - u8 unk_0x58[0x68]; - int unk_0xC0; - u8 unk_0xC4[0x1B0]; - FriendListCache* unk_0x274; - u8 unk_0x278[0x28]; + private: + u8 unk_0x58[0x68]; + int unk_0xC0; + u8 unk_0xC4[0x1B0]; + FriendListCache* unk_0x274; + u8 unk_0x278[0x28]; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_ADDRESS_H +#endif // IPL_SCENE_ADDRESS_H diff --git a/include/scene/address/iplAddressAddSel.h b/include/scene/address/iplAddressAddSel.h index f7a67b69..c35de120 100644 --- a/include/scene/address/iplAddressAddSel.h +++ b/include/scene/address/iplAddressAddSel.h @@ -10,90 +10,84 @@ namespace ipl { class AddressAddSelEvent; FADER_SCENE_CLASS(AddressAddSel), public ButtonEventHandlerBase { - public: - AddressAddSel(EGG::Heap* heap); + public: + AddressAddSel(EGG::Heap * heap); - virtual void create(); + virtual void create(); - virtual FaderSceneCommand calcFadein(); + virtual FaderSceneCommand calcFadein(); - virtual void initCalcNormal(); - virtual FaderSceneCommand calcNormal(); + virtual void initCalcNormal(); + virtual FaderSceneCommand calcNormal(); - virtual void initCalcFadeout(); - virtual FaderSceneCommand calcFadeout(); + virtual void initCalcFadeout(); + virtual FaderSceneCommand calcFadeout(); - virtual void calcCommonAfter(); + virtual void calcCommonAfter(); - virtual void draw(); + virtual void draw(); - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); + virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); - private: - enum { - STATE_NORMAL = 0, - STATE_WAIT_DECIDE_ANM, - STATE_DONE, - }; + private: + enum { + STATE_NORMAL = 0, + STATE_WAIT_DECIDE_ANM, + STATE_DONE, + }; - enum { - BTN_WII = 0, - BTN_EMAIL, - BTN_MAX - }; + enum { BTN_WII = 0, BTN_EMAIL, BTN_MAX }; - enum { - ANIM_FADE_IN = 0, - ANIM_FADE_OUT, - ANIM_BTN_FOCUS_IN, - ANIM_WII_BTN_FOCUS_IN = ANIM_BTN_FOCUS_IN, - ANIM_EMAIL_BTN_FOCUS_IN, - ANIM_BTN_FOCUS_OUT, - ANIM_WII_BTN_FOCUS_OUT = ANIM_BTN_FOCUS_OUT, - ANIM_EMAIL_BTN_FOCUS_OUT, - ANIM_BTN_SELECT, - ANIM_WII_BTN_SELECT = ANIM_BTN_SELECT, - ANIM_EMAIL_BTN_SELECT, - }; + enum { + ANIM_FADE_IN = 0, + ANIM_FADE_OUT, + ANIM_BTN_FOCUS_IN, + ANIM_WII_BTN_FOCUS_IN = ANIM_BTN_FOCUS_IN, + ANIM_EMAIL_BTN_FOCUS_IN, + ANIM_BTN_FOCUS_OUT, + ANIM_WII_BTN_FOCUS_OUT = ANIM_BTN_FOCUS_OUT, + ANIM_EMAIL_BTN_FOCUS_OUT, + ANIM_BTN_SELECT, + ANIM_WII_BTN_SELECT = ANIM_BTN_SELECT, + ANIM_EMAIL_BTN_SELECT, + }; - void stt_normal(); - void stt_wait_decide_anm(); + void stt_normal(); + void stt_wait_decide_anm(); - void start_point_event(const char* paneName, controller::Interface* con); - void start_left_event(const char* paneName); - void start_trig_event(const char* paneName); + void start_point_event(const char* paneName, controller::Interface* con); + void start_left_event(const char* paneName); + void start_trig_event(const char* paneName); - int get_button_no(const char* paneName); + int get_button_no(const char* paneName); - void reset_gui(); + void reset_gui(); - void set_textbox(const char* paneName, u32 msgId); + void set_textbox(const char* paneName, u32 msgId); - u32 mState; // 0x64 + u32 mState; // 0x64 - layout::Object* mpLayout; // 0x68 - AddressAddSelEvent* mpEvent; // 0x6C - gui::PaneManager* mpGui; // 0x70 + layout::Object* mpLayout; // 0x68 + AddressAddSelEvent* mpEvent; // 0x6C + gui::PaneManager* mpGui; // 0x70 - BOOL mbHovered[BTN_MAX]; // 0x74 + BOOL mbHovered[BTN_MAX]; // 0x74 - static const char* mscButtonName[BTN_MAX]; + static const char* mscButtonName[BTN_MAX]; - friend class AddressAddSelEvent; + friend class AddressAddSelEvent; }; class AddressAddSelEvent : public ::gui::EventHandler { - public: - AddressAddSelEvent(AddressAddSel* instance) : - ::gui::EventHandler(), - mpInstance(instance) {} + public: + AddressAddSelEvent(AddressAddSel* instance) : ::gui::EventHandler(), mpInstance(instance) {} - virtual void onEvent(u32 compId, u32 event, void* data); + virtual void onEvent(u32 compId, u32 event, void* data); - private: - AddressAddSel* mpInstance; // 0x0C + private: + AddressAddSel* mpInstance; // 0x0C }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_ADDRESS_ADD_SELECT_H +#endif // IPL_SCENE_ADDRESS_ADD_SELECT_H diff --git a/include/scene/address/iplAddressEdit.h b/include/scene/address/iplAddressEdit.h index ba897968..38237ca2 100644 --- a/include/scene/address/iplAddressEdit.h +++ b/include/scene/address/iplAddressEdit.h @@ -6,18 +6,18 @@ namespace ipl { namespace scene { FADER_SCENE_CLASS(AddressEdit) { - public: - AddressEdit(EGG::Heap* heap, int friendCode); + public: + AddressEdit(EGG::Heap * heap, int friendCode); - enum { - SCENE_ADD_WII = 1, - SCENE_ADD_EMAIL, - }; + enum { + SCENE_ADD_WII = 1, + SCENE_ADD_EMAIL, + }; - private: - u8 unk_0x58[0x498]; + private: + u8 unk_0x58[0x498]; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_ADDRESS_EDIT_H +#endif // IPL_SCENE_ADDRESS_EDIT_H diff --git a/include/scene/backMenu/iplBackMenu.h b/include/scene/backMenu/iplBackMenu.h index bcb6510b..a22f0ed1 100644 --- a/include/scene/backMenu/iplBackMenu.h +++ b/include/scene/backMenu/iplBackMenu.h @@ -6,33 +6,33 @@ namespace ipl { namespace scene { FADER_SCENE_CLASS(BackMenu) { - public: - BackMenu(EGG::Heap* heap); + public: + BackMenu(EGG::Heap * heap); - virtual BOOL isReady() const; + virtual BOOL isReady() const; - virtual void prepare(); - virtual void create(); - virtual void draw(); + virtual void prepare(); + virtual void create(); + virtual void draw(); - virtual void initCalcFadeout(); + virtual void initCalcFadeout(); - virtual void calcCommon(); + virtual void calcCommon(); - virtual FaderSceneCommand calcFadein(); - virtual FaderSceneCommand calcNormal(); - virtual FaderSceneCommand calcFadeout(); + virtual FaderSceneCommand calcFadein(); + virtual FaderSceneCommand calcNormal(); + virtual FaderSceneCommand calcFadeout(); - // Fuck this + // Fuck this #if defined(VERSION_43K) && defined(VERY_DIRTY_MATCH_HACK) - virtual void SomeSortOfPaddingIdfk() = 0; + virtual void SomeSortOfPaddingIdfk() = 0; #endif - - private: - layout::Object* mpLayout; // 0x58 - u32 unused_0x5C; // 0x5C - }; - } -} -#endif // IPL_SCENE_BACK_MENU_H + private: + layout::Object* mpLayout; // 0x58 + u32 unused_0x5C; // 0x5C + }; + } // namespace scene +} // namespace ipl + +#endif // IPL_SCENE_BACK_MENU_H diff --git a/include/scene/board/iplBoard.h b/include/scene/board/iplBoard.h index 64459345..0e590b0f 100644 --- a/include/scene/board/iplBoard.h +++ b/include/scene/board/iplBoard.h @@ -12,8 +12,8 @@ #include "scene/button/iplButton.h" #include "scene/board/iplBoardObject.h" -#include "scene/board/iplFocusObject.h" #include "scene/board/iplBoardSD.h" +#include "scene/board/iplFocusObject.h" #include @@ -21,263 +21,291 @@ namespace ipl { namespace scene { class focus_object; SCENE_CLASS(Board), public ButtonEventHandlerBase { + public: + typedef struct SearchRecord { + bool created; // 0x00 + int year; // 0x04 + int month; // 0x08 + int day; // 0x0C + int hour; // 0x10 + int min; // 0x14 + int sec; // 0x18 + int unused_0x1C; + CDBRecordKey key; // 0x20 + + CDBDate getCDBDate() { return CDBMakeCDBDate(year, month, day, hour, min, sec); } + } SearchRecord; + + Board(EGG::Heap * heap, int); + + virtual void prepare(); + virtual void create(); + + virtual void calc(); + virtual void draw(); + + virtual void destroy(); + + virtual BOOL isResetAcceptable() const; + + virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); + + void updateDate(const utility::Date& date); + + void focus(BoardObject * boardObject); + BOOL pinch(BoardObject * boardObject); + void pinchOff(BoardObject * boardObject); + + BOOL isOptOut() const; + + void reappend(BoardObject * boardObject); + BOOL appendRecord(CDBRecord * record); + + void stt_wait_cdb_init(); + void stt_wait_init(); + void stt_wait_child_dst(); + void stt_wait_child_cst(); + void stt_wait_scroll(); + void stt_normal(); + void stt_focus(); + + void stt_after_del(); + + void stt_init_lfadeaway(); + void stt_init_rfadeaway(); + void stt_wait_fadeaway(); + void stt_wait_stand(); + + void exec_count_task(); + + void set_text_date(); + void set_text_date(const utility::Date& date, const char* paneName); + + void get_text_jpn(const utility::Date& date, wchar_t* text, u32 textLen); + void get_text_kor(const utility::Date& date, wchar_t* text, u32 textLen); + void get_text_spa(const utility::Date& date, wchar_t* text, u32 textLen); + void get_text_ger(const utility::Date& date, wchar_t* text, u32 textLen); + void get_text_usaeng(const utility::Date& date, wchar_t* text, u32 textLen); + void get_text_usafre(const utility::Date& date, wchar_t* text, u32 textLen); + void get_text_paleng(const utility::Date& date, wchar_t* text, u32 textLen); + + void show_ricon(); + void hide_ricon(); + void show_licon(); + void hide_licon(); + + void enable_ricon(); + void disable_ricon(); + void enable_licon(); + void disable_licon(); + + void appear_arrow(); + void disappear_arrow(); + void edge_arrow(); + + void return_to_freelist(); + void return_to_freelist_if_diff_date(); + + int get_date_label(const utility::Date& date); + + void init_search_condition(); + + void set_key_table(); + void clear_key_table() { + memset(&mKeyTable, 0, sizeof(mKeyTable)); + set_key_table(); + }; + + BOOL is_exist_diff_date() const; + + void calc_board_object(); + + void cmn_create_child(int buttonAnim); + void cmn_start_scroll_r(); + void cmn_start_scroll_l(); + void cmn_start_scroll_r_hi(const utility::Date& date); + void cmn_start_scroll_l_hi(const utility::Date& date); + void cmn_start_scroll(int animId); + + BOOL is_wait_to_clean_task() const; + BOOL is_already_read(const char* recordKey) const; + BOOL is_exist_keytbl(const char* recordKey) const; + + void after_backup(); + + void reopen_log(); + + BoardObject* get_log_obj(); + + enum { + FRIEND_CODE_ERR_SUCCESS = 0, + FRIEND_CODE_ERR_NWC24, + FRIEND_CODE_ERR_UNAVAILABLE, + }; + + int getFriendInfo(NWC24FriendInfo * info) const; + const GXTexObj& getPictureTexObj() const; + const void* getPicture(u32 * picLength) const; + int getPictureWidth() const; + int getPictureHeight() const; + + nand::LayoutFile* getLayoutFile() const { + return mpLayoutFile; + } + utility::Date& getDate() { + return mCurrentDate; + } + + bool canPlayDispSound() const { + return mbPlayDispSound; + } + CDBSearchDirection getSearchDirection() const { + return mSearchDirection; + } + + void setHoveredObj(int index, BoardObject* boardObject) { + mHoveredObjs[index] = boardObject; + } + BoardObject* getHoveredObj(int index) { + return mHoveredObjs[index]; + } + + void countMessage() { + mMsgCount++; + } + void clearMsgCount() { + mPrevMsgCount = mMsgCount; + mMsgCount = 0; + } + + void doneReadTask() { + mbDoReadTask = false; + } + void doneReading() { + mbReading = false; + } + void doneDeleteTask() { + mbDoTaskDelete = false; + } + void doneCountTask() { + mbDoCountTask = false; + } + void sendNewMessageAnimCount() { + mbNewMsgAnimCount = true; + } + + SearchRecord& getSearchRecord() { + return mSearchRecord; + } + + private: + enum { + STATE_WAIT_CDB_INIT = 0, + STATE_WAIT_INIT, + STATE_WAIT_CHILD_DST, + STATE_WAIT_CHILD_CST, + STATE_WAIT_SCROLL, + STATE_NORMAL, + STATE_FOCUS, + STATE_AFTER_DEL, + STATE_PINCH, + STATE_INIT_LEFT_FADEAWAY, + STATE_INIT_RIGHT_FADEAWAY, + STATE_INIT_FADEAWAY, + STATE_BACKUP, + STATE_TO_SETTINGS, + STATE_TERMINATE, + STATE_WAIT_STAND, + STATE_DONE, + }; + + static Button* get_button(); + static Arrow* get_arrow(); + + static const int OBJECTS_ON_SCREEN = 10; + + class ObjList { public: - typedef struct SearchRecord { - bool created; // 0x00 - int year; // 0x04 - int month; // 0x08 - int day; // 0x0C - int hour; // 0x10 - int min; // 0x14 - int sec; // 0x18 - int unused_0x1C; - CDBRecordKey key; // 0x20 + ObjList(); - CDBDate getCDBDate() { return CDBMakeCDBDate(year, month, day, hour, min, sec); } - } SearchRecord; + BoardObject* getNext(BoardObject* obj = NULL) const { return (BoardObject*)nw4r::ut::List_GetNext((nw4r::ut::List*)&mUsedObjs, obj); } - Board(EGG::Heap* heap, int); + BoardObject* getNextFree(BoardObject* obj = NULL) { return (BoardObject*)nw4r::ut::List_GetNext(&mFreeObjs, obj); } - virtual void prepare(); - virtual void create(); + int getCount() { return mUsedObjs.numObjects; } + int getFreeCount() { return mFreeObjs.numObjects; } - virtual void calc(); - virtual void draw(); + void append(BoardObject* obj) const { + nw4r::ut::List_Remove((nw4r::ut::List*)&mFreeObjs, obj); + nw4r::ut::List_Append((nw4r::ut::List*)&mUsedObjs, obj); + } - virtual void destroy(); + void reappend(BoardObject* obj) const { + nw4r::ut::List_Remove((nw4r::ut::List*)&mUsedObjs, obj); + nw4r::ut::List_Append((nw4r::ut::List*)&mUsedObjs, obj); + } - virtual BOOL isResetAcceptable() const; - - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); - - void updateDate(const utility::Date& date); - - void focus(BoardObject* boardObject); - BOOL pinch(BoardObject* boardObject); - void pinchOff(BoardObject* boardObject); - - BOOL isOptOut() const; - - void reappend(BoardObject* boardObject); - BOOL appendRecord(CDBRecord* record); - - void stt_wait_cdb_init(); - void stt_wait_init(); - void stt_wait_child_dst(); - void stt_wait_child_cst(); - void stt_wait_scroll(); - void stt_normal(); - void stt_focus(); - - void stt_after_del(); - - void stt_init_lfadeaway(); - void stt_init_rfadeaway(); - void stt_wait_fadeaway(); - void stt_wait_stand(); - - void exec_count_task(); - - void set_text_date(); - void set_text_date(const utility::Date& date, const char* paneName); - - void get_text_jpn(const utility::Date& date, wchar_t* text, u32 textLen); - void get_text_kor(const utility::Date& date, wchar_t* text, u32 textLen); - void get_text_spa(const utility::Date& date, wchar_t* text, u32 textLen); - void get_text_ger(const utility::Date& date, wchar_t* text, u32 textLen); - void get_text_usaeng(const utility::Date& date, wchar_t* text, u32 textLen); - void get_text_usafre(const utility::Date& date, wchar_t* text, u32 textLen); - void get_text_paleng(const utility::Date& date, wchar_t* text, u32 textLen); - - void show_ricon(); - void hide_ricon(); - void show_licon(); - void hide_licon(); - - void enable_ricon(); - void disable_ricon(); - void enable_licon(); - void disable_licon(); - - void appear_arrow(); - void disappear_arrow(); - void edge_arrow(); - - void return_to_freelist(); - void return_to_freelist_if_diff_date(); - - int get_date_label(const utility::Date& date); - - void init_search_condition(); - - void set_key_table(); - void clear_key_table() { memset(&mKeyTable, 0, sizeof(mKeyTable)); set_key_table(); }; - - BOOL is_exist_diff_date() const; - - void calc_board_object(); - - void cmn_create_child(int buttonAnim); - void cmn_start_scroll_r(); - void cmn_start_scroll_l(); - void cmn_start_scroll_r_hi(const utility::Date& date); - void cmn_start_scroll_l_hi(const utility::Date& date); - void cmn_start_scroll(int animId); - - BOOL is_wait_to_clean_task() const; - BOOL is_already_read(const char* recordKey) const; - BOOL is_exist_keytbl(const char* recordKey) const; - - void after_backup(); - - void reopen_log(); - - BoardObject* get_log_obj(); - - enum { - FRIEND_CODE_ERR_SUCCESS = 0, - FRIEND_CODE_ERR_NWC24, - FRIEND_CODE_ERR_UNAVAILABLE, - }; - - int getFriendInfo(NWC24FriendInfo* info) const; - const GXTexObj& getPictureTexObj() const; - const void* getPicture(u32* picLength) const; - int getPictureWidth() const; - int getPictureHeight() const; - - nand::LayoutFile* getLayoutFile() const { return mpLayoutFile; } - utility::Date& getDate() { return mCurrentDate; } - - bool canPlayDispSound() const { return mbPlayDispSound; } - CDBSearchDirection getSearchDirection() const { return mSearchDirection; } - - void setHoveredObj(int index, BoardObject* boardObject) { mHoveredObjs[index] = boardObject; } - BoardObject* getHoveredObj(int index) { return mHoveredObjs[index]; } - - void countMessage() { mMsgCount++; } - void clearMsgCount() { mPrevMsgCount = mMsgCount; mMsgCount = 0; } - - void doneReadTask() { mbDoReadTask = false; } - void doneReading() { mbReading = false; } - void doneDeleteTask() { mbDoTaskDelete = false; } - void doneCountTask() { mbDoCountTask = false; } - void sendNewMessageAnimCount() { mbNewMsgAnimCount = true; } - - SearchRecord& getSearchRecord() { return mSearchRecord; } + void remove(BoardObject* obj) const { + nw4r::ut::List_Remove((nw4r::ut::List*)&mUsedObjs, obj); + nw4r::ut::List_Append((nw4r::ut::List*)&mFreeObjs, obj); + } private: - enum { - STATE_WAIT_CDB_INIT = 0, - STATE_WAIT_INIT, - STATE_WAIT_CHILD_DST, - STATE_WAIT_CHILD_CST, - STATE_WAIT_SCROLL, - STATE_NORMAL, - STATE_FOCUS, - STATE_AFTER_DEL, - STATE_PINCH, - STATE_INIT_LEFT_FADEAWAY, - STATE_INIT_RIGHT_FADEAWAY, - STATE_INIT_FADEAWAY, - STATE_BACKUP, - STATE_TO_SETTINGS, - STATE_TERMINATE, - STATE_WAIT_STAND, - STATE_DONE, - }; + nw4r::ut::List mUsedObjs; // 0x00 + nw4r::ut::List mFreeObjs; // 0x04 + BoardObject mObjects[OBJECTS_ON_SCREEN]; // 0x14 + }; - static Button* get_button(); - static Arrow* get_arrow(); + int mState; // 0x60 + u32 unused_0x64; - static const int OBJECTS_ON_SCREEN = 10; + ObjList mObjList; // 0x68 - class ObjList { - public: - ObjList(); + volatile bool mbDoReadTask; // 0xD00 + volatile bool mbReading; + volatile bool mbDoTaskDelete; // 0xD02 + volatile bool mbDoCountTask; - BoardObject* getNext(BoardObject* obj = NULL) const { - return (BoardObject*)nw4r::ut::List_GetNext((nw4r::ut::List*)&mUsedObjs, obj); - } + volatile bool mbNewMsgAnimCount; // 0xD04 - BoardObject* getNextFree(BoardObject* obj = NULL) { - return (BoardObject*)nw4r::ut::List_GetNext(&mFreeObjs, obj); - } + utility::Date mCurrentDate; // 0xD08 + utility::Date mPreviousDate; // 0xD14 - int getCount() { return mUsedObjs.numObjects; } - int getFreeCount() { return mFreeObjs.numObjects;} + nand::LayoutFile* mpLayoutFile; // 0xD20 + layout::Object* mpLayoutBg; // 0xD24 + layout::Object* mpLayoutFocusBg; // 0xD28 - void append(BoardObject* obj) const { - nw4r::ut::List_Remove((nw4r::ut::List*)&mFreeObjs, obj); - nw4r::ut::List_Append((nw4r::ut::List*)&mUsedObjs, obj); - } + nand::LayoutFile* mpBalloonFile; // 0xD2C - void reappend(BoardObject* obj) const { - nw4r::ut::List_Remove((nw4r::ut::List*)&mUsedObjs, obj); - nw4r::ut::List_Append((nw4r::ut::List*)&mUsedObjs, obj); - } + BoardObject* mHoveredObjs[WPAD_MAX_CONTROLLERS]; // 0xD30 - void remove(BoardObject* obj) const { - nw4r::ut::List_Remove((nw4r::ut::List*)&mUsedObjs, obj); - nw4r::ut::List_Append((nw4r::ut::List*)&mFreeObjs, obj); - } + SearchRecord mSearchRecord_Next; // 0xD40 + SearchRecord mSearchRecord_Prev; // 0xD90 + SearchRecord mSearchRecord; // 0xDE0 - private: - nw4r::ut::List mUsedObjs; // 0x00 - nw4r::ut::List mFreeObjs; // 0x04 - BoardObject mObjects[OBJECTS_ON_SCREEN]; // 0x14 - }; + u32 mKeyTable[OBJECTS_ON_SCREEN][(CDB_RECORD_KEY_STRING_LEN / 4) + 1]; // 0xE30 - int mState; // 0x60 - u32 unused_0x64; + bool mbRIconEnable; // 0xF98 + bool mbLIconEnable; // 0xF99 - ObjList mObjList; // 0x68 + bool mbFocusMode; // 0xF9A - volatile bool mbDoReadTask; // 0xD00 - volatile bool mbReading; - volatile bool mbDoTaskDelete; // 0xD02 - volatile bool mbDoCountTask; + bool mbPlayDispSound; // 0xF9B - volatile bool mbNewMsgAnimCount; // 0xD04 + CDBSearchDirection mSearchDirection; // 0xF9C - utility::Date mCurrentDate; // 0xD08 - utility::Date mPreviousDate; // 0xD14 + focus_object* mpCurrentFocus; // 0xFA0 - nand::LayoutFile* mpLayoutFile; // 0xD20 - layout::Object* mpLayoutBg; // 0xD24 - layout::Object* mpLayoutFocusBg; // 0xD28 + int mMsgCount; // 0xFA4 + int mPrevMsgCount; // 0xFA8 - nand::LayoutFile* mpBalloonFile; // 0xD2C + BoardSD mBoardSD; // 0xFAC - BoardObject* mHoveredObjs[WPAD_MAX_CONTROLLERS]; // 0xD30 - - SearchRecord mSearchRecord_Next; // 0xD40 - SearchRecord mSearchRecord_Prev; // 0xD90 - SearchRecord mSearchRecord; // 0xDE0 - - u32 mKeyTable[OBJECTS_ON_SCREEN][(CDB_RECORD_KEY_STRING_LEN/4)+1]; // 0xE30 - - bool mbRIconEnable; // 0xF98 - bool mbLIconEnable; // 0xF99 - - bool mbFocusMode; // 0xF9A - - bool mbPlayDispSound; // 0xF9B - - CDBSearchDirection mSearchDirection; // 0xF9C - - focus_object* mpCurrentFocus; // 0xFA0 - - int mMsgCount; // 0xFA4 - int mPrevMsgCount; // 0xFA8 - - BoardSD mBoardSD; // 0xFAC - - bool unk_0xFB4; - int unk_0xFB8; - u8 unk_0xFBC[4]; + bool unk_0xFB4; + int unk_0xFB8; + u8 unk_0xFBC[4]; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_BOARD_H +#endif // IPL_SCENE_BOARD_H diff --git a/include/scene/board/iplBoardObject.h b/include/scene/board/iplBoardObject.h index 582511db..58d7f47d 100644 --- a/include/scene/board/iplBoardObject.h +++ b/include/scene/board/iplBoardObject.h @@ -3,195 +3,197 @@ #include "iplSceneUIHeader.h" -#include "system/iplNigaoe.h" #include "system/RIPL_BoardRecord.h" +#include "system/iplNigaoe.h" + #include "utility/iplCalendar.h" #include "utility/iplCapture.h" #include "iplMath.h" -#include #include +#include + namespace ipl { namespace scene { typedef struct picture { - picture() : - mpRGB565(NULL), - mpWork(NULL), - width(0), - height(0) {} + picture() : mpRGB565(NULL), mpWork(NULL), width(0), height(0) {} - u8* mpRGB565; // 0x00 - u8* mpWork; // 0x04 - s32 width; // 0x08 - s32 height; // 0x0C - GXTexObj texObj; // 0x10 + u8* mpRGB565; // 0x00 + u8* mpWork; // 0x04 + s32 width; // 0x08 + s32 height; // 0x0C + GXTexObj texObj; // 0x10 } picture; class BoardObject : public ::gui::EventHandler { + public: + BoardObject(); + + void create(nand::LayoutFile* file, u8* recordData, u32 gameCode, const CDBId& cdbId, const CDBRecordKey& recordKey, + const ipl::utility::Date& date); + void init(); + + void calc(const math::VEC2& offsetPos); + void draw(); + void update(int chan); + + void destroy(); + + virtual void onEvent(u32 compId, u32 event, void* data); + + layout::Object* getLayout() const { return mpLayout; } + + void left_away(); + void right_away(); + + BOOL get_nigaoe_name(wchar_t* name, int nameLen); + + BOOL permit_reply() const; + + u16 get_addr_type() const; + NWC24FriendAddr get_addr() const; + + void delete_record(); + void clean(); + + BOOL is_protected() const; + + void startClean() { + clean(); + mbCleaned = false; + } + + private: + void stt_create(); + void stt_make_thm(); + void stt_fadein(); + void stt_pinch(); + void stt_stand(); + + void destroy_heap(); + + void capture(); + + BOOL create_picture(picture* picture, EGG::Heap* picHeap, EGG::Heap* workHeap, u8* src, u32 srcSize); + + void reset_gui(); + + void set_thumb_text(const char* paneName, const wchar_t* thumbText); + + void start_point_event(int index, controller::Interface* con); + void start_left_event(int index); + + void change_ltrtex(layout::Object* layout, void* arcData); + void change_tex(layout::Object* layout, const char* paneName, TPLPalette* tplData, u32 tplSize); + + BOOL arc_init_handle(void* buffer, ARCHandle* handle); + + enum { + STATE_CREATE, + STATE_MAKE_THUMB, + STATE_FADE_IN, + STATE_NORMAL, + STATE_PINCH, + STATE_STAND, + }; + + enum { + TYPE_MEMO = 0, + TYPE_LETTER, + TYPE_PLAYTIME, + TYPE_MAX, + }; + + enum { + ANIM_PASTE = 0, + ANIM_FOCUS_IN, + ANIM_FOCUS_OUT, + ANIM_FOCUS, + ANIM_EXIT, + ANIM_NEXT_PAGE, + ANIM_NEW, + ANIM_DEFAULT, + ANIM_SD, + ANIM_MAX, + }; + + public: + nw4r::ut::Link mLinkNode; // 0x0C + + private: + layout::Object* mpLayout; // 0x14 + gui::PaneManager* mpGui; // 0x18 + nand::LayoutFile* mpLayoutFile; // 0x1C + + nigaoe::Object* mpNigaoe; // 0x20 + + u8* mpRecordData; // 0x24 + + u8* mpThumbPtr; // 0x28 + u8* mpUncompThumb; // 0x2C + u32 mpThumbLength; // 0x30 + + math::VEC2 mBoardPos; // 0x34 + math::VEC2 mMoveSpeed; // 0x3C + math::LinearIntp mMoveAnim; // 0x44 + + CDBId mCDBId; // 0x74 + u8 unk_0x7C[4]; + CDBRecordKey mCDBRecordKey; // 0x80 + u32 mCDBGameCode; // 0xB0 + + utility::Date mBoardDate; // 0xB4 + + u8* mpHeapArena; // 0xC0 + EGG::Heap* mpHeap; // 0xC4 + EGG::Allocator* mpAllocator; // 0xC8 + + bool mbModifiedPos; // 0xCC + bool mbCleaned; // 0xCD + bool mbCreatedPic; // 0xCE + bool mbRightWay; // 0xCF + bool mbLeftWay; // 0xD0 + BOOL mbHovered; // 0xD4 + int mLetterType; // 0xD8 + RBRRecordType mRecordType; // 0xDC + u32 mOptOutFlag; // 0xE0 + + class { public: - BoardObject(); + void init() { + unk_0x0C = -1; + pos.x = 0.0f; + pos.y = 0.0f; + } - void create(nand::LayoutFile* file, u8* recordData, u32 gameCode, const CDBId& cdbId, const CDBRecordKey& recordKey, const ipl::utility::Date& date); - void init(); + math::VEC2 pos; // pos + int unk_0x08; + int unk_0x0C; + } mStandData; // 0xE4 - void calc(const math::VEC2& offsetPos); - void draw(); - void update(int chan); + picture mPicture; // 0xF4 + utility::Capture* mpCapture; // 0x124 + bool mbCaptured; // 0x128 - void destroy(); + int mState; // 0x12C + math::VEC2 mConPos; // 0x130 + int mConChan; // 0x138 + u8 unk_0x13C[4]; - virtual void onEvent(u32 compId, u32 event, void* data); + static const char* mAnimNames[TYPE_MAX][1 + ANIM_MAX]; - layout::Object* getLayout() const { return mpLayout; } + static const int THUMB_TEXT_LENGTH = 6; - void left_away(); - void right_away(); + static const OSTime NEW_MESSAGE_DURATION_SECONDS = 6 * 60 * 60; // 6 hours - BOOL get_nigaoe_name(wchar_t* name, int nameLen); - - BOOL permit_reply() const; - - u16 get_addr_type() const; - NWC24FriendAddr get_addr() const; - - void delete_record(); - void clean(); - - BOOL is_protected() const; - - void startClean() { clean(); mbCleaned = false; } - - private: - void stt_create(); - void stt_make_thm(); - void stt_fadein(); - void stt_pinch(); - void stt_stand(); - - void destroy_heap(); - - void capture(); - - BOOL create_picture(picture* picture, EGG::Heap* picHeap, EGG::Heap* workHeap, u8* src, u32 srcSize); - - void reset_gui(); - - void set_thumb_text(const char* paneName, const wchar_t* thumbText); - - void start_point_event(int index, controller::Interface* con); - void start_left_event(int index); - - void change_ltrtex(layout::Object* layout, void* arcData); - void change_tex(layout::Object* layout, const char* paneName, TPLPalette* tplData, u32 tplSize); - - BOOL arc_init_handle(void* buffer, ARCHandle* handle); - - enum { - STATE_CREATE, - STATE_MAKE_THUMB, - STATE_FADE_IN, - STATE_NORMAL, - STATE_PINCH, - STATE_STAND, - }; - - enum { - TYPE_MEMO = 0, - TYPE_LETTER, - TYPE_PLAYTIME, - TYPE_MAX, - }; - - enum { - ANIM_PASTE = 0, - ANIM_FOCUS_IN, - ANIM_FOCUS_OUT, - ANIM_FOCUS, - ANIM_EXIT, - ANIM_NEXT_PAGE, - ANIM_NEW, - ANIM_DEFAULT, - ANIM_SD, - ANIM_MAX, - }; - - public: - nw4r::ut::Link mLinkNode; // 0x0C - - private: - layout::Object* mpLayout; // 0x14 - gui::PaneManager* mpGui; // 0x18 - nand::LayoutFile* mpLayoutFile; // 0x1C - - nigaoe::Object* mpNigaoe; // 0x20 - - u8* mpRecordData; // 0x24 - - u8* mpThumbPtr; // 0x28 - u8* mpUncompThumb; // 0x2C - u32 mpThumbLength; // 0x30 - - math::VEC2 mBoardPos; // 0x34 - math::VEC2 mMoveSpeed; // 0x3C - math::LinearIntp mMoveAnim; // 0x44 - - CDBId mCDBId; // 0x74 - u8 unk_0x7C[4]; - CDBRecordKey mCDBRecordKey; // 0x80 - u32 mCDBGameCode; // 0xB0 - - utility::Date mBoardDate; // 0xB4 - - u8* mpHeapArena; // 0xC0 - EGG::Heap* mpHeap; // 0xC4 - EGG::Allocator* mpAllocator; // 0xC8 - - bool mbModifiedPos; // 0xCC - bool mbCleaned; // 0xCD - bool mbCreatedPic; // 0xCE - bool mbRightWay; // 0xCF - bool mbLeftWay; // 0xD0 - BOOL mbHovered; // 0xD4 - int mLetterType; // 0xD8 - RBRRecordType mRecordType; // 0xDC - u32 mOptOutFlag; // 0xE0 - - class { - public: - void init() { - unk_0x0C = -1; - pos.x = 0.0f; - pos.y = 0.0f; - } - - math::VEC2 pos; // pos - int unk_0x08; - int unk_0x0C; - } mStandData; // 0xE4 - - picture mPicture; // 0xF4 - utility::Capture* mpCapture; // 0x124 - bool mbCaptured; // 0x128 - - int mState; // 0x12C - math::VEC2 mConPos; // 0x130 - int mConChan; // 0x138 - u8 unk_0x13C[4]; - - static const char* mAnimNames[TYPE_MAX][1+ANIM_MAX]; - - static const int THUMB_TEXT_LENGTH = 6; - - static const OSTime NEW_MESSAGE_DURATION_SECONDS = 6 * 60 * 60; // 6 hours - - friend class button_event; - friend class focus_object; - friend class Board; + friend class button_event; + friend class focus_object; + friend class Board; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_BOARD_OBJECT_H +#endif // IPL_SCENE_BOARD_OBJECT_H diff --git a/include/scene/board/iplBoardSD.h b/include/scene/board/iplBoardSD.h index b1fcd795..fe5298f1 100644 --- a/include/scene/board/iplBoardSD.h +++ b/include/scene/board/iplBoardSD.h @@ -6,28 +6,28 @@ namespace ipl { namespace scene { class BoardSD { - public: - BoardSD(); - void update(); + public: + BoardSD(); + void update(); - u32 getSDState() { return mSDState; } + u32 getSDState() { return mSDState; } - void setState(u32 state) { mState = state; } + void setState(u32 state) { mState = state; } - private: - enum { - STATE_PREPARE = 0, - STATE_PREPARE_RESULT, - STATE_CLEANUP, - STATE_CLEANUP_RESULT, - }; + private: + enum { + STATE_PREPARE = 0, + STATE_PREPARE_RESULT, + STATE_CLEANUP, + STATE_CLEANUP_RESULT, + }; - void error_handling(int code); + void error_handling(int code); - u32 mState; // 0x00 - u32 mSDState; // 0x04 + u32 mState; // 0x00 + u32 mSDState; // 0x04 }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_BOARD_SD_H +#endif // IPL_SCENE_BOARD_SD_H diff --git a/include/scene/board/iplFocusObject.h b/include/scene/board/iplFocusObject.h index b40549dc..03410a5f 100644 --- a/include/scene/board/iplFocusObject.h +++ b/include/scene/board/iplFocusObject.h @@ -15,395 +15,387 @@ namespace ipl { class focus_object; class event : public ::gui::EventHandler { - public: - event(focus_object* instance) : - ::gui::EventHandler(), - mpInstance(instance) {} + public: + event(focus_object* instance) : ::gui::EventHandler(), mpInstance(instance) {} - virtual void onEvent(u32 compId, u32 event, void* data); + virtual void onEvent(u32 compId, u32 event, void* data); - private: - focus_object* mpInstance; // 0x0C + private: + focus_object* mpInstance; // 0x0C }; class button_event : public ButtonEventHandlerBase { - public: - button_event(focus_object* instance) : - ButtonEventHandlerBase(), - mpInstance(instance) {} + public: + button_event(focus_object* instance) : ButtonEventHandlerBase(), mpInstance(instance) {} - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); + virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); - private: - focus_object* mpInstance; // 0x0C + private: + focus_object* mpInstance; // 0x0C }; class optout_button_event : public OptOutButtonEventHandlerBase { - public: - optout_button_event(focus_object* instance) : - OptOutButtonEventHandlerBase(), - mpInstance(instance) {} + public: + optout_button_event(focus_object* instance) : OptOutButtonEventHandlerBase(), mpInstance(instance) {} - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); + virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); - private: - focus_object* mpInstance; // 0x0C + private: + focus_object* mpInstance; // 0x0C }; class scroller { - public: - scroller() : - mScroller(), - mBScroller() {} + public: + scroller() : mScroller(), mBScroller() {} - void init() { - mScroller.init(); - mBScroller.init(); - } + void init() { + mScroller.init(); + mBScroller.init(); + } - BOOL calc(bool canScroll) __attribute__((never_inline)) /*for now*/ { - BOOL result = FALSE; + BOOL calc(bool canScroll) __attribute__((never_inline)) /*for now*/ { + BOOL result = FALSE; - if (canScroll) { - if (mBScroller.calc()) { - result = TRUE; - } + if (canScroll) { + if (mBScroller.calc()) { + result = TRUE; } - - mScroller.calc(); - - f32 movable = mScroller.movable_pos(mBScroller.getSpeed()); - - mScroller.addScroll(movable); - mBScroller.addSoundFreq(movable); - - return result; } - BOOL is_busy() const { - BOOL result = TRUE; - if (mScroller.isActive()) { - if (mBScroller.isActive() ? false : true) { - // Scroller is busy. - result = FALSE; - } + mScroller.calc(); + + f32 movable = mScroller.movable_pos(mBScroller.getSpeed()); + + mScroller.addScroll(movable); + mBScroller.addSoundFreq(movable); + + return result; + } + + BOOL is_busy() const { + BOOL result = TRUE; + if (mScroller.isActive()) { + if (mBScroller.isActive() ? false : true) { + // Scroller is busy. + result = FALSE; } - // Scroller is not busy. - return result; } + // Scroller is not busy. + return result; + } - const utility::BScroller& getBInst() { return mBScroller; } + const utility::BScroller& getBInst() { return mBScroller; } - bool isDownEnd() const { return mScroller.isDownEnd(); } - bool isUpEnd() const { return mScroller.isUpEnd(); } + bool isDownEnd() const { return mScroller.isDownEnd(); } + bool isUpEnd() const { return mScroller.isUpEnd(); } - /* utility::Scroller wrappers */ + /* utility::Scroller wrappers */ - void scrollUpByCon() { mScroller.scrollUpByCon(); } - void scrollDownByCon() { mScroller.scrollDownByCon(); } - void scrollUpByBtn() { mScroller.scrollUpByBtn(); } - void scrollDownByBtn() { mScroller.scrollDownByBtn(); } + void scrollUpByCon() { mScroller.scrollUpByCon(); } + void scrollDownByCon() { mScroller.scrollDownByCon(); } + void scrollUpByBtn() { mScroller.scrollUpByBtn(); } + void scrollDownByBtn() { mScroller.scrollDownByBtn(); } - void setDownLimit(f32 v) { mScroller.setDownLimit(v); } - void setUpLimit(f32 v) { mScroller.setUpLimit(v); } + void setDownLimit(f32 v) { mScroller.setDownLimit(v); } + void setUpLimit(f32 v) { mScroller.setUpLimit(v); } - bool isActive() const { return mScroller.isActive(); } + bool isActive() const { return mScroller.isActive(); } - f32 get() { return mScroller.get(); } + f32 get() { return mScroller.get(); } - private: - utility::Scroller mScroller; // 0x50 - utility::BScroller mBScroller; // 0x50 + private: + utility::Scroller mScroller; // 0x50 + utility::BScroller mBScroller; // 0x50 }; class focus_object { - public: - typedef enum { - RESULT_NONE = 0, - RESULT_CLOSE, - RESULT_CLOSE_DEL, - RESULT_CLOSE_AFTER, - RESULT_CLOSE_AFTER_DEL, - RESULT_CHJUMP, - RESULT_REPLY, - RESULT_SEND_PICTURE, - RESULT_INTERNET_SETTING, - RESULT_INTERNET_PAGE, - RESULT_SW_UPDATE, - RESULT_PARENTAL_REQ, - } result; - - focus_object(nand::LayoutFile*, nand::LayoutFile*, BoardObject*); - ~focus_object(); - - result calc(); - void draw(); + public: + typedef enum { + RESULT_NONE = 0, + RESULT_CLOSE, + RESULT_CLOSE_DEL, + RESULT_CLOSE_AFTER, + RESULT_CLOSE_AFTER_DEL, + RESULT_CHJUMP, + RESULT_REPLY, + RESULT_SEND_PICTURE, + RESULT_INTERNET_SETTING, + RESULT_INTERNET_PAGE, + RESULT_SW_UPDATE, + RESULT_PARENTAL_REQ, + } result; + + focus_object(nand::LayoutFile*, nand::LayoutFile*, BoardObject*); + ~focus_object(); + + result calc(); + void draw(); - void show_uarw(); - void show_darw(); - void hide_uarw(); - void hide_darw(); + void show_uarw(); + void show_darw(); + void hide_uarw(); + void hide_darw(); - void show_or_hide_arw(bool showUArw, bool showDArw, bool hideUArw, bool hideDArw); - - void scale_up_uarw(); - void scale_up_darw(); - void scale_down_uarw(); - void scale_down_darw(); - - void scale_up_or_down_arw(); - - void show_cmn_btn(); - void hide_cmn_btn(); - - private: - void cmn_calc(); - - void stt_normal(); - void stt_fadeout(); - void stt_wait_btn(); - void stt_wait_msg(); - void stt_del_wait_msg(); - void stt_del_wait_delete(); - void stt_pic_fadein(); - void stt_pic_normal(); - void stt_pic_fadeout(); - void stt_ltr_wait_net(); - void stt_ltr_wait_ltr_scene(); - void stt_chn_wait_url_jump_msg(); - void stt_chn_wait_jump(); - void stt_opt_wait_select_msg(); - void stt_opt_wait_stop_msg(); - void stt_opt_wait_all_stop_msg(); - void stt_opt_delete_task(); - void stt_opt_delete_all_task(); - void stt_opt_wait_confirm_msg(); - void stt_net_wait_net_setting_msg(); - void stt_net_wait_nwc_setting_msg(); - void stt_net_wait_parental_scene(); - void stt_net_wait_parental_scene_dst(); - - void proc_input(); - void proc_url_jump(); - - BOOL is_finished_fadein() const; - BOOL is_finished_fadeout() const; - - void init_normal(); - void init_fadeout(bool keepBtn); - - void make_layout(nand::LayoutFile* layoutFile); - void make_gui_mgr(); - void make_parsed_text(const wchar_t* inText); - - BOOL is_url_end_code(wchar_t ch) const; - BOOL is_url_protocol(const wchar_t* url) const; - int get_url_end(const wchar_t* url) const; - - BOOL is_buffer_over(const wchar_t* text, u32 textLen) const; - - void check_paren(wchar_t ch); - - void make_lettertex(RBRAttachment* attach); - void init_chanjump(RBRAttachment* attach); - - BOOL setup_chanjump(); - void change_ltrtex(); - - void make_picture(RBRAttachment* attach); - void init_sound(RBRAttachment* attach); - - void resize_pane(nw4r::lyt::Pane* pane); - - void init(nand::LayoutFile* layoutFile); - - void init_balloon(nand::LayoutFile* layoutFile); - math::VEC3 calc_balloon_pos() const; - - void init_scroller(); - void init_url_proc(); - - void start_point_event(int btnNo, controller::Interface* con); - void start_left_event(int btnNo); - void start_trig_event(int btnNo); - - int get_button_no(const char* paneName) const; - - void reset_gui(int btnNo, int anim); - - int check_network(); - void check_network_for_news(); - - void set_err_msg(wchar_t* outErrMsg, u32 outErrMsgLen, u32 errMsgId, s32 nwc24Err); - BOOL is_parental_restriction() const; - - void check_delete_task_failure(); - - static Button* get_button(); - - enum { - STATE_NONE = -1, - STATE_INIT_NORMAL, - STATE_NORMAL, - STATE_FADE_OUT, - STATE_WAIT_BTN, - STATE_WAIT_MSG, - STATE_DEL_WAIT_MSG, - STATE_DEL_WAIT_DELETE, - STATE_PIC_FADE_IN, - STATE_PIC_NORMAL, - STATE_PIC_FADE_OUT, - STATE_LETTER_WAIT_NET, - STATE_LETTER_WAIT_SCENE, - STATE_CHN_WAIT_MSG, - STATE_CHN_WAIT_JUMP, - STATE_OPT_WAIT_SELECT_MSG, - STATE_OPT_WAIT_STOP_MSG, - STATE_OPT_WAIT_ALL_STOP_MSG, - STATE_OPT_DELETE_TASK, - STATE_OPT_DELETE_ALL_TASK, - STATE_OPT_WAIT_CONFIRM_MSG, - STATE_NET_WAIT_NET_MSG, - STATE_NET_WAIT_NWC_MSG, - STATE_NET_WAIT_PARENTAL, - STATE_NET_WAIT_PARENTAL_DST, - STATE_DONE, - }; - - enum { - ANIM_SELECT = 0, - ANIM_EXIT, - - ANIM_ARROW_LOOP, - ANIM_ARROW_FOCUS_ON, - ANIM_ARROW_FOCUS_OFF, - ANIM_ARROW_SELECT, - ANIM_ARROW_APPEAR, - ANIM_ARROW_LOST, - ANIM_ARROW_HD_AC_START, - ANIM_ARROW_HD_AC_END, - ANIM_ARROW_MAX, - - ANIM_ARROW_RIGHT_LOOP = ANIM_ARROW_LOOP, - ANIM_ARROW_RIGHT_FOCUS_ON, - ANIM_ARROW_RIGHT_FOCUS_OFF, - ANIM_ARROW_RIGHT_SELECT, - ANIM_ARROW_RIGHT_APPEAR, - ANIM_ARROW_RIGHT_LOST, - ANIM_ARROW_RIGHT_HD_AC_START, - ANIM_ARROW_RIGHT_HD_AC_END, + void show_or_hide_arw(bool showUArw, bool showDArw, bool hideUArw, bool hideDArw); + + void scale_up_uarw(); + void scale_up_darw(); + void scale_down_uarw(); + void scale_down_darw(); + + void scale_up_or_down_arw(); + + void show_cmn_btn(); + void hide_cmn_btn(); + + private: + void cmn_calc(); + + void stt_normal(); + void stt_fadeout(); + void stt_wait_btn(); + void stt_wait_msg(); + void stt_del_wait_msg(); + void stt_del_wait_delete(); + void stt_pic_fadein(); + void stt_pic_normal(); + void stt_pic_fadeout(); + void stt_ltr_wait_net(); + void stt_ltr_wait_ltr_scene(); + void stt_chn_wait_url_jump_msg(); + void stt_chn_wait_jump(); + void stt_opt_wait_select_msg(); + void stt_opt_wait_stop_msg(); + void stt_opt_wait_all_stop_msg(); + void stt_opt_delete_task(); + void stt_opt_delete_all_task(); + void stt_opt_wait_confirm_msg(); + void stt_net_wait_net_setting_msg(); + void stt_net_wait_nwc_setting_msg(); + void stt_net_wait_parental_scene(); + void stt_net_wait_parental_scene_dst(); + + void proc_input(); + void proc_url_jump(); + + BOOL is_finished_fadein() const; + BOOL is_finished_fadeout() const; + + void init_normal(); + void init_fadeout(bool keepBtn); + + void make_layout(nand::LayoutFile* layoutFile); + void make_gui_mgr(); + void make_parsed_text(const wchar_t* inText); + + BOOL is_url_end_code(wchar_t ch) const; + BOOL is_url_protocol(const wchar_t* url) const; + int get_url_end(const wchar_t* url) const; + + BOOL is_buffer_over(const wchar_t* text, u32 textLen) const; + + void check_paren(wchar_t ch); + + void make_lettertex(RBRAttachment* attach); + void init_chanjump(RBRAttachment* attach); + + BOOL setup_chanjump(); + void change_ltrtex(); + + void make_picture(RBRAttachment* attach); + void init_sound(RBRAttachment* attach); + + void resize_pane(nw4r::lyt::Pane* pane); + + void init(nand::LayoutFile* layoutFile); + + void init_balloon(nand::LayoutFile* layoutFile); + math::VEC3 calc_balloon_pos() const; + + void init_scroller(); + void init_url_proc(); + + void start_point_event(int btnNo, controller::Interface* con); + void start_left_event(int btnNo); + void start_trig_event(int btnNo); + + int get_button_no(const char* paneName) const; + + void reset_gui(int btnNo, int anim); + + int check_network(); + void check_network_for_news(); + + void set_err_msg(wchar_t* outErrMsg, u32 outErrMsgLen, u32 errMsgId, s32 nwc24Err); + BOOL is_parental_restriction() const; + + void check_delete_task_failure(); + + static Button* get_button(); + + enum { + STATE_NONE = -1, + STATE_INIT_NORMAL, + STATE_NORMAL, + STATE_FADE_OUT, + STATE_WAIT_BTN, + STATE_WAIT_MSG, + STATE_DEL_WAIT_MSG, + STATE_DEL_WAIT_DELETE, + STATE_PIC_FADE_IN, + STATE_PIC_NORMAL, + STATE_PIC_FADE_OUT, + STATE_LETTER_WAIT_NET, + STATE_LETTER_WAIT_SCENE, + STATE_CHN_WAIT_MSG, + STATE_CHN_WAIT_JUMP, + STATE_OPT_WAIT_SELECT_MSG, + STATE_OPT_WAIT_STOP_MSG, + STATE_OPT_WAIT_ALL_STOP_MSG, + STATE_OPT_DELETE_TASK, + STATE_OPT_DELETE_ALL_TASK, + STATE_OPT_WAIT_CONFIRM_MSG, + STATE_NET_WAIT_NET_MSG, + STATE_NET_WAIT_NWC_MSG, + STATE_NET_WAIT_PARENTAL, + STATE_NET_WAIT_PARENTAL_DST, + STATE_DONE, + }; + + enum { + ANIM_SELECT = 0, + ANIM_EXIT, + + ANIM_ARROW_LOOP, + ANIM_ARROW_FOCUS_ON, + ANIM_ARROW_FOCUS_OFF, + ANIM_ARROW_SELECT, + ANIM_ARROW_APPEAR, + ANIM_ARROW_LOST, + ANIM_ARROW_HD_AC_START, + ANIM_ARROW_HD_AC_END, + ANIM_ARROW_MAX, + + ANIM_ARROW_RIGHT_LOOP = ANIM_ARROW_LOOP, + ANIM_ARROW_RIGHT_FOCUS_ON, + ANIM_ARROW_RIGHT_FOCUS_OFF, + ANIM_ARROW_RIGHT_SELECT, + ANIM_ARROW_RIGHT_APPEAR, + ANIM_ARROW_RIGHT_LOST, + ANIM_ARROW_RIGHT_HD_AC_START, + ANIM_ARROW_RIGHT_HD_AC_END, - ANIM_ARROW_LEFT_LOOP, - ANIM_ARROW_LEFT_FOCUS_ON, - ANIM_ARROW_LEFT_FOCUS_OFF, - ANIM_ARROW_LEFT_SELECT, - ANIM_ARROW_LEFT_APPEAR, - ANIM_ARROW_LEFT_LOST, - ANIM_ARROW_LEFT_HC_AC_START, - ANIM_ARROW_LEFT_HC_AC_END, + ANIM_ARROW_LEFT_LOOP, + ANIM_ARROW_LEFT_FOCUS_ON, + ANIM_ARROW_LEFT_FOCUS_OFF, + ANIM_ARROW_LEFT_SELECT, + ANIM_ARROW_LEFT_APPEAR, + ANIM_ARROW_LEFT_LOST, + ANIM_ARROW_LEFT_HC_AC_START, + ANIM_ARROW_LEFT_HC_AC_END, - ANIM_LETTER_REPLY, - ANIM_LETTER_REPLY_BACK, - ANIM_LETTER_PIC_REPLY, - ANIM_LETTER_PIC_REPLY_BACK, - ANIM_LETTER_PIC_FOCUS_IN, - ANIM_LETTER_PIC_FOCUS_OUT, - ANIM_LETTER_SELECT_PIC, - ANIM_LETTER_EXIT_PIC, - }; - - enum { - BTN_ARROW_RIGHT = 0, - BTN_ARROW_LEFT, - BTN_PICTURE, - BTN_NIGAOE, - BTN_MAX, - }; - - enum { - NETWORK_RESULT_FAIL = 0, - NETWORK_RESULT_SUCCESS, - NETWORK_RESULT_ERROR, - }; - - int mState; // 0x00 - - // these may be incorrect - int mNextState; // 0x04 - int mPrevState; // 0x08 - - result mFinalResult; // 0x0C - result mCurrentResult; // 0x10 - - BoardObject* mpBoardObj; // 0x14 - - layout::Object* mpLayout; // 0x18 - gui::PaneManager* mpGui; // 0x1C - TextBalloon* mpNigaoeBalloon; // 0x20 - - wchar_t* mpParsedText; // 0x24 - - event mEvent; // 0x28 - button_event mButtonEvent; // 0x38 - optout_button_event mOptOutEvent; // 0x48 - - scroller mScroller; // 0x58 - picture mPicture; // 0xC8 - - int unk_0xF8; - u8 unk_0xFC; - - EGG::Allocator mGUIAlloc; // 0x100 - - wchar_t unk_0x114[6]; - - u8* mpCmpArcData; // 0x120 - u8* mpArcData; // 0x124 - u32 mArcLength; // 0x128 - - bool mbChanJump; // 0x12C - NWC24CHJumpObj* mpChJpData; // 0x130 + ANIM_LETTER_REPLY, + ANIM_LETTER_REPLY_BACK, + ANIM_LETTER_PIC_REPLY, + ANIM_LETTER_PIC_REPLY_BACK, + ANIM_LETTER_PIC_FOCUS_IN, + ANIM_LETTER_PIC_FOCUS_OUT, + ANIM_LETTER_SELECT_PIC, + ANIM_LETTER_EXIT_PIC, + }; + + enum { + BTN_ARROW_RIGHT = 0, + BTN_ARROW_LEFT, + BTN_PICTURE, + BTN_NIGAOE, + BTN_MAX, + }; + + enum { + NETWORK_RESULT_FAIL = 0, + NETWORK_RESULT_SUCCESS, + NETWORK_RESULT_ERROR, + }; + + int mState; // 0x00 + + // these may be incorrect + int mNextState; // 0x04 + int mPrevState; // 0x08 + + result mFinalResult; // 0x0C + result mCurrentResult; // 0x10 + + BoardObject* mpBoardObj; // 0x14 + + layout::Object* mpLayout; // 0x18 + gui::PaneManager* mpGui; // 0x1C + TextBalloon* mpNigaoeBalloon; // 0x20 + + wchar_t* mpParsedText; // 0x24 + + event mEvent; // 0x28 + button_event mButtonEvent; // 0x38 + optout_button_event mOptOutEvent; // 0x48 + + scroller mScroller; // 0x58 + picture mPicture; // 0xC8 + + int unk_0xF8; + u8 unk_0xFC; + + EGG::Allocator mGUIAlloc; // 0x100 + + wchar_t unk_0x114[6]; + + u8* mpCmpArcData; // 0x120 + u8* mpArcData; // 0x124 + u32 mArcLength; // 0x128 + + bool mbChanJump; // 0x12C + NWC24CHJumpObj* mpChJpData; // 0x130 - u8* mpSoundData; // 0x134 - u32 mSoundSize; // 0x138 - bool mbSoundPlaying; // 0x13C + u8* mpSoundData; // 0x134 + u32 mSoundSize; // 0x138 + bool mbSoundPlaying; // 0x13C - utility::timer mSoundStopTimer; // 0x140 - utility::timer mSoundTimer; // 0x148 + utility::timer mSoundStopTimer; // 0x140 + utility::timer mSoundTimer; // 0x148 - UrlProcessor mURLProc; // 0x150 + UrlProcessor mURLProc; // 0x150 - bool mbHoveredURL[WPAD_MAX_CONTROLLERS]; // 0x1A4 + bool mbHoveredURL[WPAD_MAX_CONTROLLERS]; // 0x1A4 - math::LinearIntp mFadeAnim; // 0x1A8 + math::LinearIntp mFadeAnim; // 0x1A8 - BOOL mbHovered[BTN_MAX]; // 0x1E0 + BOOL mbHovered[BTN_MAX]; // 0x1E0 - int mLineCount; // 0x1F0 - int mNwc24ErrCountdown; // 0x1F4 - int mChanJumpCountdown; // 0x1F8 + int mLineCount; // 0x1F0 + int mNwc24ErrCountdown; // 0x1F4 + int mChanJumpCountdown; // 0x1F8 - bool mbShowUArw; // 0x1FC - bool mbShowDArw; // 0x1FD + bool mbShowUArw; // 0x1FC + bool mbShowDArw; // 0x1FD - bool mbScaleUArw; // 0x1FE - bool mbScaleDArw; // 0x1FF + bool mbScaleUArw; // 0x1FE + bool mbScaleDArw; // 0x1FF - bool mbParentalSuccess; // 0x200 + bool mbParentalSuccess; // 0x200 - undefined unused_0x201[0x07]; + undefined unused_0x201[0x07]; - static const char* mAnimNames[BoardObject::TYPE_MAX][1+ANIM_ARROW_MAX]; - static const char* mscButtonName[BTN_MAX]; + static const char* mAnimNames[BoardObject::TYPE_MAX][1 + ANIM_ARROW_MAX]; + static const char* mscButtonName[BTN_MAX]; - static const int PARSED_TEXT_LENGTH = 6000; + static const int PARSED_TEXT_LENGTH = 6000; - friend class Board; - friend class event; - friend class button_event; - friend class optout_button_event; + friend class Board; + friend class event; + friend class button_event; + friend class optout_button_event; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_FOCUS_OBJECT_H +#endif // IPL_SCENE_FOCUS_OBJECT_H diff --git a/include/scene/board/iplUrlProcessor.h b/include/scene/board/iplUrlProcessor.h index 7ea71715..d857c39c 100644 --- a/include/scene/board/iplUrlProcessor.h +++ b/include/scene/board/iplUrlProcessor.h @@ -3,89 +3,87 @@ #include -#include -#include -#include #include +#include +#include +#include + #include namespace ipl { namespace scene { class UrlProcessor : public nw4r::ut::WideTagProcessor { + public: + class line_collision { public: - class line_collision { - public: - line_collision() : - unk_0x00(0.0f), - unk_0x04(0.0f), - unk_0x08(0.0f) {} + line_collision() : unk_0x00(0.0f), unk_0x04(0.0f), unk_0x08(0.0f) {} - f32 unk_0x00; - f32 unk_0x04; - f32 unk_0x08; - nw4r::ut::Link mLinkList; // 0x0C - }; + f32 unk_0x00; + f32 unk_0x04; + f32 unk_0x08; + nw4r::ut::Link mLinkList; // 0x0C + }; - class url_collision { - public: - url_collision(); - ~url_collision(); + class url_collision { + public: + url_collision(); + ~url_collision(); - int unk_0x00; - wchar_t* unk_0x04; - wchar_t* unk_0x08; - nw4r::ut::Link mLinkList; // 0x0C - nw4r::ut::List mLineCollisions; // 0x14 - }; + int unk_0x00; + wchar_t* unk_0x04; + wchar_t* unk_0x08; + nw4r::ut::Link mLinkList; // 0x0C + nw4r::ut::List mLineCollisions; // 0x14 + }; - UrlProcessor(); + UrlProcessor(); - nw4r::ut::Operation Process(u16 code, nw4r::ut::PrintContext* context); + nw4r::ut::Operation Process(u16 code, nw4r::ut::PrintContext* context); - void init(); - void update(); + void init(); + void update(); - void destroy(); + void destroy(); - void clear_prev_drawing(); + void clear_prev_drawing(); - void make_collision(nw4r::ut::PrintContext* context, u16 code); - void parse(nw4r::ut::PrintContext* context); + void make_collision(nw4r::ut::PrintContext* context, u16 code); + void parse(nw4r::ut::PrintContext* context); - BOOL is_focused() const; - void select(int unk); + BOOL is_focused() const; + void select(int unk); - int get_focused_tagno(int chan) const; - url_collision* get_selected_col(); + int get_focused_tagno(int chan) const; + url_collision* get_selected_col(); - void get_url(char* urlOut, u32 urlLen); + void get_url(char* urlOut, u32 urlLen); - void setUnk_0x40(f32 val) { unk_0x40 = val; } - void setUnk_0x44(f32 val) { unk_0x44 = val; } - void setUnk_0x53(bool val) { unk_0x53 = val; } + void setUnk_0x40(f32 val) { unk_0x40 = val; } + void setUnk_0x44(f32 val) { unk_0x44 = val; } + void setUnk_0x53(bool val) { unk_0x53 = val; } - u8 getUnk_0x50() const { return unk_0x50; } - void setUnk_0x50(u8 val) { unk_0x50 = val; } + u8 getUnk_0x50() const { return unk_0x50; } + void setUnk_0x50(u8 val) { unk_0x50 = val; } - private: - typedef struct { - nw4r::math::VEC2 pos; - bool valid; - } con_data; + private: + typedef struct { + nw4r::math::VEC2 pos; + bool valid; + } con_data; - con_data mConData[WPAD_MAX_CONTROLLERS]; // 0x00 - nw4r::ut::List mUrlCollisions; // 0x34 - f32 unk_0x40; - f32 unk_0x44; - int unk_0x48; - int unk_0x4C; - u8 unk_0x50; - u8 unk_0x51; - u8 unk_0x52; - u8 unk_0x53; + con_data mConData[WPAD_MAX_CONTROLLERS]; // 0x00 + nw4r::ut::List mUrlCollisions; // 0x34 + f32 unk_0x40; + f32 unk_0x44; + int unk_0x48; + int unk_0x4C; + u8 unk_0x50; + u8 unk_0x51; + u8 unk_0x52; + u8 unk_0x53; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_URL_PROCESSOR_H +#endif // IPL_SCENE_URL_PROCESSOR_H diff --git a/include/scene/button/iplButton.h b/include/scene/button/iplButton.h index 5edf2b92..c6bc248a 100644 --- a/include/scene/button/iplButton.h +++ b/include/scene/button/iplButton.h @@ -7,8 +7,8 @@ #include "scene/textBalloon/iplBalloon.h" -#include "utility/iplTimer.h" #include "utility/iplQueue.h" +#include "utility/iplTimer.h" namespace ipl { namespace scene { @@ -19,382 +19,377 @@ namespace ipl { /* Arrow Button */ SCENE_CLASS(Arrow) { - public: - Arrow(EGG::Heap* heap) : Base(heap) {} + public: + Arrow(EGG::Heap * heap) : Base(heap) { + } - virtual void draw(); + virtual void draw(); }; /* Opt Out Button */ class OptOutButton { - public: - enum { - ANIM_BTN_IN = 0, - ANIM_BTN_OUT, - ANIM_OPT_OUT_FOCUS_IN, - ANIM_OPT_OUT_FOCUS_OUT, - ANIM_BTN_SELECT, - }; + public: + enum { + ANIM_BTN_IN = 0, + ANIM_BTN_OUT, + ANIM_OPT_OUT_FOCUS_IN, + ANIM_OPT_OUT_FOCUS_OUT, + ANIM_BTN_SELECT, + }; - OptOutButton(); + OptOutButton(); - void create(nand::LayoutFile* layoutFile, EGG::Heap* heap); + void create(nand::LayoutFile* layoutFile, EGG::Heap* heap); - void calc(); - void draw(); - void update(); + void calc(); + void draw(); + void update(); - void setText(u32 msgId); - void reset_gui(); + void setText(u32 msgId); + void reset_gui(); - void start_point_event(const char* paneName, controller::Interface* con); - void start_left_event(const char* paneName); + void start_point_event(const char* paneName, controller::Interface* con); + void start_left_event(const char* paneName); - void setEventHandler(::gui::EventHandler* event); + void setEventHandler(::gui::EventHandler* event); - protected: - enum { - BTN_OPT_OUT = 0, - BTN_MAX, - }; + protected: + enum { + BTN_OPT_OUT = 0, + BTN_MAX, + }; - layout::Object* mpLayout; // 0x00 - gui::PaneManager* mpGui; // 0x04 + layout::Object* mpLayout; // 0x00 + gui::PaneManager* mpGui; // 0x04 - BOOL mbHovered; // 0x08 + BOOL mbHovered; // 0x08 - friend class Button; + friend class Button; }; /* SD Card Menu Button */ class SDMenuButton { - public: - enum { - IDANIM_ON_LOOP = 0, - IDANIM_BTN_IN, - IDANIM_BTN_OUT, - IDANIM_BTN_INSERT, - IDANIM_BTN_SELECT, - }; + public: + enum { + IDANIM_ON_LOOP = 0, + IDANIM_BTN_IN, + IDANIM_BTN_OUT, + IDANIM_BTN_INSERT, + IDANIM_BTN_SELECT, + }; - SDMenuButton(); - ~SDMenuButton(); + SDMenuButton(); + ~SDMenuButton(); - void create(nand::LayoutFile* layoutFile, nand::LayoutFile* balloonFile, EGG::Heap* heap); + void create(nand::LayoutFile* layoutFile, nand::LayoutFile* balloonFile, EGG::Heap* heap); - void calc(); + void calc(); - void draw(); - void drawBalloon(); + void draw(); + void drawBalloon(); - void update(); + void update(); - void initGui(); + void initGui(); - void startPointEvent(const char* paneName, controller::Interface* con); - void startLeftEvent(const char* paneName); + void startPointEvent(const char* paneName, controller::Interface* con); + void startLeftEvent(const char* paneName); - void setEventHandler(::gui::EventHandler* event); + void setEventHandler(::gui::EventHandler* event); - void animation(int animId); + void animation(int animId); - void enableBtn(); - void disableBtn(); + void enableBtn(); + void disableBtn(); - void toggle_insert(BOOL bInserted); - void show_balloon(int balloonId, const char* targetPaneName); + void toggle_insert(BOOL bInserted); + void show_balloon(int balloonId, const char* targetPaneName); - protected: - enum { - BTN_SD_CARD = 0, - BTN_MAX, - }; + protected: + enum { + BTN_SD_CARD = 0, + BTN_MAX, + }; - enum { - ANIM_ON_LOOP = 0, - ANIM_BTN_IN, - ANIM_BTN_OUT, - ANIM_BTN_INSERT, - ANIM_BTN_SELECT, - ANIM_BTN_ROLL_OVER, - ANIM_BTN_ROLL_OUT, - }; + enum { + ANIM_ON_LOOP = 0, + ANIM_BTN_IN, + ANIM_BTN_OUT, + ANIM_BTN_INSERT, + ANIM_BTN_SELECT, + ANIM_BTN_ROLL_OVER, + ANIM_BTN_ROLL_OUT, + }; - static int getButtonNo(const char* paneName); + static int getButtonNo(const char* paneName); - layout::Object* mpLayout; // 0x00 - gui::PaneManager* mpGui; // 0x04 + layout::Object* mpLayout; // 0x00 + gui::PaneManager* mpGui; // 0x04 - TextBalloon* mpBalloons[BTN_MAX]; // 0x08 + TextBalloon* mpBalloons[BTN_MAX]; // 0x08 - BOOL mbHovered[BTN_MAX]; // 0x0C - bool mbEnabled; // 0x10 + BOOL mbHovered[BTN_MAX]; // 0x0C + bool mbEnabled; // 0x10 - friend class Button; + friend class Button; }; /* Main Button Class */ SCENE_CLASS(Button) { - public: - typedef struct AnmFrame { - f32 start, end; - } AnmFrame; + public: + typedef struct AnmFrame { + f32 start, end; + } AnmFrame; - typedef struct BtnAnmFrame { - AnmFrame in, out; - } BtnAnmFrame; + typedef struct BtnAnmFrame { + AnmFrame in, out; + } BtnAnmFrame; - enum { - IDANIM_FROM_CH_SEL_TO_BOARD = 0, - IDANIM_FROM_CH_SEL_TO_SETTING, /*??? (unused)*/ - IDANIM_FROM_SETTING_TO_CH_SEL, /*??? (unused)*/ - IDANIM_FROM_BOARD_TO_CH_SEL, - IDANIM_FROM_BOARD_TO_CALENDAR, - IDANIM_BACK_TO_BOARD, - IDANIM_BACK_TO_BOARD_ALT, /*??? (maybe unused)*/ - IDANIM_FROM_BOARD_TO_MAIL_SEL, - IDANIM_SELECT_LEFT_BUTTON, - IDANIM_DISAPPEAR_BOARD_BUTTON, - IDANIM_APPEAR_BOARD_BUTTON, - IDANIM_APPEAR_LEFT_BUTTON, - IDANIM_DISAPPEAR_LEFT_BUTTON, - IDANIM_APPEAR_LEFT_AND_TRASH_BUTTON, - IDANIM_DISAPPEAR_LEFT_AND_TRASH_BUTTON, - IDANIM_APPEAR_LEFT_AND_RIGHT_BUTTON, - IDANIM_DISAPPEAR_LEFT_AND_RIGHT_BUTTON, - IDANIM_APPEAR_ALL_BUTTONS, - IDANIM_DISAPPEAR_ALL_BUTTONS, - IDANIM_ARROW_RIGHT_SELECT, - IDANIM_ARROW_LEFT_SELECT, - IDANIM_ARROW_RIGHT_SELECT_ALT, // unused - IDANIM_ARROW_LEFT_SELECT_ALT, // unused - IDANIM_ARROW_RIGHT_APPEAR, - IDANIM_ARROW_LEFT_APPEAR, - IDANIM_ARROW_RIGHT_DISAPPEAR, - IDANIM_ARROW_LEFT_DISAPPEAR, - IDANIM_SELECT_CALENDAR_EXIT, - IDANIM_SELECT_TRASH_BUTTON, - IDANIM_SELECT_CREATE_R, - IDANIM_RIGHT_ARROW_SHOW_LETTER, - IDANIM_RIGHT_ARROW_HIDE_LETTER, - IDANIM_LEFT_ARROW_SHOW_LETTER, - IDANIM_LEFT_ARROW_HIDE_LETTER, - IDANIM_OPTOUT_IN, - IDANIM_OPTOUT_OUT, - IDANIM_OPTOUT_IN_ALT, - IDANIM_OPTOUT_OUT_ALT, - IDANIM_OPTOUT_SELECT, - IDANIM_SD_BUTTON_LOOP, - IDANIM_SD_BUTTON_BTN_IN, - IDANIM_SD_BUTTON_BTN_OUT, - IDANIM_SD_BUTTON_INSERT, - IDANIM_SD_BUTTON_SELECT, - IDANIM_MAX, - }; - - enum { - BTN_BBS_BOARD = 0, - BTN_CH_SEL, - BTN_SETTING, - BTN_CALENDAR, - BTN_CREATE, - BTN_EXIT, - BTN_CREATE_EXIT, - BTN_CREATE_R_BUTTON, - BTN_TRASH_DELETE, - BTN_ARROW_RIGHT, - BTN_ARROW_LEFT, - BTN_MAX - }; + enum { + IDANIM_FROM_CH_SEL_TO_BOARD = 0, + IDANIM_FROM_CH_SEL_TO_SETTING, /*??? (unused)*/ + IDANIM_FROM_SETTING_TO_CH_SEL, /*??? (unused)*/ + IDANIM_FROM_BOARD_TO_CH_SEL, + IDANIM_FROM_BOARD_TO_CALENDAR, + IDANIM_BACK_TO_BOARD, + IDANIM_BACK_TO_BOARD_ALT, /*??? (maybe unused)*/ + IDANIM_FROM_BOARD_TO_MAIL_SEL, + IDANIM_SELECT_LEFT_BUTTON, + IDANIM_DISAPPEAR_BOARD_BUTTON, + IDANIM_APPEAR_BOARD_BUTTON, + IDANIM_APPEAR_LEFT_BUTTON, + IDANIM_DISAPPEAR_LEFT_BUTTON, + IDANIM_APPEAR_LEFT_AND_TRASH_BUTTON, + IDANIM_DISAPPEAR_LEFT_AND_TRASH_BUTTON, + IDANIM_APPEAR_LEFT_AND_RIGHT_BUTTON, + IDANIM_DISAPPEAR_LEFT_AND_RIGHT_BUTTON, + IDANIM_APPEAR_ALL_BUTTONS, + IDANIM_DISAPPEAR_ALL_BUTTONS, + IDANIM_ARROW_RIGHT_SELECT, + IDANIM_ARROW_LEFT_SELECT, + IDANIM_ARROW_RIGHT_SELECT_ALT, // unused + IDANIM_ARROW_LEFT_SELECT_ALT, // unused + IDANIM_ARROW_RIGHT_APPEAR, + IDANIM_ARROW_LEFT_APPEAR, + IDANIM_ARROW_RIGHT_DISAPPEAR, + IDANIM_ARROW_LEFT_DISAPPEAR, + IDANIM_SELECT_CALENDAR_EXIT, + IDANIM_SELECT_TRASH_BUTTON, + IDANIM_SELECT_CREATE_R, + IDANIM_RIGHT_ARROW_SHOW_LETTER, + IDANIM_RIGHT_ARROW_HIDE_LETTER, + IDANIM_LEFT_ARROW_SHOW_LETTER, + IDANIM_LEFT_ARROW_HIDE_LETTER, + IDANIM_OPTOUT_IN, + IDANIM_OPTOUT_OUT, + IDANIM_OPTOUT_IN_ALT, + IDANIM_OPTOUT_OUT_ALT, + IDANIM_OPTOUT_SELECT, + IDANIM_SD_BUTTON_LOOP, + IDANIM_SD_BUTTON_BTN_IN, + IDANIM_SD_BUTTON_BTN_OUT, + IDANIM_SD_BUTTON_INSERT, + IDANIM_SD_BUTTON_SELECT, + IDANIM_MAX, + }; - enum { - ARROW_BTN_RIGHT = 0, - ARROW_BTN_LEFT, - ARROW_BTN_MAX - }; + enum { + BTN_BBS_BOARD = 0, + BTN_CH_SEL, + BTN_SETTING, + BTN_CALENDAR, + BTN_CREATE, + BTN_EXIT, + BTN_CREATE_EXIT, + BTN_CREATE_R_BUTTON, + BTN_TRASH_DELETE, + BTN_ARROW_RIGHT, + BTN_ARROW_LEFT, + BTN_MAX + }; - enum { - BALLOON_BBS_BOARD = 0, - BALLOON_CH_SEL, - BALLOON_SETTING, - BALLOON_CALENDAR, - BALLOON_CREATE, - BALLOON_MAX - }; + enum { ARROW_BTN_RIGHT = 0, ARROW_BTN_LEFT, ARROW_BTN_MAX }; - enum { - TEXT_LEFT_BUTTON = 0, - TEXT_RIGHT_BUTTON, - TEXT_MAX - }; + enum { BALLOON_BBS_BOARD = 0, BALLOON_CH_SEL, BALLOON_SETTING, BALLOON_CALENDAR, BALLOON_CREATE, BALLOON_MAX }; - Button(EGG::Heap* heap); - virtual ~Button(); + enum { TEXT_LEFT_BUTTON = 0, TEXT_RIGHT_BUTTON, TEXT_MAX }; - virtual void prepare(); - virtual void create(); + Button(EGG::Heap * heap); + virtual ~Button(); - virtual void calc(); + virtual void prepare(); + virtual void create(); - virtual void draw(); + virtual void calc(); - void drawBalloon(); + virtual void draw(); - void update(); + void drawBalloon(); - void reset_gui(); + void update(); - void startPointEvent(const char* paneName, controller::Interface* con); - void startLeftEvent(const char* paneName); + void reset_gui(); - bool isActive() const; + void startPointEvent(const char* paneName, controller::Interface* con); + void startLeftEvent(const char* paneName); - void setEventHandler(::gui::EventHandler* event, ::gui::EventHandler* optOutEvent = NULL); + bool isActive() const; - void setText(const char* paneName, u32 msgId); - void setText(const char* paneName, const wchar_t* text); + void setEventHandler(::gui::EventHandler * event, ::gui::EventHandler* optOutEvent = NULL); - void animation(int animNo); + void setText(const char* paneName, u32 msgId); + void setText(const char* paneName, const wchar_t* text); - bool playingSdAnim(int animNo); + void animation(int animNo); - void initArrowAppearance(int arrowType, bool bAppear); + bool playingSdAnim(int animNo); - void show_balloon(int balloonId, const char* targetPaneName); + void initArrowAppearance(int arrowType, bool bAppear); - void startMailNumAnm(); - void stopMailNumAnm(); + void show_balloon(int balloonId, const char* targetPaneName); - void startNewMailAnm(); - void startNewMailAnm_(); - void stopNewMailAnm(); + void startMailNumAnm(); + void stopMailNumAnm(); - void initBtn(int btnNo); + void startNewMailAnm(); + void startNewMailAnm_(); + void stopNewMailAnm(); - void enableBtn(); - void disableBtn(); - - void reserveAnm(int animId); - void reserveText(int paneId, u32 msgId); + void initBtn(int btnNo); - static int getButtonNo(const char* paneName); + void enableBtn(); + void disableBtn(); - static int cmpButtonName(const char* name, int btnNo) { return strcmp(name, mscButtonName[btnNo]); } + void reserveAnm(int animId); + void reserveText(int paneId, u32 msgId); - int hasReservedAnim() { return mReservedCmd.current != 0; } + static int getButtonNo(const char* paneName); - SDMenuButton* get_sd_menu_btn() { return &mSdMenuBtn; } - OptOutButton* get_opt_out_btn() { return &mOptOutBtn; } - layout::Object* get_layout() { return mpLayout; } + static int cmpButtonName(const char* name, int btnNo) { + return strcmp(name, mscButtonName[btnNo]); + } - bool isArrowVisible(int i) { return mbArrowVisible[i]; } + int hasReservedAnim() { + return mReservedCmd.current != 0; + } - protected: - typedef struct Command { - enum { - TYPE_ANIM = 0, - TYPE_TEXT - }; - int type; // 0x00 + SDMenuButton* get_sd_menu_btn() { + return &mSdMenuBtn; + } + OptOutButton* get_opt_out_btn() { + return &mOptOutBtn; + } + layout::Object* get_layout() { + return mpLayout; + } - /* First argument (SIGNED) */ - union { - s32 firstArg; - s32 animId; - s32 paneId; - }; // 0x04 + bool isArrowVisible(int i) { + return mbArrowVisible[i]; + } - /* Second argument (UNSIGNED)*/ - union { - u32 secondArg; - u32 msgId; - }; // 0x08 - } Command; + protected: + typedef struct Command { + enum { TYPE_ANIM = 0, TYPE_TEXT }; + int type; // 0x00 - private: - enum { - ANIM_SCENE_CHANGE = 0, - ANIM_ARROW_R_AC, - ANIM_ARROW_L_AC, - ANIM_ARROW_R_HD_AC, - ANIM_ARROW_L_HD_AC, - ANIM_ARROW_R_END, - ANIM_ARROW_L_END, - ANIM_CALENDAR_EXIT, - ANIM_TRASH_DELETE, - ANIM_COMMON_BUTTON, - ANIM_ARROW_LETTER_R, - ANIM_ARROW_LETTER_L, - ANIM_BOARD_BBS_NUM_LOOP, - ANIM_BOARD_BBS_NEW, - ANIM_MAX, - }; + /* First argument (SIGNED) */ + union { + s32 firstArg; + s32 animId; + s32 paneId; + }; // 0x04 - int unk_0x54; + /* Second argument (UNSIGNED)*/ + union { + u32 secondArg; + u32 msgId; + }; // 0x08 + } Command; - layout::Object* mpLayout; // 0x58 - nand::LayoutFile* mpLayoutFile; // 0x5C - gui::PaneManager* mpGui; // 0x60 + private: + enum { + ANIM_SCENE_CHANGE = 0, + ANIM_ARROW_R_AC, + ANIM_ARROW_L_AC, + ANIM_ARROW_R_HD_AC, + ANIM_ARROW_L_HD_AC, + ANIM_ARROW_R_END, + ANIM_ARROW_L_END, + ANIM_CALENDAR_EXIT, + ANIM_TRASH_DELETE, + ANIM_COMMON_BUTTON, + ANIM_ARROW_LETTER_R, + ANIM_ARROW_LETTER_L, + ANIM_BOARD_BBS_NUM_LOOP, + ANIM_BOARD_BBS_NEW, + ANIM_MAX, + }; - OptOutButton mOptOutBtn; // 0x64 - SDMenuButton mSdMenuBtn; // 0x70 + int unk_0x54; - TextBalloon* mpBalloons[BALLOON_MAX]; // 0x84 - - nand::LayoutFile* mpBalloonFile; // 0x98 + layout::Object* mpLayout; // 0x58 + nand::LayoutFile* mpLayoutFile; // 0x5C + gui::PaneManager* mpGui; // 0x60 - layout::GroupAnimator* mpButtonAnim[ANIM_MAX]; // 0x9C + OptOutButton mOptOutBtn; // 0x64 + SDMenuButton mSdMenuBtn; // 0x70 - bool mbArrowVisible[ARROW_BTN_MAX]; // 0xD4 + TextBalloon* mpBalloons[BALLOON_MAX]; // 0x84 - BOOL mbHovered[BTN_MAX]; // 0xD8 + nand::LayoutFile* mpBalloonFile; // 0x98 - bool unk_0x104; - bool unk_0x105; + layout::GroupAnimator* mpButtonAnim[ANIM_MAX]; // 0x9C - utility::timer mTimer; // 0x108 - bool mbEnabled; // 0x110 + bool mbArrowVisible[ARROW_BTN_MAX]; // 0xD4 - utility::Queue mReservedCmd; // 0x114 + BOOL mbHovered[BTN_MAX]; // 0xD8 - int unused_0x184; + bool unk_0x104; + bool unk_0x105; - static const char* mscTextPaneName[2]; - static const char* mscButtonName[BTN_MAX]; - static const char* mscGroupName[BTN_MAX]; + utility::timer mTimer; // 0x108 + bool mbEnabled; // 0x110 - static const char* mscArrowName[ARROW_BTN_MAX]; + utility::Queue mReservedCmd; // 0x114 - friend class Arrow; + int unused_0x184; - friend class ButtonEventHandlerBase; - friend class OptOutButtonEventHandlerBase; - friend class SDMenuEventHandlerBase; + static const char* mscTextPaneName[2]; + static const char* mscButtonName[BTN_MAX]; + static const char* mscGroupName[BTN_MAX]; + + static const char* mscArrowName[ARROW_BTN_MAX]; + + friend class Arrow; + + friend class ButtonEventHandlerBase; + friend class OptOutButtonEventHandlerBase; + friend class SDMenuEventHandlerBase; }; /* Button event handlers */ class ButtonEventHandlerBase : public ::gui::EventHandler { - public: - virtual void onEvent(u32 compId, u32 event, void* data); - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); + public: + virtual void onEvent(u32 compId, u32 event, void* data); + virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); }; class OptOutButtonEventHandlerBase : public ButtonEventHandlerBase { - public: - virtual void onEvent(u32 compId, u32 event, void* data); - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); + public: + virtual void onEvent(u32 compId, u32 event, void* data); + virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); }; class SDMenuEventHandlerBase : public ButtonEventHandlerBase { - public: - virtual void onEvent(u32 compId, u32 event, void* data); - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); + public: + virtual void onEvent(u32 compId, u32 event, void* data); + virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_BUTTON_H +#endif // IPL_SCENE_BUTTON_H diff --git a/include/scene/button/iplOptOutButton.h b/include/scene/button/iplOptOutButton.h deleted file mode 100644 index e69de29b..00000000 diff --git a/include/scene/calendar/iplCalendar.h b/include/scene/calendar/iplCalendar.h index dc60e467..6a77e602 100644 --- a/include/scene/calendar/iplCalendar.h +++ b/include/scene/calendar/iplCalendar.h @@ -9,104 +9,104 @@ namespace ipl { namespace scene { FADER_SCENE_CLASS(Calendar), public ButtonEventHandlerBase { - public: - enum { - IDANIM_0 = 0, - IDANIM_1, - IDANIM_2, - IDANIM_3, - IDANIM_4, - IDANIM_MAX, - }; + public: + enum { + IDANIM_0 = 0, + IDANIM_1, + IDANIM_2, + IDANIM_3, + IDANIM_4, + IDANIM_MAX, + }; - typedef struct AnmFrame { - f32 start, end; - } AnmFrame; + typedef struct AnmFrame { + f32 start, end; + } AnmFrame; - typedef struct DayToMsgId { - const char* paneName; - u32 msgId; - } DayToMsgId; + typedef struct DayToMsgId { + const char* paneName; + u32 msgId; + } DayToMsgId; - Calendar(EGG::Heap* heap); + Calendar(EGG::Heap * heap); - void prepare(); - void create(); + void prepare(); + void create(); - void calcCommon(); - FaderSceneCommand calcFadein(); - FaderSceneCommand calcNormal(); - void initCalcFadeout(); - FaderSceneCommand calcFadeout(); + void calcCommon(); + FaderSceneCommand calcFadein(); + FaderSceneCommand calcNormal(); + void initCalcFadeout(); + FaderSceneCommand calcFadeout(); - void draw(); - void doAnim(int animId); + void draw(); + void doAnim(int animId); - void onEventDerived(u32 compId, u32 event, const controller::Interface* con); + void onEventDerived(u32 compId, u32 event, const controller::Interface* con); - void onPointDate(Date* date); - void onTrigDate(Date* date); + void onPointDate(Date * date); + void onTrigDate(Date * date); - private: - enum { - STATE_NORMAL = 0, - STATE_SCROLL_RIGHT, - STATE_SCROLL_LEFT, - STATE_WAIT_TASK, - STATE_WAIT_EXIT, - STATE_DONE, - }; + private: + enum { + STATE_NORMAL = 0, + STATE_SCROLL_RIGHT, + STATE_SCROLL_LEFT, + STATE_WAIT_TASK, + STATE_WAIT_EXIT, + STATE_DONE, + }; - void on_normal(); - void on_scroll(); - void on_wait_task(); - void on_wait_exit(); + void on_normal(); + void on_scroll(); + void on_wait_task(); + void on_wait_exit(); - void start_scroll_r(); - void do_scroll_r(); + void start_scroll_r(); + void do_scroll_r(); - void start_scroll_l(); - void do_scroll_l(); + void start_scroll_l(); + void do_scroll_l(); - void start_exit(); - void do_exit(); + void start_exit(); + void do_exit(); - void set_textbox(const char* paneName, u32 msgId); - void set_textbox_day(); - void set_textbox_month(); - void set_textbox_month(const char* paneName, const utility::Date& date); - void set_textbox_date(int unk, const utility::Date& date); + void set_textbox(const char* paneName, u32 msgId); + void set_textbox_day(); + void set_textbox_month(); + void set_textbox_month(const char* paneName, const utility::Date& date); + void set_textbox_date(int unk, const utility::Date& date); - void set_date_pos(int unk); + void set_date_pos(int unk); - void exec_search_task(); + void exec_search_task(); - BOOL is_upper_limit(); - BOOL is_lower_limit(); + BOOL is_upper_limit(); + BOOL is_lower_limit(); - int mState; // 0x64 - int mPrevState; // 0x68 - layout::Object* mpLayout; // 0x6C - nand::LayoutFile* mpLayoutFile; // 0x70 - layout::GroupAnimator* mpGroupAnim; // 0x74 - layout::GroupAnimator* mpInitAnim; // 0x78 - utility::Date* mpBoardDate; // 0x7C - Date* mpSelectDate; // 0x80 + int mState; // 0x64 + int mPrevState; // 0x68 + layout::Object* mpLayout; // 0x6C + nand::LayoutFile* mpLayoutFile; // 0x70 + layout::GroupAnimator* mpGroupAnim; // 0x74 + layout::GroupAnimator* mpInitAnim; // 0x78 + utility::Date* mpBoardDate; // 0x7C + Date* mpSelectDate; // 0x80 - public: - nw4r::ut::List mDateList; // 0x84 - nw4r::ut::List unk_0x90; - bool mbScrolling; // 0x9C - vBOOL unk_0xA0; - BOOL mbTaskCanceled; // 0xA4 - vBOOL mbBackToBoardAlt; // 0xA8 - bool mbAsian; // 0xAC - bool mbUSA; // 0xAD + public: + nw4r::ut::List mDateList; // 0x84 + nw4r::ut::List unk_0x90; + bool mbScrolling; // 0x9C + vBOOL unk_0xA0; + BOOL mbTaskCanceled; // 0xA4 + vBOOL mbBackToBoardAlt; // 0xA8 + bool mbAsian; // 0xAC + bool mbUSA; // 0xAD - static utility::Date mscMinDate; - static utility::Date mscMaxDate; + static utility::Date mscMinDate; + static utility::Date mscMaxDate; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_CALENDAR_H +#endif // IPL_SCENE_CALENDAR_H diff --git a/include/scene/calendar/iplDate.h b/include/scene/calendar/iplDate.h index 1e263714..2adaeaa3 100644 --- a/include/scene/calendar/iplDate.h +++ b/include/scene/calendar/iplDate.h @@ -8,95 +8,88 @@ namespace ipl { namespace scene { class Date : ::gui::EventHandler { - public: - typedef struct AnmFrame { - int paneAnim; - f32 start, end; - } AnmFrame; + public: + typedef struct AnmFrame { + int paneAnim; + f32 start, end; + } AnmFrame; - enum { - ANIM_PANE_BTN_HOVER = 0, - ANIM_PANE_BTN, - ANIM_PANE_BTN_TEXT, - ANIM_PANE_BODY, - ANIM_PANE_MSG, - ANIM_PANE_MAX - }; + enum { ANIM_PANE_BTN_HOVER = 0, ANIM_PANE_BTN, ANIM_PANE_BTN_TEXT, ANIM_PANE_BODY, ANIM_PANE_MSG, ANIM_PANE_MAX }; - enum { - IDANIM_FOCUS_IN, - IDANIM_FOCUS_OUT, - IDANIM_SELECT, - IDANIM_LOOP, - IDANIM_BLUE_TEXT, - IDANIM_RED_TEXT, - IDANIM_RESET_GREY_TEXT, - IDANIM_RESET_GREY_BUTTON, - IDANIM_GREY_TEXT, - IDANIM_GREY_BUTTON, - IDANIM_APPEAR_MSG, - IDANIM_NO_MSG, - IDANIM_MAX, - }; + enum { + IDANIM_FOCUS_IN, + IDANIM_FOCUS_OUT, + IDANIM_SELECT, + IDANIM_LOOP, + IDANIM_BLUE_TEXT, + IDANIM_RED_TEXT, + IDANIM_RESET_GREY_TEXT, + IDANIM_RESET_GREY_BUTTON, + IDANIM_GREY_TEXT, + IDANIM_GREY_BUTTON, + IDANIM_APPEAR_MSG, + IDANIM_NO_MSG, + IDANIM_MAX, + }; - Date(EGG::Heap* heap, nand::LayoutFile* file, const char* layoutFolder, const char* layoutFileName); + Date(EGG::Heap* heap, nand::LayoutFile* file, const char* layoutFolder, const char* layoutFileName); - void calc(); - void draw(bool unk); + void calc(); + void draw(bool unk); - layout::PaneAnimator* doAnim(int animId); + layout::PaneAnimator* doAnim(int animId); - void setRotate(const nw4r::math::VEC3& vec); - void setTranslate(const nw4r::math::VEC3& vec); - void setVisible(bool visible); - bool getVisible(); + void setRotate(const nw4r::math::VEC3& vec); + void setTranslate(const nw4r::math::VEC3& vec); + void setVisible(bool visible); + bool getVisible(); - void setAttribute(int attr); + void setAttribute(int attr); - void setDate(const utility::Date& date); + void setDate(const utility::Date& date); - void update(); + void update(); - void initEvent(); - void onEvent(u32 compId, u32 event, void* data); - void onCmdRecv(int cmd) NO_INLINE; + void initEvent(); + void onEvent(u32 compId, u32 event, void* data); + void onCmdRecv(int cmd) NO_INLINE; - static bool isValidDate(const utility::Date& date); + static bool isValidDate(const utility::Date& date); - utility::Date* getDate() { return mpDate; } + utility::Date* getDate() { return mpDate; } - private: - void start_point_event(const char* paneName, controller::Interface* con); - void start_left_event(const char* paneName); + private: + void start_point_event(const char* paneName, controller::Interface* con); + void start_left_event(const char* paneName); - void set_textbox(int day); + void set_textbox(int day); - public: - vBOOL mbAppearMsg; // 0x0C + public: + vBOOL mbAppearMsg; // 0x0C - private: - u32 unk_0x10; - int unk_0x14; - layout::Object* mpLayout; // 0x18 - gui::PaneManager* mpGui; // 0x1C - layout::PaneAnimator* mpCurrentPaneAnim; // 0x20 - layout::PaneAnimator* mpPaneAnims[ANIM_PANE_MAX]; // 0x24 + private: + u32 unk_0x10; + int unk_0x14; + layout::Object* mpLayout; // 0x18 + gui::PaneManager* mpGui; // 0x1C + layout::PaneAnimator* mpCurrentPaneAnim; // 0x20 + layout::PaneAnimator* mpPaneAnims[ANIM_PANE_MAX]; // 0x24 - public: - utility::Date* mpDate; // 0x38 - u32 unk_0x3C; + public: + utility::Date* mpDate; // 0x38 + u32 unk_0x3C; - static const char* mscAnimPanes[ANIM_PANE_MAX]; + static const char* mscAnimPanes[ANIM_PANE_MAX]; - static utility::Date mscMinDate; - static utility::Date mscMaxDate; + static utility::Date mscMinDate; + static utility::Date mscMaxDate; - nw4r::ut::Link mNode1; // 0x40 - nw4r::ut::Link mNode2; // 0x48 + nw4r::ut::Link mNode1; // 0x40 + nw4r::ut::Link mNode2; // 0x48 - friend class Calendar; + friend class Calendar; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_DATE_H +#endif // IPL_SCENE_DATE_H diff --git a/include/scene/channelEdit/iplChannelEdit.h b/include/scene/channelEdit/iplChannelEdit.h index 697f22c2..8af1bc00 100644 --- a/include/scene/channelEdit/iplChannelEdit.h +++ b/include/scene/channelEdit/iplChannelEdit.h @@ -6,13 +6,13 @@ namespace ipl { namespace scene { SCENE_CLASS(ChannelEdit) { - public: - ChannelEdit(EGG::Heap* heap); + public: + ChannelEdit(EGG::Heap * heap); - private: - u8 unk_0x54[0x84]; + private: + u8 unk_0x54[0x84]; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_CHANNEL_EDIT_H +#endif // IPL_SCENE_CHANNEL_EDIT_H diff --git a/include/scene/channelSelect/iplChannelObj.h b/include/scene/channelSelect/iplChannelObj.h index 778a2e8c..a99d16f4 100644 --- a/include/scene/channelSelect/iplChannelObj.h +++ b/include/scene/channelSelect/iplChannelObj.h @@ -14,144 +14,144 @@ namespace ipl { namespace scene { class ChannelObj { - public: - ChannelObj(EGG::Heap* heap, int page, int index); - ~ChannelObj(); + public: + ChannelObj(EGG::Heap* heap, int page, int index); + ~ChannelObj(); - void create(nand::LayoutFile* layoutFile); - void prepare(); + void create(nand::LayoutFile* layoutFile); + void prepare(); - void calc(); - void calcNormal(); + void calc(); + void calcNormal(); - void setHeaps(EGG::Heap* heap0, EGG::Heap* heap1); - void setDiskLayouts(layout::Object* diskLyt, layout::Animator* diskAnim, EGG::Heap* diskHeap); - void setBasePane(const nw4r::lyt::Pane* basePane); + void setHeaps(EGG::Heap* heap0, EGG::Heap* heap1); + void setDiskLayouts(layout::Object* diskLyt, layout::Animator* diskAnim, EGG::Heap* diskHeap); + void setBasePane(const nw4r::lyt::Pane* basePane); - void initExtModule(EGG::Heap* moduleHeap, channel::RsoThread* moduleThread); + void initExtModule(EGG::Heap* moduleHeap, channel::RsoThread* moduleThread); - int calcExtModule(EGG::ExpHeap* expHeap, bool unk0, bool unk1); + int calcExtModule(EGG::ExpHeap* expHeap, bool unk0, bool unk1); - void drawThumbnail(); - void drawCursor(); - void drawBalloon(); + void drawThumbnail(); + void drawCursor(); + void drawBalloon(); - void createDiskLayout(void* data); - void destroyDiskLayout(); - void changeDisk(); - void resetDiskTitleName(); + void createDiskLayout(void* data); + void destroyDiskLayout(); + void changeDisk(); + void resetDiskTitleName(); - nw4r::math::VEC3& getTranslate() const; + nw4r::math::VEC3& getTranslate() const; - BOOL isLayoutCreated() const; - BOOL isDiskChannel() const; - BOOL isValid() const; + BOOL isLayoutCreated() const; + BOOL isDiskChannel() const; + BOOL isValid() const; - void onPoint(int unk); - void onLeft(int unk); - void onPinch(bool unk); + void onPoint(int unk); + void onLeft(int unk); + void onPinch(bool unk); - void setCursorDecideAnim(); + void setCursorDecideAnim(); - void initCursorAnim(bool unk); - void initBalloonAnim(bool unk); + void initCursorAnim(bool unk); + void initBalloonAnim(bool unk); - void FillModuleCount(); + void FillModuleCount(); - static void setLangPane(const layout::Object* layout); + static void setLangPane(const layout::Object* layout); - static void bindRsoAnm(layout::Object* layout, layout::Animator** anims, const char* unk); + static void bindRsoAnm(layout::Object* layout, layout::Animator** anims, const char* unk); - int loadThumbnailAsync(); + int loadThumbnailAsync(); - void createThumbnail(); + void createThumbnail(); - f32 createWadThumbnail(); - f32 createWrongThumbnail(); - f32 createEmptyThumbnail(); + f32 createWadThumbnail(); + f32 createWrongThumbnail(); + f32 createEmptyThumbnail(); - void initCursor(); - void calcCursor(const nw4r::math::VEC3& vec); + void initCursor(); + void calcCursor(const nw4r::math::VEC3& vec); - void setCursorAnim(int unk); - void calcCursorAnim(); - void startCursorAnim(int unk); + void setCursorAnim(int unk); + void calcCursorAnim(); + void startCursorAnim(int unk); - void initBalloon(); - void setBalloonText(const wchar_t* text); - void calcBalloon(const nw4r::math::VEC3& vec); + void initBalloon(); + void setBalloonText(const wchar_t* text); + void calcBalloon(const nw4r::math::VEC3& vec); - void setBalloonAnim(int unk); - void calcBalloonAnim(int unk); + void setBalloonAnim(int unk); + void calcBalloonAnim(int unk); - void clearModuleParam(); + void clearModuleParam(); - void bindNewAnm(layout::Object* layout); + void bindNewAnm(layout::Object* layout); - void setupNew(); - void updateNew(); + void setupNew(); + void updateNew(); - private: - u8 unk_0x00[8]; + private: + u8 unk_0x00[8]; - EGG::Heap* unk_0x08; - EGG::Heap* unk_0x0C; - EGG::Heap* unk_0x10; - EGG::Heap* mpDiskHeap; // 0x14 + EGG::Heap* unk_0x08; + EGG::Heap* unk_0x0C; + EGG::Heap* unk_0x10; + EGG::Heap* mpDiskHeap; // 0x14 - int unk_0x18; + int unk_0x18; - int mChanPage; // 0x1C - int mChanIndex; // 0x20 + int mChanPage; // 0x1C + int mChanIndex; // 0x20 - nand::LayoutFile* unk_0x24; + nand::LayoutFile* unk_0x24; - nw4r::lyt::Pane* mpBasePane; // 0x28 + nw4r::lyt::Pane* mpBasePane; // 0x28 - nand::File* unk_0x2C; - layout::Object* unk_0x30; - layout::Animator* unk_0x34; - layout::Object* mpDiskLyt; // 0x38 - layout::Animator* mpDiskAnim; // 0x3C - layout::Object* unk_0x40; - layout::Animator* unk_0x44; - layout::Object* unk_0x48; - layout::Animator* unk_0x4C[3]; - int unk_0x58; - int unk_0x5C; - layout::Object* unk_0x60; - u8 unk_0x64[4]; - int unk_0x68; - int unk_0x6C; - int unk_0x70; - int unk_0x74; - nw4r::lyt::Group* unk_0x78; - int unk_0x7C; - u8 unk_0x80; - int unk_0x84; - int unk_0x88; - f32 unk_0x8C; - f32 unk_0x90; - f32 mLocationAdjust; // 0x94 - EGG::Heap* mpModuleHeap; // 0x98 - EGG::ExpHeap* unk_0x9C; - EGG::ExpHeap* unk_0xA0; - layout::Animator* unk_0xA4[16]; - u8 unk_0xE4; - channel::RsoThread* unk_0xE8; - int unk_0xEC; - nand::SharedFile* unk_0xF0; - u8 unk_0xF4; - u32 unk_0xF8; - u32 unk_0xFC; - RSOObjectHeader* unk_0x100; - u8* unk_0x104; - channel::CalcFunc unk_0x108; - u8 unk_0x10C; - u8 unk_0x10D; - EGG::ExpHeap* unk_0x110; + nand::File* unk_0x2C; + layout::Object* unk_0x30; + layout::Animator* unk_0x34; + layout::Object* mpDiskLyt; // 0x38 + layout::Animator* mpDiskAnim; // 0x3C + layout::Object* unk_0x40; + layout::Animator* unk_0x44; + layout::Object* unk_0x48; + layout::Animator* unk_0x4C[3]; + int unk_0x58; + int unk_0x5C; + layout::Object* unk_0x60; + u8 unk_0x64[4]; + int unk_0x68; + int unk_0x6C; + int unk_0x70; + int unk_0x74; + nw4r::lyt::Group* unk_0x78; + int unk_0x7C; + u8 unk_0x80; + int unk_0x84; + int unk_0x88; + f32 unk_0x8C; + f32 unk_0x90; + f32 mLocationAdjust; // 0x94 + EGG::Heap* mpModuleHeap; // 0x98 + EGG::ExpHeap* unk_0x9C; + EGG::ExpHeap* unk_0xA0; + layout::Animator* unk_0xA4[16]; + u8 unk_0xE4; + channel::RsoThread* unk_0xE8; + int unk_0xEC; + nand::SharedFile* unk_0xF0; + u8 unk_0xF4; + u32 unk_0xF8; + u32 unk_0xFC; + RSOObjectHeader* unk_0x100; + u8* unk_0x104; + channel::CalcFunc unk_0x108; + u8 unk_0x10C; + u8 unk_0x10D; + EGG::ExpHeap* unk_0x110; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_CHANNEL_OBJECT_H +#endif // IPL_SCENE_CHANNEL_OBJECT_H diff --git a/include/scene/channelSelect/iplChannelSelect.h b/include/scene/channelSelect/iplChannelSelect.h index aa39b978..81762df2 100644 --- a/include/scene/channelSelect/iplChannelSelect.h +++ b/include/scene/channelSelect/iplChannelSelect.h @@ -6,17 +6,19 @@ namespace ipl { namespace scene { FADER_SCENE_CLASS(ChannelSelect) { - public: - ChannelSelect(EGG::Heap* heap, int page); + public: + ChannelSelect(EGG::Heap * heap, int page); - static void setInitFlag(BOOL value) { msInitFlag = value; } - - private: - u8 unk_0x58[0x278]; + static void setInitFlag(BOOL value) { + msInitFlag = value; + } - static BOOL msInitFlag; + private: + u8 unk_0x58[0x278]; + + static BOOL msInitFlag; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_CHANNEL_SELECT_H +#endif // IPL_SCENE_CHANNEL_SELECT_H diff --git a/include/scene/channelSelect/iplClock.h b/include/scene/channelSelect/iplClock.h index ebb1a317..360bc4ec 100644 --- a/include/scene/channelSelect/iplClock.h +++ b/include/scene/channelSelect/iplClock.h @@ -11,79 +11,79 @@ namespace ipl { namespace scene { class clock { - public: - clock(); - ~clock() {} + public: + clock(); + ~clock() {} - void init(EGG::Heap* heap, nand::LayoutFile* layoutFile); - void calc(); - void draw(nw4r::lyt::Pane* pane); + void init(EGG::Heap* heap, nand::LayoutFile* layoutFile); + void calc(); + void draw(nw4r::lyt::Pane* pane); - private: - enum { - STATE_FADE_IN = 0, - STATE_NORMAL, - STATE_WAIT_ANIM, - STATE_DISAPPEAR, - }; + private: + enum { + STATE_FADE_IN = 0, + STATE_NORMAL, + STATE_WAIT_ANIM, + STATE_DISAPPEAR, + }; - enum { - ANIM_WII_MENU_CHANGE = 0, - ANIM_CLOCK_CHANGE, + enum { + ANIM_WII_MENU_CHANGE = 0, + ANIM_CLOCK_CHANGE, - ANIM_CLOCK_COLON_BLINK, + ANIM_CLOCK_COLON_BLINK, - ANIM_CLOCK_0_APPEAR, - ANIM_CLOCK_1_APPEAR, - ANIM_CLOCK_2_APPEAR, - ANIM_CLOCK_3_APPEAR, - ANIM_AM_PM_LEFT_APPEAR, - ANIM_AM_PM_RIGHT_APPEAR, + ANIM_CLOCK_0_APPEAR, + ANIM_CLOCK_1_APPEAR, + ANIM_CLOCK_2_APPEAR, + ANIM_CLOCK_3_APPEAR, + ANIM_AM_PM_LEFT_APPEAR, + ANIM_AM_PM_RIGHT_APPEAR, - ANIM_CLOCK_0_LOST, - ANIM_CLOCK_1_LOST, - ANIM_CLOCK_2_LOST, - ANIM_CLOCK_3_LOST, - ANIM_AM_PM_LEFT_LOST, - ANIM_AM_PM_RIGHT_LOST, - }; - typedef struct time_tex { - s32 hourDigit2; // 0x00 - s32 hourDigit1; // 0x04 - s32 minuteDigit2; // 0x08 - s32 minuteDigit1; // 0x0C - bool isPM; // 0x10 - } time_tex; + ANIM_CLOCK_0_LOST, + ANIM_CLOCK_1_LOST, + ANIM_CLOCK_2_LOST, + ANIM_CLOCK_3_LOST, + ANIM_AM_PM_LEFT_LOST, + ANIM_AM_PM_RIGHT_LOST, + }; + typedef struct time_tex { + s32 hourDigit2; // 0x00 + s32 hourDigit1; // 0x04 + s32 minuteDigit2; // 0x08 + s32 minuteDigit1; // 0x0C + bool isPM; // 0x10 + } time_tex; - void stt_fadein(); - void stt_normal(); - void stt_wait_anm(); - void stt_disappear(); + void stt_fadein(); + void stt_normal(); + void stt_wait_anm(); + void stt_disappear(); - void change_tex(); + void change_tex(); - time_tex calc_tex() const; + time_tex calc_tex() const; - void appear(); + void appear(); - BOOL is_same_hms(const OSCalendarTime& time0, const OSCalendarTime& time1) const; + BOOL is_same_hms(const OSCalendarTime& time0, const OSCalendarTime& time1) const; - time_tex mCurrentTex; // 0x00 - time_tex mPreviousTex; // 0x14 + time_tex mCurrentTex; // 0x00 + time_tex mPreviousTex; // 0x14 - u32 mState; // 0x28 + u32 mState; // 0x28 - layout::Object* mpLayout; // 0x2C + layout::Object* mpLayout; // 0x2C - utility::timer mWiiMenuTimer; // 0x30 + utility::timer mWiiMenuTimer; // 0x30 - OSCalendarTime mTime; // 0x38 + OSCalendarTime mTime; // 0x38 - static bool m_already_shown_wii_menu; + static bool m_already_shown_wii_menu; - static const int WII_MENU_APPEAR_FOR = 3000; /* in ms (3 seconds) */ + static const int WII_MENU_APPEAR_FOR = 3000; /* in ms (3 seconds) */ }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_CLOCK_H +#endif // IPL_SCENE_CLOCK_H diff --git a/include/scene/channelTitle/iplChannelTitle.h b/include/scene/channelTitle/iplChannelTitle.h index 40a20d6d..3ee5a9e3 100644 --- a/include/scene/channelTitle/iplChannelTitle.h +++ b/include/scene/channelTitle/iplChannelTitle.h @@ -8,15 +8,15 @@ namespace ipl { class ChannelSelect; FADER_SCENE_CLASS(ChannelTitle) { - public: - ChannelTitle(EGG::Heap* heap, ChannelSelect* chanSel); + public: + ChannelTitle(EGG::Heap * heap, ChannelSelect * chanSel); - BOOL isInLaunching() const; + BOOL isInLaunching() const; - private: - u8 unk_0x58[0x3B0]; + private: + u8 unk_0x58[0x3B0]; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_CHANNEL_TITLE_H +#endif // IPL_SCENE_CHANNEL_TITLE_H diff --git a/include/scene/faceSelect/iplFaceSelect.h b/include/scene/faceSelect/iplFaceSelect.h index e9b1965c..295c0f56 100644 --- a/include/scene/faceSelect/iplFaceSelect.h +++ b/include/scene/faceSelect/iplFaceSelect.h @@ -5,8 +5,8 @@ #include "scene/button/iplButton.h" -#include "system/iplNigaoe.h" #include "scene/textBalloon/iplBalloon.h" +#include "system/iplNigaoe.h" #include @@ -16,223 +16,220 @@ namespace ipl { class FaceSelectButtonEvent; FADER_SCENE_CLASS(FaceSelect) { - public: - enum { - FADE_FROM_MEMO = 0, - FADE_FROM_ADDRESS_EDIT, - FADE_FROM_ADDRESS_ADD, - }; + public: + enum { + FADE_FROM_MEMO = 0, + FADE_FROM_ADDRESS_EDIT, + FADE_FROM_ADDRESS_ADD, + }; - FaceSelect(EGG::Heap* heap, int fadeType); + FaceSelect(EGG::Heap * heap, int fadeType); - virtual void prepare(); - virtual void create(); + virtual void prepare(); + virtual void create(); - virtual FaderSceneCommand calcFadein(); + virtual FaderSceneCommand calcFadein(); - virtual void initCalcNormal(); - virtual FaderSceneCommand calcNormal(); + virtual void initCalcNormal(); + virtual FaderSceneCommand calcNormal(); - virtual void initCalcFadeout(); - virtual FaderSceneCommand calcFadeout(); + virtual void initCalcFadeout(); + virtual FaderSceneCommand calcFadeout(); - virtual void calcCommonAfter(); + virtual void calcCommonAfter(); - virtual void destroy(); + virtual void destroy(); - virtual void draw(); + virtual void draw(); - int getSelectedFaceId() { return mSelectedFaceId; } + int getSelectedFaceId() { + return mSelectedFaceId; + } - typedef struct Face { - bool creating; // 0x00 - bool created; // 0x01 + typedef struct Face { + bool creating; // 0x00 + bool created; // 0x01 - nigaoe::Object* object; // 0x04 - } Face; + nigaoe::Object* object; // 0x04 + } Face; - private: - enum { - ANIM_FADE_IN = 0, - ANIM_FADE_OUT, - ANIM_FADE_MEMO = ANIM_FADE_IN, - ANIM_FADE_IN_FROM_MEMO = ANIM_FADE_MEMO, - ANIM_FADE_OUT_TO_MEMO = ANIM_FADE_OUT, - ANIM_FADE_ADDRESS_EDIT, - ANIM_FADE_IN_FROM_ADDRESS_EDIT = ANIM_FADE_ADDRESS_EDIT, - ANIM_FADE_OUT_TO_ADDRESS_EDIT, - ANIM_FADE_ADDRESS_ADD, - ANIM_FADE_IN_FROM_ADDRESS_ADD = ANIM_FADE_ADDRESS_ADD, - ANIM_FADE_OUT_TO_ADDRESS_ADD, - ANIM_FOCUS_FACE_IN, - ANIM_FOCUS_FACE_1_IN = ANIM_FOCUS_FACE_IN, - ANIM_FOCUS_FACE_2_IN, - ANIM_FOCUS_FACE_3_IN, - ANIM_FOCUS_FACE_4_IN, - ANIM_FOCUS_FACE_5_IN, - ANIM_FOCUS_FACE_6_IN, - ANIM_FOCUS_FACE_7_IN, - ANIM_FOCUS_FACE_8_IN, - ANIM_FOCUS_FACE_9_IN, - ANIM_FOCUS_FACE_10_IN, - ANIM_FOCUS_FACE_OUT, - ANIM_FOCUS_FACE_1_OUT = ANIM_FOCUS_FACE_OUT, - ANIM_FOCUS_FACE_2_OUT, - ANIM_FOCUS_FACE_3_OUT, - ANIM_FOCUS_FACE_4_OUT, - ANIM_FOCUS_FACE_5_OUT, - ANIM_FOCUS_FACE_6_OUT, - ANIM_FOCUS_FACE_7_OUT, - ANIM_FOCUS_FACE_8_OUT, - ANIM_FOCUS_FACE_9_OUT, - ANIM_FOCUS_FACE_10_OUT, - ANIM_PAGE_SCROLL_LEFT, - ANIM_PAGE_SCROLL_RIGHT, - ANIM_LEFT_ARROW_FOCUS_IN, - ANIM_LEFT_ARROW_FOCUS_OUT, - ANIM_LEFT_ARROW_SELECT, - ANIM_LEFT_ARROW_SELECT_ALT, - ANIM_LEFT_ARROW_SELECT_ALT_REPEAT, - ANIM_LEFT_ARROW_APPEAR, - ANIM_LEFT_ARROW_DISAPPEAR, - ANIM_RIGHT_ARROW_FOCUS_IN, - ANIM_RIGHT_ARROW_FOCUS_OUT, - ANIM_RIGHT_ARROW_SELECT, - ANIM_RIGHT_ARROW_SELECT_ALT, - ANIM_RIGHT_ARROW_SELECT_ALT_REPEAT, - ANIM_RIGHT_ARROW_APPEAR, - ANIM_RIGHT_ARROW_DISAPPEAR, - ANIM_APPEARING, - ANIM_SWITCH_PAGE_NUMBER, - }; + private: + enum { + ANIM_FADE_IN = 0, + ANIM_FADE_OUT, + ANIM_FADE_MEMO = ANIM_FADE_IN, + ANIM_FADE_IN_FROM_MEMO = ANIM_FADE_MEMO, + ANIM_FADE_OUT_TO_MEMO = ANIM_FADE_OUT, + ANIM_FADE_ADDRESS_EDIT, + ANIM_FADE_IN_FROM_ADDRESS_EDIT = ANIM_FADE_ADDRESS_EDIT, + ANIM_FADE_OUT_TO_ADDRESS_EDIT, + ANIM_FADE_ADDRESS_ADD, + ANIM_FADE_IN_FROM_ADDRESS_ADD = ANIM_FADE_ADDRESS_ADD, + ANIM_FADE_OUT_TO_ADDRESS_ADD, + ANIM_FOCUS_FACE_IN, + ANIM_FOCUS_FACE_1_IN = ANIM_FOCUS_FACE_IN, + ANIM_FOCUS_FACE_2_IN, + ANIM_FOCUS_FACE_3_IN, + ANIM_FOCUS_FACE_4_IN, + ANIM_FOCUS_FACE_5_IN, + ANIM_FOCUS_FACE_6_IN, + ANIM_FOCUS_FACE_7_IN, + ANIM_FOCUS_FACE_8_IN, + ANIM_FOCUS_FACE_9_IN, + ANIM_FOCUS_FACE_10_IN, + ANIM_FOCUS_FACE_OUT, + ANIM_FOCUS_FACE_1_OUT = ANIM_FOCUS_FACE_OUT, + ANIM_FOCUS_FACE_2_OUT, + ANIM_FOCUS_FACE_3_OUT, + ANIM_FOCUS_FACE_4_OUT, + ANIM_FOCUS_FACE_5_OUT, + ANIM_FOCUS_FACE_6_OUT, + ANIM_FOCUS_FACE_7_OUT, + ANIM_FOCUS_FACE_8_OUT, + ANIM_FOCUS_FACE_9_OUT, + ANIM_FOCUS_FACE_10_OUT, + ANIM_PAGE_SCROLL_LEFT, + ANIM_PAGE_SCROLL_RIGHT, + ANIM_LEFT_ARROW_FOCUS_IN, + ANIM_LEFT_ARROW_FOCUS_OUT, + ANIM_LEFT_ARROW_SELECT, + ANIM_LEFT_ARROW_SELECT_ALT, + ANIM_LEFT_ARROW_SELECT_ALT_REPEAT, + ANIM_LEFT_ARROW_APPEAR, + ANIM_LEFT_ARROW_DISAPPEAR, + ANIM_RIGHT_ARROW_FOCUS_IN, + ANIM_RIGHT_ARROW_FOCUS_OUT, + ANIM_RIGHT_ARROW_SELECT, + ANIM_RIGHT_ARROW_SELECT_ALT, + ANIM_RIGHT_ARROW_SELECT_ALT_REPEAT, + ANIM_RIGHT_ARROW_APPEAR, + ANIM_RIGHT_ARROW_DISAPPEAR, + ANIM_APPEARING, + ANIM_SWITCH_PAGE_NUMBER, + }; - enum { - STATE_NORMAL = 0, - STATE_LEFT_LOAD, - STATE_RIGHT_LOAD, - STATE_LEFT_SCROLL, - STATE_RIGHT_SCROLL, - STATE_DONE, - }; + enum { + STATE_NORMAL = 0, + STATE_LEFT_LOAD, + STATE_RIGHT_LOAD, + STATE_LEFT_SCROLL, + STATE_RIGHT_SCROLL, + STATE_DONE, + }; - enum { - BTN_FACE_1 = 0, - BTN_FACE_2, - BTN_FACE_3, - BTN_FACE_4, - BTN_FACE_5, - BTN_FACE_6, - BTN_FACE_7, - BTN_FACE_8, - BTN_FACE_9, - BTN_FACE_10, - BTN_MAX_FACE, - BTN_ARROW_LEFT = BTN_MAX_FACE, - BTN_ARROW_RIGHT, - BTN_MAX, - }; + enum { + BTN_FACE_1 = 0, + BTN_FACE_2, + BTN_FACE_3, + BTN_FACE_4, + BTN_FACE_5, + BTN_FACE_6, + BTN_FACE_7, + BTN_FACE_8, + BTN_FACE_9, + BTN_FACE_10, + BTN_MAX_FACE, + BTN_ARROW_LEFT = BTN_MAX_FACE, + BTN_ARROW_RIGHT, + BTN_MAX, + }; - static const int MAX_FACE_EACH_PAGE = 10; - static const int MAX_PAGES = (RFL_MAX_DATABASE / MAX_FACE_EACH_PAGE); // (there really isn't a maximum amount of pages) - - static const int MAX_BALLOONS = BTN_MAX_FACE; + static const int MAX_FACE_EACH_PAGE = 10; + static const int MAX_PAGES = (RFL_MAX_DATABASE / MAX_FACE_EACH_PAGE); // (there really isn't a maximum amount of pages) - void stt_normal(); - void stt_wait_lloaded(); - void stt_wait_rloaded(); - void stt_wait_lscroll(); - void stt_wait_rscroll(); + static const int MAX_BALLOONS = BTN_MAX_FACE; - void start_lloaded(); - void start_rloaded(); - void start_lscroll(); - void start_rscroll(); + void stt_normal(); + void stt_wait_lloaded(); + void stt_wait_rloaded(); + void stt_wait_lscroll(); + void stt_wait_rscroll(); - void start_point_event(const char* paneName, controller::Interface* con); - void start_left_event(const char* paneName); - void start_trig_event(const char* paneName); + void start_lloaded(); + void start_rloaded(); + void start_lscroll(); + void start_rscroll(); - int get_button_no(const char* paneName); + void start_point_event(const char* paneName, controller::Interface* con); + void start_left_event(const char* paneName); + void start_trig_event(const char* paneName); - BOOL is_exist(int btnId) const; + int get_button_no(const char* paneName); - void change_state(int state); + BOOL is_exist(int btnId) const; - void set_page(); + void change_state(int state); - void reset_gui(); + void set_page(); - void set_face_pane(const char** facePaneList); - void clear_face_pane(const char** facePaneList); - void destroy_object(); - void read_face(); + void reset_gui(); - layout::Object* mpLayout; // 0x58 - nand::LayoutFile* mpLayoutFile; // 0x5C + void set_face_pane(const char** facePaneList); + void clear_face_pane(const char** facePaneList); + void destroy_object(); + void read_face(); - FaceSelectEvent* mpEvent; // 0x60 - gui::PaneManager* mpGui; // 0x64 - FaceSelectButtonEvent* mpButtonEvent; // 0x68 + layout::Object* mpLayout; // 0x58 + nand::LayoutFile* mpLayoutFile; // 0x5C - u32 mState; // 0x6C - int mPrevState; // 0x70 + FaceSelectEvent* mpEvent; // 0x60 + gui::PaneManager* mpGui; // 0x64 + FaceSelectButtonEvent* mpButtonEvent; // 0x68 - int mCurrentPage; // 0x74 - int mFaceCount; // 0x78 + u32 mState; // 0x6C + int mPrevState; // 0x70 - int mFaceIds[RFL_MAX_DATABASE]; // 0x7C - int mbHovered[BTN_MAX]; // 0x20C + int mCurrentPage; // 0x74 + int mFaceCount; // 0x78 - int mSelectedFaceId; // 0x23C - u32 mCachedPage; // 0x240 + int mFaceIds[RFL_MAX_DATABASE]; // 0x7C + int mbHovered[BTN_MAX]; // 0x20C - Face mpFaces[2][MAX_FACE_EACH_PAGE]; // 0x244 + int mSelectedFaceId; // 0x23C + u32 mCachedPage; // 0x240 - bool mbPreparing; // 0x2E4 - bool mbLeftArrowExit; // 0x2E5 - bool mbRightArrowExit; // 0x2E6 + Face mpFaces[2][MAX_FACE_EACH_PAGE]; // 0x244 - int mFadeType; // 0x2E8 - u32 mFadeAnimIndex; // 0x2EC + bool mbPreparing; // 0x2E4 + bool mbLeftArrowExit; // 0x2E5 + bool mbRightArrowExit; // 0x2E6 - TextBalloon* mpBalloons[MAX_BALLOONS]; // 0x2F0 - nand::LayoutFile* mpBalloonFile; // 0x318 + int mFadeType; // 0x2E8 + u32 mFadeAnimIndex; // 0x2EC - static const char* mscButtonName[BTN_MAX]; + TextBalloon* mpBalloons[MAX_BALLOONS]; // 0x2F0 + nand::LayoutFile* mpBalloonFile; // 0x318 - static const char* mscFacePane[BTN_MAX_FACE]; - static const char* mscLeftFacePane[BTN_MAX_FACE]; - static const char* mscRightFacePane[BTN_MAX_FACE]; + static const char* mscButtonName[BTN_MAX]; - friend class FaceSelectEvent; - friend class FaceSelectButtonEvent; + static const char* mscFacePane[BTN_MAX_FACE]; + static const char* mscLeftFacePane[BTN_MAX_FACE]; + static const char* mscRightFacePane[BTN_MAX_FACE]; + + friend class FaceSelectEvent; + friend class FaceSelectButtonEvent; }; class FaceSelectEvent : public ::gui::EventHandler { - public: - FaceSelectEvent(FaceSelect* instance) : - ::gui::EventHandler(), - mpInstance(instance) {} + public: + FaceSelectEvent(FaceSelect* instance) : ::gui::EventHandler(), mpInstance(instance) {} + virtual void onEvent(u32 compId, u32 event, void* data); - virtual void onEvent(u32 compId, u32 event, void* data); - - private: - FaceSelect* mpInstance; // 0x0C + private: + FaceSelect* mpInstance; // 0x0C }; class FaceSelectButtonEvent : public ButtonEventHandlerBase { - public: - FaceSelectButtonEvent(FaceSelect* instance) : - ButtonEventHandlerBase(), - mpInstance(instance) {} + public: + FaceSelectButtonEvent(FaceSelect* instance) : ButtonEventHandlerBase(), mpInstance(instance) {} - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); + virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); - private: - FaceSelect* mpInstance; // 0x0C + private: + FaceSelect* mpInstance; // 0x0C }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_FACE_SELECT_H +#endif // IPL_SCENE_FACE_SELECT_H diff --git a/include/scene/health/iplHealth.h b/include/scene/health/iplHealth.h index 50d34795..4fca93a7 100644 --- a/include/scene/health/iplHealth.h +++ b/include/scene/health/iplHealth.h @@ -6,51 +6,51 @@ namespace ipl { namespace scene { FADER_SCENE_CLASS(skHealth) { - public: - skHealth(EGG::Heap* heap); - virtual ~skHealth(); + public: + skHealth(EGG::Heap * heap); + virtual ~skHealth(); - virtual BOOL isReady() const; + virtual BOOL isReady() const; - virtual void prepare(); - virtual void create(); - virtual void draw(); - virtual void destroy(); + virtual void prepare(); + virtual void create(); + virtual void draw(); + virtual void destroy(); - virtual FaderSceneCommand calcFadein(); - virtual FaderSceneCommand calcNormal(); - virtual FaderSceneCommand calcFadeout(); + virtual FaderSceneCommand calcFadein(); + virtual FaderSceneCommand calcNormal(); + virtual FaderSceneCommand calcFadeout(); - private: - enum { - ANIM_FADE_IN = 0, - ANIM_WAIT_PUSH, - ANIM_FADE_OUT, - }; - - void check_safe_mode(); - BOOL finish_safe_mode_check() const; + private: + enum { + ANIM_FADE_IN = 0, + ANIM_WAIT_PUSH, + ANIM_FADE_OUT, + }; - u32 getCountryIndex_(); - - layout::Object* mpLayout; // 0x58 - nand::LayoutFile* mpLayoutFile; // 0x5C + void check_safe_mode(); + BOOL finish_safe_mode_check() const; - nw4r::lyt::Pane* mpHasPane; // 0x60 - nw4r::lyt::Pane* mpPushPane; // 0x64 + u32 getCountryIndex_(); - OSTick mWaitTick; // 0x68 - OSTick mPushTick; // 0x6C + layout::Object* mpLayout; // 0x58 + nand::LayoutFile* mpLayoutFile; // 0x5C - bool mbFadedIn; // 0x70 + nw4r::lyt::Pane* mpHasPane; // 0x60 + nw4r::lyt::Pane* mpPushPane; // 0x64 - u32 mWpadMask; // 0x74 + OSTick mWaitTick; // 0x68 + OSTick mPushTick; // 0x6C - OSTick mSafeModeTick; // 0x78 - bool mbHeldCombo; // 0x7C - bool mbDoneSafeMode; // 0x7D + bool mbFadedIn; // 0x70 + + u32 mWpadMask; // 0x74 + + OSTick mSafeModeTick; // 0x78 + bool mbHeldCombo; // 0x7C + bool mbDoneSafeMode; // 0x7D }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_HEALTH_H +#endif // IPL_HEALTH_H diff --git a/include/scene/iplFaderSceneBase.h b/include/scene/iplFaderSceneBase.h index 23295cc3..d841c0a7 100644 --- a/include/scene/iplFaderSceneBase.h +++ b/include/scene/iplFaderSceneBase.h @@ -3,7 +3,7 @@ #include "scene/iplSceneBase.h" -#define FADER_SCENE_CLASS(x) class x : public scene::FaderSceneBase +#define FADER_SCENE_CLASS(x) class x : public scene::FaderSceneBase namespace ipl { namespace scene { @@ -15,38 +15,51 @@ namespace ipl { }; SCENE_CLASS(FaderSceneBase) { - public: - enum { - STT_FADE_IN = 0, - STT_INIT_NORMAL, - STT_NORMAL, - STT_INIT_FADE_OUT, - STT_FADE_OUT, - STT_DONE, - }; + public: + enum { + STT_FADE_IN = 0, + STT_INIT_NORMAL, + STT_NORMAL, + STT_INIT_FADE_OUT, + STT_FADE_OUT, + STT_DONE, + }; - FaderSceneBase(EGG::Heap* heap); - virtual ~FaderSceneBase() {} + FaderSceneBase(EGG::Heap * heap); + virtual ~FaderSceneBase() { + } - virtual void calc(); + virtual void calc(); - virtual void initCalcNormal() {} // 0x4C - virtual void initCalcFadeout() {} // 0x50 + virtual void initCalcNormal() { + } // 0x4C + virtual void initCalcFadeout() { + } // 0x50 - virtual void calcCommon() {} // 0x54 + virtual void calcCommon() { + } // 0x54 - virtual FaderSceneCommand calcFadein() { return FADER_SCN_NEXT; } // 0x58 - virtual FaderSceneCommand calcNormal() { return FADER_SCN_NEXT; } // 0x5C - virtual FaderSceneCommand calcFadeout() { return FADER_SCN_NEXT; } // 0x60 + virtual FaderSceneCommand calcFadein() { + return FADER_SCN_NEXT; + } // 0x58 + virtual FaderSceneCommand calcNormal() { + return FADER_SCN_NEXT; + } // 0x5C + virtual FaderSceneCommand calcFadeout() { + return FADER_SCN_NEXT; + } // 0x60 - virtual void calcCommonAfter() {} // 0x64 + virtual void calcCommonAfter() { + } // 0x64 - int getSceneFadeState() { return mScnFadeState; } + int getSceneFadeState() { + return mScnFadeState; + } - protected: - int mScnFadeState; // 0x54 + protected: + int mScnFadeState; // 0x54 }; - } -} + } // namespace scene +} // namespace ipl -#endif // BASE_SCENE_FADER_H +#endif // BASE_SCENE_FADER_H diff --git a/include/scene/iplRootScene.h b/include/scene/iplRootScene.h index 183f4b9a..d3629432 100644 --- a/include/scene/iplRootScene.h +++ b/include/scene/iplRootScene.h @@ -6,20 +6,22 @@ namespace ipl { namespace scene { SCENE_CLASS(RootScene) { - public: - RootScene(EGG::Heap* heap, int sceneId) : Base(heap), mInitialArgs(NULL), mInitialSceneID((void*)sceneId) {} - virtual ~RootScene() {} + public: + RootScene(EGG::Heap * heap, int sceneId) : Base(heap), mInitialArgs(NULL), mInitialSceneID((void*)sceneId) { + } + virtual ~RootScene() { + } + + void create(); + static void proc_boot_scene(int* initialScene, int* initialSubScene); + + private: + void* mInitialArgs; // 0x54 + void* mInitialSceneID; // 0x58 - void create(); - static void proc_boot_scene(int* initialScene, int* initialSubScene); - - private: - void* mInitialArgs; // 0x54 - void* mInitialSceneID; // 0x58 - friend class Manager; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_ROOT_H +#endif // IPL_SCENE_ROOT_H diff --git a/include/scene/iplSceneBase.h b/include/scene/iplSceneBase.h index f35b0092..1b5ff666 100644 --- a/include/scene/iplSceneBase.h +++ b/include/scene/iplSceneBase.h @@ -9,18 +9,18 @@ #include #include -#define SCENE_USING_GUI \ -namespace ipl { \ - namespace gui { \ - class PaneManager; \ - } \ -} \ -namespace gui { \ - class EventHandler; \ -} +#define SCENE_USING_GUI \ + namespace ipl { \ + namespace gui { \ + class PaneManager; \ + } \ + } \ + namespace gui { \ + class EventHandler; \ + } -#define SCENE_CLASS(x) class x : public scene::Base -#define SCENE_GUI_CLASS(x) class x : public scene::Base, public ::gui::EventHandler +#define SCENE_CLASS(x) class x : public scene::Base +#define SCENE_GUI_CLASS(x) class x : public scene::Base, public ::gui::EventHandler namespace ipl { namespace scene { @@ -33,164 +33,164 @@ namespace ipl { }; typedef struct Command { - int type; // 0x00 + int type; // 0x00 - int newSceneID; // 0x04 - int prevSceneID; // 0x08 - int newRootID; // 0x0C + int newSceneID; // 0x04 + int prevSceneID; // 0x08 + int newRootID; // 0x0C - Base* parent; // 0x10 - Base* child; // 0x14 - - void* args; // 0x18 + Base* parent; // 0x10 + Base* child; // 0x14 - void clear(); + void* args; // 0x18 - Command() { clear(); } + void clear(); + + Command() { clear(); } } Command; class Base : public utility::Tree, EGG::Disposer { /* PUBLIC FUNCTIONS */ + public: + /** @brief If the scene is ready */ + Base(EGG::Heap* heap); + virtual ~Base(); + + /** @brief If the scene is ready */ + virtual BOOL isReady() const { return FALSE; } + + /** @brief If the user can power off/reset the system */ + virtual BOOL isResetAcceptable() const { return TRUE; } + /** @brief The scene running code when powering off/resetting the system */ + virtual void startResetting() {} + /** @brief If the scene has finished its powering off/resetting task */ + virtual BOOL isResetProcessDone() { return TRUE; } + + /** @brief Prepare to create scene */ + virtual void prepare() {} + /** @brief Creating the scene */ + virtual void create() {} + /** @brief Update the scene */ + virtual void calc() {} + /** @brief Rendering the scene */ + virtual void draw() {} + /** @brief Destroy the scene and clear from memory */ + virtual void destroy() {} + + virtual Base* getParent() { return (Base*)mpParent; } + virtual Base* getChild() { return (Base*)mpChild; } + virtual Base* getNext() { return (Base*)mpNext; } + virtual Base* getPrev() { return (Base*)mpPrev; } + + /** @brief Check if scene has been created.*/ + bool isSceneCreated() const { return (mScnState & SCN_STATE_CREATED); } + + /* TREE CLASSES */ + + class iterator : public utility::Tree::iterator { + typedef Base value_type; + typedef value_type* pointer; + typedef value_type& reference; + public: - /** @brief If the scene is ready */ - Base(EGG::Heap* heap); - virtual ~Base(); + explicit inline iterator(pointer ptr) : utility::Tree::iterator(ptr) {} - /** @brief If the scene is ready */ - virtual BOOL isReady() const { return FALSE; } + virtual reference operator*() { return (Base&)*mPtr; } + pointer operator->() { return (Base*)mPtr; } - /** @brief If the user can power off/reset the system */ - virtual BOOL isResetAcceptable() const { return TRUE; } - /** @brief The scene running code when powering off/resetting the system */ - virtual void startResetting() {} - /** @brief If the scene has finished its powering off/resetting task */ - virtual BOOL isResetProcessDone() { return TRUE; } + pointer getPtr() { return (pointer)mPtr; } + void setPtr(pointer p) { mPtr = p; } + }; - /** @brief Prepare to create scene */ - virtual void prepare() {} - /** @brief Creating the scene */ - virtual void create() {} - /** @brief Update the scene */ - virtual void calc() {} - /** @brief Rendering the scene */ - virtual void draw() {} - /** @brief Destroy the scene and clear from memory */ - virtual void destroy() {} + class reverse_iterator : public utility::Tree::reverse_iterator { + typedef Base value_type; + typedef value_type* pointer; + typedef value_type& reference; - virtual Base* getParent() { return (Base*)mpParent; } - virtual Base* getChild() { return (Base*)mpChild; } - virtual Base* getNext() { return (Base*)mpNext; } - virtual Base* getPrev() { return (Base*)mpPrev; } + public: + explicit inline reverse_iterator(pointer ptr) : utility::Tree::reverse_iterator(ptr) {} - /** @brief Check if scene has been created.*/ - bool isSceneCreated() const { return (mScnState & SCN_STATE_CREATED); } + virtual reference operator*() { return (reference)*mPtr; } + pointer operator->() { return (pointer)mPtr; } - /* TREE CLASSES */ - - class iterator : public utility::Tree::iterator { - typedef Base value_type; - typedef value_type* pointer; - typedef value_type& reference; - - public: - explicit inline iterator(pointer ptr) : utility::Tree::iterator(ptr) {} - - virtual reference operator*() { return (Base&)*mPtr; } - pointer operator->() { return (Base*)mPtr; } - - pointer getPtr() { return (pointer)mPtr; } - void setPtr(pointer p) { mPtr = p; } - }; - - class reverse_iterator : public utility::Tree::reverse_iterator { - typedef Base value_type; - typedef value_type* pointer; - typedef value_type& reference; - - public: - explicit inline reverse_iterator(pointer ptr) : utility::Tree::reverse_iterator(ptr) {} - - virtual reference operator*() { return (reference)*mPtr; } - pointer operator->() { return (pointer)mPtr; } - - pointer getPtr() { return (pointer)mPtr; } - void setPtr(pointer p) { mPtr = p; } - }; + pointer getPtr() { return (pointer)mPtr; } + void setPtr(pointer p) { mPtr = p; } + }; /* PRIVATE STUFF */ - private: - enum { - SCN_STATE_CREATED = (1 << 0), - SCN_STATE_DESTROY_REQ = (1 << 1), - }; + private: + enum { + SCN_STATE_CREATED = (1 << 0), + SCN_STATE_DESTROY_REQ = (1 << 1), + }; - void do_prepare(); - void do_create(); - void do_calc(); - void do_draw(); - void do_destroy(); + void do_prepare(); + void do_create(); + void do_calc(); + void do_draw(); + void do_destroy(); - EGG::Heap* mpHeap; // 0x24 + EGG::Heap* mpHeap; // 0x24 - u32 mParentFlags; // 0x28 - u32 mScnState; // 0x2C - int mSceneID; // 0x30 - u32 mPrevSceneID; // 0x34 + u32 mParentFlags; // 0x28 + u32 mScnState; // 0x2C + int mSceneID; // 0x30 + u32 mPrevSceneID; // 0x34 + + Command mCommand; // 0x38 - Command mCommand; // 0x38 - /* FUNCTIONS FOR SCENES */ - protected: - enum { - SCN_PARENTFLAG_CALC = (1 << 0), - SCN_PARENTFLAG_DRAW = (1 << 1), - }; + protected: + enum { + SCN_PARENTFLAG_CALC = (1 << 0), + SCN_PARENTFLAG_DRAW = (1 << 1), + }; - /** - * @brief Creates a child scene. - * @param sceneId The target scene ID (refer to iplSceneCreator.h) - * @param arg Arguments for the scene - */ - void createChildScene(int sceneId, Base* parent, Base* child, void* args = NULL); + /** + * @brief Creates a child scene. + * @param sceneId The target scene ID (refer to iplSceneCreator.h) + * @param arg Arguments for the scene + */ + void createChildScene(int sceneId, Base* parent, Base* child, void* args = NULL); - /** - * @brief Sends a request to change scene. - * @param sceneId The target scene ID (refer to iplSceneCreator.h) - * @param arg Arguments for the scene - */ - void reserveSceneChange(int sceneId, void* args = NULL); + /** + * @brief Sends a request to change scene. + * @param sceneId The target scene ID (refer to iplSceneCreator.h) + * @param arg Arguments for the scene + */ + void reserveSceneChange(int sceneId, void* args = NULL); - /** - * @brief Sends a request to destroy every active scene, then change scene. - * @param sceneId The target scene ID (refer to iplSceneCreator.h) - * @param arg Arguments for the scene - */ - void reserveAllSceneDestruction(int sceneId, void* args = NULL); + /** + * @brief Sends a request to destroy every active scene, then change scene. + * @param sceneId The target scene ID (refer to iplSceneCreator.h) + * @param arg Arguments for the scene + */ + void reserveAllSceneDestruction(int sceneId, void* args = NULL); - /** - * Sets flags for it's parent scene. - * SCN_PARENTFLAG_CALC = The parent scene can run `calc()` - * SCN_PARENTFLAG_DRAW = The parent scene can run `draw()` - * @param flag The flags - * @note You must execute this in the scene's constructor. - */ - void setSceneParentFlags(u32 flag) { mParentFlags = flag; } + /** + * Sets flags for it's parent scene. + * SCN_PARENTFLAG_CALC = The parent scene can run `calc()` + * SCN_PARENTFLAG_DRAW = The parent scene can run `draw()` + * @param flag The flags + * @note You must execute this in the scene's constructor. + */ + void setSceneParentFlags(u32 flag) { mParentFlags = flag; } - /** - * @brief Request scene to be destroyed. - */ - void requestSceneDestruction() { mScnState |= SCN_STATE_DESTROY_REQ; } + /** + * @brief Request scene to be destroyed. + */ + void requestSceneDestruction() { mScnState |= SCN_STATE_DESTROY_REQ; } - EGG::Heap* getSceneHeap() { return mpHeap; } - int getSceneID() const { return mSceneID; } - u32 getPrevSceneID() const { return mPrevSceneID; } + EGG::Heap* getSceneHeap() { return mpHeap; } + int getSceneID() const { return mSceneID; } + u32 getPrevSceneID() const { return mPrevSceneID; } friend class Manager; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_BASE_SCENE_H +#endif // IPL_BASE_SCENE_H diff --git a/include/scene/iplSceneCreator.h b/include/scene/iplSceneCreator.h index eb060120..de2a53d8 100644 --- a/include/scene/iplSceneCreator.h +++ b/include/scene/iplSceneCreator.h @@ -8,60 +8,60 @@ namespace ipl { namespace scene { enum { - SCENE_NONE = 0, /* 0x00, 0 */ - SCENE_ROOT, /* 0x01, 1 */ - SCENE_CHANNEL_SELECT, /* 0x02, 2 */ - SCENE_CHANNEL_TITLE, /* 0x03, 3 */ - SCENE_BOARD, /* 0x04, 4 */ - SCENE_BUTTON, /* 0x05, 5 */ - SCENE_ARROW, /* 0x06, 6 */ - SCENE_CALENDAR, /* 0x07, 7 */ - SCENE_MAIL_ADDRESS_SELECT, /* 0x08, 8 */ - SCENE_UNUSED_9, /* 0x09 */ - SCENE_TEXT_WRITER, /* 0x0A, 10 */ - SCENE_LETTER_WRITER, /* 0x0B, 11 */ - SCENE_CHANNEL_EDIT, /* 0x0C, 12 */ - SCENE_MEMORY, /* 0x0D, 13 */ - SCENE_MEMORY_CARD, /* 0x0E, 14 */ - SCENE_UNUSED_15, /* 0x0F */ - SCENE_UNUSED_16, /* 0x10 */ - SCENE_UNUSED_17, /* 0x11 */ - SCENE_SETTING, /* 0x12, 18 */ - SCENE_SETTING_SELECT, /* 0x13, 19 */ - SCENE_ADDRESS, /* 0x14, 20 */ - SCENE_SETTING_BG, /* 0x15, 21 */ - SCENE_SETTING_BUTTON, /* 0x16, 22 */ - SCENE_ADDRESS_EDIT, /* 0x17, 23 */ - SCENE_ADDRESS_ADD_SELECT, /* 0x18, 24 */ - SCENE_NAKAMURA_TEST, /* 0x19, 25 */ - SCENE_HEALTH, /* 0x1A, 26 */ - SCENE_PARENTAL_DIALOG, /* 0x1B, 27 */ - SCENE_FACE_SELECT, /* 0x1C, 28 */ - SCENE_KITAYAMA_TEST, /* 0x1D, 29 */ - SCENE_BACK_MENU, /* 0x1E, 30 */ - SCENE_LIMIT_OVER, /* 0x1F, 31 */ - SCENE_REBOOT, /* 0x20, 32 */ - SCENE_UNUSED_33, /* 0x21 */ - SCENE_SD_CHANNEL_SELECT, /* 0x22, 34 */ - SCENE_SD_CHANNEL_TITLE, /* 0x23, 35 */ - SCENE_SD_BUTTON, /* 0x24, 36 */ - SCENE_SD_ARROW, /* 0x25, 37 */ + SCENE_NONE = 0, /* 0x00, 0 */ + SCENE_ROOT, /* 0x01, 1 */ + SCENE_CHANNEL_SELECT, /* 0x02, 2 */ + SCENE_CHANNEL_TITLE, /* 0x03, 3 */ + SCENE_BOARD, /* 0x04, 4 */ + SCENE_BUTTON, /* 0x05, 5 */ + SCENE_ARROW, /* 0x06, 6 */ + SCENE_CALENDAR, /* 0x07, 7 */ + SCENE_MAIL_ADDRESS_SELECT, /* 0x08, 8 */ + SCENE_UNUSED_9, /* 0x09 */ + SCENE_TEXT_WRITER, /* 0x0A, 10 */ + SCENE_LETTER_WRITER, /* 0x0B, 11 */ + SCENE_CHANNEL_EDIT, /* 0x0C, 12 */ + SCENE_MEMORY, /* 0x0D, 13 */ + SCENE_MEMORY_CARD, /* 0x0E, 14 */ + SCENE_UNUSED_15, /* 0x0F */ + SCENE_UNUSED_16, /* 0x10 */ + SCENE_UNUSED_17, /* 0x11 */ + SCENE_SETTING, /* 0x12, 18 */ + SCENE_SETTING_SELECT, /* 0x13, 19 */ + SCENE_ADDRESS, /* 0x14, 20 */ + SCENE_SETTING_BG, /* 0x15, 21 */ + SCENE_SETTING_BUTTON, /* 0x16, 22 */ + SCENE_ADDRESS_EDIT, /* 0x17, 23 */ + SCENE_ADDRESS_ADD_SELECT, /* 0x18, 24 */ + SCENE_NAKAMURA_TEST, /* 0x19, 25 */ + SCENE_HEALTH, /* 0x1A, 26 */ + SCENE_PARENTAL_DIALOG, /* 0x1B, 27 */ + SCENE_FACE_SELECT, /* 0x1C, 28 */ + SCENE_KITAYAMA_TEST, /* 0x1D, 29 */ + SCENE_BACK_MENU, /* 0x1E, 30 */ + SCENE_LIMIT_OVER, /* 0x1F, 31 */ + SCENE_REBOOT, /* 0x20, 32 */ + SCENE_UNUSED_33, /* 0x21 */ + SCENE_SD_CHANNEL_SELECT, /* 0x22, 34 */ + SCENE_SD_CHANNEL_TITLE, /* 0x23, 35 */ + SCENE_SD_BUTTON, /* 0x24, 36 */ + SCENE_SD_ARROW, /* 0x25, 37 */ }; enum { - SCENE_SMALL_SIZE = 0x0000DC00, - SCENE_MEDIUM_SIZE = 0x000AF000, - SCENE_BIG_SIZE = 0x0012C000, + SCENE_SMALL_SIZE = 0x0000DC00, + SCENE_MEDIUM_SIZE = 0x000AF000, + SCENE_BIG_SIZE = 0x0012C000, }; - + class Base; typedef Base SceneObj; class Creator { - public: - static SceneObj* create(int sceneId, EGG::Heap* heap, void* arg); - static int size(int sceneId); + public: + static SceneObj* create(int sceneId, EGG::Heap* heap, void* arg); + static int size(int sceneId); }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_CREATOR_H +#endif // IPL_SCENE_CREATOR_H diff --git a/include/scene/iplSceneManager.h b/include/scene/iplSceneManager.h index bf132201..34d1acfe 100644 --- a/include/scene/iplSceneManager.h +++ b/include/scene/iplSceneManager.h @@ -9,14 +9,16 @@ #include +// clang-format off #include "scene/iplSceneCreator.h" #include "scene/iplSceneBase.h" +// clang-format on #include "utility/iplQueue.h" namespace ipl { namespace scene { - class Base; + class Base; typedef Base SceneObj; enum { @@ -27,75 +29,75 @@ namespace ipl { DRAW_LAYER_MAX, }; - #define MAX_COMMANDS 8 +#define MAX_COMMANDS 8 typedef utility::Queue CommandList; class Manager { - public: - Manager(EGG::Heap* heap); + public: + Manager(EGG::Heap* heap); - void init(); + void init(); - void calc(); - void calc(SceneObj* scene); + void calc(); + void calc(SceneObj* scene); - void draw(); - void draw(SceneObj* scene); + void draw(); + void draw(SceneObj* scene); - SceneObj* createScene(int sceneId, int prevSceneId, void* args); - SceneObj* createScene(int sceneId, void* args) { return createScene(sceneId, SCENE_NONE, args); } - void createScene(const Command& command); + SceneObj* createScene(int sceneId, int prevSceneId, void* args); + SceneObj* createScene(int sceneId, void* args) { return createScene(sceneId, SCENE_NONE, args); } + void createScene(const Command& command); - void destroyScene(SceneObj* scene); - void detach(SceneObj* scene); + void destroyScene(SceneObj* scene); + void detach(SceneObj* scene); - void startResetting(); - BOOL isResetProcessDone(); - BOOL isResetAcceptable(); + void startResetting(); + BOOL isResetProcessDone(); + BOOL isResetAcceptable(); - BOOL pushCommand(const Command& pCommand); + BOOL pushCommand(const Command& pCommand); - void setDestructSync(); - void doDestructSync() { mbDestroySyncTask = true; } + void setDestructSync(); + void doDestructSync() { mbDestroySyncTask = true; } - SceneObj* getScene(int sceneId); - SceneObj* getScene(int sceneId, SceneObj* obj); + SceneObj* getScene(int sceneId); + SceneObj* getScene(int sceneId, SceneObj* obj); - bool onDefaultDrawLayer() { return mDrawLayer == DRAW_LAYER_2; } - bool onDrawLayer(int layer) { return mDrawLayer == layer; } + bool onDefaultDrawLayer() { return mDrawLayer == DRAW_LAYER_2; } + bool onDrawLayer(int layer) { return mDrawLayer == layer; } - void attachReservedScene(); + void attachReservedScene(); - BOOL isReady(int sceneId); + BOOL isReady(int sceneId); - SceneObj* getReservedScene() { return mpReservedScene; } + SceneObj* getReservedScene() { return mpReservedScene; } - int getCurrentRootSceneID() { return mRootSceneID; } - int getPreviousRootSceneID() { return mPrevRootSceneID; } - - private: - void createRootScene(int sceneId, void* args); + int getCurrentRootSceneID() { return mRootSceneID; } + int getPreviousRootSceneID() { return mPrevRootSceneID; } - EGG::UnitHeap* mpBigSceneHeap; // 0x00 - EGG::UnitHeap* mpMdmSceneHeap; // 0x04 - EGG::UnitHeap* mpSmlSceneHeap; // 0x08 + private: + void createRootScene(int sceneId, void* args); - SceneObj* mpRootScene; // 0x0C + EGG::UnitHeap* mpBigSceneHeap; // 0x00 + EGG::UnitHeap* mpMdmSceneHeap; // 0x04 + EGG::UnitHeap* mpSmlSceneHeap; // 0x08 - CommandList mCommands; // 0x10 + SceneObj* mpRootScene; // 0x0C - int mDrawLayer; // 0x100 + CommandList mCommands; // 0x10 - SceneObj* mpReservedScene; // 0x104 - Command mReservedCommand; // 0x108 - bool mbCreatedReserved; // 0x124 + int mDrawLayer; // 0x100 - bool mbDestroySyncTask; // 0x125 + SceneObj* mpReservedScene; // 0x104 + Command mReservedCommand; // 0x108 + bool mbCreatedReserved; // 0x124 - int mRootSceneID; // 0x128 - int mPrevRootSceneID; // 0x12C + bool mbDestroySyncTask; // 0x125 + + int mRootSceneID; // 0x128 + int mPrevRootSceneID; // 0x12C }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_MANAGER_H +#endif // IPL_SCENE_MANAGER_H diff --git a/include/scene/kitayamaTest/iplKitayamaTest.h b/include/scene/kitayamaTest/iplKitayamaTest.h index b15c425b..2d0081a1 100644 --- a/include/scene/kitayamaTest/iplKitayamaTest.h +++ b/include/scene/kitayamaTest/iplKitayamaTest.h @@ -6,13 +6,13 @@ namespace ipl { namespace scene { FADER_SCENE_CLASS(KitayamaTest) { - public: - KitayamaTest(EGG::Heap* heap, int); + public: + KitayamaTest(EGG::Heap * heap, int); - private: - u8 unk_0x58[0x20]; + private: + u8 unk_0x58[0x20]; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_KITAYAMA_TEST_H +#endif // IPL_SCENE_KITAYAMA_TEST_H diff --git a/include/scene/letterWriter/iplLetterWriter.h b/include/scene/letterWriter/iplLetterWriter.h index f5147407..bac1a82a 100644 --- a/include/scene/letterWriter/iplLetterWriter.h +++ b/include/scene/letterWriter/iplLetterWriter.h @@ -7,76 +7,76 @@ namespace ipl { namespace scene { class Board; class LetterWriter : public TextWriter { - public: - enum { - MAIL_ADDRESS_SEL = textinput::extend::letter::InputForm::T_MailAddressSel, - ADDRESS = textinput::extend::letter::InputForm::T_Address, - PICTURE = textinput::extend::letter::InputForm::T_Picture, - REPLY = textinput::extend::letter::InputForm::T_Reply, - }; + public: + enum { + MAIL_ADDRESS_SEL = textinput::extend::letter::InputForm::T_MailAddressSel, + ADDRESS = textinput::extend::letter::InputForm::T_Address, + PICTURE = textinput::extend::letter::InputForm::T_Picture, + REPLY = textinput::extend::letter::InputForm::T_Reply, + }; - LetterWriter(EGG::Heap* heap, int type); - ~LetterWriter(); + LetterWriter(EGG::Heap* heap, int type); + ~LetterWriter(); - virtual void create(); - virtual void destroy(); + virtual void create(); + virtual void destroy(); - virtual void initCalcNormal(); - virtual void initCalcFadeout(); + virtual void initCalcNormal(); + virtual void initCalcFadeout(); - virtual void calcCommon() {} + virtual void calcCommon() {} - virtual FaderSceneCommand calcFadein(); - virtual FaderSceneCommand calcNormal(); - virtual FaderSceneCommand calcFadeout(); + virtual FaderSceneCommand calcFadein(); + virtual FaderSceneCommand calcNormal(); + virtual FaderSceneCommand calcFadeout(); - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); + virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); - virtual void onSend(); - virtual int sendMessageByNWC24(NWC24UserId userId, const wchar_t* wcString); + virtual void onSend(); + virtual int sendMessageByNWC24(NWC24UserId userId, const wchar_t* wcString); - virtual void setFriendInfo(const NWC24FriendInfo& info); - virtual void setPhoto(const GXTexObj& texObj); + virtual void setFriendInfo(const NWC24FriendInfo& info); + virtual void setPhoto(const GXTexObj& texObj); - virtual int sendToWii(NWC24UserId userId, const wchar_t* wcString); - virtual int sendToPC(NWC24UserId userId, const wchar_t* wcString); + virtual int sendToWii(NWC24UserId userId, const wchar_t* wcString); + virtual int sendToPC(NWC24UserId userId, const wchar_t* wcString); - virtual wchar_t* makeHeaderCaption(const wchar_t* headerCaption); + virtual wchar_t* makeHeaderCaption(const wchar_t* headerCaption); - virtual BOOL getFriendInfo(); + virtual BOOL getFriendInfo(); - textinput::MemoManager* getLetterManager(); /* i just thought it would be nice idk */ - textinput::LetterInputForm* getLetterInputForm(); + textinput::MemoManager* getLetterManager(); /* i just thought it would be nice idk */ + textinput::LetterInputForm* getLetterInputForm(); - Board* getBoard(); + Board* getBoard(); - private: - enum { - LETTER_STATE_NORMAL = 0, - LETTER_STATE_DISABLE_UI, - LETTER_STATE_ENABLE_UI, - LETTER_STATE_SEND, - LETTER_STATE_EXIT_ON_ERROR, - }; + private: + enum { + LETTER_STATE_NORMAL = 0, + LETTER_STATE_DISABLE_UI, + LETTER_STATE_ENABLE_UI, + LETTER_STATE_SEND, + LETTER_STATE_EXIT_ON_ERROR, + }; - NWC24FriendInfo mFriendInfo; // 0xA0 - bool mbToFriend; // 0x1E0 + NWC24FriendInfo mFriendInfo; // 0xA0 + bool mbToFriend; // 0x1E0 - int mLetterState; // 0x1E4 + int mLetterState; // 0x1E4 - textinput::extend::letter::InputForm::Type mLetterType; // 0x1E8 + textinput::extend::letter::InputForm::Type mLetterType; // 0x1E8 - u8* mpTextSubjectWork; // 0x1EC - static const int mTextSubjectWorkSize = 0x2000; + u8* mpTextSubjectWork; // 0x1EC + static const int mTextSubjectWorkSize = 0x2000; - textinput::tistring::StringBase* mpCaptionString; // 0x1F0 - EGG::Allocator* mpCaptionAllocator; // 0x1F4 + textinput::tistring::StringBase* mpCaptionString; // 0x1F0 + EGG::Allocator* mpCaptionAllocator; // 0x1F4 - u32 mNwc24ErrCountdown2; // 0x1F8 + u32 mNwc24ErrCountdown2; // 0x1F8 - u8 unused_0x1FC[4]; + u8 unused_0x1FC[4]; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_LETTER_WRITER_H +#endif // IPL_SCENE_LETTER_WRITER_H diff --git a/include/scene/limitOver/iplLimitOver.h b/include/scene/limitOver/iplLimitOver.h index 12bd28c2..ca3c07ed 100644 --- a/include/scene/limitOver/iplLimitOver.h +++ b/include/scene/limitOver/iplLimitOver.h @@ -6,44 +6,44 @@ namespace ipl { namespace scene { FADER_SCENE_CLASS(LimitOver) { - public: - LimitOver(EGG::Heap* heap); - virtual ~LimitOver(); + public: + LimitOver(EGG::Heap * heap); + virtual ~LimitOver(); - virtual BOOL isReady() const; + virtual BOOL isReady() const; - virtual void prepare(); - virtual void create(); - virtual void draw(); + virtual void prepare(); + virtual void create(); + virtual void draw(); - virtual FaderSceneCommand calcFadein(); - virtual FaderSceneCommand calcNormal(); - virtual FaderSceneCommand calcFadeout(); + virtual FaderSceneCommand calcFadein(); + virtual FaderSceneCommand calcNormal(); + virtual FaderSceneCommand calcFadeout(); - private: - enum { - ANIM_FADE_IN = 0, - ANIM_WAIT_PUSH, - ANIM_FADE_OUT, - }; + private: + enum { + ANIM_FADE_IN = 0, + ANIM_WAIT_PUSH, + ANIM_FADE_OUT, + }; - u32 getCountryIndex_(); - - layout::Object* mpLayout; // 0x58 - nand::LayoutFile* mpLayoutFile; // 0x5C + u32 getCountryIndex_(); - nw4r::lyt::Pane* mpTextPane; // 0x60 - nw4r::lyt::Pane* mpPushPane; // 0x64 + layout::Object* mpLayout; // 0x58 + nand::LayoutFile* mpLayoutFile; // 0x5C - OSTick mWaitTick; // 0x68 - OSTick mPushTick; // 0x6C + nw4r::lyt::Pane* mpTextPane; // 0x60 + nw4r::lyt::Pane* mpPushPane; // 0x64 - bool mbFadedIn; // 0x70 - bool mbDoneInit; // 0x71 + OSTick mWaitTick; // 0x68 + OSTick mPushTick; // 0x6C - u32 mWpadMask; // 0x74 + bool mbFadedIn; // 0x70 + bool mbDoneInit; // 0x71 + + u32 mWpadMask; // 0x74 }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_LIMIT_OVER_H +#endif // IPL_LIMIT_OVER_H diff --git a/include/scene/mailAddSel/iplMailAddressSelect.h b/include/scene/mailAddSel/iplMailAddressSelect.h index 961b97ab..f6309910 100644 --- a/include/scene/mailAddSel/iplMailAddressSelect.h +++ b/include/scene/mailAddSel/iplMailAddressSelect.h @@ -9,119 +9,117 @@ namespace ipl { class MailAddressEvent; FADER_SCENE_CLASS(MailAddressSelect), ButtonEventHandlerBase { - public: - MailAddressSelect(EGG::Heap* heap); - ~MailAddressSelect(); + public: + MailAddressSelect(EGG::Heap * heap); + ~MailAddressSelect(); - virtual void prepare(); - virtual void create(); + virtual void prepare(); + virtual void create(); - virtual void calcCommon(); - virtual FaderSceneCommand calcFadein(); + virtual void calcCommon(); + virtual FaderSceneCommand calcFadein(); - virtual void initCalcNormal(); - virtual FaderSceneCommand calcNormal(); + virtual void initCalcNormal(); + virtual FaderSceneCommand calcNormal(); - virtual void initCalcFadeout(); - virtual FaderSceneCommand calcFadeout(); + virtual void initCalcFadeout(); + virtual FaderSceneCommand calcFadeout(); - virtual void draw(); - virtual void destroy(); + virtual void draw(); + virtual void destroy(); - void finishMemo(bool closing); - void finishLetter(bool closing); - void finishAddress(); + void finishMemo(bool closing); + void finishLetter(bool closing); + void finishAddress(); - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); + virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); - protected: - void start_point_event(const char* paneName, controller::Interface* con); - void start_left_event(const char* paneName); - void start_trig_event(const char* paneName); + protected: + void start_point_event(const char* paneName, controller::Interface* con); + void start_left_event(const char* paneName); + void start_trig_event(const char* paneName); - void start_focusin_anm(int btnNo); - void start_focusout_anm(int btnNo); + void start_focusin_anm(int btnNo); + void start_focusout_anm(int btnNo); - int get_button_no(const char* paneName); + int get_button_no(const char* paneName); - void set_textbox(const char* paneName, u32 msgId); - void set_err_msg(wchar_t* outErrMsg, u32 outErrMsgLen, u32 errMsgId, s32 nwc24Err); + void set_textbox(const char* paneName, u32 msgId); + void set_err_msg(wchar_t * outErrMsg, u32 outErrMsgLen, u32 errMsgId, s32 nwc24Err); - BOOL check_network(); - bool is_parental_restriction() const; + BOOL check_network(); + bool is_parental_restriction() const; - void reset_gui(); + void reset_gui(); - enum { - ANIM_FADE_IN = 0, - ANIM_FADE_OUT, - ANIM_BTN_MAIL_FOCUS_IN, - ANIM_BTN_MAIL_FOCUS_OUT, - ANIM_BTN_MAIL_ZOOM_IN, - ANIM_BTN_MAIL_ZOOM_OUT, - ANIM_BTN_LETTER_FOCUS_IN, - ANIM_BTN_LETTER_FOCUS_OUT, - ANIM_BTN_LETTER_ZOOM_IN, - ANIM_BTN_LETTER_ZOOM_OUT, - ANIM_BTN_ADDRESS_FOCUS_IN, - ANIM_BTN_ADDRESS_FOCUS_OUT, - ANIM_BTN_ADDRESS_ZOOM_IN, - ANIM_BTN_ADDRESS_ZOOM_OUT, - ANIM_MAX, - }; + enum { + ANIM_FADE_IN = 0, + ANIM_FADE_OUT, + ANIM_BTN_MAIL_FOCUS_IN, + ANIM_BTN_MAIL_FOCUS_OUT, + ANIM_BTN_MAIL_ZOOM_IN, + ANIM_BTN_MAIL_ZOOM_OUT, + ANIM_BTN_LETTER_FOCUS_IN, + ANIM_BTN_LETTER_FOCUS_OUT, + ANIM_BTN_LETTER_ZOOM_IN, + ANIM_BTN_LETTER_ZOOM_OUT, + ANIM_BTN_ADDRESS_FOCUS_IN, + ANIM_BTN_ADDRESS_FOCUS_OUT, + ANIM_BTN_ADDRESS_ZOOM_IN, + ANIM_BTN_ADDRESS_ZOOM_OUT, + ANIM_MAX, + }; - enum { - STATE_NORMAL = 0, - STATE_DISABLE_SCENE, - STATE_CLOSING, - STATE_WAIT_FOR_ZOOM_OUT, - STATE_NO_NETWORK_DIALOG, - STATE_PARENTAL_DIALOG, - STATE_PARENTAL_CHECK, - STATE_DIALOG, - STATE_NO_WC24_DIALOG, - STATE_CHECK_NETWORK, - STATE_DONE, - STATE_MAX, - }; + enum { + STATE_NORMAL = 0, + STATE_DISABLE_SCENE, + STATE_CLOSING, + STATE_WAIT_FOR_ZOOM_OUT, + STATE_NO_NETWORK_DIALOG, + STATE_PARENTAL_DIALOG, + STATE_PARENTAL_CHECK, + STATE_DIALOG, + STATE_NO_WC24_DIALOG, + STATE_CHECK_NETWORK, + STATE_DONE, + STATE_MAX, + }; - enum { - BTN_MAIL = 0, - BTN_LETTER, - BTN_ADDRESS, - BTN_MAX, - }; + enum { + BTN_MAIL = 0, + BTN_LETTER, + BTN_ADDRESS, + BTN_MAX, + }; - layout::Object* mpLayout; // 0x64 - nand::LayoutFile* mpLayoutFile; // 0x68 - MailAddressEvent* mpEvent; // 0x6C - gui::PaneManager* mpGui; // 0x70 + layout::Object* mpLayout; // 0x64 + nand::LayoutFile* mpLayoutFile; // 0x68 + MailAddressEvent* mpEvent; // 0x6C + gui::PaneManager* mpGui; // 0x70 - BOOL mbHovered[BTN_MAX]; // 0x74 + BOOL mbHovered[BTN_MAX]; // 0x74 - int mState; // 0x80 + int mState; // 0x80 - int mNwc24ErrCountdown; // 0x84 + int mNwc24ErrCountdown; // 0x84 - bool mbParentalBypass; // 0x88 + bool mbParentalBypass; // 0x88 - static const char* mscButtonName[BTN_MAX]; + static const char* mscButtonName[BTN_MAX]; - friend class MailAddressEvent; + friend class MailAddressEvent; }; class MailAddressEvent : public ::gui::EventHandler { - public: - MailAddressEvent(MailAddressSelect* instance) : - ::gui::EventHandler(), - mpInstance(instance) {} + public: + MailAddressEvent(MailAddressSelect* instance) : ::gui::EventHandler(), mpInstance(instance) {} - virtual void onEvent(u32 compId, u32 event, void* data); + virtual void onEvent(u32 compId, u32 event, void* data); - private: - MailAddressSelect* mpInstance; // 0x0C + private: + MailAddressSelect* mpInstance; // 0x0C }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_MAIL_SELECT_ADDRESS_H +#endif // IPL_SCENE_MAIL_SELECT_ADDRESS_H diff --git a/include/scene/memory/iplMemory.h b/include/scene/memory/iplMemory.h index 7c360ac2..ed55afea 100644 --- a/include/scene/memory/iplMemory.h +++ b/include/scene/memory/iplMemory.h @@ -6,13 +6,13 @@ namespace ipl { namespace scene { SCENE_CLASS(Memory) { - public: - Memory(EGG::Heap* heap); + public: + Memory(EGG::Heap * heap); - private: - u8 unk_0x54[0x80]; + private: + u8 unk_0x54[0x80]; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_MEMORY_H +#endif // IPL_SCENE_MEMORY_H diff --git a/include/scene/memoryCard/iplMemoryCard.h b/include/scene/memoryCard/iplMemoryCard.h index 0176d54d..9df428c4 100644 --- a/include/scene/memoryCard/iplMemoryCard.h +++ b/include/scene/memoryCard/iplMemoryCard.h @@ -6,13 +6,13 @@ namespace ipl { namespace scene { SCENE_CLASS(MemoryCard) { - public: - MemoryCard(EGG::Heap* heap); + public: + MemoryCard(EGG::Heap * heap); - private: - u8 unk_0x54[0x7C]; + private: + u8 unk_0x54[0x7C]; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_MEMORY_CARD_H +#endif // IPL_SCENE_MEMORY_CARD_H diff --git a/include/scene/misc/iplReboot.h b/include/scene/misc/iplReboot.h index cb5118bc..d051e26c 100644 --- a/include/scene/misc/iplReboot.h +++ b/include/scene/misc/iplReboot.h @@ -5,19 +5,17 @@ namespace ipl { namespace scene { - enum { - REBOOT_DATA_MANAGEMENT = 0, - REBOOT_SETTINGS - }; + enum { REBOOT_DATA_MANAGEMENT = 0, REBOOT_SETTINGS }; SCENE_CLASS(Reboot) { - public: - Reboot(EGG::Heap* heap, int settingsType) : Base(heap), mSettingsType(settingsType) {} - virtual void calc(); - - private: - int mSettingsType; - }; - } -} + public: + Reboot(EGG::Heap * heap, int settingsType) : Base(heap), mSettingsType(settingsType) { + } + virtual void calc(); -#endif // IPL_REBOOT_H + private: + int mSettingsType; + }; + } // namespace scene +} // namespace ipl + +#endif // IPL_REBOOT_H diff --git a/include/scene/nakamuraTest/iplNakamuraTest.h b/include/scene/nakamuraTest/iplNakamuraTest.h index 96c5a2a6..a64115a4 100644 --- a/include/scene/nakamuraTest/iplNakamuraTest.h +++ b/include/scene/nakamuraTest/iplNakamuraTest.h @@ -6,13 +6,13 @@ namespace ipl { namespace scene { FADER_SCENE_CLASS(NakamuraTest) { - public: - NakamuraTest(EGG::Heap* heap); + public: + NakamuraTest(EGG::Heap * heap); - private: - u8 unk_0x58[0x2B38]; + private: + u8 unk_0x58[0x2B38]; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_NAKAMURA_TEST_H +#endif // IPL_SCENE_NAKAMURA_TEST_H diff --git a/include/scene/parentalDialog/iplParentalDialog.h b/include/scene/parentalDialog/iplParentalDialog.h index c5e7b33a..16d8665f 100644 --- a/include/scene/parentalDialog/iplParentalDialog.h +++ b/include/scene/parentalDialog/iplParentalDialog.h @@ -10,123 +10,123 @@ namespace ipl { class ParentalDialogEvent; FADER_SCENE_CLASS(ParentalDialog) { - public: - typedef enum Result { - RESULT_NONE = 0, - RESULT_SUCCESS, - RESULT_OVER_ATTEMPTS, - RESULT_CANCELLED, - } Result; + public: + typedef enum Result { + RESULT_NONE = 0, + RESULT_SUCCESS, + RESULT_OVER_ATTEMPTS, + RESULT_CANCELLED, + } Result; - enum { - TYPE_GAME = 0, - TYPE_IPL, - }; + enum { + TYPE_GAME = 0, + TYPE_IPL, + }; - ParentalDialog(EGG::Heap* heap, int type); + ParentalDialog(EGG::Heap * heap, int type); - void prepare(); - void create(); + void prepare(); + void create(); - FaderSceneCommand calcFadein(); + FaderSceneCommand calcFadein(); - FaderSceneCommand calcNormal(); + FaderSceneCommand calcNormal(); - void initCalcFadeout(); - FaderSceneCommand calcFadeout(); + void initCalcFadeout(); + FaderSceneCommand calcFadeout(); - void calcCommonAfter(); + void calcCommonAfter(); - void draw(); + void draw(); - Result getResult() const { return mResult; } + Result getResult() const { + return mResult; + } - private: - enum { - STATE_NORMAL = 0, - STATE_WAIT_SEL_ANIM, - STATE_WAIT_INPUT, - STATE_WAIT_MSG, - STATE_DONE, - STATE_MAX, - }; + private: + enum { + STATE_NORMAL = 0, + STATE_WAIT_SEL_ANIM, + STATE_WAIT_INPUT, + STATE_WAIT_MSG, + STATE_DONE, + STATE_MAX, + }; - enum { - BTN_CANCEL = 0, - BTN_DECIDE, - BTN_INPUT, - BTN_MAX, - }; + enum { + BTN_CANCEL = 0, + BTN_DECIDE, + BTN_INPUT, + BTN_MAX, + }; - enum { - ANIM_DIALOG_IN = 0, - ANIM_DIALOG_OUT, - ANIM_BTN_CANCEL_FOCUS_IN, - ANIM_BTN_CANCEL_FOCUS_OUT, - ANIM_BTN_CANCEL_SELECT, - ANIM_BTN_DECIDE_FOCUS_IN, - ANIM_BTN_DECIDE_FOCUS_OUT, - ANIM_BTN_DECIDE_SELECT, - ANIM_BTN_INPUT_FOCUS_IN, - ANIM_BTN_INPUT_FOCUS_OUT, - ANIM_BTN_INPUT_SELECT, - ANIM_CHANGE_INPUT_BUTTON, - ANIM_DECIDE_BUTTON_ENABLE, - ANIM_DECIDE_BUTTON_DISABLE, - }; + enum { + ANIM_DIALOG_IN = 0, + ANIM_DIALOG_OUT, + ANIM_BTN_CANCEL_FOCUS_IN, + ANIM_BTN_CANCEL_FOCUS_OUT, + ANIM_BTN_CANCEL_SELECT, + ANIM_BTN_DECIDE_FOCUS_IN, + ANIM_BTN_DECIDE_FOCUS_OUT, + ANIM_BTN_DECIDE_SELECT, + ANIM_BTN_INPUT_FOCUS_IN, + ANIM_BTN_INPUT_FOCUS_OUT, + ANIM_BTN_INPUT_SELECT, + ANIM_CHANGE_INPUT_BUTTON, + ANIM_DECIDE_BUTTON_ENABLE, + ANIM_DECIDE_BUTTON_DISABLE, + }; - void stt_normal(); - void stt_wait_sel_anm(); - void stt_wait_input(); - void stt_wait_msg(); + void stt_normal(); + void stt_wait_sel_anm(); + void stt_wait_input(); + void stt_wait_msg(); - void start_point_event(const char* paneName, controller::Interface* con); - void start_left_event(const char* paneName); - void start_trig_event(const char* paneName, int chan); + void start_point_event(const char* paneName, controller::Interface* con); + void start_left_event(const char* paneName); + void start_trig_event(const char* paneName, int chan); - int get_button_no(const char* paneName) const; + int get_button_no(const char* paneName) const; - void reset_gui(); + void reset_gui(); - BOOL check() const; + BOOL check() const; - void set_textbox(const char* paneName, u32 msgId); + void set_textbox(const char* paneName, u32 msgId); - u32 mState; // 0x58 + u32 mState; // 0x58 - layout::Object* mpLayout; // 0x5C - nand::LayoutFile* mpLayoutFile; // 0x60 - ParentalDialogEvent* mpEvent; // 0x64 - gui::PaneManager* mpGui; // 0x68 + layout::Object* mpLayout; // 0x5C + nand::LayoutFile* mpLayoutFile; // 0x60 + ParentalDialogEvent* mpEvent; // 0x64 + gui::PaneManager* mpGui; // 0x68 - int mDialogType; // 0x6C - Result mResult; // 0x70 + int mDialogType; // 0x6C + Result mResult; // 0x70 - BOOL mbHovered[BTN_MAX]; // 0x74 + BOOL mbHovered[BTN_MAX]; // 0x74 - wchar_t mMyPin[SC_PARENTAL_PASSWORD_LENGTH+1]; // 0x80 - bool mbInputPin; // 0x8A - int mAttempts; // 0x8C + wchar_t mMyPin[SC_PARENTAL_PASSWORD_LENGTH + 1]; // 0x80 + bool mbInputPin; // 0x8A + int mAttempts; // 0x8C - static const char* mscButtonName[BTN_MAX]; + static const char* mscButtonName[BTN_MAX]; - static const int ATTEMPTS_MAX = 3; + static const int ATTEMPTS_MAX = 3; - friend class ParentalDialogEvent; + friend class ParentalDialogEvent; }; class ParentalDialogEvent : public ::gui::EventHandler { - public: - ParentalDialogEvent(ParentalDialog* instance) : - ::gui::EventHandler(), - mpInstance(instance) {} + public: + ParentalDialogEvent(ParentalDialog* instance) : ::gui::EventHandler(), mpInstance(instance) {} - virtual void onEvent(u32 compId, u32 event, void* data); + virtual void onEvent(u32 compId, u32 event, void* data); - private: - ParentalDialog* mpInstance; // 0x0C + private: + ParentalDialog* mpInstance; // 0x0C }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_PARENTAL_DIALOG_H +#endif // IPL_SCENE_PARENTAL_DIALOG_H diff --git a/include/scene/saveDataEdit/iplWiiBannerFileInfo.h b/include/scene/saveDataEdit/iplWiiBannerFileInfo.h index f7c1ec7f..de0ac863 100644 --- a/include/scene/saveDataEdit/iplWiiBannerFileInfo.h +++ b/include/scene/saveDataEdit/iplWiiBannerFileInfo.h @@ -1,129 +1,124 @@ #ifndef IPL_SCENE_WII_BANNER_FILE_H #define IPL_SCENE_WII_BANNER_FILE_H -#include #include +#include #include "system/iplSystem.h" -#include #include +#include -#define SAVE_NAME_LENGTH 32 +#define SAVE_NAME_LENGTH 32 -#define SAVE_ICON_COUNT 8 +#define SAVE_ICON_COUNT 8 -#define SAVE_ICON_TEX_SIZE 0x1200 -#define SAVE_ICON_TEX_WIDTH 48 -#define SAVE_ICON_TEX_HEIGHT 48 +#define SAVE_ICON_TEX_SIZE 0x1200 +#define SAVE_ICON_TEX_WIDTH 48 +#define SAVE_ICON_TEX_HEIGHT 48 -#define SAVE_BANNER_TEX_SIZE 0x6000 -#define SAVE_BANNER_TEX_WIDTH 192 -#define SAVE_BANNER_TEX_HEIGHT 64 +#define SAVE_BANNER_TEX_SIZE 0x6000 +#define SAVE_BANNER_TEX_WIDTH 192 +#define SAVE_BANNER_TEX_HEIGHT 64 -#define SAVE_ANIM_FRAME_TICK 4 +#define SAVE_ANIM_FRAME_TICK 4 namespace ipl { namespace scene { class WiiBannerFileInfo { - public: - WiiBannerFileInfo() : - mFrameCount(0), mFrameSpeed(0), mFlags(0), - mAnim_Incrementer(0), mAnim_AltFlag(0), mAnim_AltForward(0), mAnim_AltBackward(0), - unk_0x104(0), unk_0xF1A8(0), unk_0xF1AC(0) { - wmemset(mSaveName, 0, SAVE_NAME_LENGTH+1); - wmemset(mSaveSubName, 0, SAVE_NAME_LENGTH+1); - - mpBannerData = System::getMem2App()->alloc(SAVE_BANNER_TEX_SIZE, DEFAULT_ALIGN); - memset(mpBannerData, 0, SAVE_BANNER_TEX_SIZE); - - for (int i = 0; i < SAVE_ICON_COUNT; i++) { - mpIconData[i] = System::getMem2App()->alloc(SAVE_ICON_TEX_SIZE, DEFAULT_ALIGN); - memset(mpIconData[i], 0, SAVE_ICON_TEX_SIZE); - } - - memset(&mData, 0, sizeof(mData)); - } - - ~WiiBannerFileInfo() { - for (int i = 0; i < SAVE_ICON_COUNT; i++) { - System::getMem2App()->free(mpIconData[i]); - } - - System::getMem2App()->free(mpBannerData); + public: + WiiBannerFileInfo() + : mFrameCount(0), mFrameSpeed(0), mFlags(0), mAnim_Incrementer(0), mAnim_AltFlag(0), mAnim_AltForward(0), mAnim_AltBackward(0), + unk_0x104(0), unk_0xF1A8(0), unk_0xF1AC(0) { + wmemset(mSaveName, 0, SAVE_NAME_LENGTH + 1); + wmemset(mSaveSubName, 0, SAVE_NAME_LENGTH + 1); + + mpBannerData = System::getMem2App()->alloc(SAVE_BANNER_TEX_SIZE, DEFAULT_ALIGN); + memset(mpBannerData, 0, SAVE_BANNER_TEX_SIZE); + + for (int i = 0; i < SAVE_ICON_COUNT; i++) { + mpIconData[i] = System::getMem2App()->alloc(SAVE_ICON_TEX_SIZE, DEFAULT_ALIGN); + memset(mpIconData[i], 0, SAVE_ICON_TEX_SIZE); } - void init(); - void create(); - void update(); + memset(&mData, 0, sizeof(mData)); + } - GXTexObj* loadIconTexture(); - GXTexObj* loadBannerTexture(); - - private: - enum { - FLAG_LOCAL_SAVE = 0x00000001, - FLAG_ALTERNATE_ANIMATION = 0x00000010, - }; - void resolve_icon(); - int get_iconspeed(int frame) const; - - int get_iconspeed_ticks(int frame) { - return get_iconspeed(frame) * SAVE_ANIM_FRAME_TICK; + ~WiiBannerFileInfo() { + for (int i = 0; i < SAVE_ICON_COUNT; i++) { + System::getMem2App()->free(mpIconData[i]); } - int get_iconspeed_begin_tick(int frame) { - return get_iconspeed(frame-1) * SAVE_ANIM_FRAME_TICK; - } - - typedef struct SData { - u32 magic; // 0x00 - u32 flags; // 0x04 - u16 speed; // 0x08 - u8 padding[22]; + System::getMem2App()->free(mpBannerData); + } - wchar_t name[SAVE_NAME_LENGTH]; // 0x20 - wchar_t subName[SAVE_NAME_LENGTH]; // 0x60 + void init(); + void create(); + void update(); - u8 bannerData[SAVE_BANNER_TEX_SIZE]; // 0xA0 - u8 iconData[SAVE_ICON_COUNT][SAVE_ICON_TEX_SIZE]; // 0x60A0 - } SData; + GXTexObj* loadIconTexture(); + GXTexObj* loadBannerTexture(); - vu8 mFrameCount; // 0x00 + private: + enum { + FLAG_LOCAL_SAVE = 0x00000001, + FLAG_ALTERNATE_ANIMATION = 0x00000010, + }; + void resolve_icon(); + int get_iconspeed(int frame) const; - vu16 mFrameSpeed; // 0x02 - vu32 mFlags; // 0x04 + int get_iconspeed_ticks(int frame) { return get_iconspeed(frame) * SAVE_ANIM_FRAME_TICK; } - vs16 mAnim_MaxFrameTicks; // 0x08 - vs16 mAnim_FrameTick; // 0x0A + int get_iconspeed_begin_tick(int frame) { return get_iconspeed(frame - 1) * SAVE_ANIM_FRAME_TICK; } - vs8 mAnim_Incrementer; // 0x0C + typedef struct SData { + u32 magic; // 0x00 + u32 flags; // 0x04 + u16 speed; // 0x08 + u8 padding[22]; - vu8 mAnim_AltFlag; // 0x0D + wchar_t name[SAVE_NAME_LENGTH]; // 0x20 + wchar_t subName[SAVE_NAME_LENGTH]; // 0x60 - u8 mAnim_AltForward; // 0x0E - u8 mAnim_AltBackward; // 0x0F + u8 bannerData[SAVE_BANNER_TEX_SIZE]; // 0xA0 + u8 iconData[SAVE_ICON_COUNT][SAVE_ICON_TEX_SIZE]; // 0x60A0 + } SData; - wchar_t mSaveName[SAVE_NAME_LENGTH+1]; // 0x10 - wchar_t mSaveSubName[SAVE_NAME_LENGTH+1]; // 0x52 + vu8 mFrameCount; // 0x00 - void* mpBannerData; // 0x94 - void* mpIconData[SAVE_ICON_COUNT]; // 0x98 + vu16 mFrameSpeed; // 0x02 + vu32 mFlags; // 0x04 - GXTexObj mCurIconTex; // 0xB8 - GXTexObj mCurBannerTex; // 0xD8 + vs16 mAnim_MaxFrameTicks; // 0x08 + vs16 mAnim_FrameTick; // 0x0A - u32 unk_0xF8; - u32 unk_0xFC; - u32 unk_0x100; - u32 unk_0x104; + vs8 mAnim_Incrementer; // 0x0C - SData mData; // 0x108 + vu8 mAnim_AltFlag; // 0x0D - u32 unk_0xF1A8; - u8 unk_0xF1AC; + u8 mAnim_AltForward; // 0x0E + u8 mAnim_AltBackward; // 0x0F + + wchar_t mSaveName[SAVE_NAME_LENGTH + 1]; // 0x10 + wchar_t mSaveSubName[SAVE_NAME_LENGTH + 1]; // 0x52 + + void* mpBannerData; // 0x94 + void* mpIconData[SAVE_ICON_COUNT]; // 0x98 + + GXTexObj mCurIconTex; // 0xB8 + GXTexObj mCurBannerTex; // 0xD8 + + u32 unk_0xF8; + u32 unk_0xFC; + u32 unk_0x100; + u32 unk_0x104; + + SData mData; // 0x108 + + u32 unk_0xF1A8; + u8 unk_0xF1AC; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_WII_BANNER_FILE_H +#endif // IPL_SCENE_WII_BANNER_FILE_H diff --git a/include/scene/sdButton/iplSDButton.h b/include/scene/sdButton/iplSDButton.h index 74286bf0..dd26d4db 100644 --- a/include/scene/sdButton/iplSDButton.h +++ b/include/scene/sdButton/iplSDButton.h @@ -12,149 +12,138 @@ namespace ipl { namespace scene { class SDButtonEventHandlerBase : public ::gui::EventHandler { - public: - virtual void onEvent(u32 compId, u32 event, void* data); - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); + public: + virtual void onEvent(u32 compId, u32 event, void* data); + virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); }; /* Arrow Button */ SCENE_CLASS(SDArrow) { - public: - SDArrow(EGG::Heap* heap) : Base(heap) {} - virtual void draw(); + public: + SDArrow(EGG::Heap * heap) : Base(heap) { + } + virtual void draw(); }; /* Main Button */ SCENE_CLASS(SDButton) { - public: - enum { - IDANIM_UNUSED_0 = 0, - IDANIM_UNUSED_1, - IDANIM_UNUSED_2, - IDANIM_UNUSED_3, - IDANIM_HELP_BTN_CLICK, - IDANIM_UNUSED_5, - IDANIM_UNUSED_6, - IDANIM_ARROW_LEFT_CLICK, - IDANIM_ARROW_RIGHT_CLICK, - IDANIM_UNUSED_9, - IDANIM_UNUSED_10, - IDANIM_UNUSED_11, - IDANIM_UNUSED_12, - IDANIM_ARROW_LEFT_APPEAR, - IDANIM_ARROW_RIGHT_APPEAR, - IDANIM_ARROW_LEFT_DISAPPEAR, - IDANIM_ARROW_RIGHT_DISAPPEAR, - IDANIM_MAX, - }; + public: + enum { + IDANIM_UNUSED_0 = 0, + IDANIM_UNUSED_1, + IDANIM_UNUSED_2, + IDANIM_UNUSED_3, + IDANIM_HELP_BTN_CLICK, + IDANIM_UNUSED_5, + IDANIM_UNUSED_6, + IDANIM_ARROW_LEFT_CLICK, + IDANIM_ARROW_RIGHT_CLICK, + IDANIM_UNUSED_9, + IDANIM_UNUSED_10, + IDANIM_UNUSED_11, + IDANIM_UNUSED_12, + IDANIM_ARROW_LEFT_APPEAR, + IDANIM_ARROW_RIGHT_APPEAR, + IDANIM_ARROW_LEFT_DISAPPEAR, + IDANIM_ARROW_RIGHT_DISAPPEAR, + IDANIM_MAX, + }; - enum { - BTN_WII_MENU = 0, - BTN_HELP, - BTN_ARROW_RIGHT, - BTN_ARROW_LEFT, - BTN_MAX - }; + enum { BTN_WII_MENU = 0, BTN_HELP, BTN_ARROW_RIGHT, BTN_ARROW_LEFT, BTN_MAX }; - enum { - ARROW_BTN_RIGHT = 0, - ARROW_BTN_LEFT, - ARROW_BTN_MAX - }; + enum { ARROW_BTN_RIGHT = 0, ARROW_BTN_LEFT, ARROW_BTN_MAX }; - enum { - BALLOON_WII_MENU = 0, - BALLOON_HELP, - BALLOON_MAX - }; + enum { BALLOON_WII_MENU = 0, BALLOON_HELP, BALLOON_MAX }; - SDButton(EGG::Heap* heap); - virtual ~SDButton(); + SDButton(EGG::Heap * heap); + virtual ~SDButton(); - virtual void prepare(); - virtual void create(); + virtual void prepare(); + virtual void create(); - virtual void calc(); + virtual void calc(); - virtual void draw(); + virtual void draw(); - void drawBalloon(); + void drawBalloon(); - void update(); + void update(); - void reset_gui(); + void reset_gui(); - void startPointEvent(const char* paneName, controller::Interface* con); - void startLeftEvent(const char* paneName); + void startPointEvent(const char* paneName, controller::Interface* con); + void startLeftEvent(const char* paneName); - bool isActive() const; + bool isActive() const; - void setEventHandler(::gui::EventHandler* event, ::gui::EventHandler* optOutEvent); + void setEventHandler(::gui::EventHandler * event, ::gui::EventHandler * optOutEvent); - void setText(const char* paneName, u32 msgId); - void setText(const char* paneName, const wchar_t* text); + void setText(const char* paneName, u32 msgId); + void setText(const char* paneName, const wchar_t* text); - void animation(int animNo); + void animation(int animNo); - void initArrowAppearance(int arrowType, bool bAppear); + void initArrowAppearance(int arrowType, bool bAppear); - void show_balloon(int balloonId, const char* targetPaneName); + void show_balloon(int balloonId, const char* targetPaneName); - void enableBtn(); - void disableBtn(); + void enableBtn(); + void disableBtn(); - static int getButtonNo(const char* paneName); + static int getButtonNo(const char* paneName); - protected: - layout::Object* get_layout() { return mpLayout; } + protected: + layout::Object* get_layout() { + return mpLayout; + } - private: - enum { - ANIM_WIIMENU_BTN_ROLL_OVER = 0, - ANIM_WIIMENU_BTN_ROLL_ON, - ANIM_WIIMENU_BTN_ROLL_OUT, - ANIM_HELP_BTN_ROLL_OVER, - ANIM_HELP_BTN_ROLL_ON, - ANIM_HELP_BTN_ROLL_OUT, - ANIM_ARROW_WAITING_LOOP, - ANIM_ARROW_LEFT_ON, - ANIM_ARROW_RIGHT_ON, - ANIM_ARROW_LEFT_ROLL_OVER, - ANIM_ARROW_RIGHT_ROLL_OVER, - ANIM_ARROW_LEFT_ROLL_OUT, - ANIM_ARROW_RIGHT_ROLL_OUT, - ANIM_ARROW_LEFT_IN, - ANIM_ARROW_RIGHT_IN, - ANIM_ARROW_LEFT_OUT, - ANIM_ARROW_RIGHT_OUT, - ANIM_MAX, - }; + private: + enum { + ANIM_WIIMENU_BTN_ROLL_OVER = 0, + ANIM_WIIMENU_BTN_ROLL_ON, + ANIM_WIIMENU_BTN_ROLL_OUT, + ANIM_HELP_BTN_ROLL_OVER, + ANIM_HELP_BTN_ROLL_ON, + ANIM_HELP_BTN_ROLL_OUT, + ANIM_ARROW_WAITING_LOOP, + ANIM_ARROW_LEFT_ON, + ANIM_ARROW_RIGHT_ON, + ANIM_ARROW_LEFT_ROLL_OVER, + ANIM_ARROW_RIGHT_ROLL_OVER, + ANIM_ARROW_LEFT_ROLL_OUT, + ANIM_ARROW_RIGHT_ROLL_OUT, + ANIM_ARROW_LEFT_IN, + ANIM_ARROW_RIGHT_IN, + ANIM_ARROW_LEFT_OUT, + ANIM_ARROW_RIGHT_OUT, + ANIM_MAX, + }; - int unk_0x54; + int unk_0x54; - layout::Object* mpLayout; // 0x58 - nand::LayoutFile* mpLayoutFile; // 0x5C - gui::PaneManager* mpGui; // 0x60 + layout::Object* mpLayout; // 0x58 + nand::LayoutFile* mpLayoutFile; // 0x5C + gui::PaneManager* mpGui; // 0x60 - TextBalloon* mpBalloons[2]; // 0x64 - - nand::LayoutFile* mpBalloonFile; // 0x6C + TextBalloon* mpBalloons[2]; // 0x64 - BOOL mbHovered[BTN_MAX]; // 0x70 + nand::LayoutFile* mpBalloonFile; // 0x6C - bool mbArrowVisible[ARROW_BTN_MAX]; // 0x80 + BOOL mbHovered[BTN_MAX]; // 0x70 - bool mbEnabled; // 0x82 + bool mbArrowVisible[ARROW_BTN_MAX]; // 0x80 - static const char* mscButtonName[BTN_MAX]; - static const char* mscArrowName[ARROW_BTN_MAX]; + bool mbEnabled; // 0x82 - friend class SDArrow; - friend class SDButtonEventHandlerBase; + static const char* mscButtonName[BTN_MAX]; + static const char* mscArrowName[ARROW_BTN_MAX]; + + friend class SDArrow; + friend class SDButtonEventHandlerBase; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_SD_BUTTON_H +#endif // IPL_SCENE_SD_BUTTON_H diff --git a/include/scene/sdChannelSelect/iplSDChannelSelect.h b/include/scene/sdChannelSelect/iplSDChannelSelect.h index ad0d93a6..a98697da 100644 --- a/include/scene/sdChannelSelect/iplSDChannelSelect.h +++ b/include/scene/sdChannelSelect/iplSDChannelSelect.h @@ -6,13 +6,13 @@ namespace ipl { namespace scene { FADER_SCENE_CLASS(SDChannelSelect) { - public: - SDChannelSelect(EGG::Heap* heap); + public: + SDChannelSelect(EGG::Heap * heap); - private: - u8 unk_0x58[0x728]; + private: + u8 unk_0x58[0x728]; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_SD_CHANNEL_SELECT_H +#endif // IPL_SCENE_SD_CHANNEL_SELECT_H diff --git a/include/scene/sdChannelTitle/iplSDChannelTitle.h b/include/scene/sdChannelTitle/iplSDChannelTitle.h index 0d64a4e7..efeb7fce 100644 --- a/include/scene/sdChannelTitle/iplSDChannelTitle.h +++ b/include/scene/sdChannelTitle/iplSDChannelTitle.h @@ -7,13 +7,13 @@ namespace ipl { namespace scene { class SDChannelSelect; FADER_SCENE_CLASS(SDChannelTitle) { - public: - SDChannelTitle(EGG::Heap* heap, SDChannelSelect* chanSel); + public: + SDChannelTitle(EGG::Heap * heap, SDChannelSelect * chanSel); - private: - u8 unk_0x58[0x3460]; + private: + u8 unk_0x58[0x3460]; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_SD_CHANNEL_TITLE_H +#endif // IPL_SCENE_SD_CHANNEL_TITLE_H diff --git a/include/scene/setting/iplNCDSetting.h b/include/scene/setting/iplNCDSetting.h index fe00592d..8082b981 100644 --- a/include/scene/setting/iplNCDSetting.h +++ b/include/scene/setting/iplNCDSetting.h @@ -6,14 +6,14 @@ namespace ipl { namespace ncd { class NCDSetting { - public: - static bool getConnectEnableFlag(); + public: + static bool getConnectEnableFlag(); - static void makeMacAddr(); - static u8* getMacAddr(); - static u32 getMacNum(); + static void makeMacAddr(); + static u8* getMacAddr(); + static u32 getMacNum(); }; - } -} + } // namespace ncd +} // namespace ipl -#endif // IPL_NCD_SETTING_H +#endif // IPL_NCD_SETTING_H diff --git a/include/scene/setting/iplParental.h b/include/scene/setting/iplParental.h index 9edec0fd..46277779 100644 --- a/include/scene/setting/iplParental.h +++ b/include/scene/setting/iplParental.h @@ -1,93 +1,93 @@ #ifndef IPL_PARENTAL_H #define IPL_PARENTAL_H -#include #include +#include #include namespace ipl { namespace parental { class Parental { - public: - enum { - RESTRICTION_SHOP = (1 << 0), - RESTRICTION_MSGBOARD = (1 << 1), - RESTRICTION_OPERA = (1 << 2), - RESTRICTION_NEWS = (1 << 4), - }; + public: + enum { + RESTRICTION_SHOP = (1 << 0), + RESTRICTION_MSGBOARD = (1 << 1), + RESTRICTION_OPERA = (1 << 2), + RESTRICTION_NEWS = (1 << 4), + }; - static void init(); + static void init(); - static BOOL checkFlags(); - static u32 checkRating(); - static u32 checkRestrictions(); - static BOOL checkPass(const char* pass); - static u32 checkMistake(u8 mistakeCount); - static u8 checkSecQ(); + static BOOL checkFlags(); + static u32 checkRating(); + static u32 checkRestrictions(); + static BOOL checkPass(const char* pass); + static u32 checkMistake(u8 mistakeCount); + static u8 checkSecQ(); - static BOOL judgePass(const char* pass); - static BOOL judgeSecA(const wchar_t* secAnswer); - static BOOL judgeMaster(const char* master); + static BOOL judgePass(const char* pass); + static BOOL judgeSecA(const wchar_t* secAnswer); + static BOOL judgeMaster(const char* master); - static wchar_t* getSecA(); - static u32 getOgn(); - static u32 getCountry(); + static wchar_t* getSecA(); + static u32 getOgn(); + static u32 getCountry(); - static void setFlags(u8 flag); - static void setRating(u8 rating); - static void setPass(const char* pass); - static void setSecQ(u8 secQuestion); - static void setSecA(const wchar_t* secAnswer); - static void setCountry(u8 country); - static void setRestrictions(u32 restrictions); - static void adjustOgn(u8 country); + static void setFlags(u8 flag); + static void setRating(u8 rating); + static void setPass(const char* pass); + static void setSecQ(u8 secQuestion); + static void setSecA(const wchar_t* secAnswer); + static void setCountry(u8 country); + static void setRestrictions(u32 restrictions); + static void adjustOgn(u8 country); - static void write(); - static void clear(); - static void clearMiss(); + static void write(); + static void clear(); + static void clearMiss(); - static void makeMasterkey(); + static void makeMasterkey(); - static char* getRequestNum(); + static char* getRequestNum(); - private: - static void _initRating(); + private: + static void _initRating(); - static BOOL _checkPass(const char* pass) NO_INLINE; + static BOOL _checkPass(const char* pass) NO_INLINE; - static void Crc32Init(); - static u32 CalcCrc32(const u8* buf, u32 size); + static void Crc32Init(); + static u32 CalcCrc32(const u8* buf, u32 size); - typedef struct SCData { - SCParentalControlsInfo info; // 0x00 - u32 netContentRestrict; // 0x4C - BOOL wwwRestrict; // 0x50 - } SCData; + typedef struct SCData { + SCParentalControlsInfo info; // 0x00 + u32 netContentRestrict; // 0x4C + BOOL wwwRestrict; // 0x50 + } SCData; - enum { - MISTAKE_PASS = 0, - MISTAKE_SEC_ANSWER, - MISTAKE_MASTER, - MISTAKE_MAX, - }; + enum { + MISTAKE_PASS = 0, + MISTAKE_SEC_ANSWER, + MISTAKE_MASTER, + MISTAKE_MAX, + }; - static const int REQUEST_NUMBER_LENGTH = 8; - static const int MASTER_KEY_LENGTH = 5; - static const int CRC32_TABLE_SIZE = 0x100; + static const int REQUEST_NUMBER_LENGTH = 8; + static const int MASTER_KEY_LENGTH = 5; + static const int CRC32_TABLE_SIZE = 0x100; - static SCData m_sc; - static SCData m_scSave; + static SCData m_sc; + static SCData m_scSave; - static char mRequestNum[REQUEST_NUMBER_LENGTH+1]; + static char mRequestNum[REQUEST_NUMBER_LENGTH + 1]; - static char mStackPass[SC_PARENTAL_PASSWORD_LENGTH]; - static u8 mMistake[MISTAKE_MAX]; - static char mMasterKey[MASTER_KEY_LENGTH+1]; + static char mStackPass[SC_PARENTAL_PASSWORD_LENGTH]; + static u8 mMistake[MISTAKE_MAX]; + static char mMasterKey[MASTER_KEY_LENGTH + 1]; - static u32 mCrc32Table[CRC32_TABLE_SIZE+1]; + static u32 mCrc32Table[CRC32_TABLE_SIZE + 1]; }; - } -} + } // namespace parental +} // namespace ipl -#endif // IPL_PARENTAL_H +#endif // IPL_PARENTAL_H diff --git a/include/scene/setting/iplSetting.h b/include/scene/setting/iplSetting.h index 578d6ec0..e78fd054 100644 --- a/include/scene/setting/iplSetting.h +++ b/include/scene/setting/iplSetting.h @@ -6,23 +6,23 @@ namespace ipl { namespace scene { FADER_SCENE_CLASS(Setting) { - public: - Setting(EGG::Heap* heap, int arg); + public: + Setting(EGG::Heap * heap, int arg); - enum { - ARG_NORMAL_PAGE = 0, - ARG_INTERNET_SETTING, - ARG_SETUP, - ARG_UPDATE, - ARG_INTERNET_PAGE, - ARG_UNK_5, - ARG_UNK_6, - }; + enum { + ARG_NORMAL_PAGE = 0, + ARG_INTERNET_SETTING, + ARG_SETUP, + ARG_UPDATE, + ARG_INTERNET_PAGE, + ARG_UNK_5, + ARG_UNK_6, + }; - private: - u8 unk_0x58[0xB68]; + private: + u8 unk_0x58[0xB68]; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_SETTING_H +#endif // IPL_SCENE_SETTING_H diff --git a/include/scene/settingSelect/iplSettingBg.h b/include/scene/settingSelect/iplSettingBg.h index ef3f55dd..3036bb47 100644 --- a/include/scene/settingSelect/iplSettingBg.h +++ b/include/scene/settingSelect/iplSettingBg.h @@ -6,22 +6,22 @@ namespace ipl { namespace scene { SCENE_CLASS(SettingBg) { - public: - SettingBg(EGG::Heap* heap, int arg); - virtual ~SettingBg(); + public: + SettingBg(EGG::Heap * heap, int arg); + virtual ~SettingBg(); - virtual void prepare(); - virtual void create(); - virtual void calc(); - virtual void draw(); - - private: - int mSettingArg; // 0x54 + virtual void prepare(); + virtual void create(); + virtual void calc(); + virtual void draw(); - layout::Object* mpLayout; // 0x58 - nand::LayoutFile* mpLayoutFile; // 0x5C + private: + int mSettingArg; // 0x54 + + layout::Object* mpLayout; // 0x58 + nand::LayoutFile* mpLayoutFile; // 0x5C }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_SETTING_BG_H +#endif // IPL_SCENE_SETTING_BG_H diff --git a/include/scene/settingSelect/iplSettingButton.h b/include/scene/settingSelect/iplSettingButton.h index 27f5e205..764e8937 100644 --- a/include/scene/settingSelect/iplSettingButton.h +++ b/include/scene/settingSelect/iplSettingButton.h @@ -6,92 +6,90 @@ namespace ipl { namespace scene { FADER_SCENE_CLASS(SettingButton), public ::gui::EventHandler { - public: - enum { - CANCEL = 0, - DECIDE, - MAX_SOUND_TYPE - }; + public: + enum { CANCEL = 0, DECIDE, MAX_SOUND_TYPE }; - enum { - CMD_NONE = 0, - CMD_SHOW_BTN, - CMD_HIDE_BTN, - CMD_SET_TEXT, - }; + enum { + CMD_NONE = 0, + CMD_SHOW_BTN, + CMD_HIDE_BTN, + CMD_SET_TEXT, + }; - SettingButton(EGG::Heap* heap, int arg); + SettingButton(EGG::Heap * heap, int arg); - virtual void prepare(); - virtual void create(); - virtual void draw(); + virtual void prepare(); + virtual void create(); + virtual void draw(); - virtual FaderSceneCommand calcFadein(); - virtual FaderSceneCommand calcNormal(); + virtual FaderSceneCommand calcFadein(); + virtual FaderSceneCommand calcNormal(); - virtual void calcCommonAfter(); + virtual void calcCommonAfter(); - virtual void onEvent(u32 compId, u32 event, void* data); - - bool update(); + virtual void onEvent(u32 compId, u32 event, void* data); - void reserve(int command, u32 msgId); + bool update(); - bool isPlaying() const; - void setSoundType(int type) { mSoundType = type; } + void reserve(int command, u32 msgId); - void setText(u32 msgId); + bool isPlaying() const; + void setSoundType(int type) { + mSoundType = type; + } - void showBtn(); - void hideBtn(); + void setText(u32 msgId); - void showWii(); - void hideWii(); + void showBtn(); + void hideBtn(); - private: - enum { - ANIM_SEEN_IN = 0, - ANIM_BTN_FOCUS_IN, - ANIM_BTN_FOCUS_OUT, - ANIM_BTN_FLASH, - ANIM_WII_APPEAR, - ANIM_WII_LOST, - ANIM_ALPHA_IN, - ANIM_ALPHA_OUT, - }; + void showWii(); + void hideWii(); - void start_point_event(const char* paneName, controller::Interface* controller); - void start_left_event(const char* paneName); - void start_trig_event(const char* paneName); + private: + enum { + ANIM_SEEN_IN = 0, + ANIM_BTN_FOCUS_IN, + ANIM_BTN_FOCUS_OUT, + ANIM_BTN_FLASH, + ANIM_WII_APPEAR, + ANIM_WII_LOST, + ANIM_ALPHA_IN, + ANIM_ALPHA_OUT, + }; - typedef struct Unk { - int command; // 0x00 - u32 msgID; // 0x04 - } Unk; + void start_point_event(const char* paneName, controller::Interface* controller); + void start_left_event(const char* paneName); + void start_trig_event(const char* paneName); - Unk unk_0x64[64]; + typedef struct Unk { + int command; // 0x00 + u32 msgID; // 0x04 + } Unk; - int unk_0x264; - int unk_0x268; - int unk_0x26C; - int unk_0x270; + Unk unk_0x64[64]; - int mSettingArg; // 0x274 + int unk_0x264; + int unk_0x268; + int unk_0x26C; + int unk_0x270; - layout::Object* mpLayout; // 0x278 + int mSettingArg; // 0x274 - nand::LayoutFile* mpLayoutFile; // 0x27C - gui::PaneManager* mpGui; // 0x280 + layout::Object* mpLayout; // 0x278 - BOOL mBtnHovered; // 0x284 + nand::LayoutFile* mpLayoutFile; // 0x27C + gui::PaneManager* mpGui; // 0x280 - int mSoundType; // 0x288 + BOOL mBtnHovered; // 0x284 - bool mbShowBtn; // 0x28C - bool mbFadedIn; // 0x28D - bool mbTrigBtn; // 0x28E + int mSoundType; // 0x288 + + bool mbShowBtn; // 0x28C + bool mbFadedIn; // 0x28D + bool mbTrigBtn; // 0x28E }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SETTING_BUTTON_H +#endif // IPL_SETTING_BUTTON_H diff --git a/include/scene/settingSelect/iplSettingSelect.h b/include/scene/settingSelect/iplSettingSelect.h index 7e548a24..85732011 100644 --- a/include/scene/settingSelect/iplSettingSelect.h +++ b/include/scene/settingSelect/iplSettingSelect.h @@ -6,183 +6,183 @@ namespace ipl { namespace scene { SCENE_CLASS(SettingSelect), public ::gui::EventHandler { - public: - SettingSelect(EGG::Heap* heap, int arg); + public: + SettingSelect(EGG::Heap * heap, int arg); - virtual void prepare(); - virtual void create(); - virtual void draw(); - virtual void calc(); + virtual void prepare(); + virtual void create(); + virtual void draw(); + virtual void calc(); - virtual void onEvent(u32 compId, u32 event, void* data); + virtual void onEvent(u32 compId, u32 event, void* data); - private: - enum { - // Base - ANIM_IN = 0, - ANIM_FOCUS_IN, - ANIM_FOCUS_OUT, - ANIM_FLASH, - ANIM_FLASH_2, - ANIM_OUT, - ANIM_BACK, + private: + enum { + // Base + ANIM_IN = 0, + ANIM_FOCUS_IN, + ANIM_FOCUS_OUT, + ANIM_FLASH, + ANIM_FLASH_2, + ANIM_OUT, + ANIM_BACK, - // Data Management button - ANIM_DATA_MANAGE_BASE = 0, - ANIM_DATA_MANAGE_IN = ANIM_DATA_MANAGE_BASE, - ANIM_DATA_MANAGE_FOCUS_IN, - ANIM_DATA_MANAGE_FOCUS_OUT, - ANIM_DATA_MANAGE_FLASH, - ANIM_DATA_MANAGE_FLASH_2, - ANIM_DATA_MANAGE_OUT, - ANIM_DATA_MANAGE_BACK, + // Data Management button + ANIM_DATA_MANAGE_BASE = 0, + ANIM_DATA_MANAGE_IN = ANIM_DATA_MANAGE_BASE, + ANIM_DATA_MANAGE_FOCUS_IN, + ANIM_DATA_MANAGE_FOCUS_OUT, + ANIM_DATA_MANAGE_FLASH, + ANIM_DATA_MANAGE_FLASH_2, + ANIM_DATA_MANAGE_OUT, + ANIM_DATA_MANAGE_BACK, - // Wii Settings button - ANIM_SETTING_BASE, - ANIM_SETTING_IN = ANIM_SETTING_BASE, - ANIM_SETTING_FOCUS_IN, - ANIM_SETTING_FOCUS_OUT, - ANIM_SETTING_FLASH, - ANIM_SETTING_FLASH_2, - ANIM_SETTING_OUT, - ANIM_SETTING_BACK, + // Wii Settings button + ANIM_SETTING_BASE, + ANIM_SETTING_IN = ANIM_SETTING_BASE, + ANIM_SETTING_FOCUS_IN, + ANIM_SETTING_FOCUS_OUT, + ANIM_SETTING_FLASH, + ANIM_SETTING_FLASH_2, + ANIM_SETTING_OUT, + ANIM_SETTING_BACK, - // Save data button - ANIM_SAVE_DATA_BASE, - ANIM_SAVE_DATA_IN = ANIM_SAVE_DATA_BASE, - ANIM_SAVE_DATA_FOCUS_IN, - ANIM_SAVE_DATA_FOCUS_OUT, - ANIM_SAVE_DATA_FLASH, - ANIM_SAVE_DATA_FLASH_2, - ANIM_SAVE_DATA_OUT, - ANIM_SAVE_DATA_BACK, + // Save data button + ANIM_SAVE_DATA_BASE, + ANIM_SAVE_DATA_IN = ANIM_SAVE_DATA_BASE, + ANIM_SAVE_DATA_FOCUS_IN, + ANIM_SAVE_DATA_FOCUS_OUT, + ANIM_SAVE_DATA_FLASH, + ANIM_SAVE_DATA_FLASH_2, + ANIM_SAVE_DATA_OUT, + ANIM_SAVE_DATA_BACK, - // Channels button - ANIM_CHANNEL_BASE, - ANIM_CHANNEL_IN = ANIM_CHANNEL_BASE, - ANIM_CHANNEL_FOCUS_IN, - ANIM_CHANNEL_FOCUS_OUT, - ANIM_CHANNEL_FLASH, - ANIM_CHANNEL_FLASH_2, - ANIM_CHANNEL_OUT, - ANIM_CHANNEL_BACK, + // Channels button + ANIM_CHANNEL_BASE, + ANIM_CHANNEL_IN = ANIM_CHANNEL_BASE, + ANIM_CHANNEL_FOCUS_IN, + ANIM_CHANNEL_FOCUS_OUT, + ANIM_CHANNEL_FLASH, + ANIM_CHANNEL_FLASH_2, + ANIM_CHANNEL_OUT, + ANIM_CHANNEL_BACK, - // Wii save data button - ANIM_WII_SAVE_DATA_BASE, - ANIM_WII_SAVE_DATA_IN = ANIM_WII_SAVE_DATA_BASE, - ANIM_WII_SAVE_DATA_FOCUS_IN, - ANIM_WII_SAVE_DATA_FOCUS_OUT, - ANIM_WII_SAVE_DATA_FLASH, - ANIM_WII_SAVE_DATA_FLASH_2, - ANIM_WII_SAVE_DATA_OUT, - ANIM_WII_SAVE_DATA_BACK, + // Wii save data button + ANIM_WII_SAVE_DATA_BASE, + ANIM_WII_SAVE_DATA_IN = ANIM_WII_SAVE_DATA_BASE, + ANIM_WII_SAVE_DATA_FOCUS_IN, + ANIM_WII_SAVE_DATA_FOCUS_OUT, + ANIM_WII_SAVE_DATA_FLASH, + ANIM_WII_SAVE_DATA_FLASH_2, + ANIM_WII_SAVE_DATA_OUT, + ANIM_WII_SAVE_DATA_BACK, - // Gamecube save data button - ANIM_GC_SAVE_DATA_BASE, - ANIM_GC_SAVE_DATA_IN = ANIM_GC_SAVE_DATA_BASE, - ANIM_GC_SAVE_DATA_FOCUS_IN, - ANIM_GC_SAVE_DATA_FOCUS_OUT, - ANIM_GC_SAVE_DATA_FLASH, - ANIM_GC_SAVE_DATA_FLASH_2, - ANIM_GC_SAVE_DATA_OUT, - ANIM_GC_SAVE_DATA_BACK, + // Gamecube save data button + ANIM_GC_SAVE_DATA_BASE, + ANIM_GC_SAVE_DATA_IN = ANIM_GC_SAVE_DATA_BASE, + ANIM_GC_SAVE_DATA_FOCUS_IN, + ANIM_GC_SAVE_DATA_FOCUS_OUT, + ANIM_GC_SAVE_DATA_FLASH, + ANIM_GC_SAVE_DATA_FLASH_2, + ANIM_GC_SAVE_DATA_OUT, + ANIM_GC_SAVE_DATA_BACK, - ANIM_MAX, - }; + ANIM_MAX, + }; - enum { - BTN_DATA_MANAGE = 0, - BTN_SETTING, - BTN_SAVEDATA, - BTN_CHANNEL, - BTN_WII_SAVE, - BTN_GC_SAVE, - BTN_MAX, - }; + enum { + BTN_DATA_MANAGE = 0, + BTN_SETTING, + BTN_SAVEDATA, + BTN_CHANNEL, + BTN_WII_SAVE, + BTN_GC_SAVE, + BTN_MAX, + }; - enum { - STATE_WAIT_BUTTON_FADE_IN = 0, - STATE_1ST_WAIT_FADE_IN, - STATE_1ST_NORMAL, - STATE_1ST_WAIT_FADE_OUT, - STATE_2ND_WAIT_FADE_IN, - STATE_2ND_NORMAL, - STATE_2ND_WAIT_FADE_OUT, - STATE_3RD_WAIT_FADE_IN, - STATE_3RD_NORMAL, - STATE_3RD_WAIT_FADE_OUT, - STATE_2ND_WAIT_BACK, - STATE_3RD_WAIT_BACK, - STATE_WAIT_BUTTON_DECIDE, - STATE_WAIT_BLACK_OUT, - STATE_WAIT_CHILD, - STATE_WAIT_CHILD_ANIM, - STATE_16, - STATE_DONE, - }; + enum { + STATE_WAIT_BUTTON_FADE_IN = 0, + STATE_1ST_WAIT_FADE_IN, + STATE_1ST_NORMAL, + STATE_1ST_WAIT_FADE_OUT, + STATE_2ND_WAIT_FADE_IN, + STATE_2ND_NORMAL, + STATE_2ND_WAIT_FADE_OUT, + STATE_3RD_WAIT_FADE_IN, + STATE_3RD_NORMAL, + STATE_3RD_WAIT_FADE_OUT, + STATE_2ND_WAIT_BACK, + STATE_3RD_WAIT_BACK, + STATE_WAIT_BUTTON_DECIDE, + STATE_WAIT_BLACK_OUT, + STATE_WAIT_CHILD, + STATE_WAIT_CHILD_ANIM, + STATE_16, + STATE_DONE, + }; - void stt_wait_button_fadein(); + void stt_wait_button_fadein(); - void stt_1st_fadein(); - void stt_1st_fadeout(); - void stt_2nd_fadein(); - void stt_2nd_fadeout(); - void stt_3rd_fadein(); - void stt_3rd_fadeout(); + void stt_1st_fadein(); + void stt_1st_fadeout(); + void stt_2nd_fadein(); + void stt_2nd_fadeout(); + void stt_3rd_fadein(); + void stt_3rd_fadeout(); - void stt_normal(); + void stt_normal(); - void stt_wait_2nd_back(); - void stt_wait_3rd_back(); + void stt_wait_2nd_back(); + void stt_wait_3rd_back(); - void stt_wait_button_decided(); - void stt_wait_blackout(); + void stt_wait_button_decided(); + void stt_wait_blackout(); - void stt_wait_child(); - void stt_wait_child_anm(); + void stt_wait_child(); + void stt_wait_child_anm(); - void reset_gui(); + void reset_gui(); - void set_text(const char* paneName, u32 msgId); + void set_text(const char* paneName, u32 msgId); - void start_point_event(const char* paneName, controller::Interface* con); - void start_left_event(const char* paneName); - void start_trig_event(const char* paneName); + void start_point_event(const char* paneName, controller::Interface* con); + void start_left_event(const char* paneName); + void start_trig_event(const char* paneName); - int get_button_no(const char* paneName); + int get_button_no(const char* paneName); - BOOL condition(int btnNo); + BOOL condition(int btnNo); - void start_focusin_anm(int btnNo, controller::Interface* con); - void start_focusout_anm(int btnNo); - void start_selected_anm(int btnNo); + void start_focusin_anm(int btnNo, controller::Interface* con); + void start_focusout_anm(int btnNo); + void start_selected_anm(int btnNo); - bool is_stopped_all_anm() const; + bool is_stopped_all_anm() const; - void fn_81409864(); + void fn_81409864(); - void fn_814098F4(); - void fn_unk_inline(); - void fn_81409988(); - void fn_814099EC(); + void fn_814098F4(); + void fn_unk_inline(); + void fn_81409988(); + void fn_814099EC(); - int mState; // 0x60 - int mPrevState; // 0x64 + int mState; // 0x60 + int mPrevState; // 0x64 - int mSettingArg; // 0x68 + int mSettingArg; // 0x68 - layout::Object* mpLayout; // 0x6C - nand::LayoutFile* mpLayoutFile; // 0x70 + layout::Object* mpLayout; // 0x6C + nand::LayoutFile* mpLayoutFile; // 0x70 - gui::PaneManager* mpGui; // 0x74 + gui::PaneManager* mpGui; // 0x74 - BOOL mbHovered[BTN_MAX]; // 0x78 - u32 unk_0x90; - u32 unk_0x94; + BOOL mbHovered[BTN_MAX]; // 0x78 + u32 unk_0x90; + u32 unk_0x94; - static const char* mscButtonName[BTN_MAX]; + static const char* mscButtonName[BTN_MAX]; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_SETTING_SELECT_H +#endif // IPL_SCENE_SETTING_SELECT_H diff --git a/include/scene/settingSelect/iplSettingSelectArg.h b/include/scene/settingSelect/iplSettingSelectArg.h index ed83edbf..5689573a 100644 --- a/include/scene/settingSelect/iplSettingSelectArg.h +++ b/include/scene/settingSelect/iplSettingSelectArg.h @@ -4,14 +4,14 @@ namespace ipl { namespace scene { class SettingSelectArg { - public: - enum { - ARG_START_NORMAL = 0, - ARG_START_SAVE_DATA, - ARG_START_AFTER_REBOOT, - }; + public: + enum { + ARG_START_NORMAL = 0, + ARG_START_SAVE_DATA, + ARG_START_AFTER_REBOOT, + }; }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_SETTING_SELECT_ARG_H +#endif // IPL_SCENE_SETTING_SELECT_ARG_H diff --git a/include/scene/textBalloon/iplBalloon.h b/include/scene/textBalloon/iplBalloon.h index 8f00f66a..d505c194 100644 --- a/include/scene/textBalloon/iplBalloon.h +++ b/include/scene/textBalloon/iplBalloon.h @@ -1,72 +1,71 @@ #ifndef IPL_SCENE_BALLOON_H #define IPL_SCENE_BALLOON_H -#include #include +#include #include "layout/iplLayout.h" namespace ipl { namespace scene { class TextBalloon { - public: - enum { - WAIT_UNTIL_FADE_IN = 15 - }; + public: + enum { WAIT_UNTIL_FADE_IN = 15 }; - TextBalloon(EGG::Heap* heap, nand::LayoutFile* layoutFile, const char* directory, const char* fileName, const ipl::math::VEC3& unk2, f32 unk3 = 120.0f, f32 unk4 = 30.0f); - ~TextBalloon(); + TextBalloon(EGG::Heap* heap, nand::LayoutFile* layoutFile, const char* directory, const char* fileName, const ipl::math::VEC3& unk2, + f32 unk3 = 120.0f, f32 unk4 = 30.0f); + ~TextBalloon(); - void calc(); - void draw(); + void calc(); + void draw(); - void init(const wchar_t* text, u32 texLen = 0); + void init(const wchar_t* text, u32 texLen = 0); - void terminate(); + void terminate(); - void fadein(); - void fadeinNoSetTextbox(); + void fadein(); + void fadeinNoSetTextbox(); - void fadeout(); - void fadeoutForce(); + void fadeout(); + void fadeoutForce(); - void setPos(const math::VEC3& pos, bool unk0, int unk1); - void updatePos(const math::VEC3& pos); + void setPos(const math::VEC3& pos, bool unk0, int unk1); + void updatePos(const math::VEC3& pos); - void set_translate(const math::VEC3& trans); - void set_textbox(const wchar_t* text, BOOL bNoLimit = FALSE); + void set_translate(const math::VEC3& trans); + void set_textbox(const wchar_t* text, BOOL bNoLimit = FALSE); - void init_textbox(BOOL bNoLimit = FALSE) { set_textbox(mpText, bNoLimit); } + void init_textbox(BOOL bNoLimit = FALSE) { set_textbox(mpText, bNoLimit); } - layout::Object* get_layout() { return mpLayout; } + layout::Object* get_layout() { return mpLayout; } - private: - void on_pre_fadein(); - void anm_fadein(); + private: + void on_pre_fadein(); + void anm_fadein(); - void set_size(const char* paneName, const nw4r::lyt::Size& size); - const nw4r::lyt::Size* get_size(const char* paneName); + void set_size(const char* paneName, const nw4r::lyt::Size& size); + const nw4r::lyt::Size* get_size(const char* paneName); - undefined4 unk_0x00; - undefined4 unk_0x04; - BOOL unk_0x08; + undefined4 unk_0x00; + undefined4 unk_0x04; + BOOL unk_0x08; - layout::Object* mpLayout; // 0x0C + layout::Object* mpLayout; // 0x0C - undefined4 unused_0x10; + undefined4 unused_0x10; - wchar_t* mpText; // 0x14 + wchar_t* mpText; // 0x14 - u32 mTextLen; // 0x18 - math::VEC3 mBalloonPos; // 0x1C - undefined4 unk_0x28; - undefined unk_0x2C; - f32 unk_0x30; - f32 unk_0x34; + u32 mTextLen; // 0x18 + math::VEC3 mBalloonPos; // 0x1C + undefined4 unk_0x28; + undefined unk_0x2C; + f32 unk_0x30; + f32 unk_0x34; - int mWaitUntilFadeIn; // 0x38 + int mWaitUntilFadeIn; // 0x38 }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_TEXT_BALLOON_H +#endif // IPL_SCENE_TEXT_BALLOON_H diff --git a/include/scene/textWriter/iplTextWriter.h b/include/scene/textWriter/iplTextWriter.h index 6e0e1382..f55d713b 100644 --- a/include/scene/textWriter/iplTextWriter.h +++ b/include/scene/textWriter/iplTextWriter.h @@ -4,8 +4,8 @@ #include "iplSceneUIHeader.h" #include "scene/button/iplButton.h" -#include "system/iplNigaoe.h" #include "scene/textBalloon/iplBalloon.h" +#include "system/iplNigaoe.h" #include "utility/iplScroller.h" #include @@ -16,109 +16,112 @@ namespace ipl { namespace scene { class TextWriter; class InputFormObserver : public textinput::extend::memo::NigaoeEventObserver { - public: - InputFormObserver(TextWriter* instance) : mpInstance(instance) {} + public: + InputFormObserver(TextWriter* instance) : mpInstance(instance) {} - virtual bool onNigaoeButton(); + virtual bool onNigaoeButton(); - virtual void pointNigaoeButton(); - virtual void leftNigaoeButton(); - virtual void moveNigaoeButton(); + virtual void pointNigaoeButton(); + virtual void leftNigaoeButton(); + virtual void moveNigaoeButton(); - private: - TextWriter* mpInstance; // 0x04 + private: + TextWriter* mpInstance; // 0x04 }; class Button; FADER_SCENE_CLASS(TextWriter), public ButtonEventHandlerBase { - public: - TextWriter(EGG::Heap* heap); - ~TextWriter(); + public: + TextWriter(EGG::Heap * heap); + ~TextWriter(); - enum { - SEND_ERR_NWC24 = -1, - SEND_ERR_SUCCESS, - SEND_ERR_RFL, - }; + enum { + SEND_ERR_NWC24 = -1, + SEND_ERR_SUCCESS, + SEND_ERR_RFL, + }; - virtual BOOL isResetAcceptable() const { return unk_0x7D; } + virtual BOOL isResetAcceptable() const { + return unk_0x7D; + } - virtual void prepare(); - virtual void create(); - virtual void draw(); - virtual void destroy(); + virtual void prepare(); + virtual void create(); + virtual void draw(); + virtual void destroy(); - virtual void initCalcNormal(); - virtual void initCalcFadeout(); + virtual void initCalcNormal(); + virtual void initCalcFadeout(); - virtual void calcCommon() {} + virtual void calcCommon() { + } - virtual FaderSceneCommand calcFadein(); - virtual FaderSceneCommand calcNormal(); - virtual FaderSceneCommand calcFadeout(); + virtual FaderSceneCommand calcFadein(); + virtual FaderSceneCommand calcNormal(); + virtual FaderSceneCommand calcFadeout(); - virtual bool onNigaoeButton(); - virtual void setNigaoe(nigaoe::Object* nigaoe); + virtual bool onNigaoeButton(); + virtual void setNigaoe(nigaoe::Object * nigaoe); - virtual void pointNigaoeButton(); - virtual void leftNigaoeButton(); - virtual void moveNigaoeButton(); + virtual void pointNigaoeButton(); + virtual void leftNigaoeButton(); + virtual void moveNigaoeButton(); - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); + virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); - virtual void onSend(); - virtual void openNWC24(); - virtual int sendMessageByNWC24(NWC24UserId userId, const wchar_t* wcString); - virtual void closeNWC24(); + virtual void onSend(); + virtual void openNWC24(); + virtual int sendMessageByNWC24(NWC24UserId userId, const wchar_t* wcString); + virtual void closeNWC24(); - virtual void getMyUserID(NWC24UserId* myUserId); + virtual void getMyUserID(NWC24UserId * myUserId); - textinput::MemoManager* getMemoManager(); - textinput::MemoInputForm* getMemoInputForm(); - Button* getButton(); + textinput::MemoManager* getMemoManager(); + textinput::MemoInputForm* getMemoInputForm(); + Button* getButton(); - void createBalloon() { - mpNigaoeBalloon = new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f)); - } + void createBalloon() { + mpNigaoeBalloon = new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f)); + } - protected: - enum { - STATE_NORMAL = 0, - STATE_TO_SEL_FACE, - STATE_SEL_FACE, - STATE_DIALOG, - STATE_SEND, - STATE_SEND_ERR, - STATE_DONE, - }; + protected: + enum { + STATE_NORMAL = 0, + STATE_TO_SEL_FACE, + STATE_SEL_FACE, + STATE_DIALOG, + STATE_SEND, + STATE_SEND_ERR, + STATE_DONE, + }; - static const int WC_STRING_LENGTH = 0x400; + static const int WC_STRING_LENGTH = 0x400; - int mState; // 0x64 - InputFormObserver* mpEventObserver; // 0x68 + int mState; // 0x64 + InputFormObserver* mpEventObserver; // 0x68 - int mSelectedFaceId; // 0x6C - nigaoe::Object* mpNigaoe; // 0x70 + int mSelectedFaceId; // 0x6C + nigaoe::Object* mpNigaoe; // 0x70 - f32 mToFace_Frame; // 0x74 - f32 mToFace_Dest; // 0x78 - static const int mToFace_Duration = 20; + f32 mToFace_Frame; // 0x74 + f32 mToFace_Dest; // 0x78 + static const int mToFace_Duration = 20; - bool mbClosing; // 0x7C - bool unk_0x7D; + bool mbClosing; // 0x7C + bool unk_0x7D; - wchar_t* mWCString; // 0x80 + wchar_t* mWCString; // 0x80 - u32 mNwc24ErrCountdown; // 0x84 + u32 mNwc24ErrCountdown; // 0x84 - u8 unused_0x88[12]; + u8 unused_0x88[12]; - TextBalloon* mpNigaoeBalloon; // 0x94 - nand::LayoutFile* mpBalloonFile; // 0x98 + TextBalloon* mpNigaoeBalloon; // 0x94 + nand::LayoutFile* mpBalloonFile; // 0x98 - utility::BScroller* mpScroller; // 0x9C + utility::BScroller* mpScroller; // 0x9C }; - } -} + } // namespace scene +} // namespace ipl -#endif // IPL_SCENE_TEXT_WRITER_H +#endif // IPL_SCENE_TEXT_WRITER_H diff --git a/include/sound/iplSound.h b/include/sound/iplSound.h index 86658a59..6eb41ce6 100644 --- a/include/sound/iplSound.h +++ b/include/sound/iplSound.h @@ -10,46 +10,46 @@ namespace ipl { namespace snd { class System { - public: - System(); + public: + System(); - void initOnMemory(const void* data, EGG::Heap* heap, u32 soundSize); - void initFx(); + void initOnMemory(const void* data, EGG::Heap* heap, u32 soundSize); + void initFx(); - void shutup(BOOL shutUpDMA); - - virtual void fn_815F6278(); // 0x08 - virtual void calc(); // 0x0C + void shutup(BOOL shutUpDMA); - void stopAllSound(int unk = 0); - void stopBannerSound(int unk = 0); + virtual void fn_815F6278(); // 0x08 + virtual void calc(); // 0x0C - int startSE(const char* sndName); - int holdSE(const char* sndName); - int holdSEwithPosDis(const char* sndName, f32 x, f32 y); - int startSEIndex(u32 sndIndex); + void stopAllSound(int unk = 0); + void stopBannerSound(int unk = 0); - int startSEwithPos(const char* sndName, f32 pos); + int startSE(const char* sndName); + int holdSE(const char* sndName); + int holdSEwithPosDis(const char* sndName, f32 x, f32 y); + int startSEIndex(u32 sndIndex); - BOOL isSEActive(const char* sndName); + int startSEwithPos(const char* sndName, f32 pos); - int startBGM(const char* bgmName); - int pauseOnBGM(); - int pauseOffBGM(); + BOOL isSEActive(const char* sndName); - int muteOffBGM(int); - int muteOnBGM(int); + int startBGM(const char* bgmName); + int pauseOnBGM(); + int pauseOffBGM(); - int resetAllSound(); + int muteOffBGM(int); + int muteOnBGM(int); - BOOL checkTmpSoundFile(void*, u32); - - private: - u32 unk_0x00[0x638]; + int resetAllSound(); + + BOOL checkTmpSoundFile(void*, u32); + + private: + u32 unk_0x00[0x638]; }; - extern System sSystem; - extern BannerSoundPlayer sBannerSoundPlayer; + extern System sSystem; + extern BannerSoundPlayer sBannerSoundPlayer; static System* getSystem() { return &sSystem; @@ -58,7 +58,7 @@ namespace ipl { static BannerSoundPlayer* getBannerPlayer() { return &sBannerSoundPlayer; } - } -} + } // namespace snd +} // namespace ipl -#endif // IPL_SOUND_H +#endif // IPL_SOUND_H diff --git a/include/system/MESGEntries.h b/include/system/MESGEntries.h index 84d8674a..ab47b0b2 100644 --- a/include/system/MESGEntries.h +++ b/include/system/MESGEntries.h @@ -1,6 +1,8 @@ #ifndef IPL_MESSAGE_ENTRIES_H #define IPL_MESSAGE_ENTRIES_H +// clang-format off + /* Common message IDs */ // TODO: Find out whats with the alts #define MESG_CMN_START 2 @@ -212,4 +214,6 @@ #define MESG_ERROR_NWC24_FATAL 454 #define MESG_ERROR_NWC24_FRIEND_NULL 456 -#endif // IPL_MESSAGE_ENTRIES_H +// clang-format on + +#endif // IPL_MESSAGE_ENTRIES_H diff --git a/include/system/RIPL_BoardRecord.h b/include/system/RIPL_BoardRecord.h index d0ea2099..72c925f8 100644 --- a/include/system/RIPL_BoardRecord.h +++ b/include/system/RIPL_BoardRecord.h @@ -13,10 +13,10 @@ extern "C" { #endif -#define RBR_MAGIC 'RI_5' // RIPL Board Record Version 5? -#define RBR_HEADER_SIZE 0x0140 +#define RBR_MAGIC 'RI_5' // RIPL Board Record Version 5? +#define RBR_HEADER_SIZE 0x0140 -#define RBR_ATTACHMENT_MAX 2 +#define RBR_ATTACHMENT_MAX 2 #define RBR_FILETYPE_LENGTH 8 @@ -24,13 +24,13 @@ static inline int RBRCompareFileType(const char* type, const char* type2) { return strncmp(type, type2, RBR_FILETYPE_LENGTH); } -#define RBR_TITLE_LENGTH_LIMIT 8 -#define RBR_BODY_LENGTH_LIMIT 8 +#define RBR_TITLE_LENGTH_LIMIT 8 +#define RBR_BODY_LENGTH_LIMIT 8 -extern const char* RBRFileType_Txt; -extern const char* RBRFileType_Odh; -extern const char* RBRFileType_Dat; -extern const char* RBRFileType_Log; +extern const char* RBRFileType_Txt; +extern const char* RBRFileType_Odh; +extern const char* RBRFileType_Dat; +extern const char* RBRFileType_Log; typedef enum RBRRecordType { RBRRecordType_Memo = 0, @@ -41,10 +41,7 @@ typedef enum RBRRecordType { RBRRecordType_Max } RBRRecordType; -typedef enum RBRReplyFlag { - RBRReplyFlag_Available, - RBRReplyFlag_NotAvailable -} RBRReplyFlag; +typedef enum RBRReplyFlag { RBRReplyFlag_Available, RBRReplyFlag_NotAvailable } RBRReplyFlag; typedef enum RBRAttachmentType { RBRAttachmentType_None = 0, @@ -57,48 +54,48 @@ typedef enum RBRAttachmentType { } RBRAttachmentType; typedef struct RBRAttachment { - RBRAttachmentType type; // 0x00 - u32 offset; // 0x04 - u32 size; // 0x08 + RBRAttachmentType type; // 0x00 + u32 offset; // 0x04 + u32 size; // 0x08 } RBRAttachment; typedef union RBRRecordFlags { u32 data; struct { - u8 optOut; // 0x00 - u8 unk_0x01[2]; - u8 type; // 0x03 + u8 optOut; // 0x00 + u8 unk_0x01[2]; + u8 type; // 0x03 }; } RBRRecordFlags; #define RBR_MAKE_RECORDFLAGS(type, optOut) ((u32)((type & 0xFF) | (optOut & 0xFF) << 24)) typedef struct RBRHeader { - u32 magic; // 0x00 (Always 0x52495F35) - f32 xPos; // 0x04 - f32 yPos; // 0x08 - RBRRecordFlags flags; // 0x0C - OSTime time; // 0x10 + u32 magic; // 0x00 (Always 0x52495F35) + f32 xPos; // 0x04 + f32 yPos; // 0x08 + RBRRecordFlags flags; // 0x0C + OSTime time; // 0x10 - NWC24FriendAddr addr; // 0x18 - u16 addrType; // 0x118 - u16 noReplyFlag; // 0x11A + NWC24FriendAddr addr; // 0x18 + u16 addrType; // 0x118 + u16 noReplyFlag; // 0x11A - u32 titleOffset; // 0x11C - u32 bodyOffset; // 0x120 - u32 faceOffset; // 0x124 + u32 titleOffset; // 0x11C + u32 bodyOffset; // 0x120 + u32 faceOffset; // 0x124 - RBRAttachment attach[RBR_ATTACHMENT_MAX]; // 0x128 + RBRAttachment attach[RBR_ATTACHMENT_MAX]; // 0x128 - u32 crc32; // 0x140 - u32 reserved; /* ? */ // 0x148 + u32 crc32; // 0x140 + u32 reserved; /* ? */ // 0x148 } RBRHeader; -u8* RBRGetPicture(u8* recordData, u32* pictureSize); -void RBRGetPosRect(f32* left, f32* right, f32* top, f32* bottom); +u8* RBRGetPicture(u8* recordData, u32* pictureSize); +void RBRGetPosRect(f32* left, f32* right, f32* top, f32* bottom); #ifdef __cplusplus } #endif -#endif // RIPL_BOARD_RECORD_H +#endif // RIPL_BOARD_RECORD_H diff --git a/include/system/TVRC.h b/include/system/TVRC.h index 3ad237cd..53b65199 100644 --- a/include/system/TVRC.h +++ b/include/system/TVRC.h @@ -5,19 +5,17 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus -BOOL TVRCInit(void* pRsrc); -BOOL TVRCSetModelType(int makerID, int typeNo, void* pFileData, int length); -void TVRCSetRepeatTimeout(u32 value); -BOOL TVRCSendStopAsync(); -BOOL TVRCIsActive(); -BOOL TVRCIsValidCommand(int cmd); +BOOL TVRCInit(void* pRsrc); +BOOL TVRCSetModelType(int makerID, int typeNo, void* pFileData, int length); +void TVRCSetRepeatTimeout(u32 value); +BOOL TVRCSendStopAsync(); +BOOL TVRCIsActive(); +BOOL TVRCIsValidCommand(int cmd); #ifdef __cplusplus } -#endif // __cplusplus - -#endif // TV_REMOTE_CONTROL_H - +#endif // __cplusplus +#endif // TV_REMOTE_CONTROL_H diff --git a/include/system/iplBS2Manager.h b/include/system/iplBS2Manager.h index 2522ca09..d13dab78 100644 --- a/include/system/iplBS2Manager.h +++ b/include/system/iplBS2Manager.h @@ -3,8 +3,8 @@ #include -#include #include +#include #include @@ -27,82 +27,82 @@ namespace ipl { }; class Manager { - public: - /** @param heap The work heap used. */ - Manager(EGG::Heap* heap); - virtual ~Manager(); + public: + /** @param pHeap The work heap used. */ + Manager(EGG::Heap* pHeap); + virtual ~Manager(); - /** @brief Initialize Disc Update */ - void startUpdate(); - /** @brief Start Disc Update */ - int update(); + /** @brief Initialize Disc Update */ + void startUpdate(); + /** @brief Start Disc Update */ + int update(); - /** - * @brief Get buffer length of a game disc's banner. - * @param pBuffer Disc banner data. - */ - u32 getDiskBannerBuffer(void** pBuffer); + /** + * @brief Get buffer length of a game disc's banner. + * @param pBuffer Disc banner data. + */ + u32 getDiskBannerBuffer(void** pBuffer); - void reserveRVLGame(); - void reserveGCGame(); - - /** @brief Start Wii Game (same as `startGCGame`) */ - void startRVLGame(); - /** @brief Start Game Cube Game (same as `startRVLGame`) */ - void startGCGame(); + void reserveRVLGame(); + void reserveGCGame(); - void abort(); - void restart(); + /** @brief Start Wii Game (same as `startGCGame`) */ + void startRVLGame(); + /** @brief Start Game Cube Game (same as `startRVLGame`) */ + void startGCGame(); - /** @brief Wrapper for `BS2CheckParentalControl` */ - bool checkParentalControl(); + void abort(); + void restart(); - /** - * @brief Gets the information of the game disc. - * @param diskID Output title ID of disc. - * @param diskMaker Output maker ID of disc. - */ - void getDiskInfo(char** diskID, char** diskMaker); + /** @brief Wrapper for `BS2CheckParentalControl` */ + bool checkParentalControl(); - /** @brief Check is disc title is available? */ - BOOL isTitleAvailable(ESTitleId titleId) const; - /** @brief Get disc's ticket from NAND? */ - s32 getTicketFromNand(ESTitleId titleId, ESTicketView* pTicketView) const; - void loadLockedTitleAsync(ESTitleId titleId, ESTicketView& ticketView); + /** + * @brief Gets the information of the game disc. + * @param diskID Output title ID of disc. + * @param diskMaker Output maker ID of disc. + */ + void getDiskInfo(char** pDiskID, char** pDiskMaker); - void splashTick(BS2State state); - void execTick(BS2State state); - void updateTick(); + /** @brief Check is disc title is available? */ + BOOL isTitleAvailable(ESTitleId titleId) const; + /** @brief Get disc's ticket from NAND? */ + s32 getTicketFromNand(ESTitleId titleId, ESTicketView* pTicketView) const; + void loadLockedTitleAsync(ESTitleId titleId, ESTicketView& ticketView); - int getIPLState() { return mIPLState; } - BS2State getUnlockedState() { return mUnlockedState; } - BOOL diskHasBanner() { return mbHasBanner; } + void splashTick(BS2State state); + void execTick(BS2State state); + void updateTick(); - private: - void bootNewSystem(); - - int mIPLState; // 0x04 - volatile BS2State mState; // 0x08 - bool unk_0x0C; - bool unk_0x0D; - bool unk_0x0E; - bool unk_0x0F; - bool mbIsDiagDisc; // 0x10 - bool unk_0x11; - u8* mpBannerBuffer; // 0x14 - BOOL mbHasBanner; // 0x18 - BS2State mUnlockedState; // 0x1C + int getIPLState() { return mIPLState; } + BS2State getUnlockedState() { return mUnlockedState; } + BOOL diskHasBanner() { return mbHasBanner; } - // For Update + private: + void bootNewSystem(); - bool mbStartUpdate; // 0x20 - BS2UpdateEntry* mEntries; // 0x24 - int mPrevEntry; // 0x28 - int mPrevFound; // 0x2C - u32 mEntrySize; // 0x30 - u32 mEntryOffset; // 0x34 + int mIPLState; // 0x04 + volatile BS2State mState; // 0x08 + bool unk_0x0C; + bool unk_0x0D; + bool unk_0x0E; + bool unk_0x0F; + bool mbIsDiagDisc; // 0x10 + bool unk_0x11; + u8* mpBannerBuffer; // 0x14 + BOOL mbHasBanner; // 0x18 + BS2State mUnlockedState; // 0x1C + + // For Update + + bool mbStartUpdate; // 0x20 + BS2UpdateEntry* mEntries; // 0x24 + int mPrevEntry; // 0x28 + int mPrevFound; // 0x2C + u32 mEntrySize; // 0x30 + u32 mEntryOffset; // 0x34 }; - } -} + } // namespace bs2 +} // namespace ipl -#endif // IPL_BS2_MANAGER_H +#endif // IPL_BS2_MANAGER_H diff --git a/include/system/iplCdbBackup.h b/include/system/iplCdbBackup.h index 7776c2de..2347f4ff 100644 --- a/include/system/iplCdbBackup.h +++ b/include/system/iplCdbBackup.h @@ -1,81 +1,81 @@ #ifndef IPL_CDB_BACKUP_H #define IPL_CDB_BACKUP_H -#include #include +#include #include namespace ipl { class CdbBackup { - public: - CdbBackup(); - ~CdbBackup(); + public: + CdbBackup(); + ~CdbBackup(); - void update(); + void update(); - void set_done_process(bool value) { mbDoneProcess = value; } - void set_cdb_result(int value) { mCDBResult = value; } - void set_prev_free_size(int value) { mPrevFreeSize = value; } - void set_free_size(int value) { mTotalFreeSize = value; } + void set_done_process(bool value) { mbDoneProcess = value; } + void set_cdb_result(int value) { mCDBResult = value; } + void set_prev_free_size(int value) { mPrevFreeSize = value; } + void set_free_size(int value) { mTotalFreeSize = value; } - BOOL is_working() { return mState != STATE_FINISHED; } + BOOL is_working() { return mState != STATE_FINISHED; } - private: - void stt_wait_worker(); - void stt_mount_sd(); - void stt_check_sd(); - void stt_wait_del_msg(); - void stt_wait_besd_del_msg(); - void stt_wait_delete(); - void stt_wait_del_msg_fns(); - void stt_wait_sd_back_msg(); - void stt_check_sd_err(); - void stt_check_prepare_back(); - void stt_wait_backup(); - void stt_wait_back_msg_fns(); - void stt_clean_up_back(); - void stt_wait_ret_msg(); - void stt_wait_fns_msg(); - void stt_wait_terminate(); + private: + void stt_wait_worker(); + void stt_mount_sd(); + void stt_check_sd(); + void stt_wait_del_msg(); + void stt_wait_besd_del_msg(); + void stt_wait_delete(); + void stt_wait_del_msg_fns(); + void stt_wait_sd_back_msg(); + void stt_check_sd_err(); + void stt_check_prepare_back(); + void stt_wait_backup(); + void stt_wait_back_msg_fns(); + void stt_clean_up_back(); + void stt_wait_ret_msg(); + void stt_wait_fns_msg(); + void stt_wait_terminate(); - int fn_8135B1C0(); + int fn_8135B1C0(); - void error_handling(); + void error_handling(); - enum { - STATE_INVALID = -1, - STATE_WAIT_WORKER, - STATE_MOUNT_SD, - STATE_CHECK_SD, - STATE_DELETING, - STATE_DELETING_2, - STATE_WAIT_DELETING, - STATE_DONE_DELETE, - STATE_SD_BACKING, - STATE_SD_CHECK_ERR, - STATE_SD_BACK_PREPARE, - STATE_WAIT_SD_BACKING, - STATE_DONE_SD_BACK, - STATE_FINISHED_2, - STATE_CLEAN_SD_BACK, - STATE_WAIT_RET, - STATE_WAIT_FINISH_MSG, - STATE_WAIT_TERMINATE, - STATE_FINISHED, - }; + enum { + STATE_INVALID = -1, + STATE_WAIT_WORKER, + STATE_MOUNT_SD, + STATE_CHECK_SD, + STATE_DELETING, + STATE_DELETING_2, + STATE_WAIT_DELETING, + STATE_DONE_DELETE, + STATE_SD_BACKING, + STATE_SD_CHECK_ERR, + STATE_SD_BACK_PREPARE, + STATE_WAIT_SD_BACKING, + STATE_DONE_SD_BACK, + STATE_FINISHED_2, + STATE_CLEAN_SD_BACK, + STATE_WAIT_RET, + STATE_WAIT_FINISH_MSG, + STATE_WAIT_TERMINATE, + STATE_FINISHED, + }; - bool mbDoneProcess; // 0x00 - int mCDBResult; // 0x04 + bool mbDoneProcess; // 0x00 + int mCDBResult; // 0x04 - int mPrevFreeSize; // 0x08 - int mTotalFreeSize; // 0x0C + int mPrevFreeSize; // 0x08 + int mTotalFreeSize; // 0x0C - int mState; // 0x10 - int mState2; // 0x14 + int mState; // 0x10 + int mState2; // 0x14 - static const int unknown; + static const int unknown; }; -} +} // namespace ipl -#endif // IPL_CDB_BACKUP_H +#endif // IPL_CDB_BACKUP_H diff --git a/include/system/iplCdbManager.h b/include/system/iplCdbManager.h index 34badc9d..4120d09a 100644 --- a/include/system/iplCdbManager.h +++ b/include/system/iplCdbManager.h @@ -5,8 +5,8 @@ #include #include -#include "system/iplSDVFWorker.h" #include "system/RIPL_BoardRecord.h" +#include "system/iplSDVFWorker.h" #include "iplMath.h" @@ -17,123 +17,116 @@ namespace ipl { namespace cdb { class Manager { - public: - static const int UNKNOWN_VALUE; + public: + static const int UNKNOWN_VALUE; - Manager(EGG::Heap* heap); + Manager(EGG::Heap* heap); - void closeDatabase(); + void closeDatabase(); - BOOL createNewRecord(const char* recordName, const char* recordFileType, const OSCalendarTime* dateTime, u32* gameCode, u16* makerCode, - const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, u16 noReplyFlag, - const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, - const void** attachData, u32* attachSize, RBRAttachmentType* attachType); + BOOL createNewRecord(const char* recordName, const char* recordFileType, const OSCalendarTime* dateTime, u32* gameCode, u16* makerCode, + const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, u16 noReplyFlag, + const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, const void** attachData, u32* attachSize, + RBRAttachmentType* attachType); - u8* makeBuffer(const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, u16 noReplyFlag, - const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, - const void** attachData, u32* attachSize, RBRAttachmentType* attachType, - u32* bufferSize); + u8* makeBuffer(const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, u16 noReplyFlag, + const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, const void** attachData, u32* attachSize, + RBRAttachmentType* attachType, u32* bufferSize); - BOOL writeRecord(CDBRecord* record, const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, u16 noReplyFlag, - const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, - const void** attachData, u32* attachSize, RBRAttachmentType* attachType); + BOOL writeRecord(CDBRecord* record, const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, + u16 noReplyFlag, const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, const void** attachData, + u32* attachSize, RBRAttachmentType* attachType); - BOOL createAtOnce(CDBRecord* record, const char* recordName, const char* recordFileType, - u32* gameCode, u16* makerCode, const OSCalendarTime* dateTime, u8* buffer, u32 bufferSize); + BOOL createAtOnce(CDBRecord* record, const char* recordName, const char* recordFileType, u32* gameCode, u16* makerCode, + const OSCalendarTime* dateTime, u8* buffer, u32 bufferSize); - BOOL deleteRecord(CDBRecordKey* recordKey); + BOOL deleteRecord(CDBRecordKey* recordKey); - BOOL isValidHeader(const RBRHeader* header); - BOOL isValidType(const char* text); - BOOL isTxtValidType(const char* text); + BOOL isValidHeader(const RBRHeader* header); + BOOL isValidType(const char* text); + BOOL isTxtValidType(const char* text); - u32 calcCRC(const RBRHeader* header); + u32 calcCRC(const RBRHeader* header); - BOOL isOverFlow() const; - BOOL isUnderFlow() const; + BOOL isOverFlow() const; + BOOL isUnderFlow() const; - BOOL findByKey(CDBRecord* record, CDBRecordKey* recordKey); - BOOL search(const CDBDate& begin, const CDBDate& end, - CDBSearchDirection searchDirection, CDBRecordLocation recordLocation, int unk2, - CDBSearchRecordCB searchRecordCB, void* searchRecordWork); + BOOL findByKey(CDBRecord* record, CDBRecordKey* recordKey); + BOOL search(const CDBDate& begin, const CDBDate& end, CDBSearchDirection searchDirection, CDBRecordLocation recordLocation, int unk2, + CDBSearchRecordCB searchRecordCB, void* searchRecordWork); - BOOL getDataSize(CDBRecord* record, u32* recordDataSize); - BOOL getCDBId(CDBRecord* record, CDBId* recordCDBId); + BOOL getDataSize(CDBRecord* record, u32* recordDataSize); + BOOL getCDBId(CDBRecord* record, CDBId* recordCDBId); - BOOL open(CDBRecord* record); - BOOL read(CDBRecord* record, void* buffer, u32 readSize); - BOOL write(CDBRecord* record, void* buffer, u32 writeSize); - BOOL seek(CDBRecord* record, s32 offset, CDBSeek seekOrigin); - BOOL close(CDBRecord* record); + BOOL open(CDBRecord* record); + BOOL read(CDBRecord* record, void* buffer, u32 readSize); + BOOL write(CDBRecord* record, void* buffer, u32 writeSize); + BOOL seek(CDBRecord* record, s32 offset, CDBSeek seekOrigin); + BOOL close(CDBRecord* record); - BOOL remove(CDBRecord* record); + BOOL remove(CDBRecord* record); - void startSDProc(); - void terminateSDProc(); + void startSDProc(); + void terminateSDProc(); - BOOL mountSD(); - BOOL unmountSD(); + BOOL mountSD(); + BOOL unmountSD(); - void unused() { - utility::autoMutexLock lock(mMutex); + void unused() { utility::autoMutexLock lock(mMutex); } + + void unused2() { utility::autoMutexLock lock(mMutex); } + + void mountSD_safe() { + if (!mbSDMounted) { + mountSD(); } + } - void unused2() { - utility::autoMutexLock lock(mMutex); + void unmountSD_safe() { + if (mbSDMounted) { + unmountSD(); } + } - void mountSD_safe() { - if (!mbSDMounted) { - mountSD(); - } - } + bool isSDMounted() { return mbSDMounted; } - void unmountSD_safe() { - if (mbSDMounted) { - unmountSD(); - } - } + BOOL backupToSD(CDBRecord* record); - bool isSDMounted() { return mbSDMounted; } + BOOL cleanUpEmptyDirectories(CDBRecordLocation recordLocation); - BOOL backupToSD(CDBRecord* record); + CDBErr getCDBResult() { return mCDBResult; } - BOOL cleanUpEmptyDirectories(CDBRecordLocation recordLocation); + void getFreeSize(u32* freeSize = NULL); - CDBErr getCDBResult() { return mCDBResult; } + SDVFWorker* getSDWorker() { return &mSDVFWorker; } - void getFreeSize(u32* freeSize = NULL); + private: + BOOL error_handling(CDBErr err, int line); - SDVFWorker* getSDWorker() { return &mSDVFWorker; } + int mCDBFreeSize; // 0x00 + CDBErr mCDBResult; // 0x04 + CDBDatabase mDatabase; // 0x08 - private: - BOOL error_handling(CDBErr err, int line); + bool mbSDMounted; // 0x14 - int mCDBFreeSize; // 0x00 - CDBErr mCDBResult; // 0x04 - CDBDatabase mDatabase; // 0x08 + SDVFWorker mSDVFWorker; // 0x18 + u8* mpSDVFWork; // 0x1C + OSMutex mMutex; // 0x20 - bool mbSDMounted; // 0x14 - - SDVFWorker mSDVFWorker; // 0x18 - u8* mpSDVFWork; // 0x1C - OSMutex mMutex; // 0x20 - - u8 unk_0x38; - u8 unk_0x39; + u8 unk_0x38; + u8 unk_0x39; }; class auto_closer { - public: - auto_closer(Manager* mgr, CDBRecord* record) : mpCDBMgr(mgr), mpRecord(record) {} - ~auto_closer() { - mpCDBMgr->close(mpRecord); - } - private: - Manager* mpCDBMgr; // 0x00 - CDBRecord* mpRecord; // 0x04 - }; - } -} + public: + auto_closer(Manager* mgr, CDBRecord* record) : mpCDBMgr(mgr), mpRecord(record) {} + ~auto_closer() { mpCDBMgr->close(mpRecord); } -#endif // IPL_CDB_MANAGER_H + private: + Manager* mpCDBMgr; // 0x00 + CDBRecord* mpRecord; // 0x04 + }; + } // namespace cdb +} // namespace ipl + +#endif // IPL_CDB_MANAGER_H diff --git a/include/system/iplCdbWrapper.h b/include/system/iplCdbWrapper.h index 7c5925e0..41fe4624 100644 --- a/include/system/iplCdbWrapper.h +++ b/include/system/iplCdbWrapper.h @@ -7,10 +7,10 @@ namespace ipl { namespace cdb { namespace wrapper { // only one - CDBErr init(void* work); - } - } - -} + CDBErr init(void* work); + } // namespace wrapper + } // namespace cdb -#endif // IPL_CDB_WRAPPER_H +} // namespace ipl + +#endif // IPL_CDB_WRAPPER_H diff --git a/include/system/iplChannelManager.h b/include/system/iplChannelManager.h index c1d9530f..7ad7cbbd 100644 --- a/include/system/iplChannelManager.h +++ b/include/system/iplChannelManager.h @@ -1,9 +1,9 @@ #ifndef IPL_CHANNEL_MANAGER_H #define IPL_CHANNEL_MANAGER_H -#include #include #include +#include #include @@ -14,22 +14,22 @@ #include "system/iplNandMeta.h" #include "system/iplNandShared.h" -#define CHANNEL_INFO(primary, second, flags, titleId) \ +#define CHANNEL_INFO(primary, second, flags, titleId) \ { primary, second, 0, 0, flags, ES_TITLE_TYPE(titleId), ES_TITLE_CODE(titleId) } -#define CHANNEL_INFO_NULL \ +#define CHANNEL_INFO_NULL \ { 0, 0, 0, 0, 0, 0, 0 } -#define MAX_CHANNEL_COLUMN 3 -#define MAX_CHANNEL_ROW 4 -#define MAX_CHANNEL_INDEX (MAX_CHANNEL_ROW * MAX_CHANNEL_COLUMN) +#define MAX_CHANNEL_COLUMN 3 +#define MAX_CHANNEL_ROW 4 +#define MAX_CHANNEL_INDEX (MAX_CHANNEL_ROW * MAX_CHANNEL_COLUMN) -#define MAX_CHANNEL_PAGE 4 +#define MAX_CHANNEL_PAGE 4 -#define MAX_CHANNEL_TOTAL (MAX_CHANNEL_PAGE * MAX_CHANNEL_INDEX) +#define MAX_CHANNEL_TOTAL (MAX_CHANNEL_PAGE * MAX_CHANNEL_INDEX) #define CHANNEL_INFO_SIZE(p, i) ((p * i) * sizeof(channel::SInfo)) -#define MAX_CHANNEL_INFO_SIZE CHANNEL_INFO_SIZE(MAX_CHANNEL_PAGE, MAX_CHANNEL_INDEX) +#define MAX_CHANNEL_INFO_SIZE CHANNEL_INFO_SIZE(MAX_CHANNEL_PAGE, MAX_CHANNEL_INDEX) namespace ipl { namespace channel { @@ -46,10 +46,10 @@ namespace ipl { }; enum { - SCENE_ID_WAD_CHANNEL = 0x0E, // ? + SCENE_ID_WAD_CHANNEL = 0x0E, // ? SCENE_ID_DISK_CHANNEL = 0x0F, }; - + typedef struct SChannelInfo { inline void clear() { primaryType = 0; @@ -60,20 +60,20 @@ namespace ipl { titleType = 0; titleCode = 0; } - u8 primaryType; // 0x00 - u8 secondaryType; // 0x01 + u8 primaryType; // 0x00 + u8 secondaryType; // 0x01 - u8 reserved[2]; // 0x02 + u8 reserved[2]; // 0x02 - s32 sceneID; // 0x04 + s32 sceneID; // 0x04 union { struct { ESTitleId32 titleType; // 0x00 ESTitleId32 titleCode; // 0x04 }; - //ESTitleId titleId; - }; // 0x08 + // ESTitleId titleId; + }; // 0x08 } SInfo; enum { @@ -91,57 +91,57 @@ namespace ipl { }; } - #define META_CHANNEL_NAME_LENGTH 20 - #define META_DISK_IN_MESSAGE_LENGTH 376 - #define META_CURRENT_VERSION 3 +#define META_CHANNEL_NAME_LENGTH 20 +#define META_DISK_IN_MESSAGE_LENGTH 376 +#define META_CURRENT_VERSION 3 - #define META_PAD 64 +#define META_PAD 64 typedef struct SMetaBlockHeader { - char magic[4]; // 0x00 (Always "IMET"; "IPL Meta"?) - u32 headerSize; // 0x04 - u32 version; // 0x08 + char magic[4]; // 0x00 (Always "IMET"; "IPL Meta"?) + u32 headerSize; // 0x04 + u32 version; // 0x08 - u32 iconSize; // 0x0C - u32 bannerSize; // 0x10 - u32 soundSize; // 0x14 + u32 iconSize; // 0x0C + u32 bannerSize; // 0x10 + u32 soundSize; // 0x14 union { u32 flags; struct { - u32 iconRSOIdx : 4; // 0x00:11110000000000000000000000000000 - u32 bannerRSOIdx : 4; // 0x00:00001111000000000000000000000000 - u32 iconCSIdx : 4; // 0x01:00000000111100000000000000000000 - u32 bannerCSIdx : 4; // 0x01:00000000000011110000000000000000 - u32 unk_15 : 1; // 0x02:00000000000000001000000000000000 - u32 unk_14 : 1; // 0x02:00000000000000000100000000000000 - u32 unk_13 : 1; // 0x02:00000000000000000010000000000000 - u32 unk_12 : 1; // 0x02:00000000000000000001000000000000 - u32 unk_11 : 1; // 0x02:00000000000000000000100000000000 - u32 unk_10 : 1; // 0x02:00000000000000000000010000000000 - u32 unk_09 : 1; // 0x02:00000000000000000000001000000000 - u32 unk_08 : 1; // 0x02:00000000000000000000000100000000 - u32 unk_07 : 1; // 0x03:00000000000000000000000010000000 - u32 unk_06 : 1; // 0x03:00000000000000000000000001000000 - u32 unk_05 : 1; // 0x03:00000000000000000000000000100000 - u32 unk_04 : 1; // 0x03:00000000000000000000000000010000 - u32 unk_03 : 1; // 0x03:00000000000000000000000000001000 - u32 unk_02 : 1; // 0x03:00000000000000000000000000000100 - u32 unk_01 : 1; // 0x03:00000000000000000000000000000010 - u32 unk_00 : 1; // 0x03:00000000000000000000000000000001 + u32 iconRSOIdx : 4; // 0x00:11110000000000000000000000000000 + u32 bannerRSOIdx : 4; // 0x00:00001111000000000000000000000000 + u32 iconCSIdx : 4; // 0x01:00000000111100000000000000000000 + u32 bannerCSIdx : 4; // 0x01:00000000000011110000000000000000 + u32 unk_15 : 1; // 0x02:00000000000000001000000000000000 + u32 unk_14 : 1; // 0x02:00000000000000000100000000000000 + u32 unk_13 : 1; // 0x02:00000000000000000010000000000000 + u32 unk_12 : 1; // 0x02:00000000000000000001000000000000 + u32 unk_11 : 1; // 0x02:00000000000000000000100000000000 + u32 unk_10 : 1; // 0x02:00000000000000000000010000000000 + u32 unk_09 : 1; // 0x02:00000000000000000000001000000000 + u32 unk_08 : 1; // 0x02:00000000000000000000000100000000 + u32 unk_07 : 1; // 0x03:00000000000000000000000010000000 + u32 unk_06 : 1; // 0x03:00000000000000000000000001000000 + u32 unk_05 : 1; // 0x03:00000000000000000000000000100000 + u32 unk_04 : 1; // 0x03:00000000000000000000000000010000 + u32 unk_03 : 1; // 0x03:00000000000000000000000000001000 + u32 unk_02 : 1; // 0x03:00000000000000000000000000000100 + u32 unk_01 : 1; // 0x03:00000000000000000000000000000010 + u32 unk_00 : 1; // 0x03:00000000000000000000000000000001 }; - }; // 0x18 + }; // 0x18 } SMetaBlockHeader; typedef struct SChanMgrMetaHeader { - u8 reserved0[META_PAD]; // 0x00 - SMetaBlockHeader blockHdr; // 0x40 + u8 reserved0[META_PAD]; // 0x00 + SMetaBlockHeader blockHdr; // 0x40 - u16 names[SC_LANG_MAX][NAME_INDEX_MAX][META_CHANNEL_NAME_LENGTH+1]; // 0x5C + u16 names[SC_LANG_MAX][NAME_INDEX_MAX][META_CHANNEL_NAME_LENGTH + 1]; // 0x5C - u8 reserved1[588]; // 0x3A4 + u8 reserved1[588]; // 0x3A4 - NETMD5Sum MD5Sum; // 0x4F0 + NETMD5Sum MD5Sum; // 0x4F0 } SChanMgrMetaHeader; enum { @@ -151,30 +151,30 @@ namespace ipl { }; typedef struct SChannelEntry { - u8* arcData; // 0x00 - SChanMgrMetaHeader* metaHdr; // 0x04 - u16 tmdVersion; // 0x08 - u16 missingTicket; // 0x0A + u8* arcData; // 0x00 + SChanMgrMetaHeader* metaHdr; // 0x04 + u16 tmdVersion; // 0x08 + u16 missingTicket; // 0x0A - u32 headerSize; // 0x0C - int headerOffset; // 0x10 + u32 headerSize; // 0x0C + int headerOffset; // 0x10 - int ticketIdx; // 0x14 + int ticketIdx; // 0x14 - vu8 loadedBnr; // 0x18 - u8 loadedBnrData[DISK_BANNERDATA_MAX]; // 0x19 + vu8 loadedBnr; // 0x18 + u8 loadedBnrData[DISK_BANNERDATA_MAX]; // 0x19 - ARCHandle arc; // 0x1C - SInfo info; // 0x38 - nand::MetaFile* bnrFile; // 0x48 + ARCHandle arc; // 0x1C + SInfo info; // 0x38 + nand::MetaFile* bnrFile; // 0x48 - int state; // 0x4C + int state; // 0x4C - u8 rsoExBuf[32]; // 0x50 + u8 rsoExBuf[32]; // 0x50 } SEntry; typedef struct SChanMgrDiskInMessages { - u16 messages[SC_LANG_MAX][META_DISK_IN_MESSAGE_LENGTH]; // 0x00 + u16 messages[SC_LANG_MAX][META_DISK_IN_MESSAGE_LENGTH]; // 0x00 } SDiskInMessages; enum { @@ -186,175 +186,183 @@ namespace ipl { }; class Manager { - public: - Manager(EGG::Heap* heap); - virtual ~Manager(); + public: + Manager(EGG::Heap* heap); + virtual ~Manager(); - void initManager(); - void update(); + void initManager(); + void update(); - void reserveRefresh(); - void refreshAsync(); + void reserveRefresh(); + void refreshAsync(); - BOOL isInitialized() const; + BOOL isInitialized() const; - BOOL isLoadedPage(int page) const; - BOOL isLoaded(int page, int index) const; - BOOL isLoadedTmp() const; + BOOL isLoadedPage(int page) const; + BOOL isLoaded(int page, int index) const; + BOOL isLoadedTmp() const; - ESTitleId hasChannel(ESTitleId titleId, int* outPage = NULL, int* outIndex = NULL) const; + ESTitleId hasChannel(ESTitleId titleId, int* outPage = NULL, int* outIndex = NULL) const; - BOOL isEnableUrlJump(); - BOOL setupUrlJump(const char* url); - BOOL setupChannelJump(ESTitleId titleId, const char* data); + BOOL isEnableUrlJump(); + BOOL setupUrlJump(const char* url); + BOOL setupChannelJump(ESTitleId titleId, const char* data); - void* getDiskThumbnail(bool unk); - void* getDiskBanner(bool unk); - void* getDiskSound(bool unk); + void* getDiskThumbnail(bool unk); + void* getDiskBanner(bool unk); + void* getDiskSound(bool unk); - nand::MetaFile* loadThumbnailAsync(EGG::Heap* heap, int page, int index); - nand::MetaFile* loadBannerAsync(EGG::Heap* heap, int page, int index); - nand::MetaFile* loadSoundAsync(EGG::Heap* heap, int page, int index); + nand::MetaFile* loadThumbnailAsync(EGG::Heap* heap, int page, int index); + nand::MetaFile* loadBannerAsync(EGG::Heap* heap, int page, int index); + nand::MetaFile* loadSoundAsync(EGG::Heap* heap, int page, int index); - nand::SharedFile* loadThumbnailRsoAsync(EGG::Heap* heap, int page, int index); - nand::SharedFile* loadBannerRsoAsync(EGG::Heap* heap, int page, int index); + nand::SharedFile* loadThumbnailRsoAsync(EGG::Heap* heap, int page, int index); + nand::SharedFile* loadBannerRsoAsync(EGG::Heap* heap, int page, int index); - nand::SharedFile* loadThumbnailCSAsync(EGG::Heap* heap, int page, int index); - nand::SharedFile* loadBannerCSAsync(EGG::Heap* heap, int page, int index); + nand::SharedFile* loadThumbnailCSAsync(EGG::Heap* heap, int page, int index); + nand::SharedFile* loadBannerCSAsync(EGG::Heap* heap, int page, int index); - void loadLockedMsgAsync(int page, int index); - BOOL isLoadedLockedMsg(); + void loadLockedMsgAsync(int page, int index); + BOOL isLoadedLockedMsg(); - u16* getLockedMsg(); + u16* getLockedMsg(); - void moveChannelInfo(int page1, int index1, int page2, int index2); + void moveChannelInfo(int page1, int index1, int page2, int index2); - u16* getLockedMsgFromBuf(const SDiskInMessages* diskInMsgs) const; + u16* getLockedMsgFromBuf(const SDiskInMessages* diskInMsgs) const; - BOOL checkNeedUpdate(int page, int index) const; - BOOL isParentalRestricted(int page, int index) const; - BOOL isInternetChannel(int page, int index) const; + BOOL checkNeedUpdate(int page, int index) const; + BOOL isParentalRestricted(int page, int index) const; + BOOL isInternetChannel(int page, int index) const; - void setDiskChannelName(); - void getDiskChannelLocation(int* page, int* index); + void setDiskChannelName(); + void getDiskChannelLocation(int* page, int* index); - int getUnlockChannelState(int page, int index) const; - int getUnlockTicket(int page, int index, ESTicketView* ticket) const; + int getUnlockChannelState(int page, int index) const; + int getUnlockTicket(int page, int index, ESTicketView* ticket) const; - void loadLockedTitleAsync(int page, int index, ESTicketView& ticket) const; - void clearRsoExBuf(int page, int index); + void loadLockedTitleAsync(int page, int index, ESTicketView& ticket) const; + void clearRsoExBuf(int page, int index); - void loadTmpMetaHeader(ESTitleId titleId); - void loadTmpMetaHeaderAsync(ESTitleId titleId); + void loadTmpMetaHeader(ESTitleId titleId); + void loadTmpMetaHeaderAsync(ESTitleId titleId); - void loadMetaHeaderAsync(int page, int index); + void loadMetaHeaderAsync(int page, int index); - void makeLoadOrderList(int* list) const; + void makeLoadOrderList(int* list) const; - SEntry& getChannel(int page, int index) { return mChannels[page][index]; } + SEntry& getChannel(int page, int index) { return mChannels[page][index]; } - ESTitleId getTitleID(int page, int index) const; - u16* getTitleName(int page, int index, int nameIndex) const; + ESTitleId getTitleID(int page, int index) const; + u16* getTitleName(int page, int index, int nameIndex) const; - /* SEntry */ - bool hasLoadedBnr(int page, int index) const { return mChannels[page][index].loadedBnr; } - int getSceneID(int page, int index) const { return mChannels[page][index].loadedBnr ? mChannels[page][index].info.sceneID : 0; } + /* SEntry */ + bool hasLoadedBnr(int page, int index) const { return mChannels[page][index].loadedBnr; } + int getSceneID(int page, int index) const { return mChannels[page][index].loadedBnr ? mChannels[page][index].info.sceneID : 0; } - /* SMetaBlockHeader */ - u32 getMetaHdr_IconRSOIdx(int page, int index) const { return mChannels[page][index].loadedBnr ? mChannels[page][index].metaHdr->blockHdr.iconRSOIdx : 0; } - u32 getMetaHdr_IconCSIdx(int page, int index) const { return mChannels[page][index].loadedBnr ? mChannels[page][index].metaHdr->blockHdr.iconCSIdx : 0; } - u32 getMetaHdr_BannerRSOIdx(int page, int index) const { return mChannels[page][index].loadedBnr ? mChannels[page][index].metaHdr->blockHdr.bannerRSOIdx : 0; } - u32 getMetaHdr_BannerCSIdx(int page, int index) const { return mChannels[page][index].loadedBnr ? mChannels[page][index].metaHdr->blockHdr.bannerCSIdx : 0; } + /* SMetaBlockHeader */ + u32 getMetaHdr_IconRSOIdx(int page, int index) const { + return mChannels[page][index].loadedBnr ? mChannels[page][index].metaHdr->blockHdr.iconRSOIdx : 0; + } + u32 getMetaHdr_IconCSIdx(int page, int index) const { + return mChannels[page][index].loadedBnr ? mChannels[page][index].metaHdr->blockHdr.iconCSIdx : 0; + } + u32 getMetaHdr_BannerRSOIdx(int page, int index) const { + return mChannels[page][index].loadedBnr ? mChannels[page][index].metaHdr->blockHdr.bannerRSOIdx : 0; + } + u32 getMetaHdr_BannerCSIdx(int page, int index) const { + return mChannels[page][index].loadedBnr ? mChannels[page][index].metaHdr->blockHdr.bannerCSIdx : 0; + } - int updateInitState(); - int updateWaitSCFlush(); - void updateDiskState(); + int updateInitState(); + int updateWaitSCFlush(); + void updateDiskState(); - void* getDiskBannerData(int index, bool unk); + void* getDiskBannerData(int index, bool unk); - int searchMetaHeader(const u8* buffer); + int searchMetaHeader(const u8* buffer); - BOOL checkHeaderBase(const u8* buffer, u32* headerSize = NULL); - BOOL checkHeaderMD5(u8* buffer); - BOOL calcMD5(const u8* sum, const u8* buffer, u32 length) const; + BOOL checkHeaderBase(const u8* buffer, u32* headerSize = NULL); + BOOL checkHeaderMD5(u8* buffer); + BOOL calcMD5(const u8* sum, const u8* buffer, u32 length) const; - bool setDiskBannerInfo(bool useDiskChan); + bool setDiskBannerInfo(bool useDiskChan); - void titleIDtoPageIndex(ESTitleId titleId, int* outPage, int* outIndex) const; + void titleIDtoPageIndex(ESTitleId titleId, int* outPage, int* outIndex) const; - BOOL nand_error_handling(int code); + BOOL nand_error_handling(int code); - SEntry* fn_8133A4E0(ESTitleId titleId); - u32 fn_8133A57C(ESTitleId titleId); - u32 fn_8133A5B8(ESTitleId titleId); - BOOL fn_8133A5F0(ESTitleId titleId); - BOOL fn_8133A634(ESTitleId titleId); - BOOL fn_8133A678(ESTitleId titleId); - BOOL fn_8133A6B8(ESTitleId titleId); - BOOL fn_8133A73C(ESTitleId titleId); - nand::MetaFile* fn_8133A7A4(EGG::Heap* heap, ESTitleId titleId); - nand::MetaFile* fn_8133A85C(EGG::Heap* heap, ESTitleId titleId); - nand::SharedFile* fn_8133A924(EGG::Heap* heap, ESTitleId titleId); - void fn_8133A9F0(); - void fn_8133AA50(ESTitleId titleId); + SEntry* fn_8133A4E0(ESTitleId titleId); + u32 fn_8133A57C(ESTitleId titleId); + u32 fn_8133A5B8(ESTitleId titleId); + BOOL fn_8133A5F0(ESTitleId titleId); + BOOL fn_8133A634(ESTitleId titleId); + BOOL fn_8133A678(ESTitleId titleId); + BOOL fn_8133A6B8(ESTitleId titleId); + BOOL fn_8133A73C(ESTitleId titleId); + nand::MetaFile* fn_8133A7A4(EGG::Heap* heap, ESTitleId titleId); + nand::MetaFile* fn_8133A85C(EGG::Heap* heap, ESTitleId titleId); + nand::SharedFile* fn_8133A924(EGG::Heap* heap, ESTitleId titleId); + void fn_8133A9F0(); + void fn_8133AA50(ESTitleId titleId); - BOOL isReady() { return mState == FINISH; } + BOOL isReady() { return mState == FINISH; } - private: - typedef struct MD5Head { - u8 magic[4]; // 0x00 (`IMD5`; "IPL MD5"?) - u32 length; // 0x04 - u8 reserved[8]; // 0x08 - NETMD5Sum md5; // 0x10 - } MD5Head; + private: + typedef struct MD5Head { + u8 magic[4]; // 0x00 (`IMD5`; "IPL MD5"?) + u32 length; // 0x04 + u8 reserved[8]; // 0x08 + NETMD5Sum md5; // 0x10 + } MD5Head; - enum { - INIT = 0, - SC_FLUSH, - FINISH, - }; + enum { + INIT = 0, + SC_FLUSH, + FINISH, + }; - EGG::Heap* mpHeap; // 0x04 - int mState; // 0x08 + EGG::Heap* mpHeap; // 0x04 + int mState; // 0x08 - SEntry mChannels[MAX_CHANNEL_PAGE][MAX_CHANNEL_INDEX]; // 0x0C - SEntry mTmpChannel; // 0x150C + SEntry mChannels[MAX_CHANNEL_PAGE][MAX_CHANNEL_INDEX]; // 0x0C + SEntry mTmpChannel; // 0x150C - SChanMgrMetaHeader mDiskChanMetaHdr; // 0x157C + SChanMgrMetaHeader mDiskChanMetaHdr; // 0x157C - int mBS2State; // 0x1B7C - bool mbCanRefresh; // 0x1B80 - bool unk_0x1B81; - - u8* mpDiskIconBuf; // 0x1B84 - u8* mpDiskBannerBuf; // 0x1B88 - u8* mpDiskSoundBuf; // 0x1B8C - bool mbSetDiskBannerInfo; // 0x1B90 + int mBS2State; // 0x1B7C + bool mbCanRefresh; // 0x1B80 + bool unk_0x1B81; - u32 mPrevNandResult; // 0x1B94 + u8* mpDiskIconBuf; // 0x1B84 + u8* mpDiskBannerBuf; // 0x1B88 + u8* mpDiskSoundBuf; // 0x1B8C + bool mbSetDiskBannerInfo; // 0x1B90 - int mChJumpPage; // 0x1B98 - int mChJumpIndex; // 0x1B9C - char mChJumpData[NWC24_MAX_CHJP_SIZE]; // 0x1BA0 - bool mbLoadedChJump; // 0x1DA0 + u32 mPrevNandResult; // 0x1B94 - nand::MetaFile* mpLockedMsgFile; // 0x1DA4 + int mChJumpPage; // 0x1B98 + int mChJumpIndex; // 0x1B9C + char mChJumpData[NWC24_MAX_CHJP_SIZE]; // 0x1BA0 + bool mbLoadedChJump; // 0x1DA0 - static u32 mNumFinished; - static int mNumValidChannel; - static bool mDiskChannelFixed; + nand::MetaFile* mpLockedMsgFile; // 0x1DA4 - static int msCurPage; - static int msCurIndex; + static u32 mNumFinished; + static int mNumValidChannel; + static bool mDiskChannelFixed; - static void initManagerTask(void* work); + static int msCurPage; + static int msCurIndex; - static void cbLoadTmpMetaHeader(void* work); + static void initManagerTask(void* work); - static void cbReadTmpMetaHeader(void* work); - static void cbReadMetaHeader(void* work); + static void cbLoadTmpMetaHeader(void* work); + + static void cbReadTmpMetaHeader(void* work); + static void cbReadMetaHeader(void* work); }; - } -} + } // namespace channel +} // namespace ipl -#endif // IPL_CHANNEL_MANAGER_H +#endif // IPL_CHANNEL_MANAGER_H diff --git a/include/system/iplChannelRsoThread.h b/include/system/iplChannelRsoThread.h index 309b312c..c951d2c0 100644 --- a/include/system/iplChannelRsoThread.h +++ b/include/system/iplChannelRsoThread.h @@ -10,31 +10,31 @@ namespace ipl { typedef void (*CreateFunc)(void*); typedef BOOL (*CalcFunc)(int); typedef void (*ThreadCalcFunc)(); - + class RsoThread : public utility::ut_thread { - public: - /** @param heap The work heap used. */ - RsoThread(EGG::Heap* heap); - virtual ~RsoThread(); // 0x08 - - virtual void* Run(); // 0x0C + public: + /** @param heap The work heap used. */ + RsoThread(EGG::Heap* heap); + virtual ~RsoThread(); // 0x08 - void start(); - /** @param func The new loop function. */ - void setCalcFunc(ThreadCalcFunc func); + virtual void* Run(); // 0x0C - OSMessageQueue* getCalcQueue() { return &mCalcQueue; } - - private: - u8* mpStack; // 0x32C - - bool mbStarted; // 0x330 + void start(); + /** @param func The new loop function. */ + void setCalcFunc(ThreadCalcFunc func); - ThreadCalcFunc mpCalcFunc; // 0x334 - OSMessageQueue mCalcQueue; // 0x338 - OSMessage mCalcMsg; // 0x358 + OSMessageQueue* getCalcQueue() { return &mCalcQueue; } + + private: + u8* mpStack; // 0x32C + + bool mbStarted; // 0x330 + + ThreadCalcFunc mpCalcFunc; // 0x334 + OSMessageQueue mCalcQueue; // 0x338 + OSMessage mCalcMsg; // 0x358 }; - } -} + } // namespace channel +} // namespace ipl -#endif // IPL_CHANNEL_RSO_THREAD_H +#endif // IPL_CHANNEL_RSO_THREAD_H diff --git a/include/system/iplChannelScriptManager.h b/include/system/iplChannelScriptManager.h index 88a2cf6f..ec11783f 100644 --- a/include/system/iplChannelScriptManager.h +++ b/include/system/iplChannelScriptManager.h @@ -17,57 +17,57 @@ namespace ipl { namespace channel { class ChannelScriptManager { + public: + class CSData { public: - class CSData { - public: - EGG::ExpHeap* unk_0x00; - layout::Object* unk_0x04; - layout::Animator** unk_0x08; - u64 unk_0x10; - u8 unk_0x18; - u8 unk_0x19; - u8 unk_0x1A; - }; + EGG::ExpHeap* unk_0x00; + layout::Object* unk_0x04; + layout::Animator** unk_0x08; + u64 unk_0x10; + u8 unk_0x18; + u8 unk_0x19; + u8 unk_0x1A; + }; - ChannelScriptManager(); + ChannelScriptManager(); - void create(EGG::ExpHeap* heap); - BOOL init(nand::File* file, RsoThread* thread); + void create(EGG::ExpHeap* heap); + BOOL init(nand::File* file, RsoThread* thread); - void calc(); + void calc(); - void finish(); - void destroy(); + void finish(); + void destroy(); - void setData(const CSData& data); + void setData(const CSData& data); - static void calcCSThread(); + static void calcCSThread(); - CSData& getData() { return mCSData; } - EGG::Heap* getHeap() { return mpHeap; } - - private: - enum { - CHANS_VM_STATE_CREATE = 0, - CHANS_VM_STATE_UNK1 = 1, - CHANS_VM_STATE_UNK2 = 2, - CHANS_VM_STATE_UNK3 = 3, - CHANS_VM_STATE_UNK4 = 4, - }; + CSData& getData() { return mCSData; } + EGG::Heap* getHeap() { return mpHeap; } - u8* mpChansWork; // 0x00 - EGG::ExpHeap* mpHeap; + private: + enum { + CHANS_VM_STATE_CREATE = 0, + CHANS_VM_STATE_UNK1 = 1, + CHANS_VM_STATE_UNK2 = 2, + CHANS_VM_STATE_UNK3 = 3, + CHANS_VM_STATE_UNK4 = 4, + }; - CSData mCSData; // 0x08 - u32 unk_0x28[2]; - OSMessage unk_0x30; - OSMessage unk_0x34; + u8* mpChansWork; // 0x00 + EGG::ExpHeap* mpHeap; - static int smCSState; - static RsoThread* smpThread; - static CHANSVm smCSVm; + CSData mCSData; // 0x08 + u32 unk_0x28[2]; + OSMessage unk_0x30; + OSMessage unk_0x34; + + static int smCSState; + static RsoThread* smpThread; + static CHANSVm smCSVm; }; - } -} + } // namespace channel +} // namespace ipl -#endif // IPL_CHANNEL_SCRIPT_MANAGER_H +#endif // IPL_CHANNEL_SCRIPT_MANAGER_H diff --git a/include/system/iplController.h b/include/system/iplController.h index 9c6e6acd..1bf0f6a8 100644 --- a/include/system/iplController.h +++ b/include/system/iplController.h @@ -4,9 +4,9 @@ #include #include +#include #include #include -#include #include @@ -14,8 +14,9 @@ namespace ipl { namespace controller { - #define __iplWpadCl(btn) ((btn)<<16) +#define __iplWpadCl(btn) ((btn) << 16) + // clang-format off /* Revolution Controller (Wii Remote) */ enum { REVO_BTN_UP = WPAD_BUTTON_UP, @@ -57,80 +58,81 @@ namespace ipl { BTN_NEXT_LEFT = REVO_BTN_MINUS | CL_BTN_MINUS | CL_BTN_R, /* 0x30001000 */ BTN_HOME = REVO_BTN_HOME | CL_BTN_HOME, /* 0x08008000 */ }; - + // clang-format on + class Interface { - public: - Interface(); + public: + Interface(); - virtual ~Interface(); // 0x08 - virtual int getType() const; // 0x0C - virtual int getChannel() const; // 0x10 - virtual int down(u32 button) const; // 0x14 - virtual int downTrg(u32 button) const; // 0x18 - virtual int upTrg(u32 button) const; // 0x1C - virtual int pinch() const; // 0x20 - virtual int pinchTrg(); const // 0x24 - virtual int pinchOffTrg() const; // 0x28 - virtual int decide() const; // 0x2C - virtual int repeat(u32 button) const; // 0x30 - virtual int rumble(int timer = 0) const; // 0x34 - virtual void cancelRumbling(); // 0x38 - virtual int getHoldFlag() const; // 0x3C - virtual int getTrigFlag() const; // 0x40 - virtual int getReleaseFlag() const; // 0x44 - virtual int getClassicHoldFlag() const; // 0x48 - virtual int getClassicTrigFlag() const; // 0x4C - virtual int getClassicReleaseFlag() const; // 0x50 - virtual math::VEC2 getDpdPos() const; // 0x54 - /** - * @brief Gets the IR sensor position of the Wii Remote. - * @return The IR sensor X and Y as `ipl::math::VEC2`. - */ - virtual math::VEC2 getDpdProjectionPos() const; // 0x58 - /** - * @brief Gets the Horizon of the Wii Remote. - * @return The Horizon X and Y as `ipl::math::VEC2`. - */ - virtual math::VEC2 getHorizon() const; // 0x5C - virtual int getDpdDistance() const; // 0x60 - virtual KPADStatus* getKPADStatus() const; // 0x64 - virtual PADStatus* getPADStatus() const; // 0x68 - virtual bool isValidBtn() const; // 0x6C - virtual bool isValidDpd() const; // 0x70 + virtual ~Interface(); // 0x08 + virtual int getType() const; // 0x0C + virtual int getChannel() const; // 0x10 + virtual int down(u32 button) const; // 0x14 + virtual int downTrg(u32 button) const; // 0x18 + virtual int upTrg(u32 button) const; // 0x1C + virtual int pinch() const; // 0x20 + virtual int pinchTrg() const; // 0x24 + virtual int pinchOffTrg() const; // 0x28 + virtual int decide() const; // 0x2C + virtual int repeat(u32 button) const; // 0x30 + virtual int rumble(int timer = 0) const; // 0x34 + virtual void cancelRumbling(); // 0x38 + virtual int getHoldFlag() const; // 0x3C + virtual int getTrigFlag() const; // 0x40 + virtual int getReleaseFlag() const; // 0x44 + virtual int getClassicHoldFlag() const; // 0x48 + virtual int getClassicTrigFlag() const; // 0x4C + virtual int getClassicReleaseFlag() const; // 0x50 + virtual math::VEC2 getDpdPos() const; // 0x54 + /** + * @brief Gets the IR sensor position of the Wii Remote. + * @return The IR sensor X and Y as `ipl::math::VEC2`. + */ + virtual math::VEC2 getDpdProjectionPos() const; // 0x58 + /** + * @brief Gets the Horizon of the Wii Remote. + * @return The Horizon X and Y as `ipl::math::VEC2`. + */ + virtual math::VEC2 getHorizon() const; // 0x5C + virtual int getDpdDistance() const; // 0x60 + virtual KPADStatus* getKPADStatus() const; // 0x64 + virtual PADStatus* getPADStatus() const; // 0x68 + virtual bool isValidBtn() const; // 0x6C + virtual bool isValidDpd() const; // 0x70 - virtual bool setForceInvalid(bool flag); // 0x74 + virtual bool setForceInvalid(bool flag); // 0x74 - virtual f32 getMainStickX() const; // 0x78 - virtual f32 getMainStickY() const; // 0x7C + virtual f32 getMainStickX() const; // 0x78 + virtual f32 getMainStickY() const; // 0x7C - virtual f32 getSubStickX() const; // 0x80 - virtual f32 getSubStickY() const; // 0x84 + virtual f32 getSubStickX() const; // 0x80 + virtual f32 getSubStickY() const; // 0x84 - virtual void read() const; // 0x88 - - private: - u8 dummyData[32]; + virtual void read() const; // 0x88 + + private: + u8 dummyData[32]; }; class Classic : public Interface { - public: - virtual BOOL isValidDpdClassic() const; // 0x8C + public: + virtual BOOL isValidDpdClassic() const; // 0x8C }; class Manager { - public: - Manager(EGG::Heap* heap); + public: + Manager(EGG::Heap* heap); - void read(); + void read(); - Interface* getController(int chan); - Interface* getMasterController(); - Interface* getYoungController(); + Interface* getController(int chan); + Interface* getMasterController(); + Interface* getYoungController(); - private: - u8 dummy[0x2F8]; + private: + u8 dummy[0x2F8]; }; - } -} + } // namespace controller +} // namespace ipl -#endif // IPL_CONTROLLER_H +#endif // IPL_CONTROLLER_H diff --git a/include/system/iplDialogWindow.h b/include/system/iplDialogWindow.h index 6938ca3e..32e58fbd 100644 --- a/include/system/iplDialogWindow.h +++ b/include/system/iplDialogWindow.h @@ -18,14 +18,14 @@ * @param rBtnMsgId Message ID for right button text. * @param lBtnMsgId Message ID for left button text. */ -#define DIALOG_WINDOW_PAGE(msgID, rBtnMsgId, lBtnMsgId) \ +#define DIALOG_WINDOW_PAGE(msgID, rBtnMsgId, lBtnMsgId) \ { msgID, rBtnMsgId, lBtnMsgId, TRUE, NULL, 0, false } /** * New data type for Multi-Dialog page * @param msgID Message ID for body text. * @param btnMsgId Message ID for button text. */ -#define DIALOG_WINDOW_PAGE_ONEBTN(msgID, btnMsgId) \ +#define DIALOG_WINDOW_PAGE_ONEBTN(msgID, btnMsgId) \ { msgID, btnMsgId, 0, FALSE, NULL, 0, false } /** @@ -37,7 +37,7 @@ * @param layoutYOff Custom layout Y offset. * @param isLytAnim If the custom layout is animating. */ -#define DIALOG_WINDOW_PAGE_EX(msgID, rBtnMsgId, lBtnMsgId, layoutObj, layoutYOff, isLytAnim) \ +#define DIALOG_WINDOW_PAGE_EX(msgID, rBtnMsgId, lBtnMsgId, layoutObj, layoutYOff, isLytAnim) \ { msgID, rBtnMsgId, lBtnMsgId, TRUE, layoutObj, layoutYOff, isLytAnim } /** * New data type for Multi-Dialog page @@ -47,7 +47,7 @@ * @param layoutYOff Custom layout Y offset. * @param isLytAnim If the custom layout is animating. */ -#define DIALOG_WINDOW_PAGE_ONEBTN_EX(msgID, btnMsgId, layoutObj, layoutYOff, isLytAnim) \ +#define DIALOG_WINDOW_PAGE_ONEBTN_EX(msgID, btnMsgId, layoutObj, layoutYOff, isLytAnim) \ { msgID, btnMsgId, 0, FALSE, layoutObj, layoutYOff, isLytAnim } /** MAIN CLASS */ @@ -56,423 +56,423 @@ namespace ipl { namespace gui { class PaneManager; } -} +} // namespace ipl namespace gui { class EventHandler; } -namespace ipl { +namespace ipl { class DialogWindow : public ::gui::EventHandler { /* ROUTINES AVAILABLE FOR USER */ - public: - enum { - RESULT_NONE = -1, /* Invalid result. */ + public: + enum { + RESULT_NONE = -1, /* Invalid result. */ - RESULT_WAIT, /* For `callBtn0` */ - RESULT_BUTTON, /* For `callBtn1` */ - RESULT_RIGHT_BUTTON = RESULT_BUTTON, /* For `callBtn2` */ - RESULT_LEFT_BUTTON, /* For `callBtn2` */ - RESULT_TOP_BUTTON, /* For `callBtn3` */ - RESULT_MIDDLE_BUTTON, /* For `callBtn3` */ - RESULT_BOTTOM_BUTTON, /* For `callBtn3` */ - RESULT_TERMINATED, - RESULT_PROGRESS, /* For `callBtnPrg` */ - }; + RESULT_WAIT, /* For `callBtn0` */ + RESULT_BUTTON, /* For `callBtn1` */ + RESULT_RIGHT_BUTTON = RESULT_BUTTON, /* For `callBtn2` */ + RESULT_LEFT_BUTTON, /* For `callBtn2` */ + RESULT_TOP_BUTTON, /* For `callBtn3` */ + RESULT_MIDDLE_BUTTON, /* For `callBtn3` */ + RESULT_BOTTOM_BUTTON, /* For `callBtn3` */ + RESULT_TERMINATED, + RESULT_PROGRESS, /* For `callBtnPrg` */ + }; - /* Multi-Dialog Page */ - typedef struct Page { - u32 msgID; // 0x00 (Message ID) - u32 rBtnMsgId; // 0x04 (Right button ID) - u32 lBtnMsgId; // 0x08 (Left button ID) - bool isTwoBtn; // 0x0C (Has two buttons) + /* Multi-Dialog Page */ + typedef struct Page { + u32 msgID; // 0x00 (Message ID) + u32 rBtnMsgId; // 0x04 (Right button ID) + u32 lBtnMsgId; // 0x08 (Left button ID) + bool isTwoBtn; // 0x0C (Has two buttons) - layout::Object* layoutObj; // 0x10 (Layout object to display) + layout::Object* layoutObj; // 0x10 (Layout object to display) - f32 layoutYOff; // 0x14 (Layout object Y offset) - bool isLytAnim; // 0x18 (If the Layout object can animate) - } Page; + f32 layoutYOff; // 0x14 (Layout object Y offset) + bool isLytAnim; // 0x18 (If the Layout object can animate) + } Page; - /*=============*/ - /* DIALOG MAIN */ - /*=============*/ + /*=============*/ + /* DIALOG MAIN */ + /*=============*/ - /** - * The constructor of the Dialog. - * @param heap The work heap used for construction. - */ - DialogWindow(EGG::Heap* heap); + /** + * The constructor of the Dialog. + * @param heap The work heap used for construction. + */ + DialogWindow(EGG::Heap* heap); - /** Initialize dialog so it is ready for calling. */ - void init(); - /** Update Dialog Loop */ - void calc(); - /** Drawing Dialog Loop */ - void draw(); - /** - * Terminate an active dialog. Recommend to only use for `callBtn0` and `callBtnPrg`. - * @return Whenether the dialog has successfully terminated. - */ - bool terminate(); + /** Initialize dialog so it is ready for calling. */ + void init(); + /** Update Dialog Loop */ + void calc(); + /** Drawing Dialog Loop */ + void draw(); + /** + * Terminate an active dialog. Recommend to only use for `callBtn0` and `callBtnPrg`. + * @return Whenether the dialog has successfully terminated. + */ + bool terminate(); - /** @return The result of the dialog saved after finishing. */ - int getLastResult() { return mLastResult; } - /** @return If the dialog is moving onto the next state. */ - bool doingNextState() { return mbNextState; } + /** @return The result of the dialog saved after finishing. */ + int getLastResult() { return mLastResult; } + /** @return If the dialog is moving onto the next state. */ + bool doingNextState() { return mbNextState; } - /*=================*/ - /* DIALOG BUTTON 0 */ - /*=================*/ + /*=================*/ + /* DIALOG BUTTON 0 */ + /*=================*/ - /** - * Call dialog with no button. - * @param msgId Message ID for body text. - * @param wait The amount of ticks for the dialog should display for. - * @param bIsProg Show waiting icon on the bottom right. - * @return Whenever dialog call was successful. - */ - BOOL callBtn0(u32 msgId, u32 wait, bool bIsProg = false); - /** - * Call dialog with no button. - * @param msg Unicode string for the body text. - * @param wait The amount of ticks for the dialog should display for. - * @param bIsProg Show waiting icon on the bottom right. - * @return Whenever dialog call was successful. - */ - BOOL callBtn0(const wchar_t* msg, u32 wait, bool bIsProg = false); - /** - * Call dialog with no button and no dark background. - * @param msgId Message ID for the body text. - * @param wait The amount of ticks for the dialog should display for. - * @param bIsProg Show waiting icon on the bottom right. - * @return Whenever dialog call was successful. - */ - BOOL callBtn0NoShade(u32 msgId, u32 wait, bool bIsProg = false); + /** + * Call dialog with no button. + * @param msgId Message ID for body text. + * @param wait The amount of ticks for the dialog should display for. + * @param bIsProg Show waiting icon on the bottom right. + * @return Whenever dialog call was successful. + */ + BOOL callBtn0(u32 msgId, u32 wait, bool bIsProg = false); + /** + * Call dialog with no button. + * @param msg Unicode string for the body text. + * @param wait The amount of ticks for the dialog should display for. + * @param bIsProg Show waiting icon on the bottom right. + * @return Whenever dialog call was successful. + */ + BOOL callBtn0(const wchar_t* msg, u32 wait, bool bIsProg = false); + /** + * Call dialog with no button and no dark background. + * @param msgId Message ID for the body text. + * @param wait The amount of ticks for the dialog should display for. + * @param bIsProg Show waiting icon on the bottom right. + * @return Whenever dialog call was successful. + */ + BOOL callBtn0NoShade(u32 msgId, u32 wait, bool bIsProg = false); - /*=================*/ - /* DIALOG BUTTON 1 */ - /*=================*/ + /*=================*/ + /* DIALOG BUTTON 1 */ + /*=================*/ - /** - * Call dialog with one button. - * @param msgId Message ID for the body text. - * @param btnId Message ID for the button text. - * @return Whenever dialog call was successful. - */ - BOOL callBtn1(u32 msgId, u32 btnId); - /** - * Call dialog with one button. - * @param msgId Message ID for the body text. - * @param btnId Message ID for the button text. - * @param size Body Text's font size. - * @return Whenever dialog call was successful. - */ - BOOL callBtn1(u32 msgId, u32 btnId, f32 size); - /** - * Call dialog with one button. - * @param msg Unicode string for the body text. - * @param btnId Message ID for the button text. - * @return Whenever dialog call was successful. - */ - BOOL callBtn1(const wchar_t* msg, u32 btnId); - /** - * Call dialog with one button. - * @param msg Unicode string for the body text. - * @param btnId Message ID for the button text. - * @param size Body Text's font size. - * @return Whenever dialog call was successful. - */ - BOOL callBtn1(const wchar_t* msg, u32 btnId, f32 size); - /** - * Call dialog with one button with small font size. - * @param msgId Message ID for the body text. - * @param btnId Message ID for the button text. - * @return Whenever dialog call was successful. - */ - BOOL callBtn1Sml(u32 msgId, u32 btnId); - /** - * Call dialog with one button and without the dark background. - * @param msgId Message ID for the body text. - * @param btnId Message ID for the button text. - * @return Whenever dialog call was successful. - */ - BOOL callBtn1NoShade(u32 msgId, u32 btnId); + /** + * Call dialog with one button. + * @param msgId Message ID for the body text. + * @param btnId Message ID for the button text. + * @return Whenever dialog call was successful. + */ + BOOL callBtn1(u32 msgId, u32 btnId); + /** + * Call dialog with one button. + * @param msgId Message ID for the body text. + * @param btnId Message ID for the button text. + * @param size Body Text's font size. + * @return Whenever dialog call was successful. + */ + BOOL callBtn1(u32 msgId, u32 btnId, f32 size); + /** + * Call dialog with one button. + * @param msg Unicode string for the body text. + * @param btnId Message ID for the button text. + * @return Whenever dialog call was successful. + */ + BOOL callBtn1(const wchar_t* msg, u32 btnId); + /** + * Call dialog with one button. + * @param msg Unicode string for the body text. + * @param btnId Message ID for the button text. + * @param size Body Text's font size. + * @return Whenever dialog call was successful. + */ + BOOL callBtn1(const wchar_t* msg, u32 btnId, f32 size); + /** + * Call dialog with one button with small font size. + * @param msgId Message ID for the body text. + * @param btnId Message ID for the button text. + * @return Whenever dialog call was successful. + */ + BOOL callBtn1Sml(u32 msgId, u32 btnId); + /** + * Call dialog with one button and without the dark background. + * @param msgId Message ID for the body text. + * @param btnId Message ID for the button text. + * @return Whenever dialog call was successful. + */ + BOOL callBtn1NoShade(u32 msgId, u32 btnId); - /*=================*/ - /* DIALOG BUTTON 2 */ - /*=================*/ + /*=================*/ + /* DIALOG BUTTON 2 */ + /*=================*/ - /** - * Call dialog with two buttons. - * @param msgId Message ID for the body text. - * @param rBtnId Message ID for the right button text. - * @param lBtnId Message ID for the left button text. - * @param bSwapSound Swap "OK" and "Back" sounds. Normally, Right button plays "Back" sound and left button plays "OK" sound. - * @return Whenever dialog call was successful. - */ - BOOL callBtn2(u32 msgId, u32 rBtnId, u32 lBtnId, bool bSwapSound = false); - /** - * Call dialog with two buttons. - * @param msg Unicode string for the body text. - * @param rBtnId Message ID for the right button text. - * @param lBtnId Message ID for the left button text. - * @param bSwapSound Swap the "OK" and "Back" sound effect. - * @return Whenever dialog call was successful. - */ - BOOL callBtn2(const wchar_t* msg, u32 rBtnId, u32 lBtnId, bool bSwapSound = false); - /** - * Call a multi-dialog. - * @param pages An array of Dialog Pages. - * @param pageCount The amount of pages. - * @param fadeDelay The delay of the transition in ticks. - * @return Whenever dialog call was successful. - */ - BOOL callBtn2Multi(Page* pages, int pageCount, int fadeDelay); - /** - * Call dialog with two buttons and without the dark background. - * @param msg Unicode string for the body text. - * @param rBtnId Message ID for the right button text. - * @param lBtnId Message ID for the left button text. - * @param bSwapSound Swap the "OK" and "Back" sound effect. - * @return Whenever dialog call was successful. - */ - BOOL callBtn2NoShade(const wchar_t* msg, u32 rBtnId, u32 lBtnId, bool bSwapSound = false); + /** + * Call dialog with two buttons. + * @param msgId Message ID for the body text. + * @param rBtnId Message ID for the right button text. + * @param lBtnId Message ID for the left button text. + * @param bSwapSound Swap "OK" and "Back" sounds. Normally, Right button plays "Back" sound and left button plays "OK" sound. + * @return Whenever dialog call was successful. + */ + BOOL callBtn2(u32 msgId, u32 rBtnId, u32 lBtnId, bool bSwapSound = false); + /** + * Call dialog with two buttons. + * @param msg Unicode string for the body text. + * @param rBtnId Message ID for the right button text. + * @param lBtnId Message ID for the left button text. + * @param bSwapSound Swap the "OK" and "Back" sound effect. + * @return Whenever dialog call was successful. + */ + BOOL callBtn2(const wchar_t* msg, u32 rBtnId, u32 lBtnId, bool bSwapSound = false); + /** + * Call a multi-dialog. + * @param pages An array of Dialog Pages. + * @param pageCount The amount of pages. + * @param fadeDelay The delay of the transition in ticks. + * @return Whenever dialog call was successful. + */ + BOOL callBtn2Multi(Page* pages, int pageCount, int fadeDelay); + /** + * Call dialog with two buttons and without the dark background. + * @param msg Unicode string for the body text. + * @param rBtnId Message ID for the right button text. + * @param lBtnId Message ID for the left button text. + * @param bSwapSound Swap the "OK" and "Back" sound effect. + * @return Whenever dialog call was successful. + */ + BOOL callBtn2NoShade(const wchar_t* msg, u32 rBtnId, u32 lBtnId, bool bSwapSound = false); - /*=================*/ - /* DIALOG BUTTON 3 */ - /*=================*/ + /*=================*/ + /* DIALOG BUTTON 3 */ + /*=================*/ - /** - * Call dialog with three buttons (vertically sorted) - * @param msgId Message ID for the body text. - * @param tBtnId Message ID for the top button text. - * @param cBtnID Message ID for the middle button text. - * @param bBtnId Message ID for the bottom button text. - * @return Whenever dialog call was successful. - */ - BOOL callBtn3(u32 msgId, u32 tBtnId, u32 cBtnID, u32 bBtnId); - /** - * Call dialog with three buttons (vertically sorted) - * @param msg Unicode string for the body text. - * @param tBtnId Message ID for the top button text. - * @param cBtnID Message ID for the middle button text. - * @param bBtnId Message ID for the bottom button text. - * @return Whenever dialog call was successful. - */ - BOOL callBtn3(const wchar_t* msg, u32 tBtnId, u32 cBtnID, u32 bBtnId); + /** + * Call dialog with three buttons (vertically sorted) + * @param msgId Message ID for the body text. + * @param tBtnId Message ID for the top button text. + * @param cBtnID Message ID for the middle button text. + * @param bBtnId Message ID for the bottom button text. + * @return Whenever dialog call was successful. + */ + BOOL callBtn3(u32 msgId, u32 tBtnId, u32 cBtnID, u32 bBtnId); + /** + * Call dialog with three buttons (vertically sorted) + * @param msg Unicode string for the body text. + * @param tBtnId Message ID for the top button text. + * @param cBtnID Message ID for the middle button text. + * @param bBtnId Message ID for the bottom button text. + * @return Whenever dialog call was successful. + */ + BOOL callBtn3(const wchar_t* msg, u32 tBtnId, u32 cBtnID, u32 bBtnId); - /*==================*/ - /* DIALOG BUTTON S2 */ - /*==================*/ + /*==================*/ + /* DIALOG BUTTON S2 */ + /*==================*/ - /** - * Call dialog with two buttons (alternative) - * @param msgId Message ID for the body text. - * @param rBtnId Message ID for the right button text. - * @param lBtnId Message ID for the left button text. - * @param bSwapSound Swap the "OK" and "Back" sound effect. - * @return Whenever dialog call was successful. - */ - BOOL callSBtn2(u32 msgId, u32 rBtnId, u32 lBtnId, bool bSwapSound = false); - /** - * Call dialog with two buttons (alternative) - * @param msgId Message ID for the body text. - * @param rBtnId Message ID for the right button text. - * @param lBtnId Message ID for the left button text. - * @param bSwapSound Swap the "OK" and "Back" sound effect. - * @return Whenever dialog call was successful. - */ - BOOL callSBtn2(const wchar_t* msg, u32 rBtnId, u32 lBtnId, bool bSwapSound = false); - /** - * Call dialog with two buttons (alternative) without header - * @param rBtnId Message ID for the right button text. - * @param lBtnId Message ID for the left button text. - * @param bSwapSound Swap the "OK" and "Back" sound effect. - * @return Whenever dialog call was successful. - */ - BOOL callS2Btn2(u32 rBtnId, u32 lBtnId, bool bSwapSound = false); + /** + * Call dialog with two buttons (alternative) + * @param msgId Message ID for the body text. + * @param rBtnId Message ID for the right button text. + * @param lBtnId Message ID for the left button text. + * @param bSwapSound Swap the "OK" and "Back" sound effect. + * @return Whenever dialog call was successful. + */ + BOOL callSBtn2(u32 msgId, u32 rBtnId, u32 lBtnId, bool bSwapSound = false); + /** + * Call dialog with two buttons (alternative) + * @param msgId Message ID for the body text. + * @param rBtnId Message ID for the right button text. + * @param lBtnId Message ID for the left button text. + * @param bSwapSound Swap the "OK" and "Back" sound effect. + * @return Whenever dialog call was successful. + */ + BOOL callSBtn2(const wchar_t* msg, u32 rBtnId, u32 lBtnId, bool bSwapSound = false); + /** + * Call dialog with two buttons (alternative) without header + * @param rBtnId Message ID for the right button text. + * @param lBtnId Message ID for the left button text. + * @param bSwapSound Swap the "OK" and "Back" sound effect. + * @return Whenever dialog call was successful. + */ + BOOL callS2Btn2(u32 rBtnId, u32 lBtnId, bool bSwapSound = false); - /*========================*/ - /* DIALOG BUTTON PROGRESS */ - /*========================*/ + /*========================*/ + /* DIALOG BUTTON PROGRESS */ + /*========================*/ - /** - * Call dialog with a progress bar. - * @param msgId Message ID for the body text. - * @return Whenever dialog call was successful. - */ - BOOL callBtnPrg(u32 msgId); - /** - * Call dialog with a progress bar. - * @param msgId Message ID for the body text. - * @return Whenever dialog call was successful. - */ - BOOL callBtnPrg(const wchar_t* msg); - /** - * Call dialog with a progress bar and no dark background. - * @param msgId Message ID for the body text. - * @return Whenever dialog call was successful. - */ - BOOL callBtnPrgNoShade(const wchar_t* msg); + /** + * Call dialog with a progress bar. + * @param msgId Message ID for the body text. + * @return Whenever dialog call was successful. + */ + BOOL callBtnPrg(u32 msgId); + /** + * Call dialog with a progress bar. + * @param msgId Message ID for the body text. + * @return Whenever dialog call was successful. + */ + BOOL callBtnPrg(const wchar_t* msg); + /** + * Call dialog with a progress bar and no dark background. + * @param msgId Message ID for the body text. + * @return Whenever dialog call was successful. + */ + BOOL callBtnPrgNoShade(const wchar_t* msg); - /** - * Set the length of the progress bar for progress bar. - * @note The dialog automatically terminates when reaching `100`. - * @param len The new length. - */ - void setProgBarLength(int len) { mProgBarLen = len; } - /** @return The current length of the progress bar */ - int getProgBarLength() { return mProgBarLen; } + /** + * Set the length of the progress bar for progress bar. + * @note The dialog automatically terminates when reaching `100`. + * @param len The new length. + */ + void setProgBarLength(int len) { mProgBarLen = len; } + /** @return The current length of the progress bar */ + int getProgBarLength() { return mProgBarLen; } + + /** + * Dialog component handler (Automatically executed by the GUI manager) + * @param compId Component ID from the dialog. + * @param event The event ID for the dialog. + * @param data Extra data that an event might require. + */ + virtual void onEvent(u32 compId, u32 event, void* data); - /** - * Dialog component handler (Automatically executed by the GUI manager) - * @param compId Component ID from the dialog. - * @param event The event ID for the dialog. - * @param data Extra data that an event might require. - */ - virtual void onEvent(u32 compId, u32 event, void* data); - /* MEMBERS AND ROUTINES FOR WORK */ - private: - typedef enum State { - DIALOG_STATE_READY = 0, - DIALOG_STATE_FADE_IN, - DIALOG_STATE_NORMAL, - DIALOG_STATE_SELECT, - DIALOG_STATE_FADE_OUT, - DIALOG_STATE_PAGE_FADE, - DIALOG_STATE_PAGE_FADE_PREPARE, - } State; - - enum { - DIALOG_TYPE_NONE = -1, - DIALOG_TYPE_BTN0, - DIALOG_TYPE_BTN1, - DIALOG_TYPE_BTN2, - DIALOG_TYPE_BTN3, - DIALOG_TYPE_BTNS2, - DIALOG_TYPE_MAX, - }; + private: + typedef enum State { + DIALOG_STATE_READY = 0, + DIALOG_STATE_FADE_IN, + DIALOG_STATE_NORMAL, + DIALOG_STATE_SELECT, + DIALOG_STATE_FADE_OUT, + DIALOG_STATE_PAGE_FADE, + DIALOG_STATE_PAGE_FADE_PREPARE, + } State; - enum { - DIALOG_BTN_TYPE_BTN1 = 0, - DIALOG_BTN_TYPE_BTN2, - DIALOG_BTN_TYPE_BTN3, - DIALOG_BTN_TYPE_MAX, - }; + enum { + DIALOG_TYPE_NONE = -1, + DIALOG_TYPE_BTN0, + DIALOG_TYPE_BTN1, + DIALOG_TYPE_BTN2, + DIALOG_TYPE_BTN3, + DIALOG_TYPE_BTNS2, + DIALOG_TYPE_MAX, + }; - enum { - DIALOG_PAGE_FADE_IN = 0, - DIALOG_PAGE_FADE_OUT, - DIALOG_PAGE_NORMAL, - }; + enum { + DIALOG_BTN_TYPE_BTN1 = 0, + DIALOG_BTN_TYPE_BTN2, + DIALOG_BTN_TYPE_BTN3, + DIALOG_BTN_TYPE_MAX, + }; - enum { - ANIM_DIALOG_IN = 0, - ANIM_DIALOG_OUT, - ANIM_FOCUS_BTN_B_ON, - ANIM_FOCUS_BTN_B_OFF, - ANIM_SELECT_BTN_B, - ANIM_FOCUS_BTN_A_ON, - ANIM_FOCUS_BTN_A_OFF, - ANIM_SELECT_BTN_A, - }; + enum { + DIALOG_PAGE_FADE_IN = 0, + DIALOG_PAGE_FADE_OUT, + DIALOG_PAGE_NORMAL, + }; - enum { - ANIM_BTN0_DIALOG_IN = 0, - ANIM_BTN0_DIALOG_OUT, - ANIM_BTN0_WAIT, - ANIM_BTN0_PRORESS, - }; + enum { + ANIM_DIALOG_IN = 0, + ANIM_DIALOG_OUT, + ANIM_FOCUS_BTN_B_ON, + ANIM_FOCUS_BTN_B_OFF, + ANIM_SELECT_BTN_B, + ANIM_FOCUS_BTN_A_ON, + ANIM_FOCUS_BTN_A_OFF, + ANIM_SELECT_BTN_A, + }; - enum { - ANIM_BTN3_DIALOG_IN = 0, - ANIM_BTN3_DIALOG_OUT, - ANIM_BTN3_FOCUS_BTN_B_ON, - ANIM_BTN3_FOCUS_BTN_B_OFF, - ANIM_BTN3_SELECT_BTN_B, - ANIM_BTN3_FOCUS_BTN_A_ON, - ANIM_BTN3_FOCUS_BTN_A_OFF, - ANIM_BTN3_SELECT_BTN_A, - ANIM_BTN3_FOCUS_BTN_C_ON, - ANIM_BTN3_FOCUS_BTN_C_OFF, - ANIM_BTN3_SELECT_BTN_C, - }; + enum { + ANIM_BTN0_DIALOG_IN = 0, + ANIM_BTN0_DIALOG_OUT, + ANIM_BTN0_WAIT, + ANIM_BTN0_PRORESS, + }; - struct Interface { - layout::Object* gLayout; // 0x00 - gui::PaneManager* guiMgr; // 0x04 - }; + enum { + ANIM_BTN3_DIALOG_IN = 0, + ANIM_BTN3_DIALOG_OUT, + ANIM_BTN3_FOCUS_BTN_B_ON, + ANIM_BTN3_FOCUS_BTN_B_OFF, + ANIM_BTN3_SELECT_BTN_B, + ANIM_BTN3_FOCUS_BTN_A_ON, + ANIM_BTN3_FOCUS_BTN_A_OFF, + ANIM_BTN3_SELECT_BTN_A, + ANIM_BTN3_FOCUS_BTN_C_ON, + ANIM_BTN3_FOCUS_BTN_C_OFF, + ANIM_BTN3_SELECT_BTN_C, + }; - BOOL call(int type); + struct Interface { + layout::Object* gLayout; // 0x00 + gui::PaneManager* guiMgr; // 0x04 + }; - void set_alpha(nw4r::lyt::Pane* pane, u8 alpha); + BOOL call(int type); - void stt_fadein(); - void stt_normal(); - void stt_select(); - void stt_fadeout(); - void stt_pagefade(); - void stt_prepare_pagefade(); + void set_alpha(nw4r::lyt::Pane* pane, u8 alpha); - void set_text(const char* findName, const wchar_t* text); - void set_title(const wchar_t* text); - void set_message(u32 id); + void stt_fadein(); + void stt_normal(); + void stt_select(); + void stt_fadeout(); + void stt_pagefade(); + void stt_prepare_pagefade(); - void set_rbtn_text(u32 id); - void set_lbtn_text(u32 id); - void set_tbtn_text(u32 id); - void set_cbtn_text(u32 id); - void set_bbtn_text(u32 id); + void set_text(const char* findName, const wchar_t* text); + void set_title(const wchar_t* text); + void set_message(u32 id); - void set_dialog_size(const nw4r::lyt::Size& size); + void set_rbtn_text(u32 id); + void set_lbtn_text(u32 id); + void set_tbtn_text(u32 id); + void set_cbtn_text(u32 id); + void set_bbtn_text(u32 id); - int get_button_no(const char* btnName); + void set_dialog_size(const nw4r::lyt::Size& size); - void start_point_event(const char* paneName, controller::Interface* controller); - void start_left_event(const char* paneName); - void start_trig_event(const char* paneName); - - State mState; // 0x0C - ipl::nand::LayoutFile* mpLayoutFile; // 0x10 + int get_button_no(const char* btnName); - BOOL mbBtnHovered[DIALOG_BTN_TYPE_MAX]; // 0x14 + void start_point_event(const char* paneName, controller::Interface* controller); + void start_left_event(const char* paneName); + void start_trig_event(const char* paneName); - int mResult; // 0x20 - int mLastResult; // 0x24 - - int mDialogType; // 0x28 + State mState; // 0x0C + ipl::nand::LayoutFile* mpLayoutFile; // 0x10 - int mWaitTick; // 0x2C - u32 mWaitTimer; // 0x30 + BOOL mbBtnHovered[DIALOG_BTN_TYPE_MAX]; // 0x14 - bool mbNextState; // 0x34 - bool mbTerminated; // 0x35 - bool mbSwapSound; // 0x36 + int mResult; // 0x20 + int mLastResult; // 0x24 - bool mbIsProg; // 0x37 - bool mbDoProgBar; // 0x38 - int mProgBarLen; // 0x3C - int mProgBarFrame; // 0x40 + int mDialogType; // 0x28 - int mPageAlpha; // 0x44 - int mPageFadeSpeed; // 0x48 - int mPageState; // 0x4C + int mWaitTick; // 0x2C + u32 mWaitTimer; // 0x30 - Interface mDialog[DIALOG_TYPE_MAX]; // 0x50 - Interface* mpCurDialog; // 0x78 + bool mbNextState; // 0x34 + bool mbTerminated; // 0x35 + bool mbSwapSound; // 0x36 - layout::Object* mpCustomLayout; // 0x7C - nw4r::math::VEC2 mCustomLayoutPos; // 0x80 - Page* mpPages; // 0x88 - int mPageCount; // 0x8C - int mCurPage; // 0x90 - int mPrevPage; // 0x94 + bool mbIsProg; // 0x37 + bool mbDoProgBar; // 0x38 + int mProgBarLen; // 0x3C + int mProgBarFrame; // 0x40 - bool mbNoShade; // 0x98 - bool mbHideBtnA; // 0x99 + int mPageAlpha; // 0x44 + int mPageFadeSpeed; // 0x48 + int mPageState; // 0x4C - static const char* mscBtnName[DIALOG_BTN_TYPE_MAX]; + Interface mDialog[DIALOG_TYPE_MAX]; // 0x50 + Interface* mpCurDialog; // 0x78 + + layout::Object* mpCustomLayout; // 0x7C + nw4r::math::VEC2 mCustomLayoutPos; // 0x80 + Page* mpPages; // 0x88 + int mPageCount; // 0x8C + int mCurPage; // 0x90 + int mPrevPage; // 0x94 + + bool mbNoShade; // 0x98 + bool mbHideBtnA; // 0x99 + + static const char* mscBtnName[DIALOG_BTN_TYPE_MAX]; }; -} +} // namespace ipl -#endif // IPL_DIALOG_WINDOW_H +#endif // IPL_DIALOG_WINDOW_H diff --git a/include/system/iplErrorHandler.h b/include/system/iplErrorHandler.h index 93839908..e8f48be1 100644 --- a/include/system/iplErrorHandler.h +++ b/include/system/iplErrorHandler.h @@ -12,66 +12,63 @@ /*** Message IDs for the Error Message ***/ /* An error has occurred. */ -#define MESG_ERR_DVD 0 +#define MESG_ERR_DVD 0 /* The Wii System Memory is damaged. */ -#define MESG_ERR_NAND 1 +#define MESG_ERR_NAND 1 /* The system files are corrupted. */ -#define MESG_ERR_FILE 2 +#define MESG_ERR_FILE 2 /* This channel can't be used. */ -#define MESG_ERR_CHANNEL 3 +#define MESG_ERR_CHANNEL 3 /* Error:003 unauthorized device has been detected. */ -#define MESG_ERR_KEY2 4 +#define MESG_ERR_KEY2 4 namespace ipl { class ErrorHandler { - public: - enum Type { - NONE = 0, - DEFAULT - }; + public: + enum Type { NONE = 0, DEFAULT }; - /** @param heap The work heap. */ - ErrorHandler(EGG::Heap* heap); + /** @param heap The work heap. */ + ErrorHandler(EGG::Heap* heap); - void draw(); - void check(); - void calc(); + void draw(); + void check(); + void calc(); - BOOL isReady() { return mbReady == TRUE; } + BOOL isReady() { return mbReady == TRUE; } - /** - * @param type The error type. - * @param msgId The message ID that will be displayed. - * @param arg1 Unknown. Left as `NULL`. - * @param arg2 Unknown. Left as `0`. - * @param arg3 Unknown. Left as `-1`. - */ - void set(Type type, u32 msgId, const char* arg1 = NULL, int arg2 = 0, int arg3 = -1); + /** + * @param type The error type. + * @param msgId The message ID that will be displayed. + * @param arg1 Unknown. Left as `NULL`. + * @param arg2 Unknown. Left as `0`. + * @param arg3 Unknown. Left as `-1`. + */ + void set(Type type, u32 msgId, const char* arg1 = NULL, int arg2 = 0, int arg3 = -1); - /** - * @param type The error type. - * @param result The result it thrown. - * @param file The source file name. - * @param line The source file line. - */ - void log(const char* type, int result, const char* file, int line); + /** + * @param type The error type. + * @param result The result it thrown. + * @param file The source file name. + * @param line The source file line. + */ + void log(const char* type, int result, const char* file, int line); - private: - BOOL mbReady; // 0x00 + private: + BOOL mbReady; // 0x00 - Type mType; // 0x04 + Type mType; // 0x04 - int mMessageID; // 0x08 + int mMessageID; // 0x08 - int unk_0x0C; - int unk_0x10; - char unk_0x14[4]; + int unk_0x0C; + int unk_0x10; + char unk_0x14[4]; - u8* mpArcData; // 0x18 - u32 mArcSize; // 0x1C + u8* mpArcData; // 0x18 + u32 mArcSize; // 0x1C - layout::Object* mpLayout; // 0x20 + layout::Object* mpLayout; // 0x20 }; -} +} // namespace ipl -#endif // IPL_ERROR_HANDLER_H +#endif // IPL_ERROR_HANDLER_H diff --git a/include/system/iplException.h b/include/system/iplException.h index 2491f56f..a4cae0a3 100644 --- a/include/system/iplException.h +++ b/include/system/iplException.h @@ -9,29 +9,29 @@ namespace ipl { class Exception { - public: - /** - * @param heap The memory heap used. - * @param rMode Render mode used. - */ - Exception(EGG::Heap* heap, const GXRenderModeObj& rMode); + public: + /** + * @param heap The memory heap used. + * @param rMode Render mode used. + */ + Exception(EGG::Heap* heap, const GXRenderModeObj& rMode); - /* @note pretty please, unless you wanna crash the ipl, dont run this . */ - void exception_callback(nw4r::db::ConsoleHandle console); + /* @note pretty please, unless you wanna crash the ipl, dont run this . */ + void exception_callback(nw4r::db::ConsoleHandle console); - private: - void setConsole(const GXRenderModeObj& rMode); - void key_input(); - void wait(u32 ticks); + private: + void setConsole(const GXRenderModeObj& rMode); + void key_input(); + void wait(u32 ticks); - nw4r::db::ConsoleHandle mConsole; // 0x00 - - undefined4 unk_0x04; - - u8* mpBuffer; // 0x08 - - int unk_0x0C; + nw4r::db::ConsoleHandle mConsole; // 0x00 + + undefined4 unk_0x04; + + u8* mpBuffer; // 0x08 + + int unk_0x0C; }; -} +} // namespace ipl -#endif // IPL_MESSAGE_H +#endif // IPL_EXCEPTION_HANDLER_H diff --git a/include/system/iplFramework.h b/include/system/iplFramework.h index 76bae009..5906f7cd 100644 --- a/include/system/iplFramework.h +++ b/include/system/iplFramework.h @@ -11,36 +11,36 @@ namespace ipl { class Framework { - public: - Framework(EGG::Heap* heap); + public: + Framework(EGG::Heap* heap); - void beginFrame(); - void beginRender(); - void endRender(); - void endFrame(); + void beginFrame(); + void beginRender(); + void endRender(); + void endFrame(); - void resetRenderMode(); + void resetRenderMode(); - GXRenderModeObj* getRenderMode() const { return mpRMode; } - BOOL getAspectRatio() const { return mAspectRatio; } - f32 getDelta() const { return mDelta; } + GXRenderModeObj* getRenderMode() const { return mpRMode; } + BOOL getAspectRatio() const { return mAspectRatio; } + f32 getDelta() const { return mDelta; } - private: - void flip_xfb(); - - void init_vi(); - void init_xfb(EGG::Heap* heap); - void reset_render_mode(); + private: + void flip_xfb(); - GXRenderModeObj* mpRMode; // 0x00 + void init_vi(); + void init_xfb(EGG::Heap* heap); + void reset_render_mode(); - int mCurXfb; // 0x04 - u8* mpXfb[2]; // 0x08 + GXRenderModeObj* mpRMode; // 0x00 - BOOL mAspectRatio; // 0x10 + int mCurXfb; // 0x04 + u8* mpXfb[2]; // 0x08 - f32 mDelta; // 0x14 + BOOL mAspectRatio; // 0x10 + + f32 mDelta; // 0x14 }; -} +} // namespace ipl -#endif // IPL_FRAME_WORK_H +#endif // IPL_FRAME_WORK_H diff --git a/include/system/iplHomeButton.h b/include/system/iplHomeButton.h index 42259d83..eb61c802 100644 --- a/include/system/iplHomeButton.h +++ b/include/system/iplHomeButton.h @@ -11,59 +11,59 @@ namespace ipl { class HomeButtonMenu { - public: - HomeButtonMenu(EGG::Heap* heap); + public: + HomeButtonMenu(EGG::Heap* heap); - void calc(); - void draw(); + void calc(); + void draw(); - void enable(); - BOOL disable(); + void enable(); + BOOL disable(); - void enable_byTVRC(); - BOOL disable_byTVRC(); + void enable_byTVRC(); + BOOL disable_byTVRC(); - void enableLib() { mbHBMLibEnabled = true; } - void disableLib() { mbHBMLibEnabled = false; } + void enableLib() { mbHBMLibEnabled = true; } + void disableLib() { mbHBMLibEnabled = false; } - bool isEnable() { return mbHbmEnabled && mEnableByTVRCFlag ? true : false; } + bool isEnable() { return mbHbmEnabled && mEnableByTVRCFlag ? true : false; } - private: - void DrawBanIcon(u8 alpha); - void callHBM(); - void checkStart(); + private: + void DrawBanIcon(u8 alpha); + void callHBM(); + void checkStart(); - HBMSelectBtnNum getSelectBtnNum(); + HBMSelectBtnNum getSelectBtnNum(); - bool mbHbmEnabled; // 0x00 - bool mEnableFlag; // 0x01 - bool mEnableByTVRCFlag; // 0x02 - bool mDisableByTVRCFlag; // 0x03 - bool mDisableFlag; // 0x04 - bool mbHBMLibEnabled; // 0x05 + bool mbHbmEnabled; // 0x00 + bool mEnableFlag; // 0x01 + bool mEnableByTVRCFlag; // 0x02 + bool mDisableByTVRCFlag; // 0x03 + bool mDisableFlag; // 0x04 + bool mbHBMLibEnabled; // 0x05 - u8 unused_0x06[14]; + u8 unused_0x06[14]; - nand::File* mpMessageFile; // 0x14 - nand::File* mpConfigFile; // 0x18 - nand::File* mpSpeakerSoundFile; // 0x1C - nand::File* mpBanIconFile; // 0x20 + nand::File* mpMessageFile; // 0x14 + nand::File* mpConfigFile; // 0x18 + nand::File* mpSpeakerSoundFile; // 0x1C + nand::File* mpBanIconFile; // 0x20 - HBMControllerData mConData; // 0x24 - HBMDataInfo* mpHbmInfo; // 0x64 + HBMControllerData mConData; // 0x24 + HBMDataInfo* mpHbmInfo; // 0x64 - bool mbBanIconEnabled; // 0x68 + bool mbBanIconEnabled; // 0x68 - enum { - BAN_ICON_STATE_FADEIN = 0, - BAN_ICON_STATE_WAIT, - BAN_ICON_STATE_FADEOUT, - }; + enum { + BAN_ICON_STATE_FADEIN = 0, + BAN_ICON_STATE_WAIT, + BAN_ICON_STATE_FADEOUT, + }; - OSTick mBanIconTime; // 0x6C - s8 mBanIconState; // 0x70 - u8 mBanIconAlpha; // 0x71 + OSTick mBanIconTime; // 0x6C + s8 mBanIconState; // 0x70 + u8 mBanIconAlpha; // 0x71 }; -} +} // namespace ipl -#endif // IPL_HOME_BUTTON_H +#endif // IPL_HOME_BUTTON_H diff --git a/include/system/iplKeyboard.h b/include/system/iplKeyboard.h index 0e39f835..aa8c6df7 100644 --- a/include/system/iplKeyboard.h +++ b/include/system/iplKeyboard.h @@ -11,121 +11,116 @@ namespace ipl { namespace keyboard { class Manager; class EventObserver : public textinput::EventObserver { - public: - virtual void onCommand(textinput::CommandReceiver::INPUT_COMMAND command, void* data); - virtual void onSE(textinput::sound::SE seId); - virtual void onOK(); - virtual void onCancel(); - virtual void setManager(Manager* manager) { mpKeyboardMgr = manager; } + public: + virtual void onCommand(textinput::CommandReceiver::INPUT_COMMAND command, void* data); + virtual void onSE(textinput::sound::SE seId); + virtual void onOK(); + virtual void onCancel(); + virtual void setManager(Manager* manager) { mpKeyboardMgr = manager; } - private: - Manager* mpKeyboardMgr; // 0x04 + private: + Manager* mpKeyboardMgr; // 0x04 }; class Manager { - public: - typedef enum KeyboardState { - STATE_HIDDEN = 0, - STATE_APPEARING, - STATE_VISIBLE, - STATE_DISAPPEARING, - STATE_HIDDEN_AFTER_DISAPPEAR - } KeyboardState; + public: + typedef enum KeyboardState { + STATE_HIDDEN = 0, + STATE_APPEARING, + STATE_VISIBLE, + STATE_DISAPPEARING, + STATE_HIDDEN_AFTER_DISAPPEAR + } KeyboardState; - typedef enum KeyboardType { - DEFAULT = 0, - LETTER, - PHOTO_LETTER, - NUMERIC, - NORMAL_WITHOUT_LINEFEED, - NORMAL_WITHOUT_LINEFEED_WITH_SIGN, - NORMAL_BIGTEXT_WITHOUT_LINEFEED, - ONLY_QWERTY_WITHOUT_LINEFEED_AND_SIGN, - ONLY_QWERTY_BIGTEXT_WITHOUT_LINEFEED_AND_SIGN, - NUMERIC_WITH_DOT, - NUMERIC_BIGTEXT_WITH_DOT, - NORMAL_BIGTEXT_WITHOUT_LINEFEED_WITH_SIGN, - NUMERIC_WITH_SEPERATOR, - PREDICT_WITHOUT_LINEFEED, - } KeyboardType; + typedef enum KeyboardType { + DEFAULT = 0, + LETTER, + PHOTO_LETTER, + NUMERIC, + NORMAL_WITHOUT_LINEFEED, + NORMAL_WITHOUT_LINEFEED_WITH_SIGN, + NORMAL_BIGTEXT_WITHOUT_LINEFEED, + ONLY_QWERTY_WITHOUT_LINEFEED_AND_SIGN, + ONLY_QWERTY_BIGTEXT_WITHOUT_LINEFEED_AND_SIGN, + NUMERIC_WITH_DOT, + NUMERIC_BIGTEXT_WITH_DOT, + NORMAL_BIGTEXT_WITHOUT_LINEFEED_WITH_SIGN, + NUMERIC_WITH_SEPERATOR, + PREDICT_WITHOUT_LINEFEED, + } KeyboardType; - typedef struct KeyboardSetting { - KeyboardType type; // 0x00 - const wchar_t* wcString; // 0x04 - u32 stringLimit; // 0x08 - u32 rowLimit; // 0x0C - } KeyboardSetting; + typedef struct KeyboardSetting { + KeyboardType type; // 0x00 + const wchar_t* wcString; // 0x04 + u32 stringLimit; // 0x08 + u32 rowLimit; // 0x0C + } KeyboardSetting; - typedef struct State { - textinput::MemoManager::StateType type; // 0x00 - KeyboardState iplType; // 0x04 - bool pressOK; // 0x08 - u8 unused_0x09; - wchar_t* wcString; // 0x0C - } State; + typedef struct State { + textinput::MemoManager::StateType type; // 0x00 + KeyboardState iplType; // 0x04 + bool pressOK; // 0x08 + u8 unused_0x09; + wchar_t* wcString; // 0x0C + } State; - Manager() : - mpManager(NULL), - mEvent(), - mCurrentConChan(0), - mbActivated(false), - mpSaveFile(NULL) {} + Manager() : mpManager(NULL), mEvent(), mCurrentConChan(0), mbActivated(false), mpSaveFile(NULL) {} - virtual void create(nand::File* file, EGG::Heap* heap); // 0x08 + virtual void create(nand::File* file, EGG::Heap* heap); // 0x08 - virtual void init(); // 0x0C - virtual void calc(); // 0x10 + virtual void init(); // 0x0C + virtual void calc(); // 0x10 - virtual void draw(); // 0x14 - virtual void memoDraw(); // 0x18 + virtual void draw(); // 0x14 + virtual void memoDraw(); // 0x18 - virtual void changeAspectRatio(); // 0x1C - virtual void setKeyboardType(int chan, KeyboardType type); // 0x20 + virtual void changeAspectRatio(); // 0x1C + virtual void setKeyboardType(int chan, KeyboardType type); // 0x20 - virtual void start(int chan, const KeyboardSetting& setting); // 0x24 + virtual void start(int chan, const KeyboardSetting& setting); // 0x24 - virtual void ok(); // 0x28 - virtual void cancel(); // 0x2C + virtual void ok(); // 0x28 + virtual void cancel(); // 0x2C - virtual void doRumble(); // 0x30 - virtual State* getState(); // 0x34 + virtual void doRumble(); // 0x30 + virtual State* getState(); // 0x34 - virtual void setWCString(const wchar_t* wcString); // 0x38 - virtual void setLanguage(u32 language); // 0x3C + virtual void setWCString(const wchar_t* wcString); // 0x38 + virtual void setLanguage(u32 language); // 0x3C - virtual void touchFormInDisp(int); // 0x40 + virtual void touchFormInDisp(int); // 0x40 - virtual void setConfigure(KeyboardType type); // 0x44 + virtual void setConfigure(KeyboardType type); // 0x44 - virtual void doSave(); // 0x48 + virtual void doSave(); // 0x48 - void sendRelease(); + void sendRelease(); - void* getZiSystemDic(); - void* getZiOemDic(); + void* getZiSystemDic(); + void* getZiOemDic(); - void activate() { mbActivated = true; } - void deactivate() { mbActivated = false; } + void activate() { mbActivated = true; } + void deactivate() { mbActivated = false; } - textinput::Manager* baseMgr() { return (textinput::Manager*)mpManager; } - textinput::MemoManager* memoMgr() { return mpManager; } - textinput::MemoInputForm* memoFrm() { return (textinput::MemoInputForm*)mpManager->getInputForm(); } + textinput::Manager* baseMgr() { return (textinput::Manager*)mpManager; } + textinput::MemoManager* memoMgr() { return mpManager; } + textinput::MemoInputForm* memoFrm() { return (textinput::MemoInputForm*)mpManager->getInputForm(); } - void startMgr() { baseMgr()->start(); } - void endMgr() { baseMgr()->end(); } + void startMgr() { baseMgr()->start(); } + void endMgr() { baseMgr()->end(); } - private: - textinput::MemoManager* mpManager; // 0x04 - EventObserver mEvent; // 0x08 - State mState; // 0x10 - u32 mCurrentConChan; // 0x20 - Vec2 projCenter; // 0x24 - bool mbActivated; // 0x2C - u8 unk_0x2D; - textinput::extend::savedata::MemoSetting mSaveData; // 0x2E - nand::File* mpSaveFile; // 0x38 + private: + textinput::MemoManager* mpManager; // 0x04 + EventObserver mEvent; // 0x08 + State mState; // 0x10 + u32 mCurrentConChan; // 0x20 + Vec2 projCenter; // 0x24 + bool mbActivated; // 0x2C + u8 unk_0x2D; + textinput::extend::savedata::MemoSetting mSaveData; // 0x2E + nand::File* mpSaveFile; // 0x38 }; - } -} + } // namespace keyboard +} // namespace ipl -#endif // IPL_KEYBOARD_H +#endif // IPL_KEYBOARD_H diff --git a/include/system/iplMessage.h b/include/system/iplMessage.h index 5960dde9..cd4d0500 100644 --- a/include/system/iplMessage.h +++ b/include/system/iplMessage.h @@ -8,57 +8,57 @@ namespace ipl { namespace message { class Message { - public: - Message(); - ~Message(); + public: + Message(); + ~Message(); - /** - * @brief Sets the message resource data. - * @param msgData The message resource data. - */ - void setResource(u8* msgData); - /** - * @brief Get message string from resource data. - * @param id The message ID. - * @return The message string as Unicode (wchar_t). - */ - wchar_t* getMessage(u32 id) const; - - private: - typedef struct MESGHeader { - u32 signatureMsg; // 0x00 - u32 signatureBmg; // 0x04 - u32 size; // 0x08 - u32 sectionCount; // 0x0C - u8 encoding; // 0x10 - u8 padding[15]; // 0x11 - } MESGHeader; + /** + * @brief Sets the message resource data. + * @param msgData The message resource data. + */ + void setResource(u8* msgData); + /** + * @brief Get message string from resource data. + * @param id The message ID. + * @return The message string as Unicode (wchar_t). + */ + wchar_t* getMessage(u32 id) const; - typedef struct MESGInfoHeader { - u32 signature; // 0x00 - u32 size; // 0x04 - u16 msgCount; // 0x08 - u16 infoSize; // 0x0A - u8 padding[4]; // 0x0C - } MESGInfoHeader; + private: + typedef struct MESGHeader { + u32 signatureMsg; // 0x00 + u32 signatureBmg; // 0x04 + u32 size; // 0x08 + u32 sectionCount; // 0x0C + u8 encoding; // 0x10 + u8 padding[15]; // 0x11 + } MESGHeader; - typedef struct MESGInfoBlock { - u32 offset; // 0x00 - u32 flags; // 0x04 - u32 unk_0x08; // 0x08 - } MESGInfoBlock; + typedef struct MESGInfoHeader { + u32 signature; // 0x00 + u32 size; // 0x04 + u16 msgCount; // 0x08 + u16 infoSize; // 0x0A + u8 padding[4]; // 0x0C + } MESGInfoHeader; - typedef struct MESGDataHeader { - u32 signature; // 0x00 - u32 size; // 0x04 - } MESGDataHeader; - - MESGInfoHeader* mpInfoHeader; // 0x00 - MESGInfoBlock* mpInfoData; // 0x04 + typedef struct MESGInfoBlock { + u32 offset; // 0x00 + u32 flags; // 0x04 + u32 unk_0x08; // 0x08 + } MESGInfoBlock; - u8* mspMessageData; // 0x08 + typedef struct MESGDataHeader { + u32 signature; // 0x00 + u32 size; // 0x04 + } MESGDataHeader; + + MESGInfoHeader* mpInfoHeader; // 0x00 + MESGInfoBlock* mpInfoData; // 0x04 + + u8* mspMessageData; // 0x08 }; - } -} + } // namespace message +} // namespace ipl -#endif // IPL_MESSAGE_H +#endif // IPL_MESSAGE_H diff --git a/include/system/iplMessageManager.h b/include/system/iplMessageManager.h index 15db6b78..9b33a68f 100644 --- a/include/system/iplMessageManager.h +++ b/include/system/iplMessageManager.h @@ -8,19 +8,19 @@ namespace ipl { namespace message { class Manager { - public: - Manager(EGG::Heap* heap); + public: + Manager(EGG::Heap* heap); - /** @return The message data in use. */ - const wchar_t* getMessage(u32 id) const { return mpMessage->getMessage(id); } - void setResource(u8* msgData) const { mpMessage->setResource(msgData); } - - private: - void initMessage(); + /** @return The message data in use. */ + const wchar_t* getMessage(u32 id) const { return mpMessage->getMessage(id); } + void setResource(u8* msgData) const { mpMessage->setResource(msgData); } - Message* mpMessage; // 0x00 + private: + void initMessage(); + + Message* mpMessage; // 0x00 }; - } -} + } // namespace message +} // namespace ipl -#endif // IPL_MESSAGE_MANAGER_H +#endif // IPL_MESSAGE_MANAGER_H diff --git a/include/system/iplNand.h b/include/system/iplNand.h index a46f86b4..6ee412ae 100644 --- a/include/system/iplNand.h +++ b/include/system/iplNand.h @@ -5,8 +5,8 @@ #include -#include #include +#include #include @@ -18,8 +18,8 @@ #include "system/iplNandWrapper.h" -#define NAND_CHECK_MAGIC3(x,a,b,c) ((x)[0] == (a) && (x)[1] == (b) && (x)[2] == (c)) -#define NAND_CHECK_MAGIC4(x,a,b,c,d) ((x)[0] == (a) && (x)[1] == (b) && (x)[2] == (c) && (x)[3] == (d)) +#define NAND_CHECK_MAGIC3(x, a, b, c) ((x)[0] == (a) && (x)[1] == (b) && (x)[2] == (c)) +#define NAND_CHECK_MAGIC4(x, a, b, c, d) ((x)[0] == (a) && (x)[1] == (b) && (x)[2] == (c) && (x)[3] == (d)) namespace ipl { namespace nand { @@ -37,132 +37,132 @@ namespace ipl { }; class Base { - public: - Base(); - virtual ~Base(); // 0x08 - - virtual void read(); // 0x0C - virtual void write(); // 0x10 - - virtual bool isFinished(); // 0x14 - virtual int checkData(); // 0x18 - virtual bool isFatalError(); // 0x1C + public: + Base(); + virtual ~Base(); // 0x08 + + virtual void read(); // 0x0C + virtual void write(); // 0x10 + + virtual bool isFinished(); // 0x14 + virtual int checkData(); // 0x18 + virtual bool isFatalError(); // 0x1C }; - + class File : public Base { - public: - File(EGG::Heap* heap, const char* fileName, ARCHandle* arc, const char* nandFileName, int offset, u32 length, bool bIsInNand); - - File(EGG::Heap* heap, const char* fileName, u8* buffer, u32 length, u8 perms); - - virtual ~File(); // 0x08 + public: + File(EGG::Heap* heap, const char* fileName, ARCHandle* arc, const char* nandFileName, int offset, u32 length, bool bIsInNand); - /** - * @brief Reads the file contents. - * @note To retrieve the read contents, use `getBuffer()` - */ - virtual void read(); // 0x0C - /** @brief Writes the file contents. */ - virtual void write(); // 0x10 + File(EGG::Heap* heap, const char* fileName, u8* buffer, u32 length, u8 perms); - virtual bool isFinished() { return mbDoneTask; } // 0x14 - virtual int checkData() { return mResult; } // 0x18 - virtual bool isFatalError(); // 0x1C + virtual ~File(); // 0x08 - u8* getBuffer() const { return mpBuffer; } - u32 getLength() const { return mFileLength; } - - bool isFullForTask() const { return mbIsFullForTask; } - - private: - typedef struct MD5Head { - u8 sig[4]; // 0x00 (`IMD5`; "IPL MD5"?) - u32 length; // 0x04 - u8 reserved[8]; // 0x08 - NETMD5Sum md5; // 0x10 - } MD5Head; + /** + * @brief Reads the file contents. + * @note To retrieve the read contents, use `getBuffer()` + */ + virtual void read(); // 0x0C + /** @brief Writes the file contents. */ + virtual void write(); // 0x10 - typedef s8 MD5Bool; // ehhhh + virtual bool isFinished() { return mbDoneTask; } // 0x14 + virtual int checkData() { return mResult; } // 0x18 + virtual bool isFatalError(); // 0x1C - protected: - virtual BOOL open_(u8 attr); // 0x20 - virtual BOOL close_(); // 0x24 + u8* getBuffer() const { return mpBuffer; } + u32 getLength() const { return mFileLength; } - virtual void readBlock_(void* buffer, int length, int offset = 0); // 0x28 - - virtual u32 getRawSize_(); // 0x2C - virtual u32 getDecodeSize_(const u8* buffer); // 0x30 - virtual u8* getBuffer_(u32 length); // 0x34 + bool isFullForTask() const { return mbIsFullForTask; } - virtual void uncompressLz7(const u8* src, u8* dest); // 0x38 + private: + typedef struct MD5Head { + u8 sig[4]; // 0x00 (`IMD5`; "IPL MD5"?) + u32 length; // 0x04 + u8 reserved[8]; // 0x08 + NETMD5Sum md5; // 0x10 + } MD5Head; - virtual BOOL isCompressed(const u8* buffer); // 0x3C - virtual BOOL isSliCompressed(const u8* buffer); // 0x40 - /* @warning Due to an oversight, this checks for ASH compression. */ - virtual BOOL isAsrCompressed(const u8* buffer); // 0x44 - /* @warning Due to an oversight, this checks for ASR compression. */ - virtual BOOL isAshCompressed(const u8* buffer); // 0x48 - virtual BOOL isLz7Compressed(const u8* buffer); // 0x4C + typedef s8 MD5Bool; // ehhhh - virtual void callback_(); // 0x50 + protected: + virtual BOOL open_(u8 attr); // 0x20 + virtual BOOL close_(); // 0x24 - int calcMD5_(const u8* sum, const u8* buffer, u32 length) const; + virtual void readBlock_(void* buffer, int length, int offset = 0); // 0x28 - BOOL nand_error_handling(int result); + virtual u32 getRawSize_(); // 0x2C + virtual u32 getDecodeSize_(const u8* buffer); // 0x30 + virtual u8* getBuffer_(u32 length); // 0x34 - EGG::Heap* mpHeap; // 0x04 + virtual void uncompressLz7(const u8* src, u8* dest); // 0x38 - char msFileName[NAND_MAX_PATH+1]; // 0x08 + virtual BOOL isCompressed(const u8* buffer); // 0x3C + virtual BOOL isSliCompressed(const u8* buffer); // 0x40 + /* @warning Due to an oversight, this checks for ASH compression. */ + virtual BOOL isAsrCompressed(const u8* buffer); // 0x44 + /* @warning Due to an oversight, this checks for ASR compression. */ + virtual BOOL isAshCompressed(const u8* buffer); // 0x48 + virtual BOOL isLz7Compressed(const u8* buffer); // 0x4C - ARCHandle* mpArc; // 0x4C - char msNandFileName[NAND_MAX_PATH+1]; // 0x50 + virtual void callback_(); // 0x50 - int mFileOffset; // 0x94 - u32 mFileLength; // 0x98 - u8 mFileMode; // 0x9C - u8 mFilePerms; // 0x9D + int calcMD5_(const u8* sum, const u8* buffer, u32 length) const; - u8* mpBuffer; // 0xA0 - u8* mpCmpBuffer; // 0xA4 + BOOL nand_error_handling(int result); - int mResult; // 0xA8 - vBOOL mbDoneTask; // 0xAC - - ARCFileInfo mArcFile; // 0xB0 - u8 unused_0xBC[0x3C]; - NANDFileInfo mNandFile; // 0xF8 + EGG::Heap* mpHeap; // 0x04 - volatile int mLastError; // 0x184 - volatile bool mbFatalError; // 0x188 - bool mbIsFullForTask; // 0x189 - BOOL mbIsNandFile; // 0x18C + char msFileName[NAND_MAX_PATH + 1]; // 0x08 + + ARCHandle* mpArc; // 0x4C + char msNandFileName[NAND_MAX_PATH + 1]; // 0x50 + + int mFileOffset; // 0x94 + u32 mFileLength; // 0x98 + u8 mFileMode; // 0x9C + u8 mFilePerms; // 0x9D + + u8* mpBuffer; // 0xA0 + u8* mpCmpBuffer; // 0xA4 + + int mResult; // 0xA8 + vBOOL mbDoneTask; // 0xAC + + ARCFileInfo mArcFile; // 0xB0 + u8 unused_0xBC[0x3C]; + NANDFileInfo mNandFile; // 0xF8 + + volatile int mLastError; // 0x184 + volatile bool mbFatalError; // 0x188 + bool mbIsFullForTask; // 0x189 + BOOL mbIsNandFile; // 0x18C }; class LangFile : public Base { - public: - LangFile(EGG::Heap* heap, const char* dirName, const char* fileName, ARCHandle* arc, bool bIsNandFile); - virtual ~LangFile(); // 0x08 + public: + LangFile(EGG::Heap* heap, const char* dirName, const char* fileName, ARCHandle* arc, bool bIsNandFile); + virtual ~LangFile(); // 0x08 - virtual void read(); // 0x0C + virtual void read(); // 0x0C - virtual bool isFinished(); // 0x14 - virtual int checkData(); // 0x18 - virtual bool isFatalError(); // 0x1C + virtual bool isFinished(); // 0x14 + virtual int checkData(); // 0x18 + virtual bool isFatalError(); // 0x1C - File* getCmnFile() const { return mpCommonFile; } - File* getLangFile() const { return mpLangFile; } + File* getCmnFile() const { return mpCommonFile; } + File* getLangFile() const { return mpLangFile; } - private: - File* mpCommonFile; // 0x04 - File* mpLangFile; // 0x08 + private: + File* mpCommonFile; // 0x04 + File* mpLangFile; // 0x08 }; class LayoutFile : public LangFile { - public: - LayoutFile(EGG::Heap* heap, const char* dirName, const char* fileName, ARCHandle* arc, bool bIsNandFile); - virtual ~LayoutFile(); // 0x08 + public: + LayoutFile(EGG::Heap* heap, const char* dirName, const char* fileName, ARCHandle* arc, bool bIsNandFile); + virtual ~LayoutFile(); // 0x08 }; - } -} + } // namespace nand +} // namespace ipl -#endif // IPL_NAND_H +#endif // IPL_NAND_H diff --git a/include/system/iplNandManager.h b/include/system/iplNandManager.h index ef5c7ca7..6996c392 100644 --- a/include/system/iplNandManager.h +++ b/include/system/iplNandManager.h @@ -3,73 +3,76 @@ #include -#include -#include -#include #include +#include +#include +#include #include #include "system/iplNand.h" -#include "system/iplNandShared.h" #include "system/iplNandMeta.h" +#include "system/iplNandShared.h" #include "config.h" namespace ipl { namespace nand { class Manager { - public: - Manager(EGG::Heap* heap); + public: + Manager(EGG::Heap* heap); - File* read(EGG::Heap* heap, const char* fileName, int offset = 0, u32 length = 0, bool bJamRequest = false); - File* readAsync(EGG::Heap* heap, const char* fileName, int offset = 0, u32 length = 0, bool bJamRequest = false); + File* read(EGG::Heap* heap, const char* fileName, int offset = 0, u32 length = 0, bool bJamRequest = false); + File* readAsync(EGG::Heap* heap, const char* fileName, int offset = 0, u32 length = 0, bool bJamRequest = false); - File* write(EGG::Heap* heap, const char* fileName, void* buffer, u32 length, u8 perms); - File* writeAsync(EGG::Heap* heap, const char* fileName, void* buffer, u32 length, u8 perms); + File* write(EGG::Heap* heap, const char* fileName, void* buffer, u32 length, u8 perms); + File* writeAsync(EGG::Heap* heap, const char* fileName, void* buffer, u32 length, u8 perms); - SharedFile* readSharedAsync(EGG::Heap* heap, const char* fileName, int index, int offset = 0, u32 length = 0, ESTitleId titleId = SYSMENU_TITLE_ID, int ticketIdx = 0); + SharedFile* readSharedAsync(EGG::Heap* heap, const char* fileName, int index, int offset = 0, u32 length = 0, + ESTitleId titleId = SYSMENU_TITLE_ID, int ticketIdx = 0); - MetaFile* readMetaHeaderAsync(EGG::Heap* heap, ESTitleId titleId, int offset, u32 length, MetaFile::Callback callback, void* callbackWork, int ticketIdx); - MetaFile* readMetaBodyAsync(EGG::Heap* heap, const char* fileName, ARCHandle* arc, ESTitleId titleId, int offset, u32 length, MetaFile::Callback callback, void* callbackWork, int ticketIdx); + MetaFile* readMetaHeaderAsync(EGG::Heap* heap, ESTitleId titleId, int offset, u32 length, MetaFile::Callback callback, void* callbackWork, + int ticketIdx); + MetaFile* readMetaBodyAsync(EGG::Heap* heap, const char* fileName, ARCHandle* arc, ESTitleId titleId, int offset, u32 length, + MetaFile::Callback callback, void* callbackWork, int ticketIdx); - LayoutFile* readLayout(EGG::Heap* heap, const char* fileName, bool bJamRequest = false); - LayoutFile* readLayoutAsync(EGG::Heap* heap, const char* fileName, bool bJamRequest = false); - - void openContentsAll(); - void closeContentsAll(); - - void sendToken(int token); - BOOL receiveToken(int* token); - - ESFd getDescriptor() const { return mDescriptor; } - ARCHandle* getArc() { return &mArc; } + LayoutFile* readLayout(EGG::Heap* heap, const char* fileName, bool bJamRequest = false); + LayoutFile* readLayoutAsync(EGG::Heap* heap, const char* fileName, bool bJamRequest = false); - EGG::TaskThread* getTask() { return mpTask; } - - private: - static void doReadTask(void* work); - static void doWriteTask(void* work); - static void doSendTokenTask(void* work); + void openContentsAll(); + void closeContentsAll(); - LayoutFile* readLayout_(EGG::Heap* heap, const char* fileName, ARCHandle* arc, bool bIsNand) NO_INLINE; - - File* write_(EGG::Heap* heap, const char* fileName, void* buffer, u32 length, u8 perms) NO_INLINE; + void sendToken(int token); + BOOL receiveToken(int* token); - EGG::TaskThread* mpTask; // 0x00 + ESFd getDescriptor() const { return mDescriptor; } + ARCHandle* getArc() { return &mArc; } - OSMessageQueue mMsgQueue; // 0x04 - OSMessage mMessage; // 0x24 + EGG::TaskThread* getTask() { return mpTask; } - // Big garbage data - u8 unused_0x28[0x1FC]; + private: + static void doReadTask(void* work); + static void doWriteTask(void* work); + static void doSendTokenTask(void* work); - char mNandPath[NAND_MAX_PATH+1]; // 0x224 - ESFd mDescriptor; // 0x268 - u8* mpFSTBuffer; // 0x26C - ARCHandle mArc; // 0x270 + LayoutFile* readLayout_(EGG::Heap* heap, const char* fileName, ARCHandle* arc, bool bIsNand) NO_INLINE; + + File* write_(EGG::Heap* heap, const char* fileName, void* buffer, u32 length, u8 perms) NO_INLINE; + + EGG::TaskThread* mpTask; // 0x00 + + OSMessageQueue mMsgQueue; // 0x04 + OSMessage mMessage; // 0x24 + + // Big garbage data + u8 unused_0x28[0x1FC]; + + char mNandPath[NAND_MAX_PATH + 1]; // 0x224 + ESFd mDescriptor; // 0x268 + u8* mpFSTBuffer; // 0x26C + ARCHandle mArc; // 0x270 }; - } -} + } // namespace nand +} // namespace ipl -#endif // IPL_NAND_MANAGER_H +#endif // IPL_NAND_MANAGER_H diff --git a/include/system/iplNandMeta.h b/include/system/iplNandMeta.h index 9628e49b..d3fc26fc 100644 --- a/include/system/iplNandMeta.h +++ b/include/system/iplNandMeta.h @@ -8,45 +8,46 @@ namespace ipl { namespace nand { class MetaFile : public File { - public: - typedef void (*Callback)(void*); + public: + typedef void (*Callback)(void*); - MetaFile(EGG::Heap* heap, const char* fileName, ARCHandle* arc, ESTitleId titleId, int offset, u32 length, Callback callBack, void* callBackWork, int ticketIdx); - virtual ~MetaFile(); + MetaFile(EGG::Heap* heap, const char* fileName, ARCHandle* arc, ESTitleId titleId, int offset, u32 length, Callback callBack, + void* callBackWork, int ticketIdx); + virtual ~MetaFile(); - bool inNand() const { return mbMetaInNand; } - - protected: - virtual BOOL open_(u8 attr); - virtual BOOL close_(); + bool inNand() const { return mbMetaInNand; } - virtual void readBlock_(void* buffer, int length, int offset = 0); + protected: + virtual BOOL open_(u8 attr); + virtual BOOL close_(); - virtual u32 getRawSize_(); + virtual void readBlock_(void* buffer, int length, int offset = 0); - virtual void callback_(); - - private: - BOOL openNandFile_(); - BOOL openTicketFile_(); - - void readNandBlock_(void* bufferOut, int length, int offset); - void readTicketBlock_(void* bufferOut, int length, int offset); - - BOOL closeNandFile_(); - BOOL closeTicketFile_(); - - undefined4 unused_0x190; - int mDescriptor; // 0x194 - ESTitleId mTitleId; // 0x198 - ESTicketView* mTicket; // 0x19C - int mTicketIdx; // 0x1A0 - bool mbMetaInNand; // 0x1A4 - - Callback mCallback; // 0x1A8 - void* mCallbackWork; // 0x1AC + virtual u32 getRawSize_(); + + virtual void callback_(); + + private: + BOOL openNandFile_(); + BOOL openTicketFile_(); + + void readNandBlock_(void* bufferOut, int length, int offset); + void readTicketBlock_(void* bufferOut, int length, int offset); + + BOOL closeNandFile_(); + BOOL closeTicketFile_(); + + undefined4 unused_0x190; + int mDescriptor; // 0x194 + ESTitleId mTitleId; // 0x198 + ESTicketView* mTicket; // 0x19C + int mTicketIdx; // 0x1A0 + bool mbMetaInNand; // 0x1A4 + + Callback mCallback; // 0x1A8 + void* mCallbackWork; // 0x1AC }; - } -} + } // namespace nand +} // namespace ipl -#endif // IPL_NAND_META_H +#endif // IPL_NAND_META_H diff --git a/include/system/iplNandSDWorker.h b/include/system/iplNandSDWorker.h index 99d9ac49..215c98e9 100644 --- a/include/system/iplNandSDWorker.h +++ b/include/system/iplNandSDWorker.h @@ -5,18 +5,18 @@ namespace ipl { class NandSDWorker { - public: - NandSDWorker(); - ~NandSDWorker(); - - private: - /** - * @brief Verifies if the banner header is valid. - * @param pBnrData The buffer containing the banner data. - * @param headerSize Header file size. - */ - BOOL check_header_base(const u8* bnrData, u32* headerSize = NULL); - }; -} + public: + NandSDWorker(); + ~NandSDWorker(); -#endif // IPL_NAND_SD_WORKER_H + private: + /** + * @brief Verifies if the banner header is valid. + * @param pBnrData The buffer containing the banner data. + * @param headerSize Header file size. + */ + BOOL check_header_base(const u8* bnrData, u32* headerSize = NULL); + }; +} // namespace ipl + +#endif // IPL_NAND_SD_WORKER_H diff --git a/include/system/iplNandShared.h b/include/system/iplNandShared.h index 8ab40c8d..dd37fa5c 100644 --- a/include/system/iplNandShared.h +++ b/include/system/iplNandShared.h @@ -9,36 +9,36 @@ namespace ipl { namespace nand { class SharedFile : public File { - public: - SharedFile(EGG::Heap* heap, const char* fileName, u32 index, int offset, u32 length, ESTitleId titleId, int ticketIdx); - virtual ~SharedFile(); - - protected: - virtual BOOL open_(u8 attr); - virtual BOOL close_(); + public: + SharedFile(EGG::Heap* heap, const char* fileName, u32 index, int offset, u32 length, ESTitleId titleId, int ticketIdx); + virtual ~SharedFile(); - virtual u32 getRawSize_(); + protected: + virtual BOOL open_(u8 attr); + virtual BOOL close_(); - virtual void readBlock_(void* buffer, int length, int offset = 0); - - private: - BOOL openTicketFile_(); - BOOL closeTicketFile_(); + virtual u32 getRawSize_(); - u32 mContentIdx; // 0x190 - ESFd mDescriptor; // 0x194 + virtual void readBlock_(void* buffer, int length, int offset = 0); - ESTitleId mTitleId; // 0x198 + private: + BOOL openTicketFile_(); + BOOL closeTicketFile_(); - ESTicketView* mTicket; // 0x1A0 + u32 mContentIdx; // 0x190 + ESFd mDescriptor; // 0x194 - int mTicketIdx; // 0x1A4 + ESTitleId mTitleId; // 0x198 - void* mpFSTBuffer; // 0x1A8 + ESTicketView* mTicket; // 0x1A0 - ARCHandle mArc; // 0x1AC + int mTicketIdx; // 0x1A4 + + void* mpFSTBuffer; // 0x1A8 + + ARCHandle mArc; // 0x1AC }; - } -} + } // namespace nand +} // namespace ipl -#endif // IPL_NAND_SHARED_H +#endif // IPL_NAND_SHARED_H diff --git a/include/system/iplNandWall.h b/include/system/iplNandWall.h index 92bc4c36..806a9893 100644 --- a/include/system/iplNandWall.h +++ b/include/system/iplNandWall.h @@ -3,8 +3,8 @@ #include -#include #include +#include namespace ipl { namespace nandwall { @@ -12,7 +12,7 @@ namespace ipl { void throwNandCheckCommand(void* work); /** @brief Checks if the NAND has enough capacity to run an application. */ BOOL checkNandCapacityAppBootable(); - } -} + } // namespace nandwall +} // namespace ipl -#endif // IPL_NAND_WALL_H +#endif // IPL_NAND_WALL_H diff --git a/include/system/iplNandWrapper.h b/include/system/iplNandWrapper.h index 19f124c0..dd08c5f4 100644 --- a/include/system/iplNandWrapper.h +++ b/include/system/iplNandWrapper.h @@ -3,8 +3,8 @@ #include -#include #include +#include namespace ipl { namespace nand { @@ -35,10 +35,11 @@ namespace ipl { s32 SecretGetUsage(const char* path, u32* usedBlocks, u32* usedINodes); s32 SecretGetUserUsage(u32* usedUserBlocks, u32* usedUserINodes); - s32 SecretGetSystemAvailableArea(const NANDFileSystemStatus *status, u32 usedSystemBlocks, u32 usedSystemINode, u32 *freeSystemBlocks, u32 *freeSystemINode); - s32 SecretGetFileSystemStatus(NANDFileSystemStatus *status); - } - } -} + s32 SecretGetSystemAvailableArea(const NANDFileSystemStatus* status, u32 usedSystemBlocks, u32 usedSystemINode, u32* freeSystemBlocks, + u32* freeSystemINode); + s32 SecretGetFileSystemStatus(NANDFileSystemStatus* status); + } // namespace wrapper + } // namespace nand +} // namespace ipl -#endif // IPL_NAND_WRAPPER_H +#endif // IPL_NAND_WRAPPER_H diff --git a/include/system/iplNigaoe.h b/include/system/iplNigaoe.h index 88589802..f86ba1f6 100644 --- a/include/system/iplNigaoe.h +++ b/include/system/iplNigaoe.h @@ -16,57 +16,56 @@ namespace ipl { namespace nigaoe { class Object { - public: - typedef void (*MakeIconCallback)(Object*, void*); + public: + typedef void (*MakeIconCallback)(Object*, void*); - Object(EGG::Heap* heap, int width, int height, int faceId, MakeIconCallback callback, void* callbackWork); - Object(EGG::Heap* heap, int width, int height, RFLiCharData* faceData, MakeIconCallback callback, void* callbackWork); - ~Object(); + Object(EGG::Heap* heap, int width, int height, int faceId, MakeIconCallback callback, void* callbackWork); + Object(EGG::Heap* heap, int width, int height, RFLiCharData* faceData, MakeIconCallback callback, void* callbackWork); + ~Object(); - const wchar_t* getName() const { - wchar_t* faceName; + const wchar_t* getName() const { + wchar_t* faceName; - int faceId = mFaceId; - if (faceId >= 0) { - RFLiCharData* charData = RFLiGetCharData(faceId); - faceName = (wchar_t*)charData->name; - } - else { - faceName = NULL; - } - - return faceName; + int faceId = mFaceId; + if (faceId >= 0) { + RFLiCharData* charData = RFLiGetCharData(faceId); + faceName = (wchar_t*)charData->name; + } else { + faceName = NULL; } - const GXTexObj& getIconTexture() const { return mFaceTexObj; } - u32 getIndex() const { return mFaceId; } + return faceName; + } - BOOL created() const { return mbCreated; } - - private: - void init(EGG::Heap* heap, int width, int height); - void make_icon(); + const GXTexObj& getIconTexture() const { return mFaceTexObj; } + u32 getIndex() const { return mFaceId; } - u8* mpIconTex; // 0x00 - u32 mIconSize; // 0x04 + BOOL created() const { return mbCreated; } - RFLIconSetting mIconSettings; // 0x08 - GXTexObj mFaceTexObj; // 0x18 - RFLiCharData* mpCharData; // 0x38 - u32 mFaceId; // 0x3C + private: + void init(EGG::Heap* heap, int width, int height); + void make_icon(); - MakeIconCallback mCallBack; // 0x40 - void* mpCallBackWork; // 0x44 + u8* mpIconTex; // 0x00 + u32 mIconSize; // 0x04 - public: - nw4r::ut::Link mLink; // 0x48 + RFLIconSetting mIconSettings; // 0x08 + GXTexObj mFaceTexObj; // 0x18 + RFLiCharData* mpCharData; // 0x38 + u32 mFaceId; // 0x3C - private: - bool mbCreated; // 0x50 + MakeIconCallback mCallBack; // 0x40 + void* mpCallBackWork; // 0x44 + + public: + nw4r::ut::Link mLink; // 0x48 + + private: + bool mbCreated; // 0x50 friend class Manager; }; - } -} + } // namespace nigaoe +} // namespace ipl -#endif // IPL_NIGAOE_H +#endif // IPL_NIGAOE_H diff --git a/include/system/iplNigaoeManager.h b/include/system/iplNigaoeManager.h index 97d34677..af4e077f 100644 --- a/include/system/iplNigaoeManager.h +++ b/include/system/iplNigaoeManager.h @@ -1,8 +1,8 @@ #ifndef IPL_NIGAOE_MANAGER_H #define IPL_NIGAOE_MANAGER_H -#include "system/iplNigaoe.h" #include "system/iplNand.h" +#include "system/iplNigaoe.h" #include @@ -11,30 +11,30 @@ namespace ipl { namespace nigaoe { class Manager { - public: - Manager(EGG::Heap* heap); + public: + Manager(EGG::Heap* heap); - Object* create(EGG::Heap* heap, int width, int height, int faceId, Object::MakeIconCallback callback, void* callbackWork); - Object* create(EGG::Heap* heap, int width, int height, RFLiCharData* faceData, Object::MakeIconCallback callback, void* callbackWork); + Object* create(EGG::Heap* heap, int width, int height, int faceId, Object::MakeIconCallback callback, void* callbackWork); + Object* create(EGG::Heap* heap, int width, int height, RFLiCharData* faceData, Object::MakeIconCallback callback, void* callbackWork); - void makeIcon(); + void makeIcon(); - void detach(Object* obj); + void detach(Object* obj); - BOOL isAvalable(u16 faceId); - BOOL isValid(const RFLiCharData* faceData) const; + BOOL isAvalable(u16 faceId); + BOOL isValid(const RFLiCharData* faceData) const; - RFLErrcode addHiddenDB(const NWC24MsgObj* faceDB); - void commitHiddenDB(); + RFLErrcode addHiddenDB(const NWC24MsgObj* faceDB); + void commitHiddenDB(); - RFLErrcode getInitResult() { return mErrcode; } + RFLErrcode getInitResult() { return mErrcode; } - private: - nand::File* mResFile; // 0x00 - RFLErrcode mErrcode; // 0x04 - nw4r::ut::List mObjects; // 0x08 + private: + nand::File* mResFile; // 0x00 + RFLErrcode mErrcode; // 0x04 + nw4r::ut::List mObjects; // 0x08 }; - } -} + } // namespace nigaoe +} // namespace ipl -#endif // IPL_NIGAOE_MANAGER_H +#endif // IPL_NIGAOE_MANAGER_H diff --git a/include/system/iplNwc24Manager.h b/include/system/iplNwc24Manager.h index 4b27616a..47340ec5 100644 --- a/include/system/iplNwc24Manager.h +++ b/include/system/iplNwc24Manager.h @@ -3,8 +3,8 @@ #include -#include #include +#include #include @@ -17,172 +17,173 @@ namespace ipl { } namespace nwc24 { class Manager { + public: + class Arg { public: - class Arg { - public: - NWC24ScdStat mScheduleStat; // 0x00 - }; + NWC24ScdStat mScheduleStat; // 0x00 + }; - static const int MAX_DOWNLOAD_COUNT = 120; - static const int MAX_MESSAGES_COUNT = 256; - - Manager(EGG::Heap* heap); + static const int MAX_DOWNLOAD_COUNT = 120; + static const int MAX_MESSAGES_COUNT = 256; - BOOL open(); - BOOL close(); + Manager(EGG::Heap* heap); - // NWC24MsgSet - BOOL initMsgObj(NWC24MsgObj* msg, NWC24MsgType msgType); - BOOL setMsgToId(NWC24MsgObj* msg, NWC24UserId id); - BOOL setMsgToAddr(NWC24MsgObj* msg, const char* addr, u32 addrLen); - BOOL setMsgText(NWC24MsgObj* msg, const char* text, u32 textLen, NWC24Charset charset, NWC24Encoding encoding); - BOOL setMsgSubjectAndTextPublic(NWC24MsgObj* msg, const u16* subject, u32 subjectLen, const u16* text, u32 textLen, u8* work, u32 workSize); - BOOL setMsgMBNoReply(NWC24MsgObj* msg, BOOL bNoReply); - BOOL setMsgMBRegDate(NWC24MsgObj* msg, u16 year, u8 month, u8 day); - BOOL setMsgAppId(NWC24MsgObj* msg, u32 appId); + BOOL open(); + BOOL close(); - // NWC24MsgCommit - BOOL commitMsg(NWC24MsgObj* msg); + // NWC24MsgSet + BOOL initMsgObj(NWC24MsgObj* msg, NWC24MsgType msgType); + BOOL setMsgToId(NWC24MsgObj* msg, NWC24UserId id); + BOOL setMsgToAddr(NWC24MsgObj* msg, const char* addr, u32 addrLen); + BOOL setMsgText(NWC24MsgObj* msg, const char* text, u32 textLen, NWC24Charset charset, NWC24Encoding encoding); + BOOL setMsgSubjectAndTextPublic(NWC24MsgObj* msg, const u16* subject, u32 subjectLen, const u16* text, u32 textLen, u8* work, + u32 workSize); + BOOL setMsgMBNoReply(NWC24MsgObj* msg, BOOL bNoReply); + BOOL setMsgMBRegDate(NWC24MsgObj* msg, u16 year, u8 month, u8 day); + BOOL setMsgAppId(NWC24MsgObj* msg, u32 appId); - // NWC24MsgGet - BOOL getNumMsgs(NWC24MBoxType msgBoxType, u32* numMsgs); - BOOL getMsgIdList(NWC24MBoxType msgBoxType, u32* msgIds, u32 maxLength); - BOOL getMsgObj(NWC24MsgObj* msg, NWC24MBoxType msgBoxType, u32 index); - BOOL getMsgType(const NWC24MsgObj* msg, NWC24MsgType* type); - BOOL getMsgAppId(const NWC24MsgObj* msg, u32* appId); - BOOL getMsgGroupId(const NWC24MsgObj* msg, u16* groupId); - BOOL getMsgTextSize(const NWC24MsgObj* msg, u32* textLen); - BOOL getMsgSubjectSize(const NWC24MsgObj* msg, u32* subjectLen); - BOOL getMsgFromId(const NWC24MsgObj* msg, NWC24UserId* fromId); - BOOL getMsgNumAttached(const NWC24MsgObj* msg, u32* numAttach); - BOOL getMsgAttachedSize(const NWC24MsgObj* msg, u32 attachIndex, u32* attachSize); - BOOL getMsgAttachedType(const NWC24MsgObj* msg, u32 attachIndex, NWC24MIMEType* attachType); - BOOL getMsgDate(const NWC24MsgObj* msg, OSCalendarTime* msgDate); - BOOL getMsgIconNewSign(const NWC24MsgObj* msg, u32* iconNewSign); + // NWC24MsgCommit + BOOL commitMsg(NWC24MsgObj* msg); - // NWC24MsgRead - BOOL readMsgAltName(const NWC24MsgObj* msg, u16* altName, u32 altNameLen); - BOOL readMsgText(const NWC24MsgObj* msg, char* text, u32 textLen, NWC24Charset* charset, NWC24Encoding* encoding); - BOOL readMsgTextPublic(const NWC24MsgObj* msg, u16* text, u32* textLen, u8* work, u32 workSize); - BOOL readMsgSubjectPublic(const NWC24MsgObj* msg, u16* subject, u32* subjectLen, u8* work, u32 workSize); - BOOL readMsgAttached(const NWC24MsgObj* msg, u32 attachIndex, u8* attachData, u32 attachSize); - BOOL readMsgFromAddr(const NWC24MsgObj* msg, char* addr, u32 addrLen); - BOOL readMsgMBNoReply(const NWC24MsgObj* msg, BOOL* bNoReply); - BOOL readMsgMBDelay(const NWC24MsgObj* msg, u8* delay); - BOOL readMsgMBRegDate(const NWC24MsgObj* msg, u16* year, u8* month, u8* day); - BOOL readMsgMBUpdateSW(const NWC24MsgObj* msg, u32* mbUpdateSW); - BOOL readMsgMBOptOutFlag(const NWC24MsgObj* msg, BOOL* mbOptOutFlag, u32* appId); + // NWC24MsgGet + BOOL getNumMsgs(NWC24MBoxType msgBoxType, u32* numMsgs); + BOOL getMsgIdList(NWC24MBoxType msgBoxType, u32* msgIds, u32 maxLength); + BOOL getMsgObj(NWC24MsgObj* msg, NWC24MBoxType msgBoxType, u32 index); + BOOL getMsgType(const NWC24MsgObj* msg, NWC24MsgType* type); + BOOL getMsgAppId(const NWC24MsgObj* msg, u32* appId); + BOOL getMsgGroupId(const NWC24MsgObj* msg, u16* groupId); + BOOL getMsgTextSize(const NWC24MsgObj* msg, u32* textLen); + BOOL getMsgSubjectSize(const NWC24MsgObj* msg, u32* subjectLen); + BOOL getMsgFromId(const NWC24MsgObj* msg, NWC24UserId* fromId); + BOOL getMsgNumAttached(const NWC24MsgObj* msg, u32* numAttach); + BOOL getMsgAttachedSize(const NWC24MsgObj* msg, u32 attachIndex, u32* attachSize); + BOOL getMsgAttachedType(const NWC24MsgObj* msg, u32 attachIndex, NWC24MIMEType* attachType); + BOOL getMsgDate(const NWC24MsgObj* msg, OSCalendarTime* msgDate); + BOOL getMsgIconNewSign(const NWC24MsgObj* msg, u32* iconNewSign); - BOOL deleteMsg(NWC24MBoxType msgBoxType, u32 index); + // NWC24MsgRead + BOOL readMsgAltName(const NWC24MsgObj* msg, u16* altName, u32 altNameLen); + BOOL readMsgText(const NWC24MsgObj* msg, char* text, u32 textLen, NWC24Charset* charset, NWC24Encoding* encoding); + BOOL readMsgTextPublic(const NWC24MsgObj* msg, u16* text, u32* textLen, u8* work, u32 workSize); + BOOL readMsgSubjectPublic(const NWC24MsgObj* msg, u16* subject, u32* subjectLen, u8* work, u32 workSize); + BOOL readMsgAttached(const NWC24MsgObj* msg, u32 attachIndex, u8* attachData, u32 attachSize); + BOOL readMsgFromAddr(const NWC24MsgObj* msg, char* addr, u32 addrLen); + BOOL readMsgMBNoReply(const NWC24MsgObj* msg, BOOL* bNoReply); + BOOL readMsgMBDelay(const NWC24MsgObj* msg, u8* delay); + BOOL readMsgMBRegDate(const NWC24MsgObj* msg, u16* year, u8* month, u8* day); + BOOL readMsgMBUpdateSW(const NWC24MsgObj* msg, u32* mbUpdateSW); + BOOL readMsgMBOptOutFlag(const NWC24MsgObj* msg, BOOL* mbOptOutFlag, u32* appId); - // NWC24Config - BOOL getMyUserId(NWC24UserId* userId); + BOOL deleteMsg(NWC24MBoxType msgBoxType, u32 index); - // NWC24FriendInfo - BOOL isFriendInfoThere(u32 friendIndex); - BOOL searchFriendInfo(const NWC24FriendAddr* friendAddr, u32* friendIndex); - BOOL searchFriendInfo(NWC24UserId friendId, u32* friendIndex); - BOOL readFriendInfo(NWC24FriendInfo* friendInfo, u32 friendIndex); - BOOL writeFriendInfo(const NWC24FriendInfo* friendInfo, u32 friendIndex); - BOOL updateFriendInfo(const NWC24FriendInfo* friendInfo, u32 friendIndex); - BOOL deleteFriendInfo(u32 friendIndex); - BOOL swapFriendInfo(u32 friendIndex1, u32 friendIndex2); - BOOL getNumRegFriendInfos(u32* numRegFriendInfo); - BOOL getNumFriendInfos(u32* numFriendInfo); + // NWC24Config + BOOL getMyUserId(NWC24UserId* userId); - // NWC24UserId - BOOL checkUserId(NWC24UserId userId); + // NWC24FriendInfo + BOOL isFriendInfoThere(u32 friendIndex); + BOOL searchFriendInfo(const NWC24FriendAddr* friendAddr, u32* friendIndex); + BOOL searchFriendInfo(NWC24UserId friendId, u32* friendIndex); + BOOL readFriendInfo(NWC24FriendInfo* friendInfo, u32 friendIndex); + BOOL writeFriendInfo(const NWC24FriendInfo* friendInfo, u32 friendIndex); + BOOL updateFriendInfo(const NWC24FriendInfo* friendInfo, u32 friendIndex); + BOOL deleteFriendInfo(u32 friendIndex); + BOOL swapFriendInfo(u32 friendIndex1, u32 friendIndex2); + BOOL getNumRegFriendInfos(u32* numRegFriendInfo); + BOOL getNumFriendInfos(u32* numFriendInfo); - // NWC24Dl - BOOL getDlTask(NWC24DlTask* dlTask, NWC24DlId id); - BOOL getDlAppId(const NWC24DlTask* dlTask, u32* appId); - BOOL getDlOptOutFlags(NWC24DlTask* dlTask, u8* optOutFlag); - BOOL initDlTask(NWC24DlTask* dlTask, NWC24DLType type); - BOOL setDlId(NWC24DlTask* dlTask, NWC24DlId id); - BOOL setDlUrl(NWC24DlTask* dlTask, const char* url); - BOOL setDlPriority(NWC24DlTask* dlTask, u8 prio); - BOOL setDlInterval(NWC24DlTask* dlTask, u16 interval); - BOOL setDlFlags(NWC24DlTask* dlTask, u32 flags); - BOOL addDlTask(NWC24DlTask* dlTask); - BOOL updateDlTask(NWC24DlTask* dlTask); - BOOL deleteDlTask(NWC24DlTask* dlTask); - BOOL setDlTableFirst(); - void setDlTable(); - BOOL isAppDlEnable(u32 appId) const; + // NWC24UserId + BOOL checkUserId(NWC24UserId userId); - // NWC24System - BOOL doDailyTasks(); - BOOL manageDlTaskListForMenu(); - BOOL setLedPattern(NWC24MsgObj* msg); - BOOL enableLedNotification(BOOL enableLed); + // NWC24Dl + BOOL getDlTask(NWC24DlTask* dlTask, NWC24DlId id); + BOOL getDlAppId(const NWC24DlTask* dlTask, u32* appId); + BOOL getDlOptOutFlags(NWC24DlTask* dlTask, u8* optOutFlag); + BOOL initDlTask(NWC24DlTask* dlTask, NWC24DLType type); + BOOL setDlId(NWC24DlTask* dlTask, NWC24DlId id); + BOOL setDlUrl(NWC24DlTask* dlTask, const char* url); + BOOL setDlPriority(NWC24DlTask* dlTask, u8 prio); + BOOL setDlInterval(NWC24DlTask* dlTask, u16 interval); + BOOL setDlFlags(NWC24DlTask* dlTask, u32 flags); + BOOL addDlTask(NWC24DlTask* dlTask); + BOOL updateDlTask(NWC24DlTask* dlTask); + BOOL deleteDlTask(NWC24DlTask* dlTask); + BOOL setDlTableFirst(); + void setDlTable(); + BOOL isAppDlEnable(u32 appId) const; - // NWC24CHJump - BOOL checkCHJumpObj(const NWC24CHJumpObj* chjp, u32 dataSize); - BOOL getCHJumpTitleId(const NWC24CHJumpObj* chjp, u64* titleId); - BOOL getCHJumpBlockSize(const NWC24CHJumpObj* chjp, u32* size, u32 index); - BOOL getCHJumpBlockData(const NWC24CHJumpObj* chjp, char* data, u32 size, u32 index); + // NWC24System + BOOL doDailyTasks(); + BOOL manageDlTaskListForMenu(); + BOOL setLedPattern(NWC24MsgObj* msg); + BOOL enableLedNotification(BOOL enableLed); - // NWC24Schedule - BOOL saveMailNow(); + // NWC24CHJump + BOOL checkCHJumpObj(const NWC24CHJumpObj* chjp, u32 dataSize); + BOOL getCHJumpTitleId(const NWC24CHJumpObj* chjp, u64* titleId); + BOOL getCHJumpBlockSize(const NWC24CHJumpObj* chjp, u32* size, u32 index); + BOOL getCHJumpBlockData(const NWC24CHJumpObj* chjp, char* data, u32 size, u32 index); - // Misc - NWC24Err check(u32 usage); - void receive(); + // NWC24Schedule + BOOL saveMailNow(); - void addDlTask(); + // Misc + NWC24Err check(u32 usage); + void receive(); - BOOL getNewTitleTbl(u32* titleTbl) const; - BOOL isNewMessageThere(u32 unk) const; + void addDlTask(); - int getErrCode(); + BOOL getNewTitleTbl(u32* titleTbl) const; + BOOL isNewMessageThere(u32 unk) const; - bool received() { return mbReviecedMsg; } - void prepNextReceive() { mbReviecedMsg = false; } - volatile bool isUnk0xA31() { return unk_0xA31 == false; } + int getErrCode(); - BOOL isAppDlEnableLock(u32 appId) { - utility::autoMutexLock lock(mAutoLock); - BOOL result = isAppDlEnable(appId); - return result; - } + bool received() { return mbReviecedMsg; } + void prepNextReceive() { mbReviecedMsg = false; } + volatile bool isUnk0xA31() { return unk_0xA31 == false; } - private: - void add_dl_task(NWC24DlId id, const char* url, u16 interval, u8 priority); + BOOL isAppDlEnableLock(u32 appId) { + utility::autoMutexLock lock(mAutoLock); + BOOL result = isAppDlEnable(appId); + return result; + } - int encode_odh(EGG::Heap* heap, u32 attachIndex); - wchar_t* make_text(EGG::Heap* heap, const NWC24MsgObj* msg, bool bIncludeSubject, u32* failFlag); + private: + void add_dl_task(NWC24DlId id, const char* url, u16 interval, u8 priority); - BOOL is_valid_app_id(u32 appId, u16 groupId) const; + int encode_odh(EGG::Heap* heap, u32 attachIndex); + wchar_t* make_text(EGG::Heap* heap, const NWC24MsgObj* msg, bool bIncludeSubject, u32* failFlag); - BOOL error_handling_ignore_file(NWC24Err code, int line); - BOOL error_handling(NWC24Err code, int line); + BOOL is_valid_app_id(u32 appId, u16 groupId) const; - u8* mAttachData[RBR_ATTACHMENT_MAX]; // 0x00 - u32 mAttachSize[RBR_ATTACHMENT_MAX]; // 0x08 + BOOL error_handling_ignore_file(NWC24Err code, int line); + BOOL error_handling(NWC24Err code, int line); - u8* mJpegData; // 0x10 - u32 mJpegSize; // 0x14 + u8* mAttachData[RBR_ATTACHMENT_MAX]; // 0x00 + u32 mAttachSize[RBR_ATTACHMENT_MAX]; // 0x08 - u32 mMsgIdsTbl[MAX_MESSAGES_COUNT]; // 0x18 - u32 mTitleTbl[MAX_MESSAGES_COUNT]; // 0x418 - u32 mDlTable[MAX_DOWNLOAD_COUNT]; // 0x818 + u8* mJpegData; // 0x10 + u32 mJpegSize; // 0x14 - NWC24Err mLastError; // 0x9F8 - u8* mpLibWork; // 0x9FC + u32 mMsgIdsTbl[MAX_MESSAGES_COUNT]; // 0x18 + u32 mTitleTbl[MAX_MESSAGES_COUNT]; // 0x418 + u32 mDlTable[MAX_DOWNLOAD_COUNT]; // 0x818 - OSMutex mLock; // 0xA00 - OSMutex mAutoLock; // 0xA18 + NWC24Err mLastError; // 0x9F8 + u8* mpLibWork; // 0x9FC - bool mbReviecedMsg; - bool unk_0xA31; - bool mbReceivePaused; // 0xA32 - bool unk_0xA33; + OSMutex mLock; // 0xA00 + OSMutex mAutoLock; // 0xA18 - static Arg smArg; + bool mbReviecedMsg; + bool unk_0xA31; + bool mbReceivePaused; // 0xA32 + bool unk_0xA33; - friend class postman::Manager; + static Arg smArg; + + friend class postman::Manager; }; - } -} + } // namespace nwc24 +} // namespace ipl -#endif // IPL_NWC24_MANAGER_H +#endif // IPL_NWC24_MANAGER_H diff --git a/include/system/iplPlayTimeLog.h b/include/system/iplPlayTimeLog.h index cd1d59cb..ba16b4cb 100644 --- a/include/system/iplPlayTimeLog.h +++ b/include/system/iplPlayTimeLog.h @@ -13,90 +13,80 @@ #include "system/iplCdbManager.h" namespace ipl { - #define LOG_MAGIC '03_0' +#define LOG_MAGIC '03_0' - #define LOG_MAX_ENTRIES 10 +#define LOG_MAX_ENTRIES 10 typedef struct LogBufferEntry { - bool alreadyAdded; // 0x00 - OSPlayRecord playRecord; // 0x08 + bool alreadyAdded; // 0x00 + OSPlayRecord playRecord; // 0x08 } LogBufferEntry; typedef struct LogBuffer { - LogBufferEntry entries[LOG_MAX_ENTRIES]; // 0x00 - OSTime extraTime; // 0x550 + LogBufferEntry entries[LOG_MAX_ENTRIES]; // 0x00 + OSTime extraTime; // 0x550 } LogBuffer; typedef struct SendMsgBufferEntry { - bool alreadyAdded; // 0x00 - wchar_t friendName[NWC24_FRIEND_NAME_LENGTH]; // 0x02 + bool alreadyAdded; // 0x00 + wchar_t friendName[NWC24_FRIEND_NAME_LENGTH]; // 0x02 } SendMsgBufferEntry; typedef struct SendMsgBuffer { - SendMsgBufferEntry entries[LOG_MAX_ENTRIES]; // 0x00 - int friendCount; // 0x104 + SendMsgBufferEntry entries[LOG_MAX_ENTRIES]; // 0x00 + int friendCount; // 0x104 } SendMsgBuffer; typedef struct EventBuffer { - u32 magic; // 0x00 - LogBuffer logBuf; // 0x08 - SendMsgBuffer sendMsg; // 0x560 + u32 magic; // 0x00 + LogBuffer logBuf; // 0x08 + SendMsgBuffer sendMsg; // 0x560 } EventBuffer; class PlayTimeLog { - public: - PlayTimeLog(); + public: + PlayTimeLog(); - static void log(); + static void log(); - static void sendMsgLog(const wchar_t* stringBuf); + static void sendMsgLog(const wchar_t* stringBuf); - BOOL check(CDBRecord* record); + BOOL check(CDBRecord* record); - private: - enum { - CHECK_STATUS_LOG = 0, - CHECK_STATUS_SENDMSG, - }; + private: + enum { + CHECK_STATUS_LOG = 0, + CHECK_STATUS_SENDMSG, + }; - static const int STRINGBUF_LIMIT = 2100; + static const int STRINGBUF_LIMIT = 2100; - void set_time_str(wchar_t* timeStr, u32 time); - void set_num_str(wchar_t* numStr, u32 num); + void set_time_str(wchar_t* timeStr, u32 time); + void set_num_str(wchar_t* numStr, u32 num); - wchar_t* create_text(const EventBuffer* event); + wchar_t* create_text(const EventBuffer* event); - void create_playlog_text(const LogBuffer* logBuffer, wchar_t* stringBuf, int stringLimit); - void create_sendmsg_text(const SendMsgBuffer* sendMsgBuffer, wchar_t* stringBuf, int stringLimit); - - void create_new_playlog(const OSPlayRecord* playRecord); - void create_new_sendmsglog(const wchar_t* stringBuf); - void create_new_record(const EventBuffer* event); + void create_playlog_text(const LogBuffer* logBuffer, wchar_t* stringBuf, int stringLimit); + void create_sendmsg_text(const SendMsgBuffer* sendMsgBuffer, wchar_t* stringBuf, int stringLimit); - void add_playlog(const OSPlayRecord* playRecord, CDBRecord* record); - void add_sendmsglog(const wchar_t* stringBuf, CDBRecord* record); + void create_new_playlog(const OSPlayRecord* playRecord); + void create_new_sendmsglog(const wchar_t* stringBuf); + void create_new_record(const EventBuffer* event); - u8* read_record(CDBRecord* record, EventBuffer* event); - void write_record(CDBRecord* record, EventBuffer* event, u8* buffer); + void add_playlog(const OSPlayRecord* playRecord, CDBRecord* record); + void add_sendmsglog(const wchar_t* stringBuf, CDBRecord* record); - BOOL create_at_once(cdb::Manager* cdbManager, const math::VEC2& boardPos, const wchar_t* titleText, const wchar_t* bodyText, const void** attachData, u32* attachSize, RBRAttachmentType* attachType) { - NWC24FriendAddr friendAddr; - memset(&friendAddr, 0, sizeof(NWC24FriendAddr)); + u8* read_record(CDBRecord* record, EventBuffer* event); + void write_record(CDBRecord* record, EventBuffer* event, u8* buffer); - return cdbManager-> createNewRecord("playtimelog", RBRFileType_Log, - &mDateTime, NULL, NULL, boardPos, RBRRecordType_PlayTimeLog, - friendAddr, NWC24_FRIENDTYPE_NONE, NWC24_MSGTYPE_RVL, titleText, bodyText, NULL, - attachData, attachSize, attachType); - } + bool mbCheckSucceed; // 0x00 + OSPlayRecord mPlayRecord; // 0x08 + OSCalendarTime mDateTime; + wchar_t mFriendNameBuf[NWC24_FRIEND_NAME_LENGTH]; // 0xB0 + int mCheckStatus; // 0xC8 - bool mbCheckSucceed; // 0x00 - OSPlayRecord mPlayRecord; // 0x08 - OSCalendarTime mDateTime; - wchar_t mFriendNameBuf[NWC24_FRIEND_NAME_LENGTH]; // 0xB0 - int mCheckStatus; // 0xC8 - - static PlayTimeLog smArg; + static PlayTimeLog smArg; }; -} +} // namespace ipl -#endif // IPL_PLAY_TIME_LOG_H +#endif // IPL_PLAY_TIME_LOG_H diff --git a/include/system/iplPointer.h b/include/system/iplPointer.h index 158c8a0e..47591e49 100644 --- a/include/system/iplPointer.h +++ b/include/system/iplPointer.h @@ -8,128 +8,131 @@ #include -#include "system/iplNand.h" #include "system/iplController.h" +#include "system/iplNand.h" #include "iplMath.h" #include "layout/iplLayout.h" -#define MAX_LAYOUT_FILES 9 +#define MAX_LAYOUT_FILES 9 namespace ipl { class Pointer; - + class PointerType { - public: - enum { - LayoutPoint = 0, - LayoutGrab, - LayoutUnknown2, - LayoutMax, /* ??? */ - }; - - enum { - StateNoScroll = 0, - StateScroll, - }; + public: + enum { + LayoutPoint = 0, + LayoutGrab, + LayoutUnknown2, + LayoutMax, /* ??? */ + }; + + enum { + StateNoScroll = 0, + StateScroll, + }; }; - + /** @warning Do not use `ipl::PointerCoreObject`, Please instead use `ipl::Pointer` */ class PointerCoreObject { - public: - PointerCoreObject(); + public: + PointerCoreObject(); - void calc(Pointer* pointer, const controller::Interface* pController); - void draw(); - - void setState(int newState) { mState = newState; } - void changeType(int newLayoutType) { mLayoutType = newLayoutType; } - - void setChan(int newChan) { mChan = newChan; } - int getChan() const { return mChan; } + void calc(Pointer* pointer, const controller::Interface* pController); + void draw(); - private: - layout::Object* mpLayout; // 0x00 - - int mState; // 0x04 - int mLayoutType; // 0x08 - int mChan; // 0x0C - - f32 unused_0x10; + void setState(int newState) { mState = newState; } + void changeType(int newLayoutType) { mLayoutType = newLayoutType; } + + void setChan(int newChan) { mChan = newChan; } + int getChan() const { return mChan; } + + private: + layout::Object* mpLayout; // 0x00 + + int mState; // 0x04 + int mLayoutType; // 0x08 + int mChan; // 0x0C + + f32 unused_0x10; }; - + /** @warning Do not use `ipl::PointerCore`, Please instead use `ipl::Pointer` */ class PointerCore { - public: - PointerCore(); - - void calc(Pointer* pointer); - void draw(); - - void setState(int chan, int state); - void changeType(int chan, int type); - - private: - PointerCoreObject mCursors[WPAD_MAX_CONTROLLERS]; // 0x00 + public: + PointerCore(); + + void calc(Pointer* pointer); + void draw(); + + void setState(int chan, int state); + void changeType(int chan, int type); + + private: + PointerCoreObject mCursors[WPAD_MAX_CONTROLLERS]; // 0x00 }; - + class Pointer { - public: - /** @param heap The memory heap used for work. */ - Pointer(EGG::Heap* heap); + public: + /** @param heap The memory heap used for work. */ + Pointer(EGG::Heap* heap); - /** @brief Updates the Wii Remote Pointers. */ - void calc(); - /** @brief Draws the Wii Remote Pointers. */ - void draw(); + /** @brief Updates the Wii Remote Pointers. */ + void calc(); + /** @brief Draws the Wii Remote Pointers. */ + void draw(); - /** - * @brief Changes the state of a Wii Remote Pointer. - * @param chan The Wii Remote Player (0 - 3) - * @param state The state that will change to. - */ - void setState(int chan, int state); - /** - * @brief Changes the Layout Type of a Wii Remote Pointer. - * @param chan The Wii Remote Player (1 - 4; exclusive) - * @param type The layout type that will change to. - */ - void changeType(int chan, int type); - /** - * @brief Gets the Layout Data of a Wii Remote Pointer. - * @param chan The Wii Remote Player (1 - 4; exclusive) - * @param type The layout type that will return. - * @return The Layout Data as `ipl::layout::Object` - */ - layout::Object* get_layout(int chan, int type); + /** + * @brief Changes the state of a Wii Remote Pointer. + * @param chan The Wii Remote Player (0 - 3) + * @param state The state that will change to. + */ + void setState(int chan, int state); + /** + * @brief Changes the Layout Type of a Wii Remote Pointer. + * @param chan The Wii Remote Player (1 - 4; exclusive) + * @param type The layout type that will change to. + */ + void changeType(int chan, int type); + /** + * @brief Gets the Layout Data of a Wii Remote Pointer. + * @param chan The Wii Remote Player (1 - 4; exclusive) + * @param type The layout type that will return. + * @return The Layout Data as `ipl::layout::Object` + */ + layout::Object* get_layout(int chan, int type); - void setVisible(bool value) { mbVisible = value; } - bool isVisible() { return mbVisible; } - - void setOrigin(f32 x, f32 y) { mOriginPos.x = x; mOriginPos.y = y; } - void setOrigin(math::VEC2 vec) { mOriginPos = vec; } - - void setArrowLength(f32 length) { mArrowLength = length; } - - private: - nand::LayoutFile* mpLayoutArchive; // 0x00 - layout::Object* mpLayout[MAX_LAYOUT_FILES]; // 0x04 - - int mIsScrolling; // 0x28 - math::VEC2 mOriginPos; // 0x2C + void setVisible(bool value) { mbVisible = value; } + bool isVisible() { return mbVisible; } - f32 mArrowLength; // 0x34 - int mPointDirection; // 0x38 + void setOrigin(f32 x, f32 y) { + mOriginPos.x = x; + mOriginPos.y = y; + } + void setOrigin(math::VEC2 vec) { mOriginPos = vec; } - bool mbScrolling; // 0x3C - bool mbVisible; // 0x3D - - PointerCore mCore; // 0x40 + void setArrowLength(f32 length) { mArrowLength = length; } + + private: + nand::LayoutFile* mpLayoutArchive; // 0x00 + layout::Object* mpLayout[MAX_LAYOUT_FILES]; // 0x04 + + int mIsScrolling; // 0x28 + math::VEC2 mOriginPos; // 0x2C + + f32 mArrowLength; // 0x34 + int mPointDirection; // 0x38 + + bool mbScrolling; // 0x3C + bool mbVisible; // 0x3D + + PointerCore mCore; // 0x40 friend class PointerCoreObject; friend class PointerCore; }; -} +} // namespace ipl -#endif // IPL_POINTER_H +#endif // IPL_POINTER_H diff --git a/include/system/iplPostmanManager.h b/include/system/iplPostmanManager.h index a6270c41..6de28144 100644 --- a/include/system/iplPostmanManager.h +++ b/include/system/iplPostmanManager.h @@ -3,84 +3,75 @@ #include -#include "utility/iplThread.h" #include "utility/iplMessageBase.h" +#include "utility/iplThread.h" #include namespace ipl { namespace postman { class Manager : public utility::ut_thread { - public: - enum { - STATE_NONE = 0, - STATE_RUN_RECEIVE, - STATE_STOP_RUN, - STATE_USBETHER_MAC, - STATE_DL_TASK, - STATE_UNKNOWN - }; - Manager(EGG::Heap* heap); - virtual ~Manager() {} + public: + enum { STATE_NONE = 0, STATE_RUN_RECEIVE, STATE_STOP_RUN, STATE_USBETHER_MAC, STATE_DL_TASK, STATE_UNKNOWN }; + Manager(EGG::Heap* heap); + virtual ~Manager() {} - void InitManager(); + void InitManager(); - void Send_ReceiveImmediately(); - void Send_Pause(); - void Send_Start(); - void Send_Stop(); - void Send_GetUsbEtherMacAddr(); - void Send_DownloadTaskReload(); + void Send_ReceiveImmediately(); + void Send_Pause(); + void Send_Start(); + void Send_Stop(); + void Send_GetUsbEtherMacAddr(); + void Send_DownloadTaskReload(); - virtual void* Run(); - - int Get_CurrentState() const { return mState; } - BOOL IsUnknown() { return mState != STATE_UNKNOWN; } - BOOL NotRunning() { return mState == STATE_STOP_RUN; } + virtual void* Run(); - void Start_RegistTask(EGG::TaskThread* task) { - task->request(register_nwc24, NULL, NULL); - } + int Get_CurrentState() const { return mState; } + BOOL IsUnknown() { return mState != STATE_UNKNOWN; } + BOOL NotRunning() { return mState == STATE_STOP_RUN; } - private: - enum { - MESSAGE_RECEIVE_IMMEDIATELY = 0, - MESSAGE_START, - MESSAGE_PAUSE, - MESSAGE_STOP, - MESSAGE_GET_USBETHER_MACADDR, - MESSAGE_DOWNLOADTASK_RELOAD, - }; + void Start_RegistTask(EGG::TaskThread* task) { task->request(register_nwc24, NULL, NULL); } - static void register_nwc24(void* work /*unused*/); + private: + enum { + MESSAGE_RECEIVE_IMMEDIATELY = 0, + MESSAGE_START, + MESSAGE_PAUSE, + MESSAGE_STOP, + MESSAGE_GET_USBETHER_MACADDR, + MESSAGE_DOWNLOADTASK_RELOAD, + }; - void suspend_scheduler_(); - void resume_scheduler_(); + static void register_nwc24(void* work /*unused*/); - void update_playlog_(); - void add_dl_task_(); - void save_mail_now_(); - void do_daily_tasks_(); - void manage_dltasklist_for_menu_(); - void receive_immediately_(); - void set_alarm_(); - void get_usb_ether_macaddr_(); - void set_nwc24_permission_(); + void suspend_scheduler_(); + void resume_scheduler_(); - void ncd_debug_print_(bool unused = true) NO_INLINE; - void ncd_debug_print_full_(); + void update_playlog_(); + void add_dl_task_(); + void save_mail_now_(); + void do_daily_tasks_(); + void manage_dltasklist_for_menu_(); + void receive_immediately_(); + void set_alarm_(); + void get_usb_ether_macaddr_(); + void set_nwc24_permission_(); - EGG::Heap* mpHeap; // 0x32C - void* mpThreadStack; // 0x330 - volatile int mState; // 0x334 - OSAlarm mAlarm; // 0x338 - utility::ut_message<32> mMessage; // 0x368 + void ncd_debug_print_(bool unused = true) NO_INLINE; + void ncd_debug_print_full_(); - static void alarm_handler_(OSAlarm* alarm, OSContext* context); + EGG::Heap* mpHeap; // 0x32C + void* mpThreadStack; // 0x330 + volatile int mState; // 0x334 + OSAlarm mAlarm; // 0x338 + utility::ut_message<32> mMessage; // 0x368 - static const int THREAD_STACK_SIZE = 0x8000; + static void alarm_handler_(OSAlarm* alarm, OSContext* context); + + static const int THREAD_STACK_SIZE = 0x8000; }; - } -} + } // namespace postman +} // namespace ipl -#endif // IPL_POSTMAN_MANAGER_H +#endif // IPL_POSTMAN_MANAGER_H diff --git a/include/system/iplResetHandler.h b/include/system/iplResetHandler.h index 6df95c6b..ebef120c 100644 --- a/include/system/iplResetHandler.h +++ b/include/system/iplResetHandler.h @@ -13,11 +13,7 @@ namespace ipl { RESET_STATE_SHUTDOWN_SYSTEM = 4, }; - enum { - STATE_WAIT_REQUEST = 0, - STATE_RESTART, - STATE_SHUTDOWN - }; + enum { STATE_WAIT_REQUEST = 0, STATE_RESTART, STATE_SHUTDOWN }; enum { FATAL_RESET_STATE_NONE = 0, @@ -27,51 +23,51 @@ namespace ipl { FATAL_RESET_STATE_SYSTEM }; - public: - ResetHandler(EGG::Heap* heap); + public: + ResetHandler(EGG::Heap* heap); - void reset(); - void powerOff() { cbPowerOff(); } + void reset(); + void powerOff() { cbPowerOff(); } - void setFatalResetCallback(); + void setFatalResetCallback(); - void check(); + void check(); - void update(); - void fatalUpdate(); + void update(); + void fatalUpdate(); - BOOL isResetting() const { return mState != STATE_WAIT_REQUEST; } - - /** - * This tells the reset handler to return to the system menu when resetting (calling `OSReturnToMenu()`) - * instead of rebooting the system (calling `OSRebootSystem()`) - */ - void enableResetToMenu() { mbReturnToMenu = TRUE; } - /** - * This tells the reset handler to reboot the system when resetting (calling `OSRebootSystem()`) - * instead of returning to the system menu (calling `OSReturnToMenu()`) - */ - void disableResetToMenu() { mbReturnToMenu = FALSE; } - /** - * Returns whether the reset handler to return to the system menu when resetting (calling `OSReturnToMenu()`) - * instead of rebooting the system (calling `OSRebootSystem()`) - */ - BOOL willResetToMenu() const { return mbReturnToMenu; } + BOOL isResetting() const { return mState != STATE_WAIT_REQUEST; } - private: - static void cbReset(); - static void cbPowerOff(); + /** + * This tells the reset handler to return to the system menu when resetting (calling `OSReturnToMenu()`) + * instead of rebooting the system (calling `OSRebootSystem()`) + */ + void enableResetToMenu() { mbReturnToMenu = TRUE; } + /** + * This tells the reset handler to reboot the system when resetting (calling `OSRebootSystem()`) + * instead of returning to the system menu (calling `OSReturnToMenu()`) + */ + void disableResetToMenu() { mbReturnToMenu = FALSE; } + /** + * Returns whether the reset handler to return to the system menu when resetting (calling `OSReturnToMenu()`) + * instead of rebooting the system (calling `OSRebootSystem()`) + */ + BOOL willResetToMenu() const { return mbReturnToMenu; } - static void cbFatalReset(); - static void cbFatalPowerOff(); + private: + static void cbReset(); + static void cbPowerOff(); - u32 mUpdateState; // 0x00 - vu32 mState; // 0x04 - public: - volatile BOOL mbReturnToMenu; // 0x08 - private: - u32 mFatalResetState; // 0x0C + static void cbFatalReset(); + static void cbFatalPowerOff(); + + u32 mUpdateState; // 0x00 + vu32 mState; // 0x04 + public: + volatile BOOL mbReturnToMenu; // 0x08 + private: + u32 mFatalResetState; // 0x0C }; -} +} // namespace ipl -#endif // IPL_RESET_HANDLER_H +#endif // IPL_RESET_HANDLER_H diff --git a/include/system/iplSDVFWorker.h b/include/system/iplSDVFWorker.h index 259bf41a..195d9113 100644 --- a/include/system/iplSDVFWorker.h +++ b/include/system/iplSDVFWorker.h @@ -3,132 +3,132 @@ #include -#include -#include #include +#include +#include namespace ipl { - #define FAT_PAGES 4 - #define DATA_PAGES 4 - #define TOTAl_PAGES (FAT_PAGES + DATA_PAGES) - #define STACK_SIZE 0x20000 +#define FAT_PAGES 4 +#define DATA_PAGES 4 +#define TOTAl_PAGES (FAT_PAGES + DATA_PAGES) +#define STACK_SIZE 0x20000 class SDVFWorker { - public: - typedef enum WorkMessage { - MESSAGE_NONE = 0, - MESSAGE_TERMINATE, - MESSAGE_MOUNT_SD, - MESSAGE_FORMAT_SD, - MESSAGE_UNUSED_4, - MESSAGE_PREPARE_CDB_BACKUP, - MESSAGE_CLEANUP_CDB_BACKUP, - } WorkMessage; + public: + typedef enum WorkMessage { + MESSAGE_NONE = 0, + MESSAGE_TERMINATE, + MESSAGE_MOUNT_SD, + MESSAGE_FORMAT_SD, + MESSAGE_UNUSED_4, + MESSAGE_PREPARE_CDB_BACKUP, + MESSAGE_CLEANUP_CDB_BACKUP, + } WorkMessage; - typedef enum WorkState { - STATE_IDLE = 0, - STATE_WORKING, - } WorkState; + typedef enum WorkState { + STATE_IDLE = 0, + STATE_WORKING, + } WorkState; - typedef enum WorkSDState { - SD_STATE_UNAVAILABLE = 0, - SD_STATE_EJECTED, - SD_STATE_INSERTED, - SD_STATE_BROKEN, - SD_STATE_ERROR, - SD_STATE_AVAILABLE, - } WorkSDState; + typedef enum WorkSDState { + SD_STATE_UNAVAILABLE = 0, + SD_STATE_EJECTED, + SD_STATE_INSERTED, + SD_STATE_BROKEN, + SD_STATE_ERROR, + SD_STATE_AVAILABLE, + } WorkSDState; - enum { - RESULT_SUCCESS = 0, - RESULT_STILL_WORKING = -1, - RESULT_FATAL_SD_ERROR = -2, - RESULT_NAND_CORRUPT = -5, // Unused but checked by CdbBackup - RESULT_OUT_OF_SPACE = -7, - RESULT_FA_ERROR = -8, - RESULT_SD_BROKEN = -9, - RESULT_SD_ERROR = -10, - RESULT_WRITE_PROTECTED = -11, - }; + enum { + RESULT_SUCCESS = 0, + RESULT_STILL_WORKING = -1, + RESULT_FATAL_SD_ERROR = -2, + RESULT_NAND_CORRUPT = -5, // Unused but checked by CdbBackup + RESULT_OUT_OF_SPACE = -7, + RESULT_FA_ERROR = -8, + RESULT_SD_BROKEN = -9, + RESULT_SD_ERROR = -10, + RESULT_WRITE_PROTECTED = -11, + }; - private: - typedef struct Work { - FACacheBuf cacheBuf[TOTAl_PAGES]; // 0x00 - FACachePage cachePages[TOTAl_PAGES]; // 0x1000 + private: + typedef struct Work { + FACacheBuf cacheBuf[TOTAl_PAGES]; // 0x00 + FACachePage cachePages[TOTAl_PAGES]; // 0x1000 - FADrvTbl driveTable; // 0x1140 + FADrvTbl driveTable; // 0x1140 - FACacheSetting cacheSetting; // 0x114C + FACacheSetting cacheSetting; // 0x114C - u8 threadStack[STACK_SIZE]; // 0x1160 - OSThread thread; // 0x21160 + u8 threadStack[STACK_SIZE]; // 0x1160 + OSThread thread; // 0x21160 - OSMutex mutex; // 0x21478 + OSMutex mutex; // 0x21478 - OSMessageQueue msgQueue; // 0x21490 - OSMessage messages[8]; // 0x214B0 + OSMessageQueue msgQueue; // 0x21490 + OSMessage messages[8]; // 0x214B0 - WorkState workState; // 0x214D0 - int asyncResult; // 0x214D4 - BOOL isWriteProtected; // 0x214D8 - int prevAsyncResult; // 0x214DC - int priority; // 0x214E0 - int unused_0x214E4; - } Work; + WorkState workState; // 0x214D0 + int asyncResult; // 0x214D4 + BOOL isWriteProtected; // 0x214D8 + int prevAsyncResult; // 0x214DC + int priority; // 0x214E0 + int unused_0x214E4; + } Work; - public: - static const int WORK_SIZE = sizeof(Work); + public: + static const int WORK_SIZE = sizeof(Work); - SDVFWorker(); + SDVFWorker(); - void create(void* work, int priority); + void create(void* work, int priority); - BOOL is_terminated(); - BOOL is_working(); + BOOL is_terminated(); + BOOL is_working(); - int get_async_result(); - WorkSDState get_sd_state(); + int get_async_result(); + WorkSDState get_sd_state(); - BOOL is_sd_write_protected(); + BOOL is_sd_write_protected(); - void terminate_async(); - void mount_sd_async(); + void terminate_async(); + void mount_sd_async(); - void prepare_cdb_backup_to_sd_async(); - void cleanup_cdb_backup_to_sd_async(); + void prepare_cdb_backup_to_sd_async(); + void cleanup_cdb_backup_to_sd_async(); - void do_mount_sd(); - void do_format_sd(); + void do_mount_sd(); + void do_format_sd(); - int call_fa_mount(); + int call_fa_mount(); - void send_work(WorkMessage messsage); - WorkMessage wait_work(); + void send_work(WorkMessage messsage); + WorkMessage wait_work(); - WorkState get_state(); - void set_state(WorkState state); + WorkState get_state(); + void set_state(WorkState state); - private: - void* run(); + private: + void* run(); - static void sd_insert_callback(s8 drive); - static void sd_eject_callback(s8 drive); + static void sd_insert_callback(s8 drive); + static void sd_eject_callback(s8 drive); - /** - * @brief Handles FA error code - * @param err The FA error code to handle - * @param resultOut The SDVFWorker result, NULL by default - * @return ...The SDVFWorker result - */ - s32 handle_sd_error(FAError err, s32* resultOut = NULL); + /** + * @brief Handles FA error code + * @param err The FA error code to handle + * @param resultOut The SDVFWorker result, NULL by default + * @return ...The SDVFWorker result + */ + s32 handle_sd_error(FAError err, s32* resultOut = NULL); - static void* thread_main(void* work); + static void* thread_main(void* work); - static WorkSDState s_sd_state; - static bool s_sd_inserted; + static WorkSDState s_sd_state; + static bool s_sd_inserted; - Work* myWork; // 0x00 + Work* myWork; // 0x00 }; -} +} // namespace ipl -#endif // IPL_H +#endif // IPL_SDVF_WORKER_H diff --git a/include/system/iplSaveDataManager.h b/include/system/iplSaveDataManager.h index 4a4494cb..ee02259a 100644 --- a/include/system/iplSaveDataManager.h +++ b/include/system/iplSaveDataManager.h @@ -1,8 +1,8 @@ #ifndef IPL_SAVE_DATA_MANAGER_H #define IPL_SAVE_DATA_MANAGER_H -#include #include +#include #include #include @@ -12,7 +12,7 @@ #include "keyboard/tiSaveData.h" #include "system/iplNand.h" -#define SAVEDATA_VERSION 3 +#define SAVEDATA_VERSION 3 namespace ipl { namespace channel { @@ -20,135 +20,135 @@ namespace ipl { } namespace savedata { class Manager { - public: - Manager(EGG::Heap* heap); - virtual ~Manager(); + public: + Manager(EGG::Heap* heap); + virtual ~Manager(); - void initManager(); + void initManager(); - void setPrevPage(int prevPage); - void setChanInfo(int page, int index, const channel::SInfo& chanInfo); - void setMemoSetting(const textinput::extend::savedata::MemoSetting& memoSetting); + void setPrevPage(int prevPage); + void setChanInfo(int page, int index, const channel::SInfo& chanInfo); + void setMemoSetting(const textinput::extend::savedata::MemoSetting& memoSetting); - nand::File* flushAsync(EGG::Heap* flushHeap); + nand::File* flushAsync(EGG::Heap* flushHeap); - ESTitleId hasChannel(ESTitleId titleId, int* outIndex = NULL, int* outPage = NULL) const; + ESTitleId hasChannel(ESTitleId titleId, int* outIndex = NULL, int* outPage = NULL) const; - int getNumValidChannel() const; + int getNumValidChannel() const; - BOOL isFinished(nand::File* file); - BOOL isResetAcceptable(); + BOOL isFinished(nand::File* file); + BOOL isResetAcceptable(); - void setDefaultSaveData(); - void updateVersion(u32 newVersion, u32 oldVersion); + void setDefaultSaveData(); + void updateVersion(u32 newVersion, u32 oldVersion); - BOOL updateChanInfos(); + BOOL updateChanInfos(); - void setLastPrevPage(int page) { mLastPrevPage = page; } - - int getPrevPage() { return mLastPrevPage; } + void setLastPrevPage(int page) { mLastPrevPage = page; } - bool hasPhotoMP3Dummy() { return mbPhotoMP3; } - bool hasPhoto2Title() { return mbPhoto2; } - bool hasPhoto2DummyCheck() { return mbPhoto2Check; } + int getPrevPage() { return mLastPrevPage; } - ESTitleId getPhotoID() { return mPhotoId; } + bool hasPhotoMP3Dummy() { return mbPhotoMP3; } + bool hasPhoto2Title() { return mbPhoto2; } + bool hasPhoto2DummyCheck() { return mbPhoto2Check; } - channel::SInfo& getChanInfo(int page, int index) { return mData.chanInfo[page][index]; } - textinput::extend::savedata::MemoSetting getMemoSetting() { return mData.memoSetting; } + ESTitleId getPhotoID() { return mPhotoId; } - private: - BOOL checkValidApp(ESTitleId titleId); + channel::SInfo& getChanInfo(int page, int index) { return mData.chanInfo[page][index]; } + textinput::extend::savedata::MemoSetting getMemoSetting() { return mData.memoSetting; } - static void initManagerTask(void* work); - static void initManagerTask_(); + private: + BOOL checkValidApp(ESTitleId titleId); - void setDefaultHeader(); - void setDefaultSDMenu(); - void setDefaultKeyboard(); - void setDefaultTVRC(); + static void initManagerTask(void* work); + static void initManagerTask_(); - void deleteInvalidTitle(ESTitleId* titleIds, u32 titleCount); - void checkSpecialTitles(ESTitleId* titleIds, u32 titleCount); - void checkTmpTitle(ESTitleId* titleIds, u32 titleCount); + void setDefaultHeader(); + void setDefaultSDMenu(); + void setDefaultKeyboard(); + void setDefaultTVRC(); - int getAvailableInList(const ESTitleId* titleIds, u32 titleCount); - int getAvailableNumInList(const ESTitleId* titleIds, u32 titleCount); - - int isEqualChannel(ESTitleId titleId0, ESTitleId titleId1); - int isDefaultChannel(ESTitleId32 titleType, ESTitleId32 titleCode); + void deleteInvalidTitle(ESTitleId* titleIds, u32 titleCount); + void checkSpecialTitles(ESTitleId* titleIds, u32 titleCount); + void checkTmpTitle(ESTitleId* titleIds, u32 titleCount); - void makePriorTitleIDList(ESTitleId* titleIdsOut, ESTitleId* titleIdsIn, u32 titleCount); - void integrateTitleIDList(ESTitleId* titleIdsOut, ESTitleId* titleIdsIn, u32 titleCount); - - BOOL doUpdateChanInfos(ESTitleId* titleIds); + int getAvailableInList(const ESTitleId* titleIds, u32 titleCount); + int getAvailableNumInList(const ESTitleId* titleIds, u32 titleCount); - BOOL nand_error_handling(int code); + int isEqualChannel(ESTitleId titleId0, ESTitleId titleId1); + int isDefaultChannel(ESTitleId32 titleType, ESTitleId32 titleCode); - /** - * VERSION HISTORY - * =============== - * Version 1 - Initial version - * Version 2 - Same as version 1 but memoSetting is initialized differently. - * Version 3 - Add SD Card menu save data and `titleCache` - */ - // CURRENT VERSION IS 3 !! - typedef struct Data { - // Meta data - u8 sig[4]; // 0x00 (Always `RIPL`) - u32 fileSize; // 0x04 - u32 version; // 0x08 + void makePriorTitleIDList(ESTitleId* titleIdsOut, ESTitleId* titleIdsIn, u32 titleCount); + void integrateTitleIDList(ESTitleId* titleIdsOut, ESTitleId* titleIdsIn, u32 titleCount); - // Channel related - int prevPage; // 0x0C - channel::SInfo chanInfo[MAX_CHANNEL_PAGE][MAX_CHANNEL_INDEX]; // 0x10 + BOOL doUpdateChanInfos(ESTitleId* titleIds); - // Keyboard - textinput::extend::savedata::MemoSetting memoSetting; // 0x310 + BOOL nand_error_handling(int code); - // TVRC Data - u8 tvrcData[4]; // 0x318 + /** + * VERSION HISTORY + * =============== + * Version 1 - Initial version + * Version 2 - Same as version 1 but memoSetting is initialized differently. + * Version 3 - Add SD Card menu save data and `titleCache` + */ + // CURRENT VERSION IS 3 !! + typedef struct Data { + // Meta data + u8 sig[4]; // 0x00 (Always `RIPL`) + u32 fileSize; // 0x04 + u32 version; // 0x08 - /* VERSION 3 DATA */ - - BOOL didntGotoSDMenu; // 0x31C - ESTitleId titleCache[MAX_CHANNEL_PAGE][MAX_CHANNEL_INDEX]; // 0x320 - int prevSDPage; // 0x4A0 - - /* END OF VERSION 3 DATA */ + // Channel related + int prevPage; // 0x0C + channel::SInfo chanInfo[MAX_CHANNEL_PAGE][MAX_CHANNEL_INDEX]; // 0x10 - u8 padding[0x0C]; // 0x4A4 + // Keyboard + textinput::extend::savedata::MemoSetting memoSetting; // 0x310 - // Sums - u8 MD5Sum[NET_MD5_DIGEST_SIZE]; // 0x4B0 - } Data; - - EGG::Heap* mpHeap; // 0x04 - u8 unused_0x08[24]; + // TVRC Data + u8 tvrcData[4]; // 0x318 - Data mData; // 0x20 + /* VERSION 3 DATA */ - int mLastPrevPage; // 0x4E0 - int mLastSDPrevPage; // 0x4E4 - bool mbBadSDPrevPage; // 0x4E8 + BOOL didntGotoSDMenu; // 0x31C + ESTitleId titleCache[MAX_CHANNEL_PAGE][MAX_CHANNEL_INDEX]; // 0x320 + int prevSDPage; // 0x4A0 - nand::File* mpFile; // 0x4EC - nand::File* mpUpdatedFile; // 0x4F0 + /* END OF VERSION 3 DATA */ - bool mbInit; // 0x4F4 + u8 padding[0x0C]; // 0x4A4 - bool mbPhoto2; // 0x4F5 - bool mbPhoto2Check; // 0x4F6 - bool mbPhotoMP3; // 0x4F7 - ESTitleId mPhotoId; // 0x4F8 + // Sums + u8 MD5Sum[NET_MD5_DIGEST_SIZE]; // 0x4B0 + } Data; - int mLastError; // 0x500 + EGG::Heap* mpHeap; // 0x04 + u8 unused_0x08[24]; - u8 unused_0x504[28]; + Data mData; // 0x20 - friend class channel::Manager; + int mLastPrevPage; // 0x4E0 + int mLastSDPrevPage; // 0x4E4 + bool mbBadSDPrevPage; // 0x4E8 + + nand::File* mpFile; // 0x4EC + nand::File* mpUpdatedFile; // 0x4F0 + + bool mbInit; // 0x4F4 + + bool mbPhoto2; // 0x4F5 + bool mbPhoto2Check; // 0x4F6 + bool mbPhotoMP3; // 0x4F7 + ESTitleId mPhotoId; // 0x4F8 + + int mLastError; // 0x500 + + u8 unused_0x504[28]; + + friend class channel::Manager; }; - } -} + } // namespace savedata +} // namespace ipl -#endif // IPL_SAVE_DATA_MANAGER_H +#endif // IPL_SAVE_DATA_MANAGER_H diff --git a/include/system/iplSocketSetting.h b/include/system/iplSocketSetting.h index 702b735f..db59502e 100644 --- a/include/system/iplSocketSetting.h +++ b/include/system/iplSocketSetting.h @@ -10,29 +10,29 @@ namespace ipl { namespace socket { class SocketSetting { - public: - static const char* getLANMacAddrUtf8(); + public: + static const char* getLANMacAddrUtf8(); - static BOOL init(void* work /*unused*/); - static void finish(); + static BOOL init(void* work /*unused*/); + static void finish(); - static void convertLANMacAddr(); - static void obtainLANMacAddr(void* work); - static bool checkLANMacAddrAvailable(); + static void convertLANMacAddr(); + static void obtainLANMacAddr(void* work); + static bool checkLANMacAddrAvailable(); - private: - static void* allocfunc(u32 unk, s32 size); - static void freefunc(u32 unk, void* buffer, s32 size); + private: + static void* allocfunc(u32 unk, s32 size); + static void freefunc(u32 unk, void* buffer, s32 size); - static char mMac[64]; + static char mMac[64]; - static MEMHeapHandle mpHeap; - static void* mpHeapBuf; + static MEMHeapHandle mpHeap; + static void* mpHeapBuf; - static u8 mMacAddr[NCD_MAC_ADDRESS_LENGTH]; - static bool isMacAddr; + static u8 mMacAddr[NCD_MAC_ADDRESS_LENGTH]; + static bool isMacAddr; }; - } -} + } // namespace socket +} // namespace ipl -#endif // IPL_SOCKET_SETTING_H +#endif // IPL_SOCKET_SETTING_H diff --git a/include/system/iplSystem.h b/include/system/iplSystem.h index f324be05..b3aeac3f 100644 --- a/include/system/iplSystem.h +++ b/include/system/iplSystem.h @@ -5,37 +5,37 @@ #include -#include #include +#include #include #include -#include "system/iplFramework.h" -#include "system/iplException.h" -#include "system/iplNandManager.h" -#include "system/iplController.h" -#include "system/iplErrorHandler.h" -#include "system/iplResetHandler.h" -#include "system/iplWarningHandler.h" -#include "system/iplDialogWindow.h" -#include "system/iplPointer.h" -#include "system/iplHomeButton.h" -#include "system/iplTVRCManager.h" -#include "system/iplChannelManager.h" -#include "system/iplChannelScriptManager.h" -#include "system/iplMessageManager.h" -#include "system/iplSaveDataManager.h" -#include "system/iplKeyboard.h" -#include "system/iplNwc24Manager.h" -#include "system/iplPostmanManager.h" -#include "system/iplNigaoeManager.h" +#include "scene/iplSceneManager.h" #include "system/iplBS2Manager.h" #include "system/iplCdbManager.h" -#include "scene/iplSceneManager.h" -#include "utility/iplJpegDecoder.h" +#include "system/iplChannelManager.h" +#include "system/iplChannelScriptManager.h" +#include "system/iplController.h" +#include "system/iplDialogWindow.h" +#include "system/iplErrorHandler.h" +#include "system/iplException.h" +#include "system/iplFramework.h" +#include "system/iplHomeButton.h" +#include "system/iplKeyboard.h" +#include "system/iplMessageManager.h" +#include "system/iplNandManager.h" +#include "system/iplNigaoeManager.h" +#include "system/iplNwc24Manager.h" +#include "system/iplPointer.h" +#include "system/iplPostmanManager.h" +#include "system/iplResetHandler.h" +#include "system/iplSaveDataManager.h" +#include "system/iplTVRCManager.h" +#include "system/iplWarningHandler.h" #include "utility/iplCalendar.h" +#include "utility/iplJpegDecoder.h" #include @@ -50,17 +50,17 @@ * @brief Display the error screen. * @param msgId The Message ID (`iplErrorHandler.h` has the list of available IDs) */ -#define IPLErrorDisplay(msgId) ipl::System::getErrorHandler()->set(ipl::ErrorHandler::DEFAULT, msgId) +#define IPLErrorDisplay(msgId) ipl::System::getErrorHandler()->set(ipl::ErrorHandler::DEFAULT, msgId) /** * @brief Display the warning dialog. * @param msgId The Message ID. */ -#define IPLWarnDisplay(msgId) ipl::System::getWarningHandler()->set(ipl::WarningHandler::DEFAULT, msgId) +#define IPLWarnDisplay(msgId) ipl::System::getWarningHandler()->set(ipl::WarningHandler::DEFAULT, msgId) /** * @brief Display the warning dialog and then reset. * @param msgId The Message ID. */ -#define IPLWarnDisplayAndReset(msgId) ipl::System::getWarningHandler()->set(ipl::WarningHandler::RESET, msgId) +#define IPLWarnDisplayAndReset(msgId) ipl::System::getWarningHandler()->set(ipl::WarningHandler::RESET, msgId) /** * @brief Log the result to the NAND log. (`shared2/test2/nanderr.log`) and then displays error screen. * @param msgId The Message ID (`iplErrorHandler.h` has the list of available IDs) @@ -68,629 +68,629 @@ * @param result The result * @param line The line number */ -#define IPLErrorLogAndDisplay(msgId, type, result, line) { \ - IPLErrorLog(type, result, line); \ - IPLErrorDisplay(msgId); \ -} +#define IPLErrorLogAndDisplay(msgId, type, result, line) \ + { \ + IPLErrorLog(type, result, line); \ + IPLErrorDisplay(msgId); \ + } namespace ipl { class System { + public: + enum { + LAUNCH_CODE_SETTING = 1, + LAUNCH_CODE_DATA_MANAGER = 2, + }; + class Arg { public: - enum { - LAUNCH_CODE_SETTING = 1, - LAUNCH_CODE_DATA_MANAGER = 2, - }; - class Arg { - public: - Arg(); - - private: - EGG::Heap* mpMem1Root; // 0x00 - EGG::Heap* mpMem2Root; // 0x04 - EGG::Heap* mpMem1Sys; // 0x08 - EGG::Heap* mpMem2Sys; // 0x0C - EGG::Heap* mpSceneHeap; // 0x10 - EGG::Heap* mpSoundHeap; // 0x14 - EGG::Heap* mpChannelHeap; // 0x18 - void* unk_0x1C; - EGG::Heap* mpSharedHeap; // 0x20 - EGG::Heap* mpMem1App; // 0x24 - EGG::Heap* mpMem2App; // 0x28 - EGG::Heap* mpTreasureHeap; // 0x2C - void* mpChannelArena; // 0x30 - EGG::Heap* mpFontHeap; // 0x34 - EGG::Heap* mpMailHeap; // 0x38 - - OSCalendarTime mCurrentTime; // 0x3C - - scene::Manager* mpSceneManager; // 0x64 - controller::Manager* mpControllerManager; // 0x68 - nand::Manager* mpNandManager; // 0x6C - nigaoe::Manager* mpMiiManager; // 0x70 - Framework* mpFramework; // 0x74 - Exception* mpException; // 0x78 - cdb::Manager* mpCdbManager; // 0x7C - message::Manager* mpMessageMgr; // 0x80 - channel::Manager* mpChannelManager; // 0x84 - channel::ChannelScriptManager* mpChannelScriptManager; // 0x88 - nwc24::Manager* mpNwc24Manager; // 0x8C - keyboard::Manager* mpKeyboardMgr; // 0x90 - savedata::Manager* mpSaveDataManager; // 0x94 - ErrorHandler* mpErrorHandler; // 0x98 - ResetHandler* mpResetHandler; // 0x9C - WarningHandler* mpWarningHandler; // 0xA0 - postman::Manager* mpPostmanManager; // 0xA4 - bs2::Manager* mpBS2Manager; // 0xA8 - DialogWindow* mpDialog; // 0xAC - Pointer* mpPointer; // 0xB0 - HomeButtonMenu* mpHomeButton; // 0xB4 - TVRCManager* mpTVRCManager; // 0xB8 - utility::JpegDecoder* mpJpegDecoder; // 0xBC - EGG::Thread* mpMainThread; // 0xC0 - EGG::ColorFader* mpFader; // 0xC4 - EGG::ColorFader* mpResetFader; // 0xC8 - math::Random* mpRandom; // 0xCC - - EGG::TaskThread* mpTask1; // 0xD0 - EGG::TaskThread* mpTask2; // 0xD4 - EGG::TaskThread* mpTask3; // 0xD8 - - nw4r::ut::Font* mpWBFont1Data; // 0xDC - nand::SharedFile* mpWBF1File; // 0xE0 - nw4r::ut::Font* mpWBFont2Data; // 0xE4 - nand::SharedFile* mpWBF2File; // 0xE8 - - enum { - FONT, - RSO_SYM_LIST, - SOUND, - SOFT_KEYBOARD, - RES_4, // unused - FACE, - HBM_LAYOUT, - HBM_LANG, - HBM_LANG_JPN = HBM_LANG, - HBM_LANG_ENG, - HBM_LANG_GER, - HBM_LANG_FRA, - HBM_LANG_SPA, - HBM_LANG_ITA, - HBM_LANG_NED, - HBM_LANG_CHN, - HBM_LANG_CHN_TRAD, // unused - HBM_LANG_KOR, - MESSAGES, - MESG_ENG = MESSAGES, - MESG_FRA, - MESG_GER, - MESG_ITA, - MESG_JPN, - MESG_NED, - MESG_SPA, - MESG_CHN, - MESG_CHN_TRAD, // unused - MESG_KOR, - RES_27, // unused - HBM_MESSAGE, - HBM_CONFIG, - HBM_SPEAKER_SOUND, - HBM_BAN_ICON, - RES_32, // unused - RES_33, // unused - RES_34, // unused - ZI_DICT, - NINTENDO_DICT, - INVALID_JPEG, - RES_38, // unused - RES_39, // unused - DIALOG_WINDOW, - MAX_RES - }; - - union { - nand::File* file[MAX_RES]; - nand::SharedFile* sharedFile[MAX_RES]; - nand::LayoutFile* layoutFile[MAX_RES]; - } mResources; // 0xEC - - union { - struct { - u8* sys[EZTX_LANG_MAX]; - u8* oem[EZTX_LANG_MAX]; - }; - u8* all[EZTX_LANG_MAX * 2]; - } mZiDicData; // 0x190 - - OSAlarm mUnusedAlarm; // 0x1E0 - - void* mpFontArena; // 0x210 - void* mpMem1Arena; // 0x214 - u32 mMem1ArenaSize; // 0x218 - - u32 mBS2BootType; // 0x21C - u32 mBS2LaunchCode; // 0x220 - u32 unk_0x224; - char* mpNetSettingArg; // 0x228 - char* mpDataManageArg; // 0x22C - char mBS2FirstArgv[128]; // 0x230 - - volatile bool mbResLoaded; // 0x2B0 - bool mbInitCreateAfter; // 0x2B1 - volatile bool mbCreatedAfter; // 0x2B2 - bool mbLibraryInit; // 0x2B3 - bool mbCreatedLibMgr; // 0x2B4 - bool unused_0x2B5; - volatile bool mbFontResLoaded; // 0x2B6 - volatile bool mbSndResLoaded; // 0x2B7 - volatile bool mbZi8ResLoaded; // 0x2B8 - volatile bool mbNeedToCreateFolders; // 0x2B9 - volatile bool mbNWC24LibError; // 0x2BA - volatile bool mbIsNandFull; // 0x2BB - volatile bool mbSafeMode; // 0x2BC - bool mbStartNewMainAmn; // 0x2BD - volatile bool mbRequestCreateAfter; // 0x2BE - bool mbRequestCreateLibMgr; // 0x2BF - - enum { - REGIST_STATE_START = 0, - REGIST_STATE_DOING, - REGIST_STATE_END, - }; - - vs32 mRegistState; // 0x2C0 - vs32 mRegistErrCode; // 0x2C4 - volatile bool mbGoingToDataManager; // 0x2C8 - u8 unk_0x2CC[0x2D0 - 0x2CC]; - ESTitleId mBS2LaunchTitle; // 0x2B0 - - friend class System; - }; - - /*==============================*/ - /* THREADING */ - /*==============================*/ - - static EGG::Thread* getMainThread() { return smArg.mpMainThread; } - static EGG::TaskThread* getTask1() { return smArg.mpTask1; } - static EGG::TaskThread* getTask2() { return smArg.mpTask2; } - static EGG::TaskThread* getTask3() { return smArg.mpTask3; } - - /*==============================*/ - /* MEMORY HEAP */ - /*==============================*/ - - static EGG::Heap* createMem1AppHeap(); - static void destroyMem1AppHeap(); - - static void setCurrentHeap(EGG::Heap* heap); - - static EGG::Heap* getMem1Root() { return smArg.mpMem1Root; } - static EGG::Heap* getMem2Root() { return smArg.mpMem2Root; } - static EGG::Heap* getMem1Sys() { return smArg.mpMem1Sys; } - static EGG::Heap* getMem2Sys() { return smArg.mpMem2Sys; } - static EGG::Heap* getMem1App() { return smArg.mpMem1App; } - static EGG::Heap* getMem2App() { return smArg.mpMem2App; } - static EGG::Heap* getSceneHeap() { return smArg.mpSceneHeap; } - static EGG::Heap* getSoundHeap() { return smArg.mpSoundHeap; } - static EGG::Heap* getChannelHeap() { return smArg.mpChannelHeap; } - static EGG::Heap* getSharedHeap() { return smArg.mpSharedHeap; } - static EGG::Heap* getTreasureHeap() { return smArg.mpTreasureHeap; } - static void* getChannelArena() { return smArg.mpChannelArena; } - static EGG::Heap* getFontHeap() { return smArg.mpFontHeap; } - static EGG::Heap* getMailWorkHeap() { return smArg.mpMailHeap; } - - /*==============================*/ - /* SYSTEM RESOURCES */ - /*==============================*/ - - static bool isCmnResLoaded() { return smArg.mbResLoaded; } - - static bool isFontResLoaded() { return smArg.mbFontResLoaded; } - static bool isSndResLoaded() { return smArg.mbSndResLoaded; } - static bool isZi8ResLoaded() { return smArg.mbZi8ResLoaded; } - - static bool hasNWC24LibError() { return smArg.mbNWC24LibError; } - static void resetNWC24LibState() { smArg.mbNWC24LibError = false; } - - static bool isRsrcLoaded() { return smArg.mbResLoaded - && smArg.mbFontResLoaded - && smArg.mbSndResLoaded -#ifdef USE_ZI8 - && smArg.mbZi8ResLoaded -#endif // USE_ZI8 - ; } - - /** @return The Message ID as a Wide-string. */ - static const wchar_t* getMessage(u32 id) { return smArg.mpMessageMgr->getMessage(id); } - static message::Manager* getMessageManager() { return smArg.mpMessageMgr; } - - static void* getFont(); - /** @return The Wii Bitmap Font 1 Data. (wbf1.brfna) */ - static nw4r::ut::Font* getWBFont1Data() { return smArg.mpWBFont1Data; } - /** @return The Wii Bitmap Font 2 Data. (wbf2.brfna) */ - static nw4r::ut::Font* getWBFont2Data() { return smArg.mpWBFont2Data; } - - /*==============================*/ - /* SYSTEM */ - /*==============================*/ - - /** - * Initializes the IPL. - * @param argc The amount of arguments passed, - * @param argv Array of arguments. - */ - static void init(int argc, char** argv); - static void reinit(); - - /** - * Run the IPL. - * @note This function must be called after `ipl::System::init` - */ - static void run(); - - /** Cancels all running tasks */ - static void cancelThread(); - - /** Gets the boot argument from BS2's argv */ - static void getBootArg(int argc, char** argv); - - static bool hasCreatedAfter() { return smArg.mbCreatedAfter; } - static bool hasCreatedLibMgr() { return smArg.mbCreatedLibMgr; } - - static volatile bool createdAfterAndLibMgr() { return smArg.mbCreatedAfter && smArg.mbCreatedLibMgr; } - - static void requestCreateAfter() { smArg.mbRequestCreateAfter = true; } - static void requestCreateLibManager() { smArg.mbRequestCreateLibMgr = true; } - - static void stopCreateAfterReq() { smArg.mbRequestCreateAfter = false; } - static void stopCreateLibManagerReq() { smArg.mbRequestCreateLibMgr = false; } - - static bool goingToDataManager() { return smArg.mbGoingToDataManager; } - - // This is a guess, judging by how it's used. - static bool requestedNewMailAnm() { return smArg.mbStartNewMainAmn; } - static void requestNewMailAnm() { smArg.mbStartNewMainAmn = true; } - static void stopRequestNewMailAnm() { smArg.mbStartNewMainAmn = false; } - - /*==============================*/ - /* SYSTEM BS2 */ - /*==============================*/ - - /** @return The BS2 Manager object. */ - static bs2::Manager* getBS2Manager() { return smArg.mpBS2Manager; } - - static u32 getBS2BootType() { return smArg.mBS2BootType; } - static u32 getBS2LaunchCode() { return smArg.mBS2LaunchCode; } - static ESTitleId getBS2LaunchTitle() { return smArg.mBS2LaunchTitle; } - - static char* getNetSettingArg() { return smArg.mpNetSettingArg; } - static char* getDataManagerArg() { return smArg.mpDataManageArg; } - - /*==============================*/ - /* WII CONTROLLERS */ - /*==============================*/ - - /** - * @return The Wii Remote being used. - * @param chan The Wii Remote Player - */ - static controller::Interface* getController(int chan); - /** @return The Master Wii Remote. */ - static controller::Interface* getMasterController(); - /** @return The Young Wii Remote. */ - static controller::Interface* getYoungController(); - /** @return The Controller Manager object. */ - static controller::Manager* getControllerManager() { return smArg.mpControllerManager; } - - - /*==============================*/ - /* SYSTEM NAND */ - /*==============================*/ - - /** @return The Content Manager object. */ - static nand::Manager* getNandManager() { return smArg.mpNandManager; } - /** @return The Save Data Manager object. */ - static savedata::Manager* getSaveData() { return smArg.mpSaveDataManager; } - - static bool isNandFull() { return smArg.mbIsNandFull; } - static void setNandFull(bool value) { smArg.mbIsNandFull = value; } - - static void checkNandOverFlowFlagAsync(); - - /*==============================*/ - /* SYSTEM REGION */ - /*==============================*/ - - /** @return The language of the System. */ - static s32 getLanguage(); - /** @return The region of the System. */ - static s32 getRegion(); - - static void setCountry(u8 country) NO_INLINE; - - /** @return The English message data. */ - static nand::File* getEngMsg() { return smArg.mResources.file[Arg::MESG_ENG]; } - /** @return The French message data. */ - static nand::File* getFraMsg() { return smArg.mResources.file[Arg::MESG_FRA]; } - /** @return The German message data. */ - static nand::File* getGerMsg() { return smArg.mResources.file[Arg::MESG_GER]; } - /** @return The Italian message data. */ - static nand::File* getItaMsg() { return smArg.mResources.file[Arg::MESG_ITA]; } - /** @return The Japanese message data. */ - static nand::File* getJpnMsg() { return smArg.mResources.file[Arg::MESG_JPN]; } - /** @return The Dutch message data. */ - static nand::File* getDutMsg() { return smArg.mResources.file[Arg::MESG_NED]; } - /** @return The Spanish message data. */ - static nand::File* getSpaMsg() { return smArg.mResources.file[Arg::MESG_SPA]; } - /** @return The Chinese (simple) message data. */ - static nand::File* getChnMsg() { return smArg.mResources.file[Arg::MESG_CHN]; } - /** - * @return The Chinese (traditional) message data. - * @remark This is unused, and will always return NULL. - */ - static nand::File* getChnTradMsg() { return smArg.mResources.file[Arg::MESG_CHN_TRAD]; } - /** @return The Korean message data. */ - static nand::File* getKorMsg() { return smArg.mResources.file[Arg::MESG_KOR]; } - - /*==============================*/ - /* SYSTEM CHANNELS */ - /*==============================*/ - - /** @return The Channel Manager object. */ - static channel::Manager* getChannelManager() { return smArg.mpChannelManager; } - /** @return The ChannelScript Manager object. */ - static channel::ChannelScriptManager* getCSManager() { return smArg.mpChannelScriptManager; } - - /*==============================*/ - /* WIICONNECT24 & MAIL */ - /*==============================*/ - - /** - * Tell the system we stopped NWC24 register process. - * @param errorCode Error code from NWC24RegisterUserId - */ - static void setNWC24RegistEnd(s32 errorCode); - /** Reset NWC24 register process. */ - static void resetNWC24Regist(); - /** Run NWC24 register process. */ - static BOOL processNWC24Regist(); - /** @return The WiiConnect24 Manager object. */ - static nwc24::Manager* getNwc24Manager() { return smArg.mbSafeMode ? NULL : smArg.mpNwc24Manager; } - /** @return The WiiConnect24 Manager object. */ - static nwc24::Manager* getNwc24ManagerForce() { return smArg.mpNwc24Manager; } - /** @return The Postman Handler object. */ - static postman::Manager* getPostmanManager() { return smArg.mpPostmanManager; } - /** @return The CDB Manager object. */ - static cdb::Manager* getCdbManager() { return isSafeMode() ? NULL : smArg.mpCdbManager; } - /** @return The CDB Manager object. */ - static cdb::Manager* getCdbManagerForce() { return smArg.mpCdbManager; } - /** @return The JPEG Decoder object. */ - static utility::JpegDecoder* getJpegDecoder() { return smArg.mpJpegDecoder; } - - static nand::File* getInvalidJpegImage() { return smArg.mResources.file[Arg::INVALID_JPEG]; } - - /** Get ethernet MAC Address from postman */ - static void getUsbEtherMacAddr(); - static BOOL isPostmanResumed(); - /** Start postman */ - static void startReceiveSchedule(); - /** Pause postman */ - static void stopReceiveSchedule(); - /** Reload download task from postman */ - static void reloadDownloadTask(); - /** Receive new message immediately task from postman */ - static void receiveImmediately(); - static BOOL isReceiveScheduleStopped(); - - /*==============================*/ - /* KEYBOARD */ - /*==============================*/ - - /** @return The Keyboard Manager object. */ - static keyboard::Manager* getKeyboard() { return smArg.mpKeyboardMgr; } - /** - * @return Array of dictionary data for ZI. - * @note For builds that do not use ZI8, do not use this. - */ - static u8** getZiDicData() { return smArg.mZiDicData.all; } - /** - * @return Dictionary data for ZI. - * @note For builds that do not use ZI8, do not use this. - */ - static u8* getZiDicData(int i) { return smArg.mZiDicData.sys[i]; } - /** - * @return System dictionary data for ZI. - * @note For builds that do not use ZI8, do not use this. - */ - static u8* getZiSystemDicData(int i) { return smArg.mZiDicData.sys[i]; } - /** - * @return OEM (Nintendo) dictionary data for ZI. - * @note For builds that do not use ZI8, do not use this. - */ - static u8* getZiOemDicData(int i) { return smArg.mZiDicData.oem[i]; } - - /*==============================*/ - /* MII */ - /*==============================*/ - - /** @return The Mii Manager object. */ - static nigaoe::Manager* getMiiManager() { return smArg.mpMiiManager; } - /** @return The Mii Archive Data */ - static nand::SharedFile* getRFLArc() { return smArg.mResources.sharedFile[Arg::FACE]; } - - /*==============================*/ - /* SYSTEM RENDERING */ - /*==============================*/ - - /** @return The Renderer of the IPL. */ - static GXRenderModeObj* getRenderModeObj(); - - /** @return Get projection rectangle depending on aspect ratio. */ - static void getProjectionRect(nw4r::ut::Rect* rect); - /** @return Get standard (4:3) projection rectangle. */ - static void getProjectionRect4x3(nw4r::ut::Rect* rect); - /** @return Get widescreen (16:9) projection rectangle. */ - static void getProjectionRect16x9(nw4r::ut::Rect* rect); - - /** @return The animation delta. */ - static f32 getAnimDelta() { return smArg.mpFramework->getDelta(); } - /** @return The aspect ratio. */ - static BOOL getAspectRatio() { return smArg.mpFramework->getAspectRatio(); } - - /*==============================*/ - /* SYSTEM FADING */ - /*==============================*/ - - /** @return The Fader object */ - static EGG::ColorFader* getFader() { return smArg.mpFader; } - - /*==============================*/ - /* SYSTEM USER INTERFACE */ - /*==============================*/ - - /** @return The Dialog object. */ - static DialogWindow* getDialog() { return smArg.mpDialog; } - /** @return The Dialog Archive Data */ - static nand::LayoutFile* getDlgArc() { return smArg.mResources.layoutFile[Arg::DIALOG_WINDOW]; } - - /** @return The Pointer object. */ - static Pointer* getPointer() { return smArg.mpPointer; } - - /*==============================*/ - /* SYSTEM SCENERY */ - /*==============================*/ - - /** @return The Scene Manager object. */ - static scene::Manager* getSceneManager() { return smArg.mpSceneManager; } - static scene::SceneObj* getScene(int sceneID) { return getSceneManager()->getScene(sceneID); } - static scene::SceneObj* getReservedScene() { return getSceneManager()->getReservedScene(); } - static bool onDefaultDrawLayer() { return getSceneManager()->onDefaultDrawLayer(); } - static bool onDrawLayer(int layer) { return getSceneManager()->onDrawLayer(layer); } - static int getCurrentRootSceneID() { return getSceneManager()->getCurrentRootSceneID(); } - static int getPreviousRootSceneID() { return getSceneManager()->getPreviousRootSceneID(); } - - /*==============================*/ - /* HOME MENU */ - /*==============================*/ - - /** @return The HOME Menu object. */ - static HomeButtonMenu* getHomeButtonMenu() { return smArg.mpHomeButton; } - static nand::File* getHBMMessageFile() { return smArg.mResources.file[Arg::HBM_MESSAGE]; } - static nand::File* getHBMConfigFile() { return smArg.mResources.file[Arg::HBM_CONFIG]; } - static nand::File* getHBMSpeakSoundFile() { return smArg.mResources.file[Arg::HBM_SPEAKER_SOUND]; } - static nand::File* getHBMBanIconFile() { return smArg.mResources.file[Arg::HBM_BAN_ICON]; } - static nand::File* getHBMLayoutFile() { return smArg.mResources.file[Arg::HBM_LAYOUT]; } - static nand::File* getHBMLangFile(u8 lang) { return smArg.mResources.file[Arg::HBM_LANG + lang]; } - static nand::File* getHBMLangFile() { return getHBMLangFile(SCGetLanguage()); } - - /*==============================*/ - /* ERROR HANDLING */ - /*==============================*/ - - /** @return The Error Handler object. */ - static ErrorHandler* getErrorHandler() { return smArg.mpErrorHandler; } - - /** @brief Prepare the system for error handler */ - static void err_run(); - - /*==============================*/ - /* RESET HANDLER */ - /*==============================*/ - - /** @return The Reset Handler object. */ - static ResetHandler* getResetHandler() { return smArg.mpResetHandler; } - /** @brief Prepare the system for reset handler */ - static void reset_run(); - /** @return The fader object for the reset handler. */ - static EGG::ColorFader* getResetFader() { return smArg.mpResetFader; } - - /** @return A boolean indicating if the user can restart their Wii console. */ - static BOOL isResetAcceptable(); - - /*==============================*/ - /* WARNING HANDLING */ - /*==============================*/ - - /** @return The Warning Handler object. */ - static WarningHandler* getWarningHandler() { return smArg.mpWarningHandler; } - - /** @brief Prepare the system for warning handler */ - static void warning_run(); - - /*==============================*/ - /* CDB BACKUP */ - /*==============================*/ - - /** @brief Prepare the system for CDB backup */ - static void backup_run(); - - /*==============================*/ - /* UTILITIES */ - /*==============================*/ - - /** @return The Random Number Generator object. */ - static math::Random* getRndm(); - /** @return The Current time. */ - static OSCalendarTime& getCurrentTime() { return smArg.mCurrentTime; } - /*==============================*/ - /* MISC */ - /*==============================*/ - - static bool isSafeMode() { return smArg.mbSafeMode; } - static void setSafeMode(bool value) { smArg.mbSafeMode = value; } + Arg(); private: - static void createRootHeap_(); - static void createAppHeap_(); + EGG::Heap* mpMem1Root; // 0x00 + EGG::Heap* mpMem2Root; // 0x04 + EGG::Heap* mpMem1Sys; // 0x08 + EGG::Heap* mpMem2Sys; // 0x0C + EGG::Heap* mpSceneHeap; // 0x10 + EGG::Heap* mpSoundHeap; // 0x14 + EGG::Heap* mpChannelHeap; // 0x18 + void* unk_0x1C; + EGG::Heap* mpSharedHeap; // 0x20 + EGG::Heap* mpMem1App; // 0x24 + EGG::Heap* mpMem2App; // 0x28 + EGG::Heap* mpTreasureHeap; // 0x2C + void* mpChannelArena; // 0x30 + EGG::Heap* mpFontHeap; // 0x34 + EGG::Heap* mpMailHeap; // 0x38 - static void* constructFontSub_(void* fontData); - static void loadFont_(); - static void constructFont_(void* work); + OSCalendarTime mCurrentTime; // 0x3C - static void constructSND_(void* work); + scene::Manager* mpSceneManager; // 0x64 + controller::Manager* mpControllerManager; // 0x68 + nand::Manager* mpNandManager; // 0x6C + nigaoe::Manager* mpMiiManager; // 0x70 + Framework* mpFramework; // 0x74 + Exception* mpException; // 0x78 + cdb::Manager* mpCdbManager; // 0x7C + message::Manager* mpMessageMgr; // 0x80 + channel::Manager* mpChannelManager; // 0x84 + channel::ChannelScriptManager* mpChannelScriptManager; // 0x88 + nwc24::Manager* mpNwc24Manager; // 0x8C + keyboard::Manager* mpKeyboardMgr; // 0x90 + savedata::Manager* mpSaveDataManager; // 0x94 + ErrorHandler* mpErrorHandler; // 0x98 + ResetHandler* mpResetHandler; // 0x9C + WarningHandler* mpWarningHandler; // 0xA0 + postman::Manager* mpPostmanManager; // 0xA4 + bs2::Manager* mpBS2Manager; // 0xA8 + DialogWindow* mpDialog; // 0xAC + Pointer* mpPointer; // 0xB0 + HomeButtonMenu* mpHomeButton; // 0xB4 + TVRCManager* mpTVRCManager; // 0xB8 + utility::JpegDecoder* mpJpegDecoder; // 0xBC + EGG::Thread* mpMainThread; // 0xC0 + EGG::ColorFader* mpFader; // 0xC4 + EGG::ColorFader* mpResetFader; // 0xC8 + math::Random* mpRandom; // 0xCC - static void* loadZiDIC_(void* arcData, const char* fileName); - static void constructZiDIC_(void* work); + EGG::TaskThread* mpTask1; // 0xD0 + EGG::TaskThread* mpTask2; // 0xD4 + EGG::TaskThread* mpTask3; // 0xD8 - static void loadRFLRes_() { - nand::Manager* nandManager = getNandManager(); - const char* rflArc = RFLGetArcFilePath(); - smArg.mResources.sharedFile[Arg::FACE] = nandManager->readSharedAsync(getMem2Sys(), rflArc, 4); + nw4r::ut::Font* mpWBFont1Data; // 0xDC + nand::SharedFile* mpWBF1File; // 0xE0 + nw4r::ut::Font* mpWBFont2Data; // 0xE4 + nand::SharedFile* mpWBF2File; // 0xE8 + + enum { + FONT, + RSO_SYM_LIST, + SOUND, + SOFT_KEYBOARD, + RES_4, // unused + FACE, + HBM_LAYOUT, + HBM_LANG, + HBM_LANG_JPN = HBM_LANG, + HBM_LANG_ENG, + HBM_LANG_GER, + HBM_LANG_FRA, + HBM_LANG_SPA, + HBM_LANG_ITA, + HBM_LANG_NED, + HBM_LANG_CHN, + HBM_LANG_CHN_TRAD, // unused + HBM_LANG_KOR, + MESSAGES, + MESG_ENG = MESSAGES, + MESG_FRA, + MESG_GER, + MESG_ITA, + MESG_JPN, + MESG_NED, + MESG_SPA, + MESG_CHN, + MESG_CHN_TRAD, // unused + MESG_KOR, + RES_27, // unused + HBM_MESSAGE, + HBM_CONFIG, + HBM_SPEAKER_SOUND, + HBM_BAN_ICON, + RES_32, // unused + RES_33, // unused + RES_34, // unused + ZI_DICT, + NINTENDO_DICT, + INVALID_JPEG, + RES_38, // unused + RES_39, // unused + DIALOG_WINDOW, + MAX_RES + }; + + union { + nand::File* file[MAX_RES]; + nand::SharedFile* sharedFile[MAX_RES]; + nand::LayoutFile* layoutFile[MAX_RES]; + } mResources; // 0xEC + + union { + struct { + u8* sys[EZTX_LANG_MAX]; + u8* oem[EZTX_LANG_MAX]; + }; + u8* all[EZTX_LANG_MAX * 2]; + } mZiDicData; // 0x190 + + OSAlarm mUnusedAlarm; // 0x1E0 + + void* mpFontArena; // 0x210 + void* mpMem1Arena; // 0x214 + u32 mMem1ArenaSize; // 0x218 + + u32 mBS2BootType; // 0x21C + u32 mBS2LaunchCode; // 0x220 + u32 unk_0x224; + char* mpNetSettingArg; // 0x228 + char* mpDataManageArg; // 0x22C + char mBS2FirstArgv[128]; // 0x230 + + volatile bool mbResLoaded; // 0x2B0 + bool mbInitCreateAfter; // 0x2B1 + volatile bool mbCreatedAfter; // 0x2B2 + bool mbLibraryInit; // 0x2B3 + bool mbCreatedLibMgr; // 0x2B4 + bool unused_0x2B5; + volatile bool mbFontResLoaded; // 0x2B6 + volatile bool mbSndResLoaded; // 0x2B7 + volatile bool mbZi8ResLoaded; // 0x2B8 + volatile bool mbNeedToCreateFolders; // 0x2B9 + volatile bool mbNWC24LibError; // 0x2BA + volatile bool mbIsNandFull; // 0x2BB + volatile bool mbSafeMode; // 0x2BC + bool mbStartNewMainAmn; // 0x2BD + volatile bool mbRequestCreateAfter; // 0x2BE + bool mbRequestCreateLibMgr; // 0x2BF + + enum { + REGIST_STATE_START = 0, + REGIST_STATE_DOING, + REGIST_STATE_END, + }; + + vs32 mRegistState; // 0x2C0 + vs32 mRegistErrCode; // 0x2C4 + volatile bool mbGoingToDataManager; // 0x2C8 + u8 unk_0x2CC[0x2D0 - 0x2CC]; + ESTitleId mBS2LaunchTitle; // 0x2B0 + + friend class System; + }; + + /*==============================*/ + /* THREADING */ + /*==============================*/ + + static EGG::Thread* getMainThread() { return smArg.mpMainThread; } + static EGG::TaskThread* getTask1() { return smArg.mpTask1; } + static EGG::TaskThread* getTask2() { return smArg.mpTask2; } + static EGG::TaskThread* getTask3() { return smArg.mpTask3; } + + /*==============================*/ + /* MEMORY HEAP */ + /*==============================*/ + + static EGG::Heap* createMem1AppHeap(); + static void destroyMem1AppHeap(); + + static void setCurrentHeap(EGG::Heap* heap); + + static EGG::Heap* getMem1Root() { return smArg.mpMem1Root; } + static EGG::Heap* getMem2Root() { return smArg.mpMem2Root; } + static EGG::Heap* getMem1Sys() { return smArg.mpMem1Sys; } + static EGG::Heap* getMem2Sys() { return smArg.mpMem2Sys; } + static EGG::Heap* getMem1App() { return smArg.mpMem1App; } + static EGG::Heap* getMem2App() { return smArg.mpMem2App; } + static EGG::Heap* getSceneHeap() { return smArg.mpSceneHeap; } + static EGG::Heap* getSoundHeap() { return smArg.mpSoundHeap; } + static EGG::Heap* getChannelHeap() { return smArg.mpChannelHeap; } + static EGG::Heap* getSharedHeap() { return smArg.mpSharedHeap; } + static EGG::Heap* getTreasureHeap() { return smArg.mpTreasureHeap; } + static void* getChannelArena() { return smArg.mpChannelArena; } + static EGG::Heap* getFontHeap() { return smArg.mpFontHeap; } + static EGG::Heap* getMailWorkHeap() { return smArg.mpMailHeap; } + + /*==============================*/ + /* SYSTEM RESOURCES */ + /*==============================*/ + + static bool isCmnResLoaded() { return smArg.mbResLoaded; } + + static bool isFontResLoaded() { return smArg.mbFontResLoaded; } + static bool isSndResLoaded() { return smArg.mbSndResLoaded; } + static bool isZi8ResLoaded() { return smArg.mbZi8ResLoaded; } + + static bool hasNWC24LibError() { return smArg.mbNWC24LibError; } + static void resetNWC24LibState() { smArg.mbNWC24LibError = false; } + + static bool isRsrcLoaded() { + return smArg.mbResLoaded && smArg.mbFontResLoaded && smArg.mbSndResLoaded +#ifdef USE_ZI8 + && smArg.mbZi8ResLoaded +#endif // USE_ZI8 + ; + } + + /** @return The Message ID as a Wide-string. */ + static const wchar_t* getMessage(u32 id) { return smArg.mpMessageMgr->getMessage(id); } + static message::Manager* getMessageManager() { return smArg.mpMessageMgr; } + + static void* getFont(); + /** @return The Wii Bitmap Font 1 Data. (wbf1.brfna) */ + static nw4r::ut::Font* getWBFont1Data() { return smArg.mpWBFont1Data; } + /** @return The Wii Bitmap Font 2 Data. (wbf2.brfna) */ + static nw4r::ut::Font* getWBFont2Data() { return smArg.mpWBFont2Data; } + + /*==============================*/ + /* SYSTEM */ + /*==============================*/ + + /** + * Initializes the IPL. + * @param argc The amount of arguments passed, + * @param argv Array of arguments. + */ + static void init(int argc, char** argv); + static void reinit(); + + /** + * Run the IPL. + * @note This function must be called after `ipl::System::init` + */ + static void run(); + + /** Cancels all running tasks */ + static void cancelThread(); + + /** Gets the boot argument from BS2's argv */ + static void getBootArg(int argc, char** argv); + + static bool hasCreatedAfter() { return smArg.mbCreatedAfter; } + static bool hasCreatedLibMgr() { return smArg.mbCreatedLibMgr; } + + static volatile bool createdAfterAndLibMgr() { return smArg.mbCreatedAfter && smArg.mbCreatedLibMgr; } + + static void requestCreateAfter() { smArg.mbRequestCreateAfter = true; } + static void requestCreateLibManager() { smArg.mbRequestCreateLibMgr = true; } + + static void stopCreateAfterReq() { smArg.mbRequestCreateAfter = false; } + static void stopCreateLibManagerReq() { smArg.mbRequestCreateLibMgr = false; } + + static bool goingToDataManager() { return smArg.mbGoingToDataManager; } + + // This is a guess, judging by how it's used. + static bool requestedNewMailAnm() { return smArg.mbStartNewMainAmn; } + static void requestNewMailAnm() { smArg.mbStartNewMainAmn = true; } + static void stopRequestNewMailAnm() { smArg.mbStartNewMainAmn = false; } + + /*==============================*/ + /* SYSTEM BS2 */ + /*==============================*/ + + /** @return The BS2 Manager object. */ + static bs2::Manager* getBS2Manager() { return smArg.mpBS2Manager; } + + static u32 getBS2BootType() { return smArg.mBS2BootType; } + static u32 getBS2LaunchCode() { return smArg.mBS2LaunchCode; } + static ESTitleId getBS2LaunchTitle() { return smArg.mBS2LaunchTitle; } + + static char* getNetSettingArg() { return smArg.mpNetSettingArg; } + static char* getDataManagerArg() { return smArg.mpDataManageArg; } + + /*==============================*/ + /* WII CONTROLLERS */ + /*==============================*/ + + /** + * @return The Wii Remote being used. + * @param chan The Wii Remote Player + */ + static controller::Interface* getController(int chan); + /** @return The Master Wii Remote. */ + static controller::Interface* getMasterController(); + /** @return The Young Wii Remote. */ + static controller::Interface* getYoungController(); + /** @return The Controller Manager object. */ + static controller::Manager* getControllerManager() { return smArg.mpControllerManager; } + + /*==============================*/ + /* SYSTEM NAND */ + /*==============================*/ + + /** @return The Content Manager object. */ + static nand::Manager* getNandManager() { return smArg.mpNandManager; } + /** @return The Save Data Manager object. */ + static savedata::Manager* getSaveData() { return smArg.mpSaveDataManager; } + + static bool isNandFull() { return smArg.mbIsNandFull; } + static void setNandFull(bool value) { smArg.mbIsNandFull = value; } + + static void checkNandOverFlowFlagAsync(); + + /*==============================*/ + /* SYSTEM REGION */ + /*==============================*/ + + /** @return The language of the System. */ + static s32 getLanguage(); + /** @return The region of the System. */ + static s32 getRegion(); + + static void setCountry(u8 country) NO_INLINE; + + /** @return The English message data. */ + static nand::File* getEngMsg() { return smArg.mResources.file[Arg::MESG_ENG]; } + /** @return The French message data. */ + static nand::File* getFraMsg() { return smArg.mResources.file[Arg::MESG_FRA]; } + /** @return The German message data. */ + static nand::File* getGerMsg() { return smArg.mResources.file[Arg::MESG_GER]; } + /** @return The Italian message data. */ + static nand::File* getItaMsg() { return smArg.mResources.file[Arg::MESG_ITA]; } + /** @return The Japanese message data. */ + static nand::File* getJpnMsg() { return smArg.mResources.file[Arg::MESG_JPN]; } + /** @return The Dutch message data. */ + static nand::File* getDutMsg() { return smArg.mResources.file[Arg::MESG_NED]; } + /** @return The Spanish message data. */ + static nand::File* getSpaMsg() { return smArg.mResources.file[Arg::MESG_SPA]; } + /** @return The Chinese (simple) message data. */ + static nand::File* getChnMsg() { return smArg.mResources.file[Arg::MESG_CHN]; } + /** + * @return The Chinese (traditional) message data. + * @remark This is unused, and will always return NULL. + */ + static nand::File* getChnTradMsg() { return smArg.mResources.file[Arg::MESG_CHN_TRAD]; } + /** @return The Korean message data. */ + static nand::File* getKorMsg() { return smArg.mResources.file[Arg::MESG_KOR]; } + + /*==============================*/ + /* SYSTEM CHANNELS */ + /*==============================*/ + + /** @return The Channel Manager object. */ + static channel::Manager* getChannelManager() { return smArg.mpChannelManager; } + /** @return The ChannelScript Manager object. */ + static channel::ChannelScriptManager* getCSManager() { return smArg.mpChannelScriptManager; } + + /*==============================*/ + /* WIICONNECT24 & MAIL */ + /*==============================*/ + + /** + * Tell the system we stopped NWC24 register process. + * @param errorCode Error code from NWC24RegisterUserId + */ + static void setNWC24RegistEnd(s32 errorCode); + /** Reset NWC24 register process. */ + static void resetNWC24Regist(); + /** Run NWC24 register process. */ + static BOOL processNWC24Regist(); + /** @return The WiiConnect24 Manager object. */ + static nwc24::Manager* getNwc24Manager() { return smArg.mbSafeMode ? NULL : smArg.mpNwc24Manager; } + /** @return The WiiConnect24 Manager object. */ + static nwc24::Manager* getNwc24ManagerForce() { return smArg.mpNwc24Manager; } + /** @return The Postman Handler object. */ + static postman::Manager* getPostmanManager() { return smArg.mpPostmanManager; } + /** @return The CDB Manager object. */ + static cdb::Manager* getCdbManager() { return isSafeMode() ? NULL : smArg.mpCdbManager; } + /** @return The CDB Manager object. */ + static cdb::Manager* getCdbManagerForce() { return smArg.mpCdbManager; } + /** @return The JPEG Decoder object. */ + static utility::JpegDecoder* getJpegDecoder() { return smArg.mpJpegDecoder; } + + static nand::File* getInvalidJpegImage() { return smArg.mResources.file[Arg::INVALID_JPEG]; } + + /** Get ethernet MAC Address from postman */ + static void getUsbEtherMacAddr(); + static BOOL isPostmanResumed(); + /** Start postman */ + static void startReceiveSchedule(); + /** Pause postman */ + static void stopReceiveSchedule(); + /** Reload download task from postman */ + static void reloadDownloadTask(); + /** Receive new message immediately task from postman */ + static void receiveImmediately(); + static BOOL isReceiveScheduleStopped(); + + /*==============================*/ + /* KEYBOARD */ + /*==============================*/ + + /** @return The Keyboard Manager object. */ + static keyboard::Manager* getKeyboard() { return smArg.mpKeyboardMgr; } + /** + * @return Array of dictionary data for ZI. + * @note For builds that do not use ZI8, do not use this. + */ + static u8** getZiDicData() { return smArg.mZiDicData.all; } + /** + * @return Dictionary data for ZI. + * @note For builds that do not use ZI8, do not use this. + */ + static u8* getZiDicData(int i) { return smArg.mZiDicData.sys[i]; } + /** + * @return System dictionary data for ZI. + * @note For builds that do not use ZI8, do not use this. + */ + static u8* getZiSystemDicData(int i) { return smArg.mZiDicData.sys[i]; } + /** + * @return OEM (Nintendo) dictionary data for ZI. + * @note For builds that do not use ZI8, do not use this. + */ + static u8* getZiOemDicData(int i) { return smArg.mZiDicData.oem[i]; } + + /*==============================*/ + /* MII */ + /*==============================*/ + + /** @return The Mii Manager object. */ + static nigaoe::Manager* getMiiManager() { return smArg.mpMiiManager; } + /** @return The Mii Archive Data */ + static nand::SharedFile* getRFLArc() { return smArg.mResources.sharedFile[Arg::FACE]; } + + /*==============================*/ + /* SYSTEM RENDERING */ + /*==============================*/ + + /** @return The Renderer of the IPL. */ + static GXRenderModeObj* getRenderModeObj(); + + /** @return Get projection rectangle depending on aspect ratio. */ + static void getProjectionRect(nw4r::ut::Rect* rect); + /** @return Get standard (4:3) projection rectangle. */ + static void getProjectionRect4x3(nw4r::ut::Rect* rect); + /** @return Get widescreen (16:9) projection rectangle. */ + static void getProjectionRect16x9(nw4r::ut::Rect* rect); + + /** @return The animation delta. */ + static f32 getAnimDelta() { return smArg.mpFramework->getDelta(); } + /** @return The aspect ratio. */ + static BOOL getAspectRatio() { return smArg.mpFramework->getAspectRatio(); } + + /*==============================*/ + /* SYSTEM FADING */ + /*==============================*/ + + /** @return The Fader object */ + static EGG::ColorFader* getFader() { return smArg.mpFader; } + + /*==============================*/ + /* SYSTEM USER INTERFACE */ + /*==============================*/ + + /** @return The Dialog object. */ + static DialogWindow* getDialog() { return smArg.mpDialog; } + /** @return The Dialog Archive Data */ + static nand::LayoutFile* getDlgArc() { return smArg.mResources.layoutFile[Arg::DIALOG_WINDOW]; } + + /** @return The Pointer object. */ + static Pointer* getPointer() { return smArg.mpPointer; } + + /*==============================*/ + /* SYSTEM SCENERY */ + /*==============================*/ + + /** @return The Scene Manager object. */ + static scene::Manager* getSceneManager() { return smArg.mpSceneManager; } + static scene::SceneObj* getScene(int sceneID) { return getSceneManager()->getScene(sceneID); } + static scene::SceneObj* getReservedScene() { return getSceneManager()->getReservedScene(); } + static bool onDefaultDrawLayer() { return getSceneManager()->onDefaultDrawLayer(); } + static bool onDrawLayer(int layer) { return getSceneManager()->onDrawLayer(layer); } + static int getCurrentRootSceneID() { return getSceneManager()->getCurrentRootSceneID(); } + static int getPreviousRootSceneID() { return getSceneManager()->getPreviousRootSceneID(); } + + /*==============================*/ + /* HOME MENU */ + /*==============================*/ + + /** @return The HOME Menu object. */ + static HomeButtonMenu* getHomeButtonMenu() { return smArg.mpHomeButton; } + static nand::File* getHBMMessageFile() { return smArg.mResources.file[Arg::HBM_MESSAGE]; } + static nand::File* getHBMConfigFile() { return smArg.mResources.file[Arg::HBM_CONFIG]; } + static nand::File* getHBMSpeakSoundFile() { return smArg.mResources.file[Arg::HBM_SPEAKER_SOUND]; } + static nand::File* getHBMBanIconFile() { return smArg.mResources.file[Arg::HBM_BAN_ICON]; } + static nand::File* getHBMLayoutFile() { return smArg.mResources.file[Arg::HBM_LAYOUT]; } + static nand::File* getHBMLangFile(u8 lang) { return smArg.mResources.file[Arg::HBM_LANG + lang]; } + static nand::File* getHBMLangFile() { return getHBMLangFile(SCGetLanguage()); } + + /*==============================*/ + /* ERROR HANDLING */ + /*==============================*/ + + /** @return The Error Handler object. */ + static ErrorHandler* getErrorHandler() { return smArg.mpErrorHandler; } + + /** @brief Prepare the system for error handler */ + static void err_run(); + + /*==============================*/ + /* RESET HANDLER */ + /*==============================*/ + + /** @return The Reset Handler object. */ + static ResetHandler* getResetHandler() { return smArg.mpResetHandler; } + /** @brief Prepare the system for reset handler */ + static void reset_run(); + /** @return The fader object for the reset handler. */ + static EGG::ColorFader* getResetFader() { return smArg.mpResetFader; } + + /** @return A boolean indicating if the user can restart their Wii console. */ + static BOOL isResetAcceptable(); + + /*==============================*/ + /* WARNING HANDLING */ + /*==============================*/ + + /** @return The Warning Handler object. */ + static WarningHandler* getWarningHandler() { return smArg.mpWarningHandler; } + + /** @brief Prepare the system for warning handler */ + static void warning_run(); + + /*==============================*/ + /* CDB BACKUP */ + /*==============================*/ + + /** @brief Prepare the system for CDB backup */ + static void backup_run(); + + /*==============================*/ + /* UTILITIES */ + /*==============================*/ + + /** @return The Random Number Generator object. */ + static math::Random* getRndm(); + /** @return The Current time. */ + static OSCalendarTime& getCurrentTime() { return smArg.mCurrentTime; } + /*==============================*/ + /* MISC */ + /*==============================*/ + + static bool isSafeMode() { return smArg.mbSafeMode; } + static void setSafeMode(bool value) { smArg.mbSafeMode = value; } + + private: + static void createRootHeap_(); + static void createAppHeap_(); + + static void* constructFontSub_(void* fontData); + static void loadFont_(); + static void constructFont_(void* work); + + static void constructSND_(void* work); + + static void* loadZiDIC_(void* arcData, const char* fileName); + static void constructZiDIC_(void* work); + + static void loadRFLRes_() { + nand::Manager* nandManager = getNandManager(); + const char* rflArc = RFLGetArcFilePath(); + smArg.mResources.sharedFile[Arg::FACE] = nandManager->readSharedAsync(getMem2Sys(), rflArc, 4); + } + + static void resourceLoaded_(void* work); + static void libraryInitialized_(void* work); + + static void createFolders_(void* work); + + static void loadResource_(void* work); + + static void createAfter_(void* work); + static void createLibManager_(); + + static void requestCreateInstance(void* work); + + static void cbThreadSwitch(OSThread* thread1, OSThread* thread2); + + static void setToday_(); + + static void resetSysConf_() { + BOOL enabled = OSDisableInterrupts(); + + SCBtDeviceInfoArray devInfoArray; + memset(&devInfoArray, 0, sizeof(devInfoArray)); + + BOOL result = SCGetBtDeviceInfoArray(&devInfoArray); + __SCClearConfBuf(); + if (result) { + SCSetBtDeviceInfoArray(&devInfoArray); } - static void resourceLoaded_(void* work); - static void libraryInitialized_(void* work); + OSRestoreInterrupts(enabled); + } - static void createFolders_(void* work); - - static void loadResource_(void* work); - - static void createAfter_(void* work); - static void createLibManager_(); - - static void requestCreateInstance(void* work); - - static void cbThreadSwitch(OSThread* thread1, OSThread* thread2); - - static void setToday_(); - - static void resetSysConf_() { - BOOL enabled = OSDisableInterrupts(); - - SCBtDeviceInfoArray devInfoArray; - memset(&devInfoArray, 0, sizeof(devInfoArray)); - - BOOL result = SCGetBtDeviceInfoArray(&devInfoArray); - __SCClearConfBuf(); - if (result) { - SCSetBtDeviceInfoArray(&devInfoArray); - } - - OSRestoreInterrupts(enabled); - } - - static Arg smArg; + static Arg smArg; }; -} +} // namespace ipl -#endif // IPL_SYSTEM_H +#endif // IPL_SYSTEM_H diff --git a/include/system/iplTVRCManager.h b/include/system/iplTVRCManager.h index f7f01e26..82834630 100644 --- a/include/system/iplTVRCManager.h +++ b/include/system/iplTVRCManager.h @@ -7,25 +7,25 @@ namespace ipl { class TVRCManager { - public: - TVRCManager(EGG::Heap* heap); + public: + TVRCManager(EGG::Heap* heap); - void setEnable(BOOL flag); + void setEnable(BOOL flag); - void update(); + void update(); - void loadDatabase(); - - void resetProcessAsync(BOOL unk); - bool waitResetProcessCompleted(); - - static TVRCManager* getHandle() { return m_handle; } + void loadDatabase(); - private: - static TVRCManager* m_handle; + void resetProcessAsync(BOOL unk); + bool waitResetProcessCompleted(); - u8 dummy[0x88]; + static TVRCManager* getHandle() { return m_handle; } + + private: + static TVRCManager* m_handle; + + u8 dummy[0x88]; }; -} +} // namespace ipl -#endif // IPL_TVRC_MANAGER_H +#endif // IPL_TVRC_MANAGER_H diff --git a/include/system/iplWarningHandler.h b/include/system/iplWarningHandler.h index 3df10155..eb4f43a1 100644 --- a/include/system/iplWarningHandler.h +++ b/include/system/iplWarningHandler.h @@ -9,35 +9,31 @@ namespace ipl { class WarningHandler { - public: - enum Type { - NONE = 0, - DEFAULT, - RESET - }; + public: + enum Type { NONE = 0, DEFAULT, RESET }; - WarningHandler(EGG::Heap* heap); - /** - * @param type The warning type. - * @param msgId The message ID. - */ - void set(Type type, u32 msgId); + WarningHandler(EGG::Heap* heap); + /** + * @param type The warning type. + * @param msgId The message ID. + */ + void set(Type type, u32 msgId); - void calc(); - void draw(); + void calc(); + void draw(); - BOOL check(); + BOOL check(); - BOOL resetting() { return mType == RESET; } + BOOL resetting() { return mType == RESET; } - private: - Type mType; // 0x00 - u32 mMessageID; // 0x04 + private: + Type mType; // 0x00 + u32 mMessageID; // 0x04 + + DialogWindow* mpDialog; // 0x08 - DialogWindow* mpDialog; // 0x08 - friend class System; }; -} +} // namespace ipl -#endif // IPL_WARNING_HANDLER_H +#endif // IPL_WARNING_HANDLER_H diff --git a/include/system/odh.h b/include/system/odh.h index 25d8bfe2..da824d19 100644 --- a/include/system/odh.h +++ b/include/system/odh.h @@ -7,8 +7,8 @@ extern "C" { #endif -#define ODHGetWorkSizeByWidthHeight(w, h) ((w * h) * 3) -#define ODHGetWorkSize(s) (s * 3) +#define ODHGetWorkSizeByWidthHeight(w, h) ((w * h) * 3) +#define ODHGetWorkSize(s) (s * 3) int ODHEncodeRGB565(u8* src, u8* dest, int width, int height, u32 sizeLimit, int quality, u8* work); int ODHEncodeRGBA8(u8* src, u8* dest, int width, int height, u32 sizeLimit, int quality, u8* work); @@ -25,4 +25,4 @@ int ODHGetHeight(u8* data); } #endif -#endif // ODH_H +#endif // ODH_H diff --git a/include/system/rvl_dec.h b/include/system/rvl_dec.h index bc41d3c2..765d5e6a 100644 --- a/include/system/rvl_dec.h +++ b/include/system/rvl_dec.h @@ -5,7 +5,7 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus int Rvl_decode(u8* out, u8* in); int Rvl_decode_szs(u8* out, u8* in); @@ -27,6 +27,6 @@ static int Rvl_decode_ash_size(const u8* in) { #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // RVL_DECODER_H +#endif // RVL_DECODER_H diff --git a/include/titledb.h b/include/titledb.h index 47298b91..993ed41d 100644 --- a/include/titledb.h +++ b/include/titledb.h @@ -3,6 +3,7 @@ #include +// clang-format off #define TITLE_TYPE_SYSTEM 0x00000001 #define TITLE_TYPE_DISC 0x00010000 #define TITLE_TYPE_CHANNEL 0x00010001 @@ -84,5 +85,6 @@ #define TITLE_NO_REGION(t) (t & TITLE_NOREGION_MASK) #define TITLE_REGION(t) (t & TITLE_REGION_MASK) +// clang-format on -#endif // IPL_TITLE_ID_DATABASE +#endif // IPL_TITLE_ID_DATABASE diff --git a/include/utility/iplCSFlags.h b/include/utility/iplCSFlags.h index 5c78a899..5e5a5634 100644 --- a/include/utility/iplCSFlags.h +++ b/include/utility/iplCSFlags.h @@ -6,9 +6,9 @@ namespace ipl { namespace utility { typedef struct CSFlagsData { - u8 unk_0x00[0x04-0x00]; + u8 unk_0x00[0x04 - 0x00]; u32 flags; // 0x04 - u8 unk_0x08[0x20-0x08]; + u8 unk_0x08[0x20 - 0x08]; enum { FLAG_SYSCONF_EULA = 0, @@ -16,15 +16,15 @@ namespace ipl { } CSFlagsData; class CSFlags { - static s32 CreateFlagsFile(); - static s32 UpdateFlagsFile(); + static s32 CreateFlagsFile(); + static s32 UpdateFlagsFile(); - static s32 ReadFlags(CSFlagsData* outData); - static s32 WriteFlags(CSFlagsData* inData); + static s32 ReadFlags(CSFlagsData* outData); + static s32 WriteFlags(CSFlagsData* inData); static void SetEULAFlag(CSFlagsData* data); }; - } -} + } // namespace utility +} // namespace ipl -#endif // IPL_UTILITY_CS_FLAGS_H +#endif // IPL_UTILITY_CS_FLAGS_H diff --git a/include/utility/iplCalendar.h b/include/utility/iplCalendar.h index bfc17cbe..e81be51b 100644 --- a/include/utility/iplCalendar.h +++ b/include/utility/iplCalendar.h @@ -10,147 +10,93 @@ namespace ipl { namespace utility { class Date { - public: - typedef enum { - NO_INIT = 0, - } HackF; + public: + typedef enum { + NO_INIT = 0, + } HackF; - // Stupid fucking hack. - Date(HackF flag) { } + // Stupid fucking hack. + Date(HackF flag) {} - Date() : year(MIN_YEAR), month(MIN_MONTH), day(MIN_DAY) {} - Date(int myYear, int myMonth, int myDay) : year(myYear), month(myMonth), day(myDay) {} - Date(const OSCalendarTime& cal) : year(cal.year), month(cal.mon+1), day(cal.mday) {} - Date(const Date& date) : year(date.year), month(date.month), day(date.day) {} + Date() : year(MIN_YEAR), month(MIN_MONTH), day(MIN_DAY) {} + Date(int myYear, int myMonth, int myDay) : year(myYear), month(myMonth), day(myDay) {} + Date(const OSCalendarTime& cal) : year(cal.year), month(cal.mon + 1), day(cal.mday) {} + Date(const Date& date) : year(date.year), month(date.month), day(date.day) {} - static Date getMaxDate() { utility::Date date(MAX_YEAR, MAX_MONTH, MAX_DAY); return date; } - static Date getMinDate() { utility::Date date(MIN_YEAR, MIN_MONTH, MIN_DAY); return date; } + static Date getMaxDate() { + utility::Date date(MAX_YEAR, MAX_MONTH, MAX_DAY); + return date; + } + static Date getMinDate() { + utility::Date date(MIN_YEAR, MIN_MONTH, MIN_DAY); + return date; + } - CDBDate cdbDateBegin() { return CDBMakeCDBDate(year, month-1, day, 0, 0, 0); } - CDBDate cdbDateEnd() { return CDBMakeCDBDate(year, month-1, day, 23, 59, 59); } + CDBDate cdbDateBegin() { return CDBMakeCDBDate(year, month - 1, day, 0, 0, 0); } + CDBDate cdbDateEnd() { return CDBMakeCDBDate(year, month - 1, day, 23, 59, 59); } - bool operator==(const Date& rhs) const { - return year == rhs.year && month == rhs.month && day == rhs.day; - } + bool operator==(const Date& rhs) const { return year == rhs.year && month == rhs.month && day == rhs.day; } - bool operator>(const Date& rhs) const { - bool result = false; - if (year > rhs.year) { + bool operator>(const Date& rhs) const { + bool result = false; + if (year > rhs.year) { + result = true; + } else if (year == rhs.year) { + if (month > rhs.month) { result = true; - } - else if (year == rhs.year) { - if (month > rhs.month) { + } else if (month == rhs.month) { + if (day > rhs.day) { result = true; } - else if (month == rhs.month) { - if (day > rhs.day) { - result = true; - } - } } - - return result; } - bool operator<(const Date& rhs) const { - bool result = false; - if (year < rhs.year) { + return result; + } + + bool operator<(const Date& rhs) const { + bool result = false; + if (year < rhs.year) { + result = true; + } else if (year == rhs.year) { + if (month < rhs.month) { result = true; - } - else if (year == rhs.year) { - if (month < rhs.month) { + } else if (month == rhs.month) { + if (day < rhs.day) { result = true; } - else if (month == rhs.month) { - if (day < rhs.day) { - result = true; - } - } } - - return result; } - bool operator!=(const Date& rhs) const NO_INLINE { - return year != rhs.year || month != rhs.month || day != rhs.day; - } + return result; + } - int year; // 0x00 - int month; // 0x04 - int day; // 0x08 + bool operator!=(const Date& rhs) const NO_INLINE { return year != rhs.year || month != rhs.month || day != rhs.day; } + + int year; // 0x00 + int month; // 0x04 + int day; // 0x08 }; class MinDate : public Date { - public: - MinDate() { getMinDate(); } + public: + MinDate() { getMinDate(); } }; class MaxDate : public Date { - public: - MaxDate() { getMaxDate(); } + public: + MaxDate() { getMaxDate(); } }; class Calendar { - public: - static void setCalendarTime(OSCalendarTime* newCalendar); + public: + static void setCalendarTime(OSCalendarTime* newCalendar); - static void getTomorrow(const Date& src, Date* dest) NO_INLINE { - *dest = src; - int days = getDays(dest->year, dest->month); - dest->day++; - if (dest->day > days) { - dest->month++; - if (dest->month > MAX_MONTH) { - dest->month = MIN_MONTH; - dest->year++; - } - dest->day = MIN_DAY; - } - } - static void getYesterday(const Date& src, Date* dest) NO_INLINE { - *dest = src; - dest->day--; - if (dest->day <= 0) { - dest->month--; - if (dest->month <= 0) { - dest->month = MAX_MONTH; - dest->year--; - } - dest->day = getDays(dest->year, dest->month); - } - } - - static int getDays(int year, int month) NO_INLINE { - u16 days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - BOOL check = year % 4 == 0 && year % 100 != 0 || year % 400 == 0 ? TRUE : FALSE; - if (check) { - days[1] = 29; - } - return days[month-1]; - } - - static int getWeek(const Date& date) NO_INLINE { - int month, year, day; - month = date.month; - day = date.day; - year = date.year; - if (month <= 2) { - year--; - month += MAX_MONTH; - } - return (day + (((month * 13) + 8) / 5) + ((year / 400) + ((year + (year / 4)) - (year / 100)))) % 7; - } - - static int getWeek(int year, int month, int day) NO_INLINE { - if (month <= 2) { - year--; - month += MAX_MONTH; - } - return (day + (((month * 13) + 8) / 5) + ((year / 400) + ((year + (year / 4)) - (year / 100)))) % 7; - } - - static void getNextMonth(const Date& src, Date* dest) NO_INLINE { - *dest = src; + static void getTomorrow(const Date& src, Date* dest) NO_INLINE { + *dest = src; + int days = getDays(dest->year, dest->month); + dest->day++; + if (dest->day > days) { dest->month++; if (dest->month > MAX_MONTH) { dest->month = MIN_MONTH; @@ -158,21 +104,73 @@ namespace ipl { } dest->day = MIN_DAY; } - - static void getLastMonth(const Date& src, Date* dest) NO_INLINE { - *dest = src; + } + static void getYesterday(const Date& src, Date* dest) NO_INLINE { + *dest = src; + dest->day--; + if (dest->day <= 0) { dest->month--; if (dest->month <= 0) { - dest->month--; - if (dest->month <= 0) { - dest->month = MAX_MONTH; - dest->year--; - } + dest->month = MAX_MONTH; + dest->year--; } dest->day = getDays(dest->year, dest->month); } - }; - } -} + } -#endif // IPL_UTILITY_CALENDAR_H + static int getDays(int year, int month) NO_INLINE { + u16 days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + BOOL check = year % 4 == 0 && year % 100 != 0 || year % 400 == 0 ? TRUE : FALSE; + if (check) { + days[1] = 29; + } + return days[month - 1]; + } + + static int getWeek(const Date& date) NO_INLINE { + int month, year, day; + month = date.month; + day = date.day; + year = date.year; + if (month <= 2) { + year--; + month += MAX_MONTH; + } + return (day + (((month * 13) + 8) / 5) + ((year / 400) + ((year + (year / 4)) - (year / 100)))) % 7; + } + + static int getWeek(int year, int month, int day) NO_INLINE { + if (month <= 2) { + year--; + month += MAX_MONTH; + } + return (day + (((month * 13) + 8) / 5) + ((year / 400) + ((year + (year / 4)) - (year / 100)))) % 7; + } + + static void getNextMonth(const Date& src, Date* dest) NO_INLINE { + *dest = src; + dest->month++; + if (dest->month > MAX_MONTH) { + dest->month = MIN_MONTH; + dest->year++; + } + dest->day = MIN_DAY; + } + + static void getLastMonth(const Date& src, Date* dest) NO_INLINE { + *dest = src; + dest->month--; + if (dest->month <= 0) { + dest->month--; + if (dest->month <= 0) { + dest->month = MAX_MONTH; + dest->year--; + } + } + dest->day = getDays(dest->year, dest->month); + } + }; + } // namespace utility +} // namespace ipl + +#endif // IPL_UTILITY_CALENDAR_H diff --git a/include/utility/iplCapture.h b/include/utility/iplCapture.h index 3aac5a9c..b227007f 100644 --- a/include/utility/iplCapture.h +++ b/include/utility/iplCapture.h @@ -10,52 +10,52 @@ namespace ipl { namespace utility { class Capture { - public: - /** - * @param heap The memory heap used for this. - * @param x The X position of the capture. - * @param y The Y position of the capture. - * @param width The width position of the capture. - * @param height The height position of the capture. - * @param texFmt Texture format of the capture. (RGB5A3 by default) - */ - Capture(EGG::Heap* heap, int x, int y, int width, int height, GXTexFmt texFmt = GX_TF_RGB5A3); - ~Capture(); + public: + /** + * @param heap The memory heap used for this. + * @param x The X position of the capture. + * @param y The Y position of the capture. + * @param width The width position of the capture. + * @param height The height position of the capture. + * @param texFmt Texture format of the capture. (RGB5A3 by default) + */ + Capture(EGG::Heap* heap, int x, int y, int width, int height, GXTexFmt texFmt = GX_TF_RGB5A3); + ~Capture(); - /** - * @brief Capture the screen - * @param disableFilter Disable the GX filter on capture. - */ - void capture(BOOL disableFilter = FALSE); + /** + * @brief Capture the screen + * @param disableFilter Disable the GX filter on capture. + */ + void capture(BOOL disableFilter = FALSE); - u32 getCaptureX() const { return mXPos; } - u32 getCaptureY() const { return mYPos; } + u32 getCaptureX() const { return mXPos; } + u32 getCaptureY() const { return mYPos; } - u32 getCaptureWidth() const { return mTextureWidth; } - u32 getCaptureHeight() const { return mTextureHeight; } + u32 getCaptureWidth() const { return mTextureWidth; } + u32 getCaptureHeight() const { return mTextureHeight; } - u32 getTexWidth() const { return mTextureWidth; } - u32 getTexHeight() const { return mTextureHeight; } + u32 getTexWidth() const { return mTextureWidth; } + u32 getTexHeight() const { return mTextureHeight; } - u32 getTexSize() const { return mTextureSize; } - u8* getTexBuffer() const { return mTextureBuffer; } - const GXTexObj& getGXTex() const { return mTexObj; } - - private: - u16 mXPos; // 0x00 - u16 mYPos; // 0x02 - - u16 mTextureWidth; // 0x04 - u16 mTextureHeight; // 0x08 - - GXTexFmt mTextureFormat; // 0x08 - - u32 mTextureSize; // 0x0C - u8* mTextureBuffer; // 0x10 - - GXTexObj mTexObj; // 0x14 + u32 getTexSize() const { return mTextureSize; } + u8* getTexBuffer() const { return mTextureBuffer; } + const GXTexObj& getGXTex() const { return mTexObj; } + + private: + u16 mXPos; // 0x00 + u16 mYPos; // 0x02 + + u16 mTextureWidth; // 0x04 + u16 mTextureHeight; // 0x08 + + GXTexFmt mTextureFormat; // 0x08 + + u32 mTextureSize; // 0x0C + u8* mTextureBuffer; // 0x10 + + GXTexObj mTexObj; // 0x14 }; - } -} + } // namespace utility +} // namespace ipl -#endif // IPL_CAPTURE_H +#endif // IPL_CAPTURE_H diff --git a/include/utility/iplCharacterCode.h b/include/utility/iplCharacterCode.h index 3516ee6f..113a93a7 100644 --- a/include/utility/iplCharacterCode.h +++ b/include/utility/iplCharacterCode.h @@ -6,25 +6,25 @@ namespace ipl { namespace utility { class CharacterCode { - public: - static void shiftJISToUTF16(wchar_t* dest, const u8* src, s32 length); + public: + static void shiftJISToUTF16(wchar_t* dest, const u8* src, s32 length); - static void ANSIToUTF16(wchar_t* dest, const u8* src, s32 length); - static void UTF16ToANSI(u8* dest, const wchar_t* src, s32 length); + static void ANSIToUTF16(wchar_t* dest, const u8* src, s32 length); + static void UTF16ToANSI(u8* dest, const wchar_t* src, s32 length); - static void UTF8ToUTF16(wchar_t* dest, const char* src, s32 length); - static void UTF16ToUTF8(char* dest, const wchar_t* src, s32 length); + static void UTF8ToUTF16(wchar_t* dest, const char* src, s32 length); + static void UTF16ToUTF8(char* dest, const wchar_t* src, s32 length); - static void ANSIToUTF8(char* dest, const u8* src); - static void ANSIToUTF8(char* dest, const u8* src, int); - static void UTF8ToANSI(char* dest, const u8* src); + static void ANSIToUTF8(char* dest, const u8* src); + static void ANSIToUTF8(char* dest, const u8* src, int); + static void UTF8ToANSI(char* dest, const u8* src); - static void UTF16ToU32(u32* dest, const wchar_t* src); - static void WiiIdToUTF16(wchar_t* dest, u64 wiiId); + static void UTF16ToU32(u32* dest, const wchar_t* src); + static void WiiIdToUTF16(wchar_t* dest, u64 wiiId); - static void changeEndian(wchar_t* dest, int endian); + static void changeEndian(wchar_t* dest, int endian); }; - } -} + } // namespace utility +} // namespace ipl -#endif // IPL_UTILITY_CHARACTER_CODE_H +#endif // IPL_UTILITY_CHARACTER_CODE_H diff --git a/include/utility/iplESMisc.h b/include/utility/iplESMisc.h index 5d6d0ee3..87cdb734 100644 --- a/include/utility/iplESMisc.h +++ b/include/utility/iplESMisc.h @@ -9,64 +9,62 @@ namespace ipl { namespace utility { class TMDFile { - public: - typedef struct EntryHead { - ESTitleId titleId; // 0x00 - u32 tmdSize; // 0x08 + public: + typedef struct EntryHead { + ESTitleId titleId; // 0x00 + u32 tmdSize; // 0x08 - void* getTmdPtr() { - return ((u8*)this + OSRoundUp32B(sizeof(EntryHead))); - } - } EntryHead; - TMDFile(EGG::Heap* heap); + void* getTmdPtr() { return ((u8*)this + OSRoundUp32B(sizeof(EntryHead))); } + } EntryHead; + TMDFile(EGG::Heap* heap); - s32 Open(char* fileName); - s32 Close(); + s32 Open(char* fileName); + s32 Close(); - BOOL Exist(ESTitleId titleId, u32* tmdOffset, u32* tmdSize); + BOOL Exist(ESTitleId titleId, u32* tmdOffset, u32* tmdSize); - s32 Backup(ESTitleId titleId); - s32 Restore(ESTitleId titleId); + s32 Backup(ESTitleId titleId); + s32 Restore(ESTitleId titleId); - private: - EGG::Heap* mpHeap; // 0x00 - NANDFileInfo mFile; // 0x04 - BOOL mbFileOpen; // 0x90 - u32 mFileLength; // 0x94 + private: + EGG::Heap* mpHeap; // 0x00 + NANDFileInfo mFile; // 0x04 + BOOL mbFileOpen; // 0x90 + u32 mFileLength; // 0x94 }; class ESMisc { - public: - static ESError GetTmdView(EGG::Heap* heap, ESTitleId titleId, ESTmdView** outTmdView); + public: + static ESError GetTmdView(EGG::Heap* heap, ESTitleId titleId, ESTmdView** outTmdView); - static ESError GetTicketViewList(EGG::Heap* heap, ESTitleId titleId, ESTicketView** outTicketViews, u32* outNumTicketViews); - static ESError GetTicketView(EGG::Heap* heap, ESTitleId titleId, ESTicketView* ticketView, int numTicketViews); + static ESError GetTicketViewList(EGG::Heap* heap, ESTitleId titleId, ESTicketView** outTicketViews, u32* outNumTicketViews); + static ESError GetTicketView(EGG::Heap* heap, ESTitleId titleId, ESTicketView* ticketView, int numTicketViews); - static s32 PrivateContentsExist(ESTitleId titleId); + static s32 PrivateContentsExist(ESTitleId titleId); - static BOOL ContentExist(ESTmdView* tmdView, u32 contentIndex, s32* result); + static BOOL ContentExist(ESTmdView* tmdView, u32 contentIndex, s32* result); - static ESError checkContentsNum(ESTitleId titleId, ESTmdView* tmdView); - - static ESError GetValidTicketIndex(EGG::Heap* heap, ESTitleId titleId, ESTicketView* ticket = NULL, u32 ticketLength = 0); + static ESError checkContentsNum(ESTitleId titleId, ESTmdView* tmdView); - static BOOL IsLastTicketExpired(ESTitleId* titleId); - static void DeleteExpiredFlagFile(); + static ESError GetValidTicketIndex(EGG::Heap* heap, ESTitleId titleId, ESTicketView* ticket = NULL, u32 ticketLength = 0); - static void DeleteUnauthorizedData(EGG::Heap* heap); + static BOOL IsLastTicketExpired(ESTitleId* titleId); + static void DeleteExpiredFlagFile(); - static u32 CheckTmdCountryCode(ESTmdView* tmdView); + static void DeleteUnauthorizedData(EGG::Heap* heap); - static BOOL __IsPCEnable(); + static u32 CheckTmdCountryCode(ESTmdView* tmdView); - static BOOL ChangeUid(ESTitleId titleId); + static BOOL __IsPCEnable(); - static u32 NumInodesSaveDirRoot(ESTitleId titleId); + static BOOL ChangeUid(ESTitleId titleId); - static s32 DeleteTitle(EGG::Heap* heap, ESTitleId titleId); - static s32 DeleteEmptyTitles(EGG::Heap* heap); - static s32 DeleteMetaContent(ESTitleId titleId); + static u32 NumInodesSaveDirRoot(ESTitleId titleId); + + static s32 DeleteTitle(EGG::Heap* heap, ESTitleId titleId); + static s32 DeleteEmptyTitles(EGG::Heap* heap); + static s32 DeleteMetaContent(ESTitleId titleId); }; - } -} + } // namespace utility +} // namespace ipl -#endif // IPL_UTILITY_ES_MISC_H +#endif // IPL_UTILITY_ES_MISC_H diff --git a/include/utility/iplFrameController.h b/include/utility/iplFrameController.h index f1679a5c..14b04a94 100644 --- a/include/utility/iplFrameController.h +++ b/include/utility/iplFrameController.h @@ -4,71 +4,69 @@ #include namespace ipl { - enum { - ANIM_TYPE_FORWARD = 0, - ANIM_TYPE_BACKWARD, - ANIM_TYPE_LOOP, - ANIM_TYPE_ALTERNATE - }; + enum { ANIM_TYPE_FORWARD = 0, ANIM_TYPE_BACKWARD, ANIM_TYPE_LOOP, ANIM_TYPE_ALTERNATE }; namespace utility { class FrameController { - protected: - enum { - ANIM_STATE_STOP = 0, - ANIM_STATE_PLAY, - ANIM_STATE_STOP_REQ, - }; + protected: + enum { + ANIM_STATE_STOP = 0, + ANIM_STATE_PLAY, + ANIM_STATE_STOP_REQ, + }; - public: - FrameController() {} - virtual ~FrameController() {} - - void init(int type, f32 maxFrame, f32 minFrame, f32 speed = 1.0f); - void initFrame(); + public: + FrameController() {} + virtual ~FrameController() {} - virtual void calc(); - - void setMaxFrame(f32 value) { mMaxFrame = value; } - f32 getMaxFrame() const { return mMaxFrame; } - f32 getLastFrame() const { return mMaxFrame - 1.0f; } - - void setMinFrame(f32 value) { mMinFrame = value; } - void setMinFrame(u32 value) { mMinFrame = value; } - f32 getMinFrame() const { return mMinFrame; } + void init(int type, f32 maxFrame, f32 minFrame, f32 speed = 1.0f); + void initFrame(); - f32 getLength() const { return mMaxFrame - mMinFrame; } - - void setCurrentFrame(f32 value) { mFrame = value; } - f32 getCurrentFrame() const { return mFrame; } + virtual void calc(); - void setSpeed(f32 value) { mSpeed = value; } - f32 getSpeed() const { return mSpeed; } + void setMaxFrame(f32 value) { mMaxFrame = value; } + f32 getMaxFrame() const { return mMaxFrame; } + f32 getLastFrame() const { return mMaxFrame - 1.0f; } - void setAnmType(int value) { mAnmType = value; } - int getAnmType() const { return mAnmType; } + void setMinFrame(f32 value) { mMinFrame = value; } + void setMinFrame(u32 value) { mMinFrame = value; } + f32 getMinFrame() const { return mMinFrame; } - void play() { initFrame(); restart(); } - void restart() { mState = ANIM_STATE_PLAY; } - void stop() { mState = ANIM_STATE_STOP; } + f32 getLength() const { return mMaxFrame - mMinFrame; } - bool isPlaying() const { return mState == ANIM_STATE_PLAY; } + void setCurrentFrame(f32 value) { mFrame = value; } + f32 getCurrentFrame() const { return mFrame; } - protected: - f32 mMaxFrame; // 0x04 - f32 mMinFrame; // 0x08 - f32 mFrame; // 0x0C - - f32 mSpeed; // 0x10 + void setSpeed(f32 value) { mSpeed = value; } + f32 getSpeed() const { return mSpeed; } - int mState; // 0x14 - - int mAnmType; // 0x18 + void setAnmType(int value) { mAnmType = value; } + int getAnmType() const { return mAnmType; } - private: - bool mbAlternateBack; // 0x1C + void play() { + initFrame(); + restart(); + } + void restart() { mState = ANIM_STATE_PLAY; } + void stop() { mState = ANIM_STATE_STOP; } + + bool isPlaying() const { return mState == ANIM_STATE_PLAY; } + + protected: + f32 mMaxFrame; // 0x04 + f32 mMinFrame; // 0x08 + f32 mFrame; // 0x0C + + f32 mSpeed; // 0x10 + + int mState; // 0x14 + + int mAnmType; // 0x18 + + private: + bool mbAlternateBack; // 0x1C }; - } -} + } // namespace utility +} // namespace ipl -#endif // IPL_FRAME_CONTROLLER_H +#endif // IPL_FRAME_CONTROLLER_H diff --git a/include/utility/iplGraphics.h b/include/utility/iplGraphics.h index 41210031..65ea2ed9 100644 --- a/include/utility/iplGraphics.h +++ b/include/utility/iplGraphics.h @@ -1,8 +1,8 @@ #ifndef IPL_GRAPHICS_H #define IPL_GRAPHICS_H -#include #include +#include #include #include @@ -12,41 +12,38 @@ namespace ipl { namespace utility { class Graphics { - public: - class Arg { - private: - Arg(); - - nw4r::math::MTX44 mProjMtx; // 0x00 - nw4r::math::MTX34 mViewMtx; // 0x40 - - ipl::math::VEC3 mOrthoTrans; // 0x70 - ipl::math::VEC2 mOrthoScale; // 0x7C - friend class Graphics; - }; - typedef enum Orientation { - ORI_NONE = 0, - ORI_90_CLOCKWISE, - ORI_90_ANTICLOCKWISE - } Orientation; - - static nw4r::math::MTX34& getViewMtx() { return mArg.mViewMtx; } - - static void setOrtho(u32 ortho = GX_PNMTX0); - static void setDefaultOrtho(u32 ortho = GX_PNMTX0); - - static void setOrthoProjection(const math::VEC3& translate, const math::VEC2& scale); - static void setOrthoProjection(u32 id); - - static void calcOrthoCamera(); - static void setCamera(u32 id = 0); - - static void drawPolygon(const nw4r::ut::Rect& rect, GXColor color); - static void drawTexture(const nw4r::ut::Rect& rect, const GXTexObj& texObj, GXColor color, u8 texScale, Orientation ori = ORI_NONE); + public: + class Arg { private: - static Arg mArg; - }; - } -} + Arg(); -#endif // IPL_GRAPHICS_H + nw4r::math::MTX44 mProjMtx; // 0x00 + nw4r::math::MTX34 mViewMtx; // 0x40 + + ipl::math::VEC3 mOrthoTrans; // 0x70 + ipl::math::VEC2 mOrthoScale; // 0x7C + friend class Graphics; + }; + typedef enum Orientation { ORI_NONE = 0, ORI_90_CLOCKWISE, ORI_90_ANTICLOCKWISE } Orientation; + + static nw4r::math::MTX34& getViewMtx() { return mArg.mViewMtx; } + + static void setOrtho(u32 ortho = GX_PNMTX0); + static void setDefaultOrtho(u32 ortho = GX_PNMTX0); + + static void setOrthoProjection(const math::VEC3& translate, const math::VEC2& scale); + static void setOrthoProjection(u32 id); + + static void calcOrthoCamera(); + static void setCamera(u32 id = 0); + + static void drawPolygon(const nw4r::ut::Rect& rect, GXColor color); + static void drawTexture(const nw4r::ut::Rect& rect, const GXTexObj& texObj, GXColor color, u8 texScale, Orientation ori = ORI_NONE); + + private: + static Arg mArg; + }; + } // namespace utility +} // namespace ipl + +#endif // IPL_GRAPHICS_H diff --git a/include/utility/iplJpegDecoder.h b/include/utility/iplJpegDecoder.h index 679aab49..6e513999 100644 --- a/include/utility/iplJpegDecoder.h +++ b/include/utility/iplJpegDecoder.h @@ -6,24 +6,24 @@ #include namespace ipl { - namespace utility { + namespace utility { class JpegDecoder { - public: - JpegDecoder(EGG::Heap* heap); + public: + JpegDecoder(EGG::Heap* heap); - BOOL decodeJpg(EGG::Heap* heap, u8* buffer, u32 length); - BOOL encodeOdh(EGG::Heap* heap, u8* buffer, u32 length); + BOOL decodeJpg(EGG::Heap* heap, u8* buffer, u32 length); + BOOL encodeOdh(EGG::Heap* heap, u8* buffer, u32 length); - BOOL waitCaptured(); + BOOL waitCaptured(); - BOOL makeRawData(); + BOOL makeRawData(); - void clear(); + void clear(); - private: - u8 dummy[0x710]; + private: + u8 dummy[0x710]; }; - } -} + } // namespace utility +} // namespace ipl -#endif // IPL_UTILITY_JPEG_DECODER +#endif // IPL_UTILITY_JPEG_DECODER diff --git a/include/utility/iplLayout.h b/include/utility/iplLayout.h index c94fca2c..ff60d60c 100644 --- a/include/utility/iplLayout.h +++ b/include/utility/iplLayout.h @@ -1,21 +1,21 @@ #ifndef IPL_UTILITY_LAYOUT_H #define IPL_UTILITY_LAYOUT_H -#include #include +#include -#include #include +#include namespace ipl { namespace utility { namespace layout { - void set_string(nw4r::lyt::Pane* pane, const wchar_t* string); + void set_string(nw4r::lyt::Pane* pane, const wchar_t* string); - void set_texture(nw4r::lyt::Material* dest, const GXTexObj& texObj); - void set_texture(nw4r::lyt::Material* dest, const nw4r::lyt::Material* src, u8 texMap = GX_TEXMAP0); - } - } -} + void set_texture(nw4r::lyt::Material* dest, const GXTexObj& texObj); + void set_texture(nw4r::lyt::Material* dest, const nw4r::lyt::Material* src, u8 texMap = GX_TEXMAP0); + } // namespace layout + } // namespace utility +} // namespace ipl -#endif // IPL_UTILITY_LAYOUT_H +#endif // IPL_UTILITY_LAYOUT_H diff --git a/include/utility/iplLock.h b/include/utility/iplLock.h index f9c04aac..e29b6662 100644 --- a/include/utility/iplLock.h +++ b/include/utility/iplLock.h @@ -1,34 +1,29 @@ #ifndef IPL_LOCK_H #define IPL_LOCK_H -#include #include +#include namespace ipl { namespace utility { class autoMutexLock { - public: - autoMutexLock(OSMutex& lockObj, bool tryLock = false) : mLockObj(lockObj) { - OSLockMutex(&mLockObj); - } - ~autoMutexLock() { - OSUnlockMutex(&mLockObj); - } - private: - OSMutex& mLockObj; // 0x00 + public: + autoMutexLock(OSMutex& lockObj, bool tryLock = false) : mLockObj(lockObj) { OSLockMutex(&mLockObj); } + ~autoMutexLock() { OSUnlockMutex(&mLockObj); } + + private: + OSMutex& mLockObj; // 0x00 }; class autoInterruptLock { - public: - autoInterruptLock() : mOldState(OSDisableInterrupts()) {} - ~autoInterruptLock() { - OSRestoreInterrupts(mOldState); - } + public: + autoInterruptLock() : mOldState(OSDisableInterrupts()) {} + ~autoInterruptLock() { OSRestoreInterrupts(mOldState); } - private: - BOOL mOldState; // 0x00 + private: + BOOL mOldState; // 0x00 }; - } -} + } // namespace utility +} // namespace ipl -#endif // IPL_LOCK_H +#endif // IPL_LOCK_H diff --git a/include/utility/iplMessageBase.h b/include/utility/iplMessageBase.h index fd9af76f..ce1b13ef 100644 --- a/include/utility/iplMessageBase.h +++ b/include/utility/iplMessageBase.h @@ -8,29 +8,28 @@ namespace ipl { namespace utility { class ut_message_base { - public: - virtual ~ut_message_base() {} - virtual BOOL SendMessage(OSMessage msg, s32 flags); // 0x0C - virtual BOOL JamMessage(OSMessage msg, s32 flags); // 0x10 - virtual BOOL ReceiveMessage(OSMessage* pMsg, s32 flags); // 0x14 - virtual void InitMessageQueue(OSMessage* pMsg, s32 msgCount); // 0x18 - - private: - OSMessageQueue mpMsgQueue; // 0x04 + public: + virtual ~ut_message_base() {} + virtual BOOL SendMessage(OSMessage msg, s32 flags); // 0x0C + virtual BOOL JamMessage(OSMessage msg, s32 flags); // 0x10 + virtual BOOL ReceiveMessage(OSMessage* pMsg, s32 flags); // 0x14 + virtual void InitMessageQueue(OSMessage* pMsg, s32 msgCount); // 0x18 + + private: + OSMessageQueue mpMsgQueue; // 0x04 }; - template class ut_message : public ut_message_base { - public: - ut_message() { - InitMessageQueue(mMessages, count); - } - virtual ~ut_message() {} + template + class ut_message : public ut_message_base { + public: + ut_message() { InitMessageQueue(mMessages, count); } + virtual ~ut_message() {} - private: - OSMessage mMessages[count]; // 0x24 - u32 unk_0x00; // (sizeof(mMessages) * count) + 0x00 + private: + OSMessage mMessages[count]; // 0x24 + u32 unk_0x00; // (sizeof(mMessages) * count) + 0x00 }; - } -} + } // namespace utility +} // namespace ipl -#endif // IPL_MESSAGE_BASE_H +#endif // IPL_MESSAGE_BASE_H diff --git a/include/utility/iplMisc.h b/include/utility/iplMisc.h index 5b536207..52a2653d 100644 --- a/include/utility/iplMisc.h +++ b/include/utility/iplMisc.h @@ -15,24 +15,26 @@ namespace ipl { * @param basePos The IR position. * @return The Cursor Position as `ipl::math::VEC2` */ - math::VEC2 get_cursor_pos(const math::VEC2& basePos); - + math::VEC2 get_cursor_pos(const math::VEC2& basePos); + class Language { - public: - static char* getPath(); + public: + static char* getPath(); }; - template inline void setBit(T* b, int pos) { + template + inline void setBit(T* b, int pos) { const T mask = (T)(1 << pos); *b |= mask; } - template inline void clearBit(T* b, int pos) { + template + inline void clearBit(T* b, int pos) { *b &= ~(T)(1 << pos); } int memcpy_s(void* dest, u32 destSize, const void* src, u32 srcSize); - } -} + } // namespace utility +} // namespace ipl -#endif // IPL_UTILITY_MISC_H +#endif // IPL_UTILITY_MISC_H diff --git a/include/utility/iplQueue.h b/include/utility/iplQueue.h index 87ab0c87..892e22b3 100644 --- a/include/utility/iplQueue.h +++ b/include/utility/iplQueue.h @@ -5,48 +5,57 @@ namespace ipl { namespace utility { - template class Queue { - public: - inline Queue() : - count(c), - current(0), - popped(0), pushed(0) {} + template + class Queue { + public: + inline Queue() : count(c), current(0), popped(0), pushed(0) {} - BOOL push(const T& item) { - if (count == current) { return FALSE; } - items[pushed] = item; - if (++pushed >= count) { pushed = 0; } current++; - return TRUE; + BOOL push(const T& item) { + if (count == current) { + return FALSE; } - - BOOL pop() { - BOOL result = TRUE; - if (current == 0) { result = FALSE; goto done; } - if (++popped >= count) { popped = 0; } current--; - done: - return result; + items[pushed] = item; + if (++pushed >= count) { + pushed = 0; } + current++; + return TRUE; + } - int get_current_index() { return current; } - T& get_current_item() { return items[get_current_index()]; } + BOOL pop() { + BOOL result = TRUE; + if (current == 0) { + result = FALSE; + goto done; + } + if (++popped >= count) { + popped = 0; + } + current--; + done: + return result; + } - int get_popped_index() { return popped; } - T& get_popped_item() { return items[get_popped_index()]; } + int get_current_index() { return current; } + T& get_current_item() { return items[get_current_index()]; } - void next_popped_item() { popped++; } - void no_popped_item() { popped = 0; } + int get_popped_index() { return popped; } + T& get_popped_item() { return items[get_popped_index()]; } - int get_pushed_index() { return pushed; } - T& get_pushed_item() { return items[get_pushed_index()]; } + void next_popped_item() { popped++; } + void no_popped_item() { popped = 0; } - T items[c]; // 0x00 - public: - int count; // (sizeof(items) * count) + 0x00 - - int current; // (sizeof(items) * count) + 0x04 - int popped, pushed; // (sizeof(items) * count) + 0x08 + int get_pushed_index() { return pushed; } + T& get_pushed_item() { return items[get_pushed_index()]; } + + T items[c]; // 0x00 + public: + int count; // (sizeof(items) * count) + 0x00 + + int current; // (sizeof(items) * count) + 0x04 + int popped, pushed; // (sizeof(items) * count) + 0x08 }; - } -} + } // namespace utility +} // namespace ipl -#endif // IPL_QUEUE_H +#endif // IPL_QUEUE_H diff --git a/include/utility/iplRBRUtility.h b/include/utility/iplRBRUtility.h index 627296bd..c8d9453e 100644 --- a/include/utility/iplRBRUtility.h +++ b/include/utility/iplRBRUtility.h @@ -9,18 +9,18 @@ namespace ipl { class RBRUtility { - public: - static void getPosRect(f32 left, f32 right, f32 top, f32 bottom) { RBRGetPosRect(&left, &right, &top, &bottom); } - static void getPosRect(nw4r::ut::Rect* rect) { RBRGetPosRect(&rect->left, &rect->right, &rect->top, &rect->bottom); } + public: + static void getPosRect(f32 left, f32 right, f32 top, f32 bottom) { RBRGetPosRect(&left, &right, &top, &bottom); } + static void getPosRect(nw4r::ut::Rect* rect) { RBRGetPosRect(&rect->left, &rect->right, &rect->top, &rect->bottom); } - static const void* getPicture(u8* recordData, u32* picSize = NULL) { return RBRGetPicture(recordData, picSize); } + static const void* getPicture(u8* recordData, u32* picSize = NULL) { return RBRGetPicture(recordData, picSize); } - static const wchar_t* getTitle(void* recordData) { return (const wchar_t*)((u8*)recordData + ((RBRHeader*)recordData)->titleOffset); } - static const wchar_t* getBody(void* recordData) { return (const wchar_t*)((u8*)recordData + ((RBRHeader*)recordData)->bodyOffset); } - static RFLiCharData* getFace(void* recordData) { return (RFLiCharData*)((u8*)recordData + ((RBRHeader*)recordData)->faceOffset); } + static const wchar_t* getTitle(void* recordData) { return (const wchar_t*)((u8*)recordData + ((RBRHeader*)recordData)->titleOffset); } + static const wchar_t* getBody(void* recordData) { return (const wchar_t*)((u8*)recordData + ((RBRHeader*)recordData)->bodyOffset); } + static RFLiCharData* getFace(void* recordData) { return (RFLiCharData*)((u8*)recordData + ((RBRHeader*)recordData)->faceOffset); } - static void* getAttachData(void* recordData, int index) { return (void*)((u8*)recordData + ((RBRHeader*)recordData)->attach[index].offset); } + static void* getAttachData(void* recordData, int index) { return (void*)((u8*)recordData + ((RBRHeader*)recordData)->attach[index].offset); } }; -} +} // namespace ipl -#endif // IPL_UTILITY_RBR_H +#endif // IPL_UTILITY_RBR_H diff --git a/include/utility/iplScroller.h b/include/utility/iplScroller.h index c7a5cfcc..96a1f5ec 100644 --- a/include/utility/iplScroller.h +++ b/include/utility/iplScroller.h @@ -8,94 +8,94 @@ namespace ipl { namespace utility { class BScroller { - public: - BScroller(); + public: + BScroller(); - virtual BOOL isYoungController(); + virtual BOOL isYoungController(); - void init(); - BOOL calc(); + void init(); + BOOL calc(); - bool isActive() const; - bool isDown() const; - bool isUp() const; + bool isActive() const; + bool isDown() const; + bool isUp() const; - f32 getSpeed() { return mSpeed; } - f32 addSoundFreq(f32 v) { return mSoundFreq += v; } + f32 getSpeed() { return mSpeed; } + f32 addSoundFreq(f32 v) { return mSoundFreq += v; } - protected: - f32 _get(); - void set_arw_param(); + protected: + f32 _get(); + void set_arw_param(); - u8 unk_0x04[0x14]; + u8 unk_0x04[0x14]; - f32 mSpeed; // 0x18 - f32 mSoundFreq; // 0x1C + f32 mSpeed; // 0x18 + f32 mSoundFreq; // 0x1C }; class YoungBScroller : public BScroller { - public: - YoungBScroller() : BScroller() {} + public: + YoungBScroller() : BScroller() {} - virtual BOOL isYoungController(); + virtual BOOL isYoungController(); }; class Scroller { - protected: - enum { - STATE_NORMAL = 0, - STATE_SCROLL_CON_UP, - STATE_SCROLL_CON_DOWN, - STATE_SCROLL_BTN_UP, - STATE_SCROLL_BTN_DOWN, - }; + protected: + enum { + STATE_NORMAL = 0, + STATE_SCROLL_CON_UP, + STATE_SCROLL_CON_DOWN, + STATE_SCROLL_BTN_UP, + STATE_SCROLL_BTN_DOWN, + }; - public: - Scroller(); + public: + Scroller(); - void init() { - mState = 0; - mScroll = 0.0f; - unk_0x3C = 0.0f; - mUpLimit = 0.0f; - mDownLimit = 0.0f; - } + void init() { + mState = 0; + mScroll = 0.0f; + unk_0x3C = 0.0f; + mUpLimit = 0.0f; + mDownLimit = 0.0f; + } - void calc(); - f32 get() const; + void calc(); + f32 get() const; - f32 movable_pos(f32 speed) const; + f32 movable_pos(f32 speed) const; - void scrollUpByCon() { mState = STATE_SCROLL_CON_UP; } - void scrollDownByCon() { mState = STATE_SCROLL_CON_DOWN; } - void scrollUpByBtn() { mState = STATE_SCROLL_BTN_UP; } - void scrollDownByBtn() { mState = STATE_SCROLL_BTN_DOWN; } + void scrollUpByCon() { mState = STATE_SCROLL_CON_UP; } + void scrollDownByCon() { mState = STATE_SCROLL_CON_DOWN; } + void scrollUpByBtn() { mState = STATE_SCROLL_BTN_UP; } + void scrollDownByBtn() { mState = STATE_SCROLL_BTN_DOWN; } - void setDownLimit(f32 v) { mDownLimit = v; } - void setUpLimit(f32 v) { mUpLimit = v; } + void setDownLimit(f32 v) { mDownLimit = v; } + void setUpLimit(f32 v) { mUpLimit = v; } - void addScroll(f32 v) { mScroll += v; } + void addScroll(f32 v) { mScroll += v; } - bool isActive() const { return mState == STATE_NORMAL; } + bool isActive() const { return mState == STATE_NORMAL; } - bool isDownEnd() const { return mScroll == mDownLimit; } - bool isUpEnd() const { return mScroll == mUpLimit; } + bool isDownEnd() const { return mScroll == mDownLimit; } + bool isUpEnd() const { return mScroll == mUpLimit; } - protected: - void movable_pos(); + protected: + void movable_pos(); - math::HermiteIntp anim; + math::HermiteIntp anim; - int mState; // 0x30 - f32 mDownLimit; // 0x34 - f32 mUpLimit; // 0x38 - f32 unk_0x3C; - f32 mScroll; // 0x40 - f32 unk_0x44; - f32 unk_0x48; - f32 unk_0x4C; + int mState; // 0x30 + f32 mDownLimit; // 0x34 + f32 mUpLimit; // 0x38 + f32 unk_0x3C; + f32 mScroll; // 0x40 + f32 unk_0x44; + f32 unk_0x48; + f32 unk_0x4C; }; - } -} + } // namespace utility +} // namespace ipl -#endif // IPL_UTILITY_SCROLLER_H +#endif // IPL_UTILITY_SCROLLER_H diff --git a/include/utility/iplTPLValidity.h b/include/utility/iplTPLValidity.h index daafe81a..420d549e 100644 --- a/include/utility/iplTPLValidity.h +++ b/include/utility/iplTPLValidity.h @@ -6,20 +6,20 @@ namespace ipl { namespace utility { class tpl_validity { - public: - tpl_validity(TPLPalette* pal, u32 palSize); + public: + tpl_validity(TPLPalette* pal, u32 palSize); - BOOL is_valid_for_ltx(); + BOOL is_valid_for_ltx(); - static BOOL isValidForLTX(TPLPalette* pal, u32 palSize) { - tpl_validity inst(pal, palSize); - return inst.is_valid_for_ltx(); - } - - private: - u8 unk_0x00[16]; + static BOOL isValidForLTX(TPLPalette* pal, u32 palSize) { + tpl_validity inst(pal, palSize); + return inst.is_valid_for_ltx(); + } + + private: + u8 unk_0x00[16]; }; - } -} + } // namespace utility +} // namespace ipl -#endif // IPL_UTILITY_TPL_VADILITY_H +#endif // IPL_UTILITY_TPL_VADILITY_H diff --git a/include/utility/iplThread.h b/include/utility/iplThread.h index 992fb436..a012dcde 100644 --- a/include/utility/iplThread.h +++ b/include/utility/iplThread.h @@ -1,38 +1,36 @@ #ifndef IPL_THREAD #define IPL_THREAD -#include #include +#include namespace ipl { namespace utility { class ut_thread { - public: - ut_thread(); + public: + ut_thread(); - virtual ~ut_thread(); // 0x08 - virtual void* Run() = 0; // 0x0C - virtual void Create(void* pStack, u32 stackSize, int priority, bool bStartThread = true); // 0x10 - virtual void Resume(); // 0x14 - virtual void Suspend(); // 0x18 - virtual BOOL WaitForThreadExit(); // 0x1C - virtual bool IsThreadTerminated(); // 0x20 - virtual bool IsThreadSuspended(); // 0x24 - virtual bool SetThreadPriority(int priority); // 0x28 - - private: - static void* ThreadMain_(void* param); + virtual ~ut_thread(); // 0x08 + virtual void* Run() = 0; // 0x0C + virtual void Create(void* pStack, u32 stackSize, int priority, bool bStartThread = true); // 0x10 + virtual void Resume(); // 0x14 + virtual void Suspend(); // 0x18 + virtual BOOL WaitForThreadExit(); // 0x1C + virtual bool IsThreadTerminated(); // 0x20 + virtual bool IsThreadSuspended(); // 0x24 + virtual bool SetThreadPriority(int priority); // 0x28 - OSThread mThread; // 0x08 - - void* mpStack; // 0x320 - u32 mStackSize; // 0x324 - - int mPriority; // 0x328 + private: + static void* ThreadMain_(void* param); + + OSThread mThread; // 0x08 + + void* mpStack; // 0x320 + u32 mStackSize; // 0x324 + + int mPriority; // 0x328 }; - } -} - -#endif // IPL_THREAD - + } // namespace utility +} // namespace ipl +#endif // IPL_THREAD diff --git a/include/utility/iplTimer.h b/include/utility/iplTimer.h index dfd1fad1..f0110a85 100644 --- a/include/utility/iplTimer.h +++ b/include/utility/iplTimer.h @@ -6,14 +6,14 @@ namespace ipl { namespace utility { class timer { - public: - bool operator()(); - void set_msec(int ms); - - private: - OSTime tick; - }; - } -} + public: + bool operator()(); + void set_msec(int ms); -#endif // IPL_UTILITY_H + private: + OSTime tick; + }; + } // namespace utility +} // namespace ipl + +#endif // IPL_UTILITY_H diff --git a/include/utility/iplTree.h b/include/utility/iplTree.h index e9e7407a..40e3481f 100644 --- a/include/utility/iplTree.h +++ b/include/utility/iplTree.h @@ -4,94 +4,95 @@ namespace ipl { namespace utility { class Tree { + public: + Tree(); + + virtual ~Tree(){}; // 0x08 + + virtual Tree* getParent() { return mpParent; } // 0x0C + virtual Tree* getChild() { return mpChild; } // 0x10 + virtual Tree* getNext() { return mpNext; } // 0x14 + virtual Tree* getPrev() { return mpPrev; } // 0x18 + + void attach(Tree* tree); + void insert(Tree* tree, Tree* childTree); + void detach(); + + static Tree* empty() { return (Tree*)0; } + + class iterator { + typedef Tree value_type; + typedef value_type* pointer; + typedef value_type& reference; + public: - Tree(); + explicit inline iterator(pointer ptr) : mPtr(ptr) {} - virtual ~Tree() {}; // 0x08 + virtual reference operator*() { return *mPtr; } + pointer operator->() { return mPtr; } - virtual Tree* getParent() { return mpParent; } // 0x0C - virtual Tree* getChild() { return mpChild; } // 0x10 - virtual Tree* getNext() { return mpNext; } // 0x14 - virtual Tree* getPrev() { return mpPrev; } // 0x18 + pointer getPtr() { return (pointer)mPtr; } - void attach(Tree* tree); - void insert(Tree* tree, Tree* childTree); - void detach(); + iterator& operator++() { + next(); + return *this; + } - static Tree* empty() { return (Tree*)0; } - - class iterator { - typedef Tree value_type; - typedef value_type* pointer; - typedef value_type& reference; - - public: - explicit inline iterator(pointer ptr) : mPtr(ptr) {} - - virtual reference operator*() { return *mPtr; } - pointer operator->() { return mPtr; } - - pointer getPtr() { return (pointer)mPtr; } - - iterator& operator++() { next(); return *this; } - - inline void next() { - if (mPtr->getChild()) { - mPtr = mPtr->getChild(); - } - else { - if (mPtr->getNext()) { - mPtr = mPtr->getNext(); - } - else { - while (1) { - if (!mPtr->getNext()) { - break; - } - mPtr = mPtr->getNext(); - } - mPtr = mPtr->getParent(); + inline void next() { + if (mPtr->getChild()) { + mPtr = mPtr->getChild(); + } else { + if (mPtr->getNext()) { + mPtr = mPtr->getNext(); + } else { + while (1) { + if (!mPtr->getNext()) { + break; } + mPtr = mPtr->getNext(); } + mPtr = mPtr->getParent(); } - - protected: - pointer mPtr; - }; - - class reverse_iterator { - typedef Tree value_type; - typedef value_type* pointer; - typedef value_type& reference; - - public: - explicit inline reverse_iterator(pointer ptr) : mPtr(ptr) { reverse(); } - - virtual reference operator*() { return (reference)*mPtr; } - pointer operator->() { return (pointer)mPtr; } - - pointer getPtr() { return (pointer)mPtr; } - - inline void reverse() { - while (mPtr->getChild()) { - mPtr = mPtr->getChild(); - while (mPtr->getNext()) { - mPtr = mPtr->getNext(); - } - } - } - - protected: - pointer mPtr; - }; + } + } protected: - Tree* mpParent; // 0x04 - Tree* mpChild; // 0x08 - Tree* mpNext; // 0x0C - Tree* mpPrev; // 0x10 - }; - } -} + pointer mPtr; + }; -#endif // IPL_TREE_NODE_H + class reverse_iterator { + typedef Tree value_type; + typedef value_type* pointer; + typedef value_type& reference; + + public: + explicit inline reverse_iterator(pointer ptr) : mPtr(ptr) { reverse(); } + + virtual reference operator*() { return (reference)*mPtr; } + pointer operator->() { return (pointer)mPtr; } + + pointer getPtr() { return (pointer)mPtr; } + + inline void reverse() { + while (mPtr->getChild()) { + mPtr = mPtr->getChild(); + while (mPtr->getNext()) { + mPtr = mPtr->getNext(); + } + } + } + + protected: + pointer mPtr; + }; + + protected: + Tree* mpParent; // 0x04 + Tree* mpChild; // 0x08 + Tree* mpNext; // 0x0C + Tree* mpPrev; // 0x10 + }; + } // namespace utility +} // namespace ipl + +#endif // IPL_TREE_NODE_H diff --git a/include/utility/iplWpad.h b/include/utility/iplWpad.h index b883a7c3..25b12247 100644 --- a/include/utility/iplWpad.h +++ b/include/utility/iplWpad.h @@ -7,12 +7,10 @@ namespace ipl { namespace utility { namespace wpad { - u32 getWpadConnectedMask(); - BOOL isIncreaseConnectedWpad(u32 prevMask, u32 nextMask); - } - } -} - -#endif // IPL_UTILITY_WPAD_H - + u32 getWpadConnectedMask(); + BOOL isIncreaseConnectedWpad(u32 prevMask, u32 nextMask); + } // namespace wpad + } // namespace utility +} // namespace ipl +#endif // IPL_UTILITY_WPAD_H diff --git a/libs/EGG/include/egg/core.h b/libs/EGG/include/egg/core.h index 6a69415b..200ae640 100644 --- a/libs/EGG/include/egg/core.h +++ b/libs/EGG/include/egg/core.h @@ -1,6 +1,7 @@ #ifndef EGG_CORE_H #define EGG_CORE_H +// clang-format off #include #include #include @@ -15,5 +16,6 @@ #include #include +// clang-format on #endif // EGG_CORE_H diff --git a/libs/EGG/include/egg/core/eggAllocator.h b/libs/EGG/include/egg/core/eggAllocator.h index 549dc8ce..18dd4456 100644 --- a/libs/EGG/include/egg/core/eggAllocator.h +++ b/libs/EGG/include/egg/core/eggAllocator.h @@ -7,15 +7,15 @@ namespace EGG { class Allocator : public MEMAllocator { - public: - Allocator(Heap* heap, s32 align); - virtual ~Allocator(); - - virtual void* alloc(u32 size); - virtual void free(void* buffer); + public: + Allocator(Heap* heap, s32 align); + virtual ~Allocator(); - operator MEMAllocator*() { return this; } + virtual void* alloc(u32 size); + virtual void free(void* buffer); + + operator MEMAllocator*() { return this; } }; -} +} // namespace EGG -#endif // EGG_CORE_ALLOCATOR_H +#endif // EGG_CORE_ALLOCATOR_H diff --git a/libs/EGG/include/egg/core/eggColorFader.h b/libs/EGG/include/egg/core/eggColorFader.h index 2d17e715..af544105 100644 --- a/libs/EGG/include/egg/core/eggColorFader.h +++ b/libs/EGG/include/egg/core/eggColorFader.h @@ -1,31 +1,32 @@ #ifndef EGG_CORE_COLOR_FADER_H #define EGG_CORE_COLOR_FADER_H -#include #include +#include namespace EGG { class ColorFader : public Fader { - public: - ColorFader(f32 left, f32 top, f32 right, f32 bottom, nw4r::ut::Color color = nw4r::ut::Color(0), EStatus status = EGG::ColorFader::PREPARE_IN); - - virtual void setStatus(EStatus status); // 0x08 - virtual EStatus getStatus() const; // 0x0C - - virtual bool fadeIn(); // 0x10 - virtual bool fadeOut(); // 0x14 - - virtual bool calc(); // 0x18 - virtual void draw(); // 0x1C - - virtual ~ColorFader(); // 0x20 - - private: /* ? */ - void setFrame(u16 value); - void setColor(nw4r::ut::Color value); + public: + ColorFader(f32 left, f32 top, f32 right, f32 bottom, nw4r::ut::Color color = nw4r::ut::Color(0), + EStatus status = EGG::ColorFader::PREPARE_IN); - u8 dummy[0x20]; + virtual void setStatus(EStatus status); // 0x08 + virtual EStatus getStatus() const; // 0x0C + + virtual bool fadeIn(); // 0x10 + virtual bool fadeOut(); // 0x14 + + virtual bool calc(); // 0x18 + virtual void draw(); // 0x1C + + virtual ~ColorFader(); // 0x20 + + private: /* ? */ + void setFrame(u16 value); + void setColor(nw4r::ut::Color value); + + u8 dummy[0x20]; }; -} +} // namespace EGG -#endif // EGG_CORE_COLOR_FADER_H +#endif // EGG_CORE_COLOR_FADER_H diff --git a/libs/EGG/include/egg/core/eggDisposer.h b/libs/EGG/include/egg/core/eggDisposer.h index 618e379a..1bbc6959 100644 --- a/libs/EGG/include/egg/core/eggDisposer.h +++ b/libs/EGG/include/egg/core/eggDisposer.h @@ -7,16 +7,14 @@ namespace EGG { class Heap; class Disposer { - public: - Disposer(); - virtual ~Disposer(); - - private: - Heap* mpHeap; // 0x00 - nw4r::ut::Link mLink; // 0x04 + public: + Disposer(); + virtual ~Disposer(); + + private: + Heap* mpHeap; // 0x00 + nw4r::ut::Link mLink; // 0x04 }; -} - -#endif // EGG_CORE_DISPOSER_H - +} // namespace EGG +#endif // EGG_CORE_DISPOSER_H diff --git a/libs/EGG/include/egg/core/eggExpHeap.h b/libs/EGG/include/egg/core/eggExpHeap.h index fc1c89e2..72dc54e4 100644 --- a/libs/EGG/include/egg/core/eggExpHeap.h +++ b/libs/EGG/include/egg/core/eggExpHeap.h @@ -5,10 +5,10 @@ namespace EGG { class ExpHeap : public Heap { - public: - static ExpHeap* create(void* arena, u32 allocSize, u16 opt); - static ExpHeap* create(u32 allocSize, Heap* parent, u16 opt); + public: + static ExpHeap* create(void* arena, u32 allocSize, u16 opt); + static ExpHeap* create(u32 allocSize, Heap* parent, u16 opt); }; -} +} // namespace EGG -#endif // EGG_CORE_EXPHEAP_H +#endif // EGG_CORE_EXPHEAP_H diff --git a/libs/EGG/include/egg/core/eggFader.h b/libs/EGG/include/egg/core/eggFader.h index 6cce0bde..022622d9 100644 --- a/libs/EGG/include/egg/core/eggFader.h +++ b/libs/EGG/include/egg/core/eggFader.h @@ -3,23 +3,18 @@ namespace EGG { class Fader { - public: - typedef enum EStatus { - PREPARE_IN = 0, - PREPARE_OUT, - FADE_IN, - FADE_OUT - } EStatus; - - virtual void setStatus(EStatus newStatus) = 0; - virtual EStatus getStatus() const = 0; - - virtual bool fadeIn() = 0; - virtual bool fadeOut() = 0; - - virtual bool calc() = 0; - virtual void draw() = 0; - }; -} + public: + typedef enum EStatus { PREPARE_IN = 0, PREPARE_OUT, FADE_IN, FADE_OUT } EStatus; -#endif // EGG_CORE_FADER_H + virtual void setStatus(EStatus newStatus) = 0; + virtual EStatus getStatus() const = 0; + + virtual bool fadeIn() = 0; + virtual bool fadeOut() = 0; + + virtual bool calc() = 0; + virtual void draw() = 0; + }; +} // namespace EGG + +#endif // EGG_CORE_FADER_H diff --git a/libs/EGG/include/egg/core/eggFrmHeap.h b/libs/EGG/include/egg/core/eggFrmHeap.h index 2124196b..6e4b0c09 100644 --- a/libs/EGG/include/egg/core/eggFrmHeap.h +++ b/libs/EGG/include/egg/core/eggFrmHeap.h @@ -5,9 +5,9 @@ namespace EGG { class FrmHeap : public Heap { - public: - static FrmHeap* create(u32, EGG::Heap*, u16); + public: + static FrmHeap* create(u32, EGG::Heap*, u16); }; -} +} // namespace EGG -#endif // EGG_CORE_FRM_HEAP_H +#endif // EGG_CORE_FRM_HEAP_H diff --git a/libs/EGG/include/egg/core/eggGraphicsFifo.h b/libs/EGG/include/egg/core/eggGraphicsFifo.h index eaf8a191..a63ca216 100644 --- a/libs/EGG/include/egg/core/eggGraphicsFifo.h +++ b/libs/EGG/include/egg/core/eggGraphicsFifo.h @@ -8,41 +8,37 @@ namespace EGG { class GraphicsFifo { - public: - typedef struct GpStatus { - GXBool overhi; // 0x00 - GXBool underlow; // 0x01 - GXBool readIdle; // 0x02 - GXBool cmdIdle; // 0x03 - GXBool brkpt; // 0x04 - } GpStatus; + public: + typedef struct GpStatus { + GXBool overhi; // 0x00 + GXBool underlow; // 0x01 + GXBool readIdle; // 0x02 + GXBool cmdIdle; // 0x03 + GXBool brkpt; // 0x04 + } GpStatus; - public: - static GraphicsFifo* create(u32 size, Heap* pHeap); + public: + static GraphicsFifo* create(u32 size, Heap* pHeap); - GraphicsFifo(u32 size, Heap* pHeap); - virtual ~GraphicsFifo(); // at 0x8 + GraphicsFifo(u32 size, Heap* pHeap); + virtual ~GraphicsFifo(); // at 0x8 - static bool isGPActive() { - return !getGpStatus().readIdle; - } + static bool isGPActive() { return !getGpStatus().readIdle; } - static const GpStatus& getGpStatus() { - GXGetGPStatus(&sGpStatus.overhi, &sGpStatus.underlow, - &sGpStatus.readIdle, &sGpStatus.cmdIdle, - &sGpStatus.brkpt); + static const GpStatus& getGpStatus() { + GXGetGPStatus(&sGpStatus.overhi, &sGpStatus.underlow, &sGpStatus.readIdle, &sGpStatus.cmdIdle, &sGpStatus.brkpt); - return sGpStatus; - } + return sGpStatus; + } - private: - GXFifoObj* mpFifoObj; // 0x04 - void* mpBuffer; // 0x08 - u32 mBufSize; // 0x0C + private: + GXFifoObj* mpFifoObj; // 0x04 + void* mpBuffer; // 0x08 + u32 mBufSize; // 0x0C - static GraphicsFifo* sGraphicsFifo; - static GpStatus sGpStatus; + static GraphicsFifo* sGraphicsFifo; + static GpStatus sGpStatus; }; -} +} // namespace EGG -#endif // EGG_CORE_GRAPHICS_FIFO_H +#endif // EGG_CORE_GRAPHICS_FIFO_H diff --git a/libs/EGG/include/egg/core/eggHeap.h b/libs/EGG/include/egg/core/eggHeap.h index 45d35e00..0295a91c 100644 --- a/libs/EGG/include/egg/core/eggHeap.h +++ b/libs/EGG/include/egg/core/eggHeap.h @@ -5,8 +5,8 @@ #include -#include #include +#include #include @@ -15,57 +15,52 @@ namespace EGG { class Allocator; class Heap : Disposer { - public: - typedef enum HeapKind { - HEAP_EXPANDED = 1, - HEAP_FRAME = 2 - } HeapKind; + public: + typedef enum HeapKind { HEAP_EXPANDED = 1, HEAP_FRAME = 2 } HeapKind; - static void initialize(); - - virtual ~Heap(); // 0x08 + static void initialize(); - virtual HeapKind getHeapKind() const = 0; // 0x0C + virtual ~Heap(); // 0x08 - virtual void initAllocator(Allocator* allocator, s32 align) = 0; // 0x10 + virtual HeapKind getHeapKind() const = 0; // 0x0C - virtual void* alloc(u32 size, s32 align) = 0; // 0x14 - virtual void free(void* buffer) = 0; // 0x18 + virtual void initAllocator(Allocator* allocator, s32 align) = 0; // 0x10 - virtual void destroy() = 0; // 0x1C - - virtual void resizeForMBlock(void* block, u32 size) = 0; // 0x20 - - virtual u32 getAllocatableSize(s32 align = 4) = 0; // 0x24 + virtual void* alloc(u32 size, s32 align) = 0; // 0x14 + virtual void free(void* buffer) = 0; // 0x18 - virtual void adjust() = 0; // 0x28 + virtual void destroy() = 0; // 0x1C - void becomeCurrentHeap(); + virtual void resizeForMBlock(void* block, u32 size) = 0; // 0x20 - void dump(); + virtual u32 getAllocatableSize(s32 align = 4) = 0; // 0x24 - void _becomeCurrentHeapWithoutLock(); - void unkUnline1(int id = 0) { - BOOL enabled = OSDisableInterrupts(); - _becomeCurrentHeapWithoutLock(); - OSSetThreadSpecific(id, this); - OSRestoreInterrupts(enabled); - } - static Heap* unkInline2(int id = 0) { - return (Heap*)OSGetThreadSpecific(id); - } + virtual void adjust() = 0; // 0x28 + + void becomeCurrentHeap(); + + void dump(); + + void _becomeCurrentHeapWithoutLock(); + void unkUnline1(int id = 0) { + BOOL enabled = OSDisableInterrupts(); + _becomeCurrentHeapWithoutLock(); + OSSetThreadSpecific(id, this); + OSRestoreInterrupts(enabled); + } + static Heap* unkInline2(int id = 0) { return (Heap*)OSGetThreadSpecific(id); } }; -} +} // namespace EGG -void* operator new(size_t size); -void* operator new(size_t size, int align); -void* operator new(size_t size, EGG::Heap *heap, int align = 4); +void* operator new(size_t size); +void* operator new(size_t size, int align); +void* operator new(size_t size, EGG::Heap* heap, int align = 4); -void* operator new[](size_t size); -void* operator new[](size_t size, int align); -void* operator new[](size_t size, EGG::Heap *heap, int align = 4); +void* operator new[](size_t size); +void* operator new[](size_t size, int align); +void* operator new[](size_t size, EGG::Heap* heap, int align = 4); -void operator delete(void* ptr); -void operator delete[](void* ptr); +void operator delete(void* ptr); +void operator delete[](void* ptr); -#endif // EGG_CORE_HEAP_H +#endif // EGG_CORE_HEAP_H diff --git a/libs/EGG/include/egg/core/eggTaskThread.h b/libs/EGG/include/egg/core/eggTaskThread.h index 956dff10..33c4b776 100644 --- a/libs/EGG/include/egg/core/eggTaskThread.h +++ b/libs/EGG/include/egg/core/eggTaskThread.h @@ -6,55 +6,55 @@ namespace EGG { class TaskThread : public Thread { - public: - typedef void (*TFunction)(void*); - - typedef struct TJob { - TFunction mFunction; // 0x00 - - void* unk_0x04; - OSMessage mMsg; // 0x08 - - TFunction mEnterFunction; // 0x0C - TFunction mExitFunction; // 0x10 - TFunction unk_0x14; - - inline TJob() : mEnterFunction(NULL), mExitFunction(NULL), unk_0x14(NULL) {} - - inline void clearFunctions() { - mFunction = NULL; - mEnterFunction = NULL; - mExitFunction = NULL; - unk_0x14 = NULL; - } - } TJob; + public: + typedef void (*TFunction)(void*); - TaskThread(); - virtual ~TaskThread(); + typedef struct TJob { + TFunction mFunction; // 0x00 - static TaskThread* create(int msgCount, int, u32 size, Heap* heap); + void* unk_0x04; + OSMessage mMsg; // 0x08 - void request(TFunction func, void* work, void*); - void requestJam(TFunction func, void* work, void*); + TFunction mEnterFunction; // 0x0C + TFunction mExitFunction; // 0x10 + TFunction unk_0x14; - OSMessageQueue* getThreadMsgQueue() { return mpMsgQueue; } + inline TJob() : mEnterFunction(NULL), mExitFunction(NULL), unk_0x14(NULL) {} - void setMessageQueue(OSMessageQueue* queue) { mpMsgQueue = queue; } + inline void clearFunctions() { + mFunction = NULL; + mEnterFunction = NULL; + mExitFunction = NULL; + unk_0x14 = NULL; + } + } TJob; - static OSMessage waitQueueMessage(OSMessageQueue* queue, BOOL* result); + TaskThread(); + virtual ~TaskThread(); - private: - TJob* mCurrentJob; // 0x44 - TJob* mJobs; // 0x48 - int mJobCount; // 0x4C + static TaskThread* create(int msgCount, int, u32 size, Heap* heap); - OSMessageQueue* mpMsgQueue; // 0x50 + void request(TFunction func, void* work, void*); + void requestJam(TFunction func, void* work, void*); - static OSMessage* sEndMesgBuffer; - static int sEndMesgBufSize; + OSMessageQueue* getThreadMsgQueue() { return mpMsgQueue; } - static OSMessageQueue sEndMesgQueue; + void setMessageQueue(OSMessageQueue* queue) { mpMsgQueue = queue; } + + static OSMessage waitQueueMessage(OSMessageQueue* queue, BOOL* result); + + private: + TJob* mCurrentJob; // 0x44 + TJob* mJobs; // 0x48 + int mJobCount; // 0x4C + + OSMessageQueue* mpMsgQueue; // 0x50 + + static OSMessage* sEndMesgBuffer; + static int sEndMesgBufSize; + + static OSMessageQueue sEndMesgQueue; }; -} +} // namespace EGG -#endif // EGG_CORE_TASK_THREAD_H +#endif // EGG_CORE_TASK_THREAD_H diff --git a/libs/EGG/include/egg/core/eggThread.h b/libs/EGG/include/egg/core/eggThread.h index 6d8df3b5..716aa8df 100644 --- a/libs/EGG/include/egg/core/eggThread.h +++ b/libs/EGG/include/egg/core/eggThread.h @@ -10,29 +10,29 @@ namespace EGG { class Thread { - public: - Thread(OSThread* currThread, int); - virtual ~Thread(); + public: + Thread(OSThread* currThread, int); + virtual ~Thread(); - static void initialize(); + static void initialize(); - OSMessageQueue* getMessageQueue() { return &mMsgQueue; } + OSMessageQueue* getMessageQueue() { return &mMsgQueue; } - private: - static nw4r::ut::List smThreadList; + private: + static nw4r::ut::List smThreadList; - Heap* mpHeap; // 0x04 - OSThread* mpThread; // 0x08 + Heap* mpHeap; // 0x04 + OSThread* mpThread; // 0x08 - OSMessageQueue mMsgQueue; // 0x0C - void* mpMsgArray; // 0x2C - s32 mMsgCount; // 0x30 + OSMessageQueue mMsgQueue; // 0x0C + void* mpMsgArray; // 0x2C + s32 mMsgCount; // 0x30 - void* mpStack; // 0x34 - u32 mStackSize; // 0x38 + void* mpStack; // 0x34 + u32 mStackSize; // 0x38 - nw4r::ut::Link mLink; // 0x3C + nw4r::ut::Link mLink; // 0x3C }; -} +} // namespace EGG -#endif // EGG_CORE_THREAD_H +#endif // EGG_CORE_THREAD_H diff --git a/libs/EGG/include/egg/core/eggUnitHeap.h b/libs/EGG/include/egg/core/eggUnitHeap.h index ff414391..b6cfddc4 100644 --- a/libs/EGG/include/egg/core/eggUnitHeap.h +++ b/libs/EGG/include/egg/core/eggUnitHeap.h @@ -5,10 +5,10 @@ namespace EGG { class UnitHeap : public Heap { - public: - static int calcHeapSize(u32, u32, long); - static UnitHeap* create(u32, u32, EGG::Heap*, long, u16); + public: + static int calcHeapSize(u32, u32, long); + static UnitHeap* create(u32, u32, EGG::Heap*, long, u16); }; -} +} // namespace EGG -#endif // EGG_CORE_UNIT_HEAP_H +#endif // EGG_CORE_UNIT_HEAP_H diff --git a/libs/MSL/include/assert.h b/libs/MSL/include/assert.h index 39c5fee9..975f9dec 100644 --- a/libs/MSL/include/assert.h +++ b/libs/MSL/include/assert.h @@ -2,6 +2,6 @@ #define MSL_ASSERT_H // Dummy (for GameSpy) -#define assert() (void)0; +#define assert() (void)0; -#endif // MSL_ASSERT_H +#endif // MSL_ASSERT_H diff --git a/libs/MSL/include/cctype b/libs/MSL/include/cctype index a54be401..c37d638a 100644 --- a/libs/MSL/include/cctype +++ b/libs/MSL/include/cctype @@ -6,10 +6,10 @@ #ifdef __cplusplus namespace std { - using ::tolower; - using ::toupper; -} // namespace std + using ::tolower; + using ::toupper; +} // namespace std #endif -#endif // MSL_CCTYPE_H +#endif // MSL_CCTYPE_H diff --git a/libs/MSL/include/cerrno b/libs/MSL/include/cerrno index c9720057..d89bb0a4 100644 --- a/libs/MSL/include/cerrno +++ b/libs/MSL/include/cerrno @@ -3,4 +3,4 @@ #include -#endif // MSL_CERRNO_H +#endif // MSL_CERRNO_H diff --git a/libs/MSL/include/climits b/libs/MSL/include/climits index 6e342aae..89cde7d6 100644 --- a/libs/MSL/include/climits +++ b/libs/MSL/include/climits @@ -3,4 +3,4 @@ #include -#endif // MSL_CLIMITS_H +#endif // MSL_CLIMITS_H diff --git a/libs/MSL/include/cmath b/libs/MSL/include/cmath index 1079e58a..35da94e6 100644 --- a/libs/MSL/include/cmath +++ b/libs/MSL/include/cmath @@ -6,71 +6,71 @@ #ifdef __cplusplus namespace std { - using ::abs; - using ::labs; - using ::fabs; - using ::fabsf; + using ::abs; + using ::fabs; + using ::fabsf; + using ::labs; - using ::fmax; - using ::fmaxf; + using ::fmax; + using ::fmaxf; - using ::fmin; - using ::fminf; + using ::fmin; + using ::fminf; - using ::div; + using ::div; - using ::scalbn; - using ::scalbnf; + using ::scalbn; + using ::scalbnf; - using ::asin; - using ::asinf; + using ::asin; + using ::asinf; - using ::sin; - using ::sinf; + using ::sin; + using ::sinf; - using ::acos; - using ::acosf; + using ::acos; + using ::acosf; - using ::cos; - using ::cosf; + using ::cos; + using ::cosf; - using ::atan; - using ::atanf; + using ::atan; + using ::atanf; - using ::atan2; - using ::atan2f; + using ::atan2; + using ::atan2f; - using ::tan; - using ::tanf; + using ::tan; + using ::tanf; - using ::exp; - using ::expf; + using ::exp; + using ::expf; - using ::fmod; - using ::fmodf; + using ::fmod; + using ::fmodf; - using ::log; - using ::logf; + using ::log; + using ::logf; - using ::pow; - using ::powf; + using ::pow; + using ::powf; - using ::sqrt; - using ::sqrtf; + using ::sqrt; + using ::sqrtf; - using ::ceil; - using ::ceilf; + using ::ceil; + using ::ceilf; - using ::copysign; - using ::copysignf; + using ::copysign; + using ::copysignf; - using ::frexp; - using ::frexpf; + using ::frexp; + using ::frexpf; - using ::ldexp; - using ::ldexpf; -} // namespace std + using ::ldexp; + using ::ldexpf; +} // namespace std #endif -#endif // MSL_CMATH_H +#endif // MSL_CMATH_H diff --git a/libs/MSL/include/csignal b/libs/MSL/include/csignal index e159b613..38174c21 100644 --- a/libs/MSL/include/csignal +++ b/libs/MSL/include/csignal @@ -6,9 +6,9 @@ #ifdef __cplusplus namespace std { - using ::raise; -} // namespace std + using ::raise; +} // namespace std #endif -#endif // MSL_CSIGNAL_H +#endif // MSL_CSIGNAL_H diff --git a/libs/MSL/include/cstdarg b/libs/MSL/include/cstdarg index 8d687f58..a4da4ed5 100644 --- a/libs/MSL/include/cstdarg +++ b/libs/MSL/include/cstdarg @@ -6,9 +6,9 @@ #ifdef __cplusplus namespace std { - using ::va_list; -} // namespace std + using ::va_list; +} // namespace std #endif -#endif // MSL_CSTDARG_H +#endif // MSL_CSTDARG_H diff --git a/libs/MSL/include/cstdbool b/libs/MSL/include/cstdbool index 4cd5a6f1..fd7d057b 100644 --- a/libs/MSL/include/cstdbool +++ b/libs/MSL/include/cstdbool @@ -3,4 +3,4 @@ #include -#endif // MSL_CSTDBOOL_H +#endif // MSL_CSTDBOOL_H diff --git a/libs/MSL/include/cstddef b/libs/MSL/include/cstddef index 9d400140..53978121 100644 --- a/libs/MSL/include/cstddef +++ b/libs/MSL/include/cstddef @@ -6,11 +6,11 @@ #ifdef __cplusplus namespace std { - using ::size_t; - using ::clock_t; - using ::time_t; -} // namespace std + using ::clock_t; + using ::size_t; + using ::time_t; +} // namespace std #endif -#endif // MSL_CSTDDEF_H +#endif // MSL_CSTDDEF_H diff --git a/libs/MSL/include/cstdint b/libs/MSL/include/cstdint index a366b446..a12bf9a3 100644 --- a/libs/MSL/include/cstdint +++ b/libs/MSL/include/cstdint @@ -6,25 +6,25 @@ #ifdef __cplusplus namespace std { - using ::int8_t; - using ::int16_t; - using ::int32_t; - using ::long int64_t; + using ::int16_t; + using ::int32_t; + using ::int8_t; + using ::long int64_t; - using ::uint8_t; - using ::uint16_t; - using ::uint32_t; - using ::uint64_t; + using ::uint16_t; + using ::uint32_t; + using ::uint64_t; + using ::uint8_t; - using ::int_least8_t; - using ::int_least16_t; - using ::int_least32_t; + using ::int_least16_t; + using ::int_least32_t; + using ::int_least8_t; - using ::uint_least8_t; - using ::uint_least16_t; - using ::uint_least32_t; -} // namespace std + using ::uint_least16_t; + using ::uint_least32_t; + using ::uint_least8_t; +} // namespace std #endif -#endif // MSL_CSTDINT_H +#endif // MSL_CSTDINT_H diff --git a/libs/MSL/include/cstdio b/libs/MSL/include/cstdio index aaf12285..23506be2 100644 --- a/libs/MSL/include/cstdio +++ b/libs/MSL/include/cstdio @@ -6,23 +6,23 @@ #ifdef __cplusplus namespace std { - using ::setvbuf; + using ::setvbuf; - using ::fclose; - using ::fflush; - using ::ftell; + using ::fclose; + using ::fflush; + using ::ftell; - using ::printf; - using ::fprintf; - using ::vprintf; + using ::fprintf; + using ::printf; + using ::vprintf; - using ::sprintf; - using ::snprintf; + using ::snprintf; + using ::sprintf; - using ::vsprintf; - using ::vsnprintf; -} // namespace std + using ::vsnprintf; + using ::vsprintf; +} // namespace std #endif -#endif // MSL_CSTDIO_H +#endif // MSL_CSTDIO_H diff --git a/libs/MSL/include/cstdlib b/libs/MSL/include/cstdlib index f27c9951..ec00d269 100644 --- a/libs/MSL/include/cstdlib +++ b/libs/MSL/include/cstdlib @@ -10,23 +10,23 @@ #ifdef __cplusplus namespace std { - using ::rand; - using ::srand; + using ::rand; + using ::srand; - using ::mbtowc; - using ::mbstowcs; + using ::mbstowcs; + using ::mbtowc; - using ::wcstombs; + using ::wcstombs; - using ::strtol; - using ::strtoull; - - using ::atoi; - using ::atol; + using ::strtol; + using ::strtoull; - using ::itoa; -} // namespace std + using ::atoi; + using ::atol; + + using ::itoa; +} // namespace std #endif -#endif // MSL_CSTDLIB_H +#endif // MSL_CSTDLIB_H diff --git a/libs/MSL/include/cstring b/libs/MSL/include/cstring index b43b8241..8b5bcf81 100644 --- a/libs/MSL/include/cstring +++ b/libs/MSL/include/cstring @@ -6,35 +6,35 @@ #ifdef __cplusplus namespace std { - using ::memcpy; - using ::memset; - using ::memmove; - using ::memchr; - using ::memcmp; + using ::memchr; + using ::memcmp; + using ::memcpy; + using ::memmove; + using ::memset; - using ::strcpy; - using ::strcat; - using ::strlen; - using ::strchr; - using ::strrchr; - using ::strcmp; - using ::strpbrk; - using ::strspn; - using ::strtok; - using ::strstr; + using ::strcat; + using ::strchr; + using ::strcmp; + using ::strcpy; + using ::strlen; + using ::strpbrk; + using ::strrchr; + using ::strspn; + using ::strstr; + using ::strtok; - using ::strncpy; - using ::strncat; - using ::strnlen; - using ::strncmp; + using ::strncat; + using ::strncmp; + using ::strncpy; + using ::strnlen; - using ::strcspn; + using ::strcspn; - using ::stricmp; - using ::strnicmp; - using ::strcmpi; -} // namespace std + using ::strcmpi; + using ::stricmp; + using ::strnicmp; +} // namespace std #endif -#endif // MSL_CSTRING_H +#endif // MSL_CSTRING_H diff --git a/libs/MSL/include/ctime b/libs/MSL/include/ctime index fe375786..8c6e5396 100644 --- a/libs/MSL/include/ctime +++ b/libs/MSL/include/ctime @@ -6,14 +6,14 @@ #ifdef __cplusplus namespace std { - using ::clock; + using ::clock; - using ::mktime; - using ::localtime; + using ::localtime; + using ::mktime; - using ::strftime; -} // namespace std + using ::strftime; +} // namespace std #endif -#endif // MSL_CTIME_H +#endif // MSL_CTIME_H diff --git a/libs/MSL/include/ctype.h b/libs/MSL/include/ctype.h index fcccb175..78847081 100644 --- a/libs/MSL/include/ctype.h +++ b/libs/MSL/include/ctype.h @@ -7,17 +7,17 @@ extern "C" { #endif -#define __MSL_ISALPHA_MAP (1 << 0) -#define __MSL_ISBLANK_MAP (1 << 1) -#define __MSL_ISCNTRL_MAP (1 << 2) -#define __MSL_ISDIGIT_MAP (1 << 3) -#define __MSL_ISGRAPH_MAP (1 << 4) -#define __MSL_ISLOWER_MAP (1 << 5) -#define __MSL_ISPRINT_MAP (1 << 6) -#define __MSL_ISPUNCT_MAP (1 << 7) -#define __MSL_ISSPACE_MAP (1 << 8) -#define __MSL_ISUPPER_MAP (1 << 9) -#define __MSL_ISXDIGIT_MAP (1 << 10) +#define __MSL_ISALPHA_MAP (1 << 0) +#define __MSL_ISBLANK_MAP (1 << 1) +#define __MSL_ISCNTRL_MAP (1 << 2) +#define __MSL_ISDIGIT_MAP (1 << 3) +#define __MSL_ISGRAPH_MAP (1 << 4) +#define __MSL_ISLOWER_MAP (1 << 5) +#define __MSL_ISPRINT_MAP (1 << 6) +#define __MSL_ISPUNCT_MAP (1 << 7) +#define __MSL_ISSPACE_MAP (1 << 8) +#define __MSL_ISUPPER_MAP (1 << 9) +#define __MSL_ISXDIGIT_MAP (1 << 10) inline int isalpha(int x) { return (x < 0 || x >= 256) ? 0 : (_current_locale.ctype_cmpt_ptr->ctype_map_ptr[x] & __MSL_ISALPHA_MAP); @@ -75,4 +75,4 @@ inline int toupper(int x) { } #endif -#endif // MSL_CTYPE_H +#endif // MSL_CTYPE_H diff --git a/libs/MSL/include/cwchar b/libs/MSL/include/cwchar index 9b14b0fd..b0ca05ef 100644 --- a/libs/MSL/include/cwchar +++ b/libs/MSL/include/cwchar @@ -6,27 +6,27 @@ #ifdef __cplusplus namespace std { - using ::fwide; + using ::fwide; - using ::wmemcpy; - using ::wmemset; - using ::wmemchr; + using ::wmemchr; + using ::wmemcpy; + using ::wmemset; - using ::wcslen; - using ::wcscpy; - using ::wcsncpy; - using ::wcscat; - using ::wcsncat; - using ::wcsncmp; - using ::wcschr; - using ::wcsstr; + using ::wcscat; + using ::wcschr; + using ::wcscpy; + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; + using ::wcsncpy; + using ::wcsstr; - using ::swprintf; - using ::vswprintf; + using ::swprintf; + using ::vswprintf; - using ::wcsnicmp; -} // namespace std + using ::wcsnicmp; +} // namespace std #endif -#endif // MSL_CWCHAR_H +#endif // MSL_CWCHAR_H diff --git a/libs/MSL/include/errno.h b/libs/MSL/include/errno.h index 70c8b34a..a0e17e0f 100644 --- a/libs/MSL/include/errno.h +++ b/libs/MSL/include/errno.h @@ -5,54 +5,54 @@ extern "C" { #endif -#define E2BIG 7 -#define EACCES 13 -#define EAGAIN 11 -#define EBADF 9 -#define EBUSY 16 -#define ECHILD 10 -#define EDEADLK 35 -#define EDEADLOCK EDEADLK -#define EDOM 33 -#define EEXIST 17 -#define EFAULT 14 -#define EFBIG 27 -#define EFPOS 40 -#define EILSEQ 88 -#define EINTR 4 -#define EINVAL 22 -#define EIO 5 -#define EISDIR 21 -#define EMFILE 24 -#define EMLINK 31 -#define ENFILE 23 +#define E2BIG 7 +#define EACCES 13 +#define EAGAIN 11 +#define EBADF 9 +#define EBUSY 16 +#define ECHILD 10 +#define EDEADLK 35 +#define EDEADLOCK EDEADLK +#define EDOM 33 +#define EEXIST 17 +#define EFAULT 14 +#define EFBIG 27 +#define EFPOS 40 +#define EILSEQ 88 +#define EINTR 4 +#define EINVAL 22 +#define EIO 5 +#define EISDIR 21 +#define EMFILE 24 +#define EMLINK 31 +#define ENFILE 23 #define ENAMETOOLONG 36 -#define ENODEV 19 -#define ENOENT 2 -#define ENOERR 0 -#define ENOEXEC 8 -#define ENOLCK 77 -#define ENOMEM 12 -#define ENOSPC 28 -#define ENOSYS 38 -#define ENOTDIR 20 -#define ENOTEMPTY 39 -#define ENOTTY 25 -#define ENXIO 6 -#define EPERM 1 -#define EPIPE 32 -#define ERANGE 34 -#define EROFS 30 -#define ESIGPARM 26 -#define ESPIPE 29 -#define ESRCH 3 -#define EUNKNOWN 99 -#define EXDEV 18 +#define ENODEV 19 +#define ENOENT 2 +#define ENOERR 0 +#define ENOEXEC 8 +#define ENOLCK 77 +#define ENOMEM 12 +#define ENOSPC 28 +#define ENOSYS 38 +#define ENOTDIR 20 +#define ENOTEMPTY 39 +#define ENOTTY 25 +#define ENXIO 6 +#define EPERM 1 +#define EPIPE 32 +#define ERANGE 34 +#define EROFS 30 +#define ESIGPARM 26 +#define ESPIPE 29 +#define ESRCH 3 +#define EUNKNOWN 99 +#define EXDEV 18 -extern int errno; +extern int errno; #ifdef __cplusplus } #endif -#endif // MSL_ERRNO_H +#endif // MSL_ERRNO_H diff --git a/libs/MSL/include/internal/ctype.h b/libs/MSL/include/internal/ctype.h index 3f6b9267..ee0abdc2 100644 --- a/libs/MSL/include/internal/ctype.h +++ b/libs/MSL/include/internal/ctype.h @@ -1,8 +1,8 @@ #ifndef MSL_INTERNAL_CCTYPE_H #define MSL_INTERNAL_CCTYPE_H -const unsigned short __ctype_mapC[0x100]; -const unsigned char __lower_mapC[0x100]; -const unsigned char __upper_mapC[0x100]; +const unsigned short __ctype_mapC[0x100]; +const unsigned char __lower_mapC[0x100]; +const unsigned char __upper_mapC[0x100]; -#endif // MSL_INTERNAL_CCTYPE_H +#endif // MSL_INTERNAL_CCTYPE_H diff --git a/libs/MSL/include/internal/fdlibm.h b/libs/MSL/include/internal/fdlibm.h index 8124fbb5..050e4807 100644 --- a/libs/MSL/include/internal/fdlibm.h +++ b/libs/MSL/include/internal/fdlibm.h @@ -5,7 +5,7 @@ * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. * * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ @@ -13,28 +13,26 @@ /* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly but these catch some common cases. */ -#if defined(i386) || defined(i486) || \ - defined(intel) || defined(x86) || defined(i86pc) || \ - defined(__alpha) || defined(__osf__) +#if defined(i386) || defined(i486) || defined(intel) || defined(x86) || defined(i86pc) || defined(__alpha) || defined(__osf__) #define __LITTLE_ENDIAN #endif #ifdef __LITTLE_ENDIAN -#define __HI(x) *(1+(int*)&x) +#define __HI(x) *(1 + (int*)&x) #define __LO(x) *(int*)&x -#define __HIp(x) *(1+(int*)x) +#define __HIp(x) *(1 + (int*)x) #define __LOp(x) *(int*)x #else #define __HI(x) *(int*)&x -#define __LO(x) *(1+(int*)&x) +#define __LO(x) *(1 + (int*)&x) #define __HIp(x) *(int*)x -#define __LOp(x) *(1+(int*)x) +#define __LOp(x) *(1 + (int*)x) #endif #ifdef __STDC__ -#define __P(p) p +#define __P(p) p #else -#define __P(p) () +#define __P(p) () #endif /* @@ -43,50 +41,50 @@ extern int signgam; -#define MAXFLOAT ((float)3.40282346638528860e+38) +#define MAXFLOAT ((float)3.40282346638528860e+38) -enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix}; +enum fdversion { fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix }; #define _LIB_VERSION_TYPE enum fdversion -#define _LIB_VERSION _fdlib_version +#define _LIB_VERSION _fdlib_version -/* if global variable _LIB_VERSION is not desirable, one may - * change the following to be a constant by: +/* if global variable _LIB_VERSION is not desirable, one may + * change the following to be a constant by: * #define _LIB_VERSION_TYPE const enum version * In that case, after one initializes the value _LIB_VERSION (see * s_lib_version.c) during compile time, it cannot be modified * in the middle of a program - */ -extern _LIB_VERSION_TYPE _LIB_VERSION; + */ +extern _LIB_VERSION_TYPE _LIB_VERSION; -#define _IEEE_ fdlibm_ieee -#define _SVID_ fdlibm_svid +#define _IEEE_ fdlibm_ieee +#define _SVID_ fdlibm_svid #define _XOPEN_ fdlibm_xopen #define _POSIX_ fdlibm_posix struct exception { - int type; - char *name; - double arg1; - double arg2; - double retval; + int type; + char* name; + double arg1; + double arg2; + double retval; }; -#define HUGE MAXFLOAT +#define HUGE MAXFLOAT -/* +/* * set X_TLOSS = pi*2**52, which is possibly defined in * (one may replace the following line by "#include ") */ -#define X_TLOSS 1.41484755040568800000e+16 +#define X_TLOSS 1.41484755040568800000e+16 -#define DOMAIN 1 -#define SING 2 -#define OVERFLOW 3 -#define UNDERFLOW 4 -#define TLOSS 5 -#define PLOSS 6 +#define DOMAIN 1 +#define SING 2 +#define OVERFLOW 3 +#define UNDERFLOW 4 +#define TLOSS 5 +#define PLOSS 6 /* * ANSI/POSIX @@ -104,11 +102,11 @@ extern double sinh __P((double)); extern double tanh __P((double)); extern double exp __P((double)); -extern double frexp __P((double, int *)); +extern double frexp __P((double, int*)); extern double ldexp __P((double, int)); extern double log __P((double)); extern double log10 __P((double)); -extern double modf __P((double, double *)); +extern double modf __P((double, double*)); extern double pow __P((double, double)); extern double sqrt __P((double)); @@ -145,7 +143,7 @@ extern double scalb __P((double, int)); extern double scalb __P((double, double)); #endif -extern int matherr __P((struct exception *)); +extern int matherr __P((struct exception*)); /* * IEEE Test Vector @@ -171,46 +169,46 @@ extern double log1p __P((double)); * as the second argument; user must allocate space for signgam. */ #ifdef _REENTRANT -extern double gamma_r __P((double, int *)); -extern double lgamma_r __P((double, int *)); -#endif /* _REENTRANT */ +extern double gamma_r __P((double, int*)); +extern double lgamma_r __P((double, int*)); +#endif /* _REENTRANT */ /* ieee style elementary functions */ -extern double __ieee754_sqrt __P((double)); -extern double __ieee754_acos __P((double)); -extern double __ieee754_acosh __P((double)); -extern double __ieee754_log __P((double)); -extern double __ieee754_atanh __P((double)); -extern double __ieee754_asin __P((double)); -extern double __ieee754_atan2 __P((double,double)); +extern double __ieee754_sqrt __P((double)); +extern double __ieee754_acos __P((double)); +extern double __ieee754_acosh __P((double)); +extern double __ieee754_log __P((double)); +extern double __ieee754_atanh __P((double)); +extern double __ieee754_asin __P((double)); +extern double __ieee754_atan2 __P((double, double)); extern double __ieee754_exp __P((double)); extern double __ieee754_cosh __P((double)); -extern double __ieee754_fmod __P((double,double)); -extern double __ieee754_pow __P((double,double)); -extern double __ieee754_lgamma_r __P((double,int *)); -extern double __ieee754_gamma_r __P((double,int *)); +extern double __ieee754_fmod __P((double, double)); +extern double __ieee754_pow __P((double, double)); +extern double __ieee754_lgamma_r __P((double, int*)); +extern double __ieee754_gamma_r __P((double, int*)); extern double __ieee754_lgamma __P((double)); extern double __ieee754_gamma __P((double)); extern double __ieee754_log10 __P((double)); extern double __ieee754_sinh __P((double)); -extern double __ieee754_hypot __P((double,double)); +extern double __ieee754_hypot __P((double, double)); extern double __ieee754_j0 __P((double)); extern double __ieee754_j1 __P((double)); extern double __ieee754_y0 __P((double)); extern double __ieee754_y1 __P((double)); -extern double __ieee754_jn __P((int,double)); -extern double __ieee754_yn __P((int,double)); -extern double __ieee754_remainder __P((double,double)); -extern int __ieee754_rem_pio2 __P((double,double*)); +extern double __ieee754_jn __P((int, double)); +extern double __ieee754_yn __P((int, double)); +extern double __ieee754_remainder __P((double, double)); +extern int __ieee754_rem_pio2 __P((double, double*)); #ifdef _SCALB_INT -extern double __ieee754_scalb __P((double,int)); +extern double __ieee754_scalb __P((double, int)); #else -extern double __ieee754_scalb __P((double,double)); +extern double __ieee754_scalb __P((double, double)); #endif /* fdlibm kernel function */ -extern double __kernel_standard __P((double,double,int)); -extern double __kernel_sin __P((double,double,int)); -extern double __kernel_cos __P((double,double)); -extern double __kernel_tan __P((double,double,int)); -extern int __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*)); \ No newline at end of file +extern double __kernel_standard __P((double, double, int)); +extern double __kernel_sin __P((double, double, int)); +extern double __kernel_cos __P((double, double)); +extern double __kernel_tan __P((double, double, int)); +extern int __kernel_rem_pio2 __P((double*, double*, int, int, int, const int*)); diff --git a/libs/MSL/include/internal/file_struct.h b/libs/MSL/include/internal/file_struct.h index f9cabf17..68b71a54 100644 --- a/libs/MSL/include/internal/file_struct.h +++ b/libs/MSL/include/internal/file_struct.h @@ -19,11 +19,11 @@ typedef struct __file_modes { } file_modes; typedef struct __file_states { - unsigned long io_state : 3; - unsigned long free_buffer : 1; + unsigned long io_state : 3; + unsigned long free_buffer : 1; - unsigned char eof; - unsigned char error; + unsigned char eof; + unsigned char error; } file_states; typedef unsigned long file_handle; @@ -32,35 +32,35 @@ typedef int (*__io_proc)(unsigned long, unsigned char*, size_t*, void*); typedef int (*__close_proc)(unsigned long); typedef struct _FILE { - file_handle handle; - file_modes mode; - file_states state; + file_handle handle; + file_modes mode; + file_states state; - unsigned char is_dyn_alloc; + unsigned char is_dyn_alloc; - unsigned char char_buf; - unsigned char char_buf_of; + unsigned char char_buf; + unsigned char char_buf_of; - unsigned char unget_buffer[2]; - unsigned short ungetwc_buffer[2]; + unsigned char unget_buffer[2]; + unsigned short ungetwc_buffer[2]; - unsigned long pos; + unsigned long pos; - unsigned char* buffer; - unsigned long buffer_size; - unsigned char* buffer_ptr; - unsigned long buffer_len; - unsigned long buffer_alignment; - unsigned long buffer_len_2; - unsigned long buffer_pos; + unsigned char* buffer; + unsigned long buffer_size; + unsigned char* buffer_ptr; + unsigned long buffer_len; + unsigned long buffer_alignment; + unsigned long buffer_len_2; + unsigned long buffer_pos; - __pos_proc pos_proc; - __io_proc read_proc; - __io_proc write_proc; - __close_proc close_proc; + __pos_proc pos_proc; + __io_proc read_proc; + __io_proc write_proc; + __close_proc close_proc; - void* ref; - struct _FILE* next_file; // 0x4C + void* ref; + struct _FILE* next_file; // 0x4C } FILE; extern FILE __files[]; @@ -69,4 +69,4 @@ extern FILE __files[]; } #endif -#endif // MSL_INTERNAL_FILE_STRUCT_H +#endif // MSL_INTERNAL_FILE_STRUCT_H diff --git a/libs/MSL/include/internal/locale.h b/libs/MSL/include/internal/locale.h index 37b88865..c311c29d 100644 --- a/libs/MSL/include/internal/locale.h +++ b/libs/MSL/include/internal/locale.h @@ -7,8 +7,8 @@ extern "C" { #include -typedef int (*__decode_mbyte) (wchar_t*, const char*, size_t); -typedef int (*__encode_mbyte) (char*, wchar_t); +typedef int (*__decode_mbyte)(wchar_t*, const char*, size_t); +typedef int (*__encode_mbyte)(char*, wchar_t); struct lconv { char* decimal_point; @@ -54,12 +54,12 @@ struct _loc_mon_cmpt { char n_sign_posn; char* int_curr_symbol; char int_frac_digits; - char int_p_cs_precedes; - char int_n_cs_precedes; - char int_p_sep_by_space; - char int_n_sep_by_space; - char int_p_sign_posn; - char int_n_sign_posn; + char int_p_cs_precedes; + char int_n_cs_precedes; + char int_p_sep_by_space; + char int_n_sep_by_space; + char int_p_sign_posn; + char int_n_sign_posn; }; struct _loc_num_cmpt { @@ -91,25 +91,25 @@ struct _loc_coll_cmpt { }; struct _loc_ctype_cmpt { - char name[8]; // 0x0 - const unsigned short* ctype_map_ptr; // 0x8 - const unsigned char* upper_map_ptr; // 0xC - const unsigned char* lower_map_ptr; // 0x10 - const unsigned short* wctype_map_ptr; // 0x14 - const wchar_t* wupper_map_ptr; // 0x18 - const wchar_t* wlower_map_ptr; // 0x1C - __decode_mbyte decode_mb; - __encode_mbyte encode_wc; + char name[8]; // 0x00 + const unsigned short* ctype_map_ptr; // 0x08 + const unsigned char* upper_map_ptr; // 0xC + const unsigned char* lower_map_ptr; // 0x10 + const unsigned short* wctype_map_ptr; // 0x14 + const wchar_t* wupper_map_ptr; // 0x18 + const wchar_t* wlower_map_ptr; // 0x1C + __decode_mbyte decode_mb; + __encode_mbyte encode_wc; }; struct __locale { - struct __locale* next_locale; // 0x0 - char name[0x30]; // 0x4 - struct _loc_coll_cmpt* coll_cmpt_ptr; // 0x34 - struct _loc_ctype_cmpt* ctype_cmpt_ptr; // 0x38 - struct _loc_mon_cmpt* mon_cmpt_ptr; // 0x3C - struct _loc_num_cmpt* num_cmpt_ptr; // 0x40 - struct _loc_time_cmpt* time_cmpt_ptr; // 0x44 + struct __locale* next_locale; // 0x00 + char name[0x30]; // 0x04 + struct _loc_coll_cmpt* coll_cmpt_ptr; // 0x34 + struct _loc_ctype_cmpt* ctype_cmpt_ptr; // 0x38 + struct _loc_mon_cmpt* mon_cmpt_ptr; // 0x3C + struct _loc_num_cmpt* num_cmpt_ptr; // 0x40 + struct _loc_time_cmpt* time_cmpt_ptr; // 0x44 }; extern struct __locale _current_locale; @@ -119,4 +119,4 @@ extern struct lconv __lconv; } #endif -#endif // MSL_INTERNAL_LOCALE_H +#endif // MSL_INTERNAL_LOCALE_H diff --git a/libs/MSL/include/internal/math_api.h b/libs/MSL/include/internal/math_api.h index e3fd8385..c3921551 100644 --- a/libs/MSL/include/internal/math_api.h +++ b/libs/MSL/include/internal/math_api.h @@ -10,11 +10,10 @@ int __signbitd(double x); int __fpclassifyf(float x); int __fpclassifyd(double x); -#define fpclassify(x) \ - (sizeof(x) == sizeof(float) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x))) +#define fpclassify(x) (sizeof(x) == sizeof(float) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x))) #ifdef __cplusplus } #endif -#endif // MSL_INTERNAL_MATH_API_H +#endif // MSL_INTERNAL_MATH_API_H diff --git a/libs/MSL/include/internal/mem_funcs.h b/libs/MSL/include/internal/mem_funcs.h index 41d22bf4..e00ced0b 100644 --- a/libs/MSL/include/internal/mem_funcs.h +++ b/libs/MSL/include/internal/mem_funcs.h @@ -6,4 +6,4 @@ void __copy_longs_rev_aligned(void* pDest, const void* pSrc, unsigned long len); void __copy_longs_unaligned(void* pDest, const void* pSrc, unsigned long len); void __copy_longs_rev_unaligned(void* pDest, const void* pSrc, unsigned long len); -#endif // MSL_INTERNAL_MEM_FUNCS_H +#endif // MSL_INTERNAL_MEM_FUNCS_H diff --git a/libs/MSL/include/internal/tm_struct.h b/libs/MSL/include/internal/tm_struct.h index fef7323e..566e9fe8 100644 --- a/libs/MSL/include/internal/tm_struct.h +++ b/libs/MSL/include/internal/tm_struct.h @@ -9,17 +9,17 @@ extern "C" { #endif typedef struct tm { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; - long int __tm_gmtoff; + long int __tm_gmtoff; const char* __tm_zone; } tm; @@ -27,4 +27,4 @@ typedef struct tm { } #endif -#endif // MSL_INTERNAL_TM_STRUCT_H +#endif // MSL_INTERNAL_TM_STRUCT_H diff --git a/libs/MSL/include/limits.h b/libs/MSL/include/limits.h index a510e05c..1e9a03f9 100644 --- a/libs/MSL/include/limits.h +++ b/libs/MSL/include/limits.h @@ -10,20 +10,20 @@ #define CHAR_MIN 0 #define CHAR_MAX SCHAR_MAX -#define SHRT_MIN (-0x7FFF - 1) -#define SHRT_MAX 0x7FFF +#define SHRT_MIN (-0x7FFF - 1) +#define SHRT_MAX 0x7FFF #define USHRT_MAX 0xFFFF -#define INT_MIN (-0x7FFFFFFF - 1) -#define INT_MAX 0x7FFFFFFF +#define INT_MIN (-0x7FFFFFFF - 1) +#define INT_MAX 0x7FFFFFFF #define UINT_MAX 0xFFFFFFFF -#define LONG_MIN (-0x7FFFFFFFL - 1) -#define LONG_MAX 0x7FFFFFFFL +#define LONG_MIN (-0x7FFFFFFFL - 1) +#define LONG_MAX 0x7FFFFFFFL #define ULONG_MAX 0xFFFFFFFFUL -#define LLONG_MIN (-0x7FFFFFFFFFFFFFFFLL - 1) -#define LLONG_MAX 0x7FFFFFFFFFFFFFFFLL +#define LLONG_MIN (-0x7FFFFFFFFFFFFFFFLL - 1) +#define LLONG_MAX 0x7FFFFFFFFFFFFFFFLL #define ULLONG_MAX 0xFFFFFFFFFFFFFFFFULL -#endif // MSL_LIMITS_H +#endif // MSL_LIMITS_H diff --git a/libs/MSL/include/malloc.h b/libs/MSL/include/malloc.h index 4a459835..bac096f6 100644 --- a/libs/MSL/include/malloc.h +++ b/libs/MSL/include/malloc.h @@ -7,14 +7,14 @@ extern "C" { #endif -void* malloc(size_t size); -void* realloc(void* ptr, size_t new_size); -void* calloc(size_t num, size_t size); +void* malloc(size_t size); +void* realloc(void* ptr, size_t new_size); +void* calloc(size_t num, size_t size); -void free(void* ptr); +void free(void* ptr); #ifdef __cplusplus } #endif -#endif // MSL_MALLOC_H +#endif // MSL_MALLOC_H diff --git a/libs/MSL/include/math.h b/libs/MSL/include/math.h index 57b8fe68..9fe5d5a4 100644 --- a/libs/MSL/include/math.h +++ b/libs/MSL/include/math.h @@ -7,23 +7,23 @@ extern "C" { #endif -#define M_E 2.71828182845904523536 +#define M_E 2.71828182845904523536 -#define M_LOG2E 1.44269504088896340736 -#define M_LOG10E 0.434294481903251827651 +#define M_LOG2E 1.44269504088896340736 +#define M_LOG10E 0.434294481903251827651 -#define M_LN10 2.30258509299404568402 -#define M_LN2 0.693147180559945309417 +#define M_LN10 2.30258509299404568402 +#define M_LN2 0.693147180559945309417 -#define M_PI 3.14159265358979323846 -#define M_PI_2 1.57079632679489661923 -#define M_PI_4 0.785398163397448309616 -#define M_1_PI 0.318309886183790671538 -#define M_2_PI 0.636619772367581343076 +#define M_PI 3.14159265358979323846 +#define M_PI_2 1.57079632679489661923 +#define M_PI_4 0.785398163397448309616 +#define M_1_PI 0.318309886183790671538 +#define M_2_PI 0.636619772367581343076 -#define M_2_SQRTPI 1.12837916709551257390 -#define M_SQRT1_2 0.707106781186547524401 -#define M_SQRT2 1.41421356237309504880 +#define M_2_SQRTPI 1.12837916709551257390 +#define M_SQRT1_2 0.707106781186547524401 +#define M_SQRT2 1.41421356237309504880 typedef struct div_t { int quot; @@ -40,16 +40,16 @@ extern int __double_huge[]; #define FP_NORMAL 4 #define FP_SUBNORMAL 5 -#define HUGE_VALF (*(float*) __float_huge ) -#define INFINITY (*(float*) __float_huge ) -#define NAN (*(float*) __float_nan ) -#define HUGE_VAL (*(double*)__double_huge) +#define HUGE_VALF (*(float*)__float_huge) +#define INFINITY (*(float*)__float_huge) +#define NAN (*(float*)__float_nan) +#define HUGE_VAL (*(double*)__double_huge) #define isnormal(x) (fpclassify(x) == FP_NORMAL) -#define iszero(x) (fpclassify(x) == FP_ZERO) -#define isnan(x) (fpclassify(x) == FP_NAN) -#define isinf(x) (fpclassify(x) == FP_INFINITE) -#define isfinite(x) (fpclassify(x) > FP_INFINITE) +#define iszero(x) (fpclassify(x) == FP_ZERO) +#define isnan(x) (fpclassify(x) == FP_NAN) +#define isinf(x) (fpclassify(x) == FP_INFINITE) +#define isfinite(x) (fpclassify(x) > FP_INFINITE) // TODO: This inline loves regswapping. Stop it from doing that. /* @@ -61,77 +61,117 @@ inline int abs(int x) { */ #define abs __abs -long int labs(long n); -inline double fabs(double x) { +long int labs(long n); +inline double fabs(double x) { #ifdef __MWERKS__ return __fabs(x); -#endif // __MWERKS__ +#endif // __MWERKS__ +} +inline float fabsf(float x) { + return fabs(x); } -inline float fabsf(float x) { return fabs(x); } -double fmax(double x, double y); -inline float fmaxf(float x, float y) { return fmax(x, y); } +double fmax(double x, double y); +inline float fmaxf(float x, float y) { + return fmax(x, y); +} -double fmin(double x, double y); -inline float fminf(float x, float y) { return fmin(x, y); } +double fmin(double x, double y); +inline float fminf(float x, float y) { + return fmin(x, y); +} -div_t div(int numer, int denom); +div_t div(int numer, int denom); -double scalbn(double x, int exp); -inline float scalbnf(float x, int exp) { return scalbn(x, exp); } +double scalbn(double x, int exp); +inline float scalbnf(float x, int exp) { + return scalbn(x, exp); +} -double asin(double x); -inline float asinf(float x) { return asin(x); } +double asin(double x); +inline float asinf(float x) { + return asin(x); +} -double sin(double x); -inline float sinf(float x) { return sin(x); } +double sin(double x); +inline float sinf(float x) { + return sin(x); +} -double acos(double x); -inline float acosf(float x) { return acos(x); } +double acos(double x); +inline float acosf(float x) { + return acos(x); +} -double cos(double x); -inline float cosf(float x) { return cos(x); } +double cos(double x); +inline float cosf(float x) { + return cos(x); +} -double atan(double x); -inline float atanf(float x) { return atan(x); } +double atan(double x); +inline float atanf(float x) { + return atan(x); +} -double atan2(double x, double y); -inline float atan2f(float x, float y) { return atan2(x, y); } +double atan2(double x, double y); +inline float atan2f(float x, float y) { + return atan2(x, y); +} -double tan(double x); -inline float tanf(float x) { return tan(x); } +double tan(double x); +inline float tanf(float x) { + return tan(x); +} -double exp(double x); -inline float expf(float x) { return exp(x); } +double exp(double x); +inline float expf(float x) { + return exp(x); +} -double fmod(double x, double y); -inline float fmodf(float x, float y) { return fmod(x, y); } +double fmod(double x, double y); +inline float fmodf(float x, float y) { + return fmod(x, y); +} -double log(double x); -inline float logf(float x) { return log(x); } +double log(double x); +inline float logf(float x) { + return log(x); +} -double pow(double x, double y); -inline float powf(float x, float y) { return pow(x, y); } +double pow(double x, double y); +inline float powf(float x, float y) { + return pow(x, y); +} -double sqrt(double x); -inline float sqrtf(float x) { return sqrt(x); } +double sqrt(double x); +inline float sqrtf(float x) { + return sqrt(x); +} -double ceil(double x); -inline float ceilf(float x) { return ceil(x); } +double ceil(double x); +inline float ceilf(float x) { + return ceil(x); +} -double copysign(double x, double y); -inline float copysignf(float x, float y) { return copysign(x, y); } +double copysign(double x, double y); +inline float copysignf(float x, float y) { + return copysign(x, y); +} -double frexp(double x, int* eptr); -inline float frexpf(float x, int* eptr) { return frexpf(x, eptr); } +double frexp(double x, int* eptr); +inline float frexpf(float x, int* eptr) { + return frexpf(x, eptr); +} -double ldexp(double x, int n); -inline float ldexpf(float x, int n) { return ldexp(x, n); } +double ldexp(double x, int n); +inline float ldexpf(float x, int n) { + return ldexp(x, n); +} -double floor(double x); +double floor(double x); #ifdef __cplusplus } #endif -#endif // MSL_MATH_H +#endif // MSL_MATH_H diff --git a/libs/MSL/include/new b/libs/MSL/include/new index 43be98f9..3c2a768d 100644 --- a/libs/MSL/include/new +++ b/libs/MSL/include/new @@ -10,6 +10,6 @@ inline void* operator new(size_t size, void* ptr) { return ptr; } -#endif // MSL_CPP_NEW_H +#endif // MSL_CPP_NEW_H #endif diff --git a/libs/MSL/include/search.h b/libs/MSL/include/search.h index 1582b2f2..0f7c7933 100644 --- a/libs/MSL/include/search.h +++ b/libs/MSL/include/search.h @@ -9,12 +9,12 @@ extern "C" { typedef int (*COMPARE_FUNC)(const void*, const void*); -void* bsearch(const void* key, const void* ptr, size_t count, size_t size, COMPARE_FUNC comp); +void* bsearch(const void* key, const void* ptr, size_t count, size_t size, COMPARE_FUNC comp); -void qsort(void* ptr, size_t count, size_t size, COMPARE_FUNC comp); +void qsort(void* ptr, size_t count, size_t size, COMPARE_FUNC comp); #ifdef __cplusplus } #endif -#endif // MSL_SEARCH_H +#endif // MSL_SEARCH_H diff --git a/libs/MSL/include/signal.h b/libs/MSL/include/signal.h index 8b6e4b46..8d05fc6c 100644 --- a/libs/MSL/include/signal.h +++ b/libs/MSL/include/signal.h @@ -11,4 +11,4 @@ int raise(int signal); } #endif -#endif // MSL_SIGNAL_H +#endif // MSL_SIGNAL_H diff --git a/libs/MSL/include/stdarg.h b/libs/MSL/include/stdarg.h index a26e15b7..7a1b8e5a 100644 --- a/libs/MSL/include/stdarg.h +++ b/libs/MSL/include/stdarg.h @@ -11,23 +11,23 @@ typedef enum { } _va_arg_type; typedef struct __va_list_struct { - char gpr; - char fpr; - char reserved[2]; - char* input_arg_area; - char* reg_save_area; + char gpr; + char fpr; + char reserved[2]; + char* input_arg_area; + char* reg_save_area; } va_list[1]; char* __va_arg(va_list args, _va_arg_type type); #ifdef __MWERKS__ #define va_start(list, arg) ((void)arg, __builtin_va_info(&list)) -#define va_end(list) ((void)list) -#define va_arg(list, type) (*(type*)__va_arg(list, _var_arg_typeof(type))) +#define va_end(list) ((void)list) +#define va_arg(list, type) (*(type*)__va_arg(list, _var_arg_typeof(type))) #else #define va_start(list, arg) #define va_end(list) #define va_arg(list, type) (type)(0); #endif -#endif // MSL_STDARG_H +#endif // MSL_STDARG_H diff --git a/libs/MSL/include/stdbool.h b/libs/MSL/include/stdbool.h index 5fbd1b64..f5292d16 100644 --- a/libs/MSL/include/stdbool.h +++ b/libs/MSL/include/stdbool.h @@ -12,4 +12,4 @@ typedef unsigned char bool; #endif -#endif // STDBOOL_H +#endif // STDBOOL_H diff --git a/libs/MSL/include/stddef.h b/libs/MSL/include/stddef.h index c4c360d3..0f0709cf 100644 --- a/libs/MSL/include/stddef.h +++ b/libs/MSL/include/stddef.h @@ -1,22 +1,22 @@ #ifndef MSL_STDDEF_H #define MSL_STDDEF_H -typedef unsigned long int size_t; -typedef long int clock_t; -typedef long int time_t; +typedef unsigned long int size_t; +typedef long int clock_t; +typedef long int time_t; #ifndef __clang__ -#define offsetof(type, member) ((size_t)&(((type*)0)->member)) +#define offsetof(type, member) ((size_t) & (((type*)0)->member)) #else #define offsetof(type, member) __builtin_offsetof(type, member) #endif #ifndef NULL #ifdef __cplusplus -#define NULL 0 +#define NULL 0 #else -#define NULL ((void*)0) +#define NULL ((void*)0) #endif // __cplusplus #endif -#endif // MSL_STDDEF_H +#endif // MSL_STDDEF_H diff --git a/libs/MSL/include/stdint.h b/libs/MSL/include/stdint.h index 3510e7b9..b07d88c6 100644 --- a/libs/MSL/include/stdint.h +++ b/libs/MSL/include/stdint.h @@ -19,4 +19,4 @@ typedef unsigned char uint_least8_t; typedef unsigned short uint_least16_t; typedef unsigned long uint_least32_t; -#endif // MSL_STDINT_H +#endif // MSL_STDINT_H diff --git a/libs/MSL/include/stdio.h b/libs/MSL/include/stdio.h index b7b7870e..f67a1ac8 100644 --- a/libs/MSL/include/stdio.h +++ b/libs/MSL/include/stdio.h @@ -1,8 +1,9 @@ #ifndef MSL_STDIO_H #define MSL_STDIO_H -#include #include +#include + #include @@ -10,32 +11,32 @@ extern "C" { #endif -int setvbuf(FILE* stream, char* buffer, int mode, size_t size); +int setvbuf(FILE* stream, char* buffer, int mode, size_t size); -int fclose(FILE* stream); -int fflush(FILE* stream); -long ftell(FILE* stream); +int fclose(FILE* stream); +int fflush(FILE* stream); +long ftell(FILE* stream); -int sscanf(const char* s, const char* format, ...); +int sscanf(const char* s, const char* format, ...); -int printf(const char* format, ...); -int fprintf(FILE* stream, const char* format, ...); -int vprintf(const char* format, va_list arg); +int printf(const char* format, ...); +int fprintf(FILE* stream, const char* format, ...); +int vprintf(const char* format, va_list arg); -int sprintf(char* s, const char* format, ...); -int snprintf(char* s, size_t n, const char* format, ...); +int sprintf(char* s, const char* format, ...); +int snprintf(char* s, size_t n, const char* format, ...); -int vsprintf(char* s, const char* format, va_list arg); -int vsnprintf(char* s, size_t n, const char* format, va_list arg); +int vsprintf(char* s, const char* format, va_list arg); +int vsnprintf(char* s, size_t n, const char* format, va_list arg); -#define stdout (&__files[1]) +#define stdout (&__files[1]) -#define _IONBF 0 -#define _IOLBF 1 -#define _IOFBF 2 +#define _IONBF 0 +#define _IOLBF 1 +#define _IOFBF 2 #ifdef __cplusplus } #endif -#endif // MSL_STDIO_H +#endif // MSL_STDIO_H diff --git a/libs/MSL/include/stdlib.h b/libs/MSL/include/stdlib.h index fde95384..67435657 100644 --- a/libs/MSL/include/stdlib.h +++ b/libs/MSL/include/stdlib.h @@ -12,27 +12,27 @@ extern "C" { #endif -int rand(); -void srand(unsigned int seed); +int rand(); +void srand(unsigned int seed); -int mbtowc(wchar_t* pwc, const char* s, size_t n); -size_t mbstowcs(wchar_t* dst, const char* src, size_t len); +int mbtowc(wchar_t* pwc, const char* s, size_t n); +size_t mbstowcs(wchar_t* dst, const char* src, size_t len); -size_t wcstombs(char* dest, const wchar_t* src, size_t max); +size_t wcstombs(char* dest, const wchar_t* src, size_t max); -long int strtol(const char* str, char** endptr, int base); -unsigned long int strtoul(const char* str, char** endptr, int base); -unsigned long long int strtoull(const char* str, char** endptr, int base); +long int strtol(const char* str, char** endptr, int base); +unsigned long int strtoul(const char* str, char** endptr, int base); +unsigned long long int strtoull(const char* str, char** endptr, int base); -double strtod(const char* str, char** endptr); +double strtod(const char* str, char** endptr); -int atoi(const char* str); -long atol(const char* str); +int atoi(const char* str); +long atol(const char* str); -char* itoa(int val, char* buffer, int radix); +char* itoa(int val, char* buffer, int radix); #ifdef __cplusplus } #endif -#endif // MSL_STDLIB_H +#endif // MSL_STDLIB_H diff --git a/libs/MSL/include/string.h b/libs/MSL/include/string.h index d33289aa..b951a16e 100644 --- a/libs/MSL/include/string.h +++ b/libs/MSL/include/string.h @@ -7,36 +7,36 @@ extern "C" { #endif -void* memcpy(void* dest, const void* src, size_t count); -void* memset(void* dest, int ch, size_t count); -void* memmove(void* dest, const void* src, size_t count); -void* memchr(const void* ptr, int ch, size_t count); -int memcmp(const void* ptr1, const void* ptr2, size_t num); +void* memcpy(void* dest, const void* src, size_t count); +void* memset(void* dest, int ch, size_t count); +void* memmove(void* dest, const void* src, size_t count); +void* memchr(const void* ptr, int ch, size_t count); +int memcmp(const void* ptr1, const void* ptr2, size_t num); -char* strcpy(char* dst, const char* src); -char* strcat(char* dst, const char* src); -size_t strlen(const char* str); -char* strchr(const char* str, int ch); -char* strrchr(const char* str, int ch); -int strcmp(const char* s1, const char* s2); -char* strpbrk(const char* s1, const char* s2); -size_t strspn(const char* s1, const char* s2); -char* strtok(char* str, const char* delimiters); -char* strstr(const char* str, const char* pat); +char* strcpy(char* dst, const char* src); +char* strcat(char* dst, const char* src); +size_t strlen(const char* str); +char* strchr(const char* str, int ch); +char* strrchr(const char* str, int ch); +int strcmp(const char* s1, const char* s2); +char* strpbrk(const char* s1, const char* s2); +size_t strspn(const char* s1, const char* s2); +char* strtok(char* str, const char* delimiters); +char* strstr(const char* str, const char* pat); -char* strncpy(char* dst, const char* src, size_t length); -char* strncat(char* dst, const char* src, size_t length); -size_t strnlen(const char* str, size_t length); -int strncmp(const char* s1, const char* s2, size_t length); +char* strncpy(char* dst, const char* src, size_t length); +char* strncat(char* dst, const char* src, size_t length); +size_t strnlen(const char* str, size_t length); +int strncmp(const char* s1, const char* s2, size_t length); -size_t strcspn(const char* s1, const char* s2); +size_t strcspn(const char* s1, const char* s2); -int stricmp(const char* dst, const char* src); -int strnicmp(const char* s1, const char* s2, size_t length); -int strcmpi(const char* s1, const char* s2); +int stricmp(const char* dst, const char* src); +int strnicmp(const char* s1, const char* s2, size_t length); +int strcmpi(const char* s1, const char* s2); #ifdef __cplusplus } #endif -#endif // MSL_STRING_H +#endif // MSL_STRING_H diff --git a/libs/MSL/include/time.h b/libs/MSL/include/time.h index 82a6f1a8..96c2736e 100644 --- a/libs/MSL/include/time.h +++ b/libs/MSL/include/time.h @@ -11,13 +11,13 @@ extern "C" { clock_t clock(); -time_t mktime(tm* timePtr); -tm* localtime(const time_t* sourceTime); +time_t mktime(tm* timePtr); +tm* localtime(const time_t* sourceTime); -size_t strftime(char* strDest, size_t maxsize, const char* format, const tm* timeptr); +size_t strftime(char* strDest, size_t maxsize, const char* format, const tm* timeptr); #ifdef __cplusplus } #endif -#endif // MSL_TIME_H +#endif // MSL_TIME_H diff --git a/libs/MSL/include/wchar.h b/libs/MSL/include/wchar.h index 259b554c..698ef700 100644 --- a/libs/MSL/include/wchar.h +++ b/libs/MSL/include/wchar.h @@ -1,8 +1,8 @@ #ifndef MSL_WCHAR_H #define MSL_WCHAR_H -#include #include +#include #include @@ -14,28 +14,28 @@ typedef unsigned short wchar_t; extern "C" { #endif -int fwide(FILE* stream, int mode); +int fwide(FILE* stream, int mode); -wchar_t* wmemcpy(wchar_t* dest, const wchar_t* src, size_t num); -wchar_t* wmemset(wchar_t* dest, wchar_t ch, size_t num); -wchar_t* wmemchr(wchar_t* ptr, wchar_t ch, size_t num); +wchar_t* wmemcpy(wchar_t* dest, const wchar_t* src, size_t num); +wchar_t* wmemset(wchar_t* dest, wchar_t ch, size_t num); +wchar_t* wmemchr(wchar_t* ptr, wchar_t ch, size_t num); -size_t wcslen(const wchar_t* str); -wchar_t* wcscpy(wchar_t* dest, const wchar_t* src); -wchar_t* wcsncpy(wchar_t* dest, const wchar_t* src, size_t num); -wchar_t* wcscat(wchar_t* dest, const wchar_t* src); -wchar_t* wcsncat(wchar_t* dest, const wchar_t* src, size_t num); -int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t num); -wchar_t* wcschr(wchar_t* ws, wchar_t wc); -wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2); +size_t wcslen(const wchar_t* str); +wchar_t* wcscpy(wchar_t* dest, const wchar_t* src); +wchar_t* wcsncpy(wchar_t* dest, const wchar_t* src, size_t num); +wchar_t* wcscat(wchar_t* dest, const wchar_t* src); +wchar_t* wcsncat(wchar_t* dest, const wchar_t* src, size_t num); +int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t num); +wchar_t* wcschr(wchar_t* ws, wchar_t wc); +wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2); -int swprintf(wchar_t* ws, size_t len, const wchar_t* format, ...); -int vswprintf(wchar_t* ws, size_t len, const wchar_t* format, va_list arg); +int swprintf(wchar_t* ws, size_t len, const wchar_t* format, ...); +int vswprintf(wchar_t* ws, size_t len, const wchar_t* format, va_list arg); -int wcsnicmp(const char* dst, const char* src, size_t num); +int wcsnicmp(const char* dst, const char* src, size_t num); #ifdef __cplusplus } #endif -#endif // MSL_WCHAR_H +#endif // MSL_WCHAR_H diff --git a/libs/MSL/src/MSL_Common/alloc.c b/libs/MSL/src/MSL_Common/alloc.c index 0589dce4..350b3570 100644 --- a/libs/MSL/src/MSL_Common/alloc.c +++ b/libs/MSL/src/MSL_Common/alloc.c @@ -90,35 +90,34 @@ static int initialized = 0; static SubBlock* SubBlock_merge_prev(SubBlock*, SubBlock**); static void SubBlock_merge_next(SubBlock*, SubBlock**); -static const unsigned int fix_pool_sizes[] = { 4, 12, 20, 36, 52, 68 }; +static const unsigned int fix_pool_sizes[] = {4, 12, 20, 36, 52, 68}; -#define SubBlock_size(ths) ((ths)->size & 0xFFFFFFF8) +#define SubBlock_size(ths) ((ths)->size & 0xFFFFFFF8) #define SubBlock_block(ths) ((Block*)((unsigned int)((ths)->block) & ~0x1)) -#define Block_size(ths) ((ths)->size & 0xFFFFFFF8) -#define Block_start(ths) (*(SubBlock**)((char*)(ths) + Block_size((ths)) - sizeof(unsigned int))) +#define Block_size(ths) ((ths)->size & 0xFFFFFFF8) +#define Block_start(ths) (*(SubBlock**)((char*)(ths) + Block_size((ths)) - sizeof(unsigned int))) -#define SubBlock_set_free(ths) \ - unsigned int this_size = SubBlock_size((ths)); \ - (ths)->size &= ~0x2; \ - *(unsigned int*)((char*)(ths) + this_size) &= ~0x4; \ +#define SubBlock_set_free(ths) \ + unsigned int this_size = SubBlock_size((ths)); \ + (ths)->size &= ~0x2; \ + *(unsigned int*)((char*)(ths) + this_size) &= ~0x4; \ *(unsigned int*)((char*)(ths) + this_size - sizeof(unsigned int)) = this_size #define SubBlock_is_free(ths) !((ths)->size & 2) -#define SubBlock_set_size(ths, sz) \ - (ths)->size &= ~0xFFFFFFF8; \ - (ths)->size |= (sz) & 0xFFFFFFF8; \ - if (SubBlock_is_free((ths))) \ +#define SubBlock_set_size(ths, sz) \ + (ths)->size &= ~0xFFFFFFF8; \ + (ths)->size |= (sz) & 0xFFFFFFF8; \ + if (SubBlock_is_free((ths))) \ *(unsigned int*)((char*)(ths) + (sz) - sizeof(unsigned int)) = (sz) -#define SubBlock_from_pointer(ptr) ((SubBlock*)((char*)(ptr) - 8)) +#define SubBlock_from_pointer(ptr) ((SubBlock*)((char*)(ptr) - 8)) #define FixSubBlock_from_pointer(ptr) ((FixSubBlock*)((char*)(ptr) - 4)) #define FixBlock_client_size(ths) ((ths)->client_size_) -#define FixSubBlock_size(ths) (FixBlock_client_size((ths)->block_)) +#define FixSubBlock_size(ths) (FixBlock_client_size((ths)->block_)) #define classify(ptr) (*(unsigned int*)((char*)(ptr) - sizeof(unsigned int)) & 1) -#define __msize_inline(ptr) \ - (!classify(ptr) ? FixSubBlock_size(FixSubBlock_from_pointer(ptr)) : SubBlock_size(SubBlock_from_pointer(ptr)) - 8) +#define __msize_inline(ptr) (!classify(ptr) ? FixSubBlock_size(FixSubBlock_from_pointer(ptr)) : SubBlock_size(SubBlock_from_pointer(ptr)) - 8) #define Block_empty(ths) (_sb = (SubBlock*)((char*)(ths) + 16)), SubBlock_is_free(_sb) && SubBlock_size(_sb) == Block_size((ths)) - 24 @@ -128,16 +127,15 @@ void Block_link(Block* ths, SubBlock* sb) { st = &Block_start(ths); if (*st != 0) { - sb->prev = (*st)->prev; + sb->prev = (*st)->prev; sb->prev->next = sb; - sb->next = *st; - (*st)->prev = sb; - *st = sb; - *st = SubBlock_merge_prev(*st, st); + sb->next = *st; + (*st)->prev = sb; + *st = sb; + *st = SubBlock_merge_prev(*st, st); SubBlock_merge_next(*st, st); - } - else { - *st = sb; + } else { + *st = sb; sb->prev = sb; sb->next = sb; } @@ -158,7 +156,7 @@ static SubBlock* SubBlock_merge_prev(SubBlock* ths, SubBlock** start) { if (*start == ths) *start = (*start)->next; - ths->next->prev = ths->prev; + ths->next->prev = ths->prev; ths->next->prev->next = ths->next; return p; } @@ -183,8 +181,7 @@ static void SubBlock_merge_next(SubBlock* pBlock, SubBlock** pStart) { if (!(pBlock->size & 2)) { *(unsigned int*)((char*)pBlock + this_cur_size) &= ~4; - } - else { + } else { *(unsigned int*)((char*)pBlock + this_cur_size) |= 4; } @@ -212,7 +209,7 @@ static Block* __unlink(__mem_pool_obj* pool_obj, Block* bp) { } if (result != 0) { - result->prev = bp->prev; + result->prev = bp->prev; result->prev->next = result; } @@ -234,7 +231,9 @@ static void deallocate_from_var_pools(__mem_pool_obj* pool_obj, void* ptr) { } } -void __init_pool_obj(__mem_pool* pool_obj) { memset(pool_obj, 0, sizeof(__mem_pool_obj)); } +void __init_pool_obj(__mem_pool* pool_obj) { + memset(pool_obj, 0, sizeof(__mem_pool_obj)); +} static __mem_pool* get_malloc_pool() { static __mem_pool protopool; @@ -258,26 +257,25 @@ void deallocate_from_fixed_pools(__mem_pool_obj* pool_obj, void* ptr, unsigned i } fs = &pool_obj->fix_start[i]; - p = FixSubBlock_from_pointer(ptr); - b = p->block_; + p = FixSubBlock_from_pointer(ptr); + b = p->block_; if (b->start_ == 0 && fs->head_ != b) { if (fs->tail_ == b) { fs->head_ = fs->head_->prev_; fs->tail_ = fs->tail_->prev_; - } - else { + } else { b->prev_->next_ = b->next_; b->next_->prev_ = b->prev_; - b->next_ = fs->head_; - b->prev_ = b->next_->prev_; + b->next_ = fs->head_; + b->prev_ = b->next_->prev_; b->prev_->next_ = b; b->next_->prev_ = b; - fs->head_ = b; + fs->head_ = b; } } - p->next_ = b->start_; + p->next_ = b->start_; b->start_ = p; if (--b->n_allocated_ == 0) { @@ -313,12 +311,11 @@ void __pool_free(__mem_pool* pool, void* ptr) { } pool_obj = (__mem_pool_obj*)pool; - size = __msize_inline(ptr); + size = __msize_inline(ptr); if (size <= 68) { deallocate_from_fixed_pools(pool_obj, ptr, size); - } - else { + } else { deallocate_from_var_pools(pool_obj, ptr); } } diff --git a/libs/MSL/src/MSL_Common/buffer_io.c b/libs/MSL/src/MSL_Common/buffer_io.c index 5b2043e9..d345f414 100644 --- a/libs/MSL/src/MSL_Common/buffer_io.c +++ b/libs/MSL/src/MSL_Common/buffer_io.c @@ -17,7 +17,7 @@ int __flush_buffer(FILE* pFile, size_t* pFlushed) { pFile->buffer_len = len; res = (*pFile->write_proc)(pFile->handle, pFile->buffer, (size_t*)&pFile->buffer_len, pFile->ref); - + if (pFlushed != 0) { *pFlushed = pFile->buffer_len; } diff --git a/libs/MSL/src/MSL_Common/ctype.c b/libs/MSL/src/MSL_Common/ctype.c index 14722f4b..655abc3d 100644 --- a/libs/MSL/src/MSL_Common/ctype.c +++ b/libs/MSL/src/MSL_Common/ctype.c @@ -1,3 +1,4 @@ +// clang-format off const unsigned short __ctype_mapC[0x100] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 0x106, 0x104, 0x104, 0x104, 0x104, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0x142, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0x458, 0x458, 0x458, @@ -44,3 +45,5 @@ const unsigned char __upper_mapC[0x100] = { 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF }; + +// clang-format on diff --git a/libs/MSL/src/MSL_Common/errno.c b/libs/MSL/src/MSL_Common/errno.c index 18f0e0e2..6e7bb62b 100644 --- a/libs/MSL/src/MSL_Common/errno.c +++ b/libs/MSL/src/MSL_Common/errno.c @@ -1 +1 @@ -int errno; \ No newline at end of file +int errno; diff --git a/libs/MSL/src/MSL_Common/float.c b/libs/MSL/src/MSL_Common/float.c index 67a68c22..6bdab043 100644 --- a/libs/MSL/src/MSL_Common/float.c +++ b/libs/MSL/src/MSL_Common/float.c @@ -1,3 +1,3 @@ -int __float_nan[] = { 0x7FFFFFFF }; -int __float_huge[] = { 0x7F800000 }; -int __double_huge[] = { 0x7FF00000, 0 }; +int __float_nan[] = {0x7FFFFFFF}; +int __float_huge[] = {0x7F800000}; +int __double_huge[] = {0x7FF00000, 0}; diff --git a/libs/MSL/src/MSL_Common/math_api.c b/libs/MSL/src/MSL_Common/math_api.c index ddc46487..0c32f3df 100644 --- a/libs/MSL/src/MSL_Common/math_api.c +++ b/libs/MSL/src/MSL_Common/math_api.c @@ -8,16 +8,14 @@ int __fpclassifyf(float x) { case 0x7F800000: if (val & 0x7FFFFF) { return 1; - } - else { + } else { return 2; } break; case 0: if (val & 0x7FFFFF) { return 5; - } - else { + } else { return 3; } break; @@ -35,8 +33,7 @@ int __fpclassifyd(double x) { case 0x7FF00000: if (((*(int*)&x) & 0xFFFFF) || (*(1 + (int*)&x)) & 0xFFFFFFFF) { return 1; - } - else { + } else { return 2; } @@ -44,8 +41,7 @@ int __fpclassifyd(double x) { case 0: if (((*(int*)&x) & 0xFFFFF) || (*(1 + (int*)&x)) & 0xFFFFFFFF) { return 5; - } - else { + } else { return 3; } diff --git a/libs/MSL/src/MSL_Common/mem.c b/libs/MSL/src/MSL_Common/mem.c index c10f3059..6466ef82 100644 --- a/libs/MSL/src/MSL_Common/mem.c +++ b/libs/MSL/src/MSL_Common/mem.c @@ -13,16 +13,13 @@ void* memmove(void* dest, const void* src, size_t count) { if (isUnaligned) { if (rev == 0) { __copy_longs_unaligned(dest, src, count); - } - else { + } else { __copy_longs_rev_unaligned(dest, src, count); } - } - else { + } else { if (rev == 0) { __copy_longs_aligned(dest, src, count); - } - else { + } else { __copy_longs_rev_aligned(dest, src, count); } } @@ -34,8 +31,7 @@ void* memmove(void* dest, const void* src, size_t count) { for (cur = (const char*)src - 1, dst = (char*)dest - 1, count++; --count;) { *++dst = *++cur; } - } - else { + } else { for (cur = (const char*)src + count, dst = (char*)dest + count, count++; --count;) { *--dst = *--cur; } @@ -75,7 +71,7 @@ int memcmp(const void* ptr1, const void* ptr2, size_t num) { for (p1 = (const unsigned char*)ptr1 - 1, p2 = (const unsigned char*)ptr2 - 1, num++; --num;) { if (*++p1 != *++p2) { - return (*p1 < *p2) ? -1 : + 1; + return (*p1 < *p2) ? -1 : +1; } } diff --git a/libs/MSL/src/MSL_Common/mem_funcs.c b/libs/MSL/src/MSL_Common/mem_funcs.c index 432c519c..6660f402 100644 --- a/libs/MSL/src/MSL_Common/mem_funcs.c +++ b/libs/MSL/src/MSL_Common/mem_funcs.c @@ -1,11 +1,11 @@ -#define srcCharPtr ((unsigned char*)pSrc) +#define srcCharPtr ((unsigned char*)pSrc) #define destCharPtr ((unsigned char*)pDest) -#define srcLongPtr ((unsigned long*)pSrc) +#define srcLongPtr ((unsigned long*)pSrc) #define destLongPtr ((unsigned long*)pDest) void __copy_longs_aligned(void* pDest, const void* pSrc, unsigned long len) { unsigned long i = (-(unsigned long)pDest) & 3; - srcCharPtr = ((unsigned char*)pSrc) - 1; + srcCharPtr = ((unsigned char*)pSrc) - 1; destCharPtr = ((unsigned char*)pDest) - 1; if (i != 0) { @@ -16,7 +16,7 @@ void __copy_longs_aligned(void* pDest, const void* pSrc, unsigned long len) { } while (--i); } - srcLongPtr = ((unsigned long*)(srcCharPtr + 1)) - 1; + srcLongPtr = ((unsigned long*)(srcCharPtr + 1)) - 1; destLongPtr = ((unsigned long*)(destCharPtr + 1)) - 1; i = len >> 5; @@ -42,7 +42,7 @@ void __copy_longs_aligned(void* pDest, const void* pSrc, unsigned long len) { } while (--i); } - srcCharPtr = ((unsigned char*)(srcLongPtr + 1)) - 1; + srcCharPtr = ((unsigned char*)(srcLongPtr + 1)) - 1; destCharPtr = ((unsigned char*)(destLongPtr + 1)) - 1; len &= 3; @@ -56,9 +56,9 @@ void __copy_longs_aligned(void* pDest, const void* pSrc, unsigned long len) { void __copy_longs_rev_aligned(void* pDest, const void* pSrc, unsigned long len) { unsigned long i; - srcCharPtr = ((unsigned char*)pSrc) + len; + srcCharPtr = ((unsigned char*)pSrc) + len; destCharPtr = ((unsigned char*)pDest) + len; - i = ((unsigned long)destCharPtr) & 3; + i = ((unsigned long)destCharPtr) & 3; if (i != 0) { len -= i; @@ -104,8 +104,8 @@ void __copy_longs_unaligned(void* pDest, const void* pSrc, unsigned long len) { unsigned long i, v1, v2; unsigned int src, ls, rs; - i = (-(unsigned long)pDest) & 3; - srcCharPtr = ((unsigned char*)pSrc) - 1; + i = (-(unsigned long)pDest) & 3; + srcCharPtr = ((unsigned char*)pSrc) - 1; destCharPtr = ((unsigned char*)pDest) - 1; if (i != 0) { @@ -117,30 +117,30 @@ void __copy_longs_unaligned(void* pDest, const void* pSrc, unsigned long len) { } src = ((unsigned int)(srcCharPtr + 1)) & 3; - ls = src << 3; - rs = 32 - ls; + ls = src << 3; + rs = 32 - ls; srcCharPtr -= src; - srcLongPtr = ((unsigned long*)(srcCharPtr + 1)) - 1; + srcLongPtr = ((unsigned long*)(srcCharPtr + 1)) - 1; destLongPtr = ((unsigned long*)(destCharPtr + 1)) - 1; - i = len >> 3; + i = len >> 3; v1 = *++srcLongPtr; do { - v2 = *++srcLongPtr; + v2 = *++srcLongPtr; *++destLongPtr = (v1 << ls) | (v2 >> rs); - v1 = *++srcLongPtr; + v1 = *++srcLongPtr; *++destLongPtr = (v2 << ls) | (v1 >> rs); } while (--i); if (len & 4) { - v2 = *++srcLongPtr; + v2 = *++srcLongPtr; *++destLongPtr = (v1 << ls) | (v2 >> rs); } - srcCharPtr = ((unsigned char*)(srcLongPtr + 1)) - 1; + srcCharPtr = ((unsigned char*)(srcLongPtr + 1)) - 1; destCharPtr = ((unsigned char*)(destLongPtr + 1)) - 1; len &= 3; @@ -157,9 +157,9 @@ void __copy_longs_rev_unaligned(void* pDest, const void* pSrc, unsigned long len unsigned long i, v1, v2; unsigned int src, ls, rs; - srcCharPtr = ((unsigned char*)pSrc) + len; + srcCharPtr = ((unsigned char*)pSrc) + len; destCharPtr = ((unsigned char*)pDest) + len; - i = ((unsigned long)pDest) & 3; + i = ((unsigned long)pDest) & 3; if (i != 0) { len -= i; @@ -170,23 +170,23 @@ void __copy_longs_rev_unaligned(void* pDest, const void* pSrc, unsigned long len } src = ((unsigned int)(srcCharPtr)) & 3; - ls = src << 3; - rs = 32 - ls; + ls = src << 3; + rs = 32 - ls; srcCharPtr += 4 - src; - i = len >> 3; + i = len >> 3; v1 = *--srcLongPtr; do { - v2 = *--srcLongPtr; + v2 = *--srcLongPtr; *--destLongPtr = (v2 << ls) | (v1 >> rs); - v1 = *--srcLongPtr; + v1 = *--srcLongPtr; *--destLongPtr = (v1 << ls) | (v2 >> rs); } while (--i); if (len & 4) { - v2 = *--srcLongPtr; + v2 = *--srcLongPtr; *--destLongPtr = (v2 << ls) | (v1 >> rs); } diff --git a/libs/MSL/src/MSL_Common/string.c b/libs/MSL/src/MSL_Common/string.c index b46e0b25..b65b70e2 100644 --- a/libs/MSL/src/MSL_Common/string.c +++ b/libs/MSL/src/MSL_Common/string.c @@ -1,9 +1,10 @@ -#include #include +#include + #pragma exceptions on -#define K1 0x80808080 +#define K1 0x80808080 #define K2 0xfefefeff char* strcpy(char* dst, const char* src) { @@ -15,7 +16,7 @@ char* strcpy(char* dst, const char* src) { fromb = (unsigned char*)src; destb = (unsigned char*)dst; - + if ((align = ((int)fromb & 3)) != ((int)destb & 3)) { goto bytecopy; } @@ -45,9 +46,9 @@ char* strcpy(char* dst, const char* src) { if (t) { goto bytecopy; } - + --((int*)(destb)); - + do { *(++((int*)(destb))) = w; w = *(++((int*)(fromb))); @@ -58,27 +59,27 @@ char* strcpy(char* dst, const char* src) { if (t) { goto adjust; } - } while(1); + } while (1); - adjust: - ++((int*)(destb)); - bytecopy: - if ((*destb = *fromb) == 0) { +adjust: + ++((int*)(destb)); +bytecopy: + if ((*destb = *fromb) == 0) { + return dst; + } + do { + if ((*(++destb) = *(++fromb)) == 0) { return dst; } - do { - if ((*(++destb) = *(++fromb)) == 0) { - return dst; - } - - } while(1); - return dst; + } while (1); + + return dst; } char* strncpy(char* dst, const char* src, size_t n) { const unsigned char* p = (const unsigned char*)src - 1; - unsigned char* q = (unsigned char*)dst -1; + unsigned char* q = (unsigned char*)dst - 1; n++; while (--n) { @@ -97,9 +98,11 @@ char* strcat(char* dst, const char* src) { const unsigned char* p = (unsigned char*)src - 1; unsigned char* q = (unsigned char*)dst - 1; - while (*++q); + while (*++q) + ; q--; - while (*++q = *++p); + while (*++q = *++p) + ; return dst; } @@ -148,7 +151,7 @@ int strcmp(const char* s1, const char* s2) { if (x & k1) { goto adjust; } - while(l1 == r1) { + while (l1 == r1) { l1 = *(++((int*)(left))); r1 = *(++((int*)(right))); x = l1 + k2; @@ -157,41 +160,40 @@ int strcmp(const char* s1, const char* s2) { } } - adjust: - l1 = *left; - r1 = *right; - dist = l1 - r1; - if (dist) { - return (dist); +adjust: + l1 = *left; + r1 = *right; + dist = l1 - r1; + if (dist) { + return (dist); + } +bytecopy: + if (l1 == 0) { + return (0); + } + do { + l1 = *(++left); + r1 = *(++right); + if (l1 - r1) { + return (l1 - r1); } - bytecopy: if (l1 == 0) { return (0); } - do { - l1 = *(++left); - r1 = *(++right); - if (l1 - r1) { - return (l1 - r1); - } - if (l1 == 0) { - return (0); - } - } while (1); + } while (1); } int strncmp(const char* s1, const char* s2, size_t n) { - const unsigned char* p1 = (unsigned char*) s1 - 1; - const unsigned char* p2 = (unsigned char*) s2 - 1; + const unsigned char* p1 = (unsigned char*)s1 - 1; + const unsigned char* p2 = (unsigned char*)s2 - 1; unsigned long c1, c2; - + n++; - + while (--n) { if ((c1 = *++p1) != (c2 = *++p2)) { - return(c1 - c2); - } - else if (!c1) { + return (c1 - c2); + } else if (!c1) { break; } } @@ -200,35 +202,35 @@ int strncmp(const char* s1, const char* s2, size_t n) { } char* strchr(const char* str, int ch) { - const unsigned char* p = (unsigned char*) str - 1; + const unsigned char* p = (unsigned char*)str - 1; unsigned long c = (ch & 0xff); unsigned long chr; - while(chr = *++p) { + while (chr = *++p) { if (chr == c) { - return((char*)p); + return ((char*)p); } } - return(c ? 0 : (char*)p); + return (c ? 0 : (char*)p); } char* strrchr(const char* str, int ch) { - const unsigned char* p = (unsigned char*) str - 1; + const unsigned char* p = (unsigned char*)str - 1; const unsigned char* q = 0; unsigned long c = (ch & 0xff); unsigned long chr; - - while(chr = *++p) { + + while (chr = *++p) { if (chr == c) q = p; } - + if (q) { - return((char*)q); + return ((char*)q); } - - return(c ? 0 : (char*)p); + + return (c ? 0 : (char*)p); } char* strstr(const char* str, const char* pat) { @@ -246,7 +248,6 @@ char* strstr(const char* str, const char* pat) { const unsigned char* p2 = p1 - 1; while ((c1 = *++s2) == (c2 = *++p2) && c1) { - } if (!c2) { diff --git a/libs/MSL/src/MSL_Common/wmem.c b/libs/MSL/src/MSL_Common/wmem.c index 046f34ed..5225e4f6 100644 --- a/libs/MSL/src/MSL_Common/wmem.c +++ b/libs/MSL/src/MSL_Common/wmem.c @@ -1,5 +1,6 @@ -#include #include +#include + wchar_t* wmemcpy(wchar_t* dest, const wchar_t* src, size_t num) { return (wchar_t*)memcpy(dest, src, num * sizeof(wchar_t)); diff --git a/libs/MSL/src/MSL_Common_Embedded/Math/e_acos.c b/libs/MSL/src/MSL_Common_Embedded/Math/e_acos.c index 21bcdef2..8d09f3f0 100644 --- a/libs/MSL/src/MSL_Common_Embedded/Math/e_acos.c +++ b/libs/MSL/src/MSL_Common_Embedded/Math/e_acos.c @@ -106,4 +106,4 @@ double x; w = r * s + c; return 2.0 * (df + w); } -} \ No newline at end of file +} diff --git a/libs/MSL/src/PPC_EABI/time.dolphin.c b/libs/MSL/src/PPC_EABI/time.dolphin.c index 711e00e1..867fe42d 100644 --- a/libs/MSL/src/PPC_EABI/time.dolphin.c +++ b/libs/MSL/src/PPC_EABI/time.dolphin.c @@ -1,3 +1,3 @@ int __isdst() { return 0; -} \ No newline at end of file +} diff --git a/libs/MSL/src/PPC_EABI/uart_console_io_gcn.c b/libs/MSL/src/PPC_EABI/uart_console_io_gcn.c index 20ad5bb7..aefd40de 100644 --- a/libs/MSL/src/PPC_EABI/uart_console_io_gcn.c +++ b/libs/MSL/src/PPC_EABI/uart_console_io_gcn.c @@ -1,14 +1,15 @@ -#include #include +#include + #pragma exceptions on -int __TRK_write_console(unsigned long, unsigned char *, size_t *, void *); +int __TRK_write_console(unsigned long, unsigned char*, size_t*, void*); -typedef void (* __idle_proc) (void); +typedef void (*__idle_proc)(void); static EUARTError __init_uart_console(void) { - EUARTError err = 0; - static int initialized = 0; + EUARTError err = 0; + static int initialized = 0; if (initialized == 0) { err = InitializeUART(57600); @@ -19,7 +20,6 @@ static EUARTError __init_uart_console(void) { } return err; - } int __write_console(unsigned long handle, unsigned char* buffer, size_t* count, void* ref) { diff --git a/libs/MetroTRK/include/trk/MetroTRK.h b/libs/MetroTRK/include/trk/MetroTRK.h index 0091f297..2ec9ea05 100644 --- a/libs/MetroTRK/include/trk/MetroTRK.h +++ b/libs/MetroTRK/include/trk/MetroTRK.h @@ -3,88 +3,89 @@ typedef unsigned char DSBool; #ifndef FALSE -#define FALSE 0 +#define FALSE 0 #endif // FALSE #ifndef TRUE -#define TRUE 1 +#define TRUE 1 #endif // TRUE typedef enum DSError { - DS_NoError = 0x00, - DS_StepError = 0x01, - DS_ParameterError = 0x02, + DS_NoError = 0x00, + DS_StepError = 0x01, + DS_ParameterError = 0x02, - DS_EventQueueFull = 0x100, + DS_EventQueueFull = 0x100, - DS_NoMessageBufferAvailable = 0x300, - DS_MessageBufferOverflow = 0x301, - DS_MessageBufferReadError = 0x302, + DS_NoMessageBufferAvailable = 0x300, + DS_MessageBufferOverflow = 0x301, + DS_MessageBufferReadError = 0x302, - DS_DispatchError = 0x500, + DS_DispatchError = 0x500, - DS_InvalidMemory = 0x700, - DS_InvalidRegister = 0x701, - DS_CWDSException = 0x702, - DS_UnsupportedError = 0x703, - DS_InvalidProcessID = 0x704, - DS_InvalidThreadID = 0x705, - DS_OSError = 0x706, + DS_InvalidMemory = 0x700, + DS_InvalidRegister = 0x701, + DS_CWDSException = 0x702, + DS_UnsupportedError = 0x703, + DS_InvalidProcessID = 0x704, + DS_InvalidThreadID = 0x705, + DS_OSError = 0x706, - DS_Error800 = 0x800, + DS_Error800 = 0x800, } DSError; typedef enum DSFileHandle { - DS_Stdin = 0, - DS_Stdout = 1, - DS_Stderr = 2, + DS_Stdin = 0, + DS_Stdout = 1, + DS_Stderr = 2, } DSFileHandle; // IO returns. typedef enum DSIOResult { - DS_IONoError = 0, - DS_IOError = 1, - DS_IOEOF = 2, + DS_IONoError = 0, + DS_IOError = 1, + DS_IOEOF = 2, } DSIOResult; typedef enum MessageCommandID { - DSMSG_Ping = 0x00, - DSMSG_Connect = 0x01, - DSMSG_Disconnect = 0x02, - DSMSG_Reset = 0x03, - DSMSG_Versions = 0x04, - DSMSG_SupportMask = 0x05, - DSMSG_Override = 0x07, + DSMSG_Ping = 0x00, + DSMSG_Connect = 0x01, + DSMSG_Disconnect = 0x02, + DSMSG_Reset = 0x03, + DSMSG_Versions = 0x04, + DSMSG_SupportMask = 0x05, + DSMSG_Override = 0x07, - DSMSG_ReadMemory = 0x10, - DSMSG_WriteMemory = 0x11, - DSMSG_ReadRegisters = 0x12, - DSMSG_WriteRegisters = 0x13, - DSMSG_SetOption = 0x17, - DSMSG_Continue = 0x18, - DSMSG_Step = 0x19, - DSMSG_Stop = 0x1A, + DSMSG_ReadMemory = 0x10, + DSMSG_WriteMemory = 0x11, + DSMSG_ReadRegisters = 0x12, + DSMSG_WriteRegisters = 0x13, + DSMSG_SetOption = 0x17, + DSMSG_Continue = 0x18, + DSMSG_Step = 0x19, + DSMSG_Stop = 0x1A, - DSMSG_ReplyACK = 0x80, + DSMSG_ReplyACK = 0x80, - DSMSG_NotifyStopped = 0x90, - DSMSG_NotifyException = 0x91, + DSMSG_NotifyStopped = 0x90, + DSMSG_NotifyException = 0x91, - DSMSG_WriteFile = 0xD0, - DSMSG_ReadFile = 0xD1, - DSMSG_OpenFile = 0xD2, - DSMSG_CloseFile = 0xD3, - DSMSG_PositionFile = 0xD4, + DSMSG_WriteFile = 0xD0, + DSMSG_ReadFile = 0xD1, + DSMSG_OpenFile = 0xD2, + DSMSG_CloseFile = 0xD3, + DSMSG_PositionFile = 0xD4, - DSMSG_ReplyNAK = 0xFF, + DSMSG_ReplyNAK = 0xFF, } MessageCommandID; -DSIOResult TRKAccessFile(MessageCommandID cmd, unsigned int handle, int* count, unsigned char* buffer); -DSIOResult TRKOpenFile(); -DSIOResult TRKCloseFile(); -DSIOResult TRKPositionFile(); +DSIOResult TRKAccessFile(MessageCommandID cmd, unsigned int handle, int *count, + unsigned char *buffer); +DSIOResult TRKOpenFile(); +DSIOResult TRKCloseFile(); +DSIOResult TRKPositionFile(); -DSError GetTRKConnected(); +DSError GetTRKConnected(); -DSBool GetUseSerialIO(); +DSBool GetUseSerialIO(); #endif // METROWORKS_TRK_H diff --git a/libs/MetroTRK/include/trk/dolphin_trk.h b/libs/MetroTRK/include/trk/dolphin_trk.h index 22ca9bc6..92a54e84 100644 --- a/libs/MetroTRK/include/trk/dolphin_trk.h +++ b/libs/MetroTRK/include/trk/dolphin_trk.h @@ -3,29 +3,29 @@ #include -typedef void (*DBCommFunc)(); -typedef unsigned int (*DBPollFunc)(); -typedef void (*DBCommInitFunc)(volatile unsigned char**, __OSInterruptHandler); -typedef int (*DBCommReadFunc)(void*, int); -typedef int (*DBCommWriteFunc)(const void*, int); +typedef void (*DBCommFunc)(); +typedef unsigned int (*DBPollFunc)(); +typedef void (*DBCommInitFunc)(volatile unsigned char **, __OSInterruptHandler); +typedef int (*DBCommReadFunc)(void *, int); +typedef int (*DBCommWriteFunc)(const void *, int); typedef struct DBCommTable { - DBCommInitFunc initialize_func; // 0x00 - DBCommFunc init_interrupts_func; // 0x04 - DBCommFunc shutdown_func; // 0x08 + DBCommInitFunc initialize_func; // 0x00 + DBCommFunc init_interrupts_func; // 0x04 + DBCommFunc shutdown_func; // 0x08 - DBPollFunc peek_func; // 0x0C + DBPollFunc peek_func; // 0x0C - DBCommReadFunc read_func; // 0x10 - DBCommWriteFunc write_func; // 0x14 + DBCommReadFunc read_func; // 0x10 + DBCommWriteFunc write_func; // 0x14 - DBCommFunc open_func; // 0x18 - DBCommFunc close_func; // 0x1C + DBCommFunc open_func; // 0x18 + DBCommFunc close_func; // 0x1C - DBCommFunc pre_continue_func; // 0x20 - DBCommFunc post_stop_func; // 0x24 + DBCommFunc pre_continue_func; // 0x20 + DBCommFunc post_stop_func; // 0x24 } DBCommTable; -void EnableMetroTRKInterrupts(); +void EnableMetroTRKInterrupts(); #endif // TRK_DOLPHIN_OS_H diff --git a/libs/MetroTRK/src/Export/mslsupp.c b/libs/MetroTRK/src/Export/mslsupp.c index 881493ed..32409b67 100644 --- a/libs/MetroTRK/src/Export/mslsupp.c +++ b/libs/MetroTRK/src/Export/mslsupp.c @@ -23,8 +23,8 @@ inline DSIOResult __access_file(unsigned int handle, unsigned char* buffer, int* } countTemp = *count; - r0 = TRKAccessFile(cmd, handle, &countTemp, buffer); - *count = countTemp; + r0 = TRKAccessFile(cmd, handle, &countTemp, buffer); + *count = countTemp; switch ((unsigned char)r0) { case DS_IONoError: diff --git a/libs/MetroTRK/src/Export/targsupp.c b/libs/MetroTRK/src/Export/targsupp.c index 6dc3c0fb..d0fe54d3 100644 --- a/libs/MetroTRK/src/Export/targsupp.c +++ b/libs/MetroTRK/src/Export/targsupp.c @@ -4,7 +4,7 @@ #pragma function_align 32 #else #pragma function_align 8 -#endif // VERSION_43U +#endif // VERSION_43U #include @@ -12,7 +12,8 @@ // Encapsulating function to get the file to align properly asm void __targsupp() { -#ifdef __MWERKS__ + // clang-format off +#ifdef __MWERKS__ nofralloc entry TRKAccessFile twi 31, r0, 0 @@ -26,5 +27,6 @@ asm void __targsupp() { entry TRKPositionFile twi 31, r0, 0 blr -#endif +#endif // __MWERKS__ + // clang-format on } diff --git a/libs/MetroTRK/src/dolphin_Os/dolphin_trk.c b/libs/MetroTRK/src/dolphin_Os/dolphin_trk.c index 6ad7e43d..18bc2a05 100644 --- a/libs/MetroTRK/src/dolphin_Os/dolphin_trk.c +++ b/libs/MetroTRK/src/dolphin_Os/dolphin_trk.c @@ -2,4 +2,6 @@ extern void EnableEXI2Interrupts(); -void EnableMetroTRKInterrupts() { EnableEXI2Interrupts(); } +void EnableMetroTRKInterrupts() { + EnableEXI2Interrupts(); +} diff --git a/libs/MetroTRK/src/dolphin_Os/dolphin_trk_glue.c b/libs/MetroTRK/src/dolphin_Os/dolphin_trk_glue.c index e92feba6..1900d7ce 100644 --- a/libs/MetroTRK/src/dolphin_Os/dolphin_trk_glue.c +++ b/libs/MetroTRK/src/dolphin_Os/dolphin_trk_glue.c @@ -4,7 +4,7 @@ DBCommTable gDBCommTable = {}; u8 TRK_Use_BBA; -void EnableEXI2Interrupts() { +void EnableEXI2Interrupts() { if (TRK_Use_BBA == FALSE && gDBCommTable.init_interrupts_func != NULL) { gDBCommTable.init_interrupts_func(); } diff --git a/libs/NW4R/include/nw4r/config.h b/libs/NW4R/include/nw4r/config.h index b5af957c..94e99c67 100644 --- a/libs/NW4R/include/nw4r/config.h +++ b/libs/NW4R/include/nw4r/config.h @@ -3,8 +3,8 @@ #include -#define NW4R_BYTEORDER_BIG 0xFEFF -#define NW4R_BYTEORDER_LITTLE 0xFFFE +#define NW4R_BYTEORDER_BIG 0xFEFF +#define NW4R_BYTEORDER_LITTLE 0xFFFE #ifdef NW4R_LITTLE_ENDIAN #define NW4R_BYTEORDER_NATIVE NW4R_BYTEORDER_LITTLE @@ -14,4 +14,4 @@ #define NW4R_VERSION(major, minor) ((major & 0xFF) << 8 | minor & 0xFF) -#endif // NW4R_CONFIG_H +#endif // NW4R_CONFIG_H diff --git a/libs/NW4R/include/nw4r/db.h b/libs/NW4R/include/nw4r/db.h index 47d461d6..4f435bb0 100644 --- a/libs/NW4R/include/nw4r/db.h +++ b/libs/NW4R/include/nw4r/db.h @@ -4,7 +4,7 @@ #include #include -#include #include +#include -#endif // NW4R_DB_H +#endif // NW4R_DB_H diff --git a/libs/NW4R/include/nw4r/db/assert.h b/libs/NW4R/include/nw4r/db/assert.h index c9634e73..eb98c7bf 100644 --- a/libs/NW4R/include/nw4r/db/assert.h +++ b/libs/NW4R/include/nw4r/db/assert.h @@ -10,14 +10,13 @@ * But then after realising it actually prevented homebrew code, they brought them back, * However instead the screen now displays "Error 004". */ -#define NW4R_ASSERT(x) { \ - if (!(x)) { \ - GXColor front = {255, 255, 255, 0}; \ - GXColor back = { 0, 0, 0, 0}; \ - OSFatal((GXColor)front, \ - (GXColor)back, \ - "Error#004\nAn error has occurred.\nThe system files are corrupted."); \ - } \ -} +#define NW4R_ASSERT(x) \ + { \ + if (!(x)) { \ + GXColor front = {255, 255, 255, 0}; \ + GXColor back = {0, 0, 0, 0}; \ + OSFatal((GXColor)front, (GXColor)back, "Error#004\nAn error has occurred.\nThe system files are corrupted."); \ + } \ + } -#endif // NW4R_DB_ASSERT_H +#endif // NW4R_DB_ASSERT_H diff --git a/libs/NW4R/include/nw4r/db/console.h b/libs/NW4R/include/nw4r/db/console.h index 3a181d54..fcba2fd6 100644 --- a/libs/NW4R/include/nw4r/db/console.h +++ b/libs/NW4R/include/nw4r/db/console.h @@ -8,38 +8,38 @@ namespace nw4r { namespace db { namespace detail { - #define NW4R_CONSOLE_BUFFER_SIZE(width, height) (sizeof(nw4r::db::detail::ConsoleHead) + ((width) + 1) * (height)) - +#define NW4R_CONSOLE_BUFFER_SIZE(width, height) (sizeof(nw4r::db::detail::ConsoleHead) + ((width) + 1) * (height)) + typedef struct ConsoleHead ConsoleHead; struct ConsoleHead { - u8* textBuf; // 0x00 + u8* textBuf; // 0x00 - u16 width; // 0x04 - u16 height; // 0x06 + u16 width; // 0x04 + u16 height; // 0x06 - u16 priority; // 0x08 - u16 attr; // 0x0A + u16 priority; // 0x08 + u16 attr; // 0x0A - u16 printTop; // 0x0C - u16 printXPos; // 0x0E - u16 printTopUsed; // 0x10 + u16 printTop; // 0x0C + u16 printXPos; // 0x0E + u16 printTopUsed; // 0x10 - u16 ringTop; // 0x12 - s32 ringTopLineCnt; // 0x14 + u16 ringTop; // 0x12 + s32 ringTopLineCnt; // 0x14 - s32 viewTopLine; // 0x18 - s16 viewPosX; // 0x1C - s16 viewPosY; // 0x1E - u16 viewLines; // 0x20 + s32 viewTopLine; // 0x18 + s16 viewPosX; // 0x1C + s16 viewPosY; // 0x1E + u16 viewLines; // 0x20 - u8 isVisible; // 0x22 - u8 padding_[1]; // 0x23 + u8 isVisible; // 0x22 + u8 padding_[1]; // 0x23 - ut::TextWriter* writer; // 0x24 + ut::TextWriter* writer; // 0x24 - ConsoleHead* next; // 0x28 + ConsoleHead* next; // 0x28 }; - } + } // namespace detail typedef enum ConsoleOutputType { CONSOLE_OUTPUT_NONE = 0, @@ -49,20 +49,20 @@ namespace nw4r { } ConsoleOutputType; typedef detail::ConsoleHead* ConsoleHandle; - - ConsoleHandle Console_Create(void* buffer, u16 width, u16 height, u16 viewHeight, u16 prioriry, u16 attr); - void Console_DrawDirect(ConsoleHandle console); + ConsoleHandle Console_Create(void* buffer, u16 width, u16 height, u16 viewHeight, u16 prioriry, u16 attr); - void Console_VFPrintf(ConsoleOutputType type, ConsoleHandle console, const char* format, va_list vlist); + void Console_DrawDirect(ConsoleHandle console); + + void Console_VFPrintf(ConsoleOutputType type, ConsoleHandle console, const char* format, va_list vlist); inline void Console_VPrintf(ConsoleHandle console, const char* format, va_list vlist) { Console_VFPrintf(CONSOLE_OUTPUT_ALL, console, format, vlist); } - void Console_Printf(ConsoleHandle console, const char* format, ...); + void Console_Printf(ConsoleHandle console, const char* format, ...); - s32 Console_GetTotalLines(ConsoleHandle console); + s32 Console_GetTotalLines(ConsoleHandle console); inline u16 Console_GetViewHeight(ConsoleHandle console) { return console->viewLines; @@ -111,7 +111,7 @@ namespace nw4r { return baseLine; } - } -} + } // namespace db +} // namespace nw4r -#endif // NW4R_DB_CONSOLE_H +#endif // NW4R_DB_CONSOLE_H diff --git a/libs/NW4R/include/nw4r/db/directPrint.h b/libs/NW4R/include/nw4r/db/directPrint.h index 6be859c0..d8015c35 100644 --- a/libs/NW4R/include/nw4r/db/directPrint.h +++ b/libs/NW4R/include/nw4r/db/directPrint.h @@ -9,23 +9,23 @@ namespace nw4r { namespace db { - void DirectPrint_Init(); - bool DirectPrint_IsActive(); + void DirectPrint_Init(); + bool DirectPrint_IsActive(); - void DirectPrint_EraseXfb(int posh, int posv, int sizeh, int sizev); - void DirectPrint_ChangeXfb(void* framebuf, u16 width, u16 height); + void DirectPrint_EraseXfb(int posh, int posv, int sizeh, int sizev); + void DirectPrint_ChangeXfb(void* framebuf, u16 width, u16 height); - void DirectPrint_StoreCache(); + void DirectPrint_StoreCache(); - void DirectPrint_DrawString(int posh, int posv, bool turnOver, const char* format, ...); + void DirectPrint_DrawString(int posh, int posv, bool turnOver, const char* format, ...); - void DirectPrint_SetColor(u8 r, u8 g, u8 b); + void DirectPrint_SetColor(u8 r, u8 g, u8 b); namespace detail { - void DirectPrint_DrawStringToXfb(int posh, int posv, const char* format, va_list vargs, bool turnOver, bool backErase); - void* DirectPrint_SetupFB(const GXRenderModeObj* rmode); - } - } -} + void DirectPrint_DrawStringToXfb(int posh, int posv, const char* format, va_list vargs, bool turnOver, bool backErase); + void* DirectPrint_SetupFB(const GXRenderModeObj* rmode); + } // namespace detail + } // namespace db +} // namespace nw4r -#endif // NW4R_DB_DIRECT_PRINT_H +#endif // NW4R_DB_DIRECT_PRINT_H diff --git a/libs/NW4R/include/nw4r/db/exception.h b/libs/NW4R/include/nw4r/db/exception.h index f19c6609..dcf7c134 100644 --- a/libs/NW4R/include/nw4r/db/exception.h +++ b/libs/NW4R/include/nw4r/db/exception.h @@ -8,12 +8,12 @@ namespace nw4r { namespace db { typedef bool (*ExceptionUserCallback)(ConsoleHandle console, void* arg); - - void Exception_Init(); - void Exception_SetUserCallback(ExceptionUserCallback callback, void* arg); - - ConsoleHandle Exception_SetConsole(ConsoleHandle console, const GXRenderModeObj* renderMode); - } -} -#endif // NW4R_DB_EXCEPTION_H + void Exception_Init(); + void Exception_SetUserCallback(ExceptionUserCallback callback, void* arg); + + ConsoleHandle Exception_SetConsole(ConsoleHandle console, const GXRenderModeObj* renderMode); + } // namespace db +} // namespace nw4r + +#endif // NW4R_DB_EXCEPTION_H diff --git a/libs/NW4R/include/nw4r/lyt.h b/libs/NW4R/include/nw4r/lyt.h index 8c83f693..01821228 100644 --- a/libs/NW4R/include/nw4r/lyt.h +++ b/libs/NW4R/include/nw4r/lyt.h @@ -11,12 +11,12 @@ #include +#include #include #include -#include #include #include #include -#endif // NW4R_LYT_H +#endif // NW4R_LYT_H diff --git a/libs/NW4R/include/nw4r/lyt/animation.h b/libs/NW4R/include/nw4r/lyt/animation.h index e14b0881..c1763b8f 100644 --- a/libs/NW4R/include/nw4r/lyt/animation.h +++ b/libs/NW4R/include/nw4r/lyt/animation.h @@ -2,8 +2,8 @@ #define NW4R_LYT_ANIMATION_H #include -#include #include +#include #include @@ -16,19 +16,19 @@ namespace nw4r { ANIMTARGET_PANE_TRANSX = 0, ANIMTARGET_PANE_TRANSY, ANIMTARGET_PANE_TRANSZ, - + ANIMTARGET_PANE_ROTX, ANIMTARGET_PANE_ROTY, ANIMTARGET_PANE_ROTZ, - + ANIMTARGET_PANE_SCALEX, ANIMTARGET_PANE_SCALEY, - + ANIMTARGET_PANE_SIZEX, ANIMTARGET_PANE_SIZEY, - + ANIMTARGET_PANE_MAX, - + ANIMTARGET_PANE_COLOR_ALPHA = 16, ANIMTARGET_PANE_COLOR_MAX, }; @@ -38,22 +38,22 @@ namespace nw4r { ANIMTARGET_VERTEXCOLOR_LT_GREEN, ANIMTARGET_VERTEXCOLOR_LT_BLUE, ANIMTARGET_VERTEXCOLOR_LT_ALPHA, - + ANIMTARGET_VERTEXCOLOR_RT_RED, ANIMTARGET_VERTEXCOLOR_RT_GREEN, ANIMTARGET_VERTEXCOLOR_RT_BLUE, ANIMTARGET_VERTEXCOLOR_RT_ALPHA, - + ANIMTARGET_VERTEXCOLOR_LB_RED, ANIMTARGET_VERTEXCOLOR_LB_GREEN, ANIMTARGET_VERTEXCOLOR_LB_BLUE, ANIMTARGET_VERTEXCOLOR_LB_ALPHA, - + ANIMTARGET_VERTEXCOLOR_RB_RED, ANIMTARGET_VERTEXCOLOR_RB_GREEN, ANIMTARGET_VERTEXCOLOR_RB_BLUE, ANIMTARGET_VERTEXCOLOR_RB_ALPHA, - + ANIMTARGET_VERTEXCOLOR_MAX }; @@ -62,60 +62,60 @@ namespace nw4r { ANIMTARGET_MATCOLOR_MATG, ANIMTARGET_MATCOLOR_MATB, ANIMTARGET_MATCOLOR_MATA, - + ANIMTARGET_MATCOLOR_TEV0R, ANIMTARGET_MATCOLOR_TEV0G, ANIMTARGET_MATCOLOR_TEV0B, ANIMTARGET_MATCOLOR_TEV0A, - + ANIMTARGET_MATCOLOR_TEV1R, ANIMTARGET_MATCOLOR_TEV1G, ANIMTARGET_MATCOLOR_TEV1B, ANIMTARGET_MATCOLOR_TEV1A, - + ANIMTARGET_MATCOLOR_TEV2R, ANIMTARGET_MATCOLOR_TEV2G, ANIMTARGET_MATCOLOR_TEV2B, ANIMTARGET_MATCOLOR_TEV2A, - + ANIMTARGET_MATCOLOR_TEVK0R, ANIMTARGET_MATCOLOR_TEVK0G, ANIMTARGET_MATCOLOR_TEVK0B, ANIMTARGET_MATCOLOR_TEVK0A, - + ANIMTARGET_MATCOLOR_TEVK1R, ANIMTARGET_MATCOLOR_TEVK1G, ANIMTARGET_MATCOLOR_TEVK1B, ANIMTARGET_MATCOLOR_TEVK1A, - + ANIMTARGET_MATCOLOR_TEVK2R, ANIMTARGET_MATCOLOR_TEVK2G, ANIMTARGET_MATCOLOR_TEVK2B, ANIMTARGET_MATCOLOR_TEVK2A, - + ANIMTARGET_MATCOLOR_TEVK3R, ANIMTARGET_MATCOLOR_TEVK3G, ANIMTARGET_MATCOLOR_TEVK3B, ANIMTARGET_MATCOLOR_TEVK3A, - + ANIMTARGET_MATCOLOR_MAX }; enum { ANIMTARGET_TEXSRT_TRANSX = 0, ANIMTARGET_TEXSRT_TRANSY, - + ANIMTARGET_TEXSRT_ROT, - + ANIMTARGET_TEXSRT_SCALEX, ANIMTARGET_TEXSRT_SCALEY, - + ANIMTARGET_TEXSRT_MAX }; enum { ANIMTARGET_TEXPATTURN_IMAGE = 0, - + ANIMTARGET_TEXPATTURN_MAX }; @@ -123,88 +123,91 @@ namespace nw4r { ANIMCURVE_NONE = 0, ANIMCURVE_STEP, ANIMCURVE_HERMITE, - + ANIMCURVE_MAX }; class AnimTransform { - public: - AnimTransform(); - virtual ~AnimTransform(); + public: + AnimTransform(); + virtual ~AnimTransform(); - virtual void SetResource(const res::AnimationBlock* pRes, ResourceAccessor* pResAccessor); + virtual void SetResource(const res::AnimationBlock* pRes, ResourceAccessor* pResAccessor); - virtual void Bind(Pane* pane, bool bRecursive); - virtual void Bind(Material* pMaterial); + virtual void Bind(Pane* pane, bool bRecursive); + virtual void Bind(Material* pMaterial); - virtual void Animate(u32 idx, Pane* pane); - virtual void Animate(u32 idx, Material* pMaterial); + virtual void Animate(u32 idx, Pane* pane); + virtual void Animate(u32 idx, Material* pMaterial); - f32 GetFrameMax() const { return GetFrameSize(); } - u16 GetFrameSize() const; + f32 GetFrameMax() const { return GetFrameSize(); } + u16 GetFrameSize() const; - void SetFrame(f32 frame) { mFrame = frame; } + void SetFrame(f32 frame) { mFrame = frame; } - bool IsLoopData() const; + bool IsLoopData() const; - ut::LinkListNode mLink; // 0x04 + ut::LinkListNode mLink; // 0x04 - protected: - const res::AnimationBlock* mpRes; // 0x0C - f32 mFrame; // 0x10 + protected: + const res::AnimationBlock* mpRes; // 0x0C + f32 mFrame; // 0x10 }; typedef ut::LinkList AnimTransformList; - + class AnimationLink { - public: - AnimationLink() : mLink(), mbDisable(false) { Reset(); } - ~AnimationLink() {} + public: + AnimationLink() : mLink(), mbDisable(false) { Reset(); } + ~AnimationLink() {} - AnimTransform* GetAnimTransform() const { return mAnimTrans; } + AnimTransform* GetAnimTransform() const { return mAnimTrans; } - u16 GetIndex() const { return mIdx; } - bool IsEnable() const { return !mbDisable; } + u16 GetIndex() const { return mIdx; } + bool IsEnable() const { return !mbDisable; } - void SetEnable(bool bEnable) { mbDisable = !bEnable; } + void SetEnable(bool bEnable) { mbDisable = !bEnable; } - void Reset() { SetAnimTransform(NULL, 0); } + void Reset() { SetAnimTransform(NULL, 0); } - void SetAnimTransform(AnimTransform* animTrans, u16 idx) { mAnimTrans = animTrans; mIdx = idx; } + void SetAnimTransform(AnimTransform* animTrans, u16 idx) { + mAnimTrans = animTrans; + mIdx = idx; + } - ut::LinkListNode mLink; // 0x00 + ut::LinkListNode mLink; // 0x00 - private: - AnimTransform* mAnimTrans; // 0x08 + private: + AnimTransform* mAnimTrans; // 0x08 - u16 mIdx; // 0x0C - bool mbDisable; // 0x0E + u16 mIdx; // 0x0C + bool mbDisable; // 0x0E }; typedef ut::LinkList AnimationLinkList; class AnimTransformBasic : public AnimTransform { - public: - AnimTransformBasic(); - virtual ~AnimTransformBasic(); + public: + AnimTransformBasic(); + virtual ~AnimTransformBasic(); - virtual void SetResource(const res::AnimationBlock* pRes, ResourceAccessor* pResAccessor); + virtual void SetResource(const res::AnimationBlock* pRes, ResourceAccessor* pResAccessor); - virtual void Bind(Pane* pane, bool bRecursive); - virtual void Bind(Material* pMaterial); + virtual void Bind(Pane* pane, bool bRecursive); + virtual void Bind(Material* pMaterial); - virtual void Animate(u32 idx, Pane* pane); - virtual void Animate(u32 idx, Material* pMaterial); + virtual void Animate(u32 idx, Pane* pane); + virtual void Animate(u32 idx, Material* pMaterial); - protected: - void** mpFileResAry; // 0x14 + protected: + void** mpFileResAry; // 0x14 - AnimationLink* mAnimLinkAry; // 0x18 - u16 mAnimLinkNum; // 0x1C + AnimationLink* mAnimLinkAry; // 0x18 + u16 mAnimLinkNum; // 0x1C }; namespace detail { AnimationLink* FindAnimationLink(AnimationLinkList* animList, AnimTransform* animTrans); } - } -} + } // namespace lyt +} // namespace nw4r -#endif // NW4R_LYT_ANIMATION_H +#endif // NW4R_LYT_ANIMATION_H diff --git a/libs/NW4R/include/nw4r/lyt/arcResourceAccessor.h b/libs/NW4R/include/nw4r/lyt/arcResourceAccessor.h index 6bbaccd4..d8cb3eb2 100644 --- a/libs/NW4R/include/nw4r/lyt/arcResourceAccessor.h +++ b/libs/NW4R/include/nw4r/lyt/arcResourceAccessor.h @@ -5,91 +5,91 @@ #include -#include #include +#include #include namespace nw4r { namespace lyt { - static const int RESOURCE_NAME_MAX = 128; + static const int RESOURCE_NAME_MAX = 128; class FontRefLink { - public: - FontRefLink(); - - void Set(const char* name, ut::Font* pFont); + public: + FontRefLink(); - const char* GetFontName() const { return mFontName; } - ut::Font* GetFont() const { return mpFont; } + void Set(const char* name, ut::Font* pFont); - ut::LinkListNode mLink; // 0x00 - - protected: - char mFontName[RESOURCE_NAME_MAX]; // 0x08 - ut::Font* mpFont; // 0x88 + const char* GetFontName() const { return mFontName; } + ut::Font* GetFont() const { return mpFont; } + + ut::LinkListNode mLink; // 0x00 + + protected: + char mFontName[RESOURCE_NAME_MAX]; // 0x08 + ut::Font* mpFont; // 0x88 }; typedef ut::LinkList FontRefLinkList; - + class ArcResourceLink { - public: - ArcResourceLink() {} + public: + ArcResourceLink() {} - bool Set(void* archiveStart, const char* resRootDirectory); - - char* GetResRootDir() { return mResRootDir; } - ARCHandle* GetArcHandle() { return &mArcHandle; } + bool Set(void* archiveStart, const char* resRootDirectory); - ut::LinkListNode mLink; // 0x00 - - protected: - ARCHandle mArcHandle; // 0x08 + char* GetResRootDir() { return mResRootDir; } + ARCHandle* GetArcHandle() { return &mArcHandle; } - char mResRootDir[RESOURCE_NAME_MAX]; // 0x24 + ut::LinkListNode mLink; // 0x00 + + protected: + ARCHandle mArcHandle; // 0x08 + + char mResRootDir[RESOURCE_NAME_MAX]; // 0x24 }; typedef ut::LinkList ArcResourceLinkList; class ArcResourceAccessor : public ResourceAccessor { - public: - ArcResourceAccessor(); - virtual ~ArcResourceAccessor() {} + public: + ArcResourceAccessor(); + virtual ~ArcResourceAccessor() {} - virtual void* GetResource(u32 resType, const char* name, u32* pSize = NULL); - virtual ut::Font* GetFont(const char* name); + virtual void* GetResource(u32 resType, const char* name, u32* pSize = NULL); + virtual ut::Font* GetFont(const char* name); - bool Attach(void* archiveStart, const char* resourceRootDirectory); + bool Attach(void* archiveStart, const char* resourceRootDirectory); - private: - ARCHandle mArcHandle; // 0x04 - void* mArcBuf; // 0x20, + private: + ARCHandle mArcHandle; // 0x04 + void* mArcBuf; // 0x20, - FontRefLinkList mFontList; // 0x24 + FontRefLinkList mFontList; // 0x24 - char mResRootDir[RESOURCE_NAME_MAX]; // 0x30 + char mResRootDir[RESOURCE_NAME_MAX]; // 0x30 }; class MultiArcResourceAccessor : public ResourceAccessor { - public: - MultiArcResourceAccessor(); - virtual ~MultiArcResourceAccessor(); + public: + MultiArcResourceAccessor(); + virtual ~MultiArcResourceAccessor(); - void Attach(ArcResourceLink* pLink); - void DetachAll() { reinterpret_cast(&mArcList)->Clear();} - - void RegistFont(FontRefLink* pLink); - - virtual void* GetResource(u32 resType, const char* name, u32* pSize = NULL); - virtual ut::Font* GetFont(const char* name); + void Attach(ArcResourceLink* pLink); + void DetachAll() { reinterpret_cast(&mArcList)->Clear(); } - protected: - ArcResourceLinkList mArcList; // 0x04 - FontRefLinkList mFontList; // 0x10 + void RegistFont(FontRefLink* pLink); + + virtual void* GetResource(u32 resType, const char* name, u32* pSize = NULL); + virtual ut::Font* GetFont(const char* name); + + protected: + ArcResourceLinkList mArcList; // 0x04 + FontRefLinkList mFontList; // 0x10 }; namespace detail { - ut::Font* FindFont(FontRefLinkList* pFontRefList, const char* name); + ut::Font* FindFont(FontRefLinkList* pFontRefList, const char* name); } - } -} + } // namespace lyt +} // namespace nw4r -#endif // NW4R_LYT_ARC_RESOURCE_ACCESSOR_H +#endif // NW4R_LYT_ARC_RESOURCE_ACCESSOR_H diff --git a/libs/NW4R/include/nw4r/lyt/bounding.h b/libs/NW4R/include/nw4r/lyt/bounding.h index e6c70cee..058ec70b 100644 --- a/libs/NW4R/include/nw4r/lyt/bounding.h +++ b/libs/NW4R/include/nw4r/lyt/bounding.h @@ -6,15 +6,15 @@ namespace nw4r { namespace lyt { class Bounding : public Pane { - public: - Bounding(const res::Bounding* pBlock, const ResBlockSet& resBlockSet); - virtual ~Bounding(); + public: + Bounding(const res::Bounding* pBlock, const ResBlockSet& resBlockSet); + virtual ~Bounding(); - NW4R_UT_RUNTIME_TYPEINFO; + NW4R_UT_RUNTIME_TYPEINFO; - virtual void DrawSelf(const DrawInfo& drawInfo); + virtual void DrawSelf(const DrawInfo& drawInfo); }; - } -} + } // namespace lyt +} // namespace nw4r -#endif // NW4R_LYT_BOUNDING_H +#endif // NW4R_LYT_BOUNDING_H diff --git a/libs/NW4R/include/nw4r/lyt/common.h b/libs/NW4R/include/nw4r/lyt/common.h index 0222167e..5bfadafe 100644 --- a/libs/NW4R/include/nw4r/lyt/common.h +++ b/libs/NW4R/include/nw4r/lyt/common.h @@ -1,8 +1,9 @@ #ifndef NW4R_LYT_COMMON_H #define NW4R_LYT_COMMON_H -#include #include +#include + #include @@ -17,50 +18,51 @@ namespace nw4r { typedef math::VEC2 TexCoords[4]; class TexCoordAry { - public: - TexCoordAry(); + public: + TexCoordAry(); - u8 GetSize() const { return mNum; } - const TexCoords* GetArray() const { return mpData; } + u8 GetSize() const { return mNum; } + const TexCoords* GetArray() const { return mpData; } - void SetSize(u8 num); + void SetSize(u8 num); - bool IsEmpty() const { return mCap == 0; } + bool IsEmpty() const { return mCap == 0; } - void Reserve(u8 num); + void Reserve(u8 num); - void Free(); - void Copy(const void* pResTexCoord, u8 texCoordNum); + void Free(); + void Copy(const void* pResTexCoord, u8 texCoordNum); - void SetCoord(u32 idx, const math::VEC2* vec); - void GetCoord(u32 idx, math::VEC2* vec) const; + void SetCoord(u32 idx, const math::VEC2* vec); + void GetCoord(u32 idx, math::VEC2* vec) const; - private: - u8 mCap; // 0x00 - u8 mNum; // 0x01 + private: + u8 mCap; // 0x00 + u8 mNum; // 0x01 - TexCoords* mpData; // 0x04 + TexCoords* mpData; // 0x04 }; - bool EqualsPaneName(const char* name1, const char* name2); - bool EqualsMaterialName(const char* name1, const char* name2); + bool EqualsPaneName(const char* name1, const char* name2); + bool EqualsMaterialName(const char* name1, const char* name2); - bool TestFileHeader(const res::BinaryFileHeader& fileHeader); - bool TestFileHeader(const res::BinaryFileHeader& fileHeader, u32 testSig); + bool TestFileHeader(const res::BinaryFileHeader& fileHeader); + bool TestFileHeader(const res::BinaryFileHeader& fileHeader, u32 testSig); - bool IsModulateVertexColor(ut::Color* vtxColors, u8 glbAlpha); + bool IsModulateVertexColor(ut::Color* vtxColors, u8 glbAlpha); - ut::Color MultipleAlpha(const ut::Color col, u8 alpha); - void MultipleAlpha(ut::Color* dst, const ut::Color* src, u8 alpha); + ut::Color MultipleAlpha(const ut::Color col, u8 alpha); + void MultipleAlpha(ut::Color* dst, const ut::Color* src, u8 alpha); - void SetVertexFormat(bool bModulate, u8 texCoordNum); + void SetVertexFormat(bool bModulate, u8 texCoordNum); - void DrawQuad(const math::VEC2& basePt, const Size& size, u8 texCoordNum, const TexCoords* texCoords, const ut::Color* vtxColors); - void DrawQuad(const math::VEC2& basePt, const Size& size, u8 texCoordNum, const TexCoords* texCoords, const ut::Color* vtxColors, u8 alpha); + void DrawQuad(const math::VEC2& basePt, const Size& size, u8 texCoordNum, const TexCoords* texCoords, const ut::Color* vtxColors); + void DrawQuad(const math::VEC2& basePt, const Size& size, u8 texCoordNum, const TexCoords* texCoords, const ut::Color* vtxColors, + u8 alpha); - void DrawLine(const math::VEC2& pos, const Size& size, ut::Color color); + void DrawLine(const math::VEC2& pos, const Size& size, ut::Color color); - void InitGXTexObjFromTPL(GXTexObj* to, TPLPalette* pal, u32 id); + void InitGXTexObjFromTPL(GXTexObj* to, TPLPalette* pal, u32 id); inline s32 GetSignatureInt(const char* sig) { return *reinterpret_cast(sig); @@ -92,14 +94,14 @@ namespace nw4r { } inline void SetHorizontalPosition(u8* pVar, u8 newVal) { - *pVar = GetVerticalPosition(*pVar) * HORIZONTALPOSITION_MAX + newVal; + *pVar = GetVerticalPosition(*pVar) * HORIZONTALPOSITION_MAX + newVal; } inline void SetVerticalPosition(u8* pVar, u8 newVal) { - *pVar = newVal * VERTICALPOSITION_MAX + GetHorizontalPosition(*pVar); + *pVar = newVal * VERTICALPOSITION_MAX + GetHorizontalPosition(*pVar); } - } - } -} + } // namespace detail + } // namespace lyt +} // namespace nw4r -#endif // NW4R_LYT_ARC_RESOURCE_ACCESSOR_H +#endif // NW4R_LYT_ARC_RESOURCE_ACCESSOR_H diff --git a/libs/NW4R/include/nw4r/lyt/config.h b/libs/NW4R/include/nw4r/lyt/config.h index 1c247daa..b5d6f2a0 100644 --- a/libs/NW4R/include/nw4r/lyt/config.h +++ b/libs/NW4R/include/nw4r/lyt/config.h @@ -3,6 +3,6 @@ #include -#define NW4R_LYT_VERSION 8 +#define NW4R_LYT_VERSION 8 -#endif // NW4R_LYT_CONFIG_H +#endif // NW4R_LYT_CONFIG_H diff --git a/libs/NW4R/include/nw4r/lyt/drawInfo.h b/libs/NW4R/include/nw4r/lyt/drawInfo.h index 6f0ea475..7df9838c 100644 --- a/libs/NW4R/include/nw4r/lyt/drawInfo.h +++ b/libs/NW4R/include/nw4r/lyt/drawInfo.h @@ -13,51 +13,51 @@ namespace nw4r { public: DrawInfo(); virtual ~DrawInfo(); - - void SetViewRect(const ut::Rect& rect) { mViewRect = rect; } - const math::MTX34& GetViewMtx() const { return mViewMtx; } - void SetViewMtx(const math::MTX34& value) { mViewMtx = value; } + void SetViewRect(const ut::Rect& rect) { mViewRect = rect; } - const math::VEC2& GetLocationAdjustScale() const { return mLocationAdjustScale; } - void SetLocationAdjustScale(const math::VEC2& scale) { mLocationAdjustScale = scale; } + const math::MTX34& GetViewMtx() const { return mViewMtx; } + void SetViewMtx(const math::MTX34& value) { mViewMtx = value; } - bool IsMultipleViewMtxOnDraw() const { return mFlag.mulViewDraw; } - void SetMultipleViewMtxOnDraw(bool bEnable) { mFlag.mulViewDraw = bEnable; } + const math::VEC2& GetLocationAdjustScale() const { return mLocationAdjustScale; } + void SetLocationAdjustScale(const math::VEC2& scale) { mLocationAdjustScale = scale; } - bool IsInfluencedAlpha() const { return mFlag.influencedAlpha; } - void SetInfluencedAlpha(bool bEnable) { mFlag.influencedAlpha = bEnable; } + bool IsMultipleViewMtxOnDraw() const { return mFlag.mulViewDraw; } + void SetMultipleViewMtxOnDraw(bool bEnable) { mFlag.mulViewDraw = bEnable; } - bool IsLocationAdjust() const { return mFlag.locationAdjust; } - void SetLocationAdjust(bool bEnable) { mFlag.locationAdjust = bEnable; } + bool IsInfluencedAlpha() const { return mFlag.influencedAlpha; } + void SetInfluencedAlpha(bool bEnable) { mFlag.influencedAlpha = bEnable; } - bool IsInvisiblePaneCalculateMtx() const { return mFlag.invisiblePaneCalculateMtx; } - void SetInvisiblePaneCalculateMtx(bool bEnable) { mFlag.invisiblePaneCalculateMtx = bEnable; } + bool IsLocationAdjust() const { return mFlag.locationAdjust; } + void SetLocationAdjust(bool bEnable) { mFlag.locationAdjust = bEnable; } - bool IsDebugDrawMode() const { return mFlag.debugDrawMode; } - void SetDebugDrawMode(bool bEnable) { mFlag.debugDrawMode = bEnable; } + bool IsInvisiblePaneCalculateMtx() const { return mFlag.invisiblePaneCalculateMtx; } + void SetInvisiblePaneCalculateMtx(bool bEnable) { mFlag.invisiblePaneCalculateMtx = bEnable; } - bool IsYAxisUp() const { return mViewRect.bottom - mViewRect.top < 0.0f; } + bool IsDebugDrawMode() const { return mFlag.debugDrawMode; } + void SetDebugDrawMode(bool bEnable) { mFlag.debugDrawMode = bEnable; } - f32 GetGlobalAlpha() const { return mGlobalAlpha; } - void SetGlobalAlpha(f32 alpha) { mGlobalAlpha = alpha; } + bool IsYAxisUp() const { return mViewRect.bottom - mViewRect.top < 0.0f; } + + f32 GetGlobalAlpha() const { return mGlobalAlpha; } + void SetGlobalAlpha(f32 alpha) { mGlobalAlpha = alpha; } protected: - math::MTX34 mViewMtx; // 0x04 - ut::Rect mViewRect; // 0x34 + math::MTX34 mViewMtx; // 0x04 + ut::Rect mViewRect; // 0x34 - math::VEC2 mLocationAdjustScale; // 0x44 - f32 mGlobalAlpha; // 0x4C + math::VEC2 mLocationAdjustScale; // 0x44 + f32 mGlobalAlpha; // 0x4C struct { - u8 mulViewDraw : 1; // 10000000 - u8 influencedAlpha : 1; // 01000000 - u8 locationAdjust : 1; // 00100000 - u8 invisiblePaneCalculateMtx : 1; // 00010000 - u8 debugDrawMode : 1; // 00001000 - } mFlag; // 0x50 + u8 mulViewDraw : 1; // 10000000 + u8 influencedAlpha : 1; // 01000000 + u8 locationAdjust : 1; // 00100000 + u8 invisiblePaneCalculateMtx : 1; // 00010000 + u8 debugDrawMode : 1; // 00001000 + } mFlag; // 0x50 }; - } -} + } // namespace lyt +} // namespace nw4r -#endif // NW4R_LYT_DRAW_INFO_H +#endif // NW4R_LYT_DRAW_INFO_H diff --git a/libs/NW4R/include/nw4r/lyt/group.h b/libs/NW4R/include/nw4r/lyt/group.h index eb3bc239..830bfd7e 100644 --- a/libs/NW4R/include/nw4r/lyt/group.h +++ b/libs/NW4R/include/nw4r/lyt/group.h @@ -11,53 +11,53 @@ namespace nw4r { namespace lyt { namespace detail { typedef struct PaneLink { - ut::LinkListNode mLink; - - Pane* mTarget; // 0x08 + ut::LinkListNode mLink; + + Pane* mTarget; // 0x08 } PaneLink; - } + } // namespace detail typedef ut::LinkList PaneLinkList; - + class Group { - public: - Group(); - Group(const res::Group* pResGroup, Pane* pRootPane); - virtual ~Group(); + public: + Group(); + Group(const res::Group* pResGroup, Pane* pRootPane); + virtual ~Group(); - const char* GetName() const { return mName; } - bool IsUserAllocated() const { return mbUserAllocated; } + const char* GetName() const { return mName; } + bool IsUserAllocated() const { return mbUserAllocated; } - PaneLinkList& GetPaneList() { return mPaneLinkList; }; + PaneLinkList& GetPaneList() { return mPaneLinkList; }; - void Init(); - void AppendPane(Pane* pane); + void Init(); + void AppendPane(Pane* pane); - ut::LinkListNode mLink; // 0x04 - - private: - PaneLinkList mPaneLinkList; // 0x0C - char mName[16]; // 0x18 - - bool mbUserAllocated; // 0x29 + ut::LinkListNode mLink; // 0x04 - u8 mPadding[2]; // 0x2A + private: + PaneLinkList mPaneLinkList; // 0x0C + char mName[16]; // 0x18 + + bool mbUserAllocated; // 0x29 + + u8 mPadding[2]; // 0x2A }; typedef ut::LinkList GroupList; - + class GroupContainer { - public: - GroupContainer() {} - ~GroupContainer(); + public: + GroupContainer() {} + ~GroupContainer(); - GroupList& GetGroupList() { return mGroupList; } + GroupList& GetGroupList() { return mGroupList; } - void AppendGroup(Group* pGroup); - Group* FindGroupByName(const char* findName); - - protected: - GroupList mGroupList; // 0x00 + void AppendGroup(Group* pGroup); + Group* FindGroupByName(const char* findName); + + protected: + GroupList mGroupList; // 0x00 }; - } -} + } // namespace lyt +} // namespace nw4r -#endif // NW4R_LYT_GROUP_H +#endif // NW4R_LYT_GROUP_H diff --git a/libs/NW4R/include/nw4r/lyt/layout.h b/libs/NW4R/include/nw4r/lyt/layout.h index 5fb2d24b..8ca32282 100644 --- a/libs/NW4R/include/nw4r/lyt/layout.h +++ b/libs/NW4R/include/nw4r/lyt/layout.h @@ -3,14 +3,14 @@ #include -#include #include +#include -#include +#include #include #include -#include #include +#include #include #include @@ -20,51 +20,51 @@ namespace nw4r { class Layout { public: Layout(); - virtual ~Layout(); // 0x08 - - const ut::Rect GetLayoutRect() const; + virtual ~Layout(); // 0x08 - virtual bool Build(const void* lytResBuf, ResourceAccessor* pResAcsr); // 0x0C - - virtual AnimTransform* CreateAnimTransform(const void* anmResBuf, ResourceAccessor* pResAcsr); // 0x10 + const ut::Rect GetLayoutRect() const; - virtual void BindAnimation(AnimTransform* animTrans); // 0x14 - virtual void UnbindAnimation(AnimTransform* animTrans); // 0x18 - virtual void UnbindAllAnimation(); // 0x1C + virtual bool Build(const void* lytResBuf, ResourceAccessor* pResAcsr); // 0x0C - virtual void SetAnimationEnable(AnimTransform* animTrans, bool bEnable = true); // 0x20 + virtual AnimTransform* CreateAnimTransform(const void* anmResBuf, ResourceAccessor* pResAcsr); // 0x10 - virtual void CalculateMtx(const DrawInfo& drawInfo); // 0x24 - virtual void Draw(const DrawInfo& drawInfo); // 0x28 + virtual void BindAnimation(AnimTransform* animTrans); // 0x14 + virtual void UnbindAnimation(AnimTransform* animTrans); // 0x18 + virtual void UnbindAllAnimation(); // 0x1C - virtual void Animate(u32 option = 0); // 0x2C + virtual void SetAnimationEnable(AnimTransform* animTrans, bool bEnable = true); // 0x20 - virtual void SetTagProcessor(ut::WideTagProcessor* pTagProcessor) NO_INLINE; // 0x30 + virtual void CalculateMtx(const DrawInfo& drawInfo); // 0x24 + virtual void Draw(const DrawInfo& drawInfo); // 0x28 - Pane* GetRootPane() const { return mpRootPane; } - GroupContainer* GetGroupContainer() const { return mpGroupContainer; } + virtual void Animate(u32 option = 0); // 0x2C - static MEMAllocator* GetAllocator() { return mspAllocator; } - static void SetAllocator(MEMAllocator* allocator) { mspAllocator = allocator; } - - static void* AllocMemory(u32 size) { return MEMAllocFromAllocator(mspAllocator, size); } - static void FreeMemory(void* ptr) { MEMFreeToAllocator(mspAllocator, ptr); } + virtual void SetTagProcessor(ut::WideTagProcessor* pTagProcessor) NO_INLINE; // 0x30 + + Pane* GetRootPane() const { return mpRootPane; } + GroupContainer* GetGroupContainer() const { return mpGroupContainer; } + + static MEMAllocator* GetAllocator() { return mspAllocator; } + static void SetAllocator(MEMAllocator* allocator) { mspAllocator = allocator; } + + static void* AllocMemory(u32 size) { return MEMAllocFromAllocator(mspAllocator, size); } + static void FreeMemory(void* ptr) { MEMFreeToAllocator(mspAllocator, ptr); } protected: - static Pane* BuildPaneObj(s32 kind, const void* dataPtr, const ResBlockSet& resBlockSet) NO_INLINE; + static Pane* BuildPaneObj(s32 kind, const void* dataPtr, const ResBlockSet& resBlockSet) NO_INLINE; - AnimTransformList mAnimTransList; // 0x04 + AnimTransformList mAnimTransList; // 0x04 - Pane* mpRootPane; // 0x10 - GroupContainer* mpGroupContainer; // 0x14 + Pane* mpRootPane; // 0x10 + GroupContainer* mpGroupContainer; // 0x14 - Size mLayoutSize; // 0x18 + Size mLayoutSize; // 0x18 - u8 mOriginType; // 0x20 + u8 mOriginType; // 0x20 - static MEMAllocator* mspAllocator; + static MEMAllocator* mspAllocator; }; - } -} + } // namespace lyt +} // namespace nw4r -#endif // NW4R_LYT_LAYOUT_H +#endif // NW4R_LYT_LAYOUT_H diff --git a/libs/NW4R/include/nw4r/lyt/material.h b/libs/NW4R/include/nw4r/lyt/material.h index c927a603..8cf82768 100644 --- a/libs/NW4R/include/nw4r/lyt/material.h +++ b/libs/NW4R/include/nw4r/lyt/material.h @@ -7,9 +7,9 @@ #include -#include -#include #include +#include +#include namespace nw4r { namespace lyt { @@ -17,145 +17,141 @@ namespace nw4r { namespace detail { typedef struct BitGXNums { - u32 texMap : 4; // 11110000000000000000000000000000 - u32 texSRT : 4; // 00001111000000000000000000000000 - u32 texCoordGen : 4; // 00000000111100000000000000000000 - u32 indSRT : 2; // 00000000000011000000000000000000 - u32 indStage : 3; // 00000000000000111000000000000000 - u32 tevSwap : 1; // 00000000000000000100000000000000 - u32 tevStage : 5; // 00000000000000000011111000000000 - u32 chanCtrl : 1; // 00000000000000000000000100000000 - u32 matCol : 1; // 00000000000000000000000010000000 - u32 alpComp : 1; // 00000000000000000000000001000000 - u32 blendMode : 1; // 00000000000000000000000000100000 + u32 texMap : 4; // 11110000000000000000000000000000 + u32 texSRT : 4; // 00001111000000000000000000000000 + u32 texCoordGen : 4; // 00000000111100000000000000000000 + u32 indSRT : 2; // 00000000000011000000000000000000 + u32 indStage : 3; // 00000000000000111000000000000000 + u32 tevSwap : 1; // 00000000000000000100000000000000 + u32 tevStage : 5; // 00000000000000000011111000000000 + u32 chanCtrl : 1; // 00000000000000000000000100000000 + u32 matCol : 1; // 00000000000000000000000010000000 + u32 alpComp : 1; // 00000000000000000000000001000000 + u32 blendMode : 1; // 00000000000000000000000000100000 } BitGXNums; Size GetTextureSize(Material* pMaterial, u8 texMapIdx); - } + } // namespace detail class Material { - public: - Material(); - Material(const res::Material* pRes, const ResBlockSet& resBlockSet); - virtual ~Material(); + public: + Material(); + Material(const res::Material* pRes, const ResBlockSet& resBlockSet); + virtual ~Material(); - virtual bool SetupGX(bool bModVtxCol, u8 alpha); + virtual bool SetupGX(bool bModVtxCol, u8 alpha); - virtual void BindAnimation(AnimTransform* animTrans); - virtual void UnbindAnimation(AnimTransform* animTrans); - virtual void UnbindAllAnimation(); + virtual void BindAnimation(AnimTransform* animTrans); + virtual void UnbindAnimation(AnimTransform* animTrans); + virtual void UnbindAllAnimation(); - virtual void Animate(); + virtual void Animate(); - virtual AnimationLink* FindAnimationLink(AnimTransform* animTrans); + virtual AnimationLink* FindAnimationLink(AnimTransform* animTrans); - virtual void SetAnimationEnable(AnimTransform* animTrans, bool bEnable); + virtual void SetAnimationEnable(AnimTransform* animTrans, bool bEnable); - const char* GetName() const { return mName; } + const char* GetName() const { return mName; } - GXColorS10 GetTevColor(u32 idx) const { return mTevCols[idx]; } - void SetTevColor(u32 idx, const GXColorS10& val) { mTevCols[idx] = val; } + GXColorS10 GetTevColor(u32 idx) const { return mTevCols[idx]; } + void SetTevColor(u32 idx, const GXColorS10& val) { mTevCols[idx] = val; } - u8 GetTextureCap() const { return mGXMemCap.texMap; } + u8 GetTextureCap() const { return mGXMemCap.texMap; } - u8 GetTexSRTCap() const { return mGXMemCap.texSRT; } + u8 GetTexSRTCap() const { return mGXMemCap.texSRT; } - u8 GetTexCoordGenCap() const { return mGXMemCap.texCoordGen; } + u8 GetTexCoordGenCap() const { return mGXMemCap.texCoordGen; } - u8 GetIndTexSRTCap() const { return mGXMemCap.indSRT; } + u8 GetIndTexSRTCap() const { return mGXMemCap.indSRT; } - bool IsTevSwapCap() const { return static_cast(mGXMemCap.tevSwap); } - bool IsBlendModeCap() const { return static_cast(mGXMemCap.blendMode); } - bool IsAlphaCompareCap() const { return static_cast(mGXMemCap.alpComp); } + bool IsTevSwapCap() const { return static_cast(mGXMemCap.tevSwap); } + bool IsBlendModeCap() const { return static_cast(mGXMemCap.blendMode); } + bool IsAlphaCompareCap() const { return static_cast(mGXMemCap.alpComp); } - bool IsMatColorCap() const { return static_cast(mGXMemCap.matCol); } - bool IsChanCtrlCap() const { return static_cast(mGXMemCap.chanCtrl); } + bool IsMatColorCap() const { return static_cast(mGXMemCap.matCol); } + bool IsChanCtrlCap() const { return static_cast(mGXMemCap.chanCtrl); } - u8 GetTextureNum() const { return mGXMemNum.texMap; } + u8 GetTextureNum() const { return mGXMemNum.texMap; } - bool IsUserAllocated() const { return mbUserAllocated; } + bool IsUserAllocated() const { return mbUserAllocated; } - void SetName(const char* name); + void SetName(const char* name); - const GXTexObj* GetTexMapAry() const; - const TexSRT* GetTexSRTAry() const; - const TexCoordGen* GetTexCoordGenAry() const; - const ChanCtrl* GetChanCtrlAry() const; - const ut::Color* GetMatColAry() const; - const TevSwapMode* GetTevSwapAry() const; - const AlphaCompare* GetAlphaComparePtr() const; - const BlendMode* GetBlendModePtr() const; - const IndirectStage* GetIndirectStageAry() const; - const TexSRT* GetIndTexSRTAry() const; - const TevStage* GetTevStageAry() const; + const GXTexObj* GetTexMapAry() const; + const TexSRT* GetTexSRTAry() const; + const TexCoordGen* GetTexCoordGenAry() const; + const ChanCtrl* GetChanCtrlAry() const; + const ut::Color* GetMatColAry() const; + const TevSwapMode* GetTevSwapAry() const; + const AlphaCompare* GetAlphaComparePtr() const; + const BlendMode* GetBlendModePtr() const; + const IndirectStage* GetIndirectStageAry() const; + const TexSRT* GetIndTexSRTAry() const; + const TevStage* GetTevStageAry() const; - GXTexObj* GetTexMapAry(); - TexSRT* GetTexSRTAry(); - TexCoordGen* GetTexCoordGenAry(); - ChanCtrl* GetChanCtrlAry(); - ut::Color* GetMatColAry(); - TevSwapMode* GetTevSwapAry(); - AlphaCompare* GetAlphaComparePtr(); - BlendMode* GetBlendModePtr(); - IndirectStage* GetIndirectStageAry(); - TexSRT* GetIndTexSRTAry(); - TevStage* GetTevStageAry(); + GXTexObj* GetTexMapAry(); + TexSRT* GetTexSRTAry(); + TexCoordGen* GetTexCoordGenAry(); + ChanCtrl* GetChanCtrlAry(); + ut::Color* GetMatColAry(); + TevSwapMode* GetTevSwapAry(); + AlphaCompare* GetAlphaComparePtr(); + BlendMode* GetBlendModePtr(); + IndirectStage* GetIndirectStageAry(); + TexSRT* GetIndTexSRTAry(); + TevStage* GetTevStageAry(); - void GetTexture(GXTexObj* pTexObj, u8 texMapIdx) const; + void GetTexture(GXTexObj* pTexObj, u8 texMapIdx) const; - void SetTextureNum(u8 num); - void SetTexCoordGenNum(u8 num); - void SetIndStageNum(u8 num); - void SetTevStageNum(u8 num); + void SetTextureNum(u8 num); + void SetTexCoordGenNum(u8 num); + void SetIndStageNum(u8 num); + void SetTevStageNum(u8 num); - void SetTexture(u8 texMapIdx, const GXTexObj& texObj); - void SetTexture(u8 texMapIdx, TPLPalette* pTplRes); - void SetTextureNoWrap(u8 texMapIdx, TPLPalette* pTplRes); + void SetTexture(u8 texMapIdx, const GXTexObj& texObj); + void SetTexture(u8 texMapIdx, TPLPalette* pTplRes); + void SetTextureNoWrap(u8 texMapIdx, TPLPalette* pTplRes); - void SetColorElement(u32 colorType, s16 value); + void SetColorElement(u32 colorType, s16 value); - void SetTexCoordGen(u32 idx, TexCoordGen value) { - GetTexCoordGenAry()[idx] = value; - } + void SetTexCoordGen(u32 idx, TexCoordGen value) { GetTexCoordGenAry()[idx] = value; } - void SetTexSRTElement(u32 texSRTIdx, u32 eleIdx, f32 value) { - f32* srtAry = reinterpret_cast(&GetTexSRTAry()[texSRTIdx]); - srtAry[eleIdx] = value; - } + void SetTexSRTElement(u32 texSRTIdx, u32 eleIdx, f32 value) { + f32* srtAry = reinterpret_cast(&GetTexSRTAry()[texSRTIdx]); + srtAry[eleIdx] = value; + } - void SetIndTexSRTElement(u32 texSRTIdx, u32 eleIdx, f32 value) { - f32* srtAry = reinterpret_cast(&GetIndTexSRTAry()[texSRTIdx]); - srtAry[eleIdx] = value; - } + void SetIndTexSRTElement(u32 texSRTIdx, u32 eleIdx, f32 value) { + f32* srtAry = reinterpret_cast(&GetIndTexSRTAry()[texSRTIdx]); + srtAry[eleIdx] = value; + } - void Init(); - void InitBitGXNums(detail::BitGXNums* ptr); + void Init(); + void InitBitGXNums(detail::BitGXNums* ptr); - void ReserveGXMem(u8 texMapNum, u8 texSRTNum, u8 texCoordGenNum, - u8 tevStageNum, bool allocTevSwap, u8 indStageNum, - u8 indSRTNum, bool allocChanCtrl, bool allocMatCol, - bool allocAlpComp, bool allocBlendMode); + void ReserveGXMem(u8 texMapNum, u8 texSRTNum, u8 texCoordGenNum, u8 tevStageNum, bool allocTevSwap, u8 indStageNum, u8 indSRTNum, + bool allocChanCtrl, bool allocMatCol, bool allocAlpComp, bool allocBlendMode); - void AddAnimationLink(AnimationLink* animationLink); + void AddAnimationLink(AnimationLink* animationLink); - private: - static const int MAX_TEX_SRT = (GX_TEXMTX9 - GX_TEXMTX0) / 3 + 1; - static const int MAX_IND_SRT = (GX_ITM_2 - GX_ITM_0) + 1; - - char mName[20]; // 0x04 + private: + static const int MAX_TEX_SRT = (GX_TEXMTX9 - GX_TEXMTX0) / 3 + 1; + static const int MAX_IND_SRT = (GX_ITM_2 - GX_ITM_0) + 1; - AnimationLinkList mAnimList; // 0x18 + char mName[20]; // 0x04 - GXColorS10 mTevCols[TEVCOLOR_MAX]; // 0x24 - ut::Color mTevKCols[GX_MAX_KCOLOR]; // 0x3C + AnimationLinkList mAnimList; // 0x18 - detail::BitGXNums mGXMemCap; // 0x4C - detail::BitGXNums mGXMemNum; // 0x50 + GXColorS10 mTevCols[TEVCOLOR_MAX]; // 0x24 + ut::Color mTevKCols[GX_MAX_KCOLOR]; // 0x3C - bool mbUserAllocated; // 0x54 + detail::BitGXNums mGXMemCap; // 0x4C + detail::BitGXNums mGXMemNum; // 0x50 - void* mpGXMem; // 0x58 + bool mbUserAllocated; // 0x54 + + void* mpGXMem; // 0x58 }; - } -} + } // namespace lyt +} // namespace nw4r -#endif // NW4R_LYT_MATERIAL_H +#endif // NW4R_LYT_MATERIAL_H diff --git a/libs/NW4R/include/nw4r/lyt/pane.h b/libs/NW4R/include/nw4r/lyt/pane.h index ccbaddc7..0c3c806c 100644 --- a/libs/NW4R/include/nw4r/lyt/pane.h +++ b/libs/NW4R/include/nw4r/lyt/pane.h @@ -9,10 +9,10 @@ #include -#include -#include #include +#include #include +#include namespace nw4r { namespace lyt { @@ -20,13 +20,13 @@ namespace nw4r { namespace detail { class PaneBase { - public: - inline PaneBase() : mLink() {} - virtual ~PaneBase() {} + public: + inline PaneBase() : mLink() {} + virtual ~PaneBase() {} - ut::LinkListNode mLink; + ut::LinkListNode mLink; }; - } + } // namespace detail typedef ut::LinkList PaneList; enum { @@ -34,140 +34,140 @@ namespace nw4r { }; class Pane : detail::PaneBase { - private: - enum { - BIT_VISIBLE = 0, - BIT_INFLUENCED_ALPHA, - BIT_LOCATION_ADJUST - }; - public: - Pane(); - Pane(const res::Pane* pBlock); - virtual ~Pane(); // 0x08 - - NW4R_UT_RUNTIME_TYPEINFO; + private: + enum { BIT_VISIBLE = 0, BIT_INFLUENCED_ALPHA, BIT_LOCATION_ADJUST }; - virtual void CalculateMtx(const DrawInfo& drawInfo); // 0x10 + public: + Pane(); + Pane(const res::Pane* pBlock); + virtual ~Pane(); // 0x08 - virtual void Draw(const DrawInfo& drawInfo); // 0x14 - virtual void DrawSelf(const DrawInfo& drawInfo); // 0x18 + NW4R_UT_RUNTIME_TYPEINFO; - virtual void Animate(u32 option = 0); // 0x1C - virtual void AnimateSelf(u32 option = 0); // 0x20 + virtual void CalculateMtx(const DrawInfo& drawInfo); // 0x10 - virtual ut::Color GetVtxColor(u32 idx) const; // 0x24 - virtual void SetVtxColor(u32 idx, ut::Color valuw); // 0x28 + virtual void Draw(const DrawInfo& drawInfo); // 0x14 + virtual void DrawSelf(const DrawInfo& drawInfo); // 0x18 - virtual u8 GetColorElement(u32 idx) const; // 0x2C - virtual void SetColorElement(u32 idx, u8 color); // 0x30 + virtual void Animate(u32 option = 0); // 0x1C + virtual void AnimateSelf(u32 option = 0); // 0x20 - virtual u8 GetVtxColorElement(u32 idx) const; // 0x34 - virtual void SetVtxColorElement(u32 idx, u8 element); // 0x38 - - virtual Pane* FindPaneByName(const char* findName, bool bRecursive = true); // 0x3C - virtual Material* FindMaterialByName(const char* findName, bool bRecursive = true); // 0x40 + virtual ut::Color GetVtxColor(u32 idx) const; // 0x24 + virtual void SetVtxColor(u32 idx, ut::Color valuw); // 0x28 - virtual void BindAnimation(AnimTransform* animTrans, bool bRecursive = true); // 0x44 - - virtual void UnbindAnimation(AnimTransform* animTrans, bool bRecursive = true); // 0x48 - virtual void UnbindAllAnimation(bool bRecursive = true); // 0x4C - virtual void UnbindAnimationSelf(AnimTransform* animTrans); // 0x50 - - virtual AnimationLink* FindAnimationLink(AnimTransform* animTrans); // 0x54 + virtual u8 GetColorElement(u32 idx) const; // 0x2C + virtual void SetColorElement(u32 idx, u8 color); // 0x30 - virtual void SetAnimationEnable(AnimTransform* animTrans, bool bEnable, bool bRecursive = true); // 0x58 + virtual u8 GetVtxColorElement(u32 idx) const; // 0x34 + virtual void SetVtxColorElement(u32 idx, u8 element); // 0x38 - virtual Material* GetMaterial() const; // 0x5C + virtual Pane* FindPaneByName(const char* findName, bool bRecursive = true); // 0x3C + virtual Material* FindMaterialByName(const char* findName, bool bRecursive = true); // 0x40 - virtual void LoadMtx(const DrawInfo& drawInfo); // 0x60 + virtual void BindAnimation(AnimTransform* animTrans, bool bRecursive = true); // 0x44 - Pane* GetParent() const { return mpParent; } - PaneList& GetChildList() { return mChildList; } + virtual void UnbindAnimation(AnimTransform* animTrans, bool bRecursive = true); // 0x48 + virtual void UnbindAllAnimation(bool bRecursive = true); // 0x4C + virtual void UnbindAnimationSelf(AnimTransform* animTrans); // 0x50 - const math::VEC3& GetTranslate() { return mTranslate; } - void SetTranslate(const math::VEC3& translate) { mTranslate = translate; } - void SetTranslate(const math::VEC2& translate) { SetTranslate(math::VEC3(translate.x, translate.y, 0.0f)); } + virtual AnimationLink* FindAnimationLink(AnimTransform* animTrans); // 0x54 - const math::VEC3& GetRotate() const { return mRotate; } - void SetRotate(const math::VEC3& rotate) { mRotate = rotate; } + virtual void SetAnimationEnable(AnimTransform* animTrans, bool bEnable, bool bRecursive = true); // 0x58 - const math::VEC2& GetScale() const { return mScale; } - void SetScale(const math::VEC2& scale) { mScale = scale; } + virtual Material* GetMaterial() const; // 0x5C - const Size& GetSize() const { return mSize; } - void SetSize(const Size& size) { mSize = size; } + virtual void LoadMtx(const DrawInfo& drawInfo); // 0x60 - bool IsVisible() { return detail::TestBit(mFlag, BIT_VISIBLE); }; - void SetVisible(bool visible) { detail::SetBit(&mFlag, BIT_VISIBLE, visible); }; + Pane* GetParent() const { return mpParent; } + PaneList& GetChildList() { return mChildList; } - bool IsInfluencedAlpha() { return detail::TestBit(mFlag, BIT_INFLUENCED_ALPHA); }; - void SetInfluencedAlpha(bool visible) { detail::SetBit(&mFlag, BIT_INFLUENCED_ALPHA, visible); }; + const math::VEC3& GetTranslate() { return mTranslate; } + void SetTranslate(const math::VEC3& translate) { mTranslate = translate; } + void SetTranslate(const math::VEC2& translate) { SetTranslate(math::VEC3(translate.x, translate.y, 0.0f)); } - bool IsLocationAdjust() { return detail::TestBit(mFlag, BIT_LOCATION_ADJUST); }; - void SetLocationAdjust(bool visible) { detail::SetBit(&mFlag, BIT_LOCATION_ADJUST, visible); }; + const math::VEC3& GetRotate() const { return mRotate; } + void SetRotate(const math::VEC3& rotate) { mRotate = rotate; } - const math::MTX34& GetGlobalMtx() const { return mGlbMtx; } - void SetGlobalMtx(const math::MTX34& mtx) { mGlbMtx = mtx; } + const math::VEC2& GetScale() const { return mScale; } + void SetScale(const math::VEC2& scale) { mScale = scale; } - const math::MTX34& GetMtx() const { return mMtx; } - void SetMtx(const math::MTX34& mtx) { mMtx = mtx; } + const Size& GetSize() const { return mSize; } + void SetSize(const Size& size) { mSize = size; } - u8 GetAlpha() { return mAlpha; } - void SetAlpha(u8 alpha) { mAlpha = alpha; } + bool IsVisible() { return detail::TestBit(mFlag, BIT_VISIBLE); }; + void SetVisible(bool visible) { detail::SetBit(&mFlag, BIT_VISIBLE, visible); }; - const char* GetName() const { return mName; } + bool IsInfluencedAlpha() { return detail::TestBit(mFlag, BIT_INFLUENCED_ALPHA); }; + void SetInfluencedAlpha(bool visible) { detail::SetBit(&mFlag, BIT_INFLUENCED_ALPHA, visible); }; - void SetSRTElement(u32 idx, f32 value) { NW4R_ASSERT(idx < ANIMTARGET_PANE_MAX); reinterpret_cast(&mTranslate)[idx] = value; } + bool IsLocationAdjust() { return detail::TestBit(mFlag, BIT_LOCATION_ADJUST); }; + void SetLocationAdjust(bool visible) { detail::SetBit(&mFlag, BIT_LOCATION_ADJUST, visible); }; - bool IsUserAllocated() const { return mbUserAllocated; } + const math::MTX34& GetGlobalMtx() const { return mGlbMtx; } + void SetGlobalMtx(const math::MTX34& mtx) { mGlbMtx = mtx; } - const ut::Rect GetPaneRect(const DrawInfo& drawInfo) const; - - math::VEC2 GetVtxPos() const; + const math::MTX34& GetMtx() const { return mMtx; } + void SetMtx(const math::MTX34& mtx) { mMtx = mtx; } - void SetName(const char* name); - void SetUserData(const char* userData); + u8 GetAlpha() { return mAlpha; } + void SetAlpha(u8 alpha) { mAlpha = alpha; } - void Init(); + const char* GetName() const { return mName; } - void InsertChild(PaneList::Iterator next, Pane* pChild); - void InsertChild(Pane* pNext, Pane* pChild); + void SetSRTElement(u32 idx, f32 value) { + NW4R_ASSERT(idx < ANIMTARGET_PANE_MAX); + reinterpret_cast(&mTranslate)[idx] = value; + } - void PrependChild(Pane* pChild); - void AppendChild(Pane* pChild); + bool IsUserAllocated() const { return mbUserAllocated; } - void RemoveChild(Pane* pChild); + const ut::Rect GetPaneRect(const DrawInfo& drawInfo) const; - void CalculateMtxChild(const DrawInfo& drawInfo); + math::VEC2 GetVtxPos() const; - void AddAnimationLink(AnimationLink* animationLink); - - protected: - Pane* mpParent; // 0x0C + void SetName(const char* name); + void SetUserData(const char* userData); - PaneList mChildList; // 0x10 - AnimationLinkList mAnimList; // 0x1C + void Init(); - Material* mpMaterial; // 0x28 + void InsertChild(PaneList::Iterator next, Pane* pChild); + void InsertChild(Pane* pNext, Pane* pChild); - math::VEC3 mTranslate; // 0x2C - math::VEC3 mRotate; // 0x38 - math::VEC2 mScale; // 0x44 - Size mSize; // 0x4C + void PrependChild(Pane* pChild); + void AppendChild(Pane* pChild); - math::MTX34 mMtx; // 0x54 - math::MTX34 mGlbMtx; // 0x84 - - char mName[16]; // 0xB4 - char mUserData[8]; // 0xC4 - - u8 mBasePosition; // 0xCC - u8 mAlpha; // 0xCD - u8 mGlbAlpha; // 0xCE - u8 mFlag; // 0xCF - bool mbUserAllocated; // 0xD0 + void RemoveChild(Pane* pChild); + + void CalculateMtxChild(const DrawInfo& drawInfo); + + void AddAnimationLink(AnimationLink* animationLink); + + protected: + Pane* mpParent; // 0x0C + + PaneList mChildList; // 0x10 + AnimationLinkList mAnimList; // 0x1C + + Material* mpMaterial; // 0x28 + + math::VEC3 mTranslate; // 0x2C + math::VEC3 mRotate; // 0x38 + math::VEC2 mScale; // 0x44 + Size mSize; // 0x4C + + math::MTX34 mMtx; // 0x54 + math::MTX34 mGlbMtx; // 0x84 + + char mName[16]; // 0xB4 + char mUserData[8]; // 0xC4 + + u8 mBasePosition; // 0xCC + u8 mAlpha; // 0xCD + u8 mGlbAlpha; // 0xCE + u8 mFlag; // 0xCF + bool mbUserAllocated; // 0xD0 }; - } -} + } // namespace lyt +} // namespace nw4r -#endif // NW4R_LYT_PANE_H +#endif // NW4R_LYT_PANE_H diff --git a/libs/NW4R/include/nw4r/lyt/picture.h b/libs/NW4R/include/nw4r/lyt/picture.h index aaffc371..2068cd93 100644 --- a/libs/NW4R/include/nw4r/lyt/picture.h +++ b/libs/NW4R/include/nw4r/lyt/picture.h @@ -8,38 +8,38 @@ namespace nw4r { namespace lyt { class Picture : public Pane { - public: - Picture(u8 num); - Picture(const res::Picture* pResPic, const ResBlockSet& resBlockSet); - virtual ~Picture(); + public: + Picture(u8 num); + Picture(const res::Picture* pResPic, const ResBlockSet& resBlockSet); + virtual ~Picture(); - NW4R_UT_RUNTIME_TYPEINFO; + NW4R_UT_RUNTIME_TYPEINFO; - virtual void DrawSelf(const DrawInfo& drawInfo); + virtual void DrawSelf(const DrawInfo& drawInfo); - virtual ut::Color GetVtxColor(u32 idx) const; - virtual void SetVtxColor(u32 idx, ut::Color value); + virtual ut::Color GetVtxColor(u32 idx) const; + virtual void SetVtxColor(u32 idx, ut::Color value); - virtual u8 GetVtxColorElement(u32 idx) const; - virtual void SetVtxColorElement(u32 idx, u8 value); + virtual u8 GetVtxColorElement(u32 idx) const; + virtual void SetVtxColorElement(u32 idx, u8 value); - virtual void Append(TPLPalette* pTplRes); - virtual void Append(const GXTexObj& texObj); + virtual void Append(TPLPalette* pTplRes); + virtual void Append(const GXTexObj& texObj); - void SetTexCoordNum(u8 num); - u8 GetTexCoordNum() const; + void SetTexCoordNum(u8 num); + u8 GetTexCoordNum() const; - void GetTexCoord(u32 idx, math::VEC2* coords) const; - void SetTexCoord(u32 idx, const math::VEC2* coords); + void GetTexCoord(u32 idx, math::VEC2* coords) const; + void SetTexCoord(u32 idx, const math::VEC2* coords); - void Init(u8 texNum); - void ReserveTexCoord(u8 num); + void Init(u8 texNum); + void ReserveTexCoord(u8 num); - private: - ut::Color mVtxColors[VERTEXCOLOR_MAX] ATTRIBUTE_ALIGN(4); // 0xD4 - detail::TexCoordAry mTexCoordAry; // 0xE4 + private: + ut::Color mVtxColors[VERTEXCOLOR_MAX] ATTRIBUTE_ALIGN(4); // 0xD4 + detail::TexCoordAry mTexCoordAry; // 0xE4 }; - } -} + } // namespace lyt +} // namespace nw4r -#endif // NW4R_LYT_PICTURE_H +#endif // NW4R_LYT_PICTURE_H diff --git a/libs/NW4R/include/nw4r/lyt/resourceAccessor.h b/libs/NW4R/include/nw4r/lyt/resourceAccessor.h index b16ff9a2..a774a58d 100644 --- a/libs/NW4R/include/nw4r/lyt/resourceAccessor.h +++ b/libs/NW4R/include/nw4r/lyt/resourceAccessor.h @@ -11,11 +11,11 @@ namespace nw4r { public: ResourceAccessor(); virtual ~ResourceAccessor(); - - virtual void* GetResource(u32 resType, const char* name, u32* pSize) = 0; - virtual ut::Font* GetFont(const char* name); - }; - } -} -#endif // NW4R_LYT_RESOURCE_ACCESSOR_H \ No newline at end of file + virtual void* GetResource(u32 resType, const char* name, u32* pSize) = 0; + virtual ut::Font* GetFont(const char* name); + }; + } // namespace lyt +} // namespace nw4r + +#endif // NW4R_LYT_RESOURCE_ACCESSOR_H diff --git a/libs/NW4R/include/nw4r/lyt/resources.h b/libs/NW4R/include/nw4r/lyt/resources.h index 0708bda6..c4c9ba42 100644 --- a/libs/NW4R/include/nw4r/lyt/resources.h +++ b/libs/NW4R/include/nw4r/lyt/resources.h @@ -1,8 +1,9 @@ #ifndef NW4R_LYT_RESOURCES_H #define NW4R_LYT_RESOURCES_H -#include #include +#include + #include @@ -26,55 +27,55 @@ namespace nw4r { } WindowFrameSize; class MaterialResourceNum { - public: - u8 GetTexMapNum() const { return detail::GetBits<>(bits, 0, 4); } - u8 GetTexSRTNum() const { return detail::GetBits<>(bits, 4, 4); } - u8 GetTexCoordGenNum() const { return detail::GetBits<>(bits, 8, 4); } + public: + u8 GetTexMapNum() const { return detail::GetBits<>(bits, 0, 4); } + u8 GetTexSRTNum() const { return detail::GetBits<>(bits, 4, 4); } + u8 GetTexCoordGenNum() const { return detail::GetBits<>(bits, 8, 4); } - bool HasTevSwapTable() const { return detail::TestBit<>(bits, 12); } + bool HasTevSwapTable() const { return detail::TestBit<>(bits, 12); } - u8 GetIndTexSRTNum() const { return detail::GetBits<>(bits, 13, 2); } - u8 GetIndTexStageNum() const { return detail::GetBits<>(bits, 15, 3); } + u8 GetIndTexSRTNum() const { return detail::GetBits<>(bits, 13, 2); } + u8 GetIndTexStageNum() const { return detail::GetBits<>(bits, 15, 3); } - u8 GetTevStageNum() const { return detail::GetBits<>(bits, 18, 5); } + u8 GetTevStageNum() const { return detail::GetBits<>(bits, 18, 5); } - bool HasAlphaCompare() const { return detail::TestBit<>(bits, 23); } - bool HasBlendMode() const { return detail::TestBit<>(bits, 24); } + bool HasAlphaCompare() const { return detail::TestBit<>(bits, 23); } + bool HasBlendMode() const { return detail::TestBit<>(bits, 24); } - u8 GetChanCtrlNum() const { return detail::GetBits<>(bits, 25, 1); } + u8 GetChanCtrlNum() const { return detail::GetBits<>(bits, 25, 1); } - u8 GetMatColNum() const { return detail::GetBits<>(bits, 27, 1); } + u8 GetMatColNum() const { return detail::GetBits<>(bits, 27, 1); } - private: - u32 bits; // 0x00 + private: + u32 bits; // 0x00 }; namespace res { /*** COMMON ***/ typedef struct BinaryFileHeader { - char signature[4]; // 0x00 - u16 byteOrder; // 0x04 + char signature[4]; // 0x00 + u16 byteOrder; // 0x04 - u16 version; // 0x06 + u16 version; // 0x06 - u32 fileSize; // 0x08 + u32 fileSize; // 0x08 - u16 headerSize; // 0x0C - u16 dataBlocks; // 0x0E + u16 headerSize; // 0x0C + u16 dataBlocks; // 0x0E } BinaryFileHeader; typedef struct DataBlockHeader { - char kind[4]; // 0x00 - u32 size; // 0x04 + char kind[4]; // 0x00 + u32 size; // 0x04 } DataBlockHeader; /*** ANIMATION ***/ typedef struct StepKey { - f32 frame; // 0x00 - u16 value; // 0x04 - u16 padding; // 0x06 + f32 frame; // 0x00 + u16 value; // 0x04 + u16 padding; // 0x06 } StepKey; typedef struct HermiteKey { @@ -84,127 +85,127 @@ namespace nw4r { } HermiteKey; typedef struct AnimationInfo { - public: - u32 kind; // 0x00 - u8 num; // 0x04 - u8 padding[3]; // 0x05 + public: + u32 kind; // 0x00 + u8 num; // 0x04 + u8 padding[3]; // 0x05 - public: - static const u32 ANIM_INFO_PANE_PAIN_SRT = 'RLPA'; - static const u32 ANIM_INFO_PANE_VERTEX_COLOR = 'RLVC'; - static const u32 ANIM_INFO_PANE_VISIBILITY = 'RLVI'; + public: + static const u32 ANIM_INFO_PANE_PAIN_SRT = 'RLPA'; + static const u32 ANIM_INFO_PANE_VERTEX_COLOR = 'RLVC'; + static const u32 ANIM_INFO_PANE_VISIBILITY = 'RLVI'; - static const u32 ANIM_INFO_MATERIAL_COLOR = 'RLMC'; - static const u32 ANIM_INFO_MATERIAL_TEXTURE_PATTERN = 'RLTP'; - static const u32 ANIM_INFO_MATERIAL_TEXTURE_SRT = 'RLTS'; - static const u32 ANIM_INFO_MATERIAL_IND_TEX_SRT = 'RLIM'; + static const u32 ANIM_INFO_MATERIAL_COLOR = 'RLMC'; + static const u32 ANIM_INFO_MATERIAL_TEXTURE_PATTERN = 'RLTP'; + static const u32 ANIM_INFO_MATERIAL_TEXTURE_SRT = 'RLTS'; + static const u32 ANIM_INFO_MATERIAL_IND_TEX_SRT = 'RLIM'; } AnimationInfo; typedef struct AnimationTarget { - u8 id; // 0x00 - u8 target; // 0x01 - u8 curveType; // 0x02 - u8 padding1; // 0x03 + u8 id; // 0x00 + u8 target; // 0x01 + u8 curveType; // 0x02 + u8 padding1; // 0x03 - u16 keyNum; // 0x04 - u8 padding2[2]; // 0x06 - u32 keysOffset; // 0x08 + u16 keyNum; // 0x04 + u8 padding2[2]; // 0x06 + u32 keysOffset; // 0x08 } AnimationTarget; typedef struct AnimationBlock { - DataBlockHeader blockHeader; // 0x00 - u16 frameSize; // 0x08 - u8 loop; // 0x0A + DataBlockHeader blockHeader; // 0x00 + u16 frameSize; // 0x08 + u8 loop; // 0x0A - u8 padding1; - u16 fileNum; // 0x0C + u8 padding1; + u16 fileNum; // 0x0C - u16 animContNum; // 0x0E - u32 animContOffsetsOffset; // 0x10 + u16 animContNum; // 0x0E + u32 animContOffsetsOffset; // 0x10 } AnimationBlock; typedef struct AnimationContent { - public: - enum { - ANIMTYPE_PANE = 0, - ANIMTYPE_MATERIAL, + public: + enum { + ANIMTYPE_PANE = 0, + ANIMTYPE_MATERIAL, - ANIMTYPE_MAX - }; + ANIMTYPE_MAX + }; - public: - char name[20]; // 0x00 - u8 num; // 0x14 - u8 type; // 0x15 - u8 padding[2]; // 0x16 + public: + char name[20]; // 0x00 + u8 num; // 0x14 + u8 type; // 0x15 + u8 padding[2]; // 0x16 } AnimationContent; /*** MATERIAL ***/ typedef struct Texture { u32 nameStrOffset; // 0x00 - u8 type; // 0x04 - u8 padding[3]; + u8 type; // 0x04 + u8 padding[3]; } Texture; typedef struct Material { - char name[20]; // 0x00 + char name[20]; // 0x00 - GXColorS10 tevCols[TEVCOLOR_MAX]; // 0x14 - GXColor tevKCols[GX_MAX_KCOLOR]; // 0x2C + GXColorS10 tevCols[TEVCOLOR_MAX]; // 0x14 + GXColor tevKCols[GX_MAX_KCOLOR]; // 0x2C - MaterialResourceNum resNum; // 0x3C + MaterialResourceNum resNum; // 0x3C } Material; typedef struct TexMap { - u16 texIdx; // 0x00 - u8 wrapS; // 0x02 - u8 wrapT; // 0x03 + u16 texIdx; // 0x00 + u8 wrapS; // 0x02 + u8 wrapT; // 0x03 } TexMap; /*** PANES ***/ - static const u32 FILE_HEADER_SIGNATURE_ANIMATION = 'RLAN'; // 0x524C414E - static const u32 FILE_HEADER_SIGNATURE_LAYOUT = 'RLYT'; // 0x524C5954 + static const u32 FILE_HEADER_SIGNATURE_ANIMATION = 'RLAN'; // 0x524C414E + static const u32 FILE_HEADER_SIGNATURE_LAYOUT = 'RLYT'; // 0x524C5954 - static const u32 OBJECT_SIGNATURE_LAYOUT = 'lyt1'; // 0x6C797431 - static const u32 OBJECT_SIGNATURE_FONT_LIST = 'fnl1'; // 0x666E6C31 - static const u32 OBJECT_SIGNATURE_MATERIAL_LIST = 'mat1'; // 0x6D617431 - static const u32 OBJECT_SIGNATURE_TEXTURE_LIST = 'txl1'; // 0x74786C31 + static const u32 OBJECT_SIGNATURE_LAYOUT = 'lyt1'; // 0x6C797431 + static const u32 OBJECT_SIGNATURE_FONT_LIST = 'fnl1'; // 0x666E6C31 + static const u32 OBJECT_SIGNATURE_MATERIAL_LIST = 'mat1'; // 0x6D617431 + static const u32 OBJECT_SIGNATURE_TEXTURE_LIST = 'txl1'; // 0x74786C31 - static const u32 OBJECT_SIGNATURE_PANE = 'pan1'; // 0x70696331 - static const u32 OBJECT_SIGNATURE_PANE_CHILD_START = 'pas1'; // 0x70697331 - static const u32 OBJECT_SIGNATURE_PANE_CHILD_END = 'pae1'; // 0x70696531 + static const u32 OBJECT_SIGNATURE_PANE = 'pan1'; // 0x70696331 + static const u32 OBJECT_SIGNATURE_PANE_CHILD_START = 'pas1'; // 0x70697331 + static const u32 OBJECT_SIGNATURE_PANE_CHILD_END = 'pae1'; // 0x70696531 - static const u32 OBJECT_SIGNATURE_PICTURE = 'pic1'; // 0x70696331 - static const u32 OBJECT_SIGNATURE_BOUNDING = 'bnd1'; // 0x626E6431 - static const u32 OBJECT_SIGNATURE_WINDOW = 'wnd1'; // 0x776E6431 - static const u32 OBJECT_SIGNATURE_TEXT_BOX = 'txt1'; // 0x74787431 - - static const u32 OBJECT_SIGNATURE_GROUP = 'grp1'; // 0x67727031 - static const u32 OBJECT_SIGNATURE_GROUP_CHILD_START = 'grs1'; // 0x67727331 - static const u32 OBJECT_SIGNATURE_GROUP_CHILD_END = 'gre1'; // 0x67726531 + static const u32 OBJECT_SIGNATURE_PICTURE = 'pic1'; // 0x70696331 + static const u32 OBJECT_SIGNATURE_BOUNDING = 'bnd1'; // 0x626E6431 + static const u32 OBJECT_SIGNATURE_WINDOW = 'wnd1'; // 0x776E6431 + static const u32 OBJECT_SIGNATURE_TEXT_BOX = 'txt1'; // 0x74787431 - static const u32 OBJECT_SIGNATURE_PANE_ANIM = 'pai1'; // 0x70616931 (Either "PAne anImation" or... "PAIn") + static const u32 OBJECT_SIGNATURE_GROUP = 'grp1'; // 0x67727031 + static const u32 OBJECT_SIGNATURE_GROUP_CHILD_START = 'grs1'; // 0x67727331 + static const u32 OBJECT_SIGNATURE_GROUP_CHILD_END = 'gre1'; // 0x67726531 + + static const u32 OBJECT_SIGNATURE_PANE_ANIM = 'pai1'; // 0x70616931 (Either "PAne anImation" or... "PAIn") typedef struct Pane { - DataBlockHeader blockHeader; // 0x00 + DataBlockHeader blockHeader; // 0x00 - u8 flag; // 0x08 - u8 basePosition; // 0x09 + u8 flag; // 0x08 + u8 basePosition; // 0x09 - u8 alpha; // 0x0A + u8 alpha; // 0x0A - u8 padding; // 0x0B + u8 padding; // 0x0B - char name[16]; // 0x0c - char userData[8]; // 0x1c + char name[16]; // 0x0c + char userData[8]; // 0x1c - math::VEC3 translate; // 0x24 - math::VEC3 rotate; // 0x30 - math::VEC2 scale; // 0x3c + math::VEC3 translate; // 0x24 + math::VEC3 rotate; // 0x30 + math::VEC2 scale; // 0x3c - Size size; // 0x44 + Size size; // 0x44 } Pane; typedef struct Bounding : Pane { @@ -212,115 +213,115 @@ namespace nw4r { } Bounding; typedef struct Picture : public Pane { - u32 vtxCols[4]; // 0x4C + u32 vtxCols[4]; // 0x4C - u16 materialIdx; // 0x5C + u16 materialIdx; // 0x5C - u8 texCoordNum; // 0x5E + u8 texCoordNum; // 0x5E - u8 padding[1]; // 0x5F + u8 padding[1]; // 0x5F } Picture; typedef struct Font { u32 nameStrOffset; // 0x00 - u8 type; // 0x04 - u8 padding[3]; + u8 type; // 0x04 + u8 padding[3]; } Font; typedef struct TextBox : public Pane { - u16 textBufBytes; // 0x4C - u16 textStrBytes; // 0x4E + u16 textBufBytes; // 0x4C + u16 textStrBytes; // 0x4E - u16 materialIdx; // 0x50 + u16 materialIdx; // 0x50 - u16 fontIdx; // 0x52 - u8 textPosition; // 0x54 + u16 fontIdx; // 0x52 + u8 textPosition; // 0x54 - u8 padding[3]; + u8 padding[3]; - u32 textStrOffset; // 0x58 - u32 textCols[TEXTCOLOR_MAX]; // 0x5C + u32 textStrOffset; // 0x58 + u32 textCols[TEXTCOLOR_MAX]; // 0x5C - Size fontSize; // 0x64 - f32 charSpace; // 0x6C - f32 lineSpace; // 0x70 + Size fontSize; // 0x64 + f32 charSpace; // 0x6C + f32 lineSpace; // 0x70 } TextBox; typedef struct WindowFrame { - u16 materialIdx; // 0x00 - u8 textureFlip; // 0x02 - u8 padding1; // 0x03 + u16 materialIdx; // 0x00 + u8 textureFlip; // 0x02 + u8 padding1; // 0x03 } WindowFrame; typedef struct WindowContent { - u32 vtxCols[VERTEXCOLOR_MAX]; // 0x00 - u16 materialIdx; // 0x10 - u8 texCoordNum; // 0x12 + u32 vtxCols[VERTEXCOLOR_MAX]; // 0x00 + u16 materialIdx; // 0x10 + u8 texCoordNum; // 0x12 - u8 padding[1]; // 0x13 + u8 padding[1]; // 0x13 } WindowContent; typedef struct Window : public Pane { - InflationLRTB inflation; // 0x4C - u8 frameNum; // 0x5C + InflationLRTB inflation; // 0x4C + u8 frameNum; // 0x5C - u8 padding1; // 0x5D - u8 padding2; // 0x5E - u8 padding3; // 0x5F + u8 padding1; // 0x5D + u8 padding2; // 0x5E + u8 padding3; // 0x5F - u32 contentOffset; // 0x60 - u32 frameOffsetTableOffset; // 0x64 + u32 contentOffset; // 0x60 + u32 frameOffsetTableOffset; // 0x64 } Window; /*** GROUP ***/ typedef struct Group { - DataBlockHeader blockHeader; // 0x00 - char name[16]; // 0x08 - u16 paneNum; // 0x18 - u8 padding[2]; // 0x19 + DataBlockHeader blockHeader; // 0x00 + char name[16]; // 0x08 + u16 paneNum; // 0x18 + u8 padding[2]; // 0x19 } Group; /*** LAYOUT ***/ typedef struct Layout { - DataBlockHeader blockHeader; // 0x00 - u8 originType; // 0x08 + DataBlockHeader blockHeader; // 0x00 + u8 originType; // 0x08 - u8 padding[3]; // 0x09 + u8 padding[3]; // 0x09 - Size layoutSize; // 0x0c + Size layoutSize; // 0x0c } Layout; - } + } // namespace res namespace res { typedef struct TextureList { - DataBlockHeader blockHeader; // 0x00 - u16 texNum; // 0x08 - u8 padding[2]; + DataBlockHeader blockHeader; // 0x00 + u16 texNum; // 0x08 + u8 padding[2]; } TextureList; typedef struct FontList { - DataBlockHeader blockHeader; // 0x00 - u16 fontNum; // 0x08 - u8 padding[2]; + DataBlockHeader blockHeader; // 0x00 + u16 fontNum; // 0x08 + u8 padding[2]; } FontList; typedef struct MaterialList { - DataBlockHeader blockHeader; // 0x00 - u16 materialNum; // 0x08 - u8 padding[2]; + DataBlockHeader blockHeader; // 0x00 + u16 materialNum; // 0x08 + u8 padding[2]; } MaterialList; - } + } // namespace res typedef struct ResBlockSet { - const res::TextureList* pTextureList; // 0x00 - const res::FontList* pFontList; // 0x04 - const res::MaterialList* pMaterialList; // 0x08 + const res::TextureList* pTextureList; // 0x00 + const res::FontList* pFontList; // 0x04 + const res::MaterialList* pMaterialList; // 0x08 - ResourceAccessor* pResAccessor; // 0x0c + ResourceAccessor* pResAccessor; // 0x0c } ResBlockSet; - } -} + } // namespace lyt +} // namespace nw4r -#endif // NW4R_LYT_RESOURCES_H +#endif // NW4R_LYT_RESOURCES_H diff --git a/libs/NW4R/include/nw4r/lyt/textBox.h b/libs/NW4R/include/nw4r/lyt/textBox.h index 772acebe..5153d0e6 100644 --- a/libs/NW4R/include/nw4r/lyt/textBox.h +++ b/libs/NW4R/include/nw4r/lyt/textBox.h @@ -1,85 +1,92 @@ #ifndef NW4R_LYT_TEXTBOX_H #define NW4R_LYT_TEXTBOX_H -#include #include +#include + #include namespace nw4r { namespace lyt { class TextBox : public Pane { - public: - NW4R_UT_RUNTIME_TYPEINFO; + public: + NW4R_UT_RUNTIME_TYPEINFO; - TextBox(u16 allocStrLen, const wchar_t* str, const ut::Font* pFont); - TextBox(const res::TextBox* pBlock, const ResBlockSet& resBlockSet); + TextBox(u16 allocStrLen, const wchar_t* str, const ut::Font* pFont); + TextBox(const res::TextBox* pBlock, const ResBlockSet& resBlockSet); - virtual ~TextBox(); + virtual ~TextBox(); - virtual void DrawSelf(const DrawInfo& drawInfo); + virtual void DrawSelf(const DrawInfo& drawInfo); - virtual ut::Color GetVtxColor(u32 idx) const; - virtual void SetVtxColor(u32 idx, ut::Color value); + virtual ut::Color GetVtxColor(u32 idx) const; + virtual void SetVtxColor(u32 idx, ut::Color value); - virtual u8 GetVtxColorElement(u32 idx) const; - virtual void SetVtxColorElement(u32 idx, u8 value); + virtual u8 GetVtxColorElement(u32 idx) const; + virtual void SetVtxColorElement(u32 idx, u8 value); - virtual void AllocStringBuffer(u16 size); // 0x64 - virtual void FreeStringBuffer(); // 0x68 + virtual void AllocStringBuffer(u16 size); // 0x64 + virtual void FreeStringBuffer(); // 0x68 - virtual u16 SetString(const wchar_t* str, u16 dstIdx = 0); // 0x6C - virtual u16 SetString(const wchar_t* str, u16 dstIdx, u16 strLen); // 0x70 - const wchar_t* GetString() const { return mTextBuf; } - - const Size& GetFontSize() const { return mFontSize;} + virtual u16 SetString(const wchar_t* str, u16 dstIdx = 0); // 0x6C + virtual u16 SetString(const wchar_t* str, u16 dstIdx, u16 strLen); // 0x70 + const wchar_t* GetString() const { return mTextBuf; } - void SetFontSize(const Size& fontSize) { mFontSize = fontSize; } - void SetTagProcessor(ut::WideTagProcessor* pTagProcessor) { mpTagProcessor = pTagProcessor; } + const Size& GetFontSize() const { return mFontSize; } - u16 GetStringBufferLength() const; + void SetFontSize(const Size& fontSize) { mFontSize = fontSize; } + void SetTagProcessor(ut::WideTagProcessor* pTagProcessor) { mpTagProcessor = pTagProcessor; } - f32 GetTextMagH() const; - f32 GetTextMagV() const; + u16 GetStringBufferLength() const; - u8 GetTextPositionH() const { return detail::GetHorizontalPosition(mTextPosition); } - u8 GetTextPositionV() const { return detail::GetVerticalPosition(mTextPosition); } + f32 GetTextMagH() const; + f32 GetTextMagV() const; - const ut::Color GetTextColor(u32 type) const { NW4R_ASSERT(type < TEXTCOLOR_MAX); return mTextColors[type]; } - void SetTextColor(u32 type, ut::Color value) { NW4R_ASSERT(type < TEXTCOLOR_MAX); mTextColors[type] = value; } + u8 GetTextPositionH() const { return detail::GetHorizontalPosition(mTextPosition); } + u8 GetTextPositionV() const { return detail::GetVerticalPosition(mTextPosition); } - void SetTextPositionH(u8 pos) { detail::SetHorizontalPosition(&mTextPosition, pos); } - void SetTextPositionV(u8 pos) { detail::SetVerticalPosition(&mTextPosition, pos); } + const ut::Color GetTextColor(u32 type) const { + NW4R_ASSERT(type < TEXTCOLOR_MAX); + return mTextColors[type]; + } + void SetTextColor(u32 type, ut::Color value) { + NW4R_ASSERT(type < TEXTCOLOR_MAX); + mTextColors[type] = value; + } - const ut::Font* GetFont() const; - void SetFont(const ut::Font* pFont); + void SetTextPositionH(u8 pos) { detail::SetHorizontalPosition(&mTextPosition, pos); } + void SetTextPositionV(u8 pos) { detail::SetVerticalPosition(&mTextPosition, pos); } - void Init(u16 allocStrLen); + const ut::Font* GetFont() const; + void SetFont(const ut::Font* pFont); - const ut::Rect GetTextDrawRect(const DrawInfo& drawInfo) const; - const ut::Rect GetTextDrawRect(ut::WideTextWriter* pWriter) const; + void Init(u16 allocStrLen); - private: - wchar_t* mTextBuf; // 0xD4 - ut::Color mTextColors[TEXTCOLOR_MAX]; // 0xD8 + const ut::Rect GetTextDrawRect(const DrawInfo& drawInfo) const; + const ut::Rect GetTextDrawRect(ut::WideTextWriter* pWriter) const; - const ut::Font* mpFont; // 0xE0 - Size mFontSize; // 0xE4 + private: + wchar_t* mTextBuf; // 0xD4 + ut::Color mTextColors[TEXTCOLOR_MAX]; // 0xD8 - f32 mLineSpace; // 0xEC - f32 mCharSpace; // 0xF0 + const ut::Font* mpFont; // 0xE0 + Size mFontSize; // 0xE4 - ut::WideTagProcessor* mpTagProcessor; // 0xF4 + f32 mLineSpace; // 0xEC + f32 mCharSpace; // 0xF0 - u16 mTextBufBytes; // 0xF8 - u16 mTextLen; // 0xFA - u8 mTextPosition; // 0xFC - - struct { - u8 allocFont : 1; - } mTextBoxFlag; // 0xFD + ut::WideTagProcessor* mpTagProcessor; // 0xF4 + + u16 mTextBufBytes; // 0xF8 + u16 mTextLen; // 0xFA + u8 mTextPosition; // 0xFC + + struct { + u8 allocFont : 1; + } mTextBoxFlag; // 0xFD }; - } -} + } // namespace lyt +} // namespace nw4r -#endif // NW4R_LYT_TEXTBOX_H +#endif // NW4R_LYT_TEXTBOX_H diff --git a/libs/NW4R/include/nw4r/lyt/types.h b/libs/NW4R/include/nw4r/lyt/types.h index bc20bb9f..009102ad 100644 --- a/libs/NW4R/include/nw4r/lyt/types.h +++ b/libs/NW4R/include/nw4r/lyt/types.h @@ -10,11 +10,12 @@ namespace nw4r { namespace lyt { - static const u32 RESOURCE_TYPE_ANIMATION = 'anim'; - static const u32 RESOURCE_TYPE_LAYOUT = 'blyt'; - static const u32 RESOURCE_TYPE_FONT = 'font'; - static const u32 RESOURCE_TYPE_TEXTURE = 'timg'; + static const u32 RESOURCE_TYPE_ANIMATION = 'anim'; + static const u32 RESOURCE_TYPE_LAYOUT = 'blyt'; + static const u32 RESOURCE_TYPE_FONT = 'font'; + static const u32 RESOURCE_TYPE_TEXTURE = 'timg'; + // clang-format off enum { VERTEXCOLOR_LT = 0, VERTEXCOLOR_RT, @@ -90,343 +91,328 @@ namespace nw4r { FLIPINDEX_MAX }; + // clang-format on namespace detail { - template const T* ConvertOffsToPtr(const void* baseAddress, unsigned offset) { + template + const T* ConvertOffsToPtr(const void* baseAddress, unsigned offset) { return reinterpret_cast(reinterpret_cast(baseAddress) + offset); } - template T* ConvertOffsToPtr(void* baseAddress, unsigned offset) { + template + T* ConvertOffsToPtr(void* baseAddress, unsigned offset) { return reinterpret_cast(reinterpret_cast(baseAddress) + offset); } - template inline void SetBit(T* pBits, int pos, bool value) { + template + inline void SetBit(T* pBits, int pos, bool value) { T mask = ~(1 << pos); *pBits &= mask; *pBits |= (value ? 1 : 0) << pos; } - template inline bool TestBit(T bits, int pos) { + template + inline bool TestBit(T bits, int pos) { T mask = 1 << pos; return (bits & mask) != 0; } - template inline T GetBits(T bits, int pos, int len) { + template + inline T GetBits(T bits, int pos, int len) { T mask = ~(static_cast(-1) << len); return bits >> pos & mask; } - } - + } // namespace detail + typedef struct Size { Size() : width(), height() {} - + Size(f32 aWidth, f32 aHeight) : width(aWidth), height(aHeight) {} Size(const Size& other) : width(other.width), height(other.height) {} - friend bool operator==(const Size& a, const Size& b) { - return a.width == b.width && a.height == b.height; - } + friend bool operator==(const Size& a, const Size& b) { return a.width == b.width && a.height == b.height; } - f32 width; // 0x00 - f32 height; // 0x04 + f32 width; // 0x00 + f32 height; // 0x04 } Size; typedef struct TexSRT { - math::VEC2 translate; // 0x00 - f32 rotate; // 0x08 - math::VEC2 scale; // 0x0c + math::VEC2 translate; // 0x00 + f32 rotate; // 0x08 + math::VEC2 scale; // 0x0c } TexSRT; class TexCoordGen { - public: - TexCoordGen() : - reserve(0) { - Set(GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); - } + public: + TexCoordGen() : reserve(0) { Set(GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); } - u32 GetTexMtx() const { return texMtx; } + u32 GetTexMtx() const { return texMtx; } - GXTexGenType GetTexGenType() const { return static_cast(texGenType); } - GXTexGenSrc GetTexGenSrc() const { return static_cast(texGenSrc); } + GXTexGenType GetTexGenType() const { return static_cast(texGenType); } + GXTexGenSrc GetTexGenSrc() const { return static_cast(texGenSrc); } - void Set(GXTexGenType aTexGenType, GXTexGenSrc aTexGenSrc, u32 aTexMtx) { - texGenType = aTexGenType; - texGenSrc = aTexGenSrc; - texMtx = aTexMtx; - } + void Set(GXTexGenType aTexGenType, GXTexGenSrc aTexGenSrc, u32 aTexMtx) { + texGenType = aTexGenType; + texGenSrc = aTexGenSrc; + texMtx = aTexMtx; + } - private: - u8 texGenType; // 0x00 - u8 texGenSrc; // 0x01 - u8 texMtx; // 0x02 - u8 reserve; // 0x03 + private: + u8 texGenType; // 0x00 + u8 texGenSrc; // 0x01 + u8 texMtx; // 0x02 + u8 reserve; // 0x03 }; class IndirectStage { - public: - IndirectStage() { - Set(GX_TEXCOORD0, GX_TEXMAP0, GX_ITS_1, GX_ITS_1); - } + public: + IndirectStage() { Set(GX_TEXCOORD0, GX_TEXMAP0, GX_ITS_1, GX_ITS_1); } - GXTexCoordID GetTexCoordGen() const { return static_cast(texCoordGen); } + GXTexCoordID GetTexCoordGen() const { return static_cast(texCoordGen); } - GXTexMapID GetTexMap() const { return static_cast(texMap); } + GXTexMapID GetTexMap() const { return static_cast(texMap); } - GXIndTexScale GetScaleS() const { return static_cast(scaleS); } - GXIndTexScale GetScaleT() const { return static_cast(scaleT); } + GXIndTexScale GetScaleS() const { return static_cast(scaleS); } + GXIndTexScale GetScaleT() const { return static_cast(scaleT); } - void Set(GXTexCoordID aTexCoordGen, GXTexMapID aTexMap, GXIndTexScale aScaleS, GXIndTexScale aScaleT) { - texCoordGen = aTexCoordGen; + void Set(GXTexCoordID aTexCoordGen, GXTexMapID aTexMap, GXIndTexScale aScaleS, GXIndTexScale aScaleT) { + texCoordGen = aTexCoordGen; - texMap = aTexMap; - scaleS = aScaleS; - scaleT = aScaleT; - } + texMap = aTexMap; + scaleS = aScaleS; + scaleT = aScaleT; + } - private: - u8 texCoordGen; // 0x00 - u8 texMap; // 0x01 - u8 scaleS; // 0x02 - u8 scaleT; // 0x03 + private: + u8 texCoordGen; // 0x00 + u8 texMap; // 0x01 + u8 scaleS; // 0x02 + u8 scaleT; // 0x03 }; class TevSwapMode { - public: - GXTevColorChan GetR() const { return static_cast((swap) & 0x03); } - GXTevColorChan GetG() const { return static_cast((swap >> 2) & 0x03); } - GXTevColorChan GetB() const { return static_cast((swap >> 4) & 0x03); } - GXTevColorChan GetA() const { return static_cast((swap >> 6) & 0x03); } + public: + GXTevColorChan GetR() const { return static_cast((swap) & 0x03); } + GXTevColorChan GetG() const { return static_cast((swap >> 2) & 0x03); } + GXTevColorChan GetB() const { return static_cast((swap >> 4) & 0x03); } + GXTevColorChan GetA() const { return static_cast((swap >> 6) & 0x03); } - void Set(GXTevColorChan r, GXTevColorChan g, GXTevColorChan b, GXTevColorChan a) { - swap = r | g << 2 | b << 4 | a << 6; - } + void Set(GXTevColorChan r, GXTevColorChan g, GXTevColorChan b, GXTevColorChan a) { swap = r | g << 2 | b << 4 | a << 6; } - private: - u8 swap; // 0x00 + private: + u8 swap; // 0x00 }; class TevStageInOp { - public: + public: + u8 GetA() const { return ab & 0x0F; } + u8 GetB() const { return (ab >> 4) & 0x0F; } + u8 GetC() const { return cd & 0x0F; } + u8 GetD() const { return (cd >> 4) & 0x0F; } - u8 GetA() const { return ab & 0x0F; } - u8 GetB() const { return (ab >> 4) & 0x0F; } - u8 GetC() const { return cd & 0x0F; } - u8 GetD() const { return (cd >> 4) & 0x0F; } + u8 GetScale() const { return (op >> 6) & 0x03; } + u8 GetBias() const { return (op >> 4) & 0x03; } + u8 GetOp() const { return op & 0x0F; } - u8 GetScale() const { return (op >> 6) & 0x03; } - u8 GetBias() const { return (op >> 4) & 0x03; } - u8 GetOp() const { return op & 0x0F; } + u8 GetKSel() const { return (cl >> 3) & 0x1F; } + u8 GetOutReg() const { return (cl >> 1) & 0x03; } + bool IsClamp() const { return static_cast(cl & 0x01); } - u8 GetKSel() const { return (cl >> 3) & 0x1F; } - u8 GetOutReg() const { return (cl >> 1) & 0x03; } - bool IsClamp() const { return static_cast(cl & 0x01); } + void SetIn(u8 a, u8 b, u8 c, u8 d) { + ab = a | b << 4; + cd = c | d << 4; + } - void SetIn(u8 a, u8 b, u8 c, u8 d) { - ab = a | b << 4; - cd = c | d << 4; - } + void SetOp(u8 aOp, u8 bias, u8 scale, bool clamp, u8 outReg, u8 kSel) { + op = aOp | bias << 4 | scale << 6; + cl = (clamp ? 1 : 0) | outReg << 1 | kSel << 3; + } - void SetOp(u8 aOp, u8 bias, u8 scale, bool clamp, u8 outReg, u8 kSel) { - op = aOp | bias << 4 | scale << 6; - cl = (clamp ? 1 : 0) | outReg << 1 | kSel << 3; - } - - private: - u8 ab; // 0x00 - u8 cd; // 0x01 - u8 op; // 0x02 - u8 cl; // 0x03 + private: + u8 ab; // 0x00 + u8 cd; // 0x01 + u8 op; // 0x02 + u8 cl; // 0x03 }; class TevStage { - public: - TevStage() { - SetOrder(GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0, GX_TEV_SWAP0, GX_TEV_SWAP0); - SetColorIn(GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_RASC); - SetAlphaIn(GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_RASA); - SetColorOp(GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV, GX_TEV_KCSEL_K0); - SetAlphaOp(GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV, GX_TEV_KASEL_K0_R); - SetIndirect(GX_INDTEXSTAGE0, GX_ITF_8, GX_ITB_NONE, GX_ITM_OFF, GX_ITW_OFF, GX_ITW_OFF, false, false, GX_ITBA_OFF); - } + public: + TevStage() { + SetOrder(GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0, GX_TEV_SWAP0, GX_TEV_SWAP0); + SetColorIn(GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_RASC); + SetAlphaIn(GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_RASA); + SetColorOp(GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV, GX_TEV_KCSEL_K0); + SetAlphaOp(GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV, GX_TEV_KASEL_K0_R); + SetIndirect(GX_INDTEXSTAGE0, GX_ITF_8, GX_ITB_NONE, GX_ITM_OFF, GX_ITW_OFF, GX_ITW_OFF, false, false, GX_ITBA_OFF); + } - GXTexCoordID GetTexCoordGen() const { return static_cast(texCoordGen); } - GXChannelID GetColorChan() const { return static_cast(colChan); } + GXTexCoordID GetTexCoordGen() const { return static_cast(texCoordGen); } + GXChannelID GetColorChan() const { return static_cast(colChan); } - GXTexMapID GetTexMap() const { return static_cast((swapSel & 1) << 8 | texMap); } + GXTexMapID GetTexMap() const { return static_cast((swapSel & 1) << 8 | texMap); } - GXTevSwapSel GetTexSwapSel() const { return static_cast((swapSel >> 3) & 0x03); } - GXTevSwapSel GetRasSwapSel() const { return static_cast((swapSel >> 1) & 0x03); } + GXTevSwapSel GetTexSwapSel() const { return static_cast((swapSel >> 3) & 0x03); } + GXTevSwapSel GetRasSwapSel() const { return static_cast((swapSel >> 1) & 0x03); } - GXTevColorArg GetColorInA() const { return static_cast(colIn.GetA()); } - GXTevColorArg GetColorInB() const { return static_cast(colIn.GetB()); } - GXTevColorArg GetColorInC() const { return static_cast(colIn.GetC()); } - GXTevColorArg GetColorInD() const { return static_cast(colIn.GetD()); } + GXTevColorArg GetColorInA() const { return static_cast(colIn.GetA()); } + GXTevColorArg GetColorInB() const { return static_cast(colIn.GetB()); } + GXTevColorArg GetColorInC() const { return static_cast(colIn.GetC()); } + GXTevColorArg GetColorInD() const { return static_cast(colIn.GetD()); } - GXTevOp GetColorOp() const { return static_cast(colIn.GetOp()); } - GXTevBias GetColorBias() const { return static_cast(colIn.GetBias()); } - GXTevScale GetColorScale() const { return static_cast(colIn.GetScale()); } + GXTevOp GetColorOp() const { return static_cast(colIn.GetOp()); } + GXTevBias GetColorBias() const { return static_cast(colIn.GetBias()); } + GXTevScale GetColorScale() const { return static_cast(colIn.GetScale()); } - bool IsColorClamp() const { return colIn.IsClamp(); } + bool IsColorClamp() const { return colIn.IsClamp(); } - GXTevRegID GetColorOutReg() const { return static_cast(colIn.GetOutReg()); } + GXTevRegID GetColorOutReg() const { return static_cast(colIn.GetOutReg()); } - GXTevKColorSel GetKColorSel() const { return static_cast(colIn.GetKSel()); } + GXTevKColorSel GetKColorSel() const { return static_cast(colIn.GetKSel()); } - GXTevAlphaArg GetAlphaInA() const { return static_cast(alpIn.GetA()); } - GXTevAlphaArg GetAlphaInB() const { return static_cast(alpIn.GetB()); } - GXTevAlphaArg GetAlphaInC() const { return static_cast(alpIn.GetC()); } - GXTevAlphaArg GetAlphaInD() const { return static_cast(alpIn.GetD()); } + GXTevAlphaArg GetAlphaInA() const { return static_cast(alpIn.GetA()); } + GXTevAlphaArg GetAlphaInB() const { return static_cast(alpIn.GetB()); } + GXTevAlphaArg GetAlphaInC() const { return static_cast(alpIn.GetC()); } + GXTevAlphaArg GetAlphaInD() const { return static_cast(alpIn.GetD()); } - GXTevOp GetAlphaOp() const { return static_cast(alpIn.GetOp()); } - GXTevBias GetAlphaBias() const { return static_cast(alpIn.GetBias()); } - GXTevScale GetAlphaScale() const { return static_cast(alpIn.GetScale()); } + GXTevOp GetAlphaOp() const { return static_cast(alpIn.GetOp()); } + GXTevBias GetAlphaBias() const { return static_cast(alpIn.GetBias()); } + GXTevScale GetAlphaScale() const { return static_cast(alpIn.GetScale()); } - bool IsAlphaClamp() const { return alpIn.IsClamp(); } + bool IsAlphaClamp() const { return alpIn.IsClamp(); } - GXTevRegID GetAlphaOutReg() const { return static_cast(alpIn.GetOutReg()); } + GXTevRegID GetAlphaOutReg() const { return static_cast(alpIn.GetOutReg()); } - GXTevKAlphaSel GetKAlphaSel() const { return static_cast(alpIn.GetKSel()); } + GXTevKAlphaSel GetKAlphaSel() const { return static_cast(alpIn.GetKSel()); } - GXIndTexStageID GetIndStage() const { return static_cast(indStage); } - GXIndTexMtxID GetIndMtxSel() const { return static_cast((indBiMt >> 3) & 0x0F); } - GXIndTexBiasSel GetIndBiasSel() const { return static_cast(indBiMt & 0x07); } + GXIndTexStageID GetIndStage() const { return static_cast(indStage); } + GXIndTexMtxID GetIndMtxSel() const { return static_cast((indBiMt >> 3) & 0x0F); } + GXIndTexBiasSel GetIndBiasSel() const { return static_cast(indBiMt & 0x07); } - GXIndTexWrap GetIndWrapS() const { return static_cast(indWrap & 0x07); } - GXIndTexWrap GetIndWrapT() const { return static_cast((indWrap >> 3) & 0x07); } + GXIndTexWrap GetIndWrapS() const { return static_cast(indWrap & 0x07); } + GXIndTexWrap GetIndWrapT() const { return static_cast((indWrap >> 3) & 0x07); } - GXIndTexAlphaSel GetIndAlphaSel() const { return static_cast((indFoAdUtAl >> 4) & 0x03); } + GXIndTexAlphaSel GetIndAlphaSel() const { return static_cast((indFoAdUtAl >> 4) & 0x03); } - bool IsIndUtcLod() const { return static_cast((indFoAdUtAl >> 3) & 0x01); } - bool IsIndAddPrev() const { return static_cast((indFoAdUtAl >> 2) & 0x01); } + bool IsIndUtcLod() const { return static_cast((indFoAdUtAl >> 3) & 0x01); } + bool IsIndAddPrev() const { return static_cast((indFoAdUtAl >> 2) & 0x01); } - GXIndTexFormat GetIndFormat() const { return static_cast(indFoAdUtAl & 0x03); } + GXIndTexFormat GetIndFormat() const { return static_cast(indFoAdUtAl & 0x03); } - void SetOrder(GXTexCoordID aTexCoordGen, GXTexMapID aTexMap, GXChannelID aColChan, GXTevSwapSel rasSel, GXTevSwapSel texSel) { - texCoordGen = aTexCoordGen; - colChan = aColChan; - texMap = aTexMap; - swapSel = aTexMap >> 8 | rasSel << 1 | texSel << 3; - } + void SetOrder(GXTexCoordID aTexCoordGen, GXTexMapID aTexMap, GXChannelID aColChan, GXTevSwapSel rasSel, GXTevSwapSel texSel) { + texCoordGen = aTexCoordGen; + colChan = aColChan; + texMap = aTexMap; + swapSel = aTexMap >> 8 | rasSel << 1 | texSel << 3; + } - void SetColorIn(GXTevColorArg a, GXTevColorArg b, GXTevColorArg c, GXTevColorArg d) { - colIn.SetIn(a, b, c, d); - } + void SetColorIn(GXTevColorArg a, GXTevColorArg b, GXTevColorArg c, GXTevColorArg d) { colIn.SetIn(a, b, c, d); } - void SetColorOp(GXTevOp op, GXTevBias bias, GXTevScale scale, bool clamp, GXTevRegID outReg, GXTevKColorSel kSel) { - colIn.SetOp(op, bias, scale, clamp, outReg, kSel); - } + void SetColorOp(GXTevOp op, GXTevBias bias, GXTevScale scale, bool clamp, GXTevRegID outReg, GXTevKColorSel kSel) { + colIn.SetOp(op, bias, scale, clamp, outReg, kSel); + } - void SetAlphaIn(GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c, GXTevAlphaArg d) { - alpIn.SetIn(a, b, c, d); - } + void SetAlphaIn(GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c, GXTevAlphaArg d) { alpIn.SetIn(a, b, c, d); } - void SetAlphaOp(GXTevOp op, GXTevBias bias, GXTevScale scale, bool clamp, GXTevRegID outReg, GXTevKAlphaSel kSel) { - alpIn.SetOp(op, bias, scale, clamp, outReg, kSel); - } + void SetAlphaOp(GXTevOp op, GXTevBias bias, GXTevScale scale, bool clamp, GXTevRegID outReg, GXTevKAlphaSel kSel) { + alpIn.SetOp(op, bias, scale, clamp, outReg, kSel); + } - void SetIndirect(GXIndTexStageID stage, GXIndTexFormat format, GXIndTexBiasSel biasSel, GXIndTexMtxID mtxSel, GXIndTexWrap wrapS, GXIndTexWrap wrapT, bool addPrev, bool utcLod, GXIndTexAlphaSel alphaSel) { - indStage = stage; - indBiMt = biasSel | mtxSel << 3; - indWrap = wrapS | wrapT << 3; - indFoAdUtAl = format | (addPrev ? 1 : 0) << 2 | (utcLod ? 1 : 0) << 3 | alphaSel << 4; - } + void SetIndirect(GXIndTexStageID stage, GXIndTexFormat format, GXIndTexBiasSel biasSel, GXIndTexMtxID mtxSel, GXIndTexWrap wrapS, + GXIndTexWrap wrapT, bool addPrev, bool utcLod, GXIndTexAlphaSel alphaSel) { + indStage = stage; + indBiMt = biasSel | mtxSel << 3; + indWrap = wrapS | wrapT << 3; + indFoAdUtAl = format | (addPrev ? 1 : 0) << 2 | (utcLod ? 1 : 0) << 3 | alphaSel << 4; + } - private: - u8 texCoordGen; // 0x00 + private: + u8 texCoordGen; // 0x00 - u8 colChan; // 0x01 + u8 colChan; // 0x01 - u8 texMap; // 0x02 + u8 texMap; // 0x02 - u8 swapSel; // 0x03 + u8 swapSel; // 0x03 - TevStageInOp colIn; // 0x04 - TevStageInOp alpIn; // 0x08 + TevStageInOp colIn; // 0x04 + TevStageInOp alpIn; // 0x08 - u8 indStage; // 0x0C - u8 indBiMt; // 0x0D - u8 indWrap; // 0x0e - u8 indFoAdUtAl; // 0x0F + u8 indStage; // 0x0C + u8 indBiMt; // 0x0D + u8 indWrap; // 0x0e + u8 indFoAdUtAl; // 0x0F }; class ChanCtrl { - public: - ChanCtrl(): reserve1(0), reserve2(0) { Set(GX_SRC_VTX, GX_SRC_VTX); } + public: + ChanCtrl() : reserve1(0), reserve2(0) { Set(GX_SRC_VTX, GX_SRC_VTX); } - GXColorSrc GetColorSrc() const { - return static_cast(matSrcCol); - } - GXColorSrc GetAlphaSrc() const { - return static_cast(matSrcAlp); - } + GXColorSrc GetColorSrc() const { return static_cast(matSrcCol); } + GXColorSrc GetAlphaSrc() const { return static_cast(matSrcAlp); } - void Set(GXColorSrc colSrc, GXColorSrc alpSrc) { - matSrcCol = colSrc; - matSrcAlp = alpSrc; - } + void Set(GXColorSrc colSrc, GXColorSrc alpSrc) { + matSrcCol = colSrc; + matSrcAlp = alpSrc; + } - private: - u8 matSrcCol; // 0x00 - u8 matSrcAlp; // 0x01 + private: + u8 matSrcCol; // 0x00 + u8 matSrcAlp; // 0x01 - u8 reserve1; // 0x02 - u8 reserve2; // 0x03 + u8 reserve1; // 0x02 + u8 reserve2; // 0x03 }; class AlphaCompare { - public: - AlphaCompare() { - Set(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0); - } + public: + AlphaCompare() { Set(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0); } - GXCompare GetComp0() const { return static_cast(comp & 0x0F); } - GXCompare GetComp1() const { return static_cast((comp >> 4) & 0x0F); } + GXCompare GetComp0() const { return static_cast(comp & 0x0F); } + GXCompare GetComp1() const { return static_cast((comp >> 4) & 0x0F); } - GXAlphaOp GetOp() const { return static_cast(op); } + GXAlphaOp GetOp() const { return static_cast(op); } - u8 GetRef0() const { return ref0; } - u8 GetRef1() const { return ref1; } + u8 GetRef0() const { return ref0; } + u8 GetRef1() const { return ref1; } - void Set(GXCompare aComp0, u8 aRef0, GXAlphaOp aOp, GXCompare aComp1, u8 aRef1) { - comp = aComp0 | aComp1 << 4; - op = aOp; - ref0 = aRef0; - ref1 = aRef1; - } + void Set(GXCompare aComp0, u8 aRef0, GXAlphaOp aOp, GXCompare aComp1, u8 aRef1) { + comp = aComp0 | aComp1 << 4; + op = aOp; + ref0 = aRef0; + ref1 = aRef1; + } - private: - u8 comp; // 0x00 - u8 op; // 0x01 - u8 ref0; // 0x02 - u8 ref1; // 0x03 + private: + u8 comp; // 0x00 + u8 op; // 0x01 + u8 ref0; // 0x02 + u8 ref1; // 0x03 }; class BlendMode { - public: - BlendMode() { - Set(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET); - } + public: + BlendMode() { Set(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET); } - GXBlendMode GetType() const { return static_cast(type); } - GXBlendFactor GetSrcFactor() const { return static_cast(srcFactor); } - GXBlendFactor GetDstFactor() const { return static_cast(dstFactor); } - GXLogicOp GetOp() const { return static_cast(op); } + GXBlendMode GetType() const { return static_cast(type); } + GXBlendFactor GetSrcFactor() const { return static_cast(srcFactor); } + GXBlendFactor GetDstFactor() const { return static_cast(dstFactor); } + GXLogicOp GetOp() const { return static_cast(op); } - void Set(GXBlendMode aType, GXBlendFactor aSrcFactor, GXBlendFactor aDstFactor, GXLogicOp aOp) { - type = aType; - srcFactor = aSrcFactor; - dstFactor = aDstFactor; - op = aOp; - } + void Set(GXBlendMode aType, GXBlendFactor aSrcFactor, GXBlendFactor aDstFactor, GXLogicOp aOp) { + type = aType; + srcFactor = aSrcFactor; + dstFactor = aDstFactor; + op = aOp; + } - private: - u8 type; // 0x00 - u8 srcFactor; // 0x01 - u8 dstFactor; // 0x02 - u8 op; // 0x03 + private: + u8 type; // 0x00 + u8 srcFactor; // 0x01 + u8 dstFactor; // 0x02 + u8 op; // 0x03 }; - } -} + } // namespace lyt +} // namespace nw4r -#endif // NW4R_LYT_TYPES_H +#endif // NW4R_LYT_TYPES_H diff --git a/libs/NW4R/include/nw4r/lyt/window.h b/libs/NW4R/include/nw4r/lyt/window.h index 741630be..304ccbaf 100644 --- a/libs/NW4R/include/nw4r/lyt/window.h +++ b/libs/NW4R/include/nw4r/lyt/window.h @@ -1,66 +1,67 @@ #ifndef NW4R_LYT_WINDOW_H #define NW4R_LYT_WINDOW_H +#include #include #include -#include + namespace nw4r { namespace lyt { class Window : public Pane { - private: - typedef struct Content { - ut::Color vtxColors[4]; // 0x00 - detail::TexCoordAry texCoordAry; // 0x10 - } Content; + private: + typedef struct Content { + ut::Color vtxColors[4]; // 0x00 + detail::TexCoordAry texCoordAry; // 0x10 + } Content; - typedef struct Frame { - u8 textureFlip; // 0x00 - Material* pMaterial; // 0x04 - } Frame; + typedef struct Frame { + u8 textureFlip; // 0x00 + Material* pMaterial; // 0x04 + } Frame; - public: - Window(const res::Window* pBlock, const ResBlockSet& resBlockSet); - virtual ~Window(); + public: + Window(const res::Window* pBlock, const ResBlockSet& resBlockSet); + virtual ~Window(); - NW4R_UT_RUNTIME_TYPEINFO; - - virtual void DrawSelf(const DrawInfo& drawInfo); - virtual void AnimateSelf(u32 option); + NW4R_UT_RUNTIME_TYPEINFO; - virtual ut::Color GetVtxColor(u32 idx) const; - virtual void SetVtxColor(u32 idx, ut::Color value); + virtual void DrawSelf(const DrawInfo& drawInfo); + virtual void AnimateSelf(u32 option); - virtual u8 GetVtxColorElement(u32 idx) const; - virtual void SetVtxColorElement(u32 idx, u8 value); + virtual ut::Color GetVtxColor(u32 idx) const; + virtual void SetVtxColor(u32 idx, ut::Color value); - virtual Material* FindMaterialByName(const char* findName, bool bRecursive); + virtual u8 GetVtxColorElement(u32 idx) const; + virtual void SetVtxColorElement(u32 idx, u8 value); - virtual void UnbindAnimationSelf(AnimTransform* animTrans); + virtual Material* FindMaterialByName(const char* findName, bool bRecursive); - virtual AnimationLink* FindAnimationLink(AnimTransform* animTrans); + virtual void UnbindAnimationSelf(AnimTransform* animTrans); - virtual void SetAnimationEnable(AnimTransform* animTrans, bool bEnable, bool bRecursive); + virtual AnimationLink* FindAnimationLink(AnimTransform* animTrans); - virtual Material* GetContentMaterial() const; - virtual Material* GetFrameMaterial(u32 frameIdx) const; + virtual void SetAnimationEnable(AnimTransform* animTrans, bool bEnable, bool bRecursive); - virtual void DrawContent(const math::VEC2& basePt, const WindowFrameSize& frameSize, u8 alpha); + virtual Material* GetContentMaterial() const; + virtual Material* GetFrameMaterial(u32 frameIdx) const; - virtual void DrawFrame(const math::VEC2& basePt, const Frame& frame, const WindowFrameSize& frameSize, u8 alpha); - virtual void DrawFrame4(const math::VEC2& basePt, const Frame* frames, const WindowFrameSize& frameSize, u8 alpha); - virtual void DrawFrame8(const math::VEC2& basePt, const Frame* frames, const WindowFrameSize& frameSize, u8 alpha); + virtual void DrawContent(const math::VEC2& basePt, const WindowFrameSize& frameSize, u8 alpha); - WindowFrameSize GetFrameSize(u8 frameNum, const Frame* frames); + virtual void DrawFrame(const math::VEC2& basePt, const Frame& frame, const WindowFrameSize& frameSize, u8 alpha); + virtual void DrawFrame4(const math::VEC2& basePt, const Frame* frames, const WindowFrameSize& frameSize, u8 alpha); + virtual void DrawFrame8(const math::VEC2& basePt, const Frame* frames, const WindowFrameSize& frameSize, u8 alpha); - private: - InflationLRTB mContentInflation; // 0x0D4 - Content mContent; // 0x0E4 + WindowFrameSize GetFrameSize(u8 frameNum, const Frame* frames); - Frame* mFrames; // 0x0FC - u8 mFrameNum; // 0x100 + private: + InflationLRTB mContentInflation; // 0x0D4 + Content mContent; // 0x0E4 + + Frame* mFrames; // 0x0FC + u8 mFrameNum; // 0x100 }; - } -} + } // namespace lyt +} // namespace nw4r -#endif // NW4R_LYT_WINDOW_H +#endif // NW4R_LYT_WINDOW_H diff --git a/libs/NW4R/include/nw4r/math.h b/libs/NW4R/include/nw4r/math.h index af98a26c..28dcba9e 100644 --- a/libs/NW4R/include/nw4r/math.h +++ b/libs/NW4R/include/nw4r/math.h @@ -1,11 +1,8 @@ #ifndef NW4R_MATH_H #define NW4R_MATH_H -#include #include #include +#include -#endif // NW4R_MATH_H - - - +#endif // NW4R_MATH_H diff --git a/libs/NW4R/include/nw4r/math/arithmetic.h b/libs/NW4R/include/nw4r/math/arithmetic.h index 5f19b6a7..b469ab2b 100644 --- a/libs/NW4R/include/nw4r/math/arithmetic.h +++ b/libs/NW4R/include/nw4r/math/arithmetic.h @@ -19,10 +19,11 @@ namespace nw4r { OSu16tof32(&x, &rval); return rval; } - } + } // namespace #ifdef TARGET_RVL + // clang-format off inline f32 FSelect(register f32 cond, register f32 ifPos, register f32 ifNeg) { register f32 ret; #ifdef __MWERKS__ @@ -39,14 +40,17 @@ namespace nw4r { return ret; } + // clang-format on #else - inline f32 FAbs(f32 x) {} - inline f32 FSelect(f32 cond, f32 ifPos, f32 ifNeg) {} -#endif // TARGET_RVL - + inline f32 FAbs(f32 x) { + } + inline f32 FSelect(f32 cond, f32 ifPos, f32 ifNeg) { + } +#endif // TARGET_RVL + f32 FrSqrt(f32 x); u32 CntBit1(u32 x); - } -} + } // namespace math +} // namespace nw4r -#endif // NW4R_MATH_ARITHMETIC_H +#endif // NW4R_MATH_ARITHMETIC_H diff --git a/libs/NW4R/include/nw4r/math/triangular.h b/libs/NW4R/include/nw4r/math/triangular.h index 3a4ffe3d..349ecb5f 100644 --- a/libs/NW4R/include/nw4r/math/triangular.h +++ b/libs/NW4R/include/nw4r/math/triangular.h @@ -9,19 +9,19 @@ namespace nw4r { namespace math { - #define NW4R_MATH_PI M_PI - #define NW4R_MATH_LN_2 0.69314718056f +#define NW4R_MATH_PI M_PI +#define NW4R_MATH_LN_2 0.69314718056f - // [0, 65535] -> [0.0, 256.0f] - #define NW4R_MATH_IDX_TO_FIDX(x) ((x) * (1.0f / 256.0f)) +// [0, 65535] -> [0.0, 256.0f] +#define NW4R_MATH_IDX_TO_FIDX(x) ((x) * (1.0f / 256.0f)) - // Convert degrees <-> lookup-table index - #define NW4R_MATH_DEG_TO_FIDX(x) ((x) * (256.0f / 360.0f)) - #define NW4R_MATH_FIDX_TO_DEG(x) ((x) * (360.0f / 256.0f)) +// Convert degrees <-> lookup-table index +#define NW4R_MATH_DEG_TO_FIDX(x) ((x) * (256.0f / 360.0f)) +#define NW4R_MATH_FIDX_TO_DEG(x) ((x) * (360.0f / 256.0f)) - // Convert radians <-> lookup-table index - #define NW4R_MATH_RAD_TO_FIDX(x) ((x) * (128.0f / NW4R_MATH_PI)) - #define NW4R_MATH_FIDX_TO_RAD(x) ((x) * (NW4R_MATH_PI / 128.0f)) +// Convert radians <-> lookup-table index +#define NW4R_MATH_RAD_TO_FIDX(x) ((x) * (128.0f / NW4R_MATH_PI)) +#define NW4R_MATH_FIDX_TO_RAD(x) ((x) * (NW4R_MATH_PI / 128.0f)) f32 AtanFIdx(f32 x); @@ -45,7 +45,7 @@ namespace nw4r { } f32 AtanFIdx(f32 x); - inline f32 AtanDeg(f32 x) { + inline f32 AtanDeg(f32 x) { return NW4R_MATH_FIDX_TO_DEG(AtanFIdx(x)); } inline f32 AtanRad(f32 x) { @@ -53,13 +53,13 @@ namespace nw4r { } f32 Atan2FIdx(f32 y, f32 x); - inline f32 Atan2Deg(f32 y, f32 x) { + inline f32 Atan2Deg(f32 y, f32 x) { return NW4R_MATH_FIDX_TO_DEG(Atan2FIdx(y, x)); } inline f32 Atan2Rad(f32 y, f32 x) { return NW4R_MATH_FIDX_TO_RAD(Atan2FIdx(y, x)); } - } -} + } // namespace math +} // namespace nw4r -#endif // NW4R_MATH_TRIANGULAR_H +#endif // NW4R_MATH_TRIANGULAR_H diff --git a/libs/NW4R/include/nw4r/math/types.h b/libs/NW4R/include/nw4r/math/types.h index 43d5e7dc..a46f642d 100644 --- a/libs/NW4R/include/nw4r/math/types.h +++ b/libs/NW4R/include/nw4r/math/types.h @@ -1,8 +1,8 @@ #ifndef NW4R_MATH_TYPES_H #define NW4R_MATH_TYPES_H -#include #include +#include namespace nw4r { namespace math { @@ -41,11 +41,11 @@ namespace nw4r { MTX34(const f32*); MTX34(const Mtx& rhs); - operator f32*() { return &_00; } - operator const f32*() const { return &_00; } + operator f32*() { return &_00; } + operator const f32*() const { return &_00; } - operator MtxPtr() { return (MtxPtr)&_00; } - operator const MtxPtr() const { return (const MtxPtr)&_00; } + operator MtxPtr() { return (MtxPtr)&_00; } + operator const MtxPtr() const { return (const MtxPtr)&_00; } } MTX34; typedef struct _MTX44 { @@ -68,26 +68,32 @@ namespace nw4r { MTX44(const f32*); MTX44(const Mtx44& rhs); - operator f32*() { return &_00; } - operator const f32*() const { return &_00; } + operator f32*() { return &_00; } + operator const f32*() const { return &_00; } - operator MtxPtr() { return (MtxPtr)&_00; } - operator const MtxPtr() const { return (const MtxPtr)&_00; } + operator MtxPtr() { return (MtxPtr)&_00; } + operator const MtxPtr() const { return (const MtxPtr)&_00; } } MTX44; void MTX44Identity(MTX44* pMtx); - + typedef struct _VEC2 { f32 x, y; } _VEC2; - + typedef struct VEC2 : public _VEC2 { - VEC2() {} + VEC2() {} - VEC2(const f32* pF) { x = pF[0]; y = pF[1]; } - VEC2(f32 fx, f32 fy) { x = fx; y = fy; } + VEC2(const f32* pF) { + x = pF[0]; + y = pF[1]; + } + VEC2(f32 fx, f32 fy) { + x = fx; + y = fy; + } - operator f32*() { return reinterpret_cast(this); } + operator f32*() { return reinterpret_cast(this); } operator const f32*() const { return reinterpret_cast(this); } VEC2& operator+=(const VEC2& rhs) { @@ -112,13 +118,16 @@ namespace nw4r { return *this; } - VEC2 operator+(const VEC2& rhs) const { return VEC2(x + rhs.x, y + rhs.y); } - VEC2 operator-(const VEC2& rhs) const { return VEC2(x - rhs.x, y - rhs.y); } - VEC2 operator*(f32 val) const { return VEC2(val * x, val * y); } - VEC2 operator/(f32 val) const { f32 result = 1.f / val; return VEC2(result * x, result * y); } + VEC2 operator+(const VEC2& rhs) const { return VEC2(x + rhs.x, y + rhs.y); } + VEC2 operator-(const VEC2& rhs) const { return VEC2(x - rhs.x, y - rhs.y); } + VEC2 operator*(f32 val) const { return VEC2(val * x, val * y); } + VEC2 operator/(f32 val) const { + f32 result = 1.f / val; + return VEC2(result * x, result * y); + } - bool operator==(const VEC2& rhs) const { return x == rhs.x && y == rhs.y; } - bool operator!=(const VEC2& rhs) const { return x != rhs.x || y != rhs.y; } + bool operator==(const VEC2& rhs) const { return x == rhs.x && y == rhs.y; } + bool operator!=(const VEC2& rhs) const { return x != rhs.x || y != rhs.y; } } VEC2; typedef struct VEC3 VEC3; @@ -131,41 +140,48 @@ namespace nw4r { typedef struct _VEC3 { f32 x, y, z; } _VEC3; - + struct VEC3 : public _VEC3 { - VEC3() {} + VEC3() {} - VEC3(const f32* pF) { x = pF[0]; y = pF[1]; z = pF[2]; } - VEC3(f32 fx, f32 fy, f32 fz) { x = fx; y = fy; z = fz; } - - operator Vec*() { return reinterpret_cast(this); } - operator const Vec*() const { return reinterpret_cast(this); } - - VEC3& operator+=(const VEC3& rhs) { VEC3Add(this, this, &rhs); return *this; } - VEC3& operator-=(const VEC3& rhs) { VEC3Sub(this, this, &rhs); return *this; } - VEC3& operator*=(f32 val) { VEC3Scale(this, this, val); return *this; } - VEC3& operator/=(f32 val) { return operator*=(1.f / val); } - - VEC3 operator+(const VEC3& rhs) const { - return VEC3(x + rhs.x, y + rhs.y, z + rhs.z); + VEC3(const f32* pF) { + x = pF[0]; + y = pF[1]; + z = pF[2]; } - VEC3 operator-(const VEC3& rhs) const { - return VEC3(x - rhs.x, y - rhs.y, z - rhs.z); + VEC3(f32 fx, f32 fy, f32 fz) { + x = fx; + y = fy; + z = fz; } - VEC3 operator*(f32 val) const { - return VEC3(val * x, val * y, val * z); + + operator Vec*() { return reinterpret_cast(this); } + operator const Vec*() const { return reinterpret_cast(this); } + + VEC3& operator+=(const VEC3& rhs) { + VEC3Add(this, this, &rhs); + return *this; } + VEC3& operator-=(const VEC3& rhs) { + VEC3Sub(this, this, &rhs); + return *this; + } + VEC3& operator*=(f32 val) { + VEC3Scale(this, this, val); + return *this; + } + VEC3& operator/=(f32 val) { return operator*=(1.f / val); } + + VEC3 operator+(const VEC3& rhs) const { return VEC3(x + rhs.x, y + rhs.y, z + rhs.z); } + VEC3 operator-(const VEC3& rhs) const { return VEC3(x - rhs.x, y - rhs.y, z - rhs.z); } + VEC3 operator*(f32 val) const { return VEC3(val * x, val * y, val * z); } VEC3 operator/(f32 val) const { f32 result = 1.f / val; return VEC3(result * x, result * y, result * z); } - bool operator==(const VEC3& rhs) const { - return x == rhs.x && y == rhs.y && z == rhs.z; - } - bool operator!=(const VEC3& rhs) const { - return x != rhs.x || y != rhs.y || z != rhs.z; - } + bool operator==(const VEC3& rhs) const { return x == rhs.x && y == rhs.y && z == rhs.z; } + bool operator!=(const VEC3& rhs) const { return x != rhs.x || y != rhs.y || z != rhs.z; } }; typedef struct _VEC4 { @@ -174,10 +190,20 @@ namespace nw4r { } _VEC4; typedef struct VEC4 : public _VEC4 { - VEC4() {} + VEC4() {} - VEC4(const f32* pF) { x = pF[0]; y = pF[1]; z = pF[2]; w = pF[3]; } - VEC4(f32 fx, f32 fy, f32 fz, f32 fw) { x = fx; y = fy; z = fz; w = fw; } + VEC4(const f32* pF) { + x = pF[0]; + y = pF[1]; + z = pF[2]; + w = pF[3]; + } + VEC4(f32 fx, f32 fy, f32 fz, f32 fw) { + x = fx; + y = fy; + z = fz; + w = fw; + } } VEC4; inline VEC3* VEC3Transform(VEC3* pOut, const MTX34* pMtx, const VEC3* pVec) { @@ -246,7 +272,7 @@ namespace nw4r { register f32 a, b; #if defined(__MWERKS__) // Wii Implementation - asm { + asm { #define qr0 0 psq_l a, 0(p), FALSE, qr0 ps_muls0 b, a, scale @@ -269,7 +295,7 @@ namespace nw4r { VEC4* VEC4Transform(VEC4* pOut, const MTX44* pM, const VEC4* pV); - inline MTX34* MTX34Copy(MTX34* pOut, const MTX34 *p) { + inline MTX34* MTX34Copy(MTX34* pOut, const MTX34* p) { PSMTXCopy(*p, *pOut); return pOut; } @@ -285,7 +311,7 @@ namespace nw4r { } void MTX44Identity(MTX44* pMtx); - } -} + } // namespace math +} // namespace nw4r -#endif // NW4R_MATH_TYPES_H +#endif // NW4R_MATH_TYPES_H diff --git a/libs/NW4R/include/nw4r/snd.h b/libs/NW4R/include/nw4r/snd.h index 07486ee1..1f11dbee 100644 --- a/libs/NW4R/include/nw4r/snd.h +++ b/libs/NW4R/include/nw4r/snd.h @@ -7,17 +7,17 @@ #include #include -#include #include +#include #include #include #include -#include #include +#include #include #include -#endif // NW4R_SND_H +#endif // NW4R_SND_H diff --git a/libs/NW4R/include/nw4r/snd/AxManager.h b/libs/NW4R/include/nw4r/snd/AxManager.h index dece7368..b578c866 100644 --- a/libs/NW4R/include/nw4r/snd/AxManager.h +++ b/libs/NW4R/include/nw4r/snd/AxManager.h @@ -1,8 +1,8 @@ #ifndef NW4R_SND_AX_MANAGER_H #define NW4R_SND_AX_MANAGER_H -#include #include +#include #include #include @@ -12,115 +12,115 @@ namespace nw4r { namespace snd { namespace detail { class AxManager { - public: - typedef struct CallbackListNode { - ut::LinkListNode link; // 0x00 - AXOutCallback callback; // 0x08 - } CallbackListNode; + public: + typedef struct CallbackListNode { + ut::LinkListNode link; // 0x00 + AXOutCallback callback; // 0x08 + } CallbackListNode; - typedef ut::LinkList CallbackList; + typedef ut::LinkList CallbackList; - static AxManager& GetInstance(); + static AxManager& GetInstance(); - void Init(); - void Update(); + void Init(); + void Update(); - bool CheckInit() { return mInitialized; } + bool CheckInit() { return mInitialized; } - bool IsDiskError() const { return mDiskErrorFlag; } - bool IsHomeButtonMenu() const { return mHomeButtonMuteFlag; } + bool IsDiskError() const { return mDiskErrorFlag; } + bool IsHomeButtonMenu() const { return mHomeButtonMuteFlag; } - bool IsResetReady() const { return mResetReadyCounter == 0; } - - f32 GetOutputVolume() const; - void* GetZeroBufferAddress(); + bool IsResetReady() const { return mResetReadyCounter == 0; } - void RegisterCallback(CallbackListNode* node, AXOutCallback callback); - void UnregisterCallback(CallbackListNode* node); + f32 GetOutputVolume() const; + void* GetZeroBufferAddress(); - void SetOutputMode(OutputMode mode); - OutputMode GetOutputMode(); + void RegisterCallback(CallbackListNode* node, AXOutCallback callback); + void UnregisterCallback(CallbackListNode* node); - void UpdateAllVoicesPriority(); - void UpdateAllVoices(); - void UpdateAllVoicesSync(u32 syncFlag); + void SetOutputMode(OutputMode mode); + OutputMode GetOutputMode(); - f32 GetMasterVolume() const { return mMasterVolume.GetValue(); } - void SetMasterVolume(f32 volume, int frame); + void UpdateAllVoicesPriority(); + void UpdateAllVoices(); + void UpdateAllVoicesSync(u32 syncFlag); - bool AppendEffect(AuxBus bus, FxBase* fx); - void ClearEffect(AuxBus bus, int frame); - void ShutdownEffect(AuxBus bus); + f32 GetMasterVolume() const { return mMasterVolume.GetValue(); } + void SetMasterVolume(f32 volume, int frame); - FxList& GetEffectList(AuxBus bus) { return mFxList[bus]; } + bool AppendEffect(AuxBus bus, FxBase* fx); + void ClearEffect(AuxBus bus, int frame); + void ShutdownEffect(AuxBus bus); - void AppendVoiceList(AxVoice* voice); - void RemoveVoiceList(AxVoice* voice); + FxList& GetEffectList(AuxBus bus) { return mFxList[bus]; } - AxVoice* AllocVoice(int channels, int voices, int priority, AxVoice::AxVoiceCallback callback, void* callbackData); - void FreeVoice(AxVoice* voice); + void AppendVoiceList(AxVoice* voice); + void RemoveVoiceList(AxVoice* voice); - void ChangeVoicePriority(AxVoice* voice); - void LockUpdateVoicePriority(); - void UnlockUpdateVoicePriority(); + AxVoice* AllocVoice(int channels, int voices, int priority, AxVoice::AxVoiceCallback callback, void* callbackData); + void FreeVoice(AxVoice* voice); - int DropLowestPriorityVoice(int priority); + void ChangeVoicePriority(AxVoice* voice); + void LockUpdateVoicePriority(); + void UnlockUpdateVoicePriority(); - AxVoiceList& GetVoiceList() { return mPrioVoiceList; } + int DropLowestPriorityVoice(int priority); - private: - static const u8 AUX_CALLBACK_WAIT_FRAME = 6; + AxVoiceList& GetVoiceList() { return mPrioVoiceList; } - static const int FX_SAMPLE_RATE = AX_SAMPLE_RATE; - static const SampleFormat FX_SAMPLE_FORMAT = SAMPLE_FORMAT_PCM_S32; - static const int FX_BUFFER_SIZE = AX_FRAME_SIZE; + private: + static const u8 AUX_CALLBACK_WAIT_FRAME = 6; - static const int ZERO_BUFFER_SIZE = 256; + static const int FX_SAMPLE_RATE = AX_SAMPLE_RATE; + static const SampleFormat FX_SAMPLE_FORMAT = SAMPLE_FORMAT_PCM_S32; + static const int FX_BUFFER_SIZE = AX_FRAME_SIZE; - AxManager(); + static const int ZERO_BUFFER_SIZE = 256; - static void AxCallbackFunc(); - static void AuxCallbackFunc(void* chans, void* context); + AxManager(); - OutputMode mOutputMode; // 0x00 + static void AxCallbackFunc(); + static void AuxCallbackFunc(void* chans, void* context); - void* mZeroBufferAddress; // 0x04 + OutputMode mOutputMode; // 0x00 - CallbackList mCallbackList; // 0x08 - AxVoiceList mPrioVoiceList; // 0x14 - AxVoiceList mFreeVoiceList; // 0x20 + void* mZeroBufferAddress; // 0x04 - AxVoice mVoices[AX_VOICE_MAX]; // 0x2C + CallbackList mCallbackList; // 0x08 + AxVoiceList mPrioVoiceList; // 0x14 + AxVoiceList mFreeVoiceList; // 0x20 - AXOutCallback mNextAxRegisterCallback; // 0xA22C + AxVoice mVoices[AX_VOICE_MAX]; // 0x2C - bool mInitialized; // 0xA230 + AXOutCallback mNextAxRegisterCallback; // 0xA22C - bool mUpdateVoicePrioFlag; // 0xA231 - bool mHomeButtonMuteFlag; // 0xA232 - bool mDiskErrorFlag; // 0xA233 + bool mInitialized; // 0xA230 - MoveValue mHomeButtonMenuVolume; // 0xA234 - MoveValue mMasterVolume; // 0xA244 - MoveValue mVolumeForReset; // 0xA254 + bool mUpdateVoicePrioFlag; // 0xA231 + bool mHomeButtonMuteFlag; // 0xA232 + bool mDiskErrorFlag; // 0xA233 - AIDCallback mOldAidCallback; // 0xA264 + MoveValue mHomeButtonMenuVolume; // 0xA234 + MoveValue mMasterVolume; // 0xA244 + MoveValue mVolumeForReset; // 0xA254 - vs32 mResetReadyCounter; // 0xA268 + AIDCallback mOldAidCallback; // 0xA264 - MoveValue mAuxFadeVolume[AUX_BUS_NUM]; // 0xA26C - MoveValue mAuxUserVolume[AUX_BUS_NUM]; // 0xA29C + vs32 mResetReadyCounter; // 0xA268 - FxList mFxList[AUX_BUS_NUM]; // 0xA2CC + MoveValue mAuxFadeVolume[AUX_BUS_NUM]; // 0xA26C + MoveValue mAuxUserVolume[AUX_BUS_NUM]; // 0xA29C - AXAuxCallback mAuxCallback[AUX_BUS_NUM]; // 0xA2F0 - void* mAuxCallbackContext[AUX_BUS_NUM]; // 0xA2FC - u8 mAuxCallbackWaitCounter[AUX_BUS_NUM]; // 0xA308 + FxList mFxList[AUX_BUS_NUM]; // 0xA2CC - static u8 sZeroBuffer[ZERO_BUFFER_SIZE]; + AXAuxCallback mAuxCallback[AUX_BUS_NUM]; // 0xA2F0 + void* mAuxCallbackContext[AUX_BUS_NUM]; // 0xA2FC + u8 mAuxCallbackWaitCounter[AUX_BUS_NUM]; // 0xA308 + + static u8 sZeroBuffer[ZERO_BUFFER_SIZE]; }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_AX_MANAGER_H +#endif // NW4R_SND_AX_MANAGER_H diff --git a/libs/NW4R/include/nw4r/snd/AxVoice.h b/libs/NW4R/include/nw4r/snd/AxVoice.h index 77932ab0..7217faea 100644 --- a/libs/NW4R/include/nw4r/snd/AxVoice.h +++ b/libs/NW4R/include/nw4r/snd/AxVoice.h @@ -15,208 +15,195 @@ namespace nw4r { class AxVoice : public DisposeCallback { friend class AxManager; - public: - typedef enum CallbackStatus { - CALLBACK_STATUS_FINISH_WAVE = 0, - CALLBACK_STATUS_INVALIDATE_WAVE, - CALLBACK_STATUS_DROP_VOICE, - CALLBACK_STATUS_DROP_DSP - } CallbackStatus; + public: + typedef enum CallbackStatus { + CALLBACK_STATUS_FINISH_WAVE = 0, + CALLBACK_STATUS_INVALIDATE_WAVE, + CALLBACK_STATUS_DROP_VOICE, + CALLBACK_STATUS_DROP_DSP + } CallbackStatus; - typedef enum VoiceSyncFlag { - SYNC_AX_SRC_INITIAL = (1 << 0), - SYNC_AX_VOICE = (1 << 1), - SYNC_AX_SRC = (1 << 3), - SYNC_AX_VE = (1 << 4), - SYNC_AX_MIX = (1 << 5), - SYNC_AX_LPF = (1 << 6), - SYNC_AX_REMOTE = (1 << 7), - SYNC_AX_BIQUAD = (1 << 8), - } VoiceSyncFlag; + typedef enum VoiceSyncFlag { + SYNC_AX_SRC_INITIAL = (1 << 0), + SYNC_AX_VOICE = (1 << 1), + SYNC_AX_SRC = (1 << 3), + SYNC_AX_VE = (1 << 4), + SYNC_AX_MIX = (1 << 5), + SYNC_AX_LPF = (1 << 6), + SYNC_AX_REMOTE = (1 << 7), + SYNC_AX_BIQUAD = (1 << 8), + } VoiceSyncFlag; - typedef enum Format { - FORMAT_PCM16 = 10, - FORMAT_PCM8 = 25, - FORMAT_ADPCM = 0 - } Format; + typedef enum Format { FORMAT_PCM16 = 10, FORMAT_PCM8 = 25, FORMAT_ADPCM = 0 } Format; - typedef enum VoiceType { - VOICE_TYPE_NORMAL = 0, - VOICE_TYPE_STREAM - } VoiceType; + typedef enum VoiceType { VOICE_TYPE_NORMAL = 0, VOICE_TYPE_STREAM } VoiceType; - typedef enum SrcType { - SRC_NONE = 0, - SRC_LINEAR, - SRC_4TAP_8K , - SRC_4TAP_12K, - SRC_4TAP_16K, - SRC_4TAP_AUTO - } SrcType; + typedef enum SrcType { SRC_NONE = 0, SRC_LINEAR, SRC_4TAP_8K, SRC_4TAP_12K, SRC_4TAP_16K, SRC_4TAP_AUTO } SrcType; - typedef void (*AxVoiceCallback)(AxVoice* drovoice, CallbackStatus status, void* callbackArg); + typedef void (*AxVoiceCallback)(AxVoice* drovoice, CallbackStatus status, void* callbackArg); - AxVoice(); - virtual ~AxVoice(); // 0x08 + AxVoice(); + virtual ~AxVoice(); // 0x08 - virtual void InvalidateData(const void* start, const void* end) {} // 0x0C - virtual void InvalidateWaveData(const void* start, const void* end); // 0x10 + virtual void InvalidateData(const void* start, const void* end) {} // 0x0C + virtual void InvalidateWaveData(const void* start, const void* end); // 0x10 - void Setup(const WaveData& waveParam); - void Update(); - void Free(); + void Setup(const WaveData& waveParam); + void Update(); + void Free(); - void Start(); - void Stop(); + void Start(); + void Stop(); - void Pause(bool flag); + void Pause(bool flag); - void SetVolume(f32 volume); - void SetVeVolume(f32 targetVolume, f32 initVolume); - void SetMainOutVolume(f32 volume); - void SetRemoteOutVolume(int remoteIndex, f32 volume); + void SetVolume(f32 volume); + void SetVeVolume(f32 targetVolume, f32 initVolume); + void SetMainOutVolume(f32 volume); + void SetRemoteOutVolume(int remoteIndex, f32 volume); - void SetPitch(f32 pitch); - void SetPan(f32 pan); - void SetPan2(f32 pan); - void SetSurroundPan(f32 surroundPan); - void SetSurroundPan2(f32 surroundPan); + void SetPitch(f32 pitch); + void SetPan(f32 pan); + void SetPan2(f32 pan); + void SetSurroundPan(f32 surroundPan); + void SetSurroundPan2(f32 surroundPan); - void SetLpfFreq(f32 lpfFreq); + void SetLpfFreq(f32 lpfFreq); - void SetOutputLine(int lineFlag); + void SetOutputLine(int lineFlag); - void SetMainSend(f32 send); - void SetFxSend(AuxBus bus, f32 send); - void SetRemoteSend(int remoteIndex, f32 send); - void SetRemoteFxSend(int remoteIndex, f32 send); - - void SetPriority(int priority); - int GetPriority() const { return mPriority; } + void SetMainSend(f32 send); + void SetFxSend(AuxBus bus, f32 send); + void SetRemoteSend(int remoteIndex, f32 send); + void SetRemoteFxSend(int remoteIndex, f32 send); - u32 GetCurrentPlayingDspAddress() const; - u32 GetLoopStartDspAddress() const; - u32 GetLoopEndDspAddress() const; + void SetPriority(int priority); + int GetPriority() const { return mPriority; } - u32 GetCurrentPlayingSample() const; + u32 GetCurrentPlayingDspAddress() const; + u32 GetLoopStartDspAddress() const; + u32 GetLoopEndDspAddress() const; - void SetAdpcmLoop(int channelIndex, Format format, const AdpcmLoopParam* param); - void SetBaseAddress(int channelIndex, const void* baseAddress); + u32 GetCurrentPlayingSample() const; - bool IsPlayFinished() const; - bool IsRun(); + void SetAdpcmLoop(int channelIndex, Format format, const AdpcmLoopParam* param); + void SetBaseAddress(int channelIndex, const void* baseAddress); - void SetAxAddr(int channelIndex, bool loopFlag, Format format, const void* waveAddr, u32 loopStart, u32 loopEnd); + bool IsPlayFinished() const; + bool IsRun(); - void SetLoopStart(int channelIndex, const void* baseAddress, u32 samples); - void SetLoopEnd(int channelIndex, const void* baseAddress, u32 samples); - void SetLoopFlag(bool loopFlag); + void SetAxAddr(int channelIndex, bool loopFlag, Format format, const void* waveAddr, u32 loopStart, u32 loopEnd); - void StopAtPoint(int channelIndex, const void* baseAddress, u32 samples); - void SetVoiceType(VoiceType type); + void SetLoopStart(int channelIndex, const void* baseAddress, u32 samples); + void SetLoopEnd(int channelIndex, const void* baseAddress, u32 samples); + void SetLoopFlag(bool loopFlag); - void UpdateAxSrc(bool initialUpdate); - void SetAxSrcType(SrcType type); + void StopAtPoint(int channelIndex, const void* baseAddress, u32 samples); + void SetVoiceType(VoiceType type); - void SetAxAdpcm(int channelIndex, Format format, const AdpcmParam* param); - void SetAxAdpcmLoop(int channelIndex, Format format, const AdpcmLoopParam* param) NO_INLINE; + void UpdateAxSrc(bool initialUpdate); + void SetAxSrcType(SrcType type); - bool UpdateAxVe(); - void UpdateAxMix(); - void UpdateAxLpf(); + void SetAxAdpcm(int channelIndex, Format format, const AdpcmParam* param); + void SetAxAdpcmLoop(int channelIndex, Format format, const AdpcmLoopParam* param) NO_INLINE; - void InitParam(int channels, int voices, AxVoiceCallback callback, void* callbackData); - bool Acquire(int channels, int voices, int priority, AxVoiceCallback callback, void* callbackData); + bool UpdateAxVe(); + void UpdateAxMix(); + void UpdateAxLpf(); - int GetAxVoiceCount() const { return mChannelCount * mVoiceOutCount; } + void InitParam(int channels, int voices, AxVoiceCallback callback, void* callbackData); + bool Acquire(int channels, int voices, int priority, AxVoiceCallback callback, void* callbackData); - static u32 GetDspAddressBySample(const void* baseAddress, u32 samples, Format format); - static u32 GetSampleByDspAddress(const void* baseAddress, u32 addr, Format format); - static u32 GetSampleByByte(u32 byte, Format format); + int GetAxVoiceCount() const { return mChannelCount * mVoiceOutCount; } - template void SetAxParam(void (*func)(AXVPB*, T), T param) { - for (int i = 0; i < mChannelCount; i++) { - for (int j = 0; j < mVoiceOutCount; j++) { - if (mVpb[i][j] != NULL) { - func(mVpb[i][j], param); - } + static u32 GetDspAddressBySample(const void* baseAddress, u32 samples, Format format); + static u32 GetSampleByDspAddress(const void* baseAddress, u32 addr, Format format); + static u32 GetSampleByByte(u32 byte, Format format); + + template + void SetAxParam(void (*func)(AXVPB*, T), T param) { + for (int i = 0; i < mChannelCount; i++) { + for (int j = 0; j < mVoiceOutCount; j++) { + if (mVpb[i][j] != NULL) { + func(mVpb[i][j], param); } } } + } - Format GetFormat() { return mFormat; } + Format GetFormat() { return mFormat; } - static const int VOICES_MAX = 4; - static const int PRIORITY_MAX = 255; + static const int VOICES_MAX = 4; + static const int PRIORITY_MAX = 255; - protected: - static void VoiceCallback(void* callbackData); + protected: + static void VoiceCallback(void* callbackData); - void TransformDpl2Pan(f32* outPan, f32* outSurroundPan, f32 inPan, f32 inSurroundPan); + void TransformDpl2Pan(f32* outPan, f32* outSurroundPan, f32 inPan, f32 inSurroundPan); - void CalcAXPBMIX(int channelIndex, int voiceIndex, AXPBMIX* mix); - void CalcAXPBRMTMIX(int channelIndex, int voiceIndex, AXPBRMTMIX* mix); + void CalcAXPBMIX(int channelIndex, int voiceIndex, AXPBMIX* mix); + void CalcAXPBRMTMIX(int channelIndex, int voiceIndex, AXPBRMTMIX* mix); - AXVPB* mVpb[CHANNEL_MAX][VOICES_MAX]; // 0x0C + AXVPB* mVpb[CHANNEL_MAX][VOICES_MAX]; // 0x0C - VoiceChannelParam mVoiceChannelParam[CHANNEL_MAX]; // 0x2C - SoundParam mVoiceOutParam[VOICES_MAX]; // 0x94 - s32 mChannelCount; // 0x104 - s32 mVoiceOutCount; // 0x108 + VoiceChannelParam mVoiceChannelParam[CHANNEL_MAX]; // 0x2C + SoundParam mVoiceOutParam[VOICES_MAX]; // 0x94 + s32 mChannelCount; // 0x104 + s32 mVoiceOutCount; // 0x108 - AxVoiceCallback mCallback; // 0x10C - void* mCallbackData; // 0x110 + AxVoiceCallback mCallback; // 0x10C + void* mCallbackData; // 0x110 - int mSampleRate; // 0x114 + int mSampleRate; // 0x114 - Format mFormat; // 0x118 + Format mFormat; // 0x118 - bool mActiveFlag; // 0x11C - bool mStartFlag; // 0x11D - bool mStartedFlag; // 0x11E - bool mPauseFlag; // 0x11F - bool mPausingFlag; // 0x120 - bool mFirstVeUpdateFlag; // 0x121 - bool mHomeButtonMuteFlag; // 0x122 - u8 mSyncFlag; // 0x123 + bool mActiveFlag; // 0x11C + bool mStartFlag; // 0x11D + bool mStartedFlag; // 0x11E + bool mPauseFlag; // 0x11F + bool mPausingFlag; // 0x120 + bool mFirstVeUpdateFlag; // 0x121 + bool mHomeButtonMuteFlag; // 0x122 + u8 mSyncFlag; // 0x123 - int mPriority; // 0x124 + int mPriority; // 0x124 - f32 mPan; // 0x128 - f32 mSurroundPan; // 0x12C - f32 mPan2; // 0x130 - f32 mSurroundPan2; // 0x134 + f32 mPan; // 0x128 + f32 mSurroundPan; // 0x12C + f32 mPan2; // 0x130 + f32 mSurroundPan2; // 0x134 - f32 mLpfFreq; // 0x138 + f32 mLpfFreq; // 0x138 - int mOutputLineFlag; // 0x13C + int mOutputLineFlag; // 0x13C - f32 mMainOutVolume; // 0x140 - f32 mMainSend; // 0x144 + f32 mMainOutVolume; // 0x140 + f32 mMainSend; // 0x144 - f32 mFxSend[AUX_BUS_NUM]; // 0x148 + f32 mFxSend[AUX_BUS_NUM]; // 0x148 - f32 mRemoteOutVolume[VOICES_MAX]; // 0x154 - f32 mRemoteSend[VOICES_MAX]; // 0x164 - f32 mRemoteFxSend[VOICES_MAX]; // 0x174 + f32 mRemoteOutVolume[VOICES_MAX]; // 0x154 + f32 mRemoteSend[VOICES_MAX]; // 0x164 + f32 mRemoteFxSend[VOICES_MAX]; // 0x174 - f32 mPitch; // 0x184 + f32 mPitch; // 0x184 - f32 mVolume; // 0x188 - f32 mVolumePrev[VOICES_MAX]; // 0x18C + f32 mVolume; // 0x188 + f32 mVolumePrev[VOICES_MAX]; // 0x18C - f32 mVeInitVolume; // 0x19C - f32 mVeTargetVolume; // 0x1A0 + f32 mVeInitVolume; // 0x19C + f32 mVeTargetVolume; // 0x1A0 - u16 mGainPrev; // 0x1A4 + u16 mGainPrev; // 0x1A4 - public: - ut::LinkListNode mLinkNode; // 0x1A8 + public: + ut::LinkListNode mLinkNode; // 0x1A8 }; typedef ut::LinkList AxVoiceList; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_AX_VOICE_H +#endif // NW4R_SND_AX_VOICE_H diff --git a/libs/NW4R/include/nw4r/snd/AxfxImpl.h b/libs/NW4R/include/nw4r/snd/AxfxImpl.h index 44fe3fcf..43eb596f 100644 --- a/libs/NW4R/include/nw4r/snd/AxfxImpl.h +++ b/libs/NW4R/include/nw4r/snd/AxfxImpl.h @@ -9,32 +9,29 @@ namespace nw4r { namespace snd { namespace detail { class AxfxImpl { - public: - AxfxImpl() : - mIsActive(false), - mHeap(NULL), - mAllocCount(0) {} + public: + AxfxImpl() : mIsActive(false), mHeap(NULL), mAllocCount(0) {} - bool CreateHeap(void* buffer, u32 size); - void DestroyHeap(); + bool CreateHeap(void* buffer, u32 size); + void DestroyHeap(); - u32 GetHeapTotalSize() { return MEMGetHeapTotalSize(mHeap); } + u32 GetHeapTotalSize() { return MEMGetHeapTotalSize(mHeap); } - static void* Alloc(u32 size); - static void Free(void* block); + static void* Alloc(u32 size); + static void Free(void* block); - static const u32 HEAP_SIZE_MIN = MEM_FRM_HEAP_MIN_SIZE + 32; - - public: - bool mIsActive; // 0x00 - MEMHeapHandle mHeap; // 0x04 - u32 mAllocCount; // 0x08 + static const u32 HEAP_SIZE_MIN = MEM_FRM_HEAP_MIN_SIZE + 32; - static AxfxImpl* mCurrentFx; - static u32 mAllocatedSize; + public: + bool mIsActive; // 0x00 + MEMHeapHandle mHeap; // 0x04 + u32 mAllocCount; // 0x08 + + static AxfxImpl* mCurrentFx; + static u32 mAllocatedSize; }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_AXFX_IMPL_H +#endif // NW4R_SND_AXFX_IMPL_H diff --git a/libs/NW4R/include/nw4r/snd/Bank.h b/libs/NW4R/include/nw4r/snd/Bank.h index 47021ad0..ea68e858 100644 --- a/libs/NW4R/include/nw4r/snd/Bank.h +++ b/libs/NW4R/include/nw4r/snd/Bank.h @@ -9,20 +9,20 @@ namespace nw4r { namespace detail { class Channel; class Bank { - public: - explicit Bank(const void* bankData); - ~Bank(); + public: + explicit Bank(const void* bankData); + ~Bank(); - Channel* NoteOn(const NoteOnInfo& noteOnInfo) const; + Channel* NoteOn(const NoteOnInfo& noteOnInfo) const; - void SetWaveDataAddress(const void* waveData) { mWaveDataAddress = waveData; } + void SetWaveDataAddress(const void* waveData) { mWaveDataAddress = waveData; } - private: - BankFileReader mBankReader; // 0x00 - const void* mWaveDataAddress; // 0x0C + private: + BankFileReader mBankReader; // 0x00 + const void* mWaveDataAddress; // 0x0C }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_BANK_H +#endif // NW4R_SND_BANK_H diff --git a/libs/NW4R/include/nw4r/snd/BankFile.h b/libs/NW4R/include/nw4r/snd/BankFile.h index 5268ffdc..f161548b 100644 --- a/libs/NW4R/include/nw4r/snd/BankFile.h +++ b/libs/NW4R/include/nw4r/snd/BankFile.h @@ -1,8 +1,8 @@ #ifndef NW4R_SND_BANK_FILE_H #define NW4R_SND_BANK_FILE_H -#include #include +#include #include @@ -17,30 +17,30 @@ namespace nw4r { namespace BankFile { typedef struct InstParam { - s32 waveIndex; // 0x00 + s32 waveIndex; // 0x00 - u8 attack; // 0x04 - u8 decay; // 0x05 - u8 sustain; // 0x06 - u8 release; // 0x07 - u16 hold; // 0x08 - u16 padding; // 0x0A - u8 originalKey; // 0x0C - u8 volume; // 0x0D - u8 pan; // 0x0E - u8 padding2; // 0x0F - f32 tune; // 0x10 + u8 attack; // 0x04 + u8 decay; // 0x05 + u8 sustain; // 0x06 + u8 release; // 0x07 + u16 hold; // 0x08 + u16 padding; // 0x0A + u8 originalKey; // 0x0C + u8 volume; // 0x0D + u8 pan; // 0x0E + u8 padding2; // 0x0F + f32 tune; // 0x10 - Util::DataRef lfoTableRef; // 0x14 - Util::DataRef graphEnvTablevRef; // 0x1C - Util::DataRef randomizerTableRef; // 0x24 + Util::DataRef lfoTableRef; // 0x14 + Util::DataRef graphEnvTablevRef; // 0x1C + Util::DataRef randomizerTableRef; // 0x24 - u32 reserved; // 0x2C + u32 reserved; // 0x2C } InstParam; typedef struct RangeTable { - u8 tableSize; // 0x00 - u8 key[]; // 0x01 + u8 tableSize; // 0x00 + u8 key[]; // 0x01 } RangeTable; typedef struct IndexTable IndexTable; @@ -49,68 +49,68 @@ namespace nw4r { typedef Util::DataRef WaveRegion; struct IndexTable { - u8 min; // 0x00 - u8 max; // 0x01 - u16 reserved; // 0x02 - DataRegion ref[]; // 0x04 + u8 min; // 0x00 + u8 max; // 0x01 + u16 reserved; // 0x02 + DataRegion ref[]; // 0x04 }; typedef struct Header { - ut::BinaryFileHeader fileHeader; // 0x00 + ut::BinaryFileHeader fileHeader; // 0x00 - u32 dataBlockOffset; // 0x10 - u32 dataBlockSize; // 0x14 - u32 waveBlockOffset; // 0x18 - u32 waveBlockSize; // 0x1C + u32 dataBlockOffset; // 0x10 + u32 dataBlockSize; // 0x14 + u32 waveBlockOffset; // 0x18 + u32 waveBlockSize; // 0x1C } Header; typedef struct DataBlock { - ut::BinaryBlockHeader blockHeader; // 0x00 - Util::Table instTable; // 0x08 + ut::BinaryBlockHeader blockHeader; // 0x00 + Util::Table instTable; // 0x08 } DataBlock; typedef struct WaveBlock { - ut::BinaryBlockHeader blockHeader; // 0x00 + ut::BinaryBlockHeader blockHeader; // 0x00 Util::Table waveInfoTable; // 0x08 } WaveBlock; - } + } // namespace BankFile typedef struct InstInfo { - s32 waveIndex; // 0x00 - u8 attack; // 0x04 - u8 decay; // 0x05 - u8 sustain; // 0x06 - u8 release; // 0x07 - u8 originalKey; // 0x08 - u8 pan; // 0x09 - u8 volume; // 0x0A - f32 tune; // 0x0C + s32 waveIndex; // 0x00 + u8 attack; // 0x04 + u8 decay; // 0x05 + u8 sustain; // 0x06 + u8 release; // 0x07 + u8 originalKey; // 0x08 + u8 pan; // 0x09 + u8 volume; // 0x0A + f32 tune; // 0x0C } InstInfo; class BankFileReader { - public: - static const u32 SIGNATURE = 'RBNK'; - static const int VERSION = NW4R_VERSION(1, 1); + public: + static const u32 SIGNATURE = 'RBNK'; + static const int VERSION = NW4R_VERSION(1, 1); - public: - explicit BankFileReader(const void* bankData); + public: + explicit BankFileReader(const void* bankData); - bool IsValidFileHeader(const void* bankData); + bool IsValidFileHeader(const void* bankData); - bool ReadInstInfo(InstInfo* instInfo, int prgNo, int key, int velocity) const; - bool ReadWaveParam(WaveData* waveData, int waveIndex, const void* waveDataAddress) const; + bool ReadInstInfo(InstInfo* instInfo, int prgNo, int key, int velocity) const; + bool ReadWaveParam(WaveData* waveData, int waveIndex, const void* waveDataAddress) const; - private: - const BankFile::DataRegion* GetReferenceToSubRegion(const BankFile::DataRegion* ref, int splitKey) const; + private: + const BankFile::DataRegion* GetReferenceToSubRegion(const BankFile::DataRegion* ref, int splitKey) const; - private: - const BankFile::Header* mHeader; // 0x00 - const BankFile::DataBlock* mDataBlock; // 0x04 - const BankFile::WaveBlock* mWaveBlock; // 0x08 + private: + const BankFile::Header* mHeader; // 0x00 + const BankFile::DataBlock* mDataBlock; // 0x04 + const BankFile::WaveBlock* mWaveBlock; // 0x08 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_BANK_FILE_H +#endif // NW4R_SND_BANK_FILE_H diff --git a/libs/NW4R/include/nw4r/snd/BasicPlayer.h b/libs/NW4R/include/nw4r/snd/BasicPlayer.h index 164759b7..fff7bda2 100644 --- a/libs/NW4R/include/nw4r/snd/BasicPlayer.h +++ b/libs/NW4R/include/nw4r/snd/BasicPlayer.h @@ -9,54 +9,54 @@ namespace nw4r { namespace snd { namespace detail { class BasicPlayer { - public: - BasicPlayer() : mId(-1) {} - virtual ~BasicPlayer() {} // 0x08 + public: + BasicPlayer() : mId(-1) {} + virtual ~BasicPlayer() {} // 0x08 - virtual bool Start() = 0; // 0x0C - virtual void Stop() = 0; // 0x10 - virtual void Pause(bool flag) = 0; // 0x14 - virtual bool IsActive() const = 0; // 0x18 - virtual bool IsPrepared() const = 0; // 0x1C - virtual bool IsStarted() const = 0; // 0x20 - virtual bool IsPause() const = 0; // 0x24 - virtual void SetVolume(f32 volume) = 0; // 0x28 - virtual void SetPitch(f32 pitch) = 0; // 0x2C - virtual void SetPan(f32 pan) = 0; // 0x30 - virtual void SetSurroundPan(f32 surroundPan) = 0; // 0x34 - virtual void SetPan2(f32 pan2) = 0; // 0x38 - virtual void SetSurroundPan2(f32 surroundPan2) = 0; // 0x3C - virtual void SetLpfFreq(f32 lpfFreq) = 0; // 0x40 - virtual f32 GetVolume() const = 0; // 0x44 - virtual f32 GetPitch() const = 0; // 0x48 - virtual f32 GetPan() const = 0; // 0x4C - virtual f32 GetSurroundPan() const = 0; // 0x50 - virtual f32 GetPan2() const = 0; // 0x54 - virtual f32 GetSurroundPan2() const = 0; // 0x58 - virtual f32 GetLpfFreq() const = 0; // 0x5C - virtual void SetOutputLine(int lineFlag) = 0; // 0x60 - virtual void SetMainOutVolume(f32 volume) = 0; // 0x64 - virtual void SetMainSend(f32 send) = 0; // 0x68 - virtual void SetFxSend(AuxBus bus, f32 send) = 0; // 0x6C - virtual void SetRemoteOutVolume(int remoteIndex, f32 volume) = 0; // 0x70 - virtual void SetRemoteSend(int remoteIndex, f32 send) = 0; // 0x74 - virtual void SetRemoteFxSend(int remoteIndex, f32 send) = 0; // 0x78 - virtual int GetOutputLine() const = 0; // 0x7C - virtual f32 GetMainOutVolume() const = 0; // 0x80 - virtual f32 GetMainSend() const = 0; // 0x84 - virtual f32 GetFxSend(AuxBus bus) const = 0; // 0x88 - virtual f32 GetRemoteOutVolume(int remoteIndex) const = 0; // 0x8C - virtual f32 GetRemoteSend(int remoteIndex) const = 0; // 0x90 - virtual f32 GetRemoteFxSend(int remoteIndex) const = 0; // 0x94 + virtual bool Start() = 0; // 0x0C + virtual void Stop() = 0; // 0x10 + virtual void Pause(bool flag) = 0; // 0x14 + virtual bool IsActive() const = 0; // 0x18 + virtual bool IsPrepared() const = 0; // 0x1C + virtual bool IsStarted() const = 0; // 0x20 + virtual bool IsPause() const = 0; // 0x24 + virtual void SetVolume(f32 volume) = 0; // 0x28 + virtual void SetPitch(f32 pitch) = 0; // 0x2C + virtual void SetPan(f32 pan) = 0; // 0x30 + virtual void SetSurroundPan(f32 surroundPan) = 0; // 0x34 + virtual void SetPan2(f32 pan2) = 0; // 0x38 + virtual void SetSurroundPan2(f32 surroundPan2) = 0; // 0x3C + virtual void SetLpfFreq(f32 lpfFreq) = 0; // 0x40 + virtual f32 GetVolume() const = 0; // 0x44 + virtual f32 GetPitch() const = 0; // 0x48 + virtual f32 GetPan() const = 0; // 0x4C + virtual f32 GetSurroundPan() const = 0; // 0x50 + virtual f32 GetPan2() const = 0; // 0x54 + virtual f32 GetSurroundPan2() const = 0; // 0x58 + virtual f32 GetLpfFreq() const = 0; // 0x5C + virtual void SetOutputLine(int lineFlag) = 0; // 0x60 + virtual void SetMainOutVolume(f32 volume) = 0; // 0x64 + virtual void SetMainSend(f32 send) = 0; // 0x68 + virtual void SetFxSend(AuxBus bus, f32 send) = 0; // 0x6C + virtual void SetRemoteOutVolume(int remoteIndex, f32 volume) = 0; // 0x70 + virtual void SetRemoteSend(int remoteIndex, f32 send) = 0; // 0x74 + virtual void SetRemoteFxSend(int remoteIndex, f32 send) = 0; // 0x78 + virtual int GetOutputLine() const = 0; // 0x7C + virtual f32 GetMainOutVolume() const = 0; // 0x80 + virtual f32 GetMainSend() const = 0; // 0x84 + virtual f32 GetFxSend(AuxBus bus) const = 0; // 0x88 + virtual f32 GetRemoteOutVolume(int remoteIndex) const = 0; // 0x8C + virtual f32 GetRemoteSend(int remoteIndex) const = 0; // 0x90 + virtual f32 GetRemoteFxSend(int remoteIndex) const = 0; // 0x94 - u32 GetId() const { return mId; } - void SetId(u32 id) { mId = id; } + u32 GetId() const { return mId; } + void SetId(u32 id) { mId = id; } - private: - u32 mId; // 0x04 + private: + u32 mId; // 0x04 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_BASIC_PLAYER_H +#endif // NW4R_SND_BASIC_PLAYER_H diff --git a/libs/NW4R/include/nw4r/snd/BasicSound.h b/libs/NW4R/include/nw4r/snd/BasicSound.h index 96dfcb9e..2afd7437 100644 --- a/libs/NW4R/include/nw4r/snd/BasicSound.h +++ b/libs/NW4R/include/nw4r/snd/BasicSound.h @@ -1,8 +1,8 @@ #ifndef NW4R_SND_BASIC_SOUND_H #define NW4R_SND_BASIC_SOUND_H -#include #include +#include #include @@ -20,185 +20,183 @@ namespace nw4r { class BasicPlayer; class ExternalSoundPlayer; class PlayerHeap; - } + } // namespace detail namespace detail { class BasicSound { - public: - NW4R_UT_RUNTIME_TYPEINFO; + public: + NW4R_UT_RUNTIME_TYPEINFO; - typedef struct AmbientParamUpdateCallback { - typedef enum ParamUpdateFlags { - PARAM_UPDATE_VOLUME = (1 << 0), - PARAM_UPDATE_PAN = (1 << 1), - PARAM_UPDATE_SURROUND_PAN = (1 << 2), - PARAM_UPDATE_PRIORITY = (1 << 3), - } ParamUpdateFlags; + typedef struct AmbientParamUpdateCallback { + typedef enum ParamUpdateFlags { + PARAM_UPDATE_VOLUME = (1 << 0), + PARAM_UPDATE_PAN = (1 << 1), + PARAM_UPDATE_SURROUND_PAN = (1 << 2), + PARAM_UPDATE_PRIORITY = (1 << 3), + } ParamUpdateFlags; - virtual void detail_Update(SoundParam* param, u32 id, BasicSound* sound, const void* arg, u32 flags) = 0; // 0x0C - } AmbientParamUpdateCallback; + virtual void detail_Update(SoundParam* param, u32 id, BasicSound* sound, const void* arg, u32 flags) = 0; // 0x0C + } AmbientParamUpdateCallback; - typedef struct AmbientArgUpdateCallback { - virtual void detail_Update(void* arg, const BasicSound* sound) = 0; // 0x0C - } AmbientArgUpdateCallback; + typedef struct AmbientArgUpdateCallback { + virtual void detail_Update(void* arg, const BasicSound* sound) = 0; // 0x0C + } AmbientArgUpdateCallback; - typedef struct AmbientArgAllocaterCallback { - virtual void* detail_AllocAmbientArg(u32 size) = 0; // 0x0C - virtual void detail_FreeAmbientArg(void* arg, const BasicSound* sound) = 0; // 0x10 - } AmbientArgAllocaterCallback; + typedef struct AmbientArgAllocaterCallback { + virtual void* detail_AllocAmbientArg(u32 size) = 0; // 0x0C + virtual void detail_FreeAmbientArg(void* arg, const BasicSound* sound) = 0; // 0x10 + } AmbientArgAllocaterCallback; - typedef struct AmbientArgInfo { - AmbientParamUpdateCallback* paramUpdateCallback; // 0x00 - AmbientArgUpdateCallback* argUpdateCallback; // 0x04 - AmbientArgAllocaterCallback* argAllocaterCallback; // 0x08 - void* arg; // 0x0C - u32 argSize; // 0x10 - } AmbientArgInfo; + typedef struct AmbientArgInfo { + AmbientParamUpdateCallback* paramUpdateCallback; // 0x00 + AmbientArgUpdateCallback* argUpdateCallback; // 0x04 + AmbientArgAllocaterCallback* argAllocaterCallback; // 0x08 + void* arg; // 0x0C + u32 argSize; // 0x10 + } AmbientArgInfo; - static const u32 INVALID_ID = 0xFFFFFFFF; - static const int PRIORITY_MAX = 127; + static const u32 INVALID_ID = 0xFFFFFFFF; + static const int PRIORITY_MAX = 127; - public: - BasicSound(); - virtual ~BasicSound() {} // 0x08 + public: + BasicSound(); + virtual ~BasicSound() {} // 0x08 - virtual void Update(); // 0x0C - virtual void StartPrepared(); // 0x10 - virtual void Stop(int frames = 0); // 0x14 - virtual void Pause(bool flag, int frames); // 0x18 - virtual void SetAutoStopCounter(int count); // 0x1C - virtual void FadeIn(int frames); // 0x20 - virtual void Shutdown(); // 0x24 - virtual bool IsPrepared() const; // 0x28 - virtual bool IsPause() const; // 0x2C + virtual void Update(); // 0x0C + virtual void StartPrepared(); // 0x10 + virtual void Stop(int frames = 0); // 0x14 + virtual void Pause(bool flag, int frames); // 0x18 + virtual void SetAutoStopCounter(int count); // 0x1C + virtual void FadeIn(int frames); // 0x20 + virtual void Shutdown(); // 0x24 + virtual bool IsPrepared() const; // 0x28 + virtual bool IsPause() const; // 0x2C - virtual void SetInitialVolume(f32 volume); // 0x30 - virtual void SetVolume(f32 volume, int frames); // 0x34 - virtual void SetPitch(f32 pitch); // 0x38 - virtual void SetPan(f32 pan); // 0x3C - virtual void SetSurroundPan(f32 pan); // 0x40 - virtual void SetLpfFreq(f32 freq); // 0x44 - virtual void SetPlayerPriority(int priority); // 0x48 + virtual void SetInitialVolume(f32 volume); // 0x30 + virtual void SetVolume(f32 volume, int frames); // 0x34 + virtual void SetPitch(f32 pitch); // 0x38 + virtual void SetPan(f32 pan); // 0x3C + virtual void SetSurroundPan(f32 pan); // 0x40 + virtual void SetLpfFreq(f32 freq); // 0x44 + virtual void SetPlayerPriority(int priority); // 0x48 - virtual bool IsAttachedTempSpecialHandle() = 0; // 0x4C - virtual void DetachTempSpecialHandle() = 0; // 0x50 + virtual bool IsAttachedTempSpecialHandle() = 0; // 0x4C + virtual void DetachTempSpecialHandle() = 0; // 0x50 - virtual void InitParam(); // 0x54 - virtual BasicPlayer& GetBasicPlayer() = 0; // 0x58 - virtual const BasicPlayer& GetBasicPlayer() const = 0; // 0x5C + virtual void InitParam(); // 0x54 + virtual BasicPlayer& GetBasicPlayer() = 0; // 0x58 + virtual const BasicPlayer& GetBasicPlayer() const = 0; // 0x5C - PlayerHeap* GetPlayerHeap() { return mHeap; } - void SetPlayerHeap(PlayerHeap* heap) { mHeap = heap; } + PlayerHeap* GetPlayerHeap() { return mHeap; } + void SetPlayerHeap(PlayerHeap* heap) { mHeap = heap; } - bool IsAttachedGeneralHandle(); - void DetachGeneralHandle(); + bool IsAttachedGeneralHandle(); + void DetachGeneralHandle(); - bool IsAttachedTempGeneralHandle(); - void DetachTempGeneralHandle(); + bool IsAttachedTempGeneralHandle(); + void DetachTempGeneralHandle(); - SoundPlayer* GetSoundPlayer() { return mSoundPlayer; } - void SetSoundPlayer(SoundPlayer* player) { mSoundPlayer = player; } + SoundPlayer* GetSoundPlayer() { return mSoundPlayer; } + void SetSoundPlayer(SoundPlayer* player) { mSoundPlayer = player; } - ExternalSoundPlayer* GetExternalSoundPlayer() { return mExtSoundPlayer; } - void SetExternalSoundPlayer(ExternalSoundPlayer* extPlayer) { mExtSoundPlayer = extPlayer; } + ExternalSoundPlayer* GetExternalSoundPlayer() { return mExtSoundPlayer; } + void SetExternalSoundPlayer(ExternalSoundPlayer* extPlayer) { mExtSoundPlayer = extPlayer; } - AmbientParamUpdateCallback* GetAmbientParamUpdateCallback() { return mAmbientParamUpdateCallback; } - AmbientArgUpdateCallback* GetAmbientArgUpdateCallback() { return mAmbientArgUpdateCallback; } - void ClearAmbientArgUpdateCallback() { mAmbientArgUpdateCallback = NULL; } + AmbientParamUpdateCallback* GetAmbientParamUpdateCallback() { return mAmbientParamUpdateCallback; } + AmbientArgUpdateCallback* GetAmbientArgUpdateCallback() { return mAmbientArgUpdateCallback; } + void ClearAmbientArgUpdateCallback() { mAmbientArgUpdateCallback = NULL; } - AmbientArgAllocaterCallback* GetAmbientArgAllocaterCallback() { return mAmbientArgAllocaterCallback; } + AmbientArgAllocaterCallback* GetAmbientArgAllocaterCallback() { return mAmbientArgAllocaterCallback; } - void* GetAmbientArg() { return mAmbientArg; } - SoundParam& GetAmbientParam() { return mAmbientParam; } + void* GetAmbientArg() { return mAmbientArg; } + SoundParam& GetAmbientParam() { return mAmbientParam; } - void SetAmbientParamCallback(AmbientParamUpdateCallback* paramUpdateCallback, - AmbientArgUpdateCallback* argUpdateCallback, - AmbientArgAllocaterCallback* argAllocaterCallback, - void* callbackArg); + void SetAmbientParamCallback(AmbientParamUpdateCallback* paramUpdateCallback, AmbientArgUpdateCallback* argUpdateCallback, + AmbientArgAllocaterCallback* argAllocaterCallback, void* callbackArg); - void SetPriority(int priority) { mPriority = priority; } + void SetPriority(int priority) { mPriority = priority; } - u32 GetId() const { return mId; } - void SetId(u32 id); + u32 GetId() const { return mId; } + void SetId(u32 id); - f32 GetMoveVolume() { return mExtMoveVolume.GetValue(); } + f32 GetMoveVolume() { return mExtMoveVolume.GetValue(); } - f32 GetInitialVolume() const; - f32 GetPan() const; - f32 GetSurroundPan() const; - f32 GetPitch() const; - f32 GetVolume() const; + f32 GetInitialVolume() const; + f32 GetPan() const; + f32 GetSurroundPan() const; + f32 GetPitch() const; + f32 GetVolume() const; - void SetOutputLine(int flag); - bool IsEnabledOutputLine() const; - int GetOutputLine() const; + void SetOutputLine(int flag); + bool IsEnabledOutputLine() const; + int GetOutputLine() const; - f32 GetMainOutVolume() const; - void SetMainOutVolume(f32 volume); + f32 GetMainOutVolume() const; + void SetMainOutVolume(f32 volume); - f32 GetRemoteOutVolume(int remote) const; - void SetRemoteOutVolume(int remote, f32 volume); + f32 GetRemoteOutVolume(int remote) const; + void SetRemoteOutVolume(int remote, f32 volume); - void SetFxSend(AuxBus bus, f32 send); + void SetFxSend(AuxBus bus, f32 send); - int CalcCurrentPlayerPriority() const { return ut::Clamp(mPriority + mAmbientParam.priority, (s32)0, (s32)PRIORITY_MAX); } + int CalcCurrentPlayerPriority() const { return ut::Clamp(mPriority + mAmbientParam.priority, (s32)0, (s32)PRIORITY_MAX); } - private: - PlayerHeap* mHeap; // 0x04 - SoundHandle* mGeneralHandle; // 0x08 - SoundHandle* mTempGeneralHandle; // 0x0C - SoundPlayer* mSoundPlayer; // 0x10 - ExternalSoundPlayer* mExtSoundPlayer; // 0x14 + private: + PlayerHeap* mHeap; // 0x04 + SoundHandle* mGeneralHandle; // 0x08 + SoundHandle* mTempGeneralHandle; // 0x0C + SoundPlayer* mSoundPlayer; // 0x10 + ExternalSoundPlayer* mExtSoundPlayer; // 0x14 - AmbientParamUpdateCallback* mAmbientParamUpdateCallback; // 0x18 - AmbientArgUpdateCallback* mAmbientArgUpdateCallback; // 0x1C - AmbientArgAllocaterCallback* mAmbientArgAllocaterCallback; // 0x20 - void* mAmbientArg; // 0x24 - SoundParam mAmbientParam; // 0x28 + AmbientParamUpdateCallback* mAmbientParamUpdateCallback; // 0x18 + AmbientArgUpdateCallback* mAmbientArgUpdateCallback; // 0x1C + AmbientArgAllocaterCallback* mAmbientArgAllocaterCallback; // 0x20 + void* mAmbientArg; // 0x24 + SoundParam mAmbientParam; // 0x28 - MoveValue mFadeVolume; // 0x44 - MoveValue mPauseFadeVolume; // 0x54 + MoveValue mFadeVolume; // 0x44 + MoveValue mPauseFadeVolume; // 0x54 - bool mStartFlag; // 0x64 - bool mStartedFlag; // 0x65 - bool mAutoStopFlag; // 0x66 - bool mPauseFlag; // 0x67 - bool mPauseFadeFlag; // 0x68 - bool mFadeOutFlag; // 0x69 + bool mStartFlag; // 0x64 + bool mStartedFlag; // 0x65 + bool mAutoStopFlag; // 0x66 + bool mPauseFlag; // 0x67 + bool mPauseFadeFlag; // 0x68 + bool mFadeOutFlag; // 0x69 - int mAutoStopCounter; // 0x6C - u32 mUpdateCounter; // 0x70 + int mAutoStopCounter; // 0x6C + u32 mUpdateCounter; // 0x70 - u8 mPriority; // 0x74 - u32 mId; // 0x78 + u8 mPriority; // 0x74 + u32 mId; // 0x78 - MoveValue mExtMoveVolume; // 0x7C - f32 mInitVolume; // 0x8C - f32 mExtPan; // 0x90 - f32 mExtSurroundPan; // 0x94 - f32 mExtPitch; // 0x98 + MoveValue mExtMoveVolume; // 0x7C + f32 mInitVolume; // 0x8C + f32 mExtPan; // 0x90 + f32 mExtSurroundPan; // 0x94 + f32 mExtPitch; // 0x98 - bool mOutputLineFlagEnable; // 0x9C - int mOutputLineFlag; // 0xA0 + bool mOutputLineFlagEnable; // 0x9C + int mOutputLineFlag; // 0xA0 - f32 mMainOutVolume; // 0xA4 - f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // 0xA8 + f32 mMainOutVolume; // 0xA4 + f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // 0xA8 + + public: + ut::LinkListNode mPriorityLink; // 0xB8 + ut::LinkListNode mSoundPlayerPlayLink; // 0xC0 + ut::LinkListNode mSoundPlayerPriorityLink; // 0xC8 + ut::LinkListNode mExtSoundPlayerPlayLink; // 0xD0 - public: - ut::LinkListNode mPriorityLink; // 0xB8 - ut::LinkListNode mSoundPlayerPlayLink; // 0xC0 - ut::LinkListNode mSoundPlayerPriorityLink; // 0xC8 - ut::LinkListNode mExtSoundPlayerPlayLink; // 0xD0 - friend class SoundHandle; }; - typedef ut::LinkList BasicSoundPrioList; - typedef ut::LinkList BasicSoundPlayerPlayList; - typedef ut::LinkList BasicSoundPlayerPrioList; - typedef ut::LinkList BasicSoundExtPlayList; - } - } -} + typedef ut::LinkList BasicSoundPrioList; + typedef ut::LinkList BasicSoundPlayerPlayList; + typedef ut::LinkList BasicSoundPlayerPrioList; + typedef ut::LinkList BasicSoundExtPlayList; + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_BASIC_SOUND_H +#endif // NW4R_SND_BASIC_SOUND_H diff --git a/libs/NW4R/include/nw4r/snd/Channel.h b/libs/NW4R/include/nw4r/snd/Channel.h index 9861f108..880c68a5 100644 --- a/libs/NW4R/include/nw4r/snd/Channel.h +++ b/libs/NW4R/include/nw4r/snd/Channel.h @@ -3,11 +3,11 @@ #include +#include #include #include #include #include -#include #include @@ -15,157 +15,153 @@ namespace nw4r { namespace snd { namespace detail { class Channel : public LinkedInstance { - public: - typedef enum ChannelCallbackStatus { - CALLBACK_STATUS_STOPPED = 0, - CALLBACK_STATUS_DROP, - CALLBACK_STATUS_FINISH, - CALLBACK_STATUS_CANCEL - } ChannelCallbackStatus; + public: + typedef enum ChannelCallbackStatus { + CALLBACK_STATUS_STOPPED = 0, + CALLBACK_STATUS_DROP, + CALLBACK_STATUS_FINISH, + CALLBACK_STATUS_CANCEL + } ChannelCallbackStatus; - typedef void (*ChannelCallback)(Channel* dropChannel, ChannelCallbackStatus status, u32 callbackArg); + typedef void (*ChannelCallback)(Channel* dropChannel, ChannelCallbackStatus status, u32 callbackArg); - typedef enum LfoTarget { - LFO_TARGET_PITCH = 0, - LFO_TARGET_VOLUME, - LFO_TARGET_PAN - } LfoTarget; + typedef enum LfoTarget { LFO_TARGET_PITCH = 0, LFO_TARGET_VOLUME, LFO_TARGET_PAN } LfoTarget; - public: - Channel(); - ~Channel(); + public: + Channel(); + ~Channel(); - void InitParam(ChannelCallback callback, u32 callbackArg); - void Update(bool doPeriodicProc); - void Start(const WaveData& waveData, s32 length); - void Release(); - void Stop(); + void InitParam(ChannelCallback callback, u32 callbackArg); + void Update(bool doPeriodicProc); + void Start(const WaveData& waveData, s32 length); + void Release(); + void Stop(); - void SetAttack(int attack) { mEnvelope.SetAttack(attack); } - void SetDecay(int decay) { mEnvelope.SetDecay(decay); } - void SetSustain(int sustain) { mEnvelope.SetSustain(sustain); } + void SetAttack(int attack) { mEnvelope.SetAttack(attack); } + void SetDecay(int decay) { mEnvelope.SetDecay(decay); } + void SetSustain(int sustain) { mEnvelope.SetSustain(sustain); } - void SetRelease(int release) { mEnvelope.SetRelease(release); } - bool IsRelease() const { return mEnvelope.GetStatus() == EnvGenerator::STATUS_RELEASE; } + void SetRelease(int release) { mEnvelope.SetRelease(release); } + bool IsRelease() const { return mEnvelope.GetStatus() == EnvGenerator::STATUS_RELEASE; } - void SetLfoParam(const LfoParam& rParam) { mLfo.SetParam(rParam); } - void SetLfoTarget(LfoTarget target) { mLfoTarget = target; } + void SetLfoParam(const LfoParam& rParam) { mLfo.SetParam(rParam); } + void SetLfoTarget(LfoTarget target) { mLfoTarget = target; } - void Pause(bool pause) { - mPauseFlag = pause; - mVoice->Pause(pause); - } + void Pause(bool pause) { + mPauseFlag = pause; + mVoice->Pause(pause); + } - bool IsPause() const { return mPauseFlag != false; } - bool IsActive() const { return mActiveFlag; } - bool IsAutoUpdateSweep() const { return mAutoSweep; } + bool IsPause() const { return mPauseFlag != false; } + bool IsActive() const { return mActiveFlag; } + bool IsAutoUpdateSweep() const { return mAutoSweep; } - void SetUserVolume(f32 volume) { mUserVolume = volume; } - void SetUserPitch(f32 pitch) { mUserPitch = pitch; } - void SetUserPitchRatio(f32 ratio) { mUserPitchRatio = ratio; } - void SetUserPan(f32 pan) { mUserPan = pan; } - void SetUserSurroundPan(f32 pan) { mUserSurroundPan = pan; } - void SetUserPan2(f32 pan2) { mUserPan2 = pan2; } - void SetUserSurroundPan2(f32 pan2) { mUserSurroundPan2 = pan2; } - void SetUserLpfFreq(f32 freq) { mUserLpfFreq = freq; } + void SetUserVolume(f32 volume) { mUserVolume = volume; } + void SetUserPitch(f32 pitch) { mUserPitch = pitch; } + void SetUserPitchRatio(f32 ratio) { mUserPitchRatio = ratio; } + void SetUserPan(f32 pan) { mUserPan = pan; } + void SetUserSurroundPan(f32 pan) { mUserSurroundPan = pan; } + void SetUserPan2(f32 pan2) { mUserPan2 = pan2; } + void SetUserSurroundPan2(f32 pan2) { mUserSurroundPan2 = pan2; } + void SetUserLpfFreq(f32 freq) { mUserLpfFreq = freq; } - void SetOutputLine(int flag) { mOutputLineFlag = flag; } + void SetOutputLine(int flag) { mOutputLineFlag = flag; } - void SetMainOutVolume(f32 volume) { mMainOutVolume = volume; } - void SetMainSend(f32 send) { mMainSend = send; } - void SetFxSend(AuxBus bus, f32 send) { mFxSend[bus] = send; } + void SetMainOutVolume(f32 volume) { mMainOutVolume = volume; } + void SetMainSend(f32 send) { mMainSend = send; } + void SetFxSend(AuxBus bus, f32 send) { mFxSend[bus] = send; } - void SetRemoteOutVolume(int remote, f32 volume) { mRemoteOutVolume[remote] = volume; } - void SetRemoteSend(int remote, f32 send) { mRemoteSend[remote] = send; } - void SetRemoteFxSend(int remote, f32 send) { mRemoteFxSend[remote] = send; } + void SetRemoteOutVolume(int remote, f32 volume) { mRemoteOutVolume[remote] = volume; } + void SetRemoteSend(int remote, f32 send) { mRemoteSend[remote] = send; } + void SetRemoteFxSend(int remote, f32 send) { mRemoteFxSend[remote] = send; } - void UpdateSweep(int count); - void SetSweepParam(f32 pitch, int time, bool autoUpdate); - f32 GetSweepValue() const; + void UpdateSweep(int count); + void SetSweepParam(f32 pitch, int time, bool autoUpdate); + f32 GetSweepValue() const; - void SetInitVolume(f32 volume) { mInitVolume = volume; } - void SetInitPan(f32 pan) { mInitPan = pan; } - void SetInitSurroundPan(f32 pan) { mInitSurroundPan = pan; } - void SetTune(f32 tune) { mTune = tune; } - void SetSilence(bool silence, int fadeTime) { mSilenceVolume.SetTarget(silence ? 0 : SILENCE_VOLUME_MAX, fadeTime); } + void SetInitVolume(f32 volume) { mInitVolume = volume; } + void SetInitPan(f32 pan) { mInitPan = pan; } + void SetInitSurroundPan(f32 pan) { mInitSurroundPan = pan; } + void SetTune(f32 tune) { mTune = tune; } + void SetSilence(bool silence, int fadeTime) { mSilenceVolume.SetTarget(silence ? 0 : SILENCE_VOLUME_MAX, fadeTime); } - void SetKey(int key) { mKey = key; } - void SetOriginalKey(int key) { mOriginalKey = key; } + void SetKey(int key) { mKey = key; } + void SetOriginalKey(int key) { mOriginalKey = key; } - s32 GetLength() const { return mLength; } - void SetLength(s32 length) { mLength = length; } + s32 GetLength() const { return mLength; } + void SetLength(s32 length) { mLength = length; } - Channel* GetNextTrackChannel() const { return mNextLink; } - void SetNextTrackChannel(Channel* channel) { mNextLink = channel; } + Channel* GetNextTrackChannel() const { return mNextLink; } + void SetNextTrackChannel(Channel* channel) { mNextLink = channel; } - static void UpdateAllChannel(); - static Channel* AllocChannel(int channels, int voices, int priority, ChannelCallback pCallback, u32 callbackArg); - static void FreeChannel(Channel* channel); + static void UpdateAllChannel(); + static Channel* AllocChannel(int channels, int voices, int priority, ChannelCallback pCallback, u32 callbackArg); + static void FreeChannel(Channel* channel); - static void VoiceCallback(AxVoice* voice, AxVoice::CallbackStatus status, void* arg); + static void VoiceCallback(AxVoice* voice, AxVoice::CallbackStatus status, void* arg); - private: - static const u8 SILENCE_VOLUME_MAX = 255; + private: + static const u8 SILENCE_VOLUME_MAX = 255; - static const int KEY_INIT = 60; - static const int ORIGINAL_KEY_INIT = 60; + static const int KEY_INIT = 60; + static const int ORIGINAL_KEY_INIT = 60; - static const int PRIORITY_RELEASE = 1; + static const int PRIORITY_RELEASE = 1; - EnvGenerator mEnvelope; // 0x08 + EnvGenerator mEnvelope; // 0x08 - Lfo mLfo; // 0x20 - u8 mLfoTarget; // 0x38 + Lfo mLfo; // 0x20 + u8 mLfoTarget; // 0x38 - bool mPauseFlag; // 0x39 - bool mActiveFlag; // 0x3A - bool mAllocFlag; // 0x3B - bool mAutoSweep; // 0x3C + bool mPauseFlag; // 0x39 + bool mActiveFlag; // 0x3A + bool mAllocFlag; // 0x3B + bool mAutoSweep; // 0x3C - f32 mUserVolume; // 0x40 - f32 mUserPitchRatio; // 0x44 - f32 mUserPan; // 0x48 - f32 mUserSurroundPan; // 0x4C - f32 mUserPan2; // 0x50 - f32 mUserSurroundPan2; // 0x54 - f32 mUserLpfFreq; // 0x58 + f32 mUserVolume; // 0x40 + f32 mUserPitchRatio; // 0x44 + f32 mUserPan; // 0x48 + f32 mUserSurroundPan; // 0x4C + f32 mUserPan2; // 0x50 + f32 mUserSurroundPan2; // 0x54 + f32 mUserLpfFreq; // 0x58 - int mOutputLineFlag; // 0x5C + int mOutputLineFlag; // 0x5C - f32 mMainOutVolume; // 0x60 - f32 mMainSend; // 0x64 - f32 mFxSend[AUX_BUS_NUM]; // 0x68 + f32 mMainOutVolume; // 0x60 + f32 mMainSend; // 0x64 + f32 mFxSend[AUX_BUS_NUM]; // 0x68 - f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // 0x74 - f32 mRemoteSend[WPAD_MAX_CONTROLLERS]; // 0x84 - f32 mRemoteFxSend[WPAD_MAX_CONTROLLERS]; // 0x94 + f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // 0x74 + f32 mRemoteSend[WPAD_MAX_CONTROLLERS]; // 0x84 + f32 mRemoteFxSend[WPAD_MAX_CONTROLLERS]; // 0x94 - f32 mUserPitch; // 0xA4 + f32 mUserPitch; // 0xA4 - f32 mSweepPitch; // 0xA8 - s32 mSweepCounter; // 0xAC - s32 mSweepLength; // 0xB0 + f32 mSweepPitch; // 0xA8 + s32 mSweepCounter; // 0xAC + s32 mSweepLength; // 0xB0 - f32 mInitVolume; // 0xB4 - f32 mInitPan; // 0xB8 - f32 mInitSurroundPan; // 0xBC + f32 mInitVolume; // 0xB4 + f32 mInitPan; // 0xB8 + f32 mInitSurroundPan; // 0xBC - f32 mTune; // 0xC0 - MoveValue mSilenceVolume; // 0xC4 - int mKey; // 0xCC - int mOriginalKey; // 0xD0 - s32 mLength; // 0xD4 + f32 mTune; // 0xC0 + MoveValue mSilenceVolume; // 0xC4 + int mKey; // 0xCC + int mOriginalKey; // 0xD0 + s32 mLength; // 0xD4 - ChannelCallback mCallback; // 0xD8 - u32 mCallbackData; // 0xDC + ChannelCallback mCallback; // 0xD8 + u32 mCallbackData; // 0xDC - AxVoice* mVoice; // 0xE0 - Channel* mNextLink; // 0xE4 + AxVoice* mVoice; // 0xE0 + Channel* mNextLink; // 0xE4 - static Channel mChannel[AX_VOICE_MAX+1]; + static Channel mChannel[AX_VOICE_MAX + 1]; }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_CHANNEL_H +#endif // NW4R_SND_CHANNEL_H diff --git a/libs/NW4R/include/nw4r/snd/ChannelManager.h b/libs/NW4R/include/nw4r/snd/ChannelManager.h index d8e09ab0..3bab27a7 100644 --- a/libs/NW4R/include/nw4r/snd/ChannelManager.h +++ b/libs/NW4R/include/nw4r/snd/ChannelManager.h @@ -1,22 +1,22 @@ #ifndef NW4R_SND_CHANNEL_MANAGER_H #define NW4R_SND_CHANNEL_MANAGER_H -#include #include +#include namespace nw4r { namespace snd { namespace detail { class ChannelManager : public InstanceManager { - public: - static ChannelManager& GetInstance() { - static ChannelManager instance; - return instance; - } - ChannelManager() {} + public: + static ChannelManager& GetInstance() { + static ChannelManager instance; + return instance; + } + ChannelManager() {} }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_CHANNEL_MANAGER_H +#endif // NW4R_SND_CHANNEL_MANAGER_H diff --git a/libs/NW4R/include/nw4r/snd/DisposeCallback.h b/libs/NW4R/include/nw4r/snd/DisposeCallback.h index 5ff0f910..f837399e 100644 --- a/libs/NW4R/include/nw4r/snd/DisposeCallback.h +++ b/libs/NW4R/include/nw4r/snd/DisposeCallback.h @@ -7,17 +7,17 @@ namespace nw4r { namespace snd { namespace detail { class DisposeCallback { - public: - ut::LinkListNode mDisposeLink; // 0x00 + public: + ut::LinkListNode mDisposeLink; // 0x00 - virtual ~DisposeCallback() {} // 0x08 + virtual ~DisposeCallback() {} // 0x08 - virtual void InvalidateData(const void* start, const void* end) = 0; // 0x0C - virtual void InvalidateWaveData(const void* start, const void* end) = 0; // 0x10 + virtual void InvalidateData(const void* start, const void* end) = 0; // 0x0C + virtual void InvalidateWaveData(const void* start, const void* end) = 0; // 0x10 }; - typedef ut::LinkList DisposeCallbackList; - } - } -} + typedef ut::LinkList DisposeCallbackList; + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_DISPOSE_CALLBACK_H +#endif // NW4R_SND_DISPOSE_CALLBACK_H diff --git a/libs/NW4R/include/nw4r/snd/DisposeCallbackManager.h b/libs/NW4R/include/nw4r/snd/DisposeCallbackManager.h index cf6c860b..4575a120 100644 --- a/libs/NW4R/include/nw4r/snd/DisposeCallbackManager.h +++ b/libs/NW4R/include/nw4r/snd/DisposeCallbackManager.h @@ -7,22 +7,22 @@ namespace nw4r { namespace snd { namespace detail { class DisposeCallbackManager { - public: - static DisposeCallbackManager& GetInstance(); + public: + static DisposeCallbackManager& GetInstance(); - void RegisterDisposeCallback(DisposeCallback* callback); - void UnregisterDisposeCallback(DisposeCallback* callback); + void RegisterDisposeCallback(DisposeCallback* callback); + void UnregisterDisposeCallback(DisposeCallback* callback); - static void Dispose(void* mem, u32 size, void* arg); - static void DisposeWave(void* mem, u32 size, void* arg); + static void Dispose(void* mem, u32 size, void* arg); + static void DisposeWave(void* mem, u32 size, void* arg); - private: - DisposeCallbackManager(); + private: + DisposeCallbackManager(); - DisposeCallbackList mCallbackList; // 0x00 + DisposeCallbackList mCallbackList; // 0x00 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_DISPOSE_CALLBACK_MANAGER_H +#endif // NW4R_SND_DISPOSE_CALLBACK_MANAGER_H diff --git a/libs/NW4R/include/nw4r/snd/DvdSoundArchive.h b/libs/NW4R/include/nw4r/snd/DvdSoundArchive.h index 0e1691d3..895546f3 100644 --- a/libs/NW4R/include/nw4r/snd/DvdSoundArchive.h +++ b/libs/NW4R/include/nw4r/snd/DvdSoundArchive.h @@ -13,42 +13,41 @@ namespace nw4r { namespace snd { class DvdSoundArchive : public SoundArchive { - private: - class DvdFileStream; + private: + class DvdFileStream; - public: - DvdSoundArchive(); - virtual ~DvdSoundArchive(); // 0x08 + public: + DvdSoundArchive(); + virtual ~DvdSoundArchive(); // 0x08 - virtual const void* detail_GetFileAddress(u32 id) const { return NULL; } // 0x0C - virtual const void* detail_GetWaveDataFileAddress(u32 id) const { return NULL; } // 0x10 + virtual const void* detail_GetFileAddress(u32 id) const { return NULL; } // 0x0C + virtual const void* detail_GetWaveDataFileAddress(u32 id) const { return NULL; } // 0x10 - virtual int detail_GetRequiredStreamBufferSize() const; // 0x14 + virtual int detail_GetRequiredStreamBufferSize() const; // 0x14 - virtual ut::FileStream* OpenStream(void* buffer, int size, u32 offset, u32 length) const; // 0x18 - virtual ut::FileStream* OpenExtStream(void* buffer, int size, const char* extPath, u32 offset, u32 length) const; // 0x1C + virtual ut::FileStream* OpenStream(void* buffer, int size, u32 offset, u32 length) const; // 0x18 + virtual ut::FileStream* OpenExtStream(void* buffer, int size, const char* extPath, u32 offset, u32 length) const; // 0x1C - bool Open(s32 entrynum); - bool Open(const char* path); + bool Open(s32 entrynum); + bool Open(const char* path); - void Close(); + void Close(); - bool LoadHeader(void* buffer, u32 size); - bool LoadLabelStringData(void* buffer, u32 size); + bool LoadHeader(void* buffer, u32 size); + bool LoadLabelStringData(void* buffer, u32 size); - u32 GetHeaderSize() const { return mFileReader.GetInfoChunkSize(); } - u32 GetLabelStringDataSize() const { return mFileReader.GetLabelStringChunkSize(); } + u32 GetHeaderSize() const { return mFileReader.GetInfoChunkSize(); } + u32 GetLabelStringDataSize() const { return mFileReader.GetLabelStringChunkSize(); } - private: - bool LoadFileHeader(); + private: + bool LoadFileHeader(); - private: - detail::SoundArchiveFileReader mFileReader; // 0x108 - DVDFileInfo mFileInfo; // 0x14C - bool mOpen; // 0x188 - + private: + detail::SoundArchiveFileReader mFileReader; // 0x108 + DVDFileInfo mFileInfo; // 0x14C + bool mOpen; // 0x188 }; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_DVD_SOUND_ARCHIVE_H +#endif // NW4R_SND_DVD_SOUND_ARCHIVE_H diff --git a/libs/NW4R/include/nw4r/snd/EnvGenerator.h b/libs/NW4R/include/nw4r/snd/EnvGenerator.h index bcd986ab..cce7e9a1 100644 --- a/libs/NW4R/include/nw4r/snd/EnvGenerator.h +++ b/libs/NW4R/include/nw4r/snd/EnvGenerator.h @@ -7,54 +7,56 @@ namespace nw4r { namespace snd { namespace detail { class EnvGenerator { - public: - typedef enum Status { - STATUS_ATTACK = 0, - STATUS_DECAY, - STATUS_SUSTAIN, - STATUS_RELEASE - } Status; + public: + // clang-format off + typedef enum Status { + STATUS_ATTACK = 0, + STATUS_DECAY, + STATUS_SUSTAIN, + STATUS_RELEASE + } Status; + // clang-format on - EnvGenerator(); + EnvGenerator(); - void Init(); - void Reset(); - f32 GetValue() const; - void Update(int msec); + void Init(); + void Reset(); + f32 GetValue() const; + void Update(int msec); - Status GetStatus() const { return mStatus; } - void SetStatus(Status status) { mStatus = status; } + Status GetStatus() const { return mStatus; } + void SetStatus(Status status) { mStatus = status; } - void SetAttack(int attack); - void SetDecay(int decay); - void SetSustain(int sustain); - void SetRelease(int release); + void SetAttack(int attack); + void SetDecay(int decay); + void SetSustain(int sustain); + void SetRelease(int release); - private: - static const int DECIBEL_SQUARE_TABLE_SIZE = 128; + private: + static const int DECIBEL_SQUARE_TABLE_SIZE = 128; - static const vf32 VOLUME_INIT; - static const int ATTACK_INIT = 127; - static const int DECAY_INIT = 127; - static const int SUSTAIN_INIT = 127; - static const int RELEASE_INIT = 127; + static const vf32 VOLUME_INIT; + static const int ATTACK_INIT = 127; + static const int DECAY_INIT = 127; + static const int SUSTAIN_INIT = 127; + static const int RELEASE_INIT = 127; - private: - f32 CalcRelease(int release); - int CalcDecibelSquare(int scale); + private: + f32 CalcRelease(int release); + int CalcDecibelSquare(int scale); - Status mStatus; // 0x00 - f32 mValue; // 0x04 - f32 mDecay; // 0x08 - f32 mRelease; // 0x0C - f32 mAttack; // 0x10 - u8 mSustain; // 0x14 - u16 padding; + Status mStatus; // 0x00 + f32 mValue; // 0x04 + f32 mDecay; // 0x08 + f32 mRelease; // 0x0C + f32 mAttack; // 0x10 + u8 mSustain; // 0x14 + u16 padding; - static const s16 DecibelSquareTable[DECIBEL_SQUARE_TABLE_SIZE]; + static const s16 DecibelSquareTable[DECIBEL_SQUARE_TABLE_SIZE]; }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_ENV_GENERATOR_H +#endif // NW4R_SND_ENV_GENERATOR_H diff --git a/libs/NW4R/include/nw4r/snd/ExternalSoundPlayer.h b/libs/NW4R/include/nw4r/snd/ExternalSoundPlayer.h index 0f7ec5a3..732ef283 100644 --- a/libs/NW4R/include/nw4r/snd/ExternalSoundPlayer.h +++ b/libs/NW4R/include/nw4r/snd/ExternalSoundPlayer.h @@ -10,57 +10,56 @@ namespace nw4r { namespace snd { namespace detail { class ExternalSoundPlayer { - public: - ExternalSoundPlayer(); - ~ExternalSoundPlayer(); + public: + ExternalSoundPlayer(); + ~ExternalSoundPlayer(); - int GetPlayableSoundCount() const { return mPlayableCount; } - void SetPlayableSoundCount(int count); + int GetPlayableSoundCount() const { return mPlayableCount; } + void SetPlayableSoundCount(int count); - int GetPlayingSoundCount() const { return mSoundList.GetSize(); } + int GetPlayingSoundCount() const { return mSoundList.GetSize(); } - f32 detail_GetVolume() const { return mVolume; } - BasicSound* GetLowestPrioritySound(); + f32 detail_GetVolume() const { return mVolume; } + BasicSound* GetLowestPrioritySound(); - void InsertSoundList(BasicSound* sound); - void RemoveSoundList(BasicSound* sound); + void InsertSoundList(BasicSound* sound); + void RemoveSoundList(BasicSound* sound); - template - TForEachFunc ForEachSound(TForEachFunc func, bool reverse) { - if (reverse) { - BasicSoundExtPlayList::RevIterator it = mSoundList.GetBeginReverseIter(); + template + TForEachFunc ForEachSound(TForEachFunc func, bool reverse) { + if (reverse) { + BasicSoundExtPlayList::RevIterator it = mSoundList.GetBeginReverseIter(); - while (it != mSoundList.GetEndReverseIter()) { - BasicSoundExtPlayList::RevIterator curr = it; + while (it != mSoundList.GetEndReverseIter()) { + BasicSoundExtPlayList::RevIterator curr = it; - SoundHandle handle; - handle.detail_AttachSoundAsTempHandle(&*curr); - func(handle); + SoundHandle handle; + handle.detail_AttachSoundAsTempHandle(&*curr); + func(handle); - if (handle.IsAttachedSound()) { - it++; - } + if (handle.IsAttachedSound()) { + it++; } } - else { - for (BasicSoundExtPlayList::Iterator itr = mSoundList.GetBeginIter(); itr != mSoundList.GetEndIter();) { - BasicSoundExtPlayList::Iterator curr = itr++; - SoundHandle handle; - handle.detail_AttachSoundAsTempHandle(&*curr); - func(handle); - } + } else { + for (BasicSoundExtPlayList::Iterator itr = mSoundList.GetBeginIter(); itr != mSoundList.GetEndIter();) { + BasicSoundExtPlayList::Iterator curr = itr++; + SoundHandle handle; + handle.detail_AttachSoundAsTempHandle(&*curr); + func(handle); } - - return func; } - private: - BasicSoundExtPlayList mSoundList; // 0x00 - u16 mPlayableCount; // 0x0C - f32 mVolume; // 0x10 - }; - } - } -} + return func; + } -#endif // NW4R_SND_AXFX_IMPL_H + private: + BasicSoundExtPlayList mSoundList; // 0x00 + u16 mPlayableCount; // 0x0C + f32 mVolume; // 0x10 + }; + } // namespace detail + } // namespace snd +} // namespace nw4r + +#endif // NW4R_SND_AXFX_IMPL_H diff --git a/libs/NW4R/include/nw4r/snd/FrameHeap.h b/libs/NW4R/include/nw4r/snd/FrameHeap.h index 33c388b4..c90a7826 100644 --- a/libs/NW4R/include/nw4r/snd/FrameHeap.h +++ b/libs/NW4R/include/nw4r/snd/FrameHeap.h @@ -6,85 +6,78 @@ #include #include -#include #include +#include namespace nw4r { namespace snd { namespace detail { class FrameHeap { - public: - typedef void (*FreeCallback)(void* buffer, u32 size, void* callbackArg); + public: + typedef void (*FreeCallback)(void* buffer, u32 size, void* callbackArg); - FrameHeap(); - ~FrameHeap(); + FrameHeap(); + ~FrameHeap(); - bool Create(void* base, u32 size); - void Destroy(); - void Clear(); - void* Alloc(u32 size, FreeCallback callback, void* callbackArg); + bool Create(void* base, u32 size); + void Destroy(); + void Clear(); + void* Alloc(u32 size, FreeCallback callback, void* callbackArg); - int SaveState(); - void LoadState(int id); + int SaveState(); + void LoadState(int id); - int GetCurrentLevel() const; - u32 GetFreeSize() const; + int GetCurrentLevel() const; + u32 GetFreeSize() const; - bool IsValid() const { return mHandle != NULL; } + bool IsValid() const { return mHandle != NULL; } - private: - typedef struct Block { - ut::LinkListNode mLink; // 0x00 + private: + typedef struct Block { + ut::LinkListNode mLink; // 0x00 - u32 mSize; // 0x08 + u32 mSize; // 0x08 - FreeCallback mCallback; // 0x0C - void* mCallbackArg; // 0x10 + FreeCallback mCallback; // 0x0C + void* mCallbackArg; // 0x10 - Block(u32 size, FreeCallback callback, void* callbackArg) : - mSize(size), - mCallback(callback), - mCallbackArg(callbackArg) {} + Block(u32 size, FreeCallback callback, void* callbackArg) : mSize(size), mCallback(callback), mCallbackArg(callbackArg) {} - ~Block() { - if (mCallback != NULL) { - mCallback(GetBufferAddr(), mSize, mCallbackArg); - } + ~Block() { + if (mCallback != NULL) { + mCallback(GetBufferAddr(), mSize, mCallbackArg); } + } - void* GetBufferAddr() { - return ut::AddOffsetToPtr(this, BLOCK_BUFFER_SIZE); + void* GetBufferAddr() { return ut::AddOffsetToPtr(this, BLOCK_BUFFER_SIZE); } + } Block; + typedef ut::LinkList BlockList; + + typedef struct Section { + ut::LinkListNode mLink; // 0x00 + BlockList mBlockList; // 0x08 + + ~Section() { + for (BlockList::Iterator it = mBlockList.GetEndIter(); it != mBlockList.GetBeginIter();) { + (--it)->~Block(); } - } Block; - typedef ut::LinkList BlockList; + } - typedef struct Section { - ut::LinkListNode mLink; // 0x00 - BlockList mBlockList; // 0x08 + void AppendBlock(Block* block) { mBlockList.PushBack(block); } + } Section; + typedef ut::LinkList SectionList; - ~Section() { - for (BlockList::Iterator it = mBlockList.GetEndIter(); it != mBlockList.GetBeginIter();) { - (--it)->~Block(); - } - } + bool NewSection(); + void ClearSection(); - void AppendBlock(Block* block) { - mBlockList.PushBack(block); - } - } Section; - typedef ut::LinkList SectionList; + static const int BLOCK_BUFFER_SIZE = OSRoundUp32B(sizeof(Block)); + static const int HEAP_ALIGN = 32; - bool NewSection(); - void ClearSection(); - - static const int BLOCK_BUFFER_SIZE = OSRoundUp32B(sizeof(Block)); - static const int HEAP_ALIGN = 32; - - MEMHeapHandle mHandle; // 0x00 - SectionList mSectionList; // 0x04 + MEMHeapHandle mHandle; // 0x00 + SectionList mSectionList; // 0x04 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_FRAME_HEAP_H +#endif // NW4R_SND_FRAME_HEAP_H diff --git a/libs/NW4R/include/nw4r/snd/FxBase.h b/libs/NW4R/include/nw4r/snd/FxBase.h index 460e2b6d..aec0b811 100644 --- a/libs/NW4R/include/nw4r/snd/FxBase.h +++ b/libs/NW4R/include/nw4r/snd/FxBase.h @@ -1,33 +1,32 @@ #ifndef NW4R_SND_FX_BASE_H #define NW4R_SND_FX_BASE_H - #include #include #include -#include #include +#include namespace nw4r { namespace snd { class FxBase : ut::NonCopyable { - public: - virtual ~FxBase() {} // 0x08 + public: + virtual ~FxBase() {} // 0x08 - virtual bool StartUp() { return true; } // 0x0C - virtual void Shutdown() {} // 0x10 + virtual bool StartUp() { return true; } // 0x0C + virtual void Shutdown() {} // 0x10 - virtual void UpdateBuffer(int channels, void** buffer, u32 size, SampleFormat format, f32 sampleRate, OutputMode mode) {} // 0x14 + virtual void UpdateBuffer(int channels, void** buffer, u32 size, SampleFormat format, f32 sampleRate, OutputMode mode) {} // 0x14 - public: - ut::LinkListNode mFxLink; // 0x04 + public: + ut::LinkListNode mFxLink; // 0x04 }; typedef ut::LinkList FxList; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_FX_BASE_H +#endif // NW4R_SND_FX_BASE_H diff --git a/libs/NW4R/include/nw4r/snd/FxChorus.h b/libs/NW4R/include/nw4r/snd/FxChorus.h index f647dfa2..5ee17085 100644 --- a/libs/NW4R/include/nw4r/snd/FxChorus.h +++ b/libs/NW4R/include/nw4r/snd/FxChorus.h @@ -6,39 +6,39 @@ namespace nw4r { namespace snd { class FxChorus : public FxBase { - public: - typedef struct ChorusParam { - f32 delayTime; // 0x00 - f32 depth; // 0x04 - f32 rate; // 0x08 - } ChorusParam; + public: + typedef struct ChorusParam { + f32 delayTime; // 0x00 + f32 depth; // 0x04 + f32 rate; // 0x08 + } ChorusParam; - public: - FxChorus(); + public: + FxChorus(); - virtual ~FxChorus() { - Shutdown(); - ReleaseWorkBuffer(); - } + virtual ~FxChorus() { + Shutdown(); + ReleaseWorkBuffer(); + } - virtual bool StartUp(); // 0x0C - virtual void Shutdown(); // 0x10 + virtual bool StartUp(); // 0x0C + virtual void Shutdown(); // 0x10 - virtual void UpdateBuffer(int channels, void** buffer, u32 size, SampleFormat format, f32 sampleRate, OutputMode mode); // 0x14 + virtual void UpdateBuffer(int channels, void** buffer, u32 size, SampleFormat format, f32 sampleRate, OutputMode mode); // 0x14 - virtual bool AssignWorkBuffer(void* buffer, u32 size); // 0x18 - virtual void ReleaseWorkBuffer(); // 0x1C + virtual bool AssignWorkBuffer(void* buffer, u32 size); // 0x18 + virtual void ReleaseWorkBuffer(); // 0x1C - u32 GetRequiredMemSize(); - bool SetParam(const ChorusParam& chorusParam) NO_INLINE; + u32 GetRequiredMemSize(); + bool SetParam(const ChorusParam& chorusParam) NO_INLINE; - private: - detail::AxfxImpl mImpl; // 0x0C + private: + detail::AxfxImpl mImpl; // 0x0C - ChorusParam mParam; // 0x18 - AXFX_CHORUS mAxfxParam; // 0x24 + ChorusParam mParam; // 0x18 + AXFX_CHORUS mAxfxParam; // 0x24 }; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_FX_CHORUS_H +#endif // NW4R_SND_FX_CHORUS_H diff --git a/libs/NW4R/include/nw4r/snd/FxDelay.h b/libs/NW4R/include/nw4r/snd/FxDelay.h index e1f7180b..79e79fe7 100644 --- a/libs/NW4R/include/nw4r/snd/FxDelay.h +++ b/libs/NW4R/include/nw4r/snd/FxDelay.h @@ -6,39 +6,39 @@ namespace nw4r { namespace snd { class FxDelay : public FxBase { - public: - typedef struct DelayParam { - f32 delay; // 0x00 - f32 feedback; // 0x04 - f32 outGain; // 0x08 - } DelayParam; + public: + typedef struct DelayParam { + f32 delay; // 0x00 + f32 feedback; // 0x04 + f32 outGain; // 0x08 + } DelayParam; - public: - FxDelay(); + public: + FxDelay(); - virtual ~FxDelay() { - Shutdown(); - ReleaseWorkBuffer(); - } + virtual ~FxDelay() { + Shutdown(); + ReleaseWorkBuffer(); + } - virtual bool StartUp(); // 0x0C - virtual void Shutdown(); // 0x10 + virtual bool StartUp(); // 0x0C + virtual void Shutdown(); // 0x10 - virtual void UpdateBuffer(int channels, void** buffer, u32 size, SampleFormat format, f32 sampleRate, OutputMode mode); // 0x14 + virtual void UpdateBuffer(int channels, void** buffer, u32 size, SampleFormat format, f32 sampleRate, OutputMode mode); // 0x14 - virtual bool AssignWorkBuffer(void* buffer, u32 size); // 0x18 - virtual void ReleaseWorkBuffer(); // 0x1C + virtual bool AssignWorkBuffer(void* buffer, u32 size); // 0x18 + virtual void ReleaseWorkBuffer(); // 0x1C - u32 GetRequiredMemSize(); - bool SetParam(const DelayParam& delayParam); + u32 GetRequiredMemSize(); + bool SetParam(const DelayParam& delayParam); - private: - detail::AxfxImpl mImpl; // 0x0C + private: + detail::AxfxImpl mImpl; // 0x0C - DelayParam mParam; // 0x18 - AXFX_DELAY mAxfxParam; // 0x24 + DelayParam mParam; // 0x18 + AXFX_DELAY mAxfxParam; // 0x24 }; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_FX_DELAY_H +#endif // NW4R_SND_FX_DELAY_H diff --git a/libs/NW4R/include/nw4r/snd/FxReverbHi.h b/libs/NW4R/include/nw4r/snd/FxReverbHi.h index 34a033e0..0b37a18f 100644 --- a/libs/NW4R/include/nw4r/snd/FxReverbHi.h +++ b/libs/NW4R/include/nw4r/snd/FxReverbHi.h @@ -6,41 +6,42 @@ namespace nw4r { namespace snd { class FxReverbHi : public FxBase { - public: - typedef struct ReverbHiParam { - f32 preDelayTime; // 0x00 - f32 fusedTime; // 0x04 - f32 coloration; // 0x08 - f32 damping; // 0x0C - f32 crossTalk; // 0x10 - f32 outGain; // 0x14 - } ReverbHiParam; - public: - FxReverbHi(); + public: + typedef struct ReverbHiParam { + f32 preDelayTime; // 0x00 + f32 fusedTime; // 0x04 + f32 coloration; // 0x08 + f32 damping; // 0x0C + f32 crossTalk; // 0x10 + f32 outGain; // 0x14 + } ReverbHiParam; - virtual ~FxReverbHi() { - Shutdown(); - ReleaseWorkBuffer(); - } + public: + FxReverbHi(); - virtual bool StartUp(); // 0x0C - virtual void Shutdown(); // 0x10 + virtual ~FxReverbHi() { + Shutdown(); + ReleaseWorkBuffer(); + } - virtual void UpdateBuffer(int channels, void** buffer, u32 size, SampleFormat format, f32 sampleRate, OutputMode mode); // 0x14 + virtual bool StartUp(); // 0x0C + virtual void Shutdown(); // 0x10 - virtual bool AssignWorkBuffer(void* buffer, u32 size); // 0x18 - virtual void ReleaseWorkBuffer(); // 0x1C + virtual void UpdateBuffer(int channels, void** buffer, u32 size, SampleFormat format, f32 sampleRate, OutputMode mode); // 0x14 - u32 GetRequiredMemSize(); - bool SetParam(const ReverbHiParam& reverbHiParam) NO_INLINE; + virtual bool AssignWorkBuffer(void* buffer, u32 size); // 0x18 + virtual void ReleaseWorkBuffer(); // 0x1C - private: - detail::AxfxImpl mImpl; // 0x0C + u32 GetRequiredMemSize(); + bool SetParam(const ReverbHiParam& reverbHiParam) NO_INLINE; - ReverbHiParam mParam; // 0x18 - AXFX_REVERBHI mAxfxParam; // 0x30 + private: + detail::AxfxImpl mImpl; // 0x0C + + ReverbHiParam mParam; // 0x18 + AXFX_REVERBHI mAxfxParam; // 0x30 }; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_FX_REVERB_HI_H +#endif // NW4R_SND_FX_REVERB_HI_H diff --git a/libs/NW4R/include/nw4r/snd/FxReverbHiDpl2.h b/libs/NW4R/include/nw4r/snd/FxReverbHiDpl2.h index 3399c2b1..31dddd7c 100644 --- a/libs/NW4R/include/nw4r/snd/FxReverbHiDpl2.h +++ b/libs/NW4R/include/nw4r/snd/FxReverbHiDpl2.h @@ -6,41 +6,42 @@ namespace nw4r { namespace snd { class FxReverbHiDpl2 : public FxBase { - public: - typedef struct ReverbHiDpl2Param { - f32 preDelayTime; // 0x00 - f32 fusedTime; // 0x04 - f32 coloration; // 0x08 - f32 damping; // 0x0C - f32 crossTalk; // 0x10 - f32 outGain; // 0x14 - } ReverbHiDpl2Param; - public: - FxReverbHiDpl2(); + public: + typedef struct ReverbHiDpl2Param { + f32 preDelayTime; // 0x00 + f32 fusedTime; // 0x04 + f32 coloration; // 0x08 + f32 damping; // 0x0C + f32 crossTalk; // 0x10 + f32 outGain; // 0x14 + } ReverbHiDpl2Param; - virtual ~FxReverbHiDpl2() { - Shutdown(); - ReleaseWorkBuffer(); - } + public: + FxReverbHiDpl2(); - virtual bool StartUp(); // 0x0C - virtual void Shutdown(); // 0x10 + virtual ~FxReverbHiDpl2() { + Shutdown(); + ReleaseWorkBuffer(); + } - virtual void UpdateBuffer(int channels, void** buffer, u32 size, SampleFormat format, f32 sampleRate, OutputMode mode); // 0x14 + virtual bool StartUp(); // 0x0C + virtual void Shutdown(); // 0x10 - virtual bool AssignWorkBuffer(void* buffer, u32 size); // 0x18 - virtual void ReleaseWorkBuffer(); // 0x1C + virtual void UpdateBuffer(int channels, void** buffer, u32 size, SampleFormat format, f32 sampleRate, OutputMode mode); // 0x14 - u32 GetRequiredMemSize(); - bool SetParam(const ReverbHiDpl2Param& reverbHiDpl2Param) NO_INLINE; + virtual bool AssignWorkBuffer(void* buffer, u32 size); // 0x18 + virtual void ReleaseWorkBuffer(); // 0x1C - private: - detail::AxfxImpl mImpl; // 0x0C + u32 GetRequiredMemSize(); + bool SetParam(const ReverbHiDpl2Param& reverbHiDpl2Param) NO_INLINE; - ReverbHiDpl2Param mParam; // 0x18 - AXFX_REVERBHI_DPL2 mAxfxParam; // 0x30 + private: + detail::AxfxImpl mImpl; // 0x0C + + ReverbHiDpl2Param mParam; // 0x18 + AXFX_REVERBHI_DPL2 mAxfxParam; // 0x30 }; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_FX_REVERB_HI_DPL2_H +#endif // NW4R_SND_FX_REVERB_HI_DPL2_H diff --git a/libs/NW4R/include/nw4r/snd/FxReverbStd.h b/libs/NW4R/include/nw4r/snd/FxReverbStd.h index c8f665cd..051c51de 100644 --- a/libs/NW4R/include/nw4r/snd/FxReverbStd.h +++ b/libs/NW4R/include/nw4r/snd/FxReverbStd.h @@ -6,40 +6,41 @@ namespace nw4r { namespace snd { class FxReverbStd : public FxBase { - public: - typedef struct ReverbStdParam { - f32 preDelayTime; // 0x00 - f32 fusedTime; // 0x04 - f32 coloration; // 0x08 - f32 damping; // 0x0C - f32 outGain; // 0x10 - } ReverbStdParam; - public: - FxReverbStd(); + public: + typedef struct ReverbStdParam { + f32 preDelayTime; // 0x00 + f32 fusedTime; // 0x04 + f32 coloration; // 0x08 + f32 damping; // 0x0C + f32 outGain; // 0x10 + } ReverbStdParam; - virtual ~FxReverbStd() { - Shutdown(); - ReleaseWorkBuffer(); - } + public: + FxReverbStd(); - virtual bool StartUp(); // 0x0C - virtual void Shutdown(); // 0x10 + virtual ~FxReverbStd() { + Shutdown(); + ReleaseWorkBuffer(); + } - virtual void UpdateBuffer(int channels, void** buffer, u32 size, SampleFormat format, f32 sampleRate, OutputMode mode); // 0x14 + virtual bool StartUp(); // 0x0C + virtual void Shutdown(); // 0x10 - virtual bool AssignWorkBuffer(void* buffer, u32 size); // 0x18 - virtual void ReleaseWorkBuffer(); // 0x1C + virtual void UpdateBuffer(int channels, void** buffer, u32 size, SampleFormat format, f32 sampleRate, OutputMode mode); // 0x14 - u32 GetRequiredMemSize(); - bool SetParam(const ReverbStdParam& rParam) NO_INLINE; + virtual bool AssignWorkBuffer(void* buffer, u32 size); // 0x18 + virtual void ReleaseWorkBuffer(); // 0x1C - private: - detail::AxfxImpl mImpl; // 0x0C + u32 GetRequiredMemSize(); + bool SetParam(const ReverbStdParam& rParam) NO_INLINE; - ReverbStdParam mParam; // 0x18 - AXFX_REVERBSTD mAxfxParam; // 0x30 + private: + detail::AxfxImpl mImpl; // 0x0C + + ReverbStdParam mParam; // 0x18 + AXFX_REVERBSTD mAxfxParam; // 0x30 }; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_FX_REVERB_STD_H +#endif // NW4R_SND_FX_REVERB_STD_H diff --git a/libs/NW4R/include/nw4r/snd/InstancePool.h b/libs/NW4R/include/nw4r/snd/InstancePool.h index 45c09f1f..e841412c 100644 --- a/libs/NW4R/include/nw4r/snd/InstancePool.h +++ b/libs/NW4R/include/nw4r/snd/InstancePool.h @@ -9,76 +9,62 @@ namespace nw4r { namespace snd { namespace detail { class PoolImpl { - public: - PoolImpl() : mNext(NULL) {} + public: + PoolImpl() : mNext(NULL) {} - protected: - u32 CreateImpl(void* buffer, u32 size, u32 objSize); - void DestroyImpl(void* buffer, u32 size); - int CountImpl() const; + protected: + u32 CreateImpl(void* buffer, u32 size, u32 objSize); + void DestroyImpl(void* buffer, u32 size); + int CountImpl() const; - void* AllocImpl(); - void FreeImpl(void* ptr); + void* AllocImpl(); + void FreeImpl(void* ptr); - private: - PoolImpl* mNext; // 0x00 + private: + PoolImpl* mNext; // 0x00 }; - template class InstancePool : private PoolImpl { - public: - u32 Create(void* buffer, u32 size) { - return CreateImpl(buffer, size, sizeof(T)); + template + class InstancePool : private PoolImpl { + public: + u32 Create(void* buffer, u32 size) { return CreateImpl(buffer, size, sizeof(T)); } + + void Destroy(void* buffer, u32 size) { DestroyImpl(buffer, size); } + + int Count() const { return CountImpl(); } + + T* Alloc() { + void* ptr = AllocImpl(); + if (ptr == NULL) { + return NULL; } - void Destroy(void* buffer, u32 size) { - DestroyImpl(buffer, size); - } + return new (ptr) T; + } - int Count() const { - return CountImpl(); - } - - T* Alloc() { - void* ptr = AllocImpl(); - if (ptr == NULL) { - return NULL; - } - - return new(ptr)T; - } - - void Free(T* obj) { - if (obj != NULL) { - obj->~T(); - FreeImpl(obj); - } - } - }; - - template class MemoryPool : private PoolImpl { - public: - u32 Create(void* buffer, u32 size) { - return CreateImpl(buffer, size, sizeof(T)); - } - - void Destroy(void* buffer, u32 size) { - DestroyImpl(buffer, size); - } - - int Count() const { - return CountImpl(); - } - - T* Alloc() { - return static_cast(AllocImpl()); - } - - void Free(T* obj) { + void Free(T* obj) { + if (obj != NULL) { + obj->~T(); FreeImpl(obj); } + } }; - } - } -} -#endif // NW4R_SND_INSTANCE_POOL_H + template + class MemoryPool : private PoolImpl { + public: + u32 Create(void* buffer, u32 size) { return CreateImpl(buffer, size, sizeof(T)); } + + void Destroy(void* buffer, u32 size) { DestroyImpl(buffer, size); } + + int Count() const { return CountImpl(); } + + T* Alloc() { return static_cast(AllocImpl()); } + + void Free(T* obj) { FreeImpl(obj); } + }; + } // namespace detail + } // namespace snd +} // namespace nw4r + +#endif // NW4R_SND_INSTANCE_POOL_H diff --git a/libs/NW4R/include/nw4r/snd/Lfo.h b/libs/NW4R/include/nw4r/snd/Lfo.h index d9ff5062..9fc0c998 100644 --- a/libs/NW4R/include/nw4r/snd/Lfo.h +++ b/libs/NW4R/include/nw4r/snd/Lfo.h @@ -8,45 +8,41 @@ namespace nw4r { namespace snd { namespace detail { typedef struct LfoParam { - LfoParam() { - Init(); - } + LfoParam() { Init(); } - void Init(); + void Init(); - f32 depth; // 0x00 - f32 speed; // 0x04 - u32 delay; // 0x08 - u8 range; // 0x0C + f32 depth; // 0x00 + f32 speed; // 0x04 + u32 delay; // 0x08 + u8 range; // 0x0C - u8 padding[3]; + u8 padding[3]; } LfoParam; class Lfo { - public: - Lfo() : - mDelayCounter(0), - mCounter(0.0f) {} + public: + Lfo() : mDelayCounter(0), mCounter(0.0f) {} - LfoParam& GetParam() { return mParam; } - void SetParam(const LfoParam& rParam) { mParam = rParam; } + LfoParam& GetParam() { return mParam; } + void SetParam(const LfoParam& rParam) { mParam = rParam; } - void Reset(); - void Update(int msec); + void Reset(); + void Update(int msec); - f32 GetValue() const; + f32 GetValue() const; - private: - static const int TABLE_SIZE = 32; + private: + static const int TABLE_SIZE = 32; - static s8 GetSinIdx(int idx); + static s8 GetSinIdx(int idx); - LfoParam mParam; // 0x00 - u32 mDelayCounter; // 0x10 - f32 mCounter; // 0x14 + LfoParam mParam; // 0x00 + u32 mDelayCounter; // 0x10 + f32 mCounter; // 0x14 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_LFO_H +#endif // NW4R_SND_LFO_H diff --git a/libs/NW4R/include/nw4r/snd/McsSoundArchive.h b/libs/NW4R/include/nw4r/snd/McsSoundArchive.h index 24aee11c..b53edb90 100644 --- a/libs/NW4R/include/nw4r/snd/McsSoundArchive.h +++ b/libs/NW4R/include/nw4r/snd/McsSoundArchive.h @@ -5,8 +5,8 @@ #include -#include #include +#include namespace nw4r { namespace snd { @@ -14,7 +14,7 @@ namespace nw4r { class McsFileStream; McsSoundArchive(); }; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_MCS_SOUND_ARCHIVE_H +#endif // NW4R_SND_MCS_SOUND_ARCHIVE_H diff --git a/libs/NW4R/include/nw4r/snd/MemorySoundArchive.h b/libs/NW4R/include/nw4r/snd/MemorySoundArchive.h index b913aec4..8ac02025 100644 --- a/libs/NW4R/include/nw4r/snd/MemorySoundArchive.h +++ b/libs/NW4R/include/nw4r/snd/MemorySoundArchive.h @@ -11,30 +11,30 @@ namespace nw4r { namespace snd { class MemorySoundArchive : public SoundArchive { - private: - class MemoryFileStream; + private: + class MemoryFileStream; - public: - MemorySoundArchive(); - virtual ~MemorySoundArchive(); // 0x08 + public: + MemorySoundArchive(); + virtual ~MemorySoundArchive(); // 0x08 - virtual const void* detail_GetFileAddress(u32 id) const; // 0x0C - virtual const void* detail_GetWaveDataFileAddress(u32 id) const; // 0x10 + virtual const void* detail_GetFileAddress(u32 id) const; // 0x0C + virtual const void* detail_GetWaveDataFileAddress(u32 id) const; // 0x10 - virtual int detail_GetRequiredStreamBufferSize() const; // 0x14 + virtual int detail_GetRequiredStreamBufferSize() const; // 0x14 - virtual ut::FileStream* OpenStream(void* buffer, int size, u32 offset, u32 length) const; // 0x18 + virtual ut::FileStream* OpenStream(void* buffer, int size, u32 offset, u32 length) const; // 0x18 - virtual ut::FileStream* OpenExtStream(void* buffer, int size, const char* extPath, u32 offset, u32 length) const; // 0x1C + virtual ut::FileStream* OpenExtStream(void* buffer, int size, const char* extPath, u32 offset, u32 length) const; // 0x1C - bool Setup(const void* buffer); - void Shutdown(); + bool Setup(const void* buffer); + void Shutdown(); - private: - const void* mData; // 0x108 - detail::SoundArchiveFileReader mFileReader; // 0x10C + private: + const void* mData; // 0x108 + detail::SoundArchiveFileReader mFileReader; // 0x10C }; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_MEMORY_SOUND_ARCHIVE_H +#endif // NW4R_SND_MEMORY_SOUND_ARCHIVE_H diff --git a/libs/NW4R/include/nw4r/snd/MidiSeqPlayer.h b/libs/NW4R/include/nw4r/snd/MidiSeqPlayer.h index 26c2a806..6fc9cc7d 100644 --- a/libs/NW4R/include/nw4r/snd/MidiSeqPlayer.h +++ b/libs/NW4R/include/nw4r/snd/MidiSeqPlayer.h @@ -11,8 +11,8 @@ namespace nw4r { MidiSeqPlayer(); virtual ~MidiSeqPlayer() {} }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_MIDI_SEQ_PLAYER_H +#endif // NW4R_SND_MIDI_SEQ_PLAYER_H diff --git a/libs/NW4R/include/nw4r/snd/MidiSeqTrack.h b/libs/NW4R/include/nw4r/snd/MidiSeqTrack.h index 5c290f2f..5d5e0607 100644 --- a/libs/NW4R/include/nw4r/snd/MidiSeqTrack.h +++ b/libs/NW4R/include/nw4r/snd/MidiSeqTrack.h @@ -11,8 +11,8 @@ namespace nw4r { MidiSeqTrack(); virtual ~MidiSeqTrack() {} }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_MIDI_SEQ_TRACK_H +#endif // NW4R_SND_MIDI_SEQ_TRACK_H diff --git a/libs/NW4R/include/nw4r/snd/MmlParser.h b/libs/NW4R/include/nw4r/snd/MmlParser.h index a81d680e..64b8c1ce 100644 --- a/libs/NW4R/include/nw4r/snd/MmlParser.h +++ b/libs/NW4R/include/nw4r/snd/MmlParser.h @@ -11,139 +11,141 @@ namespace nw4r { class SeqPlayer; class MmlParser { - public: - typedef enum SeqArgType { - SEQ_ARG_U8 = 0, - SEQ_ARG_S16, - SEQ_ARG_VMIDI, - SEQ_ARG_RANDOM, - SEQ_ARG_VARIABLE - } SeqArgType; + public: + // clang-format off + typedef enum SeqArgType { + SEQ_ARG_U8 = 0, + SEQ_ARG_S16, + SEQ_ARG_VMIDI, + SEQ_ARG_RANDOM, + SEQ_ARG_VARIABLE + } SeqArgType; - static const int CALL_STACK_MAX_DEPTH = 3; + static const int CALL_STACK_MAX_DEPTH = 3; + // clang-format on - public: - virtual void CommandProc(MmlSeqTrack* track, u32 command, s32 commandArg1, s32 commandArg2) const; // 0x8 - virtual Channel* NoteOnCommandProc(MmlSeqTrack* track, int key, int velocity, s32 length, bool tieFlag) const; // 0xC + public: + virtual void CommandProc(MmlSeqTrack* track, u32 command, s32 commandArg1, s32 commandArg2) const; // 0x8 + virtual Channel* NoteOnCommandProc(MmlSeqTrack* track, int key, int velocity, s32 length, bool tieFlag) const; // 0xC - ParseResult Parse(MmlSeqTrack* track, bool doNoteOn) const; + ParseResult Parse(MmlSeqTrack* track, bool doNoteOn) const; - vs16* GetVariablePtr(SeqPlayer* player, SeqTrack* track, int varNo) const; + vs16* GetVariablePtr(SeqPlayer* player, SeqTrack* track, int varNo) const; - static void EnablePrintVar(bool enable) { mPrintVarEnabledFlag = enable; } + static void EnablePrintVar(bool enable) { mPrintVarEnabledFlag = enable; } - private: - typedef enum MmlSeqData { - MML_CMD_MIN = 0x80, // <80 -> MML note, not a command + private: + typedef enum MmlSeqData { + MML_CMD_MIN = 0x80, // <80 -> MML note, not a command - MML_WAIT = 0x80, // 0x80 - MML_SET_PRGNO, // 0x81 - MML_OPENTRACK = 0x88, // 0x88 - MML_JUMP, // 0x89 - MML_CALL, // 0x8A + MML_WAIT = 0x80, // 0x80 + MML_SET_PRGNO, // 0x81 + MML_OPENTRACK = 0x88, // 0x88 + MML_JUMP, // 0x89 + MML_CALL, // 0x8A - MML_RNDPARAM = 0xA0, // 0xA0 - MML_INDPARAM, // 0xA1 - MML_EXECIF, // 0xA2 + MML_RNDPARAM = 0xA0, // 0xA0 + MML_INDPARAM, // 0xA1 + MML_EXECIF, // 0xA2 - MML_SET_TIMEBASE = 0xB0, // 0xB0 (unused by this version) + MML_SET_TIMEBASE = 0xB0, // 0xB0 (unused by this version) - MML_SET_PAN = 0xC0, // 0xC0 - MML_SET_TRACK_VOLUME, // 0xC1 - MML_SET_PLAYER_VOLUME, // 0xC2 - MML_SET_TRANSPOSE, // 0xC3 - MML_SET_PITCHBEND, // 0xC4 - MML_SET_BENDRANGE, // 0xC5 - MML_SET_PRIORITY, // 0xC6 - MML_SET_NOTEWAIT, // 0xC7 - MML_SET_TIE, // 0xC8 - MML_SET_PORTAMENTO, // 0xC9 - MML_SET_LFODEPTH, // 0xCA - MML_SET_LFOSPEED, // 0xCB - MML_SET_LFOTARGET, // 0xCC - MML_SET_LFORANGE, // 0xCD - MML_SET_PORTASPEED, // 0xCE - MML_SET_PORTATIME, // 0xCF + MML_SET_PAN = 0xC0, // 0xC0 + MML_SET_TRACK_VOLUME, // 0xC1 + MML_SET_PLAYER_VOLUME, // 0xC2 + MML_SET_TRANSPOSE, // 0xC3 + MML_SET_PITCHBEND, // 0xC4 + MML_SET_BENDRANGE, // 0xC5 + MML_SET_PRIORITY, // 0xC6 + MML_SET_NOTEWAIT, // 0xC7 + MML_SET_TIE, // 0xC8 + MML_SET_PORTAMENTO, // 0xC9 + MML_SET_LFODEPTH, // 0xCA + MML_SET_LFOSPEED, // 0xCB + MML_SET_LFOTARGET, // 0xCC + MML_SET_LFORANGE, // 0xCD + MML_SET_PORTASPEED, // 0xCE + MML_SET_PORTATIME, // 0xCF - MML_SET_ATTACK = 0xD0, // 0xD0 - MML_SET_DECAY, // 0xD1 - MML_SET_SUSTAIN, // 0xD2 - MML_SET_RELEASE, // 0xD3 - MML_LOOP_START, // 0xD4 - MML_SET_TRACK_VOLUME2, // 0xD5 - MML_PRINTVAR, // 0xD6 - MML_SET_SURROUNDPAN, // 0xD7 - MML_SET_LPFFREQ, // 0xD8 - MML_SET_FXSEND_A, // 0xD9 - MML_SET_FXSEND_B, // 0xDA - MML_SET_MAINSEND, // 0xDB - MML_SET_INITPAN, // 0xDC - MML_SET_MUTE, // 0xDD - MML_SET_FXSEND_C, // 0xDE - MML_SET_DAMPER, // 0xDF (unused by this version) + MML_SET_ATTACK = 0xD0, // 0xD0 + MML_SET_DECAY, // 0xD1 + MML_SET_SUSTAIN, // 0xD2 + MML_SET_RELEASE, // 0xD3 + MML_LOOP_START, // 0xD4 + MML_SET_TRACK_VOLUME2, // 0xD5 + MML_PRINTVAR, // 0xD6 + MML_SET_SURROUNDPAN, // 0xD7 + MML_SET_LPFFREQ, // 0xD8 + MML_SET_FXSEND_A, // 0xD9 + MML_SET_FXSEND_B, // 0xDA + MML_SET_MAINSEND, // 0xDB + MML_SET_INITPAN, // 0xDC + MML_SET_MUTE, // 0xDD + MML_SET_FXSEND_C, // 0xDE + MML_SET_DAMPER, // 0xDF (unused by this version) - MML_SET_LFODELAY = 0xE0, // 0xE0 - MML_SET_TEMPO, // 0xE1 - MML_CMD_E2h, // 0xE2 - MML_SET_SWEEPPITCH, // 0xE3 + MML_SET_LFODELAY = 0xE0, // 0xE0 + MML_SET_TEMPO, // 0xE1 + MML_CMD_E2h, // 0xE2 + MML_SET_SWEEPPITCH, // 0xE3 - MML_LOOP_END = 0xFC, // 0xFC - MML_RET, // 0xFD - MML_ALLOCTRACK, // 0xFE - MML_EOF, // 0xFF + MML_LOOP_END = 0xFC, // 0xFC + MML_RET, // 0xFD + MML_ALLOCTRACK, // 0xFE + MML_EOF, // 0xFF - MML_CMD_MASK = 0x80, - MML_CMD_SET_MASK = 0xF0, + MML_CMD_MASK = 0x80, + MML_CMD_SET_MASK = 0xF0, - MML_CMD_MAX = 0xFF, // >FF -> EX command + MML_CMD_MAX = 0xFF, // >FF -> EX command - // (MML_EX_COMMAND << 8) | Command - MML_EX_COMMAND = 0xF0, + // (MML_EX_COMMAND << 8) | Command + MML_EX_COMMAND = 0xF0, - // MML EX arithmetic command set - MML_EX_ARITHMETIC = 0x80, // 0xF0 0x8X - MML_EX_SET = 0x80, // 0xF0 0x80 - MML_EX_APL, // 0xF0 0x81 - MML_EX_AMI, // 0xF0 0x82 - MML_EX_AMU, // 0xF0 0x83 - MML_EX_ADV, // 0xF0 0x84 - MML_EX_ALS, // 0xF0 0x85 - MML_EX_RND, // 0xF0 0x86 - MML_EX_AAD, // 0xF0 0x87 - MML_EX_AOR, // 0xF0 0x88 - MML_EX_AER, // 0xF0 0x89 - MML_EX_ACO, // 0xF0 0x8A - MML_EX_AMD, // 0xF0 0x8B + // MML EX arithmetic command set + MML_EX_ARITHMETIC = 0x80, // 0xF0 0x8X + MML_EX_SET = 0x80, // 0xF0 0x80 + MML_EX_APL, // 0xF0 0x81 + MML_EX_AMI, // 0xF0 0x82 + MML_EX_AMU, // 0xF0 0x83 + MML_EX_ADV, // 0xF0 0x84 + MML_EX_ALS, // 0xF0 0x85 + MML_EX_RND, // 0xF0 0x86 + MML_EX_AAD, // 0xF0 0x87 + MML_EX_AOR, // 0xF0 0x88 + MML_EX_AER, // 0xF0 0x89 + MML_EX_ACO, // 0xF0 0x8A + MML_EX_AMD, // 0xF0 0x8B - // MML EX logic command set - MML_EX_LOGIC = 0x90, // 0xF0 0x9X - MML_EX_EQ = 0x90, // 0xF0 0x90 - MML_EX_GE, // 0xF0 0x91 - MML_EX_GT, // 0xF0 0x92 - MML_EX_LE, // 0xF0 0x93 - MML_EX_LT, // 0xF0 0x94 - MML_EX_NE, // 0xF0 0x95 + // MML EX logic command set + MML_EX_LOGIC = 0x90, // 0xF0 0x9X + MML_EX_EQ = 0x90, // 0xF0 0x90 + MML_EX_GE, // 0xF0 0x91 + MML_EX_GT, // 0xF0 0x92 + MML_EX_LE, // 0xF0 0x93 + MML_EX_LT, // 0xF0 0x94 + MML_EX_NE, // 0xF0 0x95 - // MML EX userproc callback - MML_EX_USERPROC = 0xE0, // 0xF0 0xE0 + // MML EX userproc callback + MML_EX_USERPROC = 0xE0, // 0xF0 0xE0 - MML_EX_CMD_MAX = 0xFFFF, // >FFFF -> Invalid command - } MmlSeqData; + MML_EX_CMD_MAX = 0xFFFF, // >FFFF -> Invalid command + } MmlSeqData; - private: - u8 ReadByte(const u8** data) const { return *(*data)++; } + private: + u8 ReadByte(const u8** data) const { return *(*data)++; } - u16 Read16(const u8** data) const; - u32 Read24(const u8** data) const; - s32 ReadVar(const u8** data) const; - s32 ReadArg(const u8** data, SeqPlayer* player, SeqTrack* track, SeqArgType type) const; + u16 Read16(const u8** data) const; + u32 Read24(const u8** data) const; + s32 ReadVar(const u8** data) const; + s32 ReadArg(const u8** data, SeqPlayer* player, SeqTrack* track, SeqArgType type) const; - private: - static bool mPrintVarEnabledFlag; + private: + static bool mPrintVarEnabledFlag; }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/MmlSeqTrack.h b/libs/NW4R/include/nw4r/snd/MmlSeqTrack.h index c1b4212b..afaf2714 100644 --- a/libs/NW4R/include/nw4r/snd/MmlSeqTrack.h +++ b/libs/NW4R/include/nw4r/snd/MmlSeqTrack.h @@ -9,32 +9,32 @@ namespace nw4r { namespace snd { namespace detail { class MmlSeqTrack : public SeqTrack { - public: - typedef struct MmlParserParam { - bool cmpFlag; // 0x00 - bool noteWaitFlag; // 0x01 - bool tieFlag; // 0x02 - u8 loopCount[MmlParser::CALL_STACK_MAX_DEPTH]; // 0x03 + public: + typedef struct MmlParserParam { + bool cmpFlag; // 0x00 + bool noteWaitFlag; // 0x01 + bool tieFlag; // 0x02 + u8 loopCount[MmlParser::CALL_STACK_MAX_DEPTH]; // 0x03 - u8 callStackDepth; // 0x06 - const u8* callStack[MmlParser::CALL_STACK_MAX_DEPTH]; // 0x08 - } MmlParserParam; + u8 callStackDepth; // 0x06 + const u8* callStack[MmlParser::CALL_STACK_MAX_DEPTH]; // 0x08 + } MmlParserParam; - public: - MmlSeqTrack(); + public: + MmlSeqTrack(); - virtual ParseResult Parse(bool doNoteOn); // 0x0C + virtual ParseResult Parse(bool doNoteOn); // 0x0C - void SetMmlParser(const MmlParser* pParser) { mParser = pParser; } - MmlParserParam& GetMmlParserParam() { return mMmlParserParam; } + void SetMmlParser(const MmlParser* pParser) { mParser = pParser; } + MmlParserParam& GetMmlParserParam() { return mMmlParserParam; } - private: - const MmlParser* mParser; // 0xC0 - MmlParserParam mMmlParserParam; // 0xC4 + private: + const MmlParser* mParser; // 0xC0 + MmlParserParam mMmlParserParam; // 0xC4 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/MmlSeqTrackAllocator.h b/libs/NW4R/include/nw4r/snd/MmlSeqTrackAllocator.h index fb82b4c2..de40cc43 100644 --- a/libs/NW4R/include/nw4r/snd/MmlSeqTrackAllocator.h +++ b/libs/NW4R/include/nw4r/snd/MmlSeqTrackAllocator.h @@ -15,21 +15,21 @@ namespace nw4r { class SeqTrack; class MmlSeqTrackAllocator : public SeqTrackAllocator { - public: - explicit MmlSeqTrackAllocator(MmlParser* parser) : mParser(parser) {} + public: + explicit MmlSeqTrackAllocator(MmlParser* parser) : mParser(parser) {} - virtual SeqTrack* AllocTrack(SeqPlayer* player); // 0x0C - virtual void FreeTrack(SeqTrack* track); // 0x10 + virtual SeqTrack* AllocTrack(SeqPlayer* player); // 0x0C + virtual void FreeTrack(SeqTrack* track); // 0x10 - u32 Create(void* buffer, u32 size); - void Destroy(void* buffer, u32 size); + u32 Create(void* buffer, u32 size); + void Destroy(void* buffer, u32 size); - private: - MmlParser* mParser; // 0x04 - InstancePool mTrackPool; // 0x08 + private: + MmlParser* mParser; // 0x04 + InstancePool mTrackPool; // 0x08 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/MoveValue.h b/libs/NW4R/include/nw4r/snd/MoveValue.h index 2794d2a5..59236f8b 100644 --- a/libs/NW4R/include/nw4r/snd/MoveValue.h +++ b/libs/NW4R/include/nw4r/snd/MoveValue.h @@ -4,53 +4,48 @@ namespace nw4r { namespace snd { namespace detail { - template class MoveValue { - public: - MoveValue() : - mOrigin(TValue()), - mTarget(TValue()), - mFrame(TTime()), - mCounter(TTime()) {} + template + class MoveValue { + public: + MoveValue() : mOrigin(TValue()), mTarget(TValue()), mFrame(TTime()), mCounter(TTime()) {} - void InitValue(TValue t1) { - mOrigin = t1; - mTarget = t1; - mFrame = 0; - mCounter = 0; + void InitValue(TValue t1) { + mOrigin = t1; + mTarget = t1; + mFrame = 0; + mCounter = 0; + } + + bool IsFinished() const { return mCounter >= mFrame; } + + TValue GetValue() const { + if (IsFinished()) { + return mTarget; } + return mOrigin + mCounter * (mTarget - mOrigin) / mFrame; + } - bool IsFinished() const { - return mCounter >= mFrame; + void Update() { + if (mCounter < mFrame) { + mCounter++; } + } - TValue GetValue() const { - if (IsFinished()) { - return mTarget; - } - return mOrigin + mCounter * (mTarget - mOrigin) / mFrame; - } + void SetTarget(TValue target, TTime frame) { + mOrigin = GetValue(); + mTarget = target; + mFrame = frame; + mCounter = 0; + } - void Update() { - if (mCounter < mFrame) { - mCounter++; - } - } - - void SetTarget(TValue target, TTime frame) { - mOrigin = GetValue(); - mTarget = target; - mFrame = frame; - mCounter = 0; - } - - private: - TValue mOrigin; // 0x00 - TValue mTarget; // 0x04 - TTime mFrame; // 0x08 - TTime mCounter; // 0x0C + private: + TValue mOrigin; // 0x00 + TValue mTarget; // 0x04 + TTime mFrame; // 0x08 + TTime mCounter; // 0x0C }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_MOVE_VALUE_H +#endif // NW4R_SND_MOVE_VALUE_H diff --git a/libs/NW4R/include/nw4r/snd/NandSoundArchive.h b/libs/NW4R/include/nw4r/snd/NandSoundArchive.h index 281e73eb..09945f2e 100644 --- a/libs/NW4R/include/nw4r/snd/NandSoundArchive.h +++ b/libs/NW4R/include/nw4r/snd/NandSoundArchive.h @@ -13,41 +13,41 @@ namespace nw4r { namespace snd { class NandSoundArchive : public SoundArchive { - private: - class NandFileStream; + private: + class NandFileStream; - public: - NandSoundArchive(); - virtual ~NandSoundArchive(); // 0x08 + public: + NandSoundArchive(); + virtual ~NandSoundArchive(); // 0x08 - virtual const void* detail_GetFileAddress(u32 id) const { return NULL; } // 0x0C - virtual const void* detail_GetWaveDataFileAddress(u32 id) const { return NULL; } // 0x10 + virtual const void* detail_GetFileAddress(u32 id) const { return NULL; } // 0x0C + virtual const void* detail_GetWaveDataFileAddress(u32 id) const { return NULL; } // 0x10 - virtual int detail_GetRequiredStreamBufferSize() const; // 0x14 + virtual int detail_GetRequiredStreamBufferSize() const; // 0x14 - virtual ut::FileStream* OpenStream(void* buffer, int size, u32 offset, u32 length) const; // 0x18 + virtual ut::FileStream* OpenStream(void* buffer, int size, u32 offset, u32 length) const; // 0x18 - virtual ut::FileStream* OpenExtStream(void* buffer, int size, const char* extPath, u32 offset, u32 length) const; // 0x1C + virtual ut::FileStream* OpenExtStream(void* buffer, int size, const char* extPath, u32 offset, u32 length) const; // 0x1C - bool Open(const char* path); - void Close(); + bool Open(const char* path); + void Close(); - bool LoadHeader(void* buffer, u32 size); - bool LoadLabelStringData(void* buffer, u32 size); + bool LoadHeader(void* buffer, u32 size); + bool LoadLabelStringData(void* buffer, u32 size); - u32 GetHeaderSize() const { return mFileReader.GetInfoChunkSize(); } - u32 GetLabelStringDataSize() const { return mFileReader.GetLabelStringChunkSize(); } + u32 GetHeaderSize() const { return mFileReader.GetInfoChunkSize(); } + u32 GetLabelStringDataSize() const { return mFileReader.GetLabelStringChunkSize(); } - private: - bool LoadFileHeader() NO_INLINE; + private: + bool LoadFileHeader() NO_INLINE; - private: - detail::SoundArchiveFileReader mFileReader; // 0x108 - NANDFileInfo mFileInfo; // 0x14C - bool mOpen; // 0x1D8 + private: + detail::SoundArchiveFileReader mFileReader; // 0x108 + NANDFileInfo mFileInfo; // 0x14C + bool mOpen; // 0x1D8 }; - } -} + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/NoteOnCallback.h b/libs/NW4R/include/nw4r/snd/NoteOnCallback.h index d7229c79..6cf007ee 100644 --- a/libs/NW4R/include/nw4r/snd/NoteOnCallback.h +++ b/libs/NW4R/include/nw4r/snd/NoteOnCallback.h @@ -7,28 +7,28 @@ namespace nw4r { namespace snd { namespace detail { typedef struct NoteOnInfo { - int prgNo; // 0x00 + int prgNo; // 0x00 - int key; // 0x04 - int velocity; // 0x08 - int length; // 0x0C - int initPan; // 0x10 - int priority; // 0x14 - int voiceOutCount; // 0x18 + int key; // 0x04 + int velocity; // 0x08 + int length; // 0x0C + int initPan; // 0x10 + int priority; // 0x14 + int voiceOutCount; // 0x18 - Channel::ChannelCallback channelCallback; // 0x1C - u32 channelCallbackData; // 0x20 + Channel::ChannelCallback channelCallback; // 0x1C + u32 channelCallbackData; // 0x20 }; class SeqPlayer; class NoteOnCallback { - public: - virtual ~NoteOnCallback() {} // 0x08 + public: + virtual ~NoteOnCallback() {} // 0x08 - virtual Channel* NoteOn(SeqPlayer* player, int bankNo, const NoteOnInfo& noteOnInfo) = 0; // 0x0C + virtual Channel* NoteOn(SeqPlayer* player, int bankNo, const NoteOnInfo& noteOnInfo) = 0; // 0x0C }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/PlayerHeap.h b/libs/NW4R/include/nw4r/snd/PlayerHeap.h index 6921509d..15e0033a 100644 --- a/libs/NW4R/include/nw4r/snd/PlayerHeap.h +++ b/libs/NW4R/include/nw4r/snd/PlayerHeap.h @@ -11,23 +11,23 @@ namespace nw4r { namespace detail { class BasicSound; class PlayerHeap : public SoundHeap { - public: - PlayerHeap() : mSound(NULL), mPlayer(NULL) {} - virtual ~PlayerHeap() {} // 0x08 + public: + PlayerHeap() : mSound(NULL), mPlayer(NULL) {} + virtual ~PlayerHeap() {} // 0x08 - void SetSound(BasicSound* sound) { mSound = sound; } - void SetSoundPlayer(SoundPlayer* player) { mPlayer = player; } + void SetSound(BasicSound* sound) { mSound = sound; } + void SetSoundPlayer(SoundPlayer* player) { mPlayer = player; } - public: - ut::LinkListNode mLink; // 0x2C + public: + ut::LinkListNode mLink; // 0x2C - private: - BasicSound* mSound; // 0x34 - SoundPlayer* mPlayer; // 0x38 + private: + BasicSound* mSound; // 0x34 + SoundPlayer* mPlayer; // 0x38 }; typedef ut::LinkList PlayerHeapList; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/RemoteSpeaker.h b/libs/NW4R/include/nw4r/snd/RemoteSpeaker.h index bb866a36..b51b7ec1 100644 --- a/libs/NW4R/include/nw4r/snd/RemoteSpeaker.h +++ b/libs/NW4R/include/nw4r/snd/RemoteSpeaker.h @@ -3,74 +3,76 @@ #include -#include -#include #include +#include +#include namespace nw4r { namespace snd { class RemoteSpeaker { - public: - static const int SAMPLES_PER_AUDIO_PACKET = 40; - static const int SAMPLES_PER_ENCODED_PACKET = (SAMPLES_PER_AUDIO_PACKET + 1) / 2; + public: + static const int SAMPLES_PER_AUDIO_PACKET = 40; + static const int SAMPLES_PER_ENCODED_PACKET = (SAMPLES_PER_AUDIO_PACKET + 1) / 2; - RemoteSpeaker(); + RemoteSpeaker(); - void InitParam(); - void ClearParam(); + void InitParam(); + void ClearParam(); - void Update(const s16* axRemoteSamples); + void Update(const s16* axRemoteSamples); - bool IsAvailable() const { return mRemoteInitFlag; } - void SetChannelIndex(int index) { mChannelIndex = index; } + bool IsAvailable() const { return mRemoteInitFlag; } + void SetChannelIndex(int index) { mChannelIndex = index; } - private: - typedef enum SpeakerState { - STATE_INVALID, - STATE_EXEC_SPEAKER_ON, - STATE_SPEAKER_ON, - STATE_EXEC_SPEAKER_PLAY, - STATE_SPEAKER_PLAY, - STATE_EXEC_SPEAKER_OFF, - STATE_SPEAKER_OFF - } SpeakerState; + private: + // clang-format off + typedef enum SpeakerState { + STATE_INVALID, + STATE_EXEC_SPEAKER_ON, + STATE_SPEAKER_ON, + STATE_EXEC_SPEAKER_PLAY, + STATE_SPEAKER_PLAY, + STATE_EXEC_SPEAKER_OFF, + STATE_SPEAKER_OFF + } SpeakerState; - typedef enum SpeakerCommand { - COMMAND_NONE, - COMMAND_SPEAKER_ON, - COMMAND_SPEAKER_PLAY, - COMMAND_SPEAKER_OFF - } SpeakerCommand; + typedef enum SpeakerCommand { + COMMAND_NONE, + COMMAND_SPEAKER_ON, + COMMAND_SPEAKER_PLAY, + COMMAND_SPEAKER_OFF + } SpeakerCommand; + // clang-format on - bool IsAllSampleZero(const s16* axRemoteSamples); + bool IsAllSampleZero(const s16* axRemoteSamples); - static const int CONTINUOUS_PLAY_INTERVAL_MINUTES = 8; + static const int CONTINUOUS_PLAY_INTERVAL_MINUTES = 8; - static void ContinueAlarmHandler(OSAlarm* alarm, OSContext* context); - static void IntervalAlarmHandler(OSAlarm* alarm, OSContext* context); + static void ContinueAlarmHandler(OSAlarm* alarm, OSContext* context); + static void IntervalAlarmHandler(OSAlarm* alarm, OSContext* context); - bool mInitFlag; // 0x00 - bool mRemoteInitFlag; // 0x01 - bool mPlayFlag; // 0x02 - bool mEnableFlag; // 0x03 - bool mSetupBusyFlag; // 0x04 - bool mFirstEncodeFlag; // 0x05 - bool mForceResumeFlag; // 0x06 - bool mContinueFlag; // 0x07 - bool mIntervalFlag; // 0x08 + bool mInitFlag; // 0x00 + bool mRemoteInitFlag; // 0x01 + bool mPlayFlag; // 0x02 + bool mEnableFlag; // 0x03 + bool mSetupBusyFlag; // 0x04 + bool mFirstEncodeFlag; // 0x05 + bool mForceResumeFlag; // 0x06 + bool mContinueFlag; // 0x07 + bool mIntervalFlag; // 0x08 - WENCInfo mEncodeInfo; // 0x09 + WENCInfo mEncodeInfo; // 0x09 - int mChannelIndex; // 0x2C + int mChannelIndex; // 0x2C - WPADCallback mSetupCallback; // 0x30 + WPADCallback mSetupCallback; // 0x30 - OSAlarm mContinueAlarm; // 0x38 - OSAlarm mInvervalAlarm; // 0x68 + OSAlarm mContinueAlarm; // 0x38 + OSAlarm mInvervalAlarm; // 0x68 - OSTime mContinueBeginTime; // 0x98 + OSTime mContinueBeginTime; // 0x98 }; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_REMOTE_SPEAKER_H +#endif // NW4R_SND_REMOTE_SPEAKER_H diff --git a/libs/NW4R/include/nw4r/snd/RemoteSpeakerManager.h b/libs/NW4R/include/nw4r/snd/RemoteSpeakerManager.h index 37a5f62e..61fa6f05 100644 --- a/libs/NW4R/include/nw4r/snd/RemoteSpeakerManager.h +++ b/libs/NW4R/include/nw4r/snd/RemoteSpeakerManager.h @@ -7,27 +7,27 @@ namespace nw4r { namespace snd { namespace detail { class RemoteSpeakerManager { - public: - static RemoteSpeakerManager& GetInstance(); + public: + static RemoteSpeakerManager& GetInstance(); - RemoteSpeaker& GetRemoteSpeaker(int idx); + RemoteSpeaker& GetRemoteSpeaker(int idx); - void Setup(); + void Setup(); - static const int SPEAKER_ALARM_HZ = 150; - static const int SPEAKER_ALARM_PERIOD_NSEC = static_cast(1.0f / SPEAKER_ALARM_HZ * 1000 * 1000 * 1000); + static const int SPEAKER_ALARM_HZ = 150; + static const int SPEAKER_ALARM_PERIOD_NSEC = static_cast(1.0f / SPEAKER_ALARM_HZ * 1000 * 1000 * 1000); - private: - RemoteSpeakerManager(); + private: + RemoteSpeakerManager(); - static void RemoteSpeakerAlarmProc(OSAlarm* alarm, OSContext* context); + static void RemoteSpeakerAlarmProc(OSAlarm* alarm, OSContext* context); - bool mInitialized; // 0x00 - OSAlarm mRemoteSpeakerAlarm; // 0x08 - RemoteSpeaker mSpeaker[WPAD_MAX_CONTROLLERS]; // 0x38 + bool mInitialized; // 0x00 + OSAlarm mRemoteSpeakerAlarm; // 0x08 + RemoteSpeaker mSpeaker[WPAD_MAX_CONTROLLERS]; // 0x38 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_REMOTE_SPEAKER_MANAGER_H +#endif // NW4R_SND_REMOTE_SPEAKER_MANAGER_H diff --git a/libs/NW4R/include/nw4r/snd/SeqFile.h b/libs/NW4R/include/nw4r/snd/SeqFile.h index 71ff3842..6603c90f 100644 --- a/libs/NW4R/include/nw4r/snd/SeqFile.h +++ b/libs/NW4R/include/nw4r/snd/SeqFile.h @@ -11,37 +11,37 @@ namespace nw4r { namespace detail { namespace SeqFile { typedef struct Header { - ut::BinaryFileHeader fileHeader; // 0x00 - u32 dataBlockOffset; // 0x10 - u32 dataBlockSize; // 0x14 - u32 labelBlockOffset; // 0x18 - u32 labelBlockSize; // 0x1C + ut::BinaryFileHeader fileHeader; // 0x00 + u32 dataBlockOffset; // 0x10 + u32 dataBlockSize; // 0x14 + u32 labelBlockOffset; // 0x18 + u32 labelBlockSize; // 0x1C } Header; typedef struct DataBlock { - ut::BinaryBlockHeader blockHeader; // 0x00 - u32 baseOffset; // 0x08 + ut::BinaryBlockHeader blockHeader; // 0x00 + u32 baseOffset; // 0x08 } DataBlock; - } + } // namespace SeqFile class SeqFileReader { - public: - static const u32 SIGNATURE = 'RSEQ'; - static const int VERSION = NW4R_VERSION(1, 0); + public: + static const u32 SIGNATURE = 'RSEQ'; + static const int VERSION = NW4R_VERSION(1, 0); - explicit SeqFileReader(const void* seqData); + explicit SeqFileReader(const void* seqData); - bool IsValidFileHeader(const void* seqData); + bool IsValidFileHeader(const void* seqData); - const void* GetBaseAddress() const; + const void* GetBaseAddress() const; - private: - const SeqFile::Header* mHeader; // 0x00 - const SeqFile::DataBlock* mDataBlock; // 0x04 + private: + const SeqFile::Header* mHeader; // 0x00 + const SeqFile::DataBlock* mDataBlock; // 0x04 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/SeqPlayer.h b/libs/NW4R/include/nw4r/snd/SeqPlayer.h index f6b0f67e..f82ddc2b 100644 --- a/libs/NW4R/include/nw4r/snd/SeqPlayer.h +++ b/libs/NW4R/include/nw4r/snd/SeqPlayer.h @@ -19,190 +19,182 @@ namespace nw4r { class SeqTrackAllocator; class SeqPlayer : public BasicPlayer, public DisposeCallback { - public: - typedef struct ParserPlayerParam { - u8 volume; // 0x00 - u8 priority; // 0x01 - u16 tempo; // 0x02 + public: + typedef struct ParserPlayerParam { + u8 volume; // 0x00 + u8 priority; // 0x01 + u16 tempo; // 0x02 - NoteOnCallback* callback; // 0x04 - } ParserPlayerParam; + NoteOnCallback* callback; // 0x04 + } ParserPlayerParam; - typedef enum OffsetType { - OFFSET_TYPE_TICK = 0, - OFFSET_TYPE_MILLISEC - } OffsetType; + typedef enum OffsetType { OFFSET_TYPE_TICK = 0, OFFSET_TYPE_MILLISEC } OffsetType; - typedef enum SetupResult { - SETUP_SUCCESS = 0, - SETUP_ERR_CANNOT_ALLOCATE_TRACK, - SETUP_ERR_UNKNOWN - } SetupResult; + typedef enum SetupResult { SETUP_SUCCESS = 0, SETUP_ERR_CANNOT_ALLOCATE_TRACK, SETUP_ERR_UNKNOWN } SetupResult; - static const int LOCAL_VARIABLE_NUM = 16; - static const int GLOBAL_VARIABLE_NUM = 16; - static const int VARIABLE_NUM = LOCAL_VARIABLE_NUM + GLOBAL_VARIABLE_NUM; + static const int LOCAL_VARIABLE_NUM = 16; + static const int GLOBAL_VARIABLE_NUM = 16; + static const int VARIABLE_NUM = LOCAL_VARIABLE_NUM + GLOBAL_VARIABLE_NUM; - static const int TRACK_NUM = 16; + static const int TRACK_NUM = 16; - SeqPlayer(); - virtual ~SeqPlayer(); // 0x8 + SeqPlayer(); + virtual ~SeqPlayer(); // 0x8 - virtual bool Start(); // 0x0C - virtual void Stop(); // 0x10 - virtual void Pause(bool flag); // 0x14 - virtual bool IsActive() const { return mActiveFlag; } // 0x18 - virtual bool IsPrepared() const { return mPreparedFlag; }; // 0x1C - virtual bool IsStarted() const { return mStartedFlag; }; // 0x20 - virtual bool IsPause() const { return mPauseFlag; }; // 0x24 - virtual void SetVolume(f32 volume); // 0x28 - virtual void SetPitch(f32 pitch); // 0x2C - virtual void SetPan(f32 pan); // 0x30 - virtual void SetSurroundPan(f32 surroundPan); // 0x34 - virtual void SetPan2(f32 pan2); // 0x38 - virtual void SetSurroundPan2(f32 surroundPan2); // 0x3C - virtual void SetLpfFreq(f32 lpfFreq); // 0x40 - virtual f32 GetVolume() const { return mExtVolume; }; // 0x44 - virtual f32 GetPitch() const { return mExtPitch; }; // 0x48 - virtual f32 GetPan() const { return mExtPan; }; // 0x4C - virtual f32 GetSurroundPan() const { return mExtSurroundPan; }; // 0x50 - virtual f32 GetPan2() const { return mExtPan2; }; // 0x54 - virtual f32 GetSurroundPan2() const { return mExtSurroundPan2; }; // 0x58 - virtual f32 GetLpfFreq() const { return mExtLpfFreq; }; // 0x5C - virtual void SetOutputLine(int lineFlag); // 0x60 - virtual void SetMainOutVolume(f32 volume); // 0x64 - virtual void SetMainSend(f32 send); // 0x68 - virtual void SetFxSend(AuxBus bus, f32 send); // 0x6C - virtual void SetRemoteOutVolume(int remoteIndex, f32 volume); // 0x70 - virtual void SetRemoteSend(int remoteIndex, f32 send); // 0x74 - virtual void SetRemoteFxSend(int remoteIndex, f32 send); // 0x78 - virtual int GetOutputLine() const; // 0x7C - virtual f32 GetMainOutVolume() const; // 0x80 - virtual f32 GetMainSend() const; // 0x84 - virtual f32 GetFxSend(AuxBus bus) const; // 0x88 - virtual f32 GetRemoteOutVolume(int remoteIndex) const; // 0x8C - virtual f32 GetRemoteSend(int remoteIndex) const; // 0x90 - virtual f32 GetRemoteFxSend(int remoteIndex) const; // 0x94 + virtual bool Start(); // 0x0C + virtual void Stop(); // 0x10 + virtual void Pause(bool flag); // 0x14 + virtual bool IsActive() const { return mActiveFlag; } // 0x18 + virtual bool IsPrepared() const { return mPreparedFlag; }; // 0x1C + virtual bool IsStarted() const { return mStartedFlag; }; // 0x20 + virtual bool IsPause() const { return mPauseFlag; }; // 0x24 + virtual void SetVolume(f32 volume); // 0x28 + virtual void SetPitch(f32 pitch); // 0x2C + virtual void SetPan(f32 pan); // 0x30 + virtual void SetSurroundPan(f32 surroundPan); // 0x34 + virtual void SetPan2(f32 pan2); // 0x38 + virtual void SetSurroundPan2(f32 surroundPan2); // 0x3C + virtual void SetLpfFreq(f32 lpfFreq); // 0x40 + virtual f32 GetVolume() const { return mExtVolume; }; // 0x44 + virtual f32 GetPitch() const { return mExtPitch; }; // 0x48 + virtual f32 GetPan() const { return mExtPan; }; // 0x4C + virtual f32 GetSurroundPan() const { return mExtSurroundPan; }; // 0x50 + virtual f32 GetPan2() const { return mExtPan2; }; // 0x54 + virtual f32 GetSurroundPan2() const { return mExtSurroundPan2; }; // 0x58 + virtual f32 GetLpfFreq() const { return mExtLpfFreq; }; // 0x5C + virtual void SetOutputLine(int lineFlag); // 0x60 + virtual void SetMainOutVolume(f32 volume); // 0x64 + virtual void SetMainSend(f32 send); // 0x68 + virtual void SetFxSend(AuxBus bus, f32 send); // 0x6C + virtual void SetRemoteOutVolume(int remoteIndex, f32 volume); // 0x70 + virtual void SetRemoteSend(int remoteIndex, f32 send); // 0x74 + virtual void SetRemoteFxSend(int remoteIndex, f32 send); // 0x78 + virtual int GetOutputLine() const; // 0x7C + virtual f32 GetMainOutVolume() const; // 0x80 + virtual f32 GetMainSend() const; // 0x84 + virtual f32 GetFxSend(AuxBus bus) const; // 0x88 + virtual f32 GetRemoteOutVolume(int remoteIndex) const; // 0x8C + virtual f32 GetRemoteSend(int remoteIndex) const; // 0x90 + virtual f32 GetRemoteFxSend(int remoteIndex) const; // 0x94 - virtual void InvalidateData(const void* start, const void* end); // 0x50 - virtual void InvalidateWaveData(const void* start, const void* end) {} // 0x54 + virtual void InvalidateData(const void* start, const void* end); // 0x50 + virtual void InvalidateWaveData(const void* start, const void* end) {} // 0x54 - virtual void ChannelCallback(Channel* channel); // 0x58 + virtual void ChannelCallback(Channel* channel); // 0x58 - void InitParam(int voices, NoteOnCallback* callback); + void InitParam(int voices, NoteOnCallback* callback); - SetupResult Setup(SeqTrackAllocator* allocator, u32 allocTrackFlags, int voices, NoteOnCallback* callback); - void SetSeqData(const void* base, s32 offset); + SetupResult Setup(SeqTrackAllocator* allocator, u32 allocTrackFlags, int voices, NoteOnCallback* callback); + void SetSeqData(const void* base, s32 offset); - void Skip(OffsetType type, int offset); + void Skip(OffsetType type, int offset); - void SetTempoRatio(f32 tempo); - void SetChannelPriority(int priority); - void SetReleasePriorityFix(bool flag); + void SetTempoRatio(f32 tempo); + void SetChannelPriority(int priority); + void SetReleasePriorityFix(bool flag); - void SetLocalVariable(int trackNo, s16 value); - static void SetGlobalVariable(int trackNo, s16 value); + void SetLocalVariable(int trackNo, s16 value); + static void SetGlobalVariable(int trackNo, s16 value); - void SetTrackVolume(u32 trackFlags, f32 volume); - void SetTrackPitch(u32 trackFlags, f32 pitch); + void SetTrackVolume(u32 trackFlags, f32 volume); + void SetTrackPitch(u32 trackFlags, f32 pitch); - SeqTrack* GetPlayerTrack(int trackNo); - vs16* GetVariablePtr(int trackNo); - void Update(); + SeqTrack* GetPlayerTrack(int trackNo); + vs16* GetVariablePtr(int trackNo); + void Update(); - Channel* NoteOn(int bankNo, const NoteOnInfo& noteOnInfo); + Channel* NoteOn(int bankNo, const NoteOnInfo& noteOnInfo); - static void UpdateAllPlayers(); - static void StopAllPlayers(); + static void UpdateAllPlayers(); + static void StopAllPlayers(); - template void SetTrackParam(u32 trackFlags, void (SeqTrack::*setter)(T), T param) { - ut::AutoInterruptLock lock; + template + void SetTrackParam(u32 trackFlags, void (SeqTrack::*setter)(T), T param) { + ut::AutoInterruptLock lock; - for (int i = 0; i < TRACK_NUM && trackFlags != 0; - trackFlags >>= 1, i++) { + for (int i = 0; i < TRACK_NUM && trackFlags != 0; trackFlags >>= 1, i++) { + if (trackFlags & 1) { + SeqTrack* track = GetPlayerTrack(i); - if (trackFlags & 1) { - SeqTrack* track = GetPlayerTrack(i); - - if (track != NULL) { - (track->*setter)(param); - } + if (track != NULL) { + (track->*setter)(param); } } } + } - f32 GetPanRange() const { return mPanRange; } - int GetVoiceOutCount() const { return mVoiceOutCount; } - ParserPlayerParam& GetParserPlayerParam() { return mParserParam; } + f32 GetPanRange() const { return mPanRange; } + int GetVoiceOutCount() const { return mVoiceOutCount; } + ParserPlayerParam& GetParserPlayerParam() { return mParserParam; } - private: - static const int DEFAULT_TEMPO = 120; - static const int DEFAULT_PRIORITY = 64; - static const int DEFAULT_VARIABLE_VALUE = -1; + private: + static const int DEFAULT_TEMPO = 120; + static const int DEFAULT_PRIORITY = 64; + static const int DEFAULT_VARIABLE_VALUE = -1; - static const int MAX_SKIP_TICK_PER_FRAME = 768; + static const int MAX_SKIP_TICK_PER_FRAME = 768; - void CloseTrack(int trackNo); - void SetPlayerTrack(int trackNo, SeqTrack* track); + void CloseTrack(int trackNo); + void SetPlayerTrack(int trackNo, SeqTrack* track); - void FinishPlayer(); - void UpdateChannelParam(); - int UpdateTempoCounter(); - int ParseNextTick(bool doNoteOn); + void FinishPlayer(); + void UpdateChannelParam(); + int UpdateTempoCounter(); + int ParseNextTick(bool doNoteOn); - void UpdateTick(int msec); - void SkipTick(); + void UpdateTick(int msec); + void SkipTick(); - static void InitGlobalVariable(); + static void InitGlobalVariable(); - bool mHomeButtonMenuFlag; // 0x14 - u8 mActiveFlag; // 0x15 - u8 mPreparedFlag; // 0x16 - u8 mStartedFlag; // 0x17 - u8 mPauseFlag; // 0x18 - bool mSkipFlag; // 0x19 + bool mHomeButtonMenuFlag; // 0x14 + u8 mActiveFlag; // 0x15 + u8 mPreparedFlag; // 0x16 + u8 mStartedFlag; // 0x17 + u8 mPauseFlag; // 0x18 + bool mSkipFlag; // 0x19 - f32 mExtVolume; // 0x1C - f32 mExtPan; // 0x20 - f32 mExtSurroundPan; // 0x24 - f32 mPanRange; // 0x28 - f32 mExtPan2; // 0x2C - f32 mExtSurroundPan2; // 0x30 - f32 mExtPitch; // 0x34 - f32 mExtLpfFreq; // 0x38 + f32 mExtVolume; // 0x1C + f32 mExtPan; // 0x20 + f32 mExtSurroundPan; // 0x24 + f32 mPanRange; // 0x28 + f32 mExtPan2; // 0x2C + f32 mExtSurroundPan2; // 0x30 + f32 mExtPitch; // 0x34 + f32 mExtLpfFreq; // 0x38 - int mOutputLineFlag; // 0x3C + int mOutputLineFlag; // 0x3C - f32 mMainOutVolume; // 0x40 - f32 mMainSend; // 0x44 + f32 mMainOutVolume; // 0x40 + f32 mMainSend; // 0x44 - f32 mFxSend[AUX_BUS_NUM]; // 0x48 + f32 mFxSend[AUX_BUS_NUM]; // 0x48 - f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // 0x54 - f32 mRemoteSend[WPAD_MAX_CONTROLLERS]; // 0x64 - f32 mRemoteFxSend[WPAD_MAX_CONTROLLERS]; // 0x74 + f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // 0x54 + f32 mRemoteSend[WPAD_MAX_CONTROLLERS]; // 0x64 + f32 mRemoteFxSend[WPAD_MAX_CONTROLLERS]; // 0x74 - f32 mTempoRatio; // 0x84 - u16 mTempoCounter; // 0x88 + f32 mTempoRatio; // 0x84 + u16 mTempoCounter; // 0x88 - s32 mVoiceOutCount; // 0x8C + s32 mVoiceOutCount; // 0x8C - ParserPlayerParam mParserParam; // 0x90 - SeqTrackAllocator* mSeqTrackAllocator; // 0x98 + ParserPlayerParam mParserParam; // 0x90 + SeqTrackAllocator* mSeqTrackAllocator; // 0x98 - SeqTrack* mTracks[TRACK_NUM]; // 0x9C - vs16 mLocalVariable[TRACK_NUM]; // 0xDC + SeqTrack* mTracks[TRACK_NUM]; // 0x9C + vs16 mLocalVariable[TRACK_NUM]; // 0xDC - u32 mTickCounter; // 0xFC + u32 mTickCounter; // 0xFC - static vs16 mGlobalVariable[LOCAL_VARIABLE_NUM]; + static vs16 mGlobalVariable[LOCAL_VARIABLE_NUM]; - public: - ut::LinkListNode mPlayerLink; // 0x100 + public: + ut::LinkListNode mPlayerLink; // 0x100 }; typedef ut::LinkList SeqPlayerList; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/SeqSound.h b/libs/NW4R/include/nw4r/snd/SeqSound.h index b2e0ee0f..8bc863a2 100644 --- a/libs/NW4R/include/nw4r/snd/SeqSound.h +++ b/libs/NW4R/include/nw4r/snd/SeqSound.h @@ -17,65 +17,60 @@ namespace nw4r { namespace detail { class NoteOnCallback; class SeqTrackAllocator; - template class SoundInstanceManager; - } + template + class SoundInstanceManager; + } // namespace detail namespace detail { class SeqSound : public BasicSound { friend class SeqSoundHandle; + public: + NW4R_UT_RUNTIME_TYPEINFO; + typedef void (*NotifyAsyncEndCallback)(bool result, const void* seqBase, s32 seqOffset, void* userData); + + class SeqLoadCallback { public: - NW4R_UT_RUNTIME_TYPEINFO; - typedef void (*NotifyAsyncEndCallback)(bool result, const void* seqBase, s32 seqOffset, void* userData); + typedef enum Result { RESULT_SUCCESS = 0, RESULT_FAILED, RESULT_CANCELED, RESULT_ASYNC, RESULT_RETRY } Result; - class SeqLoadCallback { - public: - typedef enum Result { - RESULT_SUCCESS = 0, - RESULT_FAILED, - RESULT_CANCELED, - RESULT_ASYNC, - RESULT_RETRY - } Result; + virtual ~SeqLoadCallback() {} - virtual ~SeqLoadCallback() {} + virtual Result LoadData(SeqSound::NotifyAsyncEndCallback callback, void* callbackArg, u32 userData) const = 0; + virtual void CancelLoading(u32 userData) const = 0; + }; + explicit SeqSound(SoundInstanceManager* nanager); - virtual Result LoadData(SeqSound::NotifyAsyncEndCallback callback, void* callbackArg, u32 userData) const = 0; - virtual void CancelLoading(u32 userData) const = 0; - }; - explicit SeqSound(SoundInstanceManager* nanager); + virtual void Shutdown(); // 0x28 - virtual void Shutdown(); // 0x28 + virtual void SetPlayerPriority(int priority); // 0x4C - virtual void SetPlayerPriority(int priority); // 0x4C + virtual bool IsAttachedTempSpecialHandle(); // 0x5C + virtual void DetachTempSpecialHandle(); // 0x60 - virtual bool IsAttachedTempSpecialHandle(); // 0x5C - virtual void DetachTempSpecialHandle(); // 0x60 + virtual void InitParam(); // 0x64 - virtual void InitParam(); // 0x64 + virtual BasicPlayer& GetBasicPlayer() { return mSeqPlayer; } // 0x68 + virtual const BasicPlayer& GetBasicPlayer() const { return mSeqPlayer; } // 0x6C - virtual BasicPlayer& GetBasicPlayer() { return mSeqPlayer; } // 0x68 - virtual const BasicPlayer& GetBasicPlayer() const { return mSeqPlayer; } // 0x6C + SeqPlayer::SetupResult Setup(SeqTrackAllocator* trackAllocator, u32 allocTrackFlags, int voices, NoteOnCallback* callback); - SeqPlayer::SetupResult Setup(SeqTrackAllocator* trackAllocator, u32 allocTrackFlags, int voices, NoteOnCallback* callback); + void Prepare(const void* base, s32 seqOffset); + void Prepare(const SeqLoadCallback* callback, u32 callbackData); - void Prepare(const void* base, s32 seqOffset); - void Prepare(const SeqLoadCallback* callback, u32 callbackData); + void SetChannelPriority(int priority); - void SetChannelPriority(int priority); + private: + static void NotifyLoadAsyncEndSeqData(bool result, const void* seqBase, s32 seqOffset, void* userData); - private: - static void NotifyLoadAsyncEndSeqData(bool result, const void* seqBase, s32 seqOffset, void* userData); + SeqPlayer mSeqPlayer; // 0xD8 + SeqSoundHandle* mTempSpecialHandle; // 0x1F4 + SoundInstanceManager* mManager; // 0x1F8 - SeqPlayer mSeqPlayer; // 0xD8 - SeqSoundHandle* mTempSpecialHandle; // 0x1F4 - SoundInstanceManager* mManager; // 0x1F8 - - bool mLoadingFlag; // 0x1E8 - const SeqLoadCallback* mCallback; // 0x1EC - u32 mCallbackData; // 0x1F0 + bool mLoadingFlag; // 0x1E8 + const SeqLoadCallback* mCallback; // 0x1EC + u32 mCallbackData; // 0x1F0 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/SeqSoundHandle.h b/libs/NW4R/include/nw4r/snd/SeqSoundHandle.h index 6b4f631c..62ad110d 100644 --- a/libs/NW4R/include/nw4r/snd/SeqSoundHandle.h +++ b/libs/NW4R/include/nw4r/snd/SeqSoundHandle.h @@ -10,22 +10,18 @@ namespace nw4r { namespace snd { class SeqSoundHandle : private ut::NonCopyable { - public: - ~SeqSoundHandle() { - DetachSound(); - } + public: + ~SeqSoundHandle() { DetachSound(); } - void DetachSound(); + void DetachSound(); - bool IsAttachedSound() const { - return mSound != NULL; - } + bool IsAttachedSound() const { return mSound != NULL; } - private: - detail::SeqSound* mSound; // 0x00 + private: + detail::SeqSound* mSound; // 0x00 }; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_SEQ_SOUND_HANDLE_H +#endif // NW4R_SND_SEQ_SOUND_HANDLE_H diff --git a/libs/NW4R/include/nw4r/snd/SeqTrack.h b/libs/NW4R/include/nw4r/snd/SeqTrack.h index 942a9435..2180ad96 100644 --- a/libs/NW4R/include/nw4r/snd/SeqTrack.h +++ b/libs/NW4R/include/nw4r/snd/SeqTrack.h @@ -10,6 +10,7 @@ namespace nw4r { namespace snd { + // clang-format off typedef enum SeqMute { MUTE_OFF = 0, MUTE_NO_STOP, @@ -21,132 +22,133 @@ namespace nw4r { PARSE_RESULT_CONTINUE = 0, PARSE_RESULT_FINISH } ParseResult; + // clang-format on namespace detail { class SeqPlayer; class SeqTrack { - public: - static const int VARIABLE_NUM = 16; - static const int PRGNO_MAX = 0xFFFF; + public: + static const int VARIABLE_NUM = 16; + static const int PRGNO_MAX = 0xFFFF; - typedef struct ParserTrackParam { - const u8* baseAddr; // 0x00 - const u8* currentAddr; // 0x04 + typedef struct ParserTrackParam { + const u8* baseAddr; // 0x00 + const u8* currentAddr; // 0x04 - s32 wait; // 0x08 - u8 muteFlag; // 0x0C - u8 silenceFlag; // 0x0D - u8 noteFinishWait; // 0x0E - u8 portaFlag; // 0x0F + s32 wait; // 0x08 + u8 muteFlag; // 0x0C + u8 silenceFlag; // 0x0D + u8 noteFinishWait; // 0x0E + u8 portaFlag; // 0x0F - int bankNo; // 0x10 - int prgNo; // 0x14 + int bankNo; // 0x10 + int prgNo; // 0x14 - LfoParam lfoParam; // 0x18 - u8 lfoTarget; // 0x28 + LfoParam lfoParam; // 0x18 + u8 lfoTarget; // 0x28 - f32 sweepPitch; // 0x2C + f32 sweepPitch; // 0x2C - u8 volume; // 0x30 - u8 volume2; // 0x31 + u8 volume; // 0x30 + u8 volume2; // 0x31 - s8 pitchBend; // 0x32 - u8 bendRange; // 0x33 + s8 pitchBend; // 0x32 + u8 bendRange; // 0x33 - s8 pan; // 0x34 - s8 initPan; // 0x35 - s8 surroundPan; // 0x36 + s8 pan; // 0x34 + s8 initPan; // 0x35 + s8 surroundPan; // 0x36 - s8 transpose; // 0x37 + s8 transpose; // 0x37 - u8 priority; // 0x38 + u8 priority; // 0x38 - u8 portaKey; // 0x39 - u8 portaTime; // 0x3A + u8 portaKey; // 0x39 + u8 portaTime; // 0x3A - u8 attack; // 0x3B - u8 decay; // 0x3C - u8 sustain; // 0x3D - u8 release; // 0x3E - u8 mainSend; // 0x3F + u8 attack; // 0x3B + u8 decay; // 0x3C + u8 sustain; // 0x3D + u8 release; // 0x3E + u8 mainSend; // 0x3F - u8 fxSend[AUX_BUS_NUM]; // 0x40 + u8 fxSend[AUX_BUS_NUM]; // 0x40 - u8 lpfFreq; // 0x43 - } ParserTrackParam; + u8 lpfFreq; // 0x43 + } ParserTrackParam; - public: - SeqTrack() : mSeqPlayer(NULL) { InitParam(); } - virtual ~SeqTrack() {} // 0x08 + public: + SeqTrack() : mSeqPlayer(NULL) { InitParam(); } + virtual ~SeqTrack() {} // 0x08 - virtual ParseResult Parse(bool doNoteOn) = 0; // 0x0C + virtual ParseResult Parse(bool doNoteOn) = 0; // 0x0C - void SetPlayerTrackNo(int no); - u8 GetPlayerTrackNo() const { return mPlayerTrackNo; } + void SetPlayerTrackNo(int no); + u8 GetPlayerTrackNo() const { return mPlayerTrackNo; } - void InitParam(); - void SetSeqData(const void* base, s32 offset); + void InitParam(); + void SetSeqData(const void* base, s32 offset); - void Open(); - void Close(); + void Open(); + void Close(); - void UpdateChannelLength(); - void UpdateChannelRelease(Channel* channel); + void UpdateChannelLength(); + void UpdateChannelRelease(Channel* channel); - int ParseNextTick(bool doNoteOn); + int ParseNextTick(bool doNoteOn); - void StopAllChannel(); - void ReleaseAllChannel(int release) NO_INLINE; - void PauseAllChannel(bool flag); - void AddChannel(Channel* channel); - void UpdateChannelParam(); - void FreeAllChannel(); + void StopAllChannel(); + void ReleaseAllChannel(int release) NO_INLINE; + void PauseAllChannel(bool flag); + void AddChannel(Channel* channel); + void UpdateChannelParam(); + void FreeAllChannel(); - void SetMute(SeqMute mute); - void SetVolume(f32 volume); - void SetPitch(f32 pitch); + void SetMute(SeqMute mute); + void SetVolume(f32 volume); + void SetPitch(f32 pitch); - ParserTrackParam& GetParserTrackParam() { return mParserTrackParam; } + ParserTrackParam& GetParserTrackParam() { return mParserTrackParam; } - vs16* GetVariablePtr(int idx); + vs16* GetVariablePtr(int idx); - SeqPlayer* GetSeqPlayer() { return mSeqPlayer; } - void SetSeqPlayer(SeqPlayer* seqPlayer) { mSeqPlayer = seqPlayer; } + SeqPlayer* GetSeqPlayer() { return mSeqPlayer; } + void SetSeqPlayer(SeqPlayer* seqPlayer) { mSeqPlayer = seqPlayer; } - Channel* GetLastChannel() const { return mChannelList; } + Channel* GetLastChannel() const { return mChannelList; } - Channel* NoteOn(int key, int velocity, s32 length, bool tie); + Channel* NoteOn(int key, int velocity, s32 length, bool tie); - private: - static const int DEFAULT_PRIORITY = 64; - static const int DEFAULT_BENDRANGE = 2; - static const int DEFAULT_PORTA_KEY = 60; - static const int DEFAULT_VARIABLE_VALUE = -1; + private: + static const int DEFAULT_PRIORITY = 64; + static const int DEFAULT_BENDRANGE = 2; + static const int DEFAULT_PORTA_KEY = 60; + static const int DEFAULT_VARIABLE_VALUE = -1; - private: - static void ChannelCallbackFunc(Channel* dropChannel, Channel::ChannelCallbackStatus status, u32 userData); + private: + static void ChannelCallbackFunc(Channel* dropChannel, Channel::ChannelCallbackStatus status, u32 userData); - private: - u8 mPlayerTrackNo; // 0x04 + private: + u8 mPlayerTrackNo; // 0x04 - f32 mExtVolume; // 0x08 - f32 mExtPitch; // 0x0C - f32 mExtPan; // 0x10 - f32 mExtSurroundPan; // 0x14 - f32 mPanRange; // 0x18 - f32 mExtLpfFreq; // 0x1C - f32 mExtMainSend; // 0x20 - f32 mExtFxSend[AUX_BUS_NUM]; // 0x24 - f32 mExtRemoteSend[WPAD_MAX_CONTROLLERS]; // 0x30 - f32 mExtRemoteFxSend[WPAD_MAX_CONTROLLERS]; // 0x40 + f32 mExtVolume; // 0x08 + f32 mExtPitch; // 0x0C + f32 mExtPan; // 0x10 + f32 mExtSurroundPan; // 0x14 + f32 mPanRange; // 0x18 + f32 mExtLpfFreq; // 0x1C + f32 mExtMainSend; // 0x20 + f32 mExtFxSend[AUX_BUS_NUM]; // 0x24 + f32 mExtRemoteSend[WPAD_MAX_CONTROLLERS]; // 0x30 + f32 mExtRemoteFxSend[WPAD_MAX_CONTROLLERS]; // 0x40 - ParserTrackParam mParserTrackParam; // 0x50 - vs16 mTrackVariable[VARIABLE_NUM]; // 0x94 - SeqPlayer* mSeqPlayer; // 0xB4 - Channel* mChannelList; // 0xB8 + ParserTrackParam mParserTrackParam; // 0x50 + vs16 mTrackVariable[VARIABLE_NUM]; // 0x94 + SeqPlayer* mSeqPlayer; // 0xB4 + Channel* mChannelList; // 0xB8 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/SeqTrackAllocator.h b/libs/NW4R/include/nw4r/snd/SeqTrackAllocator.h index 61ec6f58..2e2f98a9 100644 --- a/libs/NW4R/include/nw4r/snd/SeqTrackAllocator.h +++ b/libs/NW4R/include/nw4r/snd/SeqTrackAllocator.h @@ -8,15 +8,15 @@ namespace nw4r { class SeqTrack; class SeqTrackAllocator { - public: - virtual ~SeqTrackAllocator() {} // 0x08 + public: + virtual ~SeqTrackAllocator() {} // 0x08 - virtual SeqTrack* AllocTrack(SeqPlayer* player) = 0; // 0x0C - virtual void FreeTrack(SeqTrack* track) = 0; // 0x10 + virtual SeqTrack* AllocTrack(SeqPlayer* player) = 0; // 0x0C + virtual void FreeTrack(SeqTrack* track) = 0; // 0x10 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/SoundArchive.h b/libs/NW4R/include/nw4r/snd/SoundArchive.h index 7d9914ac..093848b3 100644 --- a/libs/NW4R/include/nw4r/snd/SoundArchive.h +++ b/libs/NW4R/include/nw4r/snd/SoundArchive.h @@ -11,155 +11,157 @@ namespace nw4r { class SoundArchiveFileReader; } + // clang-format off typedef enum SoundType { SOUND_TYPE_INVALID = 0, SOUND_TYPE_SEQ, SOUND_TYPE_STRM, SOUND_TYPE_WAVE } SoundType; + // clang-format on class SoundArchive { - public: - typedef struct SoundInfo { - u32 fileId; // 0x00 - u32 playerId; // 0x04 - int playerPriority; // 0x08 - int volume; // 0x0C - } SoundInfo; + public: + typedef struct SoundInfo { + u32 fileId; // 0x00 + u32 playerId; // 0x04 + int playerPriority; // 0x08 + int volume; // 0x0C + } SoundInfo; - typedef struct SeqSoundInfo { - u32 dataOffset; // 0x00 - u32 bankId; // 0x04 - u32 allocTrack; // 0x08 - int channelPriority; // 0x0C - } SeqSoundInfo; + typedef struct SeqSoundInfo { + u32 dataOffset; // 0x00 + u32 bankId; // 0x04 + u32 allocTrack; // 0x08 + int channelPriority; // 0x0C + } SeqSoundInfo; - typedef struct StrmSoundInfo { - /* Nothing here to see */ - } StrmSoundInfo; + typedef struct StrmSoundInfo { + /* Nothing here to see */ + } StrmSoundInfo; - typedef struct WaveSoundInfo { - int subNo; // 0x00 - int channelPriority; // 0x04 - } WaveSoundInfo; + typedef struct WaveSoundInfo { + int subNo; // 0x00 + int channelPriority; // 0x04 + } WaveSoundInfo; - typedef struct Sound3DParam { - u32 flags; // 0x00 - u8 decayCurve; // 0x04 - u8 decayRatio; // 0x05 - } Sound3DParam; + typedef struct Sound3DParam { + u32 flags; // 0x00 + u8 decayCurve; // 0x04 + u8 decayRatio; // 0x05 + } Sound3DParam; - typedef struct BankInfo { - u32 fileId; // 0x0 - } BankInfo; + typedef struct BankInfo { + u32 fileId; // 0x0 + } BankInfo; - typedef struct PlayerInfo { - int playableSoundCount; // 0x00 - u32 heapSize; // 0x04 - } PlayerInfo; + typedef struct PlayerInfo { + int playableSoundCount; // 0x00 + u32 heapSize; // 0x04 + } PlayerInfo; - typedef struct GroupInfo { - u32 itemCount; // 0x00 - const char* extFilePath; // 0x04 - u32 offset; // 0x08 - u32 size; // 0x0C - u32 waveDataOffset; // 0x10 - u32 waveDataSize; // 0x14 - } GroupInfo; + typedef struct GroupInfo { + u32 itemCount; // 0x00 + const char* extFilePath; // 0x04 + u32 offset; // 0x08 + u32 size; // 0x0C + u32 waveDataOffset; // 0x10 + u32 waveDataSize; // 0x14 + } GroupInfo; - typedef struct GroupItemInfo { - u32 fileId; // 0x00 - u32 offset; // 0x04 - u32 size; // 0x08 - u32 waveDataOffset; // 0x0C - u32 waveDataSize; // 0x10 - } GroupItemInfo; + typedef struct GroupItemInfo { + u32 fileId; // 0x00 + u32 offset; // 0x04 + u32 size; // 0x08 + u32 waveDataOffset; // 0x0C + u32 waveDataSize; // 0x10 + } GroupItemInfo; - typedef struct FileInfo { - u32 fileSize; // 0x00 - u32 waveDataFileSize; // 0x04 - const char* extFilePath; // 0x08 - u32 filePosCount; // 0x0C - } FileInfo; + typedef struct FileInfo { + u32 fileSize; // 0x00 + u32 waveDataFileSize; // 0x04 + const char* extFilePath; // 0x08 + u32 filePosCount; // 0x0C + } FileInfo; - typedef struct FilePos { - u32 groupId; // 0x00 - u32 index; // 0x04 - } FilePos; + typedef struct FilePos { + u32 groupId; // 0x00 + u32 index; // 0x04 + } FilePos; - typedef struct SoundArchivePlayerInfo { - int seqSoundCount; // 0x00 - int seqTrackCount; // 0x04 - int strmSoundCount; // 0x08 - int strmTrackCount; // 0x0C - int strmChannelCount; // 0x10 - int waveSoundCount; // 0x14 - int waveTrackCount; // 0x18 - } SoundArchivePlayerInfo; + typedef struct SoundArchivePlayerInfo { + int seqSoundCount; // 0x00 + int seqTrackCount; // 0x04 + int strmSoundCount; // 0x08 + int strmTrackCount; // 0x0C + int strmChannelCount; // 0x10 + int waveSoundCount; // 0x14 + int waveTrackCount; // 0x18 + } SoundArchivePlayerInfo; - static const u32 INVALID_ID = 0xFFFFFFFF; + static const u32 INVALID_ID = 0xFFFFFFFF; - public: - SoundArchive(); - virtual ~SoundArchive(); // 0x08 + public: + SoundArchive(); + virtual ~SoundArchive(); // 0x08 - virtual const void* detail_GetFileAddress(u32 id) const = 0; // 0x0C - virtual const void* detail_GetWaveDataFileAddress(u32 id) const = 0; // 0x10 + virtual const void* detail_GetFileAddress(u32 id) const = 0; // 0x0C + virtual const void* detail_GetWaveDataFileAddress(u32 id) const = 0; // 0x10 - virtual int detail_GetRequiredStreamBufferSize() const = 0; // 0x14 + virtual int detail_GetRequiredStreamBufferSize() const = 0; // 0x14 - virtual ut::FileStream* OpenStream(void* buffer, int bufferSize, u32 offset, u32 length) const = 0; // 0x18 - virtual ut::FileStream* OpenExtStream(void* buffer, int bufferSize, const char* extPath, u32 offset, u32 length) const = 0; // 0x1C + virtual ut::FileStream* OpenStream(void* buffer, int bufferSize, u32 offset, u32 length) const = 0; // 0x18 + virtual ut::FileStream* OpenExtStream(void* buffer, int bufferSize, const char* extPath, u32 offset, u32 length) const = 0; // 0x1C - bool IsAvailable() const; + bool IsAvailable() const; - void Setup(detail::SoundArchiveFileReader* pReader); - void Shutdown(); + void Setup(detail::SoundArchiveFileReader* pReader); + void Shutdown(); - u32 GetPlayerCount() const; - u32 GetGroupCount() const; + u32 GetPlayerCount() const; + u32 GetGroupCount() const; - const char* GetSoundLabelString(u32 id) const; - u32 ConvertLabelStringToSoundId(const char* label) const; - u32 ConvertLabelStringToPlayerId(const char* label) const; - u32 ConvertLabelStringToGroupId(const char* label) const; + const char* GetSoundLabelString(u32 id) const; + u32 ConvertLabelStringToSoundId(const char* label) const; + u32 ConvertLabelStringToPlayerId(const char* label) const; + u32 ConvertLabelStringToGroupId(const char* label) const; - u32 GetSoundUserParam(u32 id) const; - SoundType GetSoundType(u32 id) const; + u32 GetSoundUserParam(u32 id) const; + SoundType GetSoundType(u32 id) const; - bool ReadSoundInfo(u32 id, SoundInfo* info) const; - bool detail_ReadSeqSoundInfo(u32 id, SeqSoundInfo* info) const; - bool detail_ReadStrmSoundInfo(u32 id, StrmSoundInfo* info) const; - bool detail_ReadWaveSoundInfo(u32 id, WaveSoundInfo* info) const; + bool ReadSoundInfo(u32 id, SoundInfo* info) const; + bool detail_ReadSeqSoundInfo(u32 id, SeqSoundInfo* info) const; + bool detail_ReadStrmSoundInfo(u32 id, StrmSoundInfo* info) const; + bool detail_ReadWaveSoundInfo(u32 id, WaveSoundInfo* info) const; - bool ReadPlayerInfo(u32 id, PlayerInfo* info) const; - bool ReadSoundArchivePlayerInfo(SoundArchivePlayerInfo* info) const; + bool ReadPlayerInfo(u32 id, PlayerInfo* info) const; + bool ReadSoundArchivePlayerInfo(SoundArchivePlayerInfo* info) const; - bool detail_ReadBankInfo(u32 id, BankInfo* info) const; - bool detail_ReadGroupInfo(u32 id, GroupInfo* info) const; - bool detail_ReadGroupItemInfo(u32 groupId, u32 itemId, GroupItemInfo* info) const; + bool detail_ReadBankInfo(u32 id, BankInfo* info) const; + bool detail_ReadGroupInfo(u32 id, GroupInfo* info) const; + bool detail_ReadGroupItemInfo(u32 groupId, u32 itemId, GroupItemInfo* info) const; - bool detail_ReadFileInfo(u32 id, FileInfo* info) const; - bool detail_ReadFilePos(u32 fileId, u32 posId, FilePos* pos) const; + bool detail_ReadFileInfo(u32 id, FileInfo* info) const; + bool detail_ReadFilePos(u32 fileId, u32 posId, FilePos* pos) const; - ut::FileStream* detail_OpenFileStream(u32 id, void* buffer, int bufferSize) const; - ut::FileStream* detail_OpenGroupStream(u32 id, void* buffer, int bufferSize) const; - ut::FileStream* detail_OpenGroupWaveDataStream(u32 id, void* buffer, int bufferSize) const; + ut::FileStream* detail_OpenFileStream(u32 id, void* buffer, int bufferSize) const; + ut::FileStream* detail_OpenGroupStream(u32 id, void* buffer, int bufferSize) const; + ut::FileStream* detail_OpenGroupWaveDataStream(u32 id, void* buffer, int bufferSize) const; - void SetExternalFileRoot(const char* extFileRoot); + void SetExternalFileRoot(const char* extFileRoot); - protected: - static const int FILE_PATH_MAX = 256; + protected: + static const int FILE_PATH_MAX = 256; - private: - ut::FileStream* OpenExtStreamImpl(void* buffer, int bufferSize, const char* extPath, u32 offset, u32 size) const; + private: + ut::FileStream* OpenExtStreamImpl(void* buffer, int bufferSize, const char* extPath, u32 offset, u32 size) const; - private: - detail::SoundArchiveFileReader* mFileReader; // 0x04 - char mExtFileRoot[FILE_PATH_MAX]; // 0x08 + private: + detail::SoundArchiveFileReader* mFileReader; // 0x04 + char mExtFileRoot[FILE_PATH_MAX]; // 0x08 }; - } -} + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/SoundArchiveFile.h b/libs/NW4R/include/nw4r/snd/SoundArchiveFile.h index 6eb81a16..ac896bde 100644 --- a/libs/NW4R/include/nw4r/snd/SoundArchiveFile.h +++ b/libs/NW4R/include/nw4r/snd/SoundArchiveFile.h @@ -17,29 +17,29 @@ namespace nw4r { namespace detail { namespace SoundArchiveFile { typedef struct StringTreeNode { - u16 flags; // 0x00 - u16 bit; // 0x02 - u32 leftIdx; // 0x04 - u32 rightIdx; // 0x08 - u32 strIdx; // 0x0C - u32 id; // 0x10 + u16 flags; // 0x00 + u16 bit; // 0x02 + u32 leftIdx; // 0x04 + u32 rightIdx; // 0x08 + u32 strIdx; // 0x0C + u32 id; // 0x10 } StringTreeNode; typedef struct StringTree { - u32 rootIdx; // 0x00 + u32 rootIdx; // 0x00 Util::Table nodeTable; // 0x04 } StringTree; typedef struct StringTable { - Util::Table offsetTable; // 0x00 + Util::Table offsetTable; // 0x00 } StringTable; typedef struct StringChunk { - u32 tableOffset; // 0x00 - u32 soundTreeOffset; // 0x04 - u32 playerTreeOffset; // 0x08 - u32 groupTreeOffset; // 0x0C - u32 bankTreeOffset; // 0x10 + u32 tableOffset; // 0x00 + u32 soundTreeOffset; // 0x04 + u32 playerTreeOffset; // 0x08 + u32 groupTreeOffset; // 0x0C + u32 bankTreeOffset; // 0x10 } StringChunk; typedef struct StringBlock { @@ -50,16 +50,16 @@ namespace nw4r { } StringBlock; typedef struct SymbolBlock { - ut::BinaryBlockHeader blockHeader; // 0x00 - StringBlock stringBlock; // 0x08 + ut::BinaryBlockHeader blockHeader; // 0x00 + StringBlock stringBlock; // 0x08 } SymbolBlock; typedef struct SeqSoundInfo { u32 dataOffset; // 0x00 u32 bankId; // 0x04 u32 allocTrack; // 0x08 - u8 channelPriority; // 0x0C - u8 releasePriorityFix; // 0x0D + u8 channelPriority; // 0x0C + u8 releasePriorityFix; // 0x0D } SeqSoundInfo; typedef struct StrmSoundInfo { @@ -69,202 +69,213 @@ namespace nw4r { typedef struct WaveSoundInfo { s32 subNo; // 0x00 u32 allocTrack; // 0x04 - u8 channelPriority; // 0x08 - u8 releasePriorityFix; // 0x09 + u8 channelPriority; // 0x08 + u8 releasePriorityFix; // 0x09 } WaveSoundInfo; typedef Util::DataRef SoundInfoOffset; typedef struct Sound3DParam { u32 flags; // 0x00 - u8 decayCurve; // 0x04 - u8 decayRatio; // 0x05 + u8 decayCurve; // 0x04 + u8 decayRatio; // 0x05 } Sound3DParam; typedef struct SoundCommonInfo { - u32 stringId; // 0x00 - u32 fileId; // 0x04 - u32 playerId; // 0x08 + u32 stringId; // 0x00 + u32 fileId; // 0x04 + u32 playerId; // 0x08 - Util::DataRef param3dRef; // 0x0C - u8 volume; // 0x14 - u8 playerPriority; // 0x15 - u8 soundType; // 0x16 - u8 remoteFilter; // 0x17 - SoundInfoOffset soundInfoRef; // 0x18 + Util::DataRef param3dRef; // 0x0C + u8 volume; // 0x14 + u8 playerPriority; // 0x15 + u8 soundType; // 0x16 + u8 remoteFilter; // 0x17 + SoundInfoOffset soundInfoRef; // 0x18 - u32 userParam[2]; // 0x20 + u32 userParam[2]; // 0x20 - u8 panMode; // 0x28 - u8 panCurve; // 0x29 + u8 panMode; // 0x28 + u8 panCurve; // 0x29 } SoundCommonInfo; + // clang-format off typedef Util::Table > SoundCommonTable; + // clang-format on typedef struct BankInfo { - u32 stringId; // 0x00 - u32 fileId; // 0x04 + u32 stringId; // 0x00 + u32 fileId; // 0x04 } BankInfo; + // clang-format off typedef Util::Table > BankTable; + // clang-format on typedef struct PlayerInfo { u32 stringId; // 0x00 - u8 playableSoundCount; // 0x04 + u8 playableSoundCount; // 0x04 u32 heapSize; // 0x08 } PlayerInfo; + // clang-format off typedef Util::Table > PlayerTable; - typedef Util::Table > FilePosTable; + // clang-format on typedef struct FileInfo { - u32 fileSize; // 0x00 - u32 waveDataSize; // 0x04 - s32 entryNum; // 0x08 - Util::DataRef extFilePathRef; // 0x0C - Util::DataRef filePosTableRef; // 0x14 + u32 fileSize; // 0x00 + u32 waveDataSize; // 0x04 + s32 entryNum; // 0x08 + Util::DataRef extFilePathRef; // 0x0C + Util::DataRef filePosTableRef; // 0x14 } FileInfo; + // clang-format off typedef Util::Table > FileTable; + // clang-format on typedef struct GroupItemInfo { - u32 fileId; // 0x0 - u32 offset; // 0x4 - u32 size; // 0x8 - u32 waveDataOffset; // 0xC - u32 waveDataSize; // 0x10 + u32 fileId; // 0x0 + u32 offset; // 0x4 + u32 size; // 0x8 + u32 waveDataOffset; // 0xC + u32 waveDataSize; // 0x10 } GroupItemInfo; + // clang-format off typedef Util::Table > GroupItemTable; + // clang-format on typedef struct GroupInfo { - u32 stringId; // 0x00 - s32 entryNum; // 0x04 - Util::DataRef extFilePathRef; // 0x08 - u32 offset; // 0x10 - u32 size; // 0x14 - u32 waveDataOffset; // 0x18 - u32 waveDataSize; // 0x1C - Util::DataRef itemTableRef; // 0x20 + u32 stringId; // 0x00 + s32 entryNum; // 0x04 + Util::DataRef extFilePathRef; // 0x08 + u32 offset; // 0x10 + u32 size; // 0x14 + u32 waveDataOffset; // 0x18 + u32 waveDataSize; // 0x1C + Util::DataRef itemTableRef; // 0x20 } GroupInfo; + // clang-format off typedef Util::Table > GroupTable; + // clang-format on typedef struct SoundArchivePlayerInfo { - u16 seqSoundCount; // 0x00 - u16 seqTrackCount; // 0x02 - u16 strmSoundCount; // 0x04 - u16 strmTrackCount; // 0x06 - u16 strmChannelCount; // 0x08 - u16 waveSoundCount; // 0x0A - u16 waveTrackCount; // 0x0C + u16 seqSoundCount; // 0x00 + u16 seqTrackCount; // 0x02 + u16 strmSoundCount; // 0x04 + u16 strmTrackCount; // 0x06 + u16 strmChannelCount; // 0x08 + u16 waveSoundCount; // 0x0A + u16 waveTrackCount; // 0x0C } SoundArchivePlayerInfo; typedef struct Info { - Util::DataRef soundTableRef; // 0x00 - Util::DataRef bankTableRef; // 0x08 - Util::DataRef playerTableRef; // 0x10 - Util::DataRef fileTableRef; // 0x18 - Util::DataRef groupTableRef; // 0x20 - Util::DataRef soundArchivePlayerInfoRef; // 0x28 + Util::DataRef soundTableRef; // 0x00 + Util::DataRef bankTableRef; // 0x08 + Util::DataRef playerTableRef; // 0x10 + Util::DataRef fileTableRef; // 0x18 + Util::DataRef groupTableRef; // 0x20 + Util::DataRef soundArchivePlayerInfoRef; // 0x28 } Info; typedef struct InfoBlock { - ut::BinaryBlockHeader blockHeader; // 0x00 - Info info; // 0x08 + ut::BinaryBlockHeader blockHeader; // 0x00 + Info info; // 0x08 } InfoBlock; typedef struct Header { - ut::BinaryFileHeader fileHeader; // 0x00 - u32 symbolDataOffset; // 0x10 - u32 symbolDataSize; // 0x14 - u32 infoOffset; // 0x18 - u32 infoSize; // 0x1C - u32 fileImageOffset; // 0x20 - u32 fileImageSize; // 0x24 + ut::BinaryFileHeader fileHeader; // 0x00 + u32 symbolDataOffset; // 0x10 + u32 symbolDataSize; // 0x14 + u32 infoOffset; // 0x18 + u32 infoSize; // 0x1C + u32 fileImageOffset; // 0x20 + u32 fileImageSize; // 0x24 } Header; static const int HEADER_AREA_SIZE = OSRoundUp32B(sizeof(Header)) + 40; - } + } // namespace SoundArchiveFile class SoundArchiveFileReader { - public: - static const u32 SIGNATURE = 'RSAR'; - static const int VERSION = NW4R_VERSION(1, 1); + public: + static const u32 SIGNATURE = 'RSAR'; + static const int VERSION = NW4R_VERSION(1, 1); - public: - SoundArchiveFileReader(); + public: + SoundArchiveFileReader(); - void Init(const void* soundArchiveData); - bool IsValidFileHeader(const void* soundArchiveData); + void Init(const void* soundArchiveData); + bool IsValidFileHeader(const void* soundArchiveData); - void SetStringChunk(const void* chunk, u32 size); - void SetInfoChunk(const void* chunk, u32 size); + void SetStringChunk(const void* chunk, u32 size); + void SetInfoChunk(const void* chunk, u32 size); - SoundType GetSoundType(u32 id) const; + SoundType GetSoundType(u32 id) const; - bool ReadSoundInfo(u32 id, SoundArchive::SoundInfo* info) const; - bool ReadSound3DParam(u32 id, SoundArchive::Sound3DParam* param) const; - bool ReadSeqSoundInfo(u32 id, SoundArchive::SeqSoundInfo* info) const; - bool ReadStrmSoundInfo(u32 id, SoundArchive::StrmSoundInfo* info) const; - bool ReadWaveSoundInfo(u32 id, SoundArchive::WaveSoundInfo* info) const; - bool ReadBankInfo(u32 id, SoundArchive::BankInfo* info) const; - bool ReadPlayerInfo(u32 id, SoundArchive::PlayerInfo* info) const; - bool ReadGroupInfo(u32 id, SoundArchive::GroupInfo* info) const; - bool ReadGroupItemInfo(u32 groupId, u32 itemId, SoundArchive::GroupItemInfo* info) const; - bool ReadSoundArchivePlayerInfo(SoundArchive::SoundArchivePlayerInfo* info) const; + bool ReadSoundInfo(u32 id, SoundArchive::SoundInfo* info) const; + bool ReadSound3DParam(u32 id, SoundArchive::Sound3DParam* param) const; + bool ReadSeqSoundInfo(u32 id, SoundArchive::SeqSoundInfo* info) const; + bool ReadStrmSoundInfo(u32 id, SoundArchive::StrmSoundInfo* info) const; + bool ReadWaveSoundInfo(u32 id, SoundArchive::WaveSoundInfo* info) const; + bool ReadBankInfo(u32 id, SoundArchive::BankInfo* info) const; + bool ReadPlayerInfo(u32 id, SoundArchive::PlayerInfo* info) const; + bool ReadGroupInfo(u32 id, SoundArchive::GroupInfo* info) const; + bool ReadGroupItemInfo(u32 groupId, u32 itemId, SoundArchive::GroupItemInfo* info) const; + bool ReadSoundArchivePlayerInfo(SoundArchive::SoundArchivePlayerInfo* info) const; - u32 GetSoundStringId(u32 id) const; - u32 GetPlayerCount() const; - u32 GetGroupCount() const; + u32 GetSoundStringId(u32 id) const; + u32 GetPlayerCount() const; + u32 GetGroupCount() const; - const char* GetSoundLabelString(u32 id) const; - u32 GetSoundUserParam(u32 id) const; + const char* GetSoundLabelString(u32 id) const; + u32 GetSoundUserParam(u32 id) const; - bool ReadFileInfo(u32 id, SoundArchive::FileInfo* info) const; - bool ReadFilePos(u32 fileId, u32 id, SoundArchive::FilePos* filePos) const; + bool ReadFileInfo(u32 id, SoundArchive::FileInfo* info) const; + bool ReadFilePos(u32 fileId, u32 id, SoundArchive::FilePos* filePos) const; - const char* GetString(u32 id) const; + const char* GetString(u32 id) const; - u32 ConvertLabelStringToSoundId(const char* label) const { return ConvertLabelStringToId(mStringTreeSound, label); } - u32 ConvertLabelStringToPlayerId(const char* label) const { return ConvertLabelStringToId(mStringTreePlayer, label); } - u32 ConvertLabelStringToGroupId(const char* label) const { return ConvertLabelStringToId(mStringTreeGroup, label); } + u32 ConvertLabelStringToSoundId(const char* label) const { return ConvertLabelStringToId(mStringTreeSound, label); } + u32 ConvertLabelStringToPlayerId(const char* label) const { return ConvertLabelStringToId(mStringTreePlayer, label); } + u32 ConvertLabelStringToGroupId(const char* label) const { return ConvertLabelStringToId(mStringTreeGroup, label); } - u16 GetVersion() const { return mHeader.fileHeader.version; } - u32 GetLabelStringChunkOffset() const { return mHeader.symbolDataOffset; } - u32 GetLabelStringChunkSize() const { return mHeader.symbolDataSize; } - u32 GetInfoChunkOffset() const { return mHeader.infoOffset; } + u16 GetVersion() const { return mHeader.fileHeader.version; } + u32 GetLabelStringChunkOffset() const { return mHeader.symbolDataOffset; } + u32 GetLabelStringChunkSize() const { return mHeader.symbolDataSize; } + u32 GetInfoChunkOffset() const { return mHeader.infoOffset; } - u32 GetInfoChunkSize() const { return mHeader.infoSize; } + u32 GetInfoChunkSize() const { return mHeader.infoSize; } - private: - u32 ConvertLabelStringToId(const SoundArchiveFile::StringTree* tree, const char* label) const; + private: + u32 ConvertLabelStringToId(const SoundArchiveFile::StringTree* tree, const char* label) const; - const SoundArchiveFile::SoundCommonInfo* impl_GetSoundInfo(u32 id) const; - SoundArchiveFile::SoundInfoOffset impl_GetSoundInfoOffset(u32 id) const NO_INLINE; + const SoundArchiveFile::SoundCommonInfo* impl_GetSoundInfo(u32 id) const; + SoundArchiveFile::SoundInfoOffset impl_GetSoundInfoOffset(u32 id) const NO_INLINE; - const SoundArchiveFile::SeqSoundInfo* impl_GetSeqSoundInfo(u32 id) const; - const SoundArchiveFile::StrmSoundInfo* impl_GetStrmSoundInfo(u32 id) const; - const SoundArchiveFile::WaveSoundInfo* impl_GetWaveSoundInfo(u32 id) const; + const SoundArchiveFile::SeqSoundInfo* impl_GetSeqSoundInfo(u32 id) const; + const SoundArchiveFile::StrmSoundInfo* impl_GetStrmSoundInfo(u32 id) const; + const SoundArchiveFile::WaveSoundInfo* impl_GetWaveSoundInfo(u32 id) const; - const SoundArchiveFile::BankInfo* impl_GetBankInfo(u32 id) const; - const SoundArchiveFile::PlayerInfo* impl_GetPlayerInfo(u32 id) const; - const SoundArchiveFile::GroupInfo* impl_GetGroupInfo(u32 id) const; + const SoundArchiveFile::BankInfo* impl_GetBankInfo(u32 id) const; + const SoundArchiveFile::PlayerInfo* impl_GetPlayerInfo(u32 id) const; + const SoundArchiveFile::GroupInfo* impl_GetGroupInfo(u32 id) const; - const void* GetPtrConst(const void* base, u32 offset) const { - if (offset == 0) { - return NULL; - } - return ut::AddOffsetToPtr(base, offset); + const void* GetPtrConst(const void* base, u32 offset) const { + if (offset == 0) { + return NULL; } + return ut::AddOffsetToPtr(base, offset); + } - private: - SoundArchiveFile::Header mHeader; // 0x00 - const SoundArchiveFile::Info* mInfo; // 0x28 - const void* mStringBase; // 0x2C - const SoundArchiveFile::StringTable* mStringTable; // 0x30 - const SoundArchiveFile::StringTree* mStringTreeSound; // 0x34 - const SoundArchiveFile::StringTree* mStringTreePlayer; // 0x38 - const SoundArchiveFile::StringTree* mStringTreeGroup; // 0x3C - const SoundArchiveFile::StringTree* mStringTreeBank; // 0x40 + private: + SoundArchiveFile::Header mHeader; // 0x00 + const SoundArchiveFile::Info* mInfo; // 0x28 + const void* mStringBase; // 0x2C + const SoundArchiveFile::StringTable* mStringTable; // 0x30 + const SoundArchiveFile::StringTree* mStringTreeSound; // 0x34 + const SoundArchiveFile::StringTree* mStringTreePlayer; // 0x38 + const SoundArchiveFile::StringTree* mStringTreeGroup; // 0x3C + const SoundArchiveFile::StringTree* mStringTreeBank; // 0x40 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/SoundArchiveLoader.h b/libs/NW4R/include/nw4r/snd/SoundArchiveLoader.h index 3d5744f9..22ec2c7d 100644 --- a/libs/NW4R/include/nw4r/snd/SoundArchiveLoader.h +++ b/libs/NW4R/include/nw4r/snd/SoundArchiveLoader.h @@ -13,45 +13,44 @@ namespace nw4r { class SoundMemoryAllocatable; namespace detail { class FileStreamHandle { - public: - FileStreamHandle(ut::FileStream* pStream) : - mStream(pStream) {} + public: + FileStreamHandle(ut::FileStream* pStream) : mStream(pStream) {} - ~FileStreamHandle() { - if (mStream != NULL) { - mStream->Close(); - } + ~FileStreamHandle() { + if (mStream != NULL) { + mStream->Close(); } + } - ut::FileStream* GetFileStream() { return mStream; } + ut::FileStream* GetFileStream() { return mStream; } - ut::FileStream* operator->() { return mStream; } + ut::FileStream* operator->() { return mStream; } - operator bool() const { return mStream; } + operator bool() const { return mStream; } - private: - ut::FileStream* mStream; // 0x00 + private: + ut::FileStream* mStream; // 0x00 }; class SoundArchiveLoader { - public: - explicit SoundArchiveLoader(const SoundArchive& soundArchive); - ~SoundArchiveLoader(); + public: + explicit SoundArchiveLoader(const SoundArchive& soundArchive); + ~SoundArchiveLoader(); - void* LoadGroup(u32 id, SoundMemoryAllocatable* allocatable, void** waveBuffer, u32 blockSize); - s32 ReadFile(u32 id, void* dst, s32 size, s32 offset); - void* LoadFile(u32 id, SoundMemoryAllocatable* allocatable); + void* LoadGroup(u32 id, SoundMemoryAllocatable* allocatable, void** waveBuffer, u32 blockSize); + s32 ReadFile(u32 id, void* dst, s32 size, s32 offset); + void* LoadFile(u32 id, SoundMemoryAllocatable* allocatable); - void Cancel(); + void Cancel(); - private: - mutable OSMutex mMutex; // 0x00 - const SoundArchive& mArc; // 0x18 - u8 mStreamArea[STREAM_BUFFER_SIZE]; // 0x1C - ut::FileStream* mStream; // 0x21C + private: + mutable OSMutex mMutex; // 0x00 + const SoundArchive& mArc; // 0x18 + u8 mStreamArea[STREAM_BUFFER_SIZE]; // 0x1C + ut::FileStream* mStream; // 0x21C }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/SoundArchivePlayer.h b/libs/NW4R/include/nw4r/snd/SoundArchivePlayer.h index 2065144d..e575c608 100644 --- a/libs/NW4R/include/nw4r/snd/SoundArchivePlayer.h +++ b/libs/NW4R/include/nw4r/snd/SoundArchivePlayer.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -14,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -28,245 +28,242 @@ namespace nw4r { namespace detail { class SeqTrackAllocator; class SoundArchiveLoader; - } + } // namespace detail class SoundArchivePlayer_FileManager { - public: - virtual const void* GetFileAddress(u32 id) = 0; // 0x8 - virtual const void* GetFileWaveDataAddress(u32 id) = 0; // 0x8 + public: + virtual const void* GetFileAddress(u32 id) = 0; // 0x8 + virtual const void* GetFileWaveDataAddress(u32 id) = 0; // 0x8 }; class SoundArchivePlayer : public detail::DisposeCallback, public SoundStartable { + public: + SoundArchivePlayer(); + virtual ~SoundArchivePlayer(); // 0x08 + + virtual void InvalidateData(const void* start, const void* end); // 0x0C + virtual void InvalidateWaveData(const void* start, const void* end); // 0x10 + + virtual StartResult detail_SetupSound(SoundHandle* handle, u32 id, detail::BasicSound::AmbientArgInfo* ambientArgInfoInfo, + detail::ExternalSoundPlayer* extPlayer, bool hold, const StartInfo* startInfo); // 0x28 + + virtual u32 detail_ConvertLabelStringToSoundId(const char* label) { return mSoundArchive->ConvertLabelStringToSoundId(label); } // 0x2C + + bool IsAvailable() const; + + bool Setup(const SoundArchive* soundArchive, void* mramBuffer, u32 mramBufferSize, void* strmBuffer, u32 strmBufferSize); + + void Shutdown(); + + u32 GetRequiredMemSize(const SoundArchive* soundArchive); + u32 GetRequiredStrmBufferSize(const SoundArchive* soundArchive); + + void Update(); + + const SoundArchive& GetSoundArchive() const; + + SoundPlayer& GetSoundPlayer(u32 idx); + SoundPlayer& GetSoundPlayer(int idx) { return GetSoundPlayer(static_cast(idx)); } + + const void* detail_GetFileAddress(u32 id) const; + const void* detail_GetFileWaveDataAddress(u32 id) const; + + const void* GetGroupAddress(u32 id) const; + void SetGroupAddress(u32 id, const void* addr); + + const void* GetGroupWaveDataAddress(u32 id) const; + void SetGroupWaveDataAddress(u32 id, const void* addr); + + bool LoadGroup(u32 id, SoundMemoryAllocatable* allocatable, u32 blockSize); + bool LoadGroup(const char* label, SoundMemoryAllocatable* allocatable, u32 blockSize); + + bool LoadGroup(int id, SoundMemoryAllocatable* allocatable, u32 blockSize) { + return LoadGroup(static_cast(id), allocatable, blockSize); + } + bool LoadGroup(u32 id, SoundMemoryAllocatable* allocatable, unsigned int blockSize) { + return LoadGroup(static_cast(id), allocatable, blockSize); + } + + u32 GetSoundPlayerCount() const { return mSoundPlayerCount; } + + u32 GetFreeSeqSoundCount() const { return mSeqSoundInstanceManager.GetFreeCount(); } + u32 GetFreeStrmSoundCount() const { return mStrmSoundInstanceManager.GetFreeCount(); } + u32 GetFreeWaveSoundCount() const { return mWaveSoundInstanceManager.GetFreeCount(); } + + private: + class SeqLoadCallback : public detail::SeqSound::SeqLoadCallback { public: - SoundArchivePlayer(); - virtual ~SoundArchivePlayer(); // 0x08 + SeqLoadCallback(const SoundArchivePlayer& player); - virtual void InvalidateData(const void* start, const void* end); // 0x0C - virtual void InvalidateWaveData(const void* start, const void* end); // 0x10 - - virtual StartResult detail_SetupSound(SoundHandle* handle, u32 id, - detail::BasicSound::AmbientArgInfo* ambientArgInfoInfo, detail::ExternalSoundPlayer* extPlayer, - bool hold, const StartInfo* startInfo); // 0x28 - - virtual u32 detail_ConvertLabelStringToSoundId(const char* label) { - return mSoundArchive->ConvertLabelStringToSoundId(label); - } // 0x2C - - bool IsAvailable() const; - - bool Setup(const SoundArchive* soundArchive, void* mramBuffer, u32 mramBufferSize, void* strmBuffer, u32 strmBufferSize); - - void Shutdown(); - - u32 GetRequiredMemSize(const SoundArchive* soundArchive); - u32 GetRequiredStrmBufferSize(const SoundArchive* soundArchive); - - void Update(); - - const SoundArchive& GetSoundArchive() const; - - SoundPlayer& GetSoundPlayer(u32 idx); - SoundPlayer& GetSoundPlayer(int idx) { return GetSoundPlayer(static_cast(idx)); } - - const void* detail_GetFileAddress(u32 id) const; - const void* detail_GetFileWaveDataAddress(u32 id) const; - - const void* GetGroupAddress(u32 id) const; - void SetGroupAddress(u32 id, const void* addr); - - const void* GetGroupWaveDataAddress(u32 id) const; - void SetGroupWaveDataAddress(u32 id, const void* addr); - - bool LoadGroup(u32 id, SoundMemoryAllocatable* allocatable, u32 blockSize); - bool LoadGroup(const char* label, SoundMemoryAllocatable* allocatable, u32 blockSize); - - bool LoadGroup(int id, SoundMemoryAllocatable* allocatable, u32 blockSize) { return LoadGroup(static_cast(id), allocatable, blockSize); } - bool LoadGroup(u32 id, SoundMemoryAllocatable* allocatable, unsigned int blockSize) { return LoadGroup(static_cast(id), allocatable, blockSize); } - - u32 GetSoundPlayerCount() const { return mSoundPlayerCount; } - - u32 GetFreeSeqSoundCount() const { return mSeqSoundInstanceManager.GetFreeCount(); } - u32 GetFreeStrmSoundCount() const { return mStrmSoundInstanceManager.GetFreeCount(); } - u32 GetFreeWaveSoundCount() const { return mWaveSoundInstanceManager.GetFreeCount(); } + virtual Result LoadData(detail::SeqSound::NotifyAsyncEndCallback callback, void* callbackArg, u32 userData) const; + virtual void CancelLoading(u32 userData) const; private: - class SeqLoadCallback : public detail::SeqSound::SeqLoadCallback { - public: - SeqLoadCallback(const SoundArchivePlayer& player); + const SoundArchivePlayer& mSoundArchivePlayer; // 0x04 + mutable OSMutex mMutex; // 0x08 + }; - virtual Result LoadData(detail::SeqSound::NotifyAsyncEndCallback callback, void* callbackArg, u32 userData) const; - virtual void CancelLoading(u32 userData) const; + class SeqNoteOnCallback : public detail::NoteOnCallback { + public: + SeqNoteOnCallback(const SoundArchivePlayer& player) : mSoundArchivePlayer(player) {} - private: - const SoundArchivePlayer& mSoundArchivePlayer; // 0x04 - mutable OSMutex mMutex; // 0x08 - }; + virtual detail::Channel* NoteOn(detail::SeqPlayer* seqPlayer, int bankNo, const detail::NoteOnInfo& noteOnInfo); - class SeqNoteOnCallback : public detail::NoteOnCallback { - public: - SeqNoteOnCallback(const SoundArchivePlayer& player) : - mSoundArchivePlayer(player) {} + private: + const SoundArchivePlayer& mSoundArchivePlayer; // 0x04 + }; + friend class SoundArchivePlayer::SeqNoteOnCallback; - virtual detail::Channel* NoteOn(detail::SeqPlayer* seqPlayer, int bankNo, const detail::NoteOnInfo& noteOnInfo); + class StrmCallback : public detail::StrmPlayer::StrmCallback { + public: + StrmCallback(const SoundArchivePlayer& player); - private: - const SoundArchivePlayer& mSoundArchivePlayer; // 0x04 - }; - friend class SoundArchivePlayer::SeqNoteOnCallback; + virtual Result LoadHeader(detail::StrmPlayer::NotifyLoadHeaderAsyncEndCallback callback, void* callbackData, u32 userId, + u32 userData) const; + virtual Result LoadStream(void* mramAddr, u32 size, s32 offset, int numChannels, u32 blockSize, s32 blockHeaderOffset, + bool needUpdateAdpcmLoop, detail::StrmPlayer::LoadCommand& callback, u32 userId, u32 userData) const; + virtual void CancelLoading(u32 userId, u32 userData) const; - class StrmCallback : public detail::StrmPlayer::StrmCallback { - public: - StrmCallback(const SoundArchivePlayer& player); + private: + const SoundArchivePlayer& mSoundArchivePlayer; // 0x04 + mutable OSMutex mMutex; // 0x08 + }; - virtual Result LoadHeader(detail::StrmPlayer::NotifyLoadHeaderAsyncEndCallback callback, void* callbackData, u32 userId, u32 userData) const; - virtual Result LoadStream(void* mramAddr, u32 size, s32 offset, int numChannels, - u32 blockSize, s32 blockHeaderOffset, bool needUpdateAdpcmLoop, - detail::StrmPlayer::LoadCommand& callback, u32 userId, u32 userData) const; - virtual void CancelLoading(u32 userId, u32 userData) const; + class WsdCallback : public detail::WsdTrack::WsdCallback { + public: + WsdCallback(const SoundArchivePlayer& player) : mSoundArchivePlayer(player) {} - private: - const SoundArchivePlayer& mSoundArchivePlayer; // 0x04 - mutable OSMutex mMutex; // 0x08 - }; + virtual bool GetWaveSoundData(detail::WaveSoundInfo* soundInfo, detail::WaveSoundNoteInfo* noteInfo, detail::WaveData* waveData, + const void* waveSoundData, int index, int noteIndex, u32 userData) const; - class WsdCallback : public detail::WsdTrack::WsdCallback { - public: - WsdCallback(const SoundArchivePlayer& player) : - mSoundArchivePlayer(player) {} + private: + const SoundArchivePlayer& mSoundArchivePlayer; // 0x04 + }; - virtual bool GetWaveSoundData(detail::WaveSoundInfo* soundInfo, detail::WaveSoundNoteInfo* noteInfo, - detail::WaveData* waveData, const void* waveSoundData, - int index, int noteIndex, - u32 userData) const; + class SeqLoadTask : public detail::Task { + public: + SeqLoadTask(detail::SeqSound::NotifyAsyncEndCallback callback, void* callbackArg, const SoundArchive& arc, u32 fileId, u32 dataOffset, + SoundHeap& heap, u32 taskId, OSMutex& mutex); - private: - const SoundArchivePlayer& mSoundArchivePlayer; // 0x04 - }; + virtual void Execute(); + virtual void Cancel(); - class SeqLoadTask : public detail::Task { - public: - SeqLoadTask(detail::SeqSound::NotifyAsyncEndCallback callback, void* callbackArg, - const SoundArchive& arc, u32 fileId, u32 dataOffset, SoundHeap& heap, - u32 taskId, OSMutex& mutex); + private: + detail::SoundArchiveLoader* mLoader; // 0x10 + const SoundArchive& mSoundArchive; // 0x14 + u32 mFileId; // 0x18 + u32 mDataOffset; // 0x1C + SoundHeap& mHeap; // 0x20 - virtual void Execute(); - virtual void Cancel(); + detail::SeqSound::NotifyAsyncEndCallback mCallback; // 0x24 + void* mCallbackData; // 0x28 - private: - detail::SoundArchiveLoader* mLoader; // 0x10 - const SoundArchive& mSoundArchive; // 0x14 - u32 mFileId; // 0x18 - u32 mDataOffset; // 0x1C - SoundHeap& mHeap; // 0x20 + OSMutex& mMutex; // 0x2C + }; - detail::SeqSound::NotifyAsyncEndCallback mCallback; // 0x24 - void* mCallbackData; // 0x28 + class StrmHeaderLoadTask : public detail::Task { + public: + StrmHeaderLoadTask(detail::StrmPlayer::NotifyLoadHeaderAsyncEndCallback callback, void* callbackData, const SoundArchive& arc, + u32 fileId, u32 taskId, OSMutex& mutex); - OSMutex& mMutex; // 0x2C - }; + virtual void Execute(); + virtual void Cancel(); - class StrmHeaderLoadTask : public detail::Task { - public: - StrmHeaderLoadTask(detail::StrmPlayer::NotifyLoadHeaderAsyncEndCallback callback, void* callbackData, - const SoundArchive& arc, u32 fileId, - u32 taskId, OSMutex& mutex); - - virtual void Execute(); - virtual void Cancel(); + private: + ut::FileStream* mStream; // 0x10 + const SoundArchive& mSoundArchive; // 0x14 + u32 mFileId; // 0x18 - private: - ut::FileStream* mStream; // 0x10 - const SoundArchive& mSoundArchive; // 0x14 - u32 mFileId; // 0x18 + detail::StrmPlayer::NotifyLoadHeaderAsyncEndCallback mCallback; // 0x1C + void* mCallbackData; // 0x24 - detail::StrmPlayer::NotifyLoadHeaderAsyncEndCallback mCallback; // 0x1C - void* mCallbackData; // 0x24 + OSMutex& mMutex; // 0x28 + }; - OSMutex& mMutex; // 0x28 - }; + class StrmDataLoadTask : public detail::Task { + public: + StrmDataLoadTask(void* addr, u32 size, s32 offset, int numChannels, u32 blockSize, s32 blockHeaderOffset, bool needUpdateAdpcmLoop, + detail::StrmPlayer::LoadCommand& callback, const SoundArchive& arc, u32 fileId, u32 taskId, + OSMutex& mutex) NO_INLINE; + virtual void Execute(); + virtual void Cancel(); - class StrmDataLoadTask : public detail::Task { - public: - StrmDataLoadTask(void* addr, u32 size, s32 offset, int numChannels, - u32 blockSize, s32 blockHeaderOffset, bool needUpdateAdpcmLoop, - detail::StrmPlayer::LoadCommand& callback, const SoundArchive& arc, u32 fileId, - u32 taskId, OSMutex& mutex) NO_INLINE; - virtual void Execute(); - virtual void Cancel(); + private: + detail::StrmPlayer::LoadCommand* mCallback; // 0x10 - private: - detail::StrmPlayer::LoadCommand* mCallback; // 0x10 + ut::FileStream* mStream; // 0x14 + const SoundArchive& mSoundArchive; // 0x18 + u32 mFileId; // 0x1C + void* mAddr; // 0x20 + u32 mSize; // 0x24 + s32 mOffset; // 0x28 - ut::FileStream* mStream; // 0x14 - const SoundArchive& mSoundArchive; // 0x18 - u32 mFileId; // 0x1C - void* mAddr; // 0x20 - u32 mSize; // 0x24 - s32 mOffset; // 0x28 + s32 mNumChannels; // 0x2C - s32 mNumChannels; // 0x2C + u32 mBlockSize; // 0x30 + s32 mBlockHeaderOffset; // 0x34 - u32 mBlockSize; // 0x30 - s32 mBlockHeaderOffset; // 0x34 + bool mNeedUpdateAdpcmLoop; // 0x38 + OSMutex& mMutex; // 0x3C + }; - bool mNeedUpdateAdpcmLoop; // 0x38 - OSMutex& mMutex; // 0x3C - }; + bool SetupMram(const SoundArchive* soundArchive, void* buffer, u32 bufferSize); - bool SetupMram(const SoundArchive* soundArchive, void* buffer, u32 bufferSize); + detail::PlayerHeap* CreatePlayerHeap(void* buffer, u32 bufferSize); - detail::PlayerHeap* CreatePlayerHeap(void* buffer, u32 bufferSize); + bool SetupSoundPlayer(const SoundArchive* soundArchive, void** buffer, void* end); - bool SetupSoundPlayer(const SoundArchive* soundArchive, void** buffer, void* end); + bool CreateGroupAddressTable(const SoundArchive* soundArchive, void** buffer, void* end); - bool CreateGroupAddressTable(const SoundArchive* soundArchive, void** buffer, void* end); + bool SetupSeqSound(const SoundArchive* soundArchive, int sounds, void** buffer, void* end); + bool SetupWaveSound(const SoundArchive* soundArchive, int sounds, void** buffer, void* end); + bool SetupStrmSound(const SoundArchive* soundArchive, int sounds, void** buffer, void* end); + bool SetupSeqTrack(const SoundArchive* soundArchive, int tracks, void** buffer, void* end); + bool SetupStrmBuffer(const SoundArchive* soundArchive, void* buffer, u32 bufferSize); - bool SetupSeqSound(const SoundArchive* soundArchive, int sounds, void** buffer, void* end); - bool SetupWaveSound(const SoundArchive* soundArchive, int sounds, void** buffer, void* end); - bool SetupStrmSound(const SoundArchive* soundArchive, int sounds, void** buffer, void* end); - bool SetupSeqTrack(const SoundArchive* soundArchive, int tracks, void** buffer, void* end); - bool SetupStrmBuffer(const SoundArchive* soundArchive, void* buffer, u32 bufferSize); + StartResult PrepareSeqImpl(detail::SeqSound* sound, const SoundArchive::SoundInfo* soundInfo, + const SoundArchive::SeqSoundInfo* seqSoundInfo, int voices); + StartResult PrepareStrmImpl(detail::StrmSound* sound, const SoundArchive::SoundInfo* soundInfo, + const SoundArchive::StrmSoundInfo* strmSoundInfo, SoundStartable::StartInfo::StartOffsetType startOffsetType, + int startOffset, int voices); - StartResult PrepareSeqImpl(detail::SeqSound* sound, const SoundArchive::SoundInfo* soundInfo, const SoundArchive::SeqSoundInfo* seqSoundInfo, int voices); - StartResult PrepareStrmImpl(detail::StrmSound* sound, const SoundArchive::SoundInfo* soundInfo, const SoundArchive::StrmSoundInfo* strmSoundInfo, SoundStartable::StartInfo::StartOffsetType startOffsetType, int startOffset, int voices); + StartResult PrepareWaveSoundImpl(detail::WaveSound* sound, const SoundArchive::SoundInfo* soundInfo, + const SoundArchive::WaveSoundInfo* waveSoundInfo, int voices); - StartResult PrepareWaveSoundImpl(detail::WaveSound* sound, const SoundArchive::SoundInfo* soundInfo, const SoundArchive::WaveSoundInfo* waveSoundInfo, int voices); + typedef struct Group { + const void* address; // 0x0 + const void* waveDataAddress; // 0x4 + } Group; + typedef detail::Util::Table GroupTable; + const SoundArchive* mSoundArchive; // 0x10 + GroupTable* mGroupTable; // 0x14 - typedef struct Group { - const void* address; // 0x0 - const void* waveDataAddress; // 0x4 - } Group; - typedef detail::Util::Table GroupTable; + SeqLoadCallback mSeqLoadCallback; // 0x18 + SeqNoteOnCallback mSeqCallback; // 0x38 + WsdCallback mWsdCallback; // 0x40 + StrmCallback mStrmCallback; // 0x48 - const SoundArchive* mSoundArchive; // 0x10 - GroupTable* mGroupTable; // 0x14 + detail::SeqTrackAllocator* mSeqTrackAllocator; // 0x68 - SeqLoadCallback mSeqLoadCallback; // 0x18 - SeqNoteOnCallback mSeqCallback; // 0x38 - WsdCallback mWsdCallback; // 0x40 - StrmCallback mStrmCallback; // 0x48 + SoundArchivePlayer_FileManager* mFileManager; // 0x6C - detail::SeqTrackAllocator* mSeqTrackAllocator; // 0x68 + u32 mSoundPlayerCount; // 0x70 + SoundPlayer* mSoundPlayers; // 0x74 - SoundArchivePlayer_FileManager* mFileManager; // 0x6C + detail::SoundInstanceManager mSeqSoundInstanceManager; // 0x78 + detail::SoundInstanceManager mStrmSoundInstanceManager; // 0x88 + detail::SoundInstanceManager mWaveSoundInstanceManager; // 0x98 - u32 mSoundPlayerCount; // 0x70 - SoundPlayer* mSoundPlayers; // 0x74 + detail::StrmBufferPool mStrmBufferPool; // 0xA8 - detail::SoundInstanceManager mSeqSoundInstanceManager; // 0x78 - detail::SoundInstanceManager mStrmSoundInstanceManager; // 0x88 - detail::SoundInstanceManager mWaveSoundInstanceManager; // 0x98 + detail::MmlParser mMmlParser; // 0xC0 + detail::MmlSeqTrackAllocator mMmlSeqTrackAllocator; // 0xC4 - detail::StrmBufferPool mStrmBufferPool; // 0xA8 - - detail::MmlParser mMmlParser; // 0xC0 - detail::MmlSeqTrackAllocator mMmlSeqTrackAllocator; // 0xC4 - - void* mSetupBufferAddress; // 0xD0 - u32 mSetupBufferSize; // 0xD4 + void* mSetupBufferAddress; // 0xD0 + u32 mSetupBufferSize; // 0xD4 }; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_SOUND_ARCHIVE_PLAYER_H +#endif // NW4R_SND_SOUND_ARCHIVE_PLAYER_H diff --git a/libs/NW4R/include/nw4r/snd/SoundHandle.h b/libs/NW4R/include/nw4r/snd/SoundHandle.h index 3c38ca87..89e8cd12 100644 --- a/libs/NW4R/include/nw4r/snd/SoundHandle.h +++ b/libs/NW4R/include/nw4r/snd/SoundHandle.h @@ -10,102 +10,96 @@ namespace nw4r { namespace snd { class SoundHandle : private ut::NonCopyable { - public: - SoundHandle() : mSound(NULL) {} - ~SoundHandle() { - DetachSound(); + public: + SoundHandle() : mSound(NULL) {} + ~SoundHandle() { DetachSound(); } + + void detail_AttachSound(detail::BasicSound* sound); + void detail_AttachSoundAsTempHandle(detail::BasicSound* sound); + + bool IsAttachedSound() const { return mSound != NULL; } + + detail::BasicSound* detail_GetAttachedSound() { return mSound; } + + void DetachSound(); + + bool IsPrepared() const { + if (IsAttachedSound()) { + return mSound->IsPrepared(); } - void detail_AttachSound(detail::BasicSound* sound); - void detail_AttachSoundAsTempHandle(detail::BasicSound* sound); + return false; + } - bool IsAttachedSound() const { - return mSound != NULL; + u32 GetId() const { + if (IsAttachedSound()) { + return mSound->GetId(); } - detail::BasicSound* detail_GetAttachedSound() { - return mSound; - } + return -1; + } - void DetachSound(); - - bool IsPrepared() const { - if (IsAttachedSound()) { - return mSound->IsPrepared(); - } - - return false; + void StartPrepared() { + if (IsAttachedSound()) { + mSound->StartPrepared(); } + } - u32 GetId() const { - if (IsAttachedSound()) { - return mSound->GetId(); - } + void Stop(int frames) { + if (IsAttachedSound()) { + mSound->Stop(frames); + } + } - return -1; + void Pause(bool flag, int frames) { + if (IsAttachedSound()) { + mSound->Pause(flag, frames); } + } - void StartPrepared() { - if (IsAttachedSound()) { - mSound->StartPrepared(); - } + void SetVolume(f32 volume, int frames) { + if (IsAttachedSound()) { + mSound->SetVolume(volume, frames); } + } + void SetPan(f32 pan) { + if (IsAttachedSound()) { + mSound->SetPan(pan); + } + } + void SetPitch(f32 pitch) { + if (IsAttachedSound()) { + mSound->SetPitch(pitch); + } + } - void Stop(int frames) { - if (IsAttachedSound()) { - mSound->Stop(frames); - } + void SetOutputLine(int flag) { + if (IsAttachedSound()) { + mSound->SetOutputLine(flag); } + } - void Pause(bool flag, int frames) { - if (IsAttachedSound()) { - mSound->Pause(flag, frames); - } + void SetMainOutVolume(f32 volume) { + if (IsAttachedSound()) { + mSound->SetMainOutVolume(volume); } + } + void SetRemoteOutVolume(int remote, f32 volume) { + if (IsAttachedSound()) { + mSound->SetRemoteOutVolume(remote, volume); + } + } - void SetVolume(f32 volume, int frames) { - if (IsAttachedSound()) { - mSound->SetVolume(volume, frames); - } - } - void SetPan(f32 pan) { - if (IsAttachedSound()) { - mSound->SetPan(pan); - } - } - void SetPitch(f32 pitch) { - if (IsAttachedSound()) { - mSound->SetPitch(pitch); - } + void SetFxSend(AuxBus bus, f32 send) { + if (IsAttachedSound()) { + mSound->SetFxSend(bus, send); } + } - void SetOutputLine(int flag) { - if (IsAttachedSound()) { - mSound->SetOutputLine(flag); - } - } - - void SetMainOutVolume(f32 volume) { - if (IsAttachedSound()) { - mSound->SetMainOutVolume(volume); - } - } - void SetRemoteOutVolume(int remote, f32 volume) { - if (IsAttachedSound()) { - mSound->SetRemoteOutVolume(remote, volume); - } - } - - void SetFxSend(AuxBus bus, f32 send) { - if (IsAttachedSound()) { - mSound->SetFxSend(bus, send); - } - } - - private: - detail::BasicSound* mSound; // 0x00 + private: + detail::BasicSound* mSound; // 0x00 }; - } -} + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/SoundHeap.h b/libs/NW4R/include/nw4r/snd/SoundHeap.h index 590eca0c..f99e8f58 100644 --- a/libs/NW4R/include/nw4r/snd/SoundHeap.h +++ b/libs/NW4R/include/nw4r/snd/SoundHeap.h @@ -12,43 +12,43 @@ namespace nw4r { namespace snd { class SoundHeap : public SoundMemoryAllocatable { - public: - SoundHeap(); - virtual ~SoundHeap(); // 0x08 + public: + SoundHeap(); + virtual ~SoundHeap(); // 0x08 - virtual void* Alloc(u32 size); // 0x0C - void* Alloc(u32 size, detail::FrameHeap::FreeCallback callback, void* callbackArg); + virtual void* Alloc(u32 size); // 0x0C + void* Alloc(u32 size, detail::FrameHeap::FreeCallback callback, void* callbackArg); - bool Create(void* base, u32 size); - void Destroy(); + bool Create(void* base, u32 size); + void Destroy(); - void Clear() { - ut::AutoMutexLock lock(mMutex); - mFrameHeap.Clear(); - } + void Clear() { + ut::AutoMutexLock lock(mMutex); + mFrameHeap.Clear(); + } - int SaveState(); - void LoadState(int id); + int SaveState(); + void LoadState(int id); - bool IsValid() { return mFrameHeap.IsValid(); } + bool IsValid() { return mFrameHeap.IsValid(); } - int GetCurrentLevel() const { - ut::detail::AutoLock lock(mMutex); - return mFrameHeap.GetCurrentLevel(); - } + int GetCurrentLevel() const { + ut::detail::AutoLock lock(mMutex); + return mFrameHeap.GetCurrentLevel(); + } - u32 GetFreeSize() const { - ut::detail::AutoLock lock(mMutex); - return mFrameHeap.GetFreeSize(); - } + u32 GetFreeSize() const { + ut::detail::AutoLock lock(mMutex); + return mFrameHeap.GetFreeSize(); + } - private: - static void DisposeCallbackFunc(void* buffer, u32 size, void* callbackArg); + private: + static void DisposeCallbackFunc(void* buffer, u32 size, void* callbackArg); - mutable OSMutex mMutex; // 0x00 - detail::FrameHeap mFrameHeap; // 0x1C + mutable OSMutex mMutex; // 0x00 + detail::FrameHeap mFrameHeap; // 0x1C }; - } -} + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/SoundInstanceManager.h b/libs/NW4R/include/nw4r/snd/SoundInstanceManager.h index d656ca2d..e8b041b8 100644 --- a/libs/NW4R/include/nw4r/snd/SoundInstanceManager.h +++ b/libs/NW4R/include/nw4r/snd/SoundInstanceManager.h @@ -12,125 +12,115 @@ namespace nw4r { namespace snd { namespace detail { - template class SoundInstanceManager { - public: - u32 Create(void* buffer, u32 size) { - return mPool.Create(buffer, size); - } + template + class SoundInstanceManager { + public: + u32 Create(void* buffer, u32 size) { return mPool.Create(buffer, size); } - void Destroy(void* buffer, u32 size) { - mPool.Destroy(buffer, size); - } + void Destroy(void* buffer, u32 size) { mPool.Destroy(buffer, size); } - T* Alloc(int priority) { - ut::AutoInterruptLock lock; - T* sound; + T* Alloc(int priority) { + ut::AutoInterruptLock lock; + T* sound; - void* buffer = mPool.Alloc(); + void* buffer = mPool.Alloc(); - if (buffer != NULL) { - sound = new(buffer) T(this); - } - else { - if (mPriorityList.IsEmpty()) { - return NULL; - } - sound = &mPriorityList.GetFront(); - - if (sound == NULL) { - return NULL; - } - - if (priority < sound->CalcCurrentPlayerPriority()) { - return NULL; - } - sound->Stop(); - - buffer = mPool.Alloc(); - sound = new(buffer) T(this); - } - - InsertPriorityList(sound, priority); - return sound; - } - - void Free(T* sound) { - ut::AutoInterruptLock lock; - - if (mPriorityList.IsEmpty()) { - return; - } - - RemovePriorityList(sound); - sound->~T(); - mPool.Free(sound); - } - - u32 GetActiveCount() const { - return mPriorityList.GetSize(); - } - - u32 GetFreeCount() const { - return mPool.Count(); - } - - T* GetLowestPrioritySound() { + if (buffer != NULL) { + sound = new (buffer) T(this); + } else { if (mPriorityList.IsEmpty()) { return NULL; } + sound = &mPriorityList.GetFront(); - return static_cast(&mPriorityList.GetFront()); - } - - void InsertPriorityList(T* sound, int priority) { - TPrioList::Iterator it = mPriorityList.GetBeginIter(); - - for (; it != mPriorityList.GetEndIter(); it++) { - if (priority < it->CalcCurrentPlayerPriority()) { - break; - } + if (sound == NULL) { + return NULL; } - mPriorityList.Insert(it, sound); - } - - void RemovePriorityList(T* sound) { - mPriorityList.Erase(sound); - } - - void SortPriorityList() { - TPrioList listsByPrio[T::PRIORITY_MAX + 1]; - - while (!mPriorityList.IsEmpty()) { - T& rSound = mPriorityList.GetFront(); - mPriorityList.PopFront(); - listsByPrio[rSound.CalcCurrentPlayerPriority()].PushBack(&rSound); + if (priority < sound->CalcCurrentPlayerPriority()) { + return NULL; } + sound->Stop(); - for (int i = 0; i < T::PRIORITY_MAX + 1; i++) { - while (!listsByPrio[i].IsEmpty()) { - T& rSound = listsByPrio[i].GetFront(); - listsByPrio[i].PopFront(); - mPriorityList.PushBack(&rSound); - } + buffer = mPool.Alloc(); + sound = new (buffer) T(this); + } + + InsertPriorityList(sound, priority); + return sound; + } + + void Free(T* sound) { + ut::AutoInterruptLock lock; + + if (mPriorityList.IsEmpty()) { + return; + } + + RemovePriorityList(sound); + sound->~T(); + mPool.Free(sound); + } + + u32 GetActiveCount() const { return mPriorityList.GetSize(); } + + u32 GetFreeCount() const { return mPool.Count(); } + + T* GetLowestPrioritySound() { + if (mPriorityList.IsEmpty()) { + return NULL; + } + + return static_cast(&mPriorityList.GetFront()); + } + + void InsertPriorityList(T* sound, int priority) { + TPrioList::Iterator it = mPriorityList.GetBeginIter(); + + for (; it != mPriorityList.GetEndIter(); it++) { + if (priority < it->CalcCurrentPlayerPriority()) { + break; } } - void UpdatePriority(T* sound, int priority) { - RemovePriorityList(sound); - InsertPriorityList(sound, priority); + mPriorityList.Insert(it, sound); + } + + void RemovePriorityList(T* sound) { mPriorityList.Erase(sound); } + + void SortPriorityList() { + TPrioList listsByPrio[T::PRIORITY_MAX + 1]; + + while (!mPriorityList.IsEmpty()) { + T& rSound = mPriorityList.GetFront(); + mPriorityList.PopFront(); + listsByPrio[rSound.CalcCurrentPlayerPriority()].PushBack(&rSound); } - private: - typedef ut::LinkList TPrioList; + for (int i = 0; i < T::PRIORITY_MAX + 1; i++) { + while (!listsByPrio[i].IsEmpty()) { + T& rSound = listsByPrio[i].GetFront(); + listsByPrio[i].PopFront(); + mPriorityList.PushBack(&rSound); + } + } + } - private: - MemoryPool mPool; // 0x00 - TPrioList mPriorityList; // 0x04 + void UpdatePriority(T* sound, int priority) { + RemovePriorityList(sound); + InsertPriorityList(sound, priority); + } + + private: + typedef ut::LinkList TPrioList; + + private: + MemoryPool mPool; // 0x00 + TPrioList mPriorityList; // 0x04 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/SoundMemoryAllocatable.h b/libs/NW4R/include/nw4r/snd/SoundMemoryAllocatable.h index 20ca875a..ebb6eb29 100644 --- a/libs/NW4R/include/nw4r/snd/SoundMemoryAllocatable.h +++ b/libs/NW4R/include/nw4r/snd/SoundMemoryAllocatable.h @@ -4,13 +4,13 @@ #include namespace nw4r { -namespace snd { + namespace snd { class SoundMemoryAllocatable { - public: - virtual ~SoundMemoryAllocatable() {} // 0x08 - virtual void* Alloc(u32 size) = 0; // 0x0C + public: + virtual ~SoundMemoryAllocatable() {} // 0x08 + virtual void* Alloc(u32 size) = 0; // 0x0C }; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_SOUND_MEMORY_ALLOCATABLE_H +#endif // NW4R_SND_SOUND_MEMORY_ALLOCATABLE_H diff --git a/libs/NW4R/include/nw4r/snd/SoundPlayer.h b/libs/NW4R/include/nw4r/snd/SoundPlayer.h index 523bcd32..54be5252 100644 --- a/libs/NW4R/include/nw4r/snd/SoundPlayer.h +++ b/libs/NW4R/include/nw4r/snd/SoundPlayer.h @@ -14,94 +14,92 @@ namespace nw4r { namespace detail { class ExternalSoundPlayer; class SeqSound; - template class SoundInstanceManager; + template + class SoundInstanceManager; class StrmSound; class WaveSound; - } + } // namespace detail class SoundPlayer { - public: - SoundPlayer(); - ~SoundPlayer(); + public: + SoundPlayer(); + ~SoundPlayer(); - void InitParam(); - void Update(); + void InitParam(); + void Update(); - void StopAllSound(int frames); - void PauseAllSound(bool flag, int frames); + void StopAllSound(int frames); + void PauseAllSound(bool flag, int frames); - void SetVolume(f32 volume); + void SetVolume(f32 volume); - int detail_GetOutputLine() const; - bool detail_IsEnabledOutputLine() const; + int detail_GetOutputLine() const; + bool detail_IsEnabledOutputLine() const; - f32 detail_GetRemoteOutVolume(int idx) const; + f32 detail_GetRemoteOutVolume(int idx) const; - void detail_InsertSoundList(detail::BasicSound* sound); - void detail_RemoveSoundList(detail::BasicSound* sound); + void detail_InsertSoundList(detail::BasicSound* sound); + void detail_RemoveSoundList(detail::BasicSound* sound); - void detail_InsertPriorityList(detail::BasicSound* sound); - void detail_RemovePriorityList(detail::BasicSound* sound); + void detail_InsertPriorityList(detail::BasicSound* sound); + void detail_RemovePriorityList(detail::BasicSound* sound); - void detail_SortPriorityList(); + void detail_SortPriorityList(); - detail::SeqSound* detail_AllocSeqSound(int priority, int startPriority, - detail::BasicSound::AmbientArgInfo* ambientArgInfo, - detail::ExternalSoundPlayer* extPlayer, u32 id, - detail::SoundInstanceManager* manager); + detail::SeqSound* detail_AllocSeqSound(int priority, int startPriority, detail::BasicSound::AmbientArgInfo* ambientArgInfo, + detail::ExternalSoundPlayer* extPlayer, u32 id, + detail::SoundInstanceManager* manager); - detail::StrmSound* detail_AllocStrmSound(int priority, int startPriority, - detail::BasicSound::AmbientArgInfo* ambientArgInfo, - detail::ExternalSoundPlayer* extPlayer, u32 id, - detail::SoundInstanceManager* manager); + detail::StrmSound* detail_AllocStrmSound(int priority, int startPriority, detail::BasicSound::AmbientArgInfo* ambientArgInfo, + detail::ExternalSoundPlayer* extPlayer, u32 id, + detail::SoundInstanceManager* manager); - detail::WaveSound* detail_AllocWaveSound(int priority, int startPriority, - detail::BasicSound::AmbientArgInfo* ambientArgInfo, - detail::ExternalSoundPlayer* extPlayer, u32 id, - detail::SoundInstanceManager* manager); + detail::WaveSound* detail_AllocWaveSound(int priority, int startPriority, detail::BasicSound::AmbientArgInfo* ambientArgInfo, + detail::ExternalSoundPlayer* extPlayer, u32 id, + detail::SoundInstanceManager* manager); - int CalcPriorityReduction(detail::BasicSound::AmbientArgInfo* ambientArgInfo, u32 id); + int CalcPriorityReduction(detail::BasicSound::AmbientArgInfo* ambientArgInfo, u32 id); - void InitAmbientArg(detail::BasicSound* sound, detail::BasicSound::AmbientArgInfo* ambientArgInfo); + void InitAmbientArg(detail::BasicSound* sound, detail::BasicSound::AmbientArgInfo* ambientArgInfo); - void SetPlayableSoundCount(int count); - void detail_SetPlayableSoundLimit(int limit); + void SetPlayableSoundCount(int count); + void detail_SetPlayableSoundLimit(int limit); - bool CheckPlayableSoundCount(int startPriority, detail::ExternalSoundPlayer* extPlayer); + bool CheckPlayableSoundCount(int startPriority, detail::ExternalSoundPlayer* extPlayer); - void detail_AppendPlayerHeap(detail::PlayerHeap* pHeap); - detail::PlayerHeap* detail_AllocPlayerHeap(detail::BasicSound* sound); - void detail_FreePlayerHeap(detail::BasicSound* sound); + void detail_AppendPlayerHeap(detail::PlayerHeap* pHeap); + detail::PlayerHeap* detail_AllocPlayerHeap(detail::BasicSound* sound); + void detail_FreePlayerHeap(detail::BasicSound* sound); - int GetPlayingSoundCount() const { return mSoundList.GetSize(); } - int GetPlayableSoundCount() const { return mPlayableCount; } + int GetPlayingSoundCount() const { return mSoundList.GetSize(); } + int GetPlayableSoundCount() const { return mPlayableCount; } - f32 GetVolume() const { return mVolume; } + f32 GetVolume() const { return mVolume; } - detail::BasicSound* detail_GetLowestPrioritySound() { - // @bug UB when the list is empty - return &mPriorityList.GetFront(); - } + detail::BasicSound* detail_GetLowestPrioritySound() { + // @bug UB when the list is empty + return &mPriorityList.GetFront(); + } - f32 detail_GetMainOutVolume() const { return mMainOutVolume; } + f32 detail_GetMainOutVolume() const { return mMainOutVolume; } - private: - detail::BasicSoundPlayerPlayList mSoundList; // 0x00 - detail::BasicSoundPlayerPrioList mPriorityList; // 0x0C - detail::PlayerHeapList mHeapList; // 0x18 + private: + detail::BasicSoundPlayerPlayList mSoundList; // 0x00 + detail::BasicSoundPlayerPrioList mPriorityList; // 0x0C + detail::PlayerHeapList mHeapList; // 0x18 - u16 mPlayableCount; // 0x24 - u16 mPlayableLimit; // 0x26 + u16 mPlayableCount; // 0x24 + u16 mPlayableLimit; // 0x26 - f32 mVolume; // 0x28 - bool mOutputLineFlagEnable; // 0x2C - bool mUsePlayerHeap; // 0x2D - int mOutputLineFlag; // 0x30 - f32 mMainOutVolume; // 0x34 - f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // 0x38 + f32 mVolume; // 0x28 + bool mOutputLineFlagEnable; // 0x2C + bool mUsePlayerHeap; // 0x2D + int mOutputLineFlag; // 0x30 + f32 mMainOutVolume; // 0x34 + f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // 0x38 }; - } -} + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/SoundStartable.h b/libs/NW4R/include/nw4r/snd/SoundStartable.h index 61ede657..9913e24f 100644 --- a/libs/NW4R/include/nw4r/snd/SoundStartable.h +++ b/libs/NW4R/include/nw4r/snd/SoundStartable.h @@ -11,101 +11,85 @@ namespace nw4r { class ExternalSoundPlayer; } class SoundStartable { - public: - typedef enum StartResult { - START_SUCCESS = 0, - START_ERR_LOW_PRIORITY, - START_ERR_INVALID_LABEL_STRING, - START_ERR_INVALID_SOUNDID, - START_ERR_NOT_DATA_LOADED, - START_ERR_NOT_ENOUGH_PLAYER_HEAP, - START_ERR_CANNOT_OPEN_FILE, - START_ERR_NOT_AVAILABLE, - START_ERR_CANNOT_ALLOCATE_TRACK, - START_ERR_NOT_ENOUGH_INSTANCE, - START_ERR_INVALID_PARAMETER, - START_ERR_INVALID_SEQ_START_LOCATION_LABEL, + public: + typedef enum StartResult { + START_SUCCESS = 0, + START_ERR_LOW_PRIORITY, + START_ERR_INVALID_LABEL_STRING, + START_ERR_INVALID_SOUNDID, + START_ERR_NOT_DATA_LOADED, + START_ERR_NOT_ENOUGH_PLAYER_HEAP, + START_ERR_CANNOT_OPEN_FILE, + START_ERR_NOT_AVAILABLE, + START_ERR_CANNOT_ALLOCATE_TRACK, + START_ERR_NOT_ENOUGH_INSTANCE, + START_ERR_INVALID_PARAMETER, + START_ERR_INVALID_SEQ_START_LOCATION_LABEL, - START_ERR_USER = 128, - START_ERR_UNKNOWN = 255, - } StartResult; + START_ERR_USER = 128, + START_ERR_UNKNOWN = 255, + } StartResult; - typedef struct StartInfo { - typedef enum EnableFlag { - ENABLE_START_OFFSET = (1 << 0), - ENABLE_PLAYER_ID = (1 << 1), - ENABLE_PLAYER_PRIORITY = (1 << 2) - } EnableFlag; + typedef struct StartInfo { + // clang-format off + typedef enum EnableFlag { + ENABLE_START_OFFSET = (1 << 0), + ENABLE_PLAYER_ID = (1 << 1), + ENABLE_PLAYER_PRIORITY = (1 << 2) + } EnableFlag; + // clang-format on - typedef enum StartOffsetType { - START_OFFSET_TYPE_SAMPLE = 0, - START_OFFSET_TYPE_MILLISEC, - } StartOffsetType; + typedef enum StartOffsetType { + START_OFFSET_TYPE_SAMPLE = 0, + START_OFFSET_TYPE_MILLISEC, + } StartOffsetType; - StartOffsetType startOffsetType; // 0x00 - int startOffset; // 0x04 + StartOffsetType startOffsetType; // 0x00 + int startOffset; // 0x04 - u32 playerId; // 0x08 - int playerPriority; // 0x0C + u32 playerId; // 0x08 + int playerPriority; // 0x0C - int voiceOutCount; // 0x10 - } StartInfo; + int voiceOutCount; // 0x10 + } StartInfo; - public: - virtual ~SoundStartable() {} // 0x08 + public: + virtual ~SoundStartable() {} // 0x08 - virtual StartResult - detail_SetupSound(SoundHandle* soundHandle, u32 id, - detail::BasicSound::AmbientArgInfo* ambientArgInfo, detail::ExternalSoundPlayer* extPlayer, bool hold, - const StartInfo* startInfo) = 0; // 0x0C + virtual StartResult detail_SetupSound(SoundHandle* soundHandle, u32 id, detail::BasicSound::AmbientArgInfo* ambientArgInfo, + detail::ExternalSoundPlayer* extPlayer, bool hold, + const StartInfo* startInfo) = 0; // 0x0C - virtual u32 detail_ConvertLabelStringToSoundId(const char* label) = 0; // 0x10 + virtual u32 detail_ConvertLabelStringToSoundId(const char* label) = 0; // 0x10 - bool StartSound(SoundHandle* soundHandle, u32 id) { - return detail_StartSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; - } - bool StartSound(SoundHandle* soundHandle, unsigned int id) { - return detail_StartSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; - } - bool StartSound(SoundHandle* soundHandle, int id) { - return detail_StartSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; - } + bool StartSound(SoundHandle* soundHandle, u32 id) { return detail_StartSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; } + bool StartSound(SoundHandle* soundHandle, unsigned int id) { + return detail_StartSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; + } + bool StartSound(SoundHandle* soundHandle, int id) { return detail_StartSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; } - bool HoldSound(SoundHandle* soundHandle, u32 id) { - return detail_HoldSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; - } - bool HoldSound(SoundHandle* soundHandle, unsigned int id) { - return detail_HoldSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; - } - bool HoldSound(SoundHandle* soundHandle, int id) { - return detail_HoldSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; - } + bool HoldSound(SoundHandle* soundHandle, u32 id) { return detail_HoldSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; } + bool HoldSound(SoundHandle* soundHandle, unsigned int id) { return detail_HoldSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; } + bool HoldSound(SoundHandle* soundHandle, int id) { return detail_HoldSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; } - bool PrepareSound(SoundHandle* soundHandle, u32 id) { - return detail_PrepareSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; - } - bool PrepareSound(SoundHandle* soundHandle, unsigned int id) { - return detail_PrepareSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; - } - bool PrepareSound(SoundHandle* soundHandle, int id) { - return detail_PrepareSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; - } + bool PrepareSound(SoundHandle* soundHandle, u32 id) { return detail_PrepareSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; } + bool PrepareSound(SoundHandle* soundHandle, unsigned int id) { + return detail_PrepareSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; + } + bool PrepareSound(SoundHandle* soundHandle, int id) { return detail_PrepareSound(soundHandle, id, NULL, NULL, NULL) == START_SUCCESS; } - private: - StartResult detail_StartSound(SoundHandle* soundHandle, u32 id, - detail::BasicSound::AmbientArgInfo* ambientArgInfo, detail::ExternalSoundPlayer* extPlayer, - const StartInfo* startInfo); + private: + StartResult detail_StartSound(SoundHandle* soundHandle, u32 id, detail::BasicSound::AmbientArgInfo* ambientArgInfo, + detail::ExternalSoundPlayer* extPlayer, const StartInfo* startInfo); - StartResult detail_HoldSound(SoundHandle* soundHandle, u32 id, - detail::BasicSound::AmbientArgInfo* ambientArgInfo, detail::ExternalSoundPlayer* extPlayer, - const StartInfo* startInfo); + StartResult detail_HoldSound(SoundHandle* soundHandle, u32 id, detail::BasicSound::AmbientArgInfo* ambientArgInfo, + detail::ExternalSoundPlayer* extPlayer, const StartInfo* startInfo); - StartResult detail_PrepareSound(SoundHandle* soundHandle, u32 id, - detail::BasicSound::AmbientArgInfo* ambientArgInfo, detail::ExternalSoundPlayer* extPlayer, - const StartInfo* startInfo); + StartResult detail_PrepareSound(SoundHandle* soundHandle, u32 id, detail::BasicSound::AmbientArgInfo* ambientArgInfo, + detail::ExternalSoundPlayer* extPlayer, const StartInfo* startInfo); }; - } -} + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/SoundSystem.h b/libs/NW4R/include/nw4r/snd/SoundSystem.h index f15d77d5..336398db 100644 --- a/libs/NW4R/include/nw4r/snd/SoundSystem.h +++ b/libs/NW4R/include/nw4r/snd/SoundSystem.h @@ -11,36 +11,23 @@ namespace nw4r { namespace snd { class FxBase; class SoundSystem { - public: - static const int DEFAULT_DVD_THREAD_PRIORITY = 3; - static const int DEFAULT_SOUND_THREAD_PRIORITY = 4; + public: + static const int DEFAULT_DVD_THREAD_PRIORITY = 3; + static const int DEFAULT_SOUND_THREAD_PRIORITY = 4; - static void InitSoundSystem(s32 soundThreadPrio = DEFAULT_SOUND_THREAD_PRIORITY, - s32 dvdThreadPriority = DEFAULT_DVD_THREAD_PRIORITY); + static void InitSoundSystem(s32 soundThreadPrio = DEFAULT_SOUND_THREAD_PRIORITY, s32 dvdThreadPriority = DEFAULT_DVD_THREAD_PRIORITY); - static void SetOutputMode(OutputMode mode) { - detail::AxManager::GetInstance().SetOutputMode(mode); - } + static void SetOutputMode(OutputMode mode) { detail::AxManager::GetInstance().SetOutputMode(mode); } - static f32 GetMasterVolume() { - return detail::AxManager::GetInstance().GetMasterVolume(); - } - static void SetMasterVolume(f32 volume, int frame) { - detail::AxManager::GetInstance().SetMasterVolume(volume, frame); - } + static f32 GetMasterVolume() { return detail::AxManager::GetInstance().GetMasterVolume(); } + static void SetMasterVolume(f32 volume, int frame) { detail::AxManager::GetInstance().SetMasterVolume(volume, frame); } - static RemoteSpeaker& GetRemoteSpeaker(int idx) { - return detail::RemoteSpeakerManager::GetInstance().GetRemoteSpeaker(idx); - } + static RemoteSpeaker& GetRemoteSpeaker(int idx) { return detail::RemoteSpeakerManager::GetInstance().GetRemoteSpeaker(idx); } - static void AppendEffect(AuxBus bus, FxBase* pFx) { - detail::AxManager::GetInstance().AppendEffect(bus, pFx); - } - static void ClearEffect(AuxBus bus, int frame) { - detail::AxManager::GetInstance().ClearEffect(bus, frame); - } + static void AppendEffect(AuxBus bus, FxBase* pFx) { detail::AxManager::GetInstance().AppendEffect(bus, pFx); } + static void ClearEffect(AuxBus bus, int frame) { detail::AxManager::GetInstance().ClearEffect(bus, frame); } }; - } -} + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/SoundThread.h b/libs/NW4R/include/nw4r/snd/SoundThread.h index 88482e07..71c34d07 100644 --- a/libs/NW4R/include/nw4r/snd/SoundThread.h +++ b/libs/NW4R/include/nw4r/snd/SoundThread.h @@ -13,64 +13,63 @@ namespace nw4r { namespace snd { namespace detail { class SoundThread { + public: + class Callback { public: - class Callback { - public: - ut::LinkListNode mLink; // 0x00 + ut::LinkListNode mLink; // 0x00 - virtual ~Callback() {} // 0x08 + virtual ~Callback() {} // 0x08 - virtual void UpdatePlayer() {} // 0x0C - virtual void EndSoundFrame() {} // 0x10 - }; - typedef ut::LinkList CallbackList; + virtual void UpdatePlayer() {} // 0x0C + virtual void EndSoundFrame() {} // 0x10 + }; + typedef ut::LinkList CallbackList; - static SoundThread& GetInstance(); + static SoundThread& GetInstance(); - bool Create(s32 priority); + bool Create(s32 priority); - OSMutex& GetSoundMutex() { return mMutex; } + OSMutex& GetSoundMutex() { return mMutex; } - private: - typedef enum ThreadMessage { - MSG_NONE = 0, - MSG_AX_CALLBACK, - MSG_SHUTDOWN, - } ThreadMessage; + private: + typedef enum ThreadMessage { + MSG_NONE = 0, + MSG_AX_CALLBACK, + MSG_SHUTDOWN, + } ThreadMessage; - static const int MSG_QUEUE_CAPACITY = 8; + static const int MSG_QUEUE_CAPACITY = 8; - SoundThread() : - mCreateFlag(false) {} + SoundThread() : mCreateFlag(false) {} - ~SoundThread() {} + ~SoundThread() {} - void SoundThreadProc(); + void SoundThreadProc(); - static void AxCallback(); - static void* SoundThreadFunc(void* arg); + static void AxCallback(); + static void* SoundThreadFunc(void* arg); - void Lock() { OSLockMutex(&mMutex); } - void Unlock() { OSUnlockMutex(&mMutex); } + void Lock() { OSLockMutex(&mMutex); } + void Unlock() { OSUnlockMutex(&mMutex); } - private: - OSThread mThread; // 0x00 - u64 mThreadStack[THREAD_STACK_SIZE]; // 0x318 - OSThreadQueue mThreadQueue; // 0x2318 + private: + OSThread mThread; // 0x00 + u64 mThreadStack[THREAD_STACK_SIZE]; // 0x318 + OSThreadQueue mThreadQueue; // 0x2318 - mutable OSMutex mMutex; // 0x2320 + mutable OSMutex mMutex; // 0x2320 - OSMessageQueue mMsgQueue; // 0x2338 - OSMessage mMsgBuffer[MSG_QUEUE_CAPACITY]; // 0x2358 + OSMessageQueue mMsgQueue; // 0x2338 + OSMessage mMsgBuffer[MSG_QUEUE_CAPACITY]; // 0x2358 - AxManager::CallbackListNode mAxCallbackNode; // 0x2378 - CallbackList mCallbackList; // 0x2384 + AxManager::CallbackListNode mAxCallbackNode; // 0x2378 + CallbackList mCallbackList; // 0x2384 - u32 mProcessTick; // 0x2390 - bool mCreateFlag; // 0x2394 + u32 mProcessTick; // 0x2390 + bool mCreateFlag; // 0x2394 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/StrmChannel.h b/libs/NW4R/include/nw4r/snd/StrmChannel.h index f56d70dd..6f3dbd0f 100644 --- a/libs/NW4R/include/nw4r/snd/StrmChannel.h +++ b/libs/NW4R/include/nw4r/snd/StrmChannel.h @@ -7,37 +7,37 @@ namespace nw4r { namespace snd { namespace detail { typedef struct StrmChannel { - void* mBuffer; // 0x00 - u32 mBufferSize; // 0x04 + void* mBuffer; // 0x00 + u32 mBufferSize; // 0x04 - AdpcmInfo mAdpcmInfo; // 0x08 + AdpcmInfo mAdpcmInfo; // 0x08 } StrmChannel; class StrmBufferPool { - public: - void Setup(void* base, u32 size, int count); - void Shutdown(); + public: + void Setup(void* base, u32 size, int count); + void Shutdown(); - void* Alloc(); - void Free(void* buffer); + void* Alloc(); + void Free(void* buffer); - u32 GetBlockSize() const { return mBlockSize; } + u32 GetBlockSize() const { return mBlockSize; } - private: - static const int BLOCK_MAX = 32; - static const int BITS_PER_BYTE = 8; + private: + static const int BLOCK_MAX = 32; + static const int BITS_PER_BYTE = 8; - void* mBuffer; // 0x00 - u32 mBufferSize; // 0x04 + void* mBuffer; // 0x00 + u32 mBufferSize; // 0x04 - u32 mBlockSize; // 0x08 - int mBlockCount; // 0x0C + u32 mBlockSize; // 0x08 + int mBlockCount; // 0x0C - int mAllocCount; // 0x10 - u8 mAllocFlags[BLOCK_MAX / BITS_PER_BYTE]; // 0x14 + int mAllocCount; // 0x10 + u8 mAllocFlags[BLOCK_MAX / BITS_PER_BYTE]; // 0x14 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/StrmFile.h b/libs/NW4R/include/nw4r/snd/StrmFile.h index 1d52ee0d..68d9fef5 100644 --- a/libs/NW4R/include/nw4r/snd/StrmFile.h +++ b/libs/NW4R/include/nw4r/snd/StrmFile.h @@ -17,142 +17,141 @@ namespace nw4r { namespace detail { namespace StrmFile { typedef struct StrmDataInfo { - u8 format; // 0x00 - u8 loopFlag; // 0x01 - u8 numChannels; // 0x02 - u8 sampleRate24; // 0x03 - u16 sampleRate; // 0x04 - u16 blockHeaderOffset; // 0x06 - u32 loopStart; // 0x08 - u32 loopEnd; // 0x0C - u32 dataOffset; // 0x10 - u32 numBlocks; // 0x14 - u32 blockSize; // 0x18 - u32 blockSamples; // 0x1C - u32 lastBlockSize; // 0x20 - u32 lastBlockSamples; // 0x24 - u32 lastBlockPaddedSize; // 0x28 - u32 adpcmDataInterval; // 0x2C - u32 adpcmDataSize; // 0x30 + u8 format; // 0x00 + u8 loopFlag; // 0x01 + u8 numChannels; // 0x02 + u8 sampleRate24; // 0x03 + u16 sampleRate; // 0x04 + u16 blockHeaderOffset; // 0x06 + u32 loopStart; // 0x08 + u32 loopEnd; // 0x0C + u32 dataOffset; // 0x10 + u32 numBlocks; // 0x14 + u32 blockSize; // 0x18 + u32 blockSamples; // 0x1C + u32 lastBlockSize; // 0x20 + u32 lastBlockSamples; // 0x24 + u32 lastBlockPaddedSize; // 0x28 + u32 adpcmDataInterval; // 0x2C + u32 adpcmDataSize; // 0x30 } StrmDataInfo; typedef struct TrackInfo { - u8 channelCount; // 0x00 - u8 channelIndexTable[]; // 0x01 + u8 channelCount; // 0x00 + u8 channelIndexTable[]; // 0x01 } TrackInfo; typedef struct TrackTable { - u8 trackCount; // 0x00 - u8 trackDataType; // 0x01 - Util::DataRef refTrackHeader[]; // 0x04 + u8 trackCount; // 0x00 + u8 trackDataType; // 0x01 + Util::DataRef refTrackHeader[]; // 0x04 } TrackTable; typedef struct ChannelInfo { - Util::DataRef refAdpcmInfo; // 0x00 + Util::DataRef refAdpcmInfo; // 0x00 } ChannelInfo; typedef struct ChannelTable { - u8 channelCount; // 0x00 - Util::DataRef refChannelHeader[]; // 0x04 + u8 channelCount; // 0x00 + Util::DataRef refChannelHeader[]; // 0x04 } ChannelTable; typedef struct Header { - ut::BinaryFileHeader fileHeader; // 0x00 + ut::BinaryFileHeader fileHeader; // 0x00 - u32 headBlockOffset; // 0x10 - u32 headBlockSize; // 0x14 + u32 headBlockOffset; // 0x10 + u32 headBlockSize; // 0x14 - u32 adpcBlockOffset; // 0x18 - u32 adpcBlockSize; // 0x1C + u32 adpcBlockOffset; // 0x18 + u32 adpcBlockSize; // 0x1C - u32 dataBlockOffset; // 0x20 - u32 dataBlockSize; // 0x24 + u32 dataBlockOffset; // 0x20 + u32 dataBlockSize; // 0x24 } Header; typedef struct HeadBlock { - ut::BinaryBlockHeader blockHeader; // 0x00 - Util::DataRef refDataHeader; // 0x08 - Util::DataRef refTrackTable; // 0x10 - Util::DataRef refChannelTable; // 0x18 + ut::BinaryBlockHeader blockHeader; // 0x00 + Util::DataRef refDataHeader; // 0x08 + Util::DataRef refTrackTable; // 0x10 + Util::DataRef refChannelTable; // 0x18 } HeadBlock; - } + } // namespace StrmFile typedef struct StrmInfo { - u8 format; // 0x00 - u8 loopFlag; // 0x01 - u8 numChannels; // 0x02 - int sampleRate; // 0x04 - u16 blockHeaderOffset; // 0x08 - u32 loopStart; // 0x0C - u32 loopEnd; // 0x10 - u32 dataOffset; // 0x14 - u32 numBlocks; // 0x18 - u32 blockSize; // 0x1C - u32 blockSamples; // 0x20 - u32 lastBlockSize; // 0x24 - u32 lastBlockSamples; // 0x28 - u32 lastBlockPaddedSize; // 0x2C - u32 adpcmDataInterval; // 0x30 - u32 adpcmDataSize; // 0x34 + u8 format; // 0x00 + u8 loopFlag; // 0x01 + u8 numChannels; // 0x02 + int sampleRate; // 0x04 + u16 blockHeaderOffset; // 0x08 + u32 loopStart; // 0x0C + u32 loopEnd; // 0x10 + u32 dataOffset; // 0x14 + u32 numBlocks; // 0x18 + u32 blockSize; // 0x1C + u32 blockSamples; // 0x20 + u32 lastBlockSize; // 0x24 + u32 lastBlockSamples; // 0x28 + u32 lastBlockPaddedSize; // 0x2C + u32 adpcmDataInterval; // 0x30 + u32 adpcmDataSize; // 0x34 } StrmInfo; class StrmFileReader { - public: - static const u32 SIGNATURE = 'RSTM'; - static const int VERSION = NW4R_VERSION(1, 0); + public: + static const u32 SIGNATURE = 'RSTM'; + static const int VERSION = NW4R_VERSION(1, 0); - StrmFileReader(); + StrmFileReader(); - bool IsAvailable() const { return mHeader != NULL; } + bool IsAvailable() const { return mHeader != NULL; } - bool IsValidFileHeader(const void* buffer); - void Setup(const void* buffer); + bool IsValidFileHeader(const void* buffer); + void Setup(const void* buffer); - bool ReadStrmInfo(StrmInfo* strmInfo) const; - bool ReadAdpcmInfo(AdpcmInfo* adpcmInfo, int channels) const; + bool ReadStrmInfo(StrmInfo* strmInfo) const; + bool ReadAdpcmInfo(AdpcmInfo* adpcmInfo, int channels) const; - u32 GetAdpcBlockOffset() const { - if (IsAvailable()) { - return mHeader->adpcBlockOffset; - } - return 0; + u32 GetAdpcBlockOffset() const { + if (IsAvailable()) { + return mHeader->adpcBlockOffset; } + return 0; + } - private: - const StrmFile::Header* mHeader; // 0x00 - const StrmFile::HeadBlock* mHeadBlock; // 0x04 + private: + const StrmFile::Header* mHeader; // 0x00 + const StrmFile::HeadBlock* mHeadBlock; // 0x04 }; class StrmFileLoader { - public: - explicit StrmFileLoader(ut::FileStream& rFileStream) : - mStream(rFileStream) {} + public: + explicit StrmFileLoader(ut::FileStream& rFileStream) : mStream(rFileStream) {} - bool LoadFileHeader(void* buffer, u32 size); - bool ReadAdpcBlockData(u16* yn1, u16* yn2, int block, int channels); + bool LoadFileHeader(void* buffer, u32 size); + bool ReadAdpcBlockData(u16* yn1, u16* yn2, int block, int channels); - bool ReadStrmInfo(StrmInfo* strmInfo) const { - if (!mReader.IsAvailable()) { - return false; - } - return mReader.ReadStrmInfo(strmInfo); + bool ReadStrmInfo(StrmInfo* strmInfo) const { + if (!mReader.IsAvailable()) { + return false; } + return mReader.ReadStrmInfo(strmInfo); + } - bool ReadAdpcmInfo(AdpcmInfo* adpcmInfo, int channel) const { - if (!mReader.IsAvailable()) { - return false; - } - return mReader.ReadAdpcmInfo(adpcmInfo, channel); + bool ReadAdpcmInfo(AdpcmInfo* adpcmInfo, int channel) const { + if (!mReader.IsAvailable()) { + return false; } + return mReader.ReadAdpcmInfo(adpcmInfo, channel); + } - private: - static const int HEADER_ALIGNED_SIZE = OSRoundUp32B(sizeof(StrmFile::Header)); + private: + static const int HEADER_ALIGNED_SIZE = OSRoundUp32B(sizeof(StrmFile::Header)); - ut::FileStream& mStream; // 0x00 - StrmFileReader mReader; // 0x04 + ut::FileStream& mStream; // 0x00 + StrmFileReader mReader; // 0x04 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r #endif diff --git a/libs/NW4R/include/nw4r/snd/StrmPlayer.h b/libs/NW4R/include/nw4r/snd/StrmPlayer.h index 9e62542e..d31173f8 100644 --- a/libs/NW4R/include/nw4r/snd/StrmPlayer.h +++ b/libs/NW4R/include/nw4r/snd/StrmPlayer.h @@ -3,11 +3,11 @@ #include +#include #include #include #include #include -#include #include @@ -15,231 +15,223 @@ namespace nw4r { namespace snd { namespace detail { class StrmPlayer : public BasicPlayer { - public: - typedef enum StartOffsetType { - START_OFFSET_TYPE_SAMPLE = 0, - START_OFFSET_TYPE_MILLISEC - } StartOffsetType; + public: + typedef enum StartOffsetType { START_OFFSET_TYPE_SAMPLE = 0, START_OFFSET_TYPE_MILLISEC } StartOffsetType; - typedef struct StrmHeader { - // TODO: Why 8 if the player only supports 2??? - static const int STRM_CHANNEL_MAX = 8; + typedef struct StrmHeader { + // TODO: Why 8 if the player only supports 2??? + static const int STRM_CHANNEL_MAX = 8; - StrmInfo strmInfo; // 0x00 - AdpcmInfo adpcmInfo[STRM_CHANNEL_MAX]; // 0x38 - } StrmHeader; + StrmInfo strmInfo; // 0x00 + AdpcmInfo adpcmInfo[STRM_CHANNEL_MAX]; // 0x38 + } StrmHeader; - // TODO: How is this calculated? - static const int LOAD_BUFFER_SIZE = 0x4000 + 32; - class LoadCommand { - friend class StrmPlayer; - - public: - virtual void NotifyAsyncEnd(bool result); - - void SetAdpcmLoopContext(int channelNum, u16* predScale); - void* GetBuffer(int channelNum); - - private: - typedef enum Status { - STATE_SETUP = 0, - STATE_INTERVAL, - } Status; - - StrmPlayer* mPlayer; // 0x04 - Status mStatus; // 0x08 - - s32 mStreamBlockIndex; // 0x0C - s32 mBufferBlockIndex; // 0x10 - - public: - ut::LinkListNode mLinkNode; // 0x14 - - static u8 mMramBuf[LOAD_BUFFER_SIZE] ALIGN32; - }; - typedef ut::LinkList LoadCommandList; - - typedef void (*NotifyLoadHeaderAsyncEndCallback)(bool, const StrmHeader*, void*); - class StrmCallback { - public: - typedef enum Result { - RESULT_SUCCESS = 0, - RESULT_FAILED, - RESULT_CANCELED, - RESULT_ASYNC, - RESULT_RETRY - } Result; - - virtual ~StrmCallback() {} - - virtual Result LoadHeader(StrmPlayer::NotifyLoadHeaderAsyncEndCallback callback, void* callbackData, u32 userId, u32 userData) const = 0; - virtual Result LoadStream(void* mramAddr, u32 size, s32 offset, int numChannels, - u32 blockSize, s32 blockHeaderOffset, bool needUpdateAdpcmLoop, - StrmPlayer::LoadCommand& callback, u32 userId, u32 userData) const = 0; - - virtual void CancelLoading(u32 userId, u32 userData) const = 0; - }; + // TODO: How is this calculated? + static const int LOAD_BUFFER_SIZE = 0x4000 + 32; + class LoadCommand { + friend class StrmPlayer; public: - StrmPlayer(); - - virtual bool Start(); // 0x0C - virtual void Stop(); // 0x10 - virtual void Pause(bool flag); // 0x14 - virtual bool IsActive() const { return mActiveFlag; } // 0x18 - virtual bool IsPrepared() const { return mPreparedFlag; }; // 0x1C - virtual bool IsStarted() const { return mStartedFlag; }; // 0x20 - virtual bool IsPause() const { return mPauseFlag; }; // 0x24 - virtual void SetVolume(f32 volume) { mExtVolume = volume; } // 0x28 - virtual void SetPitch(f32 pitch) { mExtPitch = pitch; } // 0x2C - virtual void SetPan(f32 pan) { mExtPan = pan; } // 0x30 - virtual void SetSurroundPan(f32 surroundPan) { mExtSurroundPan = surroundPan; } // 0x34 - virtual void SetPan2(f32 pan2) { mExtPan2 = pan2; } // 0x38 - virtual void SetSurroundPan2(f32 surroundPan2) { mExtSurroundPan2 = surroundPan2; } // 0x3C - virtual void SetLpfFreq(f32 lpfFreq) { mExtLpfFreq = lpfFreq; } // 0x40 - virtual f32 GetVolume() const { return mExtVolume; }; // 0x44 - virtual f32 GetPitch() const { return mExtPitch; }; // 0x48 - virtual f32 GetPan() const { return mExtPan; }; // 0x4C - virtual f32 GetSurroundPan() const { return mExtSurroundPan; }; // 0x50 - virtual f32 GetPan2() const { return mExtPan2; }; // 0x54 - virtual f32 GetSurroundPan2() const { return mExtSurroundPan2; }; // 0x58 - virtual f32 GetLpfFreq() const { return mExtLpfFreq; }; // 0x5C - virtual void SetOutputLine(int lineFlag); // 0x60 - virtual void SetMainOutVolume(f32 volume); // 0x64 - virtual void SetMainSend(f32 send); // 0x68 - virtual void SetFxSend(AuxBus bus, f32 send); // 0x6C - virtual void SetRemoteOutVolume(int remoteIndex, f32 volume); // 0x70 - virtual void SetRemoteSend(int remoteIndex, f32 send); // 0x74 - virtual void SetRemoteFxSend(int remoteIndex, f32 send); // 0x78 - virtual int GetOutputLine() const; // 0x7C - virtual f32 GetMainOutVolume() const; // 0x80 - virtual f32 GetMainSend() const; // 0x84 - virtual f32 GetFxSend(AuxBus bus) const; // 0x88 - virtual f32 GetRemoteOutVolume(int remoteIndex) const; // 0x8C - virtual f32 GetRemoteSend(int remoteIndex) const; // 0x90 - virtual f32 GetRemoteFxSend(int remoteIndex) const; // 0x94 + virtual void NotifyAsyncEnd(bool result); - void Setup(const StrmHeader* header); - bool SetupPlayer(const StrmHeader* header); - void Shutdown(); - - bool Prepare(StrmBufferPool* bufferPool, StartOffsetType startOffsetType, s32 startOffset, int voices, StrmCallback* callback, u32 callbackData); - - void InitParam(int voices); - void ForceStop(); - - void Update(); - - static void UpdateAllPlayers(); - static void StopAllPlayers(); - static void UpdateBufferAllPlayers(); + void SetAdpcmLoopContext(int channelNum, u16* predScale); + void* GetBuffer(int channelNum); private: - static const int DATA_BLOCK_COUNT_MIN = 4; - static const int DATA_BLOCK_COUNT_MAX = 32; - static const int DATA_BLOCK_SIZE_MAX = 0x2000; + typedef enum Status { + STATE_SETUP = 0, + STATE_INTERVAL, + } Status; - bool AllocChannels(int channels, int voices); - void FreeChannels(); + StrmPlayer* mPlayer; // 0x04 + Status mStatus; // 0x08 - void UpdateBuffer(); - void UpdateLoopAddress(u32 startSample, u32 endSample); - void UpdatePlayingBlockIndex(); - void UpdateDataLoopAddress(s32 endBlock); - void SetLoopEndToZeroBuffer(int endBlock); - void UpdateLoadingBlockIndex(LoadCommand::Status status); - void UpdatePauseStatus(); - - int CalcLoadingBufferBlockCount() const; - bool CalcStartOffset(s32* blockIndex, u32* blockOffset, s32* loopCount); - - static void VoiceCallbackFunc(AxVoice* dropVoice, AxVoice::CallbackStatus status, void* pCallbackArg); - - static void NotifyStrmHeaderAsyncEndCallback(bool result, const StrmHeader* header, void* userData); + s32 mStreamBlockIndex; // 0x0C + s32 mBufferBlockIndex; // 0x10 public: - ut::LinkListNode mPlayerLink; // 0x08 + ut::LinkListNode mLinkNode; // 0x14 - private: - StrmInfo mStrmInfo; // 0x10 + static u8 mMramBuf[LOAD_BUFFER_SIZE] ALIGN32; + }; + typedef ut::LinkList LoadCommandList; - u8 mActiveFlag; // 0x48 - u8 mStartedFlag; // 0x49 - u8 mPreparedFlag; // 0x4A - u8 mPauseFlag; // 0x4B - u8 mDiskErrorFlag; // 0x4C - u8 mPauseStatus; // 0x4D - u8 mLoadWaitFlag; // 0x4E - u8 mNoRealtimeLoadFlag; // 0x4F + typedef void (*NotifyLoadHeaderAsyncEndCallback)(bool, const StrmHeader*, void*); + class StrmCallback { + public: + typedef enum Result { RESULT_SUCCESS = 0, RESULT_FAILED, RESULT_CANCELED, RESULT_ASYNC, RESULT_RETRY } Result; - u8 mSkipUpdateAdpcmLoop; // 0x50 - u8 mValidAdpcmLoop; // 0x51 + virtual ~StrmCallback() {} - u8 mPlayFinishFlag; // 0x52 - u8 mLoadFinishFlag; // 0x53 - s32 mLoopCounter; // 0x54 + virtual Result LoadHeader(StrmPlayer::NotifyLoadHeaderAsyncEndCallback callback, void* callbackData, u32 userId, + u32 userData) const = 0; + virtual Result LoadStream(void* mramAddr, u32 size, s32 offset, int numChannels, u32 blockSize, s32 blockHeaderOffset, + bool needUpdateAdpcmLoop, StrmPlayer::LoadCommand& callback, u32 userId, u32 userData) const = 0; - int mPrepareCounter; // 0x58 + virtual void CancelLoading(u32 userId, u32 userData) const = 0; + }; - int mChangeNumBlocks; // 0x5C - int mDataBlockSize; // 0x60 + public: + StrmPlayer(); - int mBufferBlockCount; // 0x64 - int mBufferBlockCountBase; // 0x68 + virtual bool Start(); // 0x0C + virtual void Stop(); // 0x10 + virtual void Pause(bool flag); // 0x14 + virtual bool IsActive() const { return mActiveFlag; } // 0x18 + virtual bool IsPrepared() const { return mPreparedFlag; }; // 0x1C + virtual bool IsStarted() const { return mStartedFlag; }; // 0x20 + virtual bool IsPause() const { return mPauseFlag; }; // 0x24 + virtual void SetVolume(f32 volume) { mExtVolume = volume; } // 0x28 + virtual void SetPitch(f32 pitch) { mExtPitch = pitch; } // 0x2C + virtual void SetPan(f32 pan) { mExtPan = pan; } // 0x30 + virtual void SetSurroundPan(f32 surroundPan) { mExtSurroundPan = surroundPan; } // 0x34 + virtual void SetPan2(f32 pan2) { mExtPan2 = pan2; } // 0x38 + virtual void SetSurroundPan2(f32 surroundPan2) { mExtSurroundPan2 = surroundPan2; } // 0x3C + virtual void SetLpfFreq(f32 lpfFreq) { mExtLpfFreq = lpfFreq; } // 0x40 + virtual f32 GetVolume() const { return mExtVolume; }; // 0x44 + virtual f32 GetPitch() const { return mExtPitch; }; // 0x48 + virtual f32 GetPan() const { return mExtPan; }; // 0x4C + virtual f32 GetSurroundPan() const { return mExtSurroundPan; }; // 0x50 + virtual f32 GetPan2() const { return mExtPan2; }; // 0x54 + virtual f32 GetSurroundPan2() const { return mExtSurroundPan2; }; // 0x58 + virtual f32 GetLpfFreq() const { return mExtLpfFreq; }; // 0x5C + virtual void SetOutputLine(int lineFlag); // 0x60 + virtual void SetMainOutVolume(f32 volume); // 0x64 + virtual void SetMainSend(f32 send); // 0x68 + virtual void SetFxSend(AuxBus bus, f32 send); // 0x6C + virtual void SetRemoteOutVolume(int remoteIndex, f32 volume); // 0x70 + virtual void SetRemoteSend(int remoteIndex, f32 send); // 0x74 + virtual void SetRemoteFxSend(int remoteIndex, f32 send); // 0x78 + virtual int GetOutputLine() const; // 0x7C + virtual f32 GetMainOutVolume() const; // 0x80 + virtual f32 GetMainSend() const; // 0x84 + virtual f32 GetFxSend(AuxBus bus) const; // 0x88 + virtual f32 GetRemoteOutVolume(int remoteIndex) const; // 0x8C + virtual f32 GetRemoteSend(int remoteIndex) const; // 0x90 + virtual f32 GetRemoteFxSend(int remoteIndex) const; // 0x94 - int mLoadingBufferBlockCount; // 0x6C - int mLoadingBufferBlockIndex; // 0x70 - int mLoadingDataBlockIndex; // 0x74 + void Setup(const StrmHeader* header); + bool SetupPlayer(const StrmHeader* header); + void Shutdown(); - int mPlayingBufferBlockCount; // 0x78 - int mPlayingBufferBlockIndex; // 0x7C - int mPlayingDataBlockIndex; // 0x80 + bool Prepare(StrmBufferPool* bufferPool, StartOffsetType startOffsetType, s32 startOffset, int voices, StrmCallback* callback, + u32 callbackData); - int mLoopStartBlockIndex; // 0x84 - int mLastBlockIndex; // 0x88 + void InitParam(int voices); + void ForceStop(); - StartOffsetType mStartOffsetType; // 0x8C - int mStartOffset; // 0x90 + void Update(); - LoadCommandList mFreeLoadCommandList; // 0x94 - LoadCommandList mFillBufferCommandList; // 0xA0 - LoadCommand mLoadCoammndArray[32]; // 0xAC + static void UpdateAllPlayers(); + static void StopAllPlayers(); + static void UpdateBufferAllPlayers(); - StrmBufferPool* mBufferPool; // 0x42C + private: + static const int DATA_BLOCK_COUNT_MIN = 4; + static const int DATA_BLOCK_COUNT_MAX = 32; + static const int DATA_BLOCK_SIZE_MAX = 0x2000; - StrmCallback* mCallback; // 0x430 - u32 mCallbackData; // 0x434 + bool AllocChannels(int channels, int voices); + void FreeChannels(); - AxVoice* mVoice; // 0x438 + void UpdateBuffer(); + void UpdateLoopAddress(u32 startSample, u32 endSample); + void UpdatePlayingBlockIndex(); + void UpdateDataLoopAddress(s32 endBlock); + void SetLoopEndToZeroBuffer(int endBlock); + void UpdateLoadingBlockIndex(LoadCommand::Status status); + void UpdatePauseStatus(); - f32 mExtVolume; // 0x43C - f32 mExtPan; // 0x440 - f32 mExtSurroundPan; // 0x444 - f32 mExtPan2; // 0x448 - f32 mExtSurroundPan2; // 0x44C - f32 mExtPitch; // 0x450 - f32 mExtLpfFreq; // 0x454 + int CalcLoadingBufferBlockCount() const; + bool CalcStartOffset(s32* blockIndex, u32* blockOffset, s32* loopCount); - int mOutputLineFlag; // 0x458 + static void VoiceCallbackFunc(AxVoice* dropVoice, AxVoice::CallbackStatus status, void* pCallbackArg); - f32 mMainOutVolume; // 0x45C - f32 mMainSend; // 0x460 + static void NotifyStrmHeaderAsyncEndCallback(bool result, const StrmHeader* header, void* userData); - f32 mFxSend[AUX_BUS_NUM]; // 0x464 + public: + ut::LinkListNode mPlayerLink; // 0x08 - f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // 0x470 - f32 mRemoteSend[WPAD_MAX_CONTROLLERS]; // 0x480 - f32 mRemoteFxSend[WPAD_MAX_CONTROLLERS]; // 0x490 + private: + StrmInfo mStrmInfo; // 0x10 - s32 mChannelCount; // 0x4A0 - s32 mVoiceOutCount; // 0x4A4 + u8 mActiveFlag; // 0x48 + u8 mStartedFlag; // 0x49 + u8 mPreparedFlag; // 0x4A + u8 mPauseFlag; // 0x4B + u8 mDiskErrorFlag; // 0x4C + u8 mPauseStatus; // 0x4D + u8 mLoadWaitFlag; // 0x4E + u8 mNoRealtimeLoadFlag; // 0x4F - StrmChannel mChannels[CHANNEL_MAX]; // 0x4A8 - u16 mAdpcmPredScale[CHANNEL_MAX]; // 0x518 + u8 mSkipUpdateAdpcmLoop; // 0x50 + u8 mValidAdpcmLoop; // 0x51 + + u8 mPlayFinishFlag; // 0x52 + u8 mLoadFinishFlag; // 0x53 + s32 mLoopCounter; // 0x54 + + int mPrepareCounter; // 0x58 + + int mChangeNumBlocks; // 0x5C + int mDataBlockSize; // 0x60 + + int mBufferBlockCount; // 0x64 + int mBufferBlockCountBase; // 0x68 + + int mLoadingBufferBlockCount; // 0x6C + int mLoadingBufferBlockIndex; // 0x70 + int mLoadingDataBlockIndex; // 0x74 + + int mPlayingBufferBlockCount; // 0x78 + int mPlayingBufferBlockIndex; // 0x7C + int mPlayingDataBlockIndex; // 0x80 + + int mLoopStartBlockIndex; // 0x84 + int mLastBlockIndex; // 0x88 + + StartOffsetType mStartOffsetType; // 0x8C + int mStartOffset; // 0x90 + + LoadCommandList mFreeLoadCommandList; // 0x94 + LoadCommandList mFillBufferCommandList; // 0xA0 + LoadCommand mLoadCoammndArray[32]; // 0xAC + + StrmBufferPool* mBufferPool; // 0x42C + + StrmCallback* mCallback; // 0x430 + u32 mCallbackData; // 0x434 + + AxVoice* mVoice; // 0x438 + + f32 mExtVolume; // 0x43C + f32 mExtPan; // 0x440 + f32 mExtSurroundPan; // 0x444 + f32 mExtPan2; // 0x448 + f32 mExtSurroundPan2; // 0x44C + f32 mExtPitch; // 0x450 + f32 mExtLpfFreq; // 0x454 + + int mOutputLineFlag; // 0x458 + + f32 mMainOutVolume; // 0x45C + f32 mMainSend; // 0x460 + + f32 mFxSend[AUX_BUS_NUM]; // 0x464 + + f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // 0x470 + f32 mRemoteSend[WPAD_MAX_CONTROLLERS]; // 0x480 + f32 mRemoteFxSend[WPAD_MAX_CONTROLLERS]; // 0x490 + + s32 mChannelCount; // 0x4A0 + s32 mVoiceOutCount; // 0x4A4 + + StrmChannel mChannels[CHANNEL_MAX]; // 0x4A8 + u16 mAdpcmPredScale[CHANNEL_MAX]; // 0x518 }; typedef ut::LinkList StrmPlayerList; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_STRM_PLAYER_H +#endif // NW4R_SND_STRM_PLAYER_H diff --git a/libs/NW4R/include/nw4r/snd/StrmSound.h b/libs/NW4R/include/nw4r/snd/StrmSound.h index 659f3d81..1d445f7f 100644 --- a/libs/NW4R/include/nw4r/snd/StrmSound.h +++ b/libs/NW4R/include/nw4r/snd/StrmSound.h @@ -13,7 +13,8 @@ namespace nw4r { namespace snd { class StrmSoundHandle; namespace detail { - template class SoundInstanceManager; + template + class SoundInstanceManager; } namespace detail { @@ -21,45 +22,44 @@ namespace nw4r { class StrmSound : public BasicSound { friend class StrmSoundHandle; - public: - NW4R_UT_RUNTIME_TYPEINFO; + public: + NW4R_UT_RUNTIME_TYPEINFO; - explicit StrmSound(SoundInstanceManager* manager); + explicit StrmSound(SoundInstanceManager* manager); - virtual void Shutdown(); // 0x28 + virtual void Shutdown(); // 0x28 - virtual void SetPlayerPriority(int priority); // 0x4C + virtual void SetPlayerPriority(int priority); // 0x4C - virtual bool IsAttachedTempSpecialHandle(); // 0x5C - virtual void DetachTempSpecialHandle(); // 0x60 + virtual bool IsAttachedTempSpecialHandle(); // 0x5C + virtual void DetachTempSpecialHandle(); // 0x60 - virtual BasicPlayer& GetBasicPlayer() { return mStrmPlayer; } // 0x68 - virtual const BasicPlayer& GetBasicPlayer() const { return mStrmPlayer; } // 0x6C + virtual BasicPlayer& GetBasicPlayer() { return mStrmPlayer; } // 0x68 + virtual const BasicPlayer& GetBasicPlayer() const { return mStrmPlayer; } // 0x6C - void Setup(const StrmPlayer::StrmHeader* header); + void Setup(const StrmPlayer::StrmHeader* header); - bool Prepare(StrmBufferPool* bufferPool, - StrmPlayer::StartOffsetType startOffsetType, s32 startOffset, int voices, - StrmPlayer::StrmCallback* callback, u32 callbackData); + bool Prepare(StrmBufferPool* bufferPool, StrmPlayer::StartOffsetType startOffsetType, s32 startOffset, int voices, + StrmPlayer::StrmCallback* callback, u32 callbackData); - void SetChannelPriority(int priority); + void SetChannelPriority(int priority); - private: - StrmPlayer mStrmPlayer; // 0xD8 - StrmSoundHandle* mTempSpecialHandle; // 0x1F4 - SoundInstanceManager* mManager; // 0x1F8 + private: + StrmPlayer mStrmPlayer; // 0xD8 + StrmSoundHandle* mTempSpecialHandle; // 0x1F4 + SoundInstanceManager* mManager; // 0x1F8 - u8 mNumChannels; // 0x5FC + u8 mNumChannels; // 0x5FC - void* mBuffer[CHANNEL_MAX]; // 0x600 - u32 mBufSize; // 0x608 + void* mBuffer[CHANNEL_MAX]; // 0x600 + u32 mBufSize; // 0x608 - u8 mNumBufBlocks; // 0x60C + u8 mNumBufBlocks; // 0x60C - int mAllocChannelCount; // 0x610 + int mAllocChannelCount; // 0x610 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_STRM_SOUND_H +#endif // NW4R_SND_STRM_SOUND_H diff --git a/libs/NW4R/include/nw4r/snd/StrmSoundHandle.h b/libs/NW4R/include/nw4r/snd/StrmSoundHandle.h index 9090761b..8c40ce81 100644 --- a/libs/NW4R/include/nw4r/snd/StrmSoundHandle.h +++ b/libs/NW4R/include/nw4r/snd/StrmSoundHandle.h @@ -10,22 +10,18 @@ namespace nw4r { namespace snd { class StrmSoundHandle : private ut::NonCopyable { - public: - ~StrmSoundHandle() { - DetachSound(); - } + public: + ~StrmSoundHandle() { DetachSound(); } - void DetachSound(); + void DetachSound(); - bool IsAttachedSound() const { - return mSound != NULL; - } + bool IsAttachedSound() const { return mSound != NULL; } - private: - detail::StrmSound* mSound; // 0x00 + private: + detail::StrmSound* mSound; // 0x00 }; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_STRM_SOUND_HANDLE_H +#endif // NW4R_SND_STRM_SOUND_HANDLE_H diff --git a/libs/NW4R/include/nw4r/snd/Task.h b/libs/NW4R/include/nw4r/snd/Task.h index 5f3ff5a8..25ff308f 100644 --- a/libs/NW4R/include/nw4r/snd/Task.h +++ b/libs/NW4R/include/nw4r/snd/Task.h @@ -11,30 +11,28 @@ namespace nw4r { class Task : private ut::NonCopyable { friend class TaskManager; - public: - Task() : - mTaskId(0) {} + public: + Task() : mTaskId(0) {} - Task(u32 taskId) : - mTaskId(taskId) {} + Task(u32 taskId) : mTaskId(taskId) {} - virtual ~Task() {} // 0x08 + virtual ~Task() {} // 0x08 - virtual void Execute() = 0; // 0x0C - virtual void Cancel() = 0; // 0x10 + virtual void Execute() = 0; // 0x0C + virtual void Cancel() = 0; // 0x10 - u32 GetTaskId() const { return mTaskId; } + u32 GetTaskId() const { return mTaskId; } - public: - ut::LinkListNode mTaskLink; // 0x04 + public: + ut::LinkListNode mTaskLink; // 0x04 - private: - u32 mTaskId; // 0x0C + private: + u32 mTaskId; // 0x0C }; typedef ut::LinkList TaskList; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_TASK_H +#endif // NW4R_SND_TASK_H diff --git a/libs/NW4R/include/nw4r/snd/TaskManager.h b/libs/NW4R/include/nw4r/snd/TaskManager.h index 566394a7..7147ed40 100644 --- a/libs/NW4R/include/nw4r/snd/TaskManager.h +++ b/libs/NW4R/include/nw4r/snd/TaskManager.h @@ -9,41 +9,36 @@ namespace nw4r { namespace snd { namespace detail { class TaskManager { - public: - typedef enum TaskPriority { - PRIORITY_LOW = 0, - PRIORITY_MIDDLE, - PRIORITY_HIGH, - PRIORITY_MAX - } TaskPriority; + public: + typedef enum TaskPriority { PRIORITY_LOW = 0, PRIORITY_MIDDLE, PRIORITY_HIGH, PRIORITY_MAX } TaskPriority; - public: - static TaskManager& GetInstance(); + public: + static TaskManager& GetInstance(); - void AppendTask(Task* task, TaskPriority priority); - Task* PopTask(TaskPriority priority); + void AppendTask(Task* task, TaskPriority priority); + Task* PopTask(TaskPriority priority); - void Execute(); - bool ExecuteSingle() NO_INLINE; + void Execute(); + bool ExecuteSingle() NO_INLINE; - void CancelByTaskId(u32 taskId); + void CancelByTaskId(u32 taskId); - void* Alloc(); - void Free(void* ptr); + void* Alloc(); + void Free(void* ptr); - static u8 mTaskArea[0x2000 + 0x44]; + static u8 mTaskArea[0x2000 + 0x44]; - private: - TaskManager(); + private: + TaskManager(); - OSMutex mMutex; // 0x00 - MEMHeapHandle mHeapHandle; // 0x18 + OSMutex mMutex; // 0x00 + MEMHeapHandle mHeapHandle; // 0x18 - Task* mCurrentTask; // 0x1C - TaskList mTaskList[PRIORITY_MAX]; // 0x20 + Task* mCurrentTask; // 0x1C + TaskList mTaskList[PRIORITY_MAX]; // 0x20 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_TASK_MANAGER_H +#endif // NW4R_SND_TASK_MANAGER_H diff --git a/libs/NW4R/include/nw4r/snd/TaskThread.h b/libs/NW4R/include/nw4r/snd/TaskThread.h index 45b9cf4c..3e75fae9 100644 --- a/libs/NW4R/include/nw4r/snd/TaskThread.h +++ b/libs/NW4R/include/nw4r/snd/TaskThread.h @@ -11,42 +11,41 @@ namespace nw4r { namespace snd { namespace detail { class TaskThread { - public: - TaskThread() : - mCreateFlag(false) {} + public: + TaskThread() : mCreateFlag(false) {} - bool Create(s32 priority); - void Destroy(); + bool Create(s32 priority); + void Destroy(); - void SendWakeupMessage(); + void SendWakeupMessage(); - void ThreadProc(); + void ThreadProc(); - static void* ThreadFunc(void* arg); + static void* ThreadFunc(void* arg); - static TaskThread& GetInstance(); + static TaskThread& GetInstance(); - enum { - MSG_NONE = 0, - MSG_EXECUTE, - MSG_DONE, - }; + enum { + MSG_NONE = 0, + MSG_EXECUTE, + MSG_DONE, + }; - private: - static const int MSG_QUEUE_CAPACITY = 8; + private: + static const int MSG_QUEUE_CAPACITY = 8; - OSThread mThread; // 0x00 - u64 mThreadStack[THREAD_STACK_SIZE]; // 0x318 - OSThreadQueue mThreadQueue; // 0x2318 + OSThread mThread; // 0x00 + u64 mThreadStack[THREAD_STACK_SIZE]; // 0x318 + OSThreadQueue mThreadQueue; // 0x2318 - OSMessageQueue mMsgQueue; // 0x2320 - OSMessage mMsgBuffer[MSG_QUEUE_CAPACITY]; // 0x2340 + OSMessageQueue mMsgQueue; // 0x2320 + OSMessage mMsgBuffer[MSG_QUEUE_CAPACITY]; // 0x2340 - bool mCreateFlag; // 0x2360 - u8 mPadding[3]; // 0x2361 + bool mCreateFlag; // 0x2360 + u8 mPadding[3]; // 0x2361 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_TASK_THREAD_H +#endif // NW4R_SND_TASK_THREAD_H diff --git a/libs/NW4R/include/nw4r/snd/Util.h b/libs/NW4R/include/nw4r/snd/Util.h index 8402d29c..a6b0b897 100644 --- a/libs/NW4R/include/nw4r/snd/Util.h +++ b/libs/NW4R/include/nw4r/snd/Util.h @@ -9,109 +9,98 @@ namespace nw4r { namespace snd { namespace detail { class Util { - public: - static const int SEMITONE_MAX = 12; - static const int MICROTONE_MAX = 256; + public: + static const int SEMITONE_MAX = 12; + static const int MICROTONE_MAX = 256; - static const int VOLUME_MIN = static_cast(10 * VOLUME_MIN_DB); // -90.4db - static const int VOLUME_MAX = static_cast(10 * VOLUME_MAX_DB); // +6.0db + static const int VOLUME_MIN = static_cast(10 * VOLUME_MIN_DB); // -90.4db + static const int VOLUME_MAX = static_cast(10 * VOLUME_MAX_DB); // +6.0db - public: - typedef enum RefType { - REFTYPE_ADDRESS, - REFTYPE_OFFSET, - } RefType; + public: + typedef enum RefType { + REFTYPE_ADDRESS, + REFTYPE_OFFSET, + } RefType; - typedef enum DataType { - DATATYPE_T0, - DATATYPE_T1, - DATATYPE_T2, - DATATYPE_T3, - DATATYPE_INVALID - } DataType; + typedef enum DataType { DATATYPE_T0, DATATYPE_T1, DATATYPE_T2, DATATYPE_T3, DATATYPE_INVALID } DataType; - template struct DataRef { - u8 refType; // 0x00 - u8 dataType; // 0x01 - u16 reserved; // 0x02 - u32 value; // 0x04 - }; + template + struct DataRef { + u8 refType; // 0x00 + u8 dataType; // 0x01 + u16 reserved; // 0x02 + u32 value; // 0x04 + }; - template - static inline const T0* GetDataRefAddress0(const DataRef& ref, const void* base) { - return static_cast(GetDataRefAddressImpl(static_cast(ref.refType), ref.value, base)); - } + template + static inline const T0* GetDataRefAddress0(const DataRef& ref, const void* base) { + return static_cast(GetDataRefAddressImpl(static_cast(ref.refType), ref.value, base)); + } - template - static inline const T1* GetDataRefAddress1(const DataRef& ref, const void* base) { - return static_cast(GetDataRefAddressImpl(static_cast(ref.refType), ref.value, base)); - } + template + static inline const T1* GetDataRefAddress1(const DataRef& ref, const void* base) { + return static_cast(GetDataRefAddressImpl(static_cast(ref.refType), ref.value, base)); + } - template - static inline const T2* GetDataRefAddress2(const DataRef& ref, const void* base) { - return static_cast(GetDataRefAddressImpl(static_cast(ref.refType), ref.value, base)); - } + template + static inline const T2* GetDataRefAddress2(const DataRef& ref, const void* base) { + return static_cast(GetDataRefAddressImpl(static_cast(ref.refType), ref.value, base)); + } - template - static inline const T3* GetDataRefAddress3(const DataRef& ref, const void* base) { - return static_cast(GetDataRefAddressImpl(static_cast(ref.refType), ref.value, base)); - } + template + static inline const T3* GetDataRefAddress3(const DataRef& ref, const void* base) { + return static_cast(GetDataRefAddressImpl(static_cast(ref.refType), ref.value, base)); + } - template struct Table { - u32 count; // 0x00 - T items[1]; // 0x04 - }; + template + struct Table { + u32 count; // 0x00 + T items[1]; // 0x04 + }; - #ifdef NW4R_LITLE_ENDIAN - static inline u16 ReadBigEndian(u16 x) { - return x >> 8 | x << 8; - } - static inline u32 ReadBigEndian(u32 x) { - return (x >> 24) & 0x000000FF | (x >> 8) & 0x0000FF00 | - (x << 8) & 0x00FF0000 | (x << 24) & 0xFF000000; - } - #else - static inline u16 ReadBigEndian(u16 x) { - return x; - } - static inline u32 ReadBigEndian(u32 x) { - return x; - } - #endif +#ifdef NW4R_LITLE_ENDIAN + static inline u16 ReadBigEndian(u16 x) { return x >> 8 | x << 8; } + static inline u32 ReadBigEndian(u32 x) { + return (x >> 24) & 0x000000FF | (x >> 8) & 0x0000FF00 | (x << 8) & 0x00FF0000 | (x << 24) & 0xFF000000; + } +#else + static inline u16 ReadBigEndian(u16 x) { return x; } + static inline u32 ReadBigEndian(u32 x) { return x; } +#endif - static f32 CalcPitchRatio(int pitch); - static f32 CalcVolumeRatio(f32 db); - static f32 CalcPanRatio(f32 pan); - static f32 CalcSurroundPanRatio(f32 surroundPan); - static int CalcLpfFreq(f32 scale); + static f32 CalcPitchRatio(int pitch); + static f32 CalcVolumeRatio(f32 db); + static f32 CalcPanRatio(f32 pan); + static f32 CalcSurroundPanRatio(f32 surroundPan); + static int CalcLpfFreq(f32 scale); - static u16 CalcRandom(); + static u16 CalcRandom(); - private: - static const void* GetDataRefAddressImpl(RefType type, u32 value, const void* base); + private: + static const void* GetDataRefAddressImpl(RefType type, u32 value, const void* base); - private: - // Chromatic scale (tbl[idx] / tbl[idx-1] == ~1.06) - static const f32 NoteTable[SEMITONE_MAX]; - // Each note contains 256 microtones - static const f32 PitchTable[MICROTONE_MAX]; + private: + // Chromatic scale (tbl[idx] / tbl[idx-1] == ~1.06) + static const f32 NoteTable[SEMITONE_MAX]; + // Each note contains 256 microtones + static const f32 PitchTable[MICROTONE_MAX]; - // Table index is the millibel / hundredth-of-a-decibel - // dB(idx) = VOLUME_MIN_DB + (idx / 10) - // tbl[idx] = 10 ** (dB(idx) / 20) - static const int VOLUME_TABLE_SIZE = VOLUME_RANGE_MB + 1; - static const f32 Decibel2RatioTable[VOLUME_TABLE_SIZE]; + // Table index is the millibel / hundredth-of-a-decibel + // dB(idx) = VOLUME_MIN_DB + (idx / 10) + // tbl[idx] = 10 ** (dB(idx) / 20) + static const int VOLUME_TABLE_SIZE = VOLUME_RANGE_MB + 1; + static const f32 Decibel2RatioTable[VOLUME_TABLE_SIZE]; - // 1/256 step - static const int PAN_TABLE_MIN = 0; - static const int PAN_TABLE_MAX = 256; - static const int PAN_TABLE_CENTER = PAN_TABLE_MAX / 2; - static const int PAN_TABLE_SIZE = PAN_TABLE_MAX + 1; - // tbl[idx] = sqrt(1 - (idx / PAN_TABLE_MAX)) - static const f32 Pan2RatioTable[PAN_TABLE_SIZE]; + // 1/256 step + static const int PAN_TABLE_MIN = 0; + static const int PAN_TABLE_MAX = 256; + static const int PAN_TABLE_CENTER = PAN_TABLE_MAX / 2; + static const int PAN_TABLE_SIZE = PAN_TABLE_MAX + 1; + // tbl[idx] = sqrt(1 - (idx / PAN_TABLE_MAX)) + static const f32 Pan2RatioTable[PAN_TABLE_SIZE]; }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_UTIL_H +#endif // NW4R_SND_UTIL_H diff --git a/libs/NW4R/include/nw4r/snd/WaveFile.h b/libs/NW4R/include/nw4r/snd/WaveFile.h index b5708a1c..79af1172 100644 --- a/libs/NW4R/include/nw4r/snd/WaveFile.h +++ b/libs/NW4R/include/nw4r/snd/WaveFile.h @@ -8,24 +8,20 @@ namespace nw4r { namespace snd { namespace detail { namespace WaveFile { - typedef enum Format { - FORMAT_PCM8 = 0, - FORMAT_PCM16, - FORMAT_ADPCM - } Format; + typedef enum Format { FORMAT_PCM8 = 0, FORMAT_PCM16, FORMAT_ADPCM } Format; typedef struct WaveInfo { - u8 format; // 0x00 - u8 loopFlag; // 0x01 - u8 numChannels; // 0x02 - u8 sampleRate24; // 0x03 - u16 sampleRate; // 0x04 - u16 padding2; // 0x06 - u32 loopStart; // 0x08 - u32 loopEnd; // 0x0C - u32 channelInfoTableOffset; // 0x10 - u32 dataOffset; // 0x14 - u32 reserved; // 0x18 + u8 format; // 0x00 + u8 loopFlag; // 0x01 + u8 numChannels; // 0x02 + u8 sampleRate24; // 0x03 + u16 sampleRate; // 0x04 + u16 padding2; // 0x06 + u32 loopStart; // 0x08 + u32 loopEnd; // 0x0C + u32 channelInfoTableOffset; // 0x10 + u32 dataOffset; // 0x14 + u32 reserved; // 0x18 } WaveInfo; typedef struct WaveChannelInfo { @@ -37,36 +33,36 @@ namespace nw4r { u32 volumeRearRight; // 0x14 u32 reserved; // 0x18 } WaveChannelInfo; - } + } // namespace WaveFile typedef struct ChannelParam { - void* dataAddr; // 0x00 - u32 volumeFrontLeft; // 0x04 - u32 volumeFrontRight; // 0x08 - u32 volumeRearLeft; // 0x0C - u32 volumeRearRight; // 0x10 - AdpcmInfo adpcmInfo; // 0x14 + void* dataAddr; // 0x00 + u32 volumeFrontLeft; // 0x04 + u32 volumeFrontRight; // 0x08 + u32 volumeRearLeft; // 0x0C + u32 volumeRearRight; // 0x10 + AdpcmInfo adpcmInfo; // 0x14 } ChannelParam; typedef struct WaveData { - u8 format; // 0x00 - u8 loopFlag; // 0x01 - u8 numChannels; // 0x02 - int sampleRate; // 0x04 - u32 loopStart; // 0x08 - u32 loopEnd; // 0x0C - ChannelParam channelParam[CHANNEL_MAX]; // 0x10 + u8 format; // 0x00 + u8 loopFlag; // 0x01 + u8 numChannels; // 0x02 + int sampleRate; // 0x04 + u32 loopStart; // 0x08 + u32 loopEnd; // 0x0C + ChannelParam channelParam[CHANNEL_MAX]; // 0x10 } WaveData; class WaveFileReader { - public: - explicit WaveFileReader(const WaveFile::WaveInfo* waveInfo); + public: + explicit WaveFileReader(const WaveFile::WaveInfo* waveInfo); - bool ReadWaveParam(WaveData* waveData, const void* waveAddr) const; - static AxVoice::Format WaveFormatToAxFormat(u32 format); + bool ReadWaveParam(WaveData* waveData, const void* waveAddr) const; + static AxVoice::Format WaveFormatToAxFormat(u32 format); - private: - const WaveFile::WaveInfo* mWaveInfo; // 0x00 + private: + const WaveFile::WaveInfo* mWaveInfo; // 0x00 }; inline AxVoice::Format WaveFormatToAxFormat(u32 format) { @@ -78,8 +74,8 @@ namespace nw4r { } return AxVoice::FORMAT_ADPCM; } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_WAVE_FILE_H +#endif // NW4R_SND_WAVE_FILE_H diff --git a/libs/NW4R/include/nw4r/snd/WavePlayer.h b/libs/NW4R/include/nw4r/snd/WavePlayer.h index f9b680a8..1d9896b9 100644 --- a/libs/NW4R/include/nw4r/snd/WavePlayer.h +++ b/libs/NW4R/include/nw4r/snd/WavePlayer.h @@ -15,117 +15,117 @@ namespace nw4r { class SoundThread; } class WavePlayer { - public: - friend class detail::SoundThread; - typedef struct WaveBufferInfo { - int channelCount; - void* bufferAddress[CHANNEL_MAX]; - u32 bufferSize; - } WaveBufferInfo; + public: + friend class detail::SoundThread; + typedef struct WaveBufferInfo { + int channelCount; + void* bufferAddress[CHANNEL_MAX]; + u32 bufferSize; + } WaveBufferInfo; - class WavePacket { - WavePacket(); - virtual ~WavePacket() {} + class WavePacket { + WavePacket(); + virtual ~WavePacket() {} - private: - WaveBufferInfo mWaveBuffer; // 0x04 - bool mAppendFlag; // 0x14 - - public: - ut::LinkListNode mLinkNode; // 0x18 - - friend class WavePlayer; - }; - typedef ut::LinkList WavePacketList; - - typedef enum WavePacketCallbackStatus { - WAVE_PACKET_CALLBACK_STATUS_FINISH = 0, - WAVE_PACKET_CALLBACK_STATUS_CANCEL, - } WavePacketCallbackStatus; - - typedef void (*WavePacketCallback)(WavePacketCallbackStatus, WavePlayer*, WavePacket*, void*); - - typedef struct SetupParam { - int channelCount; // 0x00 - SampleFormat sampleFormat; // 0x04 - int sampleRate; // 0x08 - f32 pitchMax; // 0x0C - int voices; // 0x10 - } SetupParam; - - WavePlayer(); - virtual ~WavePlayer(); - - void InitParam(); - bool Setup(const SetupParam& setupParam, WavePacketCallback callback, void* callbackArg); - - bool AppendWavePacket(WavePacket* packet); - - void Start(); - void Stop(); - void Pause(bool flag); - - void Shutdown(); - - void StartVoice(); - void StopVoice(); - - bool IsNextWavePacket() const; - void SetNextWavePacket(); - void UpdateWavePacket(); - private: - void detail_Update(); - void detail_UpdateBuffer(); - - static void detail_UpdateAllPlayers(); - static void detail_UpdateBufferAllPlayers(); - static void detail_StopAllPlayers(); - - static void VoiceCallbackFunc(detail::AxVoice* voice, detail::AxVoice::CallbackStatus status, void* arg); - - WavePacketList mWavePacketList; // 0x04 - - int mChannelCount; // 0x10 - - f32 mPitchMax; // 0x14 - - detail::AxVoice* mVoice; // 0x18 - - bool mStartFlag; // 0x1C - bool mVoiceStartFlag; // 0x1D - bool mLoopSetFlag; // 0x1E - bool mPauseFlag; // 0x1F - - SampleFormat mSampleFormat; // 0x20 - int mSampleRate; // 0x24 - - s64 mPlaySampleCount; // 0x28 - f32 mVolume; // 0x30 - f32 mPan; // 0x34 - f32 mSurroundPan; // 0x38 - f32 mPitch; // 0x3C - f32 mLpfFreq; // 0x40 - - int mOutputLineFlag; // 0x44 - - f32 mMainOutVolume; // 0x48 - f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // 0x4C - - f32 mMainSend; // 0x5C - f32 mFxSend[AUX_BUS_NUM]; // 0x60 - - f32 mRemoteSend[WPAD_MAX_CONTROLLERS]; // 0x6C - f32 mRemoteFxSend[WPAD_MAX_CONTROLLERS]; // 0x7C - - WavePacketCallback mCallback; // 0x8C - void* mCallbackArg; // 0x90 + WaveBufferInfo mWaveBuffer; // 0x04 + bool mAppendFlag; // 0x14 public: - ut::LinkListNode mPlayerLink; // 0x94 + ut::LinkListNode mLinkNode; // 0x18 + + friend class WavePlayer; + }; + typedef ut::LinkList WavePacketList; + + typedef enum WavePacketCallbackStatus { + WAVE_PACKET_CALLBACK_STATUS_FINISH = 0, + WAVE_PACKET_CALLBACK_STATUS_CANCEL, + } WavePacketCallbackStatus; + + typedef void (*WavePacketCallback)(WavePacketCallbackStatus, WavePlayer*, WavePacket*, void*); + + typedef struct SetupParam { + int channelCount; // 0x00 + SampleFormat sampleFormat; // 0x04 + int sampleRate; // 0x08 + f32 pitchMax; // 0x0C + int voices; // 0x10 + } SetupParam; + + WavePlayer(); + virtual ~WavePlayer(); + + void InitParam(); + bool Setup(const SetupParam& setupParam, WavePacketCallback callback, void* callbackArg); + + bool AppendWavePacket(WavePacket* packet); + + void Start(); + void Stop(); + void Pause(bool flag); + + void Shutdown(); + + void StartVoice(); + void StopVoice(); + + bool IsNextWavePacket() const; + void SetNextWavePacket(); + void UpdateWavePacket(); + + private: + void detail_Update(); + void detail_UpdateBuffer(); + + static void detail_UpdateAllPlayers(); + static void detail_UpdateBufferAllPlayers(); + static void detail_StopAllPlayers(); + + static void VoiceCallbackFunc(detail::AxVoice* voice, detail::AxVoice::CallbackStatus status, void* arg); + + WavePacketList mWavePacketList; // 0x04 + + int mChannelCount; // 0x10 + + f32 mPitchMax; // 0x14 + + detail::AxVoice* mVoice; // 0x18 + + bool mStartFlag; // 0x1C + bool mVoiceStartFlag; // 0x1D + bool mLoopSetFlag; // 0x1E + bool mPauseFlag; // 0x1F + + SampleFormat mSampleFormat; // 0x20 + int mSampleRate; // 0x24 + + s64 mPlaySampleCount; // 0x28 + f32 mVolume; // 0x30 + f32 mPan; // 0x34 + f32 mSurroundPan; // 0x38 + f32 mPitch; // 0x3C + f32 mLpfFreq; // 0x40 + + int mOutputLineFlag; // 0x44 + + f32 mMainOutVolume; // 0x48 + f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // 0x4C + + f32 mMainSend; // 0x5C + f32 mFxSend[AUX_BUS_NUM]; // 0x60 + + f32 mRemoteSend[WPAD_MAX_CONTROLLERS]; // 0x6C + f32 mRemoteFxSend[WPAD_MAX_CONTROLLERS]; // 0x7C + + WavePacketCallback mCallback; // 0x8C + void* mCallbackArg; // 0x90 + + public: + ut::LinkListNode mPlayerLink; // 0x94 }; typedef ut::LinkList WavePlayerList; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_WAVE_PLAYER_H +#endif // NW4R_SND_WAVE_PLAYER_H diff --git a/libs/NW4R/include/nw4r/snd/WaveSound.h b/libs/NW4R/include/nw4r/snd/WaveSound.h index 7c445b83..ae628495 100644 --- a/libs/NW4R/include/nw4r/snd/WaveSound.h +++ b/libs/NW4R/include/nw4r/snd/WaveSound.h @@ -12,37 +12,38 @@ namespace nw4r { namespace snd { class WaveSoundHandle; namespace detail { - template class SoundInstanceManager; + template + class SoundInstanceManager; class WaveSound : public BasicSound { friend class WaveSoundHandle; - public: - NW4R_UT_RUNTIME_TYPEINFO; + public: + NW4R_UT_RUNTIME_TYPEINFO; - explicit WaveSound(SoundInstanceManager* manager); + explicit WaveSound(SoundInstanceManager* manager); - virtual void Shutdown(); // 0x28 + virtual void Shutdown(); // 0x28 - virtual void SetPlayerPriority(int priority); // 0x4C - virtual bool IsAttachedTempSpecialHandle(); // 0x5C - virtual void DetachTempSpecialHandle(); // 0x60 + virtual void SetPlayerPriority(int priority); // 0x4C + virtual bool IsAttachedTempSpecialHandle(); // 0x5C + virtual void DetachTempSpecialHandle(); // 0x60 - virtual BasicPlayer& GetBasicPlayer() { return mWsdPlayer; } // 0x68 - virtual const BasicPlayer& GetBasicPlayer() const { return mWsdPlayer; } // 0x6C + virtual BasicPlayer& GetBasicPlayer() { return mWsdPlayer; } // 0x68 + virtual const BasicPlayer& GetBasicPlayer() const { return mWsdPlayer; } // 0x6C - bool Prepare(const void* waveSoundBase, s32 waveSoundOffset, int voices, const WsdTrack::WsdCallback* callback, u32 callbackData); + bool Prepare(const void* waveSoundBase, s32 waveSoundOffset, int voices, const WsdTrack::WsdCallback* callback, u32 callbackData); - void SetChannelPriority(int priority); - void SetReleasePriorityFix(bool flag); + void SetChannelPriority(int priority); + void SetReleasePriorityFix(bool flag); - private: - WsdPlayer mWsdPlayer; // 0xD8 - WaveSoundHandle* mTempSpecialHandle; // 0x1B0 - SoundInstanceManager* mManager; // 0x1B4 + private: + WsdPlayer mWsdPlayer; // 0xD8 + WaveSoundHandle* mTempSpecialHandle; // 0x1B0 + SoundInstanceManager* mManager; // 0x1B4 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_WAVE_SOUND_H +#endif // NW4R_SND_WAVE_SOUND_H diff --git a/libs/NW4R/include/nw4r/snd/WaveSoundHandle.h b/libs/NW4R/include/nw4r/snd/WaveSoundHandle.h index eb521f82..4040ab7e 100644 --- a/libs/NW4R/include/nw4r/snd/WaveSoundHandle.h +++ b/libs/NW4R/include/nw4r/snd/WaveSoundHandle.h @@ -10,22 +10,18 @@ namespace nw4r { namespace snd { class WaveSoundHandle : private ut::NonCopyable { - public: - ~WaveSoundHandle() { - DetachSound(); - } + public: + ~WaveSoundHandle() { DetachSound(); } - void DetachSound(); + void DetachSound(); - bool IsAttachedSound() const { - return mSound != NULL; - } + bool IsAttachedSound() const { return mSound != NULL; } - private: - detail::WaveSound* mSound; // 0x00 + private: + detail::WaveSound* mSound; // 0x00 }; - } -} + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_WAVE_SOUND_HANDLE_H +#endif // NW4R_SND_WAVE_SOUND_HANDLE_H diff --git a/libs/NW4R/include/nw4r/snd/WsdFile.h b/libs/NW4R/include/nw4r/snd/WsdFile.h index b31d5be2..a5e548c8 100644 --- a/libs/NW4R/include/nw4r/snd/WsdFile.h +++ b/libs/NW4R/include/nw4r/snd/WsdFile.h @@ -15,17 +15,17 @@ namespace nw4r { namespace detail { namespace WsdFile { typedef struct WsdInfo { - f32 pitch; // 0x00 - u8 pan; // 0x04 - u8 surroundPan; // 0x05 - u8 fxSendA; // 0x06 - u8 fxSendB; // 0x07 - u8 fxSendC; // 0x08 - u8 mainSend; // 0x09 - u8 padding[2]; // 0x0A - Util::DataRef graphEnvTablevRef; // 0x0C - Util::DataRef randomizerTableRef; // 0x14 - u32 reserved; // 0x1C + f32 pitch; // 0x00 + u8 pan; // 0x04 + u8 surroundPan; // 0x05 + u8 fxSendA; // 0x06 + u8 fxSendB; // 0x07 + u8 fxSendC; // 0x08 + u8 mainSend; // 0x09 + u8 padding[2]; // 0x0A + Util::DataRef graphEnvTablevRef; // 0x0C + Util::DataRef randomizerTableRef; // 0x14 + u32 reserved; // 0x1C } WsdInfo; typedef struct TrackInfo { @@ -33,103 +33,105 @@ namespace nw4r { } TrackInfo; typedef struct NoteInfo { - s32 waveIndex; // 0x00 - u8 attack; // 0x04 - u8 decay; // 0x05 - u8 sustain; // 0x06 - u8 release; // 0x07 - u16 hold; // 0x08 - u16 padding; // 0x0A - u8 originalKey; // 0x0C - u8 volume; // 0x0D - u8 pan; // 0x0E - u8 surroundPan; // 0x0F - f32 pitch; // 0x10 - Util::DataRef lfoTableRef; // 0x14 - Util::DataRef graphEnvTablevRef; // 0x1C - Util::DataRef randomizerTableRef; // 0x24 - u32 reserved; // 0x2C + s32 waveIndex; // 0x00 + u8 attack; // 0x04 + u8 decay; // 0x05 + u8 sustain; // 0x06 + u8 release; // 0x07 + u16 hold; // 0x08 + u16 padding; // 0x0A + u8 originalKey; // 0x0C + u8 volume; // 0x0D + u8 pan; // 0x0E + u8 surroundPan; // 0x0F + f32 pitch; // 0x10 + Util::DataRef lfoTableRef; // 0x14 + Util::DataRef graphEnvTablevRef; // 0x1C + Util::DataRef randomizerTableRef; // 0x24 + u32 reserved; // 0x2C } NoteInfo; + // clang-format off typedef Util::Table > TrackTable; typedef Util::Table > NoteTable; + // clang-format on typedef struct Wsd { - Util::DataRef refWsdInfo; // 0x00 - Util::DataRef refTrackTable; // 0x08 - Util::DataRef refNoteTable; // 0x10 + Util::DataRef refWsdInfo; // 0x00 + Util::DataRef refTrackTable; // 0x08 + Util::DataRef refNoteTable; // 0x10 } Wsd; typedef struct Header { - ut::BinaryFileHeader fileHeader; // 0x00 - u32 dataBlockOffset; // 0x10 - u32 dataBlockSize; // 0x14 - u32 waveBlockOffset; // 0x18 - u32 waveBlockSize; // 0x1C + ut::BinaryFileHeader fileHeader; // 0x00 + u32 dataBlockOffset; // 0x10 + u32 dataBlockSize; // 0x14 + u32 waveBlockOffset; // 0x18 + u32 waveBlockSize; // 0x1C } Header; typedef struct DataBlock { - ut::BinaryBlockHeader blockHeader; // 0x00 - u32 wsdCount; // 0x08 - Util::DataRef refWsd[]; // 0x0C + ut::BinaryBlockHeader blockHeader; // 0x00 + u32 wsdCount; // 0x08 + Util::DataRef refWsd[]; // 0x0C } DataBlock; typedef struct WaveBlock { - ut::BinaryBlockHeader blockHeader; // 0x00 - u32 waveCount; // 0x08 - u32 offsetTable[]; // 0x0C + ut::BinaryBlockHeader blockHeader; // 0x00 + u32 waveCount; // 0x08 + u32 offsetTable[]; // 0x0C } WaveBlock; // <= NW4R_VERSION(1, 0) typedef struct WaveBlockOld { - ut::BinaryBlockHeader blockHeader; // 0x00 - u32 offsetTable[]; // 0x08 + ut::BinaryBlockHeader blockHeader; // 0x00 + u32 offsetTable[]; // 0x08 } WaveBlockOld; - } + } // namespace WsdFile typedef struct WaveSoundInfo { - f32 pitch; // 0x00 - u8 pan; // 0x04 - u8 surroundPan; // 0x05 - u8 fxSendA; // 0x06 - u8 fxSendB; // 0x07 - u8 fxSendC; // 0x08 - u8 mainSend; // 0x09 + f32 pitch; // 0x00 + u8 pan; // 0x04 + u8 surroundPan; // 0x05 + u8 fxSendA; // 0x06 + u8 fxSendB; // 0x07 + u8 fxSendC; // 0x08 + u8 mainSend; // 0x09 } WaveSoundInfo; typedef struct WaveSoundNoteInfo { - s32 waveIndex; // 0x00 - u8 attack; // 0x04 - u8 decay; // 0x06 - u8 sustain; // 0x07 - u8 release; // 0x08 - u8 originalKey; // 0x09 - u8 pan; // 0x0A - u8 surroundPan; // 0x0B - u8 volume; // 0x0C - f32 pitch; // 0x10 + s32 waveIndex; // 0x00 + u8 attack; // 0x04 + u8 decay; // 0x06 + u8 sustain; // 0x07 + u8 release; // 0x08 + u8 originalKey; // 0x09 + u8 pan; // 0x0A + u8 surroundPan; // 0x0B + u8 volume; // 0x0C + f32 pitch; // 0x10 } WaveSoundNoteInfo; class WsdFileReader { - public: - static const u32 SIGNATURE = 'RWSD'; - static const int VERSION = NW4R_VERSION(1, 2); + public: + static const u32 SIGNATURE = 'RWSD'; + static const int VERSION = NW4R_VERSION(1, 2); - explicit WsdFileReader(const void* waveData); + explicit WsdFileReader(const void* waveData); - bool IsValidFileHeader(const void* waveData); + bool IsValidFileHeader(const void* waveData); - bool ReadWaveSoundInfo(WaveSoundInfo* soundInfo, int id) const; - bool ReadWaveSoundNoteInfo(WaveSoundNoteInfo* soundNoteInfo, int id, int note) const; - bool ReadWaveParam(int id, WaveData* waveData, const void* waveAddr) const; + bool ReadWaveSoundInfo(WaveSoundInfo* soundInfo, int id) const; + bool ReadWaveSoundNoteInfo(WaveSoundNoteInfo* soundNoteInfo, int id, int note) const; + bool ReadWaveParam(int id, WaveData* waveData, const void* waveAddr) const; - private: - const WsdFile::Header* mHeader; // 0x00 - const WsdFile::DataBlock* mDataBlock; // 0x04 - const WsdFile::WaveBlock* mWaveBlock; // 0x08 + private: + const WsdFile::Header* mHeader; // 0x00 + const WsdFile::DataBlock* mDataBlock; // 0x04 + const WsdFile::WaveBlock* mWaveBlock; // 0x08 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_WSD_FILE_H +#endif // NW4R_SND_WSD_FILE_H diff --git a/libs/NW4R/include/nw4r/snd/WsdPlayer.h b/libs/NW4R/include/nw4r/snd/WsdPlayer.h index 01c7563f..8b64bbf6 100644 --- a/libs/NW4R/include/nw4r/snd/WsdPlayer.h +++ b/libs/NW4R/include/nw4r/snd/WsdPlayer.h @@ -1,8 +1,8 @@ #ifndef NW4R_SND_WSD_PLAYER_H #define NW4R_SND_WSD_PLAYER_H -#include #include +#include #include @@ -10,113 +10,113 @@ namespace nw4r { namespace snd { namespace detail { class WsdPlayer : public BasicPlayer, public DisposeCallback { - public: - WsdPlayer(); + public: + WsdPlayer(); - void InitParam(int voices, const WsdTrack::WsdCallback* callback, u32 callbackData); + void InitParam(int voices, const WsdTrack::WsdCallback* callback, u32 callbackData); - bool Prepare(const void* waveSoundBase, int index, int voices, const WsdTrack::WsdCallback* callback,u32 callbackData); + bool Prepare(const void* waveSoundBase, int index, int voices, const WsdTrack::WsdCallback* callback, u32 callbackData); - virtual bool Start(); // 0x0C - virtual void Stop(); // 0x10 - virtual void Pause(bool flag); // 0x14 - virtual bool IsActive() const { return mActiveFlag; } // 0x18 - virtual bool IsStarted() const { return mStartedFlag; }; // 0x20 - virtual bool IsPrepared() const { return mPreparedFlag; }; // 0x1C - virtual bool IsPause() const { return mPauseFlag; }; // 0x24 - virtual void SetVolume(f32 volume); // 0x28 - virtual void SetPitch(f32 pitch); // 0x2C - virtual void SetPan(f32 pan); // 0x30 - virtual void SetSurroundPan(f32 surroundPan); // 0x34 - virtual void SetPan2(f32 pan2); // 0x38 - virtual void SetSurroundPan2(f32 surroundPan2); // 0x3C - virtual void SetLpfFreq(f32 lpfFreq); // 0x40 - virtual f32 GetVolume() const { return mExtVolume; }; // 0x44 - virtual f32 GetPitch() const { return mExtPitch; }; // 0x48 - virtual f32 GetPan() const { return mExtPan; }; // 0x4C - virtual f32 GetSurroundPan() const { return mExtSurroundPan; }; // 0x50 - virtual f32 GetPan2() const { return mExtPan2; }; // 0x54 - virtual f32 GetSurroundPan2() const { return mExtSurroundPan2; }; // 0x58 - virtual f32 GetLpfFreq() const { return mExtLpfFreq; }; // 0x5C - virtual void SetOutputLine(int lineFlag); // 0x60 - virtual void SetMainOutVolume(f32 volume); // 0x64 - virtual void SetMainSend(f32 send); // 0x68 - virtual void SetFxSend(AuxBus bus, f32 send); // 0x6C - virtual void SetRemoteOutVolume(int remoteIndex, f32 volume); // 0x70 - virtual void SetRemoteSend(int remoteIndex, f32 send); // 0x74 - virtual void SetRemoteFxSend(int remoteIndex, f32 send); // 0x78 - virtual int GetOutputLine() const; // 0x7C - virtual f32 GetMainOutVolume() const; // 0x80 - virtual f32 GetMainSend() const; // 0x84 - virtual f32 GetFxSend(AuxBus bus) const; // 0x88 - virtual f32 GetRemoteOutVolume(int remoteIndex) const; // 0x8C - virtual f32 GetRemoteSend(int remoteIndex) const; // 0x90 - virtual f32 GetRemoteFxSend(int remoteIndex) const; // 0x94 + virtual bool Start(); // 0x0C + virtual void Stop(); // 0x10 + virtual void Pause(bool flag); // 0x14 + virtual bool IsActive() const { return mActiveFlag; } // 0x18 + virtual bool IsStarted() const { return mStartedFlag; }; // 0x20 + virtual bool IsPrepared() const { return mPreparedFlag; }; // 0x1C + virtual bool IsPause() const { return mPauseFlag; }; // 0x24 + virtual void SetVolume(f32 volume); // 0x28 + virtual void SetPitch(f32 pitch); // 0x2C + virtual void SetPan(f32 pan); // 0x30 + virtual void SetSurroundPan(f32 surroundPan); // 0x34 + virtual void SetPan2(f32 pan2); // 0x38 + virtual void SetSurroundPan2(f32 surroundPan2); // 0x3C + virtual void SetLpfFreq(f32 lpfFreq); // 0x40 + virtual f32 GetVolume() const { return mExtVolume; }; // 0x44 + virtual f32 GetPitch() const { return mExtPitch; }; // 0x48 + virtual f32 GetPan() const { return mExtPan; }; // 0x4C + virtual f32 GetSurroundPan() const { return mExtSurroundPan; }; // 0x50 + virtual f32 GetPan2() const { return mExtPan2; }; // 0x54 + virtual f32 GetSurroundPan2() const { return mExtSurroundPan2; }; // 0x58 + virtual f32 GetLpfFreq() const { return mExtLpfFreq; }; // 0x5C + virtual void SetOutputLine(int lineFlag); // 0x60 + virtual void SetMainOutVolume(f32 volume); // 0x64 + virtual void SetMainSend(f32 send); // 0x68 + virtual void SetFxSend(AuxBus bus, f32 send); // 0x6C + virtual void SetRemoteOutVolume(int remoteIndex, f32 volume); // 0x70 + virtual void SetRemoteSend(int remoteIndex, f32 send); // 0x74 + virtual void SetRemoteFxSend(int remoteIndex, f32 send); // 0x78 + virtual int GetOutputLine() const; // 0x7C + virtual f32 GetMainOutVolume() const; // 0x80 + virtual f32 GetMainSend() const; // 0x84 + virtual f32 GetFxSend(AuxBus bus) const; // 0x88 + virtual f32 GetRemoteOutVolume(int remoteIndex) const; // 0x8C + virtual f32 GetRemoteSend(int remoteIndex) const; // 0x90 + virtual f32 GetRemoteFxSend(int remoteIndex) const; // 0x94 - void SetChannelPriority(int prio); - u8 GetChannelPriority() { return mPriority; } + void SetChannelPriority(int prio); + u8 GetChannelPriority() { return mPriority; } - f32 GetPanRange() { return mPanRange; } + f32 GetPanRange() { return mPanRange; } - int GetVoiceOutCount() { return mVoiceOutCount; } + int GetVoiceOutCount() { return mVoiceOutCount; } - void FinishPlayer(); + void FinishPlayer(); - BOOL ParseNextTick(bool doNoteOn); + BOOL ParseNextTick(bool doNoteOn); - void UpdateChannel(); - void Update(); + void UpdateChannel(); + void Update(); - static void UpdateAllPlayers(); - static void StopAllPlayers(); + static void UpdateAllPlayers(); + static void StopAllPlayers(); - virtual void InvalidateData(const void* start, const void* end); - virtual void InvalidateWaveData(const void* start, const void* end) {} + virtual void InvalidateData(const void* start, const void* end); + virtual void InvalidateWaveData(const void* start, const void* end) {} - ut::LinkListNode mPlayerLink; // 0x14 - private: - bool mHomeButtonMenuFlag; // 0x1C - u8 mActiveFlag; // 0x1D - u8 mPreparedFlag; // 0x1E - u8 mStartedFlag; // 0x1F - u8 mPauseFlag; // 0x20 - u8 mSkipFlag; // 0x21 + ut::LinkListNode mPlayerLink; // 0x14 + private: + bool mHomeButtonMenuFlag; // 0x1C + u8 mActiveFlag; // 0x1D + u8 mPreparedFlag; // 0x1E + u8 mStartedFlag; // 0x1F + u8 mPauseFlag; // 0x20 + u8 mSkipFlag; // 0x21 - f32 mExtVolume; // 0x24 - f32 mExtPan; // 0x28 - f32 mExtSurroundPan; // 0x2C - f32 mPanRange; // 0x30 - f32 mExtPan2; // 0x34 - f32 mExtSurroundPan2; // 0x38 - f32 mExtPitch; // 0x3C - f32 mExtLpfFreq; // 0x40 + f32 mExtVolume; // 0x24 + f32 mExtPan; // 0x28 + f32 mExtSurroundPan; // 0x2C + f32 mPanRange; // 0x30 + f32 mExtPan2; // 0x34 + f32 mExtSurroundPan2; // 0x38 + f32 mExtPitch; // 0x3C + f32 mExtLpfFreq; // 0x40 - int mOutputLineFlag; // 0x44 + int mOutputLineFlag; // 0x44 - f32 mMainOutVolume; // 0x48 + f32 mMainOutVolume; // 0x48 - f32 mMainSend; // 0x4C - f32 mFxSend[AUX_BUS_NUM]; // 0x50 + f32 mMainSend; // 0x4C + f32 mFxSend[AUX_BUS_NUM]; // 0x50 - f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // 0x5C - f32 mRemoteSend[WPAD_MAX_CONTROLLERS]; // 0x6C - f32 mRemoteFxSend[WPAD_MAX_CONTROLLERS]; // 0x7C + f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]; // 0x5C + f32 mRemoteSend[WPAD_MAX_CONTROLLERS]; // 0x6C + f32 mRemoteFxSend[WPAD_MAX_CONTROLLERS]; // 0x7C - int mVoiceOutCount; // 0x8C + int mVoiceOutCount; // 0x8C - u8 mPriority; // 0x90 + u8 mPriority; // 0x90 - const WsdTrack::WsdCallback* mCallback; // 0x94 - u32 mCallbackData; // 0x98 + const WsdTrack::WsdCallback* mCallback; // 0x94 + u32 mCallbackData; // 0x98 - WsdTrack mTrack; // 0x9C + WsdTrack mTrack; // 0x9C - u32 mTickCounter; // 0xD0 + u32 mTickCounter; // 0xD0 }; typedef ut::LinkList WsdPlayerList; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_WSD_PLAYER_H +#endif // NW4R_SND_WSD_PLAYER_H diff --git a/libs/NW4R/include/nw4r/snd/WsdTrack.h b/libs/NW4R/include/nw4r/snd/WsdTrack.h index e2fe7803..c342bb1a 100644 --- a/libs/NW4R/include/nw4r/snd/WsdTrack.h +++ b/libs/NW4R/include/nw4r/snd/WsdTrack.h @@ -3,65 +3,63 @@ #include +#include #include #include -#include + namespace nw4r { namespace snd { namespace detail { class WsdPlayer; class WsdTrack { + public: + class WsdCallback { public: - class WsdCallback { - public: - virtual ~WsdCallback() {} // 0x08 + virtual ~WsdCallback() {} // 0x08 - virtual bool GetWaveSoundData(WaveSoundInfo* info, WaveSoundNoteInfo* noteInfo, WaveData* waveData, const void* waveSoundData, int index, int noteIndex, u32 userData) const; - }; + virtual bool GetWaveSoundData(WaveSoundInfo* info, WaveSoundNoteInfo* noteInfo, WaveData* waveData, const void* waveSoundData, + int index, int noteIndex, u32 userData) const; + }; - typedef enum StartOffsetType { - START_OFFSET_TYPE_SAMPLE = 0, - START_OFFSET_TYPE_MILLISEC - } StartOffsetType; + typedef enum StartOffsetType { START_OFFSET_TYPE_SAMPLE = 0, START_OFFSET_TYPE_MILLISEC } StartOffsetType; - WsdTrack() : - mWsdPlayer(NULL) {} + WsdTrack() : mWsdPlayer(NULL) {} - void Init(WsdPlayer* player); + void Init(WsdPlayer* player); - void Start(const void* wsdData, int index); - void Close(); + void Start(const void* wsdData, int index); + void Close(); - void UpdateChannel(); - void ReleaseAllChannel(int release) NO_INLINE; - void PauseAllChannel(bool flag); - void FreeAllChannel(); - void AddChannel(Channel* channel); + void UpdateChannel(); + void ReleaseAllChannel(int release) NO_INLINE; + void PauseAllChannel(bool flag); + void FreeAllChannel(); + void AddChannel(Channel* channel); - int Parse(const WsdCallback* callback, u32 callbackData, bool doNoteOn); - int ParseNextTick(const WsdCallback* callback, u32 callbackData, bool doNoteOn); + int Parse(const WsdCallback* callback, u32 callbackData, bool doNoteOn); + int ParseNextTick(const WsdCallback* callback, u32 callbackData, bool doNoteOn); - static void ChannelCallbackFunc(Channel* dropChannel, Channel::ChannelCallbackStatus status, u32 userData); + static void ChannelCallbackFunc(Channel* dropChannel, Channel::ChannelCallbackStatus status, u32 userData); - const void* GetWsdDataAddress() const { return mWsdData; } + const void* GetWsdDataAddress() const { return mWsdData; } - private: - const void* mWsdData; // 0x00 - int mIndex; // 0x04 + private: + const void* mWsdData; // 0x00 + int mIndex; // 0x04 - u32 mCounter; // 0x08 - LfoParam mLfoParam; // 0x0C - u8 mBendRange; // 0x1C - u8 mPriority; // 0x1D + u32 mCounter; // 0x08 + LfoParam mLfoParam; // 0x0C + u8 mBendRange; // 0x1C + u8 mPriority; // 0x1D - WaveSoundInfo mWaveSoundInfo; // 0x20 - WsdPlayer* mWsdPlayer; // 0x2C + WaveSoundInfo mWaveSoundInfo; // 0x20 + WsdPlayer* mWsdPlayer; // 0x2C - Channel* mChannelList; // 0x30 + Channel* mChannelList; // 0x30 }; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_WSD_TRACK_H +#endif // NW4R_SND_WSD_TRACK_H diff --git a/libs/NW4R/include/nw4r/snd/types.h b/libs/NW4R/include/nw4r/snd/types.h index e60d06ac..034dae36 100644 --- a/libs/NW4R/include/nw4r/snd/types.h +++ b/libs/NW4R/include/nw4r/snd/types.h @@ -8,41 +8,38 @@ namespace nw4r { namespace snd { class LinkedInstance { - public: - ut::LinkListNode mInstanceLink; // 0x00 + public: + ut::LinkListNode mInstanceLink; // 0x00 }; - template class InstanceManager { - public: - typedef typename ut::LinkList::Iterator Iterator; - void Append(T* obj) { + template + class InstanceManager { + public: + typedef typename ut::LinkList::Iterator Iterator; + void Append(T* obj) { mFreeList.PushBack(obj); } + void Remove(T* obj) { mFreeList.Erase(obj); } + T* Alloc() { + if (mFreeList.IsEmpty()) { + return NULL; + } else { + T& obj = mFreeList.GetFront(); + mFreeList.PopFront(); + mActiveList.PushBack(&obj); + return &obj; + } + } + void Free(T* obj) { + if (!mActiveList.IsEmpty()) { + mActiveList.Erase(obj); mFreeList.PushBack(obj); } - void Remove(T* obj) { - mFreeList.Erase(obj); - } - T* Alloc() { - if (mFreeList.IsEmpty()) { - return NULL; - } - else { - T& obj = mFreeList.GetFront(); - mFreeList.PopFront(); - mActiveList.PushBack(&obj); - return &obj; - } - } - void Free(T* obj) { - if (!mActiveList.IsEmpty()) { - mActiveList.Erase(obj); - mFreeList.PushBack(obj); - } - } + } - Iterator GetBeginIter() { return mActiveList.GetBeginIter(); } - Iterator GetEndIter() { return mActiveList.GetEndIter(); } - private: - ut::LinkList mFreeList; // 0x00 - ut::LinkList mActiveList; // 0x0C + Iterator GetBeginIter() { return mActiveList.GetBeginIter(); } + Iterator GetEndIter() { return mActiveList.GetEndIter(); } + + private: + ut::LinkList mFreeList; // 0x00 + ut::LinkList mActiveList; // 0x0C }; static const int THREAD_STACK_SIZE = 1024; @@ -66,64 +63,49 @@ namespace nw4r { OUTPUT_LINE_REMOTE_N = (1 << 1), } OutputLineFlag; - typedef enum OutputMode { - OUTPUT_MODE_STEREO = 0, - OUTPUT_MODE_SURROUND, - OUTPUT_MODE_DPL2, - OUTPUT_MODE_MONO - } OutputMode; + typedef enum OutputMode { OUTPUT_MODE_STEREO = 0, OUTPUT_MODE_SURROUND, OUTPUT_MODE_DPL2, OUTPUT_MODE_MONO } OutputMode; - typedef enum AuxBus { - AUX_A = 0, - AUX_B, - AUX_C, - AUX_BUS_NUM - } AuxBus; + typedef enum AuxBus { AUX_A = 0, AUX_B, AUX_C, AUX_BUS_NUM } AuxBus; - typedef enum SampleFormat { - SAMPLE_FORMAT_PCM_S32 = 0, - SAMPLE_FORMAT_PCM_S16, - SAMPLE_FORMAT_PCM_S8, - SAMPLE_FORMAT_DSP_ADPCM - } SampleFormat; + typedef enum SampleFormat { SAMPLE_FORMAT_PCM_S32 = 0, SAMPLE_FORMAT_PCM_S16, SAMPLE_FORMAT_PCM_S8, SAMPLE_FORMAT_DSP_ADPCM } SampleFormat; typedef struct SoundParam { - f32 volume; // 0x00 - f32 pitch; // 0x04 - f32 pan; // 0x08 - f32 surroundPan; // 0x0C - f32 fxSend; // 0x10 - f32 lpf; // 0x14 - s32 priority; // 0x18 + f32 volume; // 0x00 + f32 pitch; // 0x04 + f32 pan; // 0x08 + f32 surroundPan; // 0x0C + f32 fxSend; // 0x10 + f32 lpf; // 0x14 + s32 priority; // 0x18 } SoundParam; namespace detail { typedef struct AdpcmParam { - u16 coef[16]; // 0x00 - u16 gain; // 0x20 - u16 pred_scale; // 0x22 - u16 yn1; // 0x24 - u16 yn2; // 0x26 + u16 coef[16]; // 0x00 + u16 gain; // 0x20 + u16 pred_scale; // 0x22 + u16 yn1; // 0x24 + u16 yn2; // 0x26 } AdpcmParam; typedef struct AdpcmLoopParam { - u16 loop_pred_scale; // 0x00 - u16 loop_yn1; // 0x02 - u16 loop_yn2; // 0x04 + u16 loop_pred_scale; // 0x00 + u16 loop_yn1; // 0x02 + u16 loop_yn2; // 0x04 } AdpcmLoopParam; typedef struct AdpcmInfo { - AdpcmParam adpcm; // 0x08 - AdpcmLoopParam adpcmloop; // 0x28 - u16 padding; // 0x2E + AdpcmParam adpcm; // 0x08 + AdpcmLoopParam adpcmloop; // 0x28 + u16 padding; // 0x2E } AdpcmInfo; typedef struct VoiceChannelParam { - void* waveData; // 0x00 - AdpcmInfo adpcmInfo; // 0x04 + void* waveData; // 0x00 + AdpcmInfo adpcmInfo; // 0x04 } VoiceChannelParam; - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r -#endif // NW4R_SND_TYPES_H +#endif // NW4R_SND_TYPES_H diff --git a/libs/NW4R/include/nw4r/ut.h b/libs/NW4R/include/nw4r/ut.h index 7d03d144..0562e72d 100644 --- a/libs/NW4R/include/nw4r/ut.h +++ b/libs/NW4R/include/nw4r/ut.h @@ -24,8 +24,8 @@ #include #include -#include #include +#include #include -#endif // NW4R_UT_H +#endif // NW4R_UT_H diff --git a/libs/NW4R/include/nw4r/ut/ArchiveFont.h b/libs/NW4R/include/nw4r/ut/ArchiveFont.h index 51cf9f00..a9d4ac43 100644 --- a/libs/NW4R/include/nw4r/ut/ArchiveFont.h +++ b/libs/NW4R/include/nw4r/ut/ArchiveFont.h @@ -7,22 +7,22 @@ namespace nw4r { namespace ut { namespace detail { class ArchiveFontBase { - protected: - u8 dummy[0x1c]; + protected: + u8 dummy[0x1c]; - static const char LOAD_GLYPH_ALL[1]; + static const char LOAD_GLYPH_ALL[1]; }; - }; + }; // namespace detail class ArchiveFont : public detail::ArchiveFontBase { - public: - ArchiveFont(); + public: + ArchiveFont(); - static u32 GetRequireBufferSize(const void* param_1, const char* param_2 = LOAD_GLYPH_ALL); + static u32 GetRequireBufferSize(const void* param_1, const char* param_2 = LOAD_GLYPH_ALL); - bool Construct(void* param_1, u32 param_2, const void* param_3, const char* param_4 = LOAD_GLYPH_ALL); + bool Construct(void* param_1, u32 param_2, const void* param_3, const char* param_4 = LOAD_GLYPH_ALL); }; - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_ARCHIVE_FONT_H +#endif // NW4R_UT_ARCHIVE_FONT_H diff --git a/libs/NW4R/include/nw4r/ut/CharStrmReader.h b/libs/NW4R/include/nw4r/ut/CharStrmReader.h index 936acf71..f1758a46 100644 --- a/libs/NW4R/include/nw4r/ut/CharStrmReader.h +++ b/libs/NW4R/include/nw4r/ut/CharStrmReader.h @@ -6,37 +6,39 @@ namespace nw4r { namespace ut { class CharStrmReader { - public: - typedef u16 (CharStrmReader::*ReadFunc)(); + public: + typedef u16 (CharStrmReader::*ReadFunc)(); - CharStrmReader(ReadFunc func) : mCharStrm(NULL), mReadFunc(func) {} + CharStrmReader(ReadFunc func) : mCharStrm(NULL), mReadFunc(func) {} - const void* GetCurrentPos() const { return mCharStrm; } + const void* GetCurrentPos() const { return mCharStrm; } - void Set(const char* stream) { mCharStrm = stream; } - void Set(const wchar_t* stream) { mCharStrm = stream; } + void Set(const char* stream) { mCharStrm = stream; } + void Set(const wchar_t* stream) { mCharStrm = stream; } - u16 ReadNextCharUTF8(); - u16 ReadNextCharUTF16(); - u16 ReadNextCharCP1252(); - u16 ReadNextCharSJIS(); + u16 ReadNextCharUTF8(); + u16 ReadNextCharUTF16(); + u16 ReadNextCharCP1252(); + u16 ReadNextCharSJIS(); - u16 Next() { return (this->*mReadFunc)(); } + u16 Next() { return (this->*mReadFunc)(); } - template T GetChar(int offset) const { - const T* const charStrm = static_cast(mCharStrm); - return charStrm[offset]; - } + template + T GetChar(int offset) const { + const T* const charStrm = static_cast(mCharStrm); + return charStrm[offset]; + } - template void StepStrm(int step) { - const T*& charStrm = *reinterpret_cast(&mCharStrm); - charStrm += step; - } + template + void StepStrm(int step) { + const T*& charStrm = *reinterpret_cast(&mCharStrm); + charStrm += step; + } - const void* mCharStrm; // 0x00 - const ReadFunc mReadFunc; // 0x04 + const void* mCharStrm; // 0x00 + const ReadFunc mReadFunc; // 0x04 }; - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_CHAR_STREAM_READER_H +#endif // NW4R_UT_CHAR_STREAM_READER_H diff --git a/libs/NW4R/include/nw4r/ut/CharWriter.h b/libs/NW4R/include/nw4r/ut/CharWriter.h index fdc5f95c..e66277a0 100644 --- a/libs/NW4R/include/nw4r/ut/CharWriter.h +++ b/libs/NW4R/include/nw4r/ut/CharWriter.h @@ -3,8 +3,8 @@ #include -#include #include +#include #include @@ -13,147 +13,145 @@ namespace nw4r { namespace ut { class CharWriter { + public: + typedef enum GradationMode { + GRADMODE_NONE = 0, + GRADMODE_H, + GRADMODE_V, + + NUM_OF_GRADMODE + } GradationMode; + + private: + typedef struct ColorMapping { + Color min; // 0x00 + Color max; // 0x04 + } ColorMapping; + + typedef struct VertexColor { + Color lu, ru; // 0x00 + Color ld, rd; // 0x08 + } VertexColor; + + typedef struct TextureFilter { public: - typedef enum GradationMode { - GRADMODE_NONE = 0, - GRADMODE_H, - GRADMODE_V, + bool operator!=(const TextureFilter& rhs) const { return atSmall != rhs.atSmall || atLarge != rhs.atLarge; } - NUM_OF_GRADMODE - } GradationMode; + GXTexFilter atSmall; // 0x00 + GXTexFilter atLarge; // 0x04 + } TextureFilter; - private: - typedef struct ColorMapping { - Color min; // 0x00 - Color max; // 0x04 - } ColorMapping; - - typedef struct VertexColor { - Color lu, ru; // 0x00 - Color ld, rd; // 0x08 - } VertexColor; - - typedef struct TextureFilter { - public: - bool operator !=(const TextureFilter& rhs) const { return atSmall != rhs.atSmall || atLarge != rhs.atLarge; } - - GXTexFilter atSmall; // 0x00 - GXTexFilter atLarge; // 0x04 - } TextureFilter; - - typedef struct TextColor { - Color start; // 0x00 - Color end; // 0x04 - GradationMode gradationMode; // 0x08 - } TextColor; - - typedef struct LoadingTexture { - public: - bool operator !=(const LoadingTexture& rhs) const { - return slot != rhs.slot || texture != rhs.texture || filter != rhs.filter; - } - - void Reset() { - slot = GX_TEXMAP_NULL; - texture = NULL; - } - - GXTexMapID slot; // 0x00 - void* texture; // 0x04 - TextureFilter filter; // 0x08 - } LoadingTexture; + typedef struct TextColor { + Color start; // 0x00 + Color end; // 0x04 + GradationMode gradationMode; // 0x08 + } TextColor; + typedef struct LoadingTexture { public: - CharWriter(); - ~CharWriter(); + bool operator!=(const LoadingTexture& rhs) const { return slot != rhs.slot || texture != rhs.texture || filter != rhs.filter; } - const Font* GetFont() const; + void Reset() { + slot = GX_TEXMAP_NULL; + texture = NULL; + } - f32 GetScaleH() const; - f32 GetScaleV() const; + GXTexMapID slot; // 0x00 + void* texture; // 0x04 + TextureFilter filter; // 0x08 + } LoadingTexture; - f32 GetCursorX() const; - f32 GetCursorY() const; + public: + CharWriter(); + ~CharWriter(); - void SetFont(const Font& font); - void SetColorMapping(Color min, Color max); + const Font* GetFont() const; - void SetScale(f32 hScale, f32 vScale); - void SetScale(f32 scale); + f32 GetScaleH() const; + f32 GetScaleV() const; - void SetCursor(f32 x, f32 y); - void SetCursor(f32 x, f32 y, f32 z); - void SetCursorX(f32 x); - void SetCursorY(f32 y); + f32 GetCursorX() const; + f32 GetCursorY() const; - f32 GetFontWidth() const; - f32 GetFontHeight() const; - f32 GetFontAscent() const; + void SetFont(const Font& font); + void SetColorMapping(Color min, Color max); - bool IsWidthFixed() const; - void EnableFixedWidth(bool flag); + void SetScale(f32 hScale, f32 vScale); + void SetScale(f32 scale); - f32 GetFixedWidth() const; - void SetFixedWidth(f32 width); + void SetCursor(f32 x, f32 y); + void SetCursor(f32 x, f32 y, f32 z); + void SetCursorX(f32 x); + void SetCursorY(f32 y); - void SetGradationMode(GradationMode mode); + f32 GetFontWidth() const; + f32 GetFontHeight() const; + f32 GetFontAscent() const; - void SetTextColor(Color color); - void SetTextColor(Color start, Color end); - Color GetTextColor() const; + bool IsWidthFixed() const; + void EnableFixedWidth(bool flag); - void SetFontSize(f32 width, f32 height); - void SetFontSize(f32 height); + f32 GetFixedWidth() const; + void SetFixedWidth(f32 width); - void SetupGX(); + void SetGradationMode(GradationMode mode); - void ResetColorMapping(); - void ResetTextureCache(); + void SetTextColor(Color color); + void SetTextColor(Color start, Color end); + Color GetTextColor() const; - void EnableLinearFilter(bool atSmall, bool atLarge); + void SetFontSize(f32 width, f32 height); + void SetFontSize(f32 height); - f32 Print(u16 code); + void SetupGX(); - void MoveCursorX(f32 dx); - void MoveCursorY(f32 dy); + void ResetColorMapping(); + void ResetTextureCache(); - void PrintGlyph(f32 x, f32 y, f32 z, const Glyph& glyph); + void EnableLinearFilter(bool atSmall, bool atLarge); - void LoadTexture(const Glyph& glyph, GXTexMapID slot); + f32 Print(u16 code); - void UpdateVertexColor(); + void MoveCursorX(f32 dx); + void MoveCursorY(f32 dy); - private: - static void SetupVertexFormat(); + void PrintGlyph(f32 x, f32 y, f32 z, const Glyph& glyph); - static void SetupGXDefault(); - static void SetupGXWithColorMapping(Color min, Color max); - static void SetupGXForI(); - static void SetupGXForRGBA(); + void LoadTexture(const Glyph& glyph, GXTexMapID slot); - ColorMapping mColorMapping; // 0x00 - VertexColor mVertexColor; // 0x08 - TextColor mTextColor; // 0x18 + void UpdateVertexColor(); - math::VEC2 mScale; // 0x24 - math::VEC3 mCursorPos; // 0x2C + private: + static void SetupVertexFormat(); - TextureFilter mFilter; // 0x38 + static void SetupGXDefault(); + static void SetupGXWithColorMapping(Color min, Color max); + static void SetupGXForI(); + static void SetupGXForRGBA(); - u8 padding_[2]; // 0x40 - u8 mAlpha; // 0x42 - bool mIsWidthFixed; // 0x43 - f32 mFixedWidth; // 0x44 + ColorMapping mColorMapping; // 0x00 + VertexColor mVertexColor; // 0x08 + TextColor mTextColor; // 0x18 - const Font* mFont; // 0x48 + math::VEC2 mScale; // 0x24 + math::VEC3 mCursorPos; // 0x2C - static const u32 DEFAULT_COLOR_MAPPING_MIN = 0x00000000; - static const u32 DEFAULT_COLOR_MAPPING_MAX = 0xFFFFFFFF; + TextureFilter mFilter; // 0x38 - private: - static LoadingTexture mLoadingTexture; + u8 padding_[2]; // 0x40 + u8 mAlpha; // 0x42 + bool mIsWidthFixed; // 0x43 + f32 mFixedWidth; // 0x44 + + const Font* mFont; // 0x48 + + static const u32 DEFAULT_COLOR_MAPPING_MIN = 0x00000000; + static const u32 DEFAULT_COLOR_MAPPING_MAX = 0xFFFFFFFF; + + private: + static LoadingTexture mLoadingTexture; }; - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_CHAR_WRITER_H +#endif // NW4R_UT_CHAR_WRITER_H diff --git a/libs/NW4R/include/nw4r/ut/Color.h b/libs/NW4R/include/nw4r/ut/Color.h index 5443b5e5..50f93c50 100644 --- a/libs/NW4R/include/nw4r/ut/Color.h +++ b/libs/NW4R/include/nw4r/ut/Color.h @@ -1,33 +1,33 @@ #ifndef NW4R_UT_COLOR_H #define NW4R_UT_COLOR_H -#include #include +#include namespace nw4r { namespace ut { typedef struct Color : public GXColor { - static const u32 RED = 0xFF0000FF; - static const u32 GREEN = 0x00FF00FF; - static const u32 BLUE = 0x0000FFFF; + static const u32 RED = 0xFF0000FF; + static const u32 GREEN = 0x00FF00FF; + static const u32 BLUE = 0x0000FFFF; - static const u32 CYAN = 0x00FFFFFF; - static const u32 MAGENTA = 0xFF00FFFF; - static const u32 YELLOW = 0xFFFF00FF; + static const u32 CYAN = 0x00FFFFFF; + static const u32 MAGENTA = 0xFF00FFFF; + static const u32 YELLOW = 0xFFFF00FF; - static const u32 BLACK = 0x000000FF; - static const u32 GRAY = 0x808080FF; - static const u32 WHITE = 0xFFFFFFFF; + static const u32 BLACK = 0x000000FF; + static const u32 GRAY = 0x808080FF; + static const u32 WHITE = 0xFFFFFFFF; - static const u32 NOCOLOR = 0x00000000; - static const u32 MAXCOLOR = 0xFFFFFFFF; + static const u32 NOCOLOR = 0x00000000; + static const u32 MAXCOLOR = 0xFFFFFFFF; // Constructor - Color() { *this = WHITE; } - Color(u32 color) { *this = color; } - Color(const GXColor& color) { *this = color; } - Color(int red, int green, int blue, int alpha) { Set(red, green, blue, alpha); } + Color() { *this = WHITE; } + Color(u32 color) { *this = color; } + Color(const GXColor& color) { *this = color; } + Color(int red, int green, int blue, int alpha) { Set(red, green, blue, alpha); } // Left out destructor @@ -35,24 +35,32 @@ namespace nw4r { // Operators - Color& operator=(u32 color) { ToU32ref() = color; return *this; } + Color& operator=(u32 color) { + ToU32ref() = color; + return *this; + } - Color& operator=(const GXColor& color) { return *this = *reinterpret_cast(&color); } + Color& operator=(const GXColor& color) { return *this = *reinterpret_cast(&color); } - Color operator|(u32 color) const { return Color(ToU32() | color); } - Color operator&(u32 color) const { return Color(ToU32() & color);} + Color operator|(u32 color) const { return Color(ToU32() | color); } + Color operator&(u32 color) const { return Color(ToU32() & color); } - u32& ToU32ref() { return *reinterpret_cast(this); } - const u32& ToU32ref() const { return *reinterpret_cast(this); } - u32 ToU32() const { return ToU32ref();} + u32& ToU32ref() { return *reinterpret_cast(this); } + const u32& ToU32ref() const { return *reinterpret_cast(this); } + u32 ToU32() const { return ToU32ref(); } - operator u32() const { return ToU32ref(); } + operator u32() const { return ToU32ref(); } // Functions - void Set(int red, int green, int blue, int alpha) { r = red; g = green; b = blue; a = alpha; } + void Set(int red, int green, int blue, int alpha) { + r = red; + g = green; + b = blue; + a = alpha; + } } Color; - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_COLOR_H +#endif // NW4R_UT_COLOR_H diff --git a/libs/NW4R/include/nw4r/ut/DvdFileStream.h b/libs/NW4R/include/nw4r/ut/DvdFileStream.h index a6adf11d..0645ce23 100644 --- a/libs/NW4R/include/nw4r/ut/DvdFileStream.h +++ b/libs/NW4R/include/nw4r/ut/DvdFileStream.h @@ -8,76 +8,76 @@ namespace nw4r { namespace ut { class DvdFileStream : public FileStream { - public: - NW4R_UT_RUNTIME_TYPEINFO; + public: + NW4R_UT_RUNTIME_TYPEINFO; - explicit DvdFileStream(s32 entrynum); - DvdFileStream(const DVDFileInfo* info, bool close); - virtual ~DvdFileStream(); // 0x0C + explicit DvdFileStream(s32 entrynum); + DvdFileStream(const DVDFileInfo* info, bool close); + virtual ~DvdFileStream(); // 0x0C - bool Open(s32 entrynum); - bool Open(const DVDFileInfo* info, bool close); - - void SetPriority(s32 priority) { mPriority = priority; } - - virtual void Close(); // 0x10 - - virtual s32 Read(void* pDst, u32 size); // 0x14 - virtual bool ReadAsync(void* pDst, u32 size, IOStreamCallback pCallback, void* pCallbackArg); // 0x18 - - virtual s32 Peek(void* pDst, u32 size); // 0x5C - virtual bool PeekAsync(void* pDst, u32 size, IOStreamCallback pCallback, void* pCallbackArg); // 0x60 - - virtual void Seek(s32 offset, u32 origin); // 0x44 - - virtual void Cancel(); // 0x48 - virtual bool CancelAsync(IOStreamCallback pCallback, void* pCallbackArg); // 0x4C - - virtual bool IsBusy() const { return mIsBusy; } // 0x24 - - virtual u32 Tell() const { return mFilePosition.Tell(); } // 0x58 - virtual u32 GetSize() const { return mFilePosition.GetFileSize(); } // 0x40 - - virtual bool CanAsync() const { return true; } // 0x28 - virtual bool CanSeek() const { return true; } // 0x50 - virtual bool CanRead() const { return true; } // 0x2C - virtual bool CanWrite() const { return false; } // 0x30 - virtual bool CanCancel() const { return true; } // 0x54 - - virtual u32 GetOffsetAlign() const { return 4; } // 0x34 - virtual u32 GetSizeAlign() const { return DEFAULT_ALIGN; } // 0x38 - virtual u32 GetBufferAlign() const { return DEFAULT_ALIGN; } // 0x3C - - private: - typedef struct DvdFileStreamInfo { - DVDFileInfo dvdInfo; // 0x00 - DvdFileStream* stream; // 0x3C - } DvdFileStreamInfo; - - private: - static void DvdAsyncCallback_(s32 result, DVDFileInfo* info); - static void DvdCBAsyncCallback_(s32 result, DVDCommandBlock* pBlock); - - void Initialize_(); - u32 AdjustReadLength_(u32 len); - - private: - FilePosition mFilePosition; // 0x14 + bool Open(s32 entrynum); + bool Open(const DVDFileInfo* info, bool close); - IOStreamCallback mCancelCallback; // 0x1C - void* mCancelArg; // 0x20 - volatile bool mIsCanceling; // 0x24 + void SetPriority(s32 priority) { mPriority = priority; } - DvdFileStreamInfo mFileInfo; // 0x28 + virtual void Close(); // 0x10 - s32 mPriority; // 0x68 + virtual s32 Read(void* pDst, u32 size); // 0x14 + virtual bool ReadAsync(void* pDst, u32 size, IOStreamCallback pCallback, void* pCallbackArg); // 0x18 - volatile bool mIsBusy; // 0x6C + virtual s32 Peek(void* pDst, u32 size); // 0x5C + virtual bool PeekAsync(void* pDst, u32 size, IOStreamCallback pCallback, void* pCallbackArg); // 0x60 - bool mCloseOnDestroyFlg; // 0x6D - bool mCloseEnableFlg; // 0x6E + virtual void Seek(s32 offset, u32 origin); // 0x44 + + virtual void Cancel(); // 0x48 + virtual bool CancelAsync(IOStreamCallback pCallback, void* pCallbackArg); // 0x4C + + virtual bool IsBusy() const { return mIsBusy; } // 0x24 + + virtual u32 Tell() const { return mFilePosition.Tell(); } // 0x58 + virtual u32 GetSize() const { return mFilePosition.GetFileSize(); } // 0x40 + + virtual bool CanAsync() const { return true; } // 0x28 + virtual bool CanSeek() const { return true; } // 0x50 + virtual bool CanRead() const { return true; } // 0x2C + virtual bool CanWrite() const { return false; } // 0x30 + virtual bool CanCancel() const { return true; } // 0x54 + + virtual u32 GetOffsetAlign() const { return 4; } // 0x34 + virtual u32 GetSizeAlign() const { return DEFAULT_ALIGN; } // 0x38 + virtual u32 GetBufferAlign() const { return DEFAULT_ALIGN; } // 0x3C + + private: + typedef struct DvdFileStreamInfo { + DVDFileInfo dvdInfo; // 0x00 + DvdFileStream* stream; // 0x3C + } DvdFileStreamInfo; + + private: + static void DvdAsyncCallback_(s32 result, DVDFileInfo* info); + static void DvdCBAsyncCallback_(s32 result, DVDCommandBlock* pBlock); + + void Initialize_(); + u32 AdjustReadLength_(u32 len); + + private: + FilePosition mFilePosition; // 0x14 + + IOStreamCallback mCancelCallback; // 0x1C + void* mCancelArg; // 0x20 + volatile bool mIsCanceling; // 0x24 + + DvdFileStreamInfo mFileInfo; // 0x28 + + s32 mPriority; // 0x68 + + volatile bool mIsBusy; // 0x6C + + bool mCloseOnDestroyFlg; // 0x6D + bool mCloseEnableFlg; // 0x6E }; - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_DVD_FILE_STREAM_H +#endif // NW4R_UT_DVD_FILE_STREAM_H diff --git a/libs/NW4R/include/nw4r/ut/DvdLockedFileStream.h b/libs/NW4R/include/nw4r/ut/DvdLockedFileStream.h index c7060d1c..9ebc300a 100644 --- a/libs/NW4R/include/nw4r/ut/DvdLockedFileStream.h +++ b/libs/NW4R/include/nw4r/ut/DvdLockedFileStream.h @@ -6,31 +6,31 @@ namespace nw4r { namespace ut { class DvdLockedFileStream : public DvdFileStream { - public: - NW4R_UT_RUNTIME_TYPEINFO; + public: + NW4R_UT_RUNTIME_TYPEINFO; - explicit DvdLockedFileStream(s32 entrynum); - DvdLockedFileStream(const DVDFileInfo* info, bool close); - virtual ~DvdLockedFileStream(); // 0x0C + explicit DvdLockedFileStream(s32 entrynum); + DvdLockedFileStream(const DVDFileInfo* info, bool close); + virtual ~DvdLockedFileStream(); // 0x0C - virtual s32 Read(void* pDst, u32 size); // 0x14 - virtual bool ReadAsync(void* pDst, u32 size, IOStreamCallback pCallback, void* pCallbackArg) { return false; } // 0x18 + virtual s32 Read(void* pDst, u32 size); // 0x14 + virtual bool ReadAsync(void* pDst, u32 size, IOStreamCallback pCallback, void* pCallbackArg) { return false; } // 0x18 - virtual s32 Peek(void* pDst, u32 size); // 0x5C - virtual bool PeekAsync(void* pDst , u32 size, IOStreamCallback pCallback, void* pCallbackArg) { return false; } // 0x60 + virtual s32 Peek(void* pDst, u32 size); // 0x5C + virtual bool PeekAsync(void* pDst, u32 size, IOStreamCallback pCallback, void* pCallbackArg) { return false; } // 0x60 - virtual bool CanAsync() const { return false; } // 0x28 + virtual bool CanAsync() const { return false; } // 0x28 - private: - static void InitMutex_(); + private: + static void InitMutex_(); - private: - bool mCancelFlag; // 0x6F + private: + bool mCancelFlag; // 0x6F - static bool sInitialized; - static OSMutex sMutex; + static bool sInitialized; + static OSMutex sMutex; }; - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_DVD_LOCKED_FILE_STREAM_H +#endif // NW4R_UT_DVD_LOCKED_FILE_STREAM_H diff --git a/libs/NW4R/include/nw4r/ut/FileStream.h b/libs/NW4R/include/nw4r/ut/FileStream.h index 7553c184..a0284885 100644 --- a/libs/NW4R/include/nw4r/ut/FileStream.h +++ b/libs/NW4R/include/nw4r/ut/FileStream.h @@ -6,48 +6,47 @@ namespace nw4r { namespace ut { class FileStream : public IOStream { - public: - enum SeekOrigin { SEEK_BEG, SEEK_CUR, SEEK_END }; - - public: - NW4R_UT_RUNTIME_TYPEINFO; - - FileStream() {} - virtual ~FileStream() {} // 0x0C - - virtual u32 GetSize() const = 0; // 0x40 - - virtual void Seek(s32 offset, u32 origin); // 0x44 - - virtual void Cancel(); // 0x48 - virtual bool CancelAsync(IOStreamCallback pCallback, void* pCallbackArg); // 0x4C - - virtual bool CanSeek() const = 0; // 0x50 - virtual bool CanCancel() const = 0; // 0x54 - - virtual u32 Tell() const = 0; // 0x58 - - protected: - class FilePosition { - public: - FilePosition() : mFileSize(0), mPosition(0) {} - - u32 GetFileSize() const { return mFileSize; - } - void SetFileSize(u32 size) { mFileSize = size; } - - u32 Tell() const { return mPosition; } - - u32 Skip(s32 offset); - u32 Append(s32 offset); - void Seek(s32 offset, u32 origin); - - private: - u32 mFileSize; // 0x0 - u32 mPosition; // 0x4 - }; - }; - } -} + public: + enum SeekOrigin { SEEK_BEG, SEEK_CUR, SEEK_END }; -#endif // NW4R_UT_FILE_STREAM_H + public: + NW4R_UT_RUNTIME_TYPEINFO; + + FileStream() {} + virtual ~FileStream() {} // 0x0C + + virtual u32 GetSize() const = 0; // 0x40 + + virtual void Seek(s32 offset, u32 origin); // 0x44 + + virtual void Cancel(); // 0x48 + virtual bool CancelAsync(IOStreamCallback pCallback, void* pCallbackArg); // 0x4C + + virtual bool CanSeek() const = 0; // 0x50 + virtual bool CanCancel() const = 0; // 0x54 + + virtual u32 Tell() const = 0; // 0x58 + + protected: + class FilePosition { + public: + FilePosition() : mFileSize(0), mPosition(0) {} + + u32 GetFileSize() const { return mFileSize; } + void SetFileSize(u32 size) { mFileSize = size; } + + u32 Tell() const { return mPosition; } + + u32 Skip(s32 offset); + u32 Append(s32 offset); + void Seek(s32 offset, u32 origin); + + private: + u32 mFileSize; // 0x0 + u32 mPosition; // 0x4 + }; + }; + } // namespace ut +} // namespace nw4r + +#endif // NW4R_UT_FILE_STREAM_H diff --git a/libs/NW4R/include/nw4r/ut/Font.h b/libs/NW4R/include/nw4r/ut/Font.h index 5e17aedc..e1115cbb 100644 --- a/libs/NW4R/include/nw4r/ut/Font.h +++ b/libs/NW4R/include/nw4r/ut/Font.h @@ -1,8 +1,8 @@ #ifndef NW4R_UT_FONT_H #define NW4R_UT_FONT_H -#include #include +#include #include #include @@ -25,57 +25,55 @@ namespace nw4r { } FontEncoding; class Font { - public: - typedef enum Type { - TYPE_NULL = 0, - TYPE_ROM, - TYPE_RESOURCE, - } Type; + public: + typedef enum Type { + TYPE_NULL = 0, + TYPE_ROM, + TYPE_RESOURCE, + } Type; - public: - Font() : mReaderFunc(&CharStrmReader::ReadNextCharCP1252) {} - virtual ~Font() {} + public: + Font() : mReaderFunc(&CharStrmReader::ReadNextCharCP1252) {} + virtual ~Font() {} - virtual int GetWidth() const = 0; - virtual int GetHeight() const = 0; + virtual int GetWidth() const = 0; + virtual int GetHeight() const = 0; - virtual int GetAscent() const = 0; - virtual int GetDescent() const = 0; + virtual int GetAscent() const = 0; + virtual int GetDescent() const = 0; - virtual int GetBaselinePos() const = 0; + virtual int GetBaselinePos() const = 0; - virtual int GetCellHeight() const = 0; - virtual int GetCellWidth() const = 0; + virtual int GetCellHeight() const = 0; + virtual int GetCellWidth() const = 0; - virtual int GetMaxCharWidth() const = 0; - virtual Type GetType() const = 0; - virtual GXTexFmt GetTextureFormat() const = 0; - virtual int GetLineFeed() const = 0; + virtual int GetMaxCharWidth() const = 0; + virtual Type GetType() const = 0; + virtual GXTexFmt GetTextureFormat() const = 0; + virtual int GetLineFeed() const = 0; - virtual CharWidths GetDefaultCharWidths() const = 0; - virtual void SetDefaultCharWidths(const CharWidths& widths) = 0; + virtual CharWidths GetDefaultCharWidths() const = 0; + virtual void SetDefaultCharWidths(const CharWidths& widths) = 0; - virtual bool SetAlternateChar(u16 c) = 0; + virtual bool SetAlternateChar(u16 c) = 0; - virtual void SetLineFeed(int linefeed) = 0; + virtual void SetLineFeed(int linefeed) = 0; - virtual int GetCharWidth(u16 c) const = 0; - virtual CharWidths GetCharWidths(u16 c) const = 0; + virtual int GetCharWidth(u16 c) const = 0; + virtual CharWidths GetCharWidths(u16 c) const = 0; - virtual void GetGlyph(Glyph* glyph, u16 c) const = 0; + virtual void GetGlyph(Glyph* glyph, u16 c) const = 0; - virtual FontEncoding GetEncoding() const = 0; + virtual FontEncoding GetEncoding() const = 0; - void InitReaderFunc(FontEncoding encoding); + void InitReaderFunc(FontEncoding encoding); - CharStrmReader GetCharStrmReader() const NO_INLINE { - return CharStrmReader(mReaderFunc); - } + CharStrmReader GetCharStrmReader() const NO_INLINE { return CharStrmReader(mReaderFunc); } - private: - CharStrmReader::ReadFunc mReaderFunc; // 0x04 + private: + CharStrmReader::ReadFunc mReaderFunc; // 0x04 }; - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_CHAR_STREAM_READER_H +#endif // NW4R_UT_CHAR_STREAM_READER_H diff --git a/libs/NW4R/include/nw4r/ut/IOStream.h b/libs/NW4R/include/nw4r/ut/IOStream.h index acf9cbb1..18231e12 100644 --- a/libs/NW4R/include/nw4r/ut/IOStream.h +++ b/libs/NW4R/include/nw4r/ut/IOStream.h @@ -8,47 +8,44 @@ namespace nw4r { namespace ut { class IOStream { - public: - typedef void (*IOStreamCallback)(s32 result, IOStream* pStream, void* pCallbackArg); + public: + typedef void (*IOStreamCallback)(s32 result, IOStream* pStream, void* pCallbackArg); - NW4R_UT_RUNTIME_TYPEINFO; + NW4R_UT_RUNTIME_TYPEINFO; - IOStream() : - mAvailable(false), - mCallback(NULL), - mArg(NULL) {} + IOStream() : mAvailable(false), mCallback(NULL), mArg(NULL) {} - virtual ~IOStream() {} // 0x0C + virtual ~IOStream() {} // 0x0C - virtual void Close() = 0; // 0x10 + virtual void Close() = 0; // 0x10 - virtual s32 Read(void* pDst, u32 size) = 0; // 0x14 - virtual bool ReadAsync(void* pDst, u32 size, IOStreamCallback pCallback, void* pCallbackArg); // 0x18 + virtual s32 Read(void* pDst, u32 size) = 0; // 0x14 + virtual bool ReadAsync(void* pDst, u32 size, IOStreamCallback pCallback, void* pCallbackArg); // 0x18 - virtual void Write(const void* pSrc, u32 size); // 0x1C - virtual bool WriteAsync(const void* pSrc, u32 size, IOStreamCallback pCallback, void* pCallbackArg); // 0x20 + virtual void Write(const void* pSrc, u32 size); // 0x1C + virtual bool WriteAsync(const void* pSrc, u32 size, IOStreamCallback pCallback, void* pCallbackArg); // 0x20 - virtual bool IsBusy() const; // 0x24 + virtual bool IsBusy() const; // 0x24 - virtual bool CanAsync() const = 0; // 0x28 - virtual bool CanRead() const = 0; // 0x2C - virtual bool CanWrite() const = 0; // 0x30 + virtual bool CanAsync() const = 0; // 0x28 + virtual bool CanRead() const = 0; // 0x2C + virtual bool CanWrite() const = 0; // 0x30 - virtual u32 GetOffsetAlign() const { return 1; } // 0x34 - virtual u32 GetSizeAlign() const { return 1; } // 0x38 - virtual u32 GetBufferAlign() const { return 1; } // 0x3C + virtual u32 GetOffsetAlign() const { return 1; } // 0x34 + virtual u32 GetSizeAlign() const { return 1; } // 0x38 + virtual u32 GetBufferAlign() const { return 1; } // 0x3C - bool IsAvailable() const { return mAvailable; } - - protected: - bool mAvailable; // 0x04 + bool IsAvailable() const { return mAvailable; } - s32 mAsyncResult; // 0x08 + protected: + bool mAvailable; // 0x04 - IOStreamCallback mCallback; // 0x0C - void* mArg; // 0x10 + s32 mAsyncResult; // 0x08 + + IOStreamCallback mCallback; // 0x0C + void* mArg; // 0x10 }; - }; -}; + }; // namespace ut +}; // namespace nw4r -#endif // NW4R_UT_IO_STREAM_H +#endif // NW4R_UT_IO_STREAM_H diff --git a/libs/NW4R/include/nw4r/ut/LinkList.h b/libs/NW4R/include/nw4r/ut/LinkList.h index b85ed89b..2f199c41 100644 --- a/libs/NW4R/include/nw4r/ut/LinkList.h +++ b/libs/NW4R/include/nw4r/ut/LinkList.h @@ -24,16 +24,12 @@ namespace nw4r { public: LinkListNode() : mNext(NULL), mPrev(NULL) {} - LinkListNode* GetNext() const { - return mNext; - } - LinkListNode* GetPrev() const { - return mPrev; - } + LinkListNode* GetNext() const { return mNext; } + LinkListNode* GetPrev() const { return mPrev; } private: - LinkListNode* mNext; // 0x00 - LinkListNode* mPrev; // 0x04 + LinkListNode* mNext; // 0x00 + LinkListNode* mPrev; // 0x04 }; namespace detail { @@ -69,17 +65,12 @@ namespace nw4r { return *this; } - LinkListNode* operator->() const { - return mNode; - } + LinkListNode* operator->() const { return mNode; } - friend bool operator==(LinkListImpl::Iterator lhs, - LinkListImpl::Iterator rhs) { - return lhs.mNode == rhs.mNode; - } + friend bool operator==(LinkListImpl::Iterator lhs, LinkListImpl::Iterator rhs) { return lhs.mNode == rhs.mNode; } private: - LinkListNode* mNode; // 0x00 + LinkListNode* mNode; // 0x00 }; /****************************************************************************** @@ -101,35 +92,22 @@ namespace nw4r { return *this; } - const LinkListNode* operator->() const { - return mNode; - } + const LinkListNode* operator->() const { return mNode; } - friend bool operator==(LinkListImpl::ConstIterator lhs, - LinkListImpl::ConstIterator rhs) { - return lhs.mNode == rhs.mNode; - } + friend bool operator==(LinkListImpl::ConstIterator lhs, LinkListImpl::ConstIterator rhs) { return lhs.mNode == rhs.mNode; } private: - LinkListNode* mNode; // 0x00 + LinkListNode* mNode; // 0x00 }; protected: - static Iterator GetIteratorFromPointer(LinkListNode* pNode) { - return Iterator(pNode); - } + static Iterator GetIteratorFromPointer(LinkListNode* pNode) { return Iterator(pNode); } - LinkListImpl() { - Initialize_(); - } + LinkListImpl() { Initialize_(); } ~LinkListImpl(); - Iterator GetBeginIter() { - return Iterator(mNode.GetNext()); - } - Iterator GetEndIter() { - return Iterator(&mNode); - } + Iterator GetBeginIter() { return Iterator(mNode.GetNext()); } + Iterator GetEndIter() { return Iterator(&mNode); } Iterator Insert(Iterator it, LinkListNode* pNode); @@ -138,19 +116,11 @@ namespace nw4r { Iterator Erase(Iterator begin, Iterator end); public: - u32 GetSize() const { - return mSize; - } - bool IsEmpty() const { - return mSize == 0; - } + u32 GetSize() const { return mSize; } + bool IsEmpty() const { return mSize == 0; } - void PopFront() { - Erase(GetBeginIter()); - } - void PopBack() { - Erase(--GetEndIter()); - } + void PopFront() { Erase(GetBeginIter()); } + void PopBack() { Erase(--GetEndIter()); } void Clear(); @@ -162,8 +132,8 @@ namespace nw4r { } private: - u32 mSize; // 0x00 - LinkListNode mNode; // 0x04 + u32 mSize; // 0x00 + LinkListNode mNode; // 0x04 }; /****************************************************************************** @@ -171,50 +141,42 @@ namespace nw4r { * Reverse iterator * ******************************************************************************/ - template class ReverseIterator { + template + class ReverseIterator { public: explicit ReverseIterator(TIter it) : mCurrent(it) {} - TIter GetBase() const { - return mCurrent; - } + TIter GetBase() const { return mCurrent; } ReverseIterator& operator++() { --mCurrent; return *this; } - const typename TIter::TElem* operator->() const { - return &this->operator*(); - } + const typename TIter::TElem* operator->() const { return &this->operator*(); } typename TIter::TElem& operator*() const { TIter it = mCurrent; return *--it; } - friend bool operator==(const ReverseIterator& rLhs, - const ReverseIterator& rRhs) { - return rLhs.mCurrent == rRhs.mCurrent; - } + friend bool operator==(const ReverseIterator& rLhs, const ReverseIterator& rRhs) { return rLhs.mCurrent == rRhs.mCurrent; } - friend bool operator!=(const ReverseIterator& rLhs, - const ReverseIterator& rRhs) { - return !(rLhs.mCurrent == rRhs.mCurrent); - } + friend bool operator!=(const ReverseIterator& rLhs, const ReverseIterator& rRhs) { return !(rLhs.mCurrent == rRhs.mCurrent); } private: - TIter mCurrent; // 0x00 + TIter mCurrent; // 0x00 }; - } + } // namespace detail /****************************************************************************** * * Templated linked list * ******************************************************************************/ - template class LinkList : public detail::LinkListImpl { + template + class LinkList : public detail::LinkListImpl { public: // Forward declarations class ConstIterator; @@ -250,24 +212,16 @@ namespace nw4r { return ret; } - T* operator->() const { - return GetPointerFromNode(mIterator.operator->()); - } + T* operator->() const { return GetPointerFromNode(mIterator.operator->()); } - T& operator*() const { - return *this->operator->(); - } + T& operator*() const { return *this->operator->(); } - friend bool operator==(Iterator lhs, Iterator rhs) { - return lhs.mIterator == rhs.mIterator; - } + friend bool operator==(Iterator lhs, Iterator rhs) { return lhs.mIterator == rhs.mIterator; } - friend bool operator!=(Iterator lhs, Iterator rhs) { - return !(lhs == rhs); - } + friend bool operator!=(Iterator lhs, Iterator rhs) { return !(lhs == rhs); } private: - LinkListImpl::Iterator mIterator; // 0x00 + LinkListImpl::Iterator mIterator; // 0x00 }; /****************************************************************************** @@ -300,24 +254,16 @@ namespace nw4r { return ret; } - const T* operator->() const { - return GetPointerFromNode(mIterator.operator->()); - } + const T* operator->() const { return GetPointerFromNode(mIterator.operator->()); } - const T& operator*() const { - return *this->operator->(); - } + const T& operator*() const { return *this->operator->(); } - friend bool operator==(ConstIterator lhs, ConstIterator rhs) { - return lhs.mIterator == rhs.mIterator; - } + friend bool operator==(ConstIterator lhs, ConstIterator rhs) { return lhs.mIterator == rhs.mIterator; } - friend bool operator!=(ConstIterator lhs, ConstIterator rhs) { - return !(lhs == rhs); - } + friend bool operator!=(ConstIterator lhs, ConstIterator rhs) { return !(lhs == rhs); } private: - LinkListImpl::ConstIterator mIterator; // 0x00 + LinkListImpl::ConstIterator mIterator; // 0x00 }; public: @@ -328,83 +274,42 @@ namespace nw4r { public: LinkList() {} - Iterator GetBeginIter() { - return Iterator(LinkListImpl::GetBeginIter()); - } - ConstIterator GetBeginIter() const { - return ConstIterator(const_cast(this)->GetBeginIter()); - } - RevIterator GetBeginReverseIter() { - return RevIterator(GetBeginIter()); - } - ConstRevIterator GetBeginReverseIter() const { - return ConstRevIterator(GetBeginIter()); - } + Iterator GetBeginIter() { return Iterator(LinkListImpl::GetBeginIter()); } + ConstIterator GetBeginIter() const { return ConstIterator(const_cast(this)->GetBeginIter()); } + RevIterator GetBeginReverseIter() { return RevIterator(GetBeginIter()); } + ConstRevIterator GetBeginReverseIter() const { return ConstRevIterator(GetBeginIter()); } - Iterator GetEndIter() { - return Iterator(LinkListImpl::GetEndIter()); - } - ConstIterator GetEndIter() const { - return ConstIterator(const_cast(this)->GetEndIter()); - } - RevIterator GetEndReverseIter() { - return RevIterator(GetEndIter()); - } - ConstRevIterator GetEndReverseIter() const { - return ConstRevIterator(GetEndIter()); - } + Iterator GetEndIter() { return Iterator(LinkListImpl::GetEndIter()); } + ConstIterator GetEndIter() const { return ConstIterator(const_cast(this)->GetEndIter()); } + RevIterator GetEndReverseIter() { return RevIterator(GetEndIter()); } + ConstRevIterator GetEndReverseIter() const { return ConstRevIterator(GetEndIter()); } - Iterator Insert(Iterator it, T* pElem) { - return Iterator(LinkListImpl::Insert(it.mIterator, GetNodeFromPointer(pElem))); - } + Iterator Insert(Iterator it, T* pElem) { return Iterator(LinkListImpl::Insert(it.mIterator, GetNodeFromPointer(pElem))); } - Iterator Erase(T* pElem) { - return Iterator(LinkListImpl::Erase(GetNodeFromPointer(pElem))); - } - Iterator Erase(Iterator it) { - return Iterator(LinkListImpl::Erase(it.mIterator)); - } + Iterator Erase(T* pElem) { return Iterator(LinkListImpl::Erase(GetNodeFromPointer(pElem))); } + Iterator Erase(Iterator it) { return Iterator(LinkListImpl::Erase(it.mIterator)); } - void PushBack(T* pElem) { - Insert(GetEndIter(), pElem); - } + void PushBack(T* pElem) { Insert(GetEndIter(), pElem); } - T& GetFront() { - return *GetBeginIter(); - } - const T& GetFront() const { - return *GetBeginIter(); - } + T& GetFront() { return *GetBeginIter(); } + const T& GetFront() const { return *GetBeginIter(); } - T& GetBack() { - return *--GetEndIter(); - } - const T& GetBack() const { - return *--GetEndIter(); - } + T& GetBack() { return *--GetEndIter(); } + const T& GetBack() const { return *--GetEndIter(); } - static Iterator GetIteratorFromPointer(T* pElem) { - return GetIteratorFromPointer(GetNodeFromPointer(pElem)); - } + static Iterator GetIteratorFromPointer(T* pElem) { return GetIteratorFromPointer(GetNodeFromPointer(pElem)); } - static Iterator GetIteratorFromPointer(LinkListNode* pNode) { - return Iterator(LinkListImpl::GetIteratorFromPointer(pNode)); - } + static Iterator GetIteratorFromPointer(LinkListNode* pNode) { return Iterator(LinkListImpl::GetIteratorFromPointer(pNode)); } - static LinkListNode* GetNodeFromPointer(T* pElem) { - return reinterpret_cast(reinterpret_cast(pElem) + Ofs); - } + static LinkListNode* GetNodeFromPointer(T* pElem) { return reinterpret_cast(reinterpret_cast(pElem) + Ofs); } - static T* GetPointerFromNode(LinkListNode* pNode) { - return reinterpret_cast(reinterpret_cast(pNode) - Ofs); - } + static T* GetPointerFromNode(LinkListNode* pNode) { return reinterpret_cast(reinterpret_cast(pNode) - Ofs); } static const T* GetPointerFromNode(const LinkListNode* pNode) { return reinterpret_cast(reinterpret_cast(pNode) - Ofs); } }; - } -} + } // namespace ut +} // namespace nw4r - -#endif // NW4R_UT_LINK_LIST_H +#endif // NW4R_UT_LINK_LIST_H diff --git a/libs/NW4R/include/nw4r/ut/Lock.h b/libs/NW4R/include/nw4r/ut/Lock.h index 4587c339..eee9652a 100644 --- a/libs/NW4R/include/nw4r/ut/Lock.h +++ b/libs/NW4R/include/nw4r/ut/Lock.h @@ -1,9 +1,10 @@ #ifndef NW4R_UT_LOCK_H #define NW4R_UT_LOCK_H -#include -#include #include +#include +#include + namespace nw4r { namespace ut { @@ -15,33 +16,28 @@ namespace nw4r { OSUnlockMutex(&rMutex); } - template class AutoLock : private NonCopyable { - public: - explicit AutoLock(T& rLockObj) : mLockObj(rLockObj) { - Lock(rLockObj); - } - ~AutoLock() { - Unlock(mLockObj); - } - - private: - T& mLockObj; // 0x00 - }; - } - - typedef detail::AutoLock AutoMutexLock; - - class AutoInterruptLock : private NonCopyable { + template + class AutoLock : private NonCopyable { public: - AutoInterruptLock() : mOldState(OSDisableInterrupts()) {} - ~AutoInterruptLock() { - OSRestoreInterrupts(mOldState); - } + explicit AutoLock(T& rLockObj) : mLockObj(rLockObj) { Lock(rLockObj); } + ~AutoLock() { Unlock(mLockObj); } private: - BOOL mOldState; // 0x00 - }; - } -} + T& mLockObj; // 0x00 + }; + } // namespace detail -#endif // NW4R_UT_LIST_H + typedef detail::AutoLock AutoMutexLock; + + class AutoInterruptLock : private NonCopyable { + public: + AutoInterruptLock() : mOldState(OSDisableInterrupts()) {} + ~AutoInterruptLock() { OSRestoreInterrupts(mOldState); } + + private: + BOOL mOldState; // 0x00 + }; + } // namespace ut +} // namespace nw4r + +#endif // NW4R_UT_LIST_H diff --git a/libs/NW4R/include/nw4r/ut/NandFileStream.h b/libs/NW4R/include/nw4r/ut/NandFileStream.h index f1f8b50c..85a69f3e 100644 --- a/libs/NW4R/include/nw4r/ut/NandFileStream.h +++ b/libs/NW4R/include/nw4r/ut/NandFileStream.h @@ -8,64 +8,64 @@ namespace nw4r { namespace ut { class NandFileStream : public FileStream { - public: - NW4R_UT_RUNTIME_TYPEINFO; + public: + NW4R_UT_RUNTIME_TYPEINFO; - NandFileStream(const char* path, u32 mode); - NandFileStream(const NANDFileInfo* info, u32 mode, bool enableClose); - virtual ~NandFileStream(); // 0x0C + NandFileStream(const char* path, u32 mode); + NandFileStream(const NANDFileInfo* info, u32 mode, bool enableClose); + virtual ~NandFileStream(); // 0x0C - bool Open(const char* path, u32 mode); - bool Open(const NANDFileInfo* info, u32 mode, bool enableClose) NO_INLINE; + bool Open(const char* path, u32 mode); + bool Open(const NANDFileInfo* info, u32 mode, bool enableClose) NO_INLINE; - virtual void Close(); // 0x10 + virtual void Close(); // 0x10 - virtual s32 Read(void* pDst, u32 size); // 0x14 - virtual bool ReadAsync(void* pDst, u32 size, IOStreamCallback pCallback, void* pCallbackArg); // 0x18 + virtual s32 Read(void* pDst, u32 size); // 0x14 + virtual bool ReadAsync(void* pDst, u32 size, IOStreamCallback pCallback, void* pCallbackArg); // 0x18 - virtual void Write(const void* pSrc, u32 size); // 0x1C - virtual bool WriteAsync(const void* pSrc, u32 size, IOStreamCallback pCallback, void* pCallbackArg); // 0x20 + virtual void Write(const void* pSrc, u32 size); // 0x1C + virtual bool WriteAsync(const void* pSrc, u32 size, IOStreamCallback pCallback, void* pCallbackArg); // 0x20 - virtual void Seek(s32 offset, u32 origin); // 0x44 + virtual void Seek(s32 offset, u32 origin); // 0x44 - virtual bool IsBusy() const { return mIsBusy; } // 0x24 + virtual bool IsBusy() const { return mIsBusy; } // 0x24 - virtual u32 Tell() const { return mFilePosition.Tell(); } // 0x58 - virtual u32 GetSize() const { return mFilePosition.GetFileSize(); } // 0x40 + virtual u32 Tell() const { return mFilePosition.Tell(); } // 0x58 + virtual u32 GetSize() const { return mFilePosition.GetFileSize(); } // 0x40 - virtual bool CanAsync() const { return true; } // 0x28 - virtual bool CanSeek() const { return true; } // 0x50 - virtual bool CanRead() const { return mCanRead; } // 0x2C - virtual bool CanWrite() const { return mCanWrite; } // 0x30 - virtual bool CanCancel() const { return false; } // 0x54 + virtual bool CanAsync() const { return true; } // 0x28 + virtual bool CanSeek() const { return true; } // 0x50 + virtual bool CanRead() const { return mCanRead; } // 0x2C + virtual bool CanWrite() const { return mCanWrite; } // 0x30 + virtual bool CanCancel() const { return false; } // 0x54 - virtual u32 GetOffsetAlign() const { return 1; } // 0x34 - virtual u32 GetSizeAlign() const { return DEFAULT_ALIGN; } // 0x38 - virtual u32 GetBufferAlign() const { return DEFAULT_ALIGN; } // 0x3C + virtual u32 GetOffsetAlign() const { return 1; } // 0x34 + virtual u32 GetSizeAlign() const { return DEFAULT_ALIGN; } // 0x38 + virtual u32 GetBufferAlign() const { return DEFAULT_ALIGN; } // 0x3C - private: - typedef struct NandFileStreamInfo { - NANDCommandBlock nandBlock; // 0x00 - NANDFileInfo nandInfo; // 0xB8 - NandFileStream* stream; // 0x144 - } NandFileStreamInfo; + private: + typedef struct NandFileStreamInfo { + NANDCommandBlock nandBlock; // 0x00 + NANDFileInfo nandInfo; // 0xB8 + NandFileStream* stream; // 0x144 + } NandFileStreamInfo; - static void NandAsyncCallback_(s32 result, NANDCommandBlock* pBlock); + static void NandAsyncCallback_(s32 result, NANDCommandBlock* pBlock); - void Initialize_(); + void Initialize_(); - FilePosition mFilePosition; // 0x14 - NandFileStreamInfo mFileInfo; // 0x1C + FilePosition mFilePosition; // 0x14 + NandFileStreamInfo mFileInfo; // 0x1C - bool mCanRead; // 0x164 - bool mCanWrite; // 0x165 + bool mCanRead; // 0x164 + bool mCanWrite; // 0x165 - volatile bool mIsBusy; // 0x166 + volatile bool mIsBusy; // 0x166 - bool mCloseOnDestroyFlg; // 0x167 - bool mCloseEnableFlg; // 0x168 + bool mCloseOnDestroyFlg; // 0x167 + bool mCloseEnableFlg; // 0x168 }; - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_NAND_FILE_STREAM_H +#endif // NW4R_UT_NAND_FILE_STREAM_H diff --git a/libs/NW4R/include/nw4r/ut/Rect.h b/libs/NW4R/include/nw4r/ut/Rect.h index 1282eab0..25419229 100644 --- a/libs/NW4R/include/nw4r/ut/Rect.h +++ b/libs/NW4R/include/nw4r/ut/Rect.h @@ -8,25 +8,24 @@ namespace nw4r { namespace ut { class Rect { - public: - + public: Rect() : left(), top(), right(), bottom() {} Rect(f32 l, f32 t, f32 r, f32 b) : left(l), top(t), right(r), bottom(b) {} ~Rect() {} - void SetWidth(f32 width) { right = left + width; } - void SetHeight(f32 height) { bottom = top + height; } + void SetWidth(f32 width) { right = left + width; } + void SetHeight(f32 height) { bottom = top + height; } - f32 GetWidth() const { return right - left; } - f32 GetHeight() const { return bottom - top; } + f32 GetWidth() const { return right - left; } + f32 GetHeight() const { return bottom - top; } void MoveTo(f32 x, f32 y) { - right = x + GetWidth(); - left = x; + right = x + GetWidth(); + left = x; - bottom = y + GetHeight(); - top = y; + bottom = y + GetHeight(); + top = y; } void Normalize() { @@ -35,16 +34,16 @@ namespace nw4r { f32 r = right; f32 b = bottom; - left = math::FSelect(r - l, l, r); - right = math::FSelect(r - l, r, l); - top = math::FSelect(b - t, t, b); - bottom = math::FSelect(b - t, b, t); + left = math::FSelect(r - l, l, r); + right = math::FSelect(r - l, r, l); + top = math::FSelect(b - t, t, b); + bottom = math::FSelect(b - t, b, t); } f32 left, top; // 0x00 f32 right, bottom; // 0x08 }; - }; -}; + }; // namespace ut +}; // namespace nw4r -#endif // NW4R_RECT_H +#endif // NW4R_RECT_H diff --git a/libs/NW4R/include/nw4r/ut/ResFont.h b/libs/NW4R/include/nw4r/ut/ResFont.h index 6c6e36cd..23c61a57 100644 --- a/libs/NW4R/include/nw4r/ut/ResFont.h +++ b/libs/NW4R/include/nw4r/ut/ResFont.h @@ -10,80 +10,80 @@ namespace nw4r { namespace ut { namespace detail { class ResFontBase : public Font { - public: - ResFontBase(); - virtual ~ResFontBase(); - - virtual int GetWidth() const; - virtual int GetHeight() const; - - virtual int GetAscent() const; - virtual int GetDescent() const; - - virtual int GetBaselinePos() const; - - virtual int GetCellHeight() const; - virtual int GetCellWidth() const; - - virtual int GetMaxCharWidth() const; - - virtual Type GetType() const; - - virtual GXTexFmt GetTextureFormat() const; - - virtual int GetLineFeed() const; - - virtual CharWidths GetDefaultCharWidths() const; - virtual void SetDefaultCharWidths(const CharWidths& widths); - - virtual bool SetAlternateChar(u16 c); - virtual void SetLineFeed(int linefeed); - - virtual int GetCharWidth(u16 c) const; - virtual CharWidths GetCharWidths(u16 c) const; - - virtual void GetGlyph(Glyph* glyph, u16 c) const; - - virtual FontEncoding GetEncoding() const; - - void SetResourceBuffer(void* pUserBuffer, FontInformation* pFontInfo); - - u16 GetGlyphIndex(u16 c) const; - const CharWidths& GetCharWidthsFromIndex(u16 index) const; - const CharWidths& GetCharWidthsFromIndex(const FontWidth* pWidth, u16 index) const; - void GetGlyphFromIndex(Glyph* glyph, u16 index) const; - - u16 FindGlyphIndex(u16 c) const; - u16 FindGlyphIndex(const FontCodeMap* pMap, u16 c) const; - - bool IsManaging(const void* ptr) const { return mResource == ptr; } - - private: - void* mResource; // 0x10 - FontInformation* mFontInfo; // 0x14 - }; - } - - class ResFont : public detail::ResFontBase { public: - ResFont(); - virtual ~ResFont(); + ResFontBase(); + virtual ~ResFontBase(); - bool SetResource(void* brfnt); - static FontInformation* Rebuild(BinaryFileHeader* fileHeader); + virtual int GetWidth() const; + virtual int GetHeight() const; + + virtual int GetAscent() const; + virtual int GetDescent() const; + + virtual int GetBaselinePos() const; + + virtual int GetCellHeight() const; + virtual int GetCellWidth() const; + + virtual int GetMaxCharWidth() const; + + virtual Type GetType() const; + + virtual GXTexFmt GetTextureFormat() const; + + virtual int GetLineFeed() const; + + virtual CharWidths GetDefaultCharWidths() const; + virtual void SetDefaultCharWidths(const CharWidths& widths); + + virtual bool SetAlternateChar(u16 c); + virtual void SetLineFeed(int linefeed); + + virtual int GetCharWidth(u16 c) const; + virtual CharWidths GetCharWidths(u16 c) const; + + virtual void GetGlyph(Glyph* glyph, u16 c) const; + + virtual FontEncoding GetEncoding() const; + + void SetResourceBuffer(void* pUserBuffer, FontInformation* pFontInfo); + + u16 GetGlyphIndex(u16 c) const; + const CharWidths& GetCharWidthsFromIndex(u16 index) const; + const CharWidths& GetCharWidthsFromIndex(const FontWidth* pWidth, u16 index) const; + void GetGlyphFromIndex(Glyph* glyph, u16 index) const; + + u16 FindGlyphIndex(u16 c) const; + u16 FindGlyphIndex(const FontCodeMap* pMap, u16 c) const; + + bool IsManaging(const void* ptr) const { return mResource == ptr; } private: - static const u32 SIGNATURE_FONT = 'RFNT'; /* Revolution FoNT */ - static const u32 SIGNATURE_FONT_UNPACKED = 'RFNU'; /* Revolution FoNt Unpacked */ - - static const u32 SIGNATURE_FONT_INFO = 'FINF'; /* Font INFormation */ - static const u32 SIGNATURE_TEX_GLYPH = 'TGLP'; /* Texture GLyPh */ - static const u32 SIGNATURE_CHAR_WIDTH = 'CWDH'; /* Character WiDtH */ - static const u32 SIGNATURE_CODE_MAP = 'CMAP'; /* Code MAP */ + void* mResource; // 0x10 + FontInformation* mFontInfo; // 0x14 + }; + } // namespace detail - static const u32 SIGNATURE_GLGR = 'GLGR'; /* Uhhh what is this?.... Something related to GLyPh??? */ + class ResFont : public detail::ResFontBase { + public: + ResFont(); + virtual ~ResFont(); + + bool SetResource(void* brfnt); + static FontInformation* Rebuild(BinaryFileHeader* fileHeader); + + private: + static const u32 SIGNATURE_FONT = 'RFNT'; /* Revolution FoNT */ + static const u32 SIGNATURE_FONT_UNPACKED = 'RFNU'; /* Revolution FoNt Unpacked */ + + static const u32 SIGNATURE_FONT_INFO = 'FINF'; /* Font INFormation */ + static const u32 SIGNATURE_TEX_GLYPH = 'TGLP'; /* Texture GLyPh */ + static const u32 SIGNATURE_CHAR_WIDTH = 'CWDH'; /* Character WiDtH */ + static const u32 SIGNATURE_CODE_MAP = 'CMAP'; /* Code MAP */ + + static const u32 SIGNATURE_GLGR = 'GLGR'; /* Uhhh what is this?.... Something related to GLyPh??? */ }; - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_RES_FONT_H +#endif // NW4R_UT_RES_FONT_H diff --git a/libs/NW4R/include/nw4r/ut/RuntimeTypeInfo.h b/libs/NW4R/include/nw4r/ut/RuntimeTypeInfo.h index 172af626..54f0b5d5 100644 --- a/libs/NW4R/include/nw4r/ut/RuntimeTypeInfo.h +++ b/libs/NW4R/include/nw4r/ut/RuntimeTypeInfo.h @@ -5,45 +5,46 @@ namespace nw4r { namespace ut { - #define NW4R_UT_RUNTIME_TYPEINFO \ - virtual const nw4r::ut::detail::RuntimeTypeInfo* GetRuntimeTypeInfo() const { return &typeInfo; } \ - static const nw4r::ut::detail::RuntimeTypeInfo typeInfo - - #define NW4R_UT_GET_RUNTIME_TYPEINFO(T) \ - const nw4r::ut::detail::RuntimeTypeInfo T::typeInfo(NULL); +#define NW4R_UT_RUNTIME_TYPEINFO \ + virtual const nw4r::ut::detail::RuntimeTypeInfo* GetRuntimeTypeInfo() const { \ + return &typeInfo; \ + } \ + static const nw4r::ut::detail::RuntimeTypeInfo typeInfo - #define NW4R_UT_GET_DERIVED_RUNTIME_TYPEINFO(T, D) \ - const nw4r::ut::detail::RuntimeTypeInfo T::typeInfo(&D::typeInfo); +#define NW4R_UT_GET_RUNTIME_TYPEINFO(T) const nw4r::ut::detail::RuntimeTypeInfo T::typeInfo(NULL); + +#define NW4R_UT_GET_DERIVED_RUNTIME_TYPEINFO(T, D) const nw4r::ut::detail::RuntimeTypeInfo T::typeInfo(&D::typeInfo); namespace detail { struct RuntimeTypeInfo { explicit RuntimeTypeInfo(const RuntimeTypeInfo* base) : mParentTypeInfo(base) {} bool IsDerivedFrom(const RuntimeTypeInfo* base) const { - for (const RuntimeTypeInfo* it = this; it != NULL; - it = it->mParentTypeInfo) { + for (const RuntimeTypeInfo* it = this; it != NULL; it = it->mParentTypeInfo) { if (it == base) { return true; } } return false; } - const RuntimeTypeInfo* mParentTypeInfo; // 0x00 + const RuntimeTypeInfo* mParentTypeInfo; // 0x00 }; - template inline const RuntimeTypeInfo* GetTypeInfoFromPtr_(T* pPtr) { + template + inline const RuntimeTypeInfo* GetTypeInfoFromPtr_(T* pPtr) { return &pPtr->typeInfo; } - } - - template inline TDerived DynamicCast(TBase* pPtr) { + } // namespace detail + + template + inline TDerived DynamicCast(TBase* pPtr) { const detail::RuntimeTypeInfo* pDerivedTypeInfo = detail::GetTypeInfoFromPtr_(static_cast(NULL)); if (pPtr->GetRuntimeTypeInfo()->IsDerivedFrom(pDerivedTypeInfo)) { return static_cast(pPtr); } return NULL; } - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_RUNTIME_TYPE_INFO_H +#endif // NW4R_UT_RUNTIME_TYPE_INFO_H diff --git a/libs/NW4R/include/nw4r/ut/TagProcessor.h b/libs/NW4R/include/nw4r/ut/TagProcessor.h index 4d04f5a1..b2df2ae0 100644 --- a/libs/NW4R/include/nw4r/ut/TagProcessor.h +++ b/libs/NW4R/include/nw4r/ut/TagProcessor.h @@ -5,8 +5,8 @@ namespace nw4r { namespace ut { - typedef TagProcessorBase TagProcessor; + typedef TagProcessorBase TagProcessor; } -} +} // namespace nw4r -#endif // NW4R_UT_TAG_PROCESSOR_H +#endif // NW4R_UT_TAG_PROCESSOR_H diff --git a/libs/NW4R/include/nw4r/ut/TagProcessorBase.h b/libs/NW4R/include/nw4r/ut/TagProcessorBase.h index a08fa2b2..52e28b67 100644 --- a/libs/NW4R/include/nw4r/ut/TagProcessorBase.h +++ b/libs/NW4R/include/nw4r/ut/TagProcessorBase.h @@ -17,30 +17,33 @@ namespace nw4r { NUM_OF_OPERATION } Operation; - template class TextWriterBase; + template + class TextWriterBase; - template struct PrintContext { - TextWriterBase* writer; // 0x00 - const T* str; // 0x04 + template + struct PrintContext { + TextWriterBase* writer; // 0x00 + const T* str; // 0x04 - f32 xOrigin; // 0x08 - f32 yOrigin; // 0x0c + f32 xOrigin; // 0x08 + f32 yOrigin; // 0x0c - u32 flags; // 0x10 + u32 flags; // 0x10 }; - template class TagProcessorBase { - public: - TagProcessorBase(); - virtual ~TagProcessorBase(); + template + class TagProcessorBase { + public: + TagProcessorBase(); + virtual ~TagProcessorBase(); - virtual Operation Process(u16 code, PrintContext* context); - virtual Operation CalcRect(Rect* pRect, u16 code, PrintContext* context); + virtual Operation Process(u16 code, PrintContext* context); + virtual Operation CalcRect(Rect* pRect, u16 code, PrintContext* context); - void ProcessLinefeed(PrintContext* context); - void ProcessTab(PrintContext* context); + void ProcessLinefeed(PrintContext* context); + void ProcessTab(PrintContext* context); }; - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_TAG_PROCESSOR_BASE_H +#endif // NW4R_UT_TAG_PROCESSOR_BASE_H diff --git a/libs/NW4R/include/nw4r/ut/TextWriter.h b/libs/NW4R/include/nw4r/ut/TextWriter.h index 735b14ad..47e7f611 100644 --- a/libs/NW4R/include/nw4r/ut/TextWriter.h +++ b/libs/NW4R/include/nw4r/ut/TextWriter.h @@ -5,8 +5,8 @@ namespace nw4r { namespace ut { - typedef TextWriterBase TextWriter; + typedef TextWriterBase TextWriter; } -} +} // namespace nw4r -#endif // NW4R_UT_TEXT_WRITER_H +#endif // NW4R_UT_TEXT_WRITER_H diff --git a/libs/NW4R/include/nw4r/ut/TextWriterBase.h b/libs/NW4R/include/nw4r/ut/TextWriterBase.h index 3bd1916c..cfedb55e 100644 --- a/libs/NW4R/include/nw4r/ut/TextWriterBase.h +++ b/libs/NW4R/include/nw4r/ut/TextWriterBase.h @@ -3,11 +3,11 @@ #include -#include #include +#include -#include #include +#include #include @@ -17,125 +17,118 @@ namespace nw4r { namespace ut { - template class TextWriterBase : public CharWriter { - public: - enum DrawFlag { - // Align text lines - DRAWFLAG_ALIGN_TEXT_BASELINE = 0, - DRAWFLAG_ALIGN_TEXT_CENTER = (1 << 0), - DRAWFLAG_ALIGN_TEXT_RIGHT = (1 << 1), - - // Align text block (horizontal) - DRAWFLAG_ALIGN_H_BASELINE = 0, - DRAWFLAG_ALIGN_H_CENTER = (1 << 4), - DRAWFLAG_ALIGN_H_RIGHT = (1 << 5), - - // Align text block (vertical) - DRAWFLAG_ALIGN_V_BASELINE = 0, - DRAWFLAG_ALIGN_V_CENTER = (1 << 8), - DRAWFLAG_ALIGN_V_TOP = (1 << 9), - - // Mask constants - DRAWFLAG_MASK_ALIGN_TEXT = DRAWFLAG_ALIGN_TEXT_BASELINE | - DRAWFLAG_ALIGN_TEXT_CENTER | - DRAWFLAG_ALIGN_TEXT_RIGHT, - - DRAWFLAG_MASK_ALIGN_H = DRAWFLAG_ALIGN_H_BASELINE | - DRAWFLAG_ALIGN_H_CENTER | - DRAWFLAG_ALIGN_H_RIGHT, - - DRAWFLAG_MASK_ALIGN_V = DRAWFLAG_ALIGN_V_BASELINE | - DRAWFLAG_ALIGN_V_CENTER | DRAWFLAG_ALIGN_V_TOP, - }; - TextWriterBase(); - ~TextWriterBase(); + template + class TextWriterBase : public CharWriter { + public: + enum DrawFlag { + // Align text lines + DRAWFLAG_ALIGN_TEXT_BASELINE = 0, + DRAWFLAG_ALIGN_TEXT_CENTER = (1 << 0), + DRAWFLAG_ALIGN_TEXT_RIGHT = (1 << 1), - void SetLineHeight(f32 lineHeight); - f32 GetLineHeight() const; + // Align text block (horizontal) + DRAWFLAG_ALIGN_H_BASELINE = 0, + DRAWFLAG_ALIGN_H_CENTER = (1 << 4), + DRAWFLAG_ALIGN_H_RIGHT = (1 << 5), - void SetLineSpace(f32 lineSpace); - void SetCharSpace(f32 charSpace); + // Align text block (vertical) + DRAWFLAG_ALIGN_V_BASELINE = 0, + DRAWFLAG_ALIGN_V_CENTER = (1 << 8), + DRAWFLAG_ALIGN_V_TOP = (1 << 9), - f32 GetLineSpace() const; - f32 GetCharSpace() const; + // Mask constants + DRAWFLAG_MASK_ALIGN_TEXT = DRAWFLAG_ALIGN_TEXT_BASELINE | DRAWFLAG_ALIGN_TEXT_CENTER | DRAWFLAG_ALIGN_TEXT_RIGHT, - void SetTabWidth(int tabWidth); - int GetTabWidth() const; + DRAWFLAG_MASK_ALIGN_H = DRAWFLAG_ALIGN_H_BASELINE | DRAWFLAG_ALIGN_H_CENTER | DRAWFLAG_ALIGN_H_RIGHT, - void SetDrawFlag(u32 flags); - u32 GetDrawFlag() const; + DRAWFLAG_MASK_ALIGN_V = DRAWFLAG_ALIGN_V_BASELINE | DRAWFLAG_ALIGN_V_CENTER | DRAWFLAG_ALIGN_V_TOP, + }; + TextWriterBase(); + ~TextWriterBase(); - void SetTagProcessor(TagProcessorBase* tagProcessor); - void ResetTagProcessor(); - TagProcessorBase& GetTagProcessor() const; + void SetLineHeight(f32 lineHeight); + f32 GetLineHeight() const; - f32 CalcFormatStringWidth(const T* format, ...) const; - f32 CalcFormatStringHeight(const T* format, ...) const; + void SetLineSpace(f32 lineSpace); + void SetCharSpace(f32 charSpace); - void CalcFormatStringRect(Rect* pRect, const T* format, ...) const; - void CalcVStringRect(Rect* pRect, const T* format, va_list args) const; + f32 GetLineSpace() const; + f32 GetCharSpace() const; - f32 CalcStringWidth(const T* str, int length) const; - f32 CalcStringWidth(const T* str) const; + void SetTabWidth(int tabWidth); + int GetTabWidth() const; - f32 CalcStringHeight(const T* str, int length) const; - f32 CalcStringHeight(const T* str) const; + void SetDrawFlag(u32 flags); + u32 GetDrawFlag() const; - void CalcStringRect(Rect* pRect, const T* str, int length) const; - void CalcStringRect(Rect* pRect, const T* str) const; + void SetTagProcessor(TagProcessorBase* tagProcessor); + void ResetTagProcessor(); + TagProcessorBase& GetTagProcessor() const; - f32 PrintMutable(const T* str, int length); - f32 Printf(const T* format, ...); - f32 VPrintf(const T* format, va_list args); - f32 Print(const T* str, int length); - f32 Print(const T* str); + f32 CalcFormatStringWidth(const T* format, ...) const; + f32 CalcFormatStringHeight(const T* format, ...) const; - static T* SetBuffer(T* buf, u32 size); - static T* SetBuffer(u32 size); + void CalcFormatStringRect(Rect* pRect, const T* format, ...) const; + void CalcVStringRect(Rect* pRect, const T* format, va_list args) const; - static u32 GetBufferSize(); - static T* GetBuffer(); + f32 CalcStringWidth(const T* str, int length) const; + f32 CalcStringWidth(const T* str) const; - static int VSNPrintf(T* buffer, u32 count, const T* format, va_list arg) { - return sizeof(T) == sizeof(char) ? vsnprintf((char*)buffer, count, (const char*)format, arg) : vswprintf((wchar_t*)buffer, count, (const wchar_t*)format, arg); - } - static int StrLen(const T* str) { - return sizeof(T) == sizeof(char) ? strlen((const char*)str) : wcslen((const wchar_t*)str); - } + f32 CalcStringHeight(const T* str, int length) const; + f32 CalcStringHeight(const T* str) const; - f32 CalcLineWidth(const T* str, int length); - int CalcLineRectImpl(Rect* pRect, const T* str, int length); - void CalcStringRectImpl(Rect* pRect, const T* str, int length); + void CalcStringRect(Rect* pRect, const T* str, int length) const; + void CalcStringRect(Rect* pRect, const T* str) const; - f32 PrintImpl(const T* str, int length); + f32 PrintMutable(const T* str, int length); + f32 Printf(const T* format, ...); + f32 VPrintf(const T* format, va_list args); + f32 Print(const T* str, int length); + f32 Print(const T* str); - f32 AdjustCursor(f32* xOrigin, f32* yOrigin, const T* str, int length); + static T* SetBuffer(T* buf, u32 size); + static T* SetBuffer(u32 size); - bool IsDrawFlagSet(u32 mask, u32 flag) const { return (mDrawFlag& mask) == flag; } + static u32 GetBufferSize(); + static T* GetBuffer(); - private: - f32 mCharSpace; // 0x4C - f32 mLineSpace; // 0x50 + static int VSNPrintf(T* buffer, u32 count, const T* format, va_list arg) { + return sizeof(T) == sizeof(char) ? vsnprintf((char*)buffer, count, (const char*)format, arg) : + vswprintf((wchar_t*)buffer, count, (const wchar_t*)format, arg); + } + static int StrLen(const T* str) { return sizeof(T) == sizeof(char) ? strlen((const char*)str) : wcslen((const wchar_t*)str); } - int mTabWidth; // 0x54 + f32 CalcLineWidth(const T* str, int length); + int CalcLineRectImpl(Rect* pRect, const T* str, int length); + void CalcStringRectImpl(Rect* pRect, const T* str, int length); - u32 mDrawFlag; // 0x58 + f32 PrintImpl(const T* str, int length); - TagProcessorBase* mTagProcessor; // 0x5C + f32 AdjustCursor(f32* xOrigin, f32* yOrigin, const T* str, int length); - private: - static T* mFormatBuffer; - static u32 mFormatBufferSize; + bool IsDrawFlagSet(u32 mask, u32 flag) const { return (mDrawFlag & mask) == flag; } - static TagProcessorBase mDefaultTagProcessor; + private: + f32 mCharSpace; // 0x4C + f32 mLineSpace; // 0x50 - static const int DEFAULT_FORMAT_BUFFER_SIZE = 256; + int mTabWidth; // 0x54 - static const u32 DRAWFLAG_MASK_ALL = DRAWFLAG_MASK_ALIGN_TEXT | - DRAWFLAG_MASK_ALIGN_H | - DRAWFLAG_MASK_ALIGN_V; + u32 mDrawFlag; // 0x58 + + TagProcessorBase* mTagProcessor; // 0x5C + + private: + static T* mFormatBuffer; + static u32 mFormatBufferSize; + + static TagProcessorBase mDefaultTagProcessor; + + static const int DEFAULT_FORMAT_BUFFER_SIZE = 256; + + static const u32 DRAWFLAG_MASK_ALL = DRAWFLAG_MASK_ALIGN_TEXT | DRAWFLAG_MASK_ALIGN_H | DRAWFLAG_MASK_ALIGN_V; }; - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_TEXT_WRITER_BASE_H +#endif // NW4R_UT_TEXT_WRITER_BASE_H diff --git a/libs/NW4R/include/nw4r/ut/WideTagProcessor.h b/libs/NW4R/include/nw4r/ut/WideTagProcessor.h index 081d7984..37d75a7a 100644 --- a/libs/NW4R/include/nw4r/ut/WideTagProcessor.h +++ b/libs/NW4R/include/nw4r/ut/WideTagProcessor.h @@ -5,8 +5,8 @@ namespace nw4r { namespace ut { - typedef TagProcessorBase WideTagProcessor; + typedef TagProcessorBase WideTagProcessor; } -} +} // namespace nw4r -#endif // NW4R_UT_WIDE_TAG_PROCESSOR_H +#endif // NW4R_UT_WIDE_TAG_PROCESSOR_H diff --git a/libs/NW4R/include/nw4r/ut/WideTextWriter.h b/libs/NW4R/include/nw4r/ut/WideTextWriter.h index 5efa7527..d4a4219c 100644 --- a/libs/NW4R/include/nw4r/ut/WideTextWriter.h +++ b/libs/NW4R/include/nw4r/ut/WideTextWriter.h @@ -7,6 +7,6 @@ namespace nw4r { namespace ut { typedef TextWriterBase WideTextWriter; } -} +} // namespace nw4r -#endif // NW4R_UT_WIDE_TEXT_WRITER_H +#endif // NW4R_UT_WIDE_TEXT_WRITER_H diff --git a/libs/NW4R/include/nw4r/ut/binaryFileFormat.h b/libs/NW4R/include/nw4r/ut/binaryFileFormat.h index 69b2f4aa..e3e5c681 100644 --- a/libs/NW4R/include/nw4r/ut/binaryFileFormat.h +++ b/libs/NW4R/include/nw4r/ut/binaryFileFormat.h @@ -10,19 +10,19 @@ namespace nw4r { u16 byteOrder; // 0x04 u16 version; // 0x06 - u32 fileSize; // 0x08 - u16 headerSize; // 0x0C + u32 fileSize; // 0x08 + u16 headerSize; // 0x0C - u16 dataBlocks; // 0x0E + u16 dataBlocks; // 0x0E } BinaryFileHeader; typedef struct BinaryBlockHeader { - u32 kind; // 0x00 - u32 size; // 0x04 + u32 kind; // 0x00 + u32 size; // 0x04 } BinaryBlockHeader; bool IsValidBinaryFile(const BinaryFileHeader* header, u32 signature, u16 version, u16 minBlocks); - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_BINARY_FILE_FORMAT_H +#endif // NW4R_UT_BINARY_FILE_FORMAT_H diff --git a/libs/NW4R/include/nw4r/ut/fontResources.h b/libs/NW4R/include/nw4r/ut/fontResources.h index 288a5110..5c218ba2 100644 --- a/libs/NW4R/include/nw4r/ut/fontResources.h +++ b/libs/NW4R/include/nw4r/ut/fontResources.h @@ -8,83 +8,83 @@ namespace nw4r { namespace ut { typedef struct CharWidths { - s8 left; // 0x00 - u8 glyphWidth; // 0x01 - s8 charWidth; // 0x02 + s8 left; // 0x00 + u8 glyphWidth; // 0x01 + s8 charWidth; // 0x02 } CharWidths; typedef struct FontWidth { - u16 indexBegin; // 0x00 - u16 indexEnd; // 0x02 + u16 indexBegin; // 0x00 + u16 indexEnd; // 0x02 - FontWidth* pNext; // 0x04 - CharWidths widthTable[]; // 0x08 + FontWidth* pNext; // 0x04 + CharWidths widthTable[]; // 0x08 } FontWidth; typedef struct Glyph { - void* pTexture; // 0x00 + void* pTexture; // 0x00 - CharWidths widths; // 0x04 - u8 height; // 0x07 + CharWidths widths; // 0x04 + u8 height; // 0x07 - GXTexFmt texFormat; // 0x08 - u16 texWidth; // 0x0C - u16 texHeight; // 0x0E + GXTexFmt texFormat; // 0x08 + u16 texWidth; // 0x0C + u16 texHeight; // 0x0E - u16 cellX; // 0x10 - u16 cellY; // 0x12 + u16 cellX; // 0x10 + u16 cellY; // 0x12 } Glyph; typedef struct FontTextureGlyph { - u8 cellWidth; // 0x00 - u8 cellHeight; // 0x01 + u8 cellWidth; // 0x00 + u8 cellHeight; // 0x01 - s8 baselinePos; // 0x02 + s8 baselinePos; // 0x02 - u8 maxCharWidth; // 0x03 + u8 maxCharWidth; // 0x03 - u32 sheetSize; // 0x04 - u16 sheetNum; // 0x08 - u16 sheetFormat; // 0x0A - u16 sheetRow; // 0x0C - u16 sheetLine; // 0x0E - u16 sheetWidth; // 0x10 - u16 sheetHeight; // 0x12 - u8* sheetImage; // 0x14 + u32 sheetSize; // 0x04 + u16 sheetNum; // 0x08 + u16 sheetFormat; // 0x0A + u16 sheetRow; // 0x0C + u16 sheetLine; // 0x0E + u16 sheetWidth; // 0x10 + u16 sheetHeight; // 0x12 + u8* sheetImage; // 0x14 } FontTextureGlyph; typedef struct FontCodeMap { - u16 ccodeBegin; // 0x00 - u16 ccodeEnd; // 0x02 + u16 ccodeBegin; // 0x00 + u16 ccodeEnd; // 0x02 - u16 mappingMethod; // 0x04 + u16 mappingMethod; // 0x04 - u16 reserved; // 0x06 + u16 reserved; // 0x06 - FontCodeMap* pNext; // 0x08 + FontCodeMap* pNext; // 0x08 - u16 mapInfo[]; // 0x0C + u16 mapInfo[]; // 0x0C } FontCodeMap; typedef struct FontInformation { - u8 fontType; // 0x00 - s8 linefeed; // 0x01 + u8 fontType; // 0x00 + s8 linefeed; // 0x01 - u16 alterCharIndex; // 0x02 + u16 alterCharIndex; // 0x02 - CharWidths defaultWidth; // 0x04 - u8 encoding; // 0x07 + CharWidths defaultWidth; // 0x04 + u8 encoding; // 0x07 - FontTextureGlyph* pGlyph; // 0x08 - FontWidth* pWidth; // 0x0C - FontCodeMap* pMap; // 0x10 + FontTextureGlyph* pGlyph; // 0x08 + FontWidth* pWidth; // 0x0C + FontCodeMap* pMap; // 0x10 - u8 height; // 0x14 - u8 width; // 0x15 - u8 ascent; // 0x16 - u8 padding_[1]; // 0x17 + u8 height; // 0x14 + u8 width; // 0x15 + u8 ascent; // 0x16 + u8 padding_[1]; // 0x17 } FontInformation; - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_FONT_RESOURCES_H +#endif // NW4R_UT_FONT_RESOURCES_H diff --git a/libs/NW4R/include/nw4r/ut/inlines.h b/libs/NW4R/include/nw4r/ut/inlines.h index 3128b26b..3929252b 100644 --- a/libs/NW4R/include/nw4r/ut/inlines.h +++ b/libs/NW4R/include/nw4r/ut/inlines.h @@ -6,75 +6,87 @@ namespace nw4r { namespace ut { class NonCopyable { - protected: - NonCopyable() {} - ~NonCopyable() {} - private: - NonCopyable(const NonCopyable&); - const NonCopyable& operator=(const NonCopyable&); + protected: + NonCopyable() {} + ~NonCopyable() {} + + private: + NonCopyable(const NonCopyable&); + const NonCopyable& operator=(const NonCopyable&); }; - template inline T Min(T a, T b) { + template + inline T Min(T a, T b) { return (a > b) ? b : a; } - template inline T Max(T a, T b) { + template + inline T Max(T a, T b) { return (a < b) ? b : a; } - template inline T Clamp(T x, T low, T high) { + template + inline T Clamp(T x, T low, T high) { return (x > high) ? high : ((x < low) ? low : x); } - template inline T Abs(T x) { + template + inline T Abs(T x) { // Static cast needed to break abs optimization return x < 0 ? static_cast(-x) : static_cast(x); } - template inline T BitExtract(T bits, int pos, int len) { + template + inline T BitExtract(T bits, int pos, int len) { T mask = (1 << len) - 1; - return (bits >> pos)& mask; + return (bits >> pos) & mask; } inline u32 GetIntPtr(const void* pPtr) { return reinterpret_cast(pPtr); } - - template inline const void* AddOffsetToPtr(const void* base, T offset) { + + template + inline const void* AddOffsetToPtr(const void* base, T offset) { return reinterpret_cast(GetIntPtr(base) + offset); } - template inline void* AddOffsetToPtr(void* base, T offset) { + template + inline void* AddOffsetToPtr(void* base, T offset) { return reinterpret_cast(GetIntPtr(base) + offset); } - + inline s32 GetOffsetFromPtr(const void* start, const void* end) { return static_cast(GetIntPtr(end) - GetIntPtr(start)); } - + inline int ComparePtr(const void* pPtr1, const void* pPtr2) { return static_cast(GetIntPtr(pPtr1) - GetIntPtr(pPtr2)); } - template inline T RoundUp(T t, u32 alignment) { - return (alignment + t - 1)& ~(alignment - 1); + template + inline T RoundUp(T t, u32 alignment) { + return (alignment + t - 1) & ~(alignment - 1); } - - template inline void* RoundUp(T* pPtr, u32 alignment) { - u32 value = reinterpret_cast(pPtr); - u32 rounded = (alignment + value - 1)& ~(alignment - 1); - return reinterpret_cast(rounded); - } - - template inline T RoundDown(T t, u32 alignment) { - return t& ~(alignment - 1); - } - - template inline void* RoundDown(T* pPtr, u32 alignment) { - u32 value = reinterpret_cast(pPtr); - u32 rounded = value& ~(alignment - 1); - return reinterpret_cast(rounded); - } - } -} -#endif // NW4R_UT_INLINE_FUNCTIONS_H + template + inline void* RoundUp(T* pPtr, u32 alignment) { + u32 value = reinterpret_cast(pPtr); + u32 rounded = (alignment + value - 1) & ~(alignment - 1); + return reinterpret_cast(rounded); + } + + template + inline T RoundDown(T t, u32 alignment) { + return t & ~(alignment - 1); + } + + template + inline void* RoundDown(T* pPtr, u32 alignment) { + u32 value = reinterpret_cast(pPtr); + u32 rounded = value & ~(alignment - 1); + return reinterpret_cast(rounded); + } + } // namespace ut +} // namespace nw4r + +#endif // NW4R_UT_INLINE_FUNCTIONS_H diff --git a/libs/NW4R/include/nw4r/ut/list.h b/libs/NW4R/include/nw4r/ut/list.h index 667b5141..f798a6d2 100644 --- a/libs/NW4R/include/nw4r/ut/list.h +++ b/libs/NW4R/include/nw4r/ut/list.h @@ -6,24 +6,24 @@ namespace nw4r { namespace ut { typedef struct Link { - void* prevObject; // 0x00 - void* nextObject; // 0x04 + void* prevObject; // 0x00 + void* nextObject; // 0x04 } Link; - - typedef struct List { - void* headObject; // 0x00 - void* tailObject; // 0x04 - u16 numObjects; // 0x08 - u16 offset; // 0x0A + typedef struct List { + void* headObject; // 0x00 + void* tailObject; // 0x04 + u16 numObjects; // 0x08 + + u16 offset; // 0x0A } List; - + void List_Init(List* list, u16 offset); void List_Append(List* list, void* object); void List_Prepend(List* list, void* object); void List_Insert(List* list, void* target, void* object); void List_Remove(List* list, void* object); - + void* List_GetNext(const List* list, const void* object); void* List_GetPrev(const List* list, const void* object); void* List_GetNth(const List* list, u16 index); @@ -35,11 +35,11 @@ namespace nw4r { static void* List_GetLast(const List* list) { return List_GetPrev(list, NULL); } - + static u16 List_GetSize(const List* list) { return list->numObjects; } - } -} + } // namespace ut +} // namespace nw4r -#endif // NW4R_UT_LIST_H +#endif // NW4R_UT_LIST_H diff --git a/libs/NW4R/src/db/db_console.cpp b/libs/NW4R/src/db/db_console.cpp index 36f9fd29..b6cfb339 100644 --- a/libs/NW4R/src/db/db_console.cpp +++ b/libs/NW4R/src/db/db_console.cpp @@ -7,13 +7,13 @@ namespace nw4r { namespace db { - static OSMutex sMutex; + static OSMutex sMutex; - static u8 sStrBuf[1024]; + static u8 sStrBuf[1024]; - static ConsoleHandle sConsoleList; + static ConsoleHandle sConsoleList; - static bool sInitialized = false; + static bool sInitialized = false; static inline u8* GetTextPtr_(ConsoleHandle console, u16 line, u16 xPos) { return console->textBuf + xPos + (console->width + 1) * line; @@ -58,11 +58,11 @@ namespace nw4r { } static void TerminateLine_(ConsoleHandle console); - static u8* NextLine_(ConsoleHandle console); - static u8* PutTab_(ConsoleHandle console, u8* dstPtr); - static u32 GetTabSize_(ConsoleHandle console); - static u32 PutChar_(ConsoleHandle console, const u8* str, u8* dstPtr); - static u32 CodeWidth_(const u8* p); + static u8* NextLine_(ConsoleHandle console); + static u8* PutTab_(ConsoleHandle console, u8* dstPtr); + static u32 GetTabSize_(ConsoleHandle console); + static u32 PutChar_(ConsoleHandle console, const u8* str, u8* dstPtr); + static u32 CodeWidth_(const u8* p); static void DoDrawString_(ConsoleHandle console, u32 printLine, const u8* str, ut::TextWriter* writer); static void DoDrawConsole_(ConsoleHandle console, ut::TextWriter* writer); @@ -95,8 +95,7 @@ namespace nw4r { if (cursor == NULL) { console->next = sConsoleList; sConsoleList = console; - } - else { + } else { console->next = cursor->next; cursor->next = console; } @@ -152,7 +151,7 @@ namespace nw4r { console->printTop++; console->printTopUsed = 0; - if (console->printTop == console->height && !(console->attr & (1<<1))) { + if (console->printTop == console->height && !(console->attr & (1 << 1))) { console->printTop = 0; } @@ -201,8 +200,7 @@ namespace nw4r { static void DoDrawString_(ConsoleHandle console, u32 printLine, const u8* str, ut::TextWriter* writer) { if (writer) { writer->Printf("%s\n", str); - } - else { + } else { s32 height = (s32)((u32)console->viewPosY + printLine * 10); DirectPrint_DrawString(console->viewPosX, height, false, "%s\n", str); } @@ -219,8 +217,7 @@ namespace nw4r { if (viewOffset < 0) { viewOffset = 0; - } - else if (viewOffset > GetActiveLines_(console)) { + } else if (viewOffset > GetActiveLines_(console)) { goto end; } @@ -245,7 +242,7 @@ namespace nw4r { line++; if (line == console->height) { - if (console->attr & (1<<1)) { + if (console->attr & (1 << 1)) { goto end; } line = 0; @@ -299,16 +296,14 @@ namespace nw4r { str++; storePtr = PutTab_(console, storePtr); console->printTopUsed = 1; - } - else { + } else { u32 bytes = PutChar_(console, str, storePtr); if (bytes) { str += bytes; storePtr += bytes; console->printTopUsed = 1; - } - else { + } else { newLineFlag = true; } } @@ -369,5 +364,5 @@ namespace nw4r { return count; } - } -} + } // namespace db +} // namespace nw4r diff --git a/libs/NW4R/src/db/db_directPrint.cpp b/libs/NW4R/src/db/db_directPrint.cpp index f0d11e8e..abed627b 100644 --- a/libs/NW4R/src/db/db_directPrint.cpp +++ b/libs/NW4R/src/db/db_directPrint.cpp @@ -1,31 +1,31 @@ #include -#include #include +#include #include #include #include typedef struct FrameBufferInfo { - u8* frameMemory; // 0x00 - u32 frameSize; // 0x04 - u16 frameWidth; // 0x08 - u16 frameHeight; // 0x0A - u16 frameRow; // 0x0C - u16 reserved; // 0x0E + u8* frameMemory; // 0x00 + u32 frameSize; // 0x04 + u16 frameWidth; // 0x08 + u16 frameHeight; // 0x0A + u16 frameRow; // 0x0C + u16 reserved; // 0x0E } FrameBufferInfo; typedef struct YUVColorInfo { GXColor colorRGBA; // 0x00 - u16 colorY256; // 0x04 - u16 colorU; // 0x06 - u16 colorU2; // 0x08 - u16 colorU4; // 0x0A - u16 colorV; // 0x0C - u16 colorV2; // 0x0E - u16 colorV4; // 0x10 - u16 reserved; // 0x12 + u16 colorY256; // 0x04 + u16 colorU; // 0x06 + u16 colorU2; // 0x08 + u16 colorU4; // 0x0A + u16 colorV; // 0x0C + u16 colorV2; // 0x0E + u16 colorV4; // 0x10 + u16 reserved; // 0x12 } YUVColorInfo; namespace nw4r { @@ -50,83 +50,51 @@ namespace nw4r { return len; } - static void DrawStringToXfb_(int posh, int posv, const char* str, bool turnOver, bool backErase); - static const char* DrawStringLineToXfb_(int posh, int posv, const char* str, int width); - static void DrawCharToXfb_(int posh, int posv, int code); + static void DrawStringToXfb_(int posh, int posv, const char* str, bool turnOver, bool backErase); + static const char* DrawStringLineToXfb_(int posh, int posv, const char* str, int width); + static void DrawCharToXfb_(int posh, int posv, int code); namespace detail { - static void WaitVIRetrace_(); - static void* CreateFB_(const GXRenderModeObj* rmode); - } + static void WaitVIRetrace_(); + static void* CreateFB_(const GXRenderModeObj* rmode); + } // namespace detail static const u8 sAsciiTable[128] = { - 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, - 0x7A, 0xFD, 0xFE, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0x29, 0x64, 0x65, 0x66, 0x2B, 0x67, 0x68, - 0x25, 0x26, 0x69, 0x2A, 0x6A, 0x27, 0x2C, 0x6B, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x24, 0x6C, 0x6D, 0x6E, 0x6F, 0x28, - 0x70, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, - 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, - 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, - 0x21, 0x22, 0x23, 0x71, 0x72, 0x73, 0x74, 0x75, - 0xFF, 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83, - 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, - 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, - 0x94, 0x95, 0x96, 0x76, 0x77, 0x78, 0x79, 0x7A - }; + 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0xFD, 0xFE, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x29, 0x64, 0x65, 0x66, 0x2B, 0x67, 0x68, 0x25, 0x26, 0x69, 0x2A, + 0x6A, 0x27, 0x2C, 0x6B, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x24, 0x6C, 0x6D, 0x6E, 0x6F, 0x28, 0x70, 0x0A, + 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, + 0x21, 0x22, 0x23, 0x71, 0x72, 0x73, 0x74, 0x75, 0xFF, 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, + 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x76, 0x77, 0x78, 0x79, 0x7A}; static const u32 sFontData[64] = { - 0x70871C30, 0x8988A250, 0x88808290, 0x88830C90, - 0x888402F8, 0x88882210, 0x71CF9C10, 0xF9CF9C70, - 0x8208A288, 0xF200A288, 0x0BC11C78, 0x0A222208, - 0x8A222208, 0x71C21C70, 0x23C738F8, 0x5228A480, - 0x8A282280, 0x8BC822F0, 0xFA282280, 0x8A28A480, - 0x8BC738F8, 0xF9C89C08, 0x82288808, 0x82088808, - 0xF2EF8808, 0x82288888, 0x82288888, 0x81C89C70, - 0x8A08A270, 0x920DA288, 0xA20AB288, 0xC20AAA88, - 0xA208A688, 0x9208A288, 0x8BE8A270, 0xF1CF1CF8, - 0x8A28A220, 0x8A28A020, 0xF22F1C20, 0x82AA0220, - 0x82492220, 0x81A89C20, 0x8A28A288, 0x8A28A288, - 0x8A289488, 0x8A2A8850, 0x894A9420, 0x894AA220, - 0x70852220, 0xF8011000, 0x08020800, 0x10840400, - 0x20040470, 0x40840400, 0x80020800, 0xF8011000, - 0x70800000, 0x88822200, 0x08820400, 0x108F8800, - 0x20821000, 0x00022200, 0x20800020, 0x00000000 - }; + 0x70871C30, 0x8988A250, 0x88808290, 0x88830C90, 0x888402F8, 0x88882210, 0x71CF9C10, 0xF9CF9C70, 0x8208A288, 0xF200A288, 0x0BC11C78, + 0x0A222208, 0x8A222208, 0x71C21C70, 0x23C738F8, 0x5228A480, 0x8A282280, 0x8BC822F0, 0xFA282280, 0x8A28A480, 0x8BC738F8, 0xF9C89C08, + 0x82288808, 0x82088808, 0xF2EF8808, 0x82288888, 0x82288888, 0x81C89C70, 0x8A08A270, 0x920DA288, 0xA20AB288, 0xC20AAA88, 0xA208A688, + 0x9208A288, 0x8BE8A270, 0xF1CF1CF8, 0x8A28A220, 0x8A28A020, 0xF22F1C20, 0x82AA0220, 0x82492220, 0x81A89C20, 0x8A28A288, 0x8A28A288, + 0x8A289488, 0x8A2A8850, 0x894A9420, 0x894AA220, 0x70852220, 0xF8011000, 0x08020800, 0x10840400, 0x20040470, 0x40840400, 0x80020800, + 0xF8011000, 0x70800000, 0x88822200, 0x08820400, 0x108F8800, 0x20821000, 0x00022200, 0x20800020, 0x00000000}; static const u32 sFontData2[77] = { - 0x51421820, 0x53E7A420, 0x014A2C40, 0x01471000, - 0x0142AA00, 0x03EAA400, 0x01471A78, 0x00000000, - 0x50008010, 0x20010820, 0xF8020040, 0x20420820, - 0x50441010, 0x00880000, 0x00070E00, 0x01088840, - 0x78898820, 0x004A8810, 0x788A8810, 0x01098808, - 0x00040E04, 0x70800620, 0x11400820, 0x12200820, - 0x10001020, 0x10000820, 0x100F8820, 0x70000620, - 0x60070000, 0x110F82A0, 0x12AA8AE0, 0x084F92A0, - 0x100FBE1C, 0x10089008, 0x60070808, 0x00000000, - 0x02000200, 0x7A078270, 0x8BC81E88, 0x8A2822F8, - 0x9A282280, 0x6BC79E78, 0x30000000, 0x48080810, - 0x41E80000, 0x422F1830, 0xFBE88810, 0x40288890, - 0x43C89C60, 0x81000000, 0x81000000, 0x990F3C70, - 0xA10AA288, 0xE10AA288, 0xA10AA288, 0x98CAA270, - 0x00000000, 0x00000020, 0xF1EF1E20, 0x8A28A0F8, - 0x8A281C20, 0xF1E80220, 0x80283C38, 0x00000000, - 0x00000000, 0x8A28B688, 0x8A2A8888, 0x8A2A8878, - 0x894A8808, 0x788536F0, 0x00000000, 0x00000000, - 0xF8000000, 0x10000000, 0x20000000, 0x40000000, - 0xF8000000 - }; + 0x51421820, 0x53E7A420, 0x014A2C40, 0x01471000, 0x0142AA00, 0x03EAA400, 0x01471A78, 0x00000000, 0x50008010, 0x20010820, 0xF8020040, + 0x20420820, 0x50441010, 0x00880000, 0x00070E00, 0x01088840, 0x78898820, 0x004A8810, 0x788A8810, 0x01098808, 0x00040E04, 0x70800620, + 0x11400820, 0x12200820, 0x10001020, 0x10000820, 0x100F8820, 0x70000620, 0x60070000, 0x110F82A0, 0x12AA8AE0, 0x084F92A0, 0x100FBE1C, + 0x10089008, 0x60070808, 0x00000000, 0x02000200, 0x7A078270, 0x8BC81E88, 0x8A2822F8, 0x9A282280, 0x6BC79E78, 0x30000000, 0x48080810, + 0x41E80000, 0x422F1830, 0xFBE88810, 0x40288890, 0x43C89C60, 0x81000000, 0x81000000, 0x990F3C70, 0xA10AA288, 0xE10AA288, 0xA10AA288, + 0x98CAA270, 0x00000000, 0x00000020, 0xF1EF1E20, 0x8A28A0F8, 0x8A281C20, 0xF1E80220, 0x80283C38, 0x00000000, 0x00000000, 0x8A28B688, + 0x8A2A8888, 0x8A2A8878, 0x894A8808, 0x788536F0, 0x00000000, 0x00000000, 0xF8000000, 0x10000000, 0x20000000, 0x40000000, 0xF8000000}; - static FrameBufferInfo sFrameBufferInfo; - static YUVColorInfo sFrameBufferColor; + static FrameBufferInfo sFrameBufferInfo; + static YUVColorInfo sFrameBufferColor; static BOOL sInitialized = false; - static inline int GetDotWidth_() { return sFrameBufferInfo.frameWidth < 400 ? 1 : 2; } - static inline int GetDotHeight_() { return sFrameBufferInfo.frameHeight < 300 ? 1 : 2; } + static inline int GetDotWidth_() { + return sFrameBufferInfo.frameWidth < 400 ? 1 : 2; + } + static inline int GetDotHeight_() { + return sFrameBufferInfo.frameHeight < 300 ? 1 : 2; + } void DirectPrint_Init() { if (!sInitialized) { @@ -137,8 +105,7 @@ namespace nw4r { } } - bool DirectPrint_IsActive() - { + bool DirectPrint_IsActive() { return sInitialized && sFrameBufferInfo.frameMemory; } @@ -175,7 +142,7 @@ namespace nw4r { for (int cntv = 0; cntv < sizev; cntv++) { for (int cnth = 0; cnth < sizeh; cnth++) { - *pixel++ = 0x1080; // some sort of white or black? + *pixel++ = 0x1080; // some sort of white or black? } pixel += sFrameBufferInfo.frameRow - sizeh; @@ -204,7 +171,7 @@ namespace nw4r { va_list vargs; va_start(vargs, format); - detail::DirectPrint_DrawStringToXfb(posh, posv, format, vargs, turnOver,false); + detail::DirectPrint_DrawStringToXfb(posh, posv, format, vargs, turnOver, false); va_end(vargs); } } @@ -277,8 +244,7 @@ namespace nw4r { str++; posh = basePosH; continue; - } - else { + } else { break; } } @@ -287,13 +253,13 @@ namespace nw4r { } } - static const char* DrawStringLineToXfb_(int posh, int posv, const char* str, int width){ + static const char* DrawStringLineToXfb_(int posh, int posv, const char* str, int width) { char c; int code; int cnt = 0; for (; (c = *str) != '\0'; str++) { - if (c == '\n' || c == '\0') { // another check against null character? + if (c == '\n' || c == '\0') { // another check against null character? return str; } @@ -304,8 +270,7 @@ namespace nw4r { posh += tab_size * 6; cnt += tab_size; - } - else { + } else { if (code != 0xff) { DrawCharToXfb_(posh, posv, code); } @@ -332,7 +297,7 @@ namespace nw4r { int ncode = code >= 100 ? code - 100 : code; int fonth = ncode % 5 * 6; int fontv = ncode / 5 * 7; - const u32 *fontLine = code < 100 ? &sFontData[fontv] : &sFontData2[fontv]; + const u32* fontLine = code < 100 ? &sFontData[fontv] : &sFontData2[fontv]; int wH = GetDotWidth_(); int wV = GetDotHeight_(); @@ -352,18 +317,15 @@ namespace nw4r { if (wH == 1) { fontBits = (fontBits & 0xfc000000) >> 1; - } - else { - fontBits = (twiceBit[(fontBits >> 26) & 3] - | twiceBit[(fontBits >> 28) & 3] << 4 - | twiceBit[(fontBits >> 30) & 3] << 8) << 19; + } else { + fontBits = (twiceBit[(fontBits >> 26) & 3] | twiceBit[(fontBits >> 28) & 3] << 4 | twiceBit[(fontBits >> 30) & 3] << 8) << 19; } for (int cnth = 0; cnth < wH * 6;) { - u16 pixColor = (fontBits & (1u << 30) ? sFrameBufferColor.colorY256 : 0x00) - | ((fontBits & (1u << 31) ? sFrameBufferColor.colorU4 : 0x20) - + (fontBits & (1u << 30) ? sFrameBufferColor.colorU2 : 0x40) - + (fontBits & (1u << 29) ? sFrameBufferColor.colorU4 : 0x20)); + u16 pixColor = + (fontBits & (1u << 30) ? sFrameBufferColor.colorY256 : 0x00) | + ((fontBits & (1u << 31) ? sFrameBufferColor.colorU4 : 0x20) + (fontBits & (1u << 30) ? sFrameBufferColor.colorU2 : 0x40) + + (fontBits & (1u << 29) ? sFrameBufferColor.colorU4 : 0x20)); *pixel = pixColor; @@ -373,10 +335,10 @@ namespace nw4r { pixel++; - pixColor = (fontBits & (1u << 29) ? sFrameBufferColor.colorY256 : 0x00) - | ((fontBits & (1u << 30) ? sFrameBufferColor.colorV4 : 0x20) - + (fontBits & (1u << 29) ? sFrameBufferColor.colorV2 : 0x40) - + (fontBits & (1u << 28) ? sFrameBufferColor.colorV4 : 0x20)); + pixColor = + (fontBits & (1u << 29) ? sFrameBufferColor.colorY256 : 0x00) | + ((fontBits & (1u << 30) ? sFrameBufferColor.colorV4 : 0x20) + (fontBits & (1u << 29) ? sFrameBufferColor.colorV2 : 0x40) + + (fontBits & (1u << 28) ? sFrameBufferColor.colorV4 : 0x20)); *pixel = pixColor; @@ -397,7 +359,8 @@ namespace nw4r { BOOL enabled = OSEnableInterrupts(); u32 preCnt = VIGetRetraceCount(); - while (preCnt == VIGetRetraceCount()) {} + while (preCnt == VIGetRetraceCount()) { + } OSRestoreInterrupts(enabled); } @@ -413,7 +376,7 @@ namespace nw4r { return reinterpret_cast(frameBuf); } - void* detail::DirectPrint_SetupFB(GXRenderModeObj const *rmode) { + void* detail::DirectPrint_SetupFB(GXRenderModeObj const* rmode) { void* frameMemory; DirectPrint_Init(); @@ -450,12 +413,11 @@ namespace nw4r { if (rmode) { DirectPrint_ChangeXfb(frameMemory, rmode->fbWidth, rmode->xfbHeight); - } - else { + } else { DirectPrint_ChangeXfb(frameMemory); } return frameMemory; } - } -} + } // namespace db +} // namespace nw4r diff --git a/libs/NW4R/src/db/db_exception.cpp b/libs/NW4R/src/db/db_exception.cpp index 1f94edcf..a938a107 100644 --- a/libs/NW4R/src/db/db_exception.cpp +++ b/libs/NW4R/src/db/db_exception.cpp @@ -1,42 +1,42 @@ -#include #include #include +#include #include #include -#include #include +#include #include namespace nw4r { namespace db { typedef struct ExceptionStruct { - OSThread thread; - OSMessageQueue queue; - void* frameMemory; + OSThread thread; + OSMessageQueue queue; + void* frameMemory; - u32 stackAddress; + u32 stackAddress; - ConsoleHandle consoleHandle; + ConsoleHandle consoleHandle; - const GXRenderModeObj* exceptionRenderObj; - ExceptionUserCallback exceptionCallback; - void* exceptionCallbackArgs; + const GXRenderModeObj* exceptionRenderObj; + ExceptionUserCallback exceptionCallback; + void* exceptionCallbackArgs; - u32 MSR_COPY; - u32 FPCSR_COPY; + u32 MSR_COPY; + u32 FPCSR_COPY; - u16 exceptionDisplayInfo; + u16 exceptionDisplayInfo; } ExceptionStruct; typedef struct { - u16 error; - OSContext* context; - u32 dsisr; - u32 dar; + u16 error; + OSContext* context; + u32 dsisr; + u32 dar; } ExceptionCallbackParam; static OSMessage sMessageBuffer[1]; @@ -64,8 +64,8 @@ namespace nw4r { "FLOATING POINT", }; - void* RunThread_(void* work); - void ErrorHandler_(u16 error, OSContext* context, u32 dsisr, u32 dar); + void* RunThread_(void* work); + void ErrorHandler_(u16 error, OSContext* context, u32 dsisr, u32 dar); static void PrintContext_(u16 error, OSContext* context, u32 dsisr, u32 dar); static void WaitTime_(s32 time); @@ -177,11 +177,9 @@ namespace nw4r { return NULL; } } while (info == sException.exceptionDisplayInfo); - } - else if (sException.consoleHandle != NULL) { + } else if (sException.consoleHandle != NULL) { DrawConsoleEndless_(sException.consoleHandle); - } - else { + } else { return NULL; } } @@ -190,7 +188,7 @@ namespace nw4r { return NULL; } - static void Exception_Printf_(const char *format, ...) { + static void Exception_Printf_(const char* format, ...) { const GXRenderModeObj* obj = sException.exceptionRenderObj; va_list args; @@ -220,8 +218,7 @@ namespace nw4r { static void PrintContext_(u16 error, OSContext* context, u32 dsisr, u32 dar) { if (error < OS_EXCEPTION_MAX) { Exception_Printf_("******** EXCEPTION OCCURRED! ********\nFrameMemory:%XH\n", sException.frameMemory); - } - else { + } else { Exception_Printf_("******** USER HALT ********\nFrameMemory:%XH\n", sException.frameMemory); } @@ -262,18 +259,15 @@ namespace nw4r { static bool IsValidStackAddr_(u32 stackAddress) { if (stackAddress == 0 || stackAddress == 0xFFFFFFFF) { return false; - } - else if (OSIsMEM1Region(stackAddress)) { + } else if (OSIsMEM1Region(stackAddress)) { if ((stackAddress & 0x0fffffff) >= OSGetPhysicalMem1Size()) { return false; } - } - else if (OSIsMEM2Region(stackAddress)) { + } else if (OSIsMEM2Region(stackAddress)) { if ((stackAddress & 0x0fffffff) >= OSGetPhysicalMem2Size()) { return false; } - } - else { + } else { return false; } @@ -285,7 +279,7 @@ namespace nw4r { Exception_Printf_("Address: BackChain LR save\n"); u32 i; - u32 *ptr = (u32 *)stackAddress; + u32* ptr = (u32*)stackAddress; for (i = 0; i < 16; i++) { if (ptr == NULL || (u32)ptr == 0xffffffff) { break; @@ -295,15 +289,14 @@ namespace nw4r { if (!ShowMapInfoSubroutine_(ptr[1], true)) { Exception_Printf_("\n"); } - ptr = (u32 *)*ptr; + ptr = (u32*)*ptr; } } void ShowMainInfo_(u16 error, OSContext* context, u32 dsisr, u32 dar) { if (error < OS_EXCEPTION_MAX) { Exception_Printf_("CONTEXT:%08XH (%s EXCEPTION)\n", context, CPU_EXP_NAME[error]); - } - else { + } else { Exception_Printf_("CONTEXT:%08XH\n", context); } @@ -360,7 +353,8 @@ namespace nw4r { void ShowGPR_(OSContext* context) { Exception_Printf_("-------------------------------- GPR\n"); for (int i = 0; i < 10; i++) { - Exception_Printf_("R%02d:%08XH R%02d:%08XH R%02d:%08XH\n", i, context->gpr[i], i + 11, context->gpr[i + 11], i + 22, context->gpr[i + 22]); + Exception_Printf_("R%02d:%08XH R%02d:%08XH R%02d:%08XH\n", i, context->gpr[i], i + 11, context->gpr[i + 11], i + 22, + context->gpr[i + 22]); } Exception_Printf_("R%02d:%08XH R%02d:%08XH\n", 10, context->gpr[10], 21, context->gpr[21]); } @@ -420,20 +414,16 @@ namespace nw4r { void ShowFloatSub_(s32 reg, f32 val) { if (isnan(val)) { Exception_Printf_("F%02d: Nan ", reg); - } - else { + } else { if (__fpclassifyf(val) == 2) { if ((reinterpret_cast(val) & 0x80) != 0) { Exception_Printf_("F%02d:+Inf ", reg); - } - else { + } else { Exception_Printf_("F%02d:-Inf ", reg); } - } - else if (val == 0.0f) { + } else if (val == 0.0f) { Exception_Printf_("F%02d: 0.0 ", reg); - } - else { + } else { Exception_Printf_("F%02d:%+.3E", reg, val); } } @@ -462,5 +452,5 @@ namespace nw4r { t2 = OSGetTime(); } while (OSTicksToMilliseconds(t2 - t1) < time); } - } -} + } // namespace db +} // namespace nw4r diff --git a/libs/NW4R/src/lyt/lyt_animation.cpp b/libs/NW4R/src/lyt/lyt_animation.cpp index 64578eea..9ce0cdfb 100644 --- a/libs/NW4R/src/lyt/lyt_animation.cpp +++ b/libs/NW4R/src/lyt/lyt_animation.cpp @@ -39,16 +39,14 @@ namespace { if (frame < centerKey.frame) { ikeyR = ikeyCenter; - } - else { + } else { ikeyL = ikeyCenter; } } if (RIsSame(frame, keyArray[ikeyR].frame, 0.001f)) { return keyArray[ikeyR].value; - } - else { + } else { return keyArray[ikeyL].value; } } @@ -65,12 +63,11 @@ namespace { int ikeyL = 0; int ikeyR = keySize - 1; - while (ikeyL != ikeyR - 1 && ikeyL != ikeyR) { + while (ikeyL != ikeyR - 1 && ikeyL != ikeyR) { int ikeyCenter = (ikeyL + ikeyR) / 2; if (frame <= keyArray[ikeyCenter].frame) { ikeyR = ikeyCenter; - } - else { + } else { ikeyL = ikeyCenter; } } @@ -81,8 +78,7 @@ namespace { if (RIsSame(frame, key1.frame, 0.001f)) { if (ikeyR < keySize - 1 && keyArray[ikeyR + 1].frame == key1.frame) { return keyArray[ikeyR + 1].value; - } - else { + } else { return key1.value; } } @@ -94,16 +90,14 @@ namespace { f32 s0 = key0.slope; f32 s1 = key1.slope; - f32 t1t1t2 = t1 * t1 * t2; - f32 t1t1t2t2 = t1t1t2 * t2; - f32 t1t1t1t2t2 = t1 * t1t1t2t2; + f32 t1t1t2 = t1 * t1 * t2; + f32 t1t1t2t2 = t1t1t2 * t2; + f32 t1t1t1t2t2 = t1 * t1t1t2t2; f32 t1t1t1t2t2t2 = t1t1t1t2t2 * t2; // oh god - return v0 * (( 2.0f * t1t1t1t2t2t2) - (3.0f * t1t1t2t2) + 1.0f) - + v1 * ((-2.0f * t1t1t1t2t2t2) + (3.0f * t1t1t2t2) ) - + s0 * (( t1t1t1t2t2) - (2.0f * t1t1t2 ) + t1 ) - + s1 * (( t1t1t1t2t2) - ( t1t1t2 ) ); + return v0 * ((2.0f * t1t1t1t2t2t2) - (3.0f * t1t1t2t2) + 1.0f) + v1 * ((-2.0f * t1t1t1t2t2t2) + (3.0f * t1t1t2t2)) + + s0 * ((t1t1t1t2t2) - (2.0f * t1t1t2) + t1) + s1 * ((t1t1t1t2t2) - (t1t1t2)); } void AnimatePainSRT(Pane* pane, const res::AnimationInfo* animInfo, const u32* animTargetOffsets, f32 frame) { @@ -112,40 +106,31 @@ namespace { NW4R_ASSERT(animTarget->target < ANIMTARGET_PANE_MAX); - const res::HermiteKey* keys = detail::ConvertOffsToPtr(animTarget, - animTarget->keysOffset); - - pane->SetSRTElement(animTarget->target, - GetHermiteCurveValue(frame, keys, animTarget->keyNum)); + const res::HermiteKey* keys = detail::ConvertOffsToPtr(animTarget, animTarget->keysOffset); + + pane->SetSRTElement(animTarget->target, GetHermiteCurveValue(frame, keys, animTarget->keyNum)); } } void AnimateVisibility(Pane* pane, const res::AnimationInfo* animInfo, const u32* animTargetOffsets, f32 frame) { for (int i = 0; i < animInfo->num; i++) { - const res::AnimationTarget* animTarget = detail::ConvertOffsToPtr(animInfo, - animTargetOffsets[i]); + const res::AnimationTarget* animTarget = detail::ConvertOffsToPtr(animInfo, animTargetOffsets[i]); NW4R_ASSERT(animTarget->target < ANIMTARGET_PANE_MAX); - const res::StepKey* keys = detail::ConvertOffsToPtr(animTarget, - animTarget->keysOffset); - + const res::StepKey* keys = detail::ConvertOffsToPtr(animTarget, animTarget->keysOffset); - pane->SetVisible(GetStepCurveValue(frame, - keys, - animTarget->keyNum) != 0); + pane->SetVisible(GetStepCurveValue(frame, keys, animTarget->keyNum) != 0); } } void AnimateVertexColor(Pane* pane, const res::AnimationInfo* animInfo, const u32* animTargetOffsets, f32 frame) NO_INLINE { for (int i = 0; i < animInfo->num; i++) { - const res::AnimationTarget* animTarget = detail::ConvertOffsToPtr(animInfo, - animTargetOffsets[i]); + const res::AnimationTarget* animTarget = detail::ConvertOffsToPtr(animInfo, animTargetOffsets[i]); NW4R_ASSERT(animTarget->target < ANIMTARGET_PANE_COLOR_MAX); - const res::HermiteKey* keys = detail::ConvertOffsToPtr(animTarget, - animTarget->keysOffset); + const res::HermiteKey* keys = detail::ConvertOffsToPtr(animTarget, animTarget->keysOffset); f32 value = GetHermiteCurveValue(frame, keys, animTarget->keyNum); value += 0.5f; @@ -153,20 +138,17 @@ namespace { u8 u8Val; OSf32tou8(&value, &u8Val); - pane->SetColorElement(animTarget->target, - u8Val); + pane->SetColorElement(animTarget->target, u8Val); } } void AnimateMaterialColor(Material* pMaterial, const res::AnimationInfo* animInfo, const u32* animTargetOffsets, f32 frame) NO_INLINE { for (int i = 0; i < animInfo->num; i++) { - const res::AnimationTarget* animTarget = detail::ConvertOffsToPtr(animInfo, - animTargetOffsets[i]); + const res::AnimationTarget* animTarget = detail::ConvertOffsToPtr(animInfo, animTargetOffsets[i]); NW4R_ASSERT(animTarget->target < ANIMTARGET_MATCOLOR_MAX); - const res::HermiteKey* keys = detail::ConvertOffsToPtr(animTarget, - animTarget->keysOffset); + const res::HermiteKey* keys = detail::ConvertOffsToPtr(animTarget, animTarget->keysOffset); f32 value = GetHermiteCurveValue(frame, keys, animTarget->keyNum); value += 0.5f; @@ -175,76 +157,61 @@ namespace { OSf32tos16(&value, &s16Val); s16Val = ut::Min(ut::Max(s16Val, -1024), 1023); - pMaterial->SetColorElement(animTarget->target, - s16Val); + pMaterial->SetColorElement(animTarget->target, s16Val); } } void AnimateTextureSRT(Material* pMaterial, const res::AnimationInfo* animInfo, const u32* animTargetOffsets, f32 frame) { for (int i = 0; i < animInfo->num; i++) { - const res::AnimationTarget* animTarget = detail::ConvertOffsToPtr(animInfo, - animTargetOffsets[i]); + const res::AnimationTarget* animTarget = detail::ConvertOffsToPtr(animInfo, animTargetOffsets[i]); if (animTarget->id < pMaterial->GetTexSRTCap()) { NW4R_ASSERT(animTarget->target < ANIMTARGET_TEXSRT_MAX); - const res::HermiteKey* keys = detail::ConvertOffsToPtr(animTarget, - animTarget->keysOffset); + const res::HermiteKey* keys = detail::ConvertOffsToPtr(animTarget, animTarget->keysOffset); - pMaterial->SetTexSRTElement(animTarget->id, - animTarget->target, - GetHermiteCurveValue(frame, keys, animTarget->keyNum)); + pMaterial->SetTexSRTElement(animTarget->id, animTarget->target, GetHermiteCurveValue(frame, keys, animTarget->keyNum)); } } } - void AnimateTexturePattern(Material* pMaterial, const res::AnimationInfo* animInfo, const u32* animTargetOffsets, f32 frame, void* *tpls) { + void AnimateTexturePattern(Material* pMaterial, const res::AnimationInfo* animInfo, const u32* animTargetOffsets, f32 frame, void** tpls) { // Not `i`? for (int j = 0; j < animInfo->num; j++) { - const res::AnimationTarget* animTarget = detail::ConvertOffsToPtr(animInfo, - animTargetOffsets[j]); + const res::AnimationTarget* animTarget = detail::ConvertOffsToPtr(animInfo, animTargetOffsets[j]); if (animTarget->id < pMaterial->GetTextureNum() && animTarget->target == ANIMTARGET_TEXPATTURN_IMAGE) { - const res::StepKey* keys = detail::ConvertOffsToPtr(animTarget, - animTarget->keysOffset); + const res::StepKey* keys = detail::ConvertOffsToPtr(animTarget, animTarget->keysOffset); - u16 fileIdx = GetStepCurveValue(frame, - keys, - animTarget->keyNum); + u16 fileIdx = GetStepCurveValue(frame, keys, animTarget->keyNum); - pMaterial->SetTextureNoWrap(animTarget->id, - static_cast(tpls[fileIdx])); + pMaterial->SetTextureNoWrap(animTarget->id, static_cast(tpls[fileIdx])); } } } void AnimateIndTexSRT(Material* pMaterial, const res::AnimationInfo* animInfo, const u32* animTargetOffsets, f32 frame) { for (int i = 0; i < animInfo->num; i++) { - const res::AnimationTarget* animTarget = detail::ConvertOffsToPtr(animInfo, - animTargetOffsets[i]); + const res::AnimationTarget* animTarget = detail::ConvertOffsToPtr(animInfo, animTargetOffsets[i]); if (animTarget->id < pMaterial->GetIndTexSRTCap()) { NW4R_ASSERT(animTarget->target < ANIMTARGET_TEXSRT_MAX); - const res::HermiteKey* keys = detail::ConvertOffsToPtr(animTarget, - animTarget->keysOffset); + const res::HermiteKey* keys = detail::ConvertOffsToPtr(animTarget, animTarget->keysOffset); - pMaterial->SetIndTexSRTElement(animTarget->id, - animTarget->target, - GetHermiteCurveValue(frame, keys, animTarget->keyNum)); + pMaterial->SetIndTexSRTElement(animTarget->id, animTarget->target, GetHermiteCurveValue(frame, keys, animTarget->keyNum)); } } } -} +} // namespace namespace nw4r { namespace lyt { - AnimTransform::AnimTransform(): - mLink(), - mpRes(NULL), - mFrame(0.0f) {} + AnimTransform::AnimTransform() : mLink(), mpRes(NULL), mFrame(0.0f) { + } - AnimTransform::~AnimTransform() {} + AnimTransform::~AnimTransform() { + } u16 AnimTransform::GetFrameSize() const { return mpRes->frameSize; @@ -254,10 +221,8 @@ namespace nw4r { return mpRes->loop; } - AnimTransformBasic::AnimTransformBasic(): - mpFileResAry(NULL), - mAnimLinkAry(NULL), - mAnimLinkNum(0) {} + AnimTransformBasic::AnimTransformBasic() : mpFileResAry(NULL), mAnimLinkAry(NULL), mAnimLinkNum(0) { + } AnimTransformBasic::~AnimTransformBasic() { if (mAnimLinkAry != NULL) { @@ -292,7 +257,7 @@ namespace nw4r { memset(mAnimLinkAry, 0, sizeof(*mAnimLinkAry) * pRes->animContNum); for (u16 i = 0; i < pRes->animContNum; i++) { - new(&mAnimLinkAry[i]) AnimationLink(); + new (&mAnimLinkAry[i]) AnimationLink(); } } } @@ -310,8 +275,7 @@ namespace nw4r { mAnimLinkAry[i].SetAnimTransform(this, i); pFindPane->AddAnimationLink(&mAnimLinkAry[i]); } - } - else { + } else { Material* pFindMat = pane->FindMaterialByName(animCont->name, bRecursive); if (pFindMat != NULL) { @@ -411,5 +375,5 @@ namespace nw4r { } return NULL; } - } -} + } // namespace lyt +} // namespace nw4r diff --git a/libs/NW4R/src/lyt/lyt_arcResourceAccessor.cpp b/libs/NW4R/src/lyt/lyt_arcResourceAccessor.cpp index e42b0e97..5e92d4ea 100644 --- a/libs/NW4R/src/lyt/lyt_arcResourceAccessor.cpp +++ b/libs/NW4R/src/lyt/lyt_arcResourceAccessor.cpp @@ -5,10 +5,10 @@ namespace { s32 FindNameResource(ARCHandle* pArcHandle, const char* resName) NO_INLINE { s32 entryNum = -1; - + ARCDir dir; BOOL bSuccess = ARCOpenDir(pArcHandle, ".", &dir); - + ARCDirEntry dirEntry; while (ARCReadDir(&dir, &dirEntry)) { @@ -16,63 +16,61 @@ namespace { bSuccess = ARCChangeDir(pArcHandle, dirEntry.name); entryNum = FindNameResource(pArcHandle, resName); bSuccess = ARCChangeDir(pArcHandle, ".."); - + if (entryNum != -1) { break; } - } - else if (stricmp(resName, dirEntry.name) == 0) { + } else if (stricmp(resName, dirEntry.name) == 0) { entryNum = dirEntry.entryNum; break; } } - + bSuccess = ARCCloseDir(&dir); return entryNum; } void* GetResourceSub(ARCHandle* pArcHandle, const char* resRootDir, u32 resType, const char* name, u32* pSize) { s32 entryNum = -1; - + if (ARCConvertPathToEntrynum(pArcHandle, resRootDir) != -1 && ARCChangeDir(pArcHandle, resRootDir)) { if (!resType) { entryNum = FindNameResource(pArcHandle, name); - } - else { + } else { char resTypeStr[5]; resTypeStr[0] = resType >> 24; resTypeStr[1] = resType >> 16; resTypeStr[2] = resType >> 8; resTypeStr[3] = resType; resTypeStr[4] = '\0'; - + if (ARCConvertPathToEntrynum(pArcHandle, resTypeStr) != -1 && ARCChangeDir(pArcHandle, resTypeStr)) { entryNum = ARCConvertPathToEntrynum(pArcHandle, name); BOOL bSuccess = ARCChangeDir(pArcHandle, ".."); } } - + BOOL bSuccess = ARCChangeDir(pArcHandle, ".."); } - + if (entryNum != -1) { ARCFileInfo arcFileInfo; BOOL bSuccess = ARCFastOpen(pArcHandle, entryNum, &arcFileInfo); - + void* resPtr = ARCGetStartAddrInMem(&arcFileInfo); - + if (pSize) { - *pSize = ARCGetLength(&arcFileInfo); + *pSize = ARCGetLength(&arcFileInfo); } - + ARCClose(&arcFileInfo); - + return resPtr; } - + return NULL; } -} +} // namespace namespace nw4r { namespace lyt { @@ -85,16 +83,16 @@ namespace nw4r { return NULL; } - FontRefLink::FontRefLink() : - mpFont(NULL) {} + FontRefLink::FontRefLink() : mpFont(NULL) { + } void FontRefLink::Set(const char* name, ut::Font* pFont) { strcpy(mFontName, name); mpFont = pFont; } - ArcResourceAccessor::ArcResourceAccessor(): - mArcBuf(NULL) {} + ArcResourceAccessor::ArcResourceAccessor() : mArcBuf(NULL) { + } bool ArcResourceAccessor::Attach(void* archiveStart, const char* resourceRootDirectory) { BOOL bSuccess = ARCInitHandle(archiveStart, &mArcHandle); @@ -124,7 +122,8 @@ namespace nw4r { return true; } - MultiArcResourceAccessor::MultiArcResourceAccessor() {} + MultiArcResourceAccessor::MultiArcResourceAccessor() { + } MultiArcResourceAccessor::~MultiArcResourceAccessor() { DetachAll(); @@ -151,5 +150,5 @@ namespace nw4r { ut::Font* MultiArcResourceAccessor::GetFont(const char* name) { return detail::FindFont(&mFontList, name); } - } -} + } // namespace lyt +} // namespace nw4r diff --git a/libs/NW4R/src/lyt/lyt_bounding.cpp b/libs/NW4R/src/lyt/lyt_bounding.cpp index 264626de..93b7c88d 100644 --- a/libs/NW4R/src/lyt/lyt_bounding.cpp +++ b/libs/NW4R/src/lyt/lyt_bounding.cpp @@ -4,11 +4,13 @@ namespace nw4r { namespace lyt { NW4R_UT_GET_DERIVED_RUNTIME_TYPEINFO(Bounding, Pane); - Bounding::Bounding(const res::Bounding *pBlock, const ResBlockSet&) : - Pane(pBlock) {} + Bounding::Bounding(const res::Bounding* pBlock, const ResBlockSet&) : Pane(pBlock) { + } - Bounding::~Bounding() {} + Bounding::~Bounding() { + } - void Bounding::DrawSelf(const DrawInfo& drawInfo) {} - } -} + void Bounding::DrawSelf(const DrawInfo& drawInfo) { + } + } // namespace lyt +} // namespace nw4r diff --git a/libs/NW4R/src/lyt/lyt_common.cpp b/libs/NW4R/src/lyt/lyt_common.cpp index 3a9d98e2..dd639aac 100644 --- a/libs/NW4R/src/lyt/lyt_common.cpp +++ b/libs/NW4R/src/lyt/lyt_common.cpp @@ -29,10 +29,8 @@ namespace nw4r { return static_cast(GetSignatureInt(fileHeader.signature)) == testSig && TestFileHeader(fileHeader); } - TexCoordAry::TexCoordAry(): - mCap(0), - mNum(0), - mpData(NULL) {} + TexCoordAry::TexCoordAry() : mCap(0), mNum(0), mpData(NULL) { + } void TexCoordAry::Free() { if (mpData != NULL) { @@ -63,12 +61,7 @@ namespace nw4r { return; } - static TexCoords texCoords = { - math::VEC2(0.0f, 0.0f), - math::VEC2(1.0f, 0.0f), - math::VEC2(0.0f, 1.0f), - math::VEC2(1.0f, 1.0f) - }; + static TexCoords texCoords = {math::VEC2(0.0f, 0.0f), math::VEC2(1.0f, 0.0f), math::VEC2(0.0f, 1.0f), math::VEC2(1.0f, 1.0f)}; for (int j = mNum; j < num; j++) { for (int i = 0; i < (int)ARRAY_LENGTH(mpData[j]); i++) { @@ -108,10 +101,8 @@ namespace nw4r { } if (vtxColors != NULL) { - if (vtxColors[VERTEXCOLOR_LT] != ut::Color::WHITE - || vtxColors[VERTEXCOLOR_RT] != ut::Color::WHITE - || vtxColors[VERTEXCOLOR_LB] != ut::Color::WHITE - || vtxColors[VERTEXCOLOR_RB] != ut::Color::WHITE) { + if (vtxColors[VERTEXCOLOR_LT] != ut::Color::WHITE || vtxColors[VERTEXCOLOR_RT] != ut::Color::WHITE || + vtxColors[VERTEXCOLOR_LB] != ut::Color::WHITE || vtxColors[VERTEXCOLOR_RB] != ut::Color::WHITE) { return true; } } @@ -154,7 +145,8 @@ namespace nw4r { } void DrawQuad(const math::VEC2& basePt, const Size& size, u8 texCoordNum, const TexCoords* texCoords, const ut::Color* vtxColors) { - GXBegin(GX_QUADS, GX_VTXFMT0, 4); { + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + { // Left top (LT) GXPosition2f32(basePt.x, basePt.y); if (vtxColors != NULL) { @@ -190,10 +182,12 @@ namespace nw4r { for (int i = 0; i < texCoordNum; i++) { GXTexCoord2f32(texCoords[i][VERTEXCOLOR_LB].x, texCoords[i][VERTEXCOLOR_LB].y); } - } GXEnd(); + } + GXEnd(); } - void DrawQuad(const math::VEC2& basePt, const Size& size, u8 texCoordNum, const TexCoords* texCoords, const ut::Color* vtxColors, u8 alpha) { + void DrawQuad(const math::VEC2& basePt, const Size& size, u8 texCoordNum, const TexCoords* texCoords, const ut::Color* vtxColors, + u8 alpha) { ut::Color wkVtxColors[VERTEXCOLOR_MAX]; if (vtxColors != NULL) { MultipleAlpha(wkVtxColors, vtxColors, alpha); @@ -227,13 +221,15 @@ namespace nw4r { GXSetLineWidth(6, GX_TO_ZERO); - GXBegin(GX_LINESTRIP, GX_VTXFMT0, 5); { - GXPosition2f32(pos.x, pos.y ); - GXPosition2f32(pos.x + size.width, pos.y ); - GXPosition2f32(pos.x + size.width, pos.y + size.height); - GXPosition2f32(pos.x, pos.y + size.height); - GXPosition2f32(pos.x, pos.y ); - } GXEnd(); + GXBegin(GX_LINESTRIP, GX_VTXFMT0, 5); + { + GXPosition2f32(pos.x, pos.y); + GXPosition2f32(pos.x + size.width, pos.y); + GXPosition2f32(pos.x + size.width, pos.y + size.height); + GXPosition2f32(pos.x, pos.y + size.height); + GXPosition2f32(pos.x, pos.y); + } + GXEnd(); } void InitGXTexObjFromTPL(GXTexObj* to, TPLPalette* pal, u32 id) { @@ -247,27 +243,19 @@ namespace nw4r { GXBool mipMap = tdp->textureHeader->minLOD != tdp->textureHeader->maxLOD ? GX_TRUE : GX_FALSE; if (tdp->CLUTHeader != NULL) { - GXInitTexObjCI(to, tdp->textureHeader->data, - tdp->textureHeader->width, tdp->textureHeader->height, - static_cast(tdp->textureHeader->format), - tdp->textureHeader->wrapS, tdp->textureHeader->wrapT, - mipMap, 0); + GXInitTexObjCI(to, tdp->textureHeader->data, tdp->textureHeader->width, tdp->textureHeader->height, + static_cast(tdp->textureHeader->format), tdp->textureHeader->wrapS, tdp->textureHeader->wrapT, mipMap, + 0); GXInitTexObjUserData(to, tdp->CLUTHeader); - } - else { - GXInitTexObj(to, tdp->textureHeader->data, - tdp->textureHeader->width, tdp->textureHeader->height, - static_cast(tdp->textureHeader->format), - tdp->textureHeader->wrapS, tdp->textureHeader->wrapT, - mipMap); + } else { + GXInitTexObj(to, tdp->textureHeader->data, tdp->textureHeader->width, tdp->textureHeader->height, + static_cast(tdp->textureHeader->format), tdp->textureHeader->wrapS, tdp->textureHeader->wrapT, mipMap); } - GXInitTexObjLOD(to, - tdp->textureHeader->minFilter, tdp->textureHeader->magFilter, - tdp->textureHeader->minLOD, tdp->textureHeader->maxLOD, tdp->textureHeader->LODBias, - false, tdp->textureHeader->edgeLODEnable, GX_ANISO_1); + GXInitTexObjLOD(to, tdp->textureHeader->minFilter, tdp->textureHeader->magFilter, tdp->textureHeader->minLOD, + tdp->textureHeader->maxLOD, tdp->textureHeader->LODBias, false, tdp->textureHeader->edgeLODEnable, GX_ANISO_1); } - } - } -} + } // namespace detail + } // namespace lyt +} // namespace nw4r diff --git a/libs/NW4R/src/lyt/lyt_drawinfo.cpp b/libs/NW4R/src/lyt/lyt_drawinfo.cpp index 172b246d..6bcc1f3b 100644 --- a/libs/NW4R/src/lyt/lyt_drawinfo.cpp +++ b/libs/NW4R/src/lyt/lyt_drawinfo.cpp @@ -6,13 +6,12 @@ namespace nw4r { namespace lyt { - DrawInfo::DrawInfo() : - mLocationAdjustScale(1.0f, 1.0f), - mGlobalAlpha(1.0f) { + DrawInfo::DrawInfo() : mLocationAdjustScale(1.0f, 1.0f), mGlobalAlpha(1.0f) { memset(&mFlag, 0, sizeof(mFlag)); math::MTX34Identity(&mViewMtx); } - DrawInfo::~DrawInfo() {} - } -} + DrawInfo::~DrawInfo() { + } + } // namespace lyt +} // namespace nw4r diff --git a/libs/NW4R/src/lyt/lyt_group.cpp b/libs/NW4R/src/lyt/lyt_group.cpp index bdc58c57..935396c4 100644 --- a/libs/NW4R/src/lyt/lyt_group.cpp +++ b/libs/NW4R/src/lyt/lyt_group.cpp @@ -1,13 +1,14 @@ +#include #include #include -#include -#include #include +#include namespace nw4r { namespace lyt { - Group::Group() {} + Group::Group() { + } Group::Group(const res::Group* pResGroup, Pane* pRootPane) { Init(); @@ -40,7 +41,7 @@ namespace nw4r { void Group::AppendPane(Pane* pane) { if (void* pMem = Layout::AllocMemory(sizeof(detail::PaneLink))) { - detail::PaneLink* paneLink = new(pMem) detail::PaneLink(); + detail::PaneLink* paneLink = new (pMem) detail::PaneLink(); paneLink->mTarget = pane; mPaneLinkList.PushBack(paneLink); @@ -73,5 +74,5 @@ namespace nw4r { return NULL; } - } -} + } // namespace lyt +} // namespace nw4r diff --git a/libs/NW4R/src/lyt/lyt_layout.cpp b/libs/NW4R/src/lyt/lyt_layout.cpp index c82b3769..b4f54fc0 100644 --- a/libs/NW4R/src/lyt/lyt_layout.cpp +++ b/libs/NW4R/src/lyt/lyt_layout.cpp @@ -2,8 +2,8 @@ #include -#include #include +#include #include #include #include @@ -16,35 +16,35 @@ namespace { using namespace nw4r; using namespace nw4r::lyt; - template T* CreateObject() { + template + T* CreateObject() { void* pMem = Layout::AllocMemory(sizeof(T)); if (pMem != NULL) { - return new(pMem) T(); - } - else { + return new (pMem) T(); + } else { return NULL; } } - template T* CreateObject(Param1 p1) { + template + T* CreateObject(Param1 p1) { void* pMem = Layout::AllocMemory(sizeof(T)); if (pMem) { - return new(pMem) T(p1); - } - else { + return new (pMem) T(p1); + } else { return NULL; } } - template T* CreateObject(Param1 p1, Param2 p2) { + template + T* CreateObject(Param1 p1, Param2 p2) { void* pMem = Layout::AllocMemory(sizeof(T)); if (pMem) { - return new(pMem) T(p1, p2); - } - else { + return new (pMem) T(p1, p2); + } else { return NULL; } } @@ -58,17 +58,14 @@ namespace { SetTagProcessorImpl(&(*it), pTagProcessor); } } -} +} // namespace namespace nw4r { namespace lyt { - MEMAllocator* Layout::mspAllocator; + MEMAllocator* Layout::mspAllocator; - Layout::Layout(): - mpRootPane(NULL), - mpGroupContainer(NULL), - mLayoutSize(0.0f, 0.0f), - mOriginType(ORIGINTYPE_TOPLEFT) {} + Layout::Layout() : mpRootPane(NULL), mpGroupContainer(NULL), mLayoutSize(0.0f, 0.0f), mOriginType(ORIGINTYPE_TOPLEFT) { + } Layout::~Layout() { if (mpGroupContainer != NULL) { @@ -104,7 +101,7 @@ namespace nw4r { Pane* pLastPane = NULL; bool bReadRootGroup = false; - int groupNestLevel = 0; + int groupNestLevel = 0; void* dataPtr = reinterpret_cast(reinterpret_cast(lytResBuf) + fileHead->headerSize); @@ -117,7 +114,7 @@ namespace nw4r { // Layout case res::OBJECT_SIGNATURE_LAYOUT: { res::Layout* pResLyt = static_cast(dataPtr); - mOriginType = pResLyt->originType != ORIGINTYPE_TOPLEFT; // Interesting way of doing it. + mOriginType = pResLyt->originType != ORIGINTYPE_TOPLEFT; // Interesting way of doing it. mLayoutSize = pResLyt->layoutSize; break; } @@ -177,8 +174,7 @@ namespace nw4r { if (!bReadRootGroup) { bReadRootGroup = true; mpGroupContainer = CreateObject(); - } - else if (mpGroupContainer && groupNestLevel == 1) { + } else if (mpGroupContainer && groupNestLevel == 1) { Group* pGroup = CreateObject(reinterpret_cast(pDataBlockHead), mpRootPane); if (pGroup != NULL) { mpGroupContainer->AppendGroup(pGroup); @@ -212,8 +208,7 @@ namespace nw4r { } const res::AnimationBlock* pInfoBlock = NULL; - const res::DataBlockHeader* pDataBlockHead = detail::ConvertOffsToPtr(pFileHead, - pFileHead->headerSize); + const res::DataBlockHeader* pDataBlockHead = detail::ConvertOffsToPtr(pFileHead, pFileHead->headerSize); AnimTransform* ret = NULL; @@ -244,8 +239,7 @@ namespace nw4r { } } - pDataBlockHead = detail::ConvertOffsToPtr(pDataBlockHead, - pDataBlockHead->size); + pDataBlockHead = detail::ConvertOffsToPtr(pDataBlockHead, pDataBlockHead->size); } return ret; @@ -293,10 +287,8 @@ namespace nw4r { const ut::Rect Layout::GetLayoutRect() const { if (mOriginType == ORIGINTYPE_CENTER) { - return ut::Rect(-mLayoutSize.width / 2.0f, mLayoutSize.height / 2.0f, - mLayoutSize.width / 2.0f, -mLayoutSize.height / 2.0f); - } - else { + return ut::Rect(-mLayoutSize.width / 2.0f, mLayoutSize.height / 2.0f, mLayoutSize.width / 2.0f, -mLayoutSize.height / 2.0f); + } else { return ut::Rect(0.0f, 0.0f, mLayoutSize.width, mLayoutSize.height); } } @@ -332,5 +324,5 @@ namespace nw4r { } } } - } -} + } // namespace lyt +} // namespace nw4r diff --git a/libs/NW4R/src/lyt/lyt_material.cpp b/libs/NW4R/src/lyt/lyt_material.cpp index 44c7bf95..bca59b59 100644 --- a/libs/NW4R/src/lyt/lyt_material.cpp +++ b/libs/NW4R/src/lyt/lyt_material.cpp @@ -1,6 +1,6 @@ -#include -#include #include +#include +#include #include @@ -9,8 +9,8 @@ #include -static const GXColorS10 DefaultWhiteColor = { 255, 255, 255, 255 }; -static const GXColorS10 DefaultBlackColor = { 0, 0, 0, 0 }; +static const GXColorS10 DefaultWhiteColor = {255, 255, 255, 255}; +static const GXColorS10 DefaultBlackColor = {0, 0, 0, 0}; namespace { using namespace nw4r; @@ -42,14 +42,14 @@ namespace { pMtx->mtx[0][0] = a0; pMtx->mtx[0][1] = a1; pMtx->mtx[0][2] = 0.0f; - pMtx->mtx[0][3] = texSRT.translate.x + center.x + a0 * -center.x + a1 * -center.y; + pMtx->mtx[0][3] = texSRT.translate.x + center.x + a0 * -center.x + a1 * -center.y; a0 = sinR * texSRT.scale.x; a1 = cosR * texSRT.scale.y; pMtx->mtx[1][0] = a0; pMtx->mtx[1][1] = a1; pMtx->mtx[1][2] = 0.0f; - pMtx->mtx[1][3] = texSRT.translate.y + center.y + a0 * -center.x + a1 * -center.y; + pMtx->mtx[1][3] = texSRT.translate.y + center.y + a0 * -center.x + a1 * -center.y; pMtx->mtx[2][0] = 0.0f; pMtx->mtx[2][1] = 0.0f; @@ -102,11 +102,19 @@ namespace { s8 scaleExp = 0; - m00 = mtx[0][0]; m01 = mtx[0][1]; m02 = mtx[0][2]; - m10 = mtx[1][0]; m11 = mtx[1][1]; m12 = mtx[1][2]; + m00 = mtx[0][0]; + m01 = mtx[0][1]; + m02 = mtx[0][2]; + m10 = mtx[1][0]; + m11 = mtx[1][1]; + m12 = mtx[1][2]; - a00 = math::FAbs(m00); a01 = math::FAbs(m01); a02 = math::FAbs(m02); - a10 = math::FAbs(m10); a11 = math::FAbs(m11); a12 = math::FAbs(m12); + a00 = math::FAbs(m00); + a01 = math::FAbs(m01); + a02 = math::FAbs(m02); + a10 = math::FAbs(m10); + a11 = math::FAbs(m11); + a12 = math::FAbs(m12); if (a00 >= 1.0f || a01 >= 1.0f || a02 >= 1.0f || a10 >= 1.0f || a11 >= 1.0f || a12 >= 1.0f) { do { @@ -116,32 +124,42 @@ namespace { scaleExp++; - m00 /= 2.0f; m01 /= 2.0f; m02 /= 2.0f; - m10 /= 2.0f; m11 /= 2.0f; m12 /= 2.0f; + m00 /= 2.0f; + m01 /= 2.0f; + m02 /= 2.0f; + m10 /= 2.0f; + m11 /= 2.0f; + m12 /= 2.0f; - a00 /= 2.0f; a01 /= 2.0f; a02 /= 2.0f; - a10 /= 2.0f; a11 /= 2.0f; a12 /= 2.0f; + a00 /= 2.0f; + a01 /= 2.0f; + a02 /= 2.0f; + a10 /= 2.0f; + a11 /= 2.0f; + a12 /= 2.0f; - } - while (a00 >= 1.0f || a01 >= 1.0f || a02 >= 1.0f || a10 >= 1.0f || a11 >= 1.0f || a12 >= 1.0f); - } - else if (a00 < 0.5f && a01 < 0.5f && a02 < 0.5f && a10 < 0.5f && a11 < 0.5f && a12 < 0.5f) { + } while (a00 >= 1.0f || a01 >= 1.0f || a02 >= 1.0f || a10 >= 1.0f || a11 >= 1.0f || a12 >= 1.0f); + } else if (a00 < 0.5f && a01 < 0.5f && a02 < 0.5f && a10 < 0.5f && a11 < 0.5f && a12 < 0.5f) { do { scaleExp--; - m00 *= 2.0f; m01 *= 2.0f; m02 *= 2.0f; - m10 *= 2.0f; m11 *= 2.0f; m12 *= 2.0f; + m00 *= 2.0f; + m01 *= 2.0f; + m02 *= 2.0f; + m10 *= 2.0f; + m11 *= 2.0f; + m12 *= 2.0f; - a00 *= 2.0f; a01 *= 2.0f; a02 *= 2.0f; - a10 *= 2.0f; a11 *= 2.0f; a12 *= 2.0f; - } - while (a00 < 0.5f && a01 < 0.5f && a02 < 0.5f && a10 < 0.5f && a11 < 0.5f && a12 < 0.5f && scaleExp > -17); + a00 *= 2.0f; + a01 *= 2.0f; + a02 *= 2.0f; + a10 *= 2.0f; + a11 *= 2.0f; + a12 *= 2.0f; + } while (a00 < 0.5f && a01 < 0.5f && a02 < 0.5f && a10 < 0.5f && a11 < 0.5f && a12 < 0.5f && scaleExp > -17); } - Mtx23 outMtx = { - { m00, m01, m02 }, - { m10, m11, m12 } - }; + Mtx23 outMtx = {{m00, m01, m02}, {m10, m11, m12}}; GXSetIndTexMtx(id, outMtx, scaleExp); } @@ -198,7 +216,7 @@ namespace { *pDst = *pSrc; GXInitTexObjUserData(pDst, NULL); } -} +} // namespace namespace nw4r { namespace lyt { @@ -222,47 +240,46 @@ namespace nw4r { const res::TexMap* const pResTexMap = detail::ConvertOffsToPtr(pRes, resOffs); resOffs += pRes->resNum.GetTexMapNum() * sizeof(res::TexMap); - + const TexSRT* const resTexSRTs = detail::ConvertOffsToPtr(pRes, resOffs); resOffs += pRes->resNum.GetTexSRTNum() * sizeof(TexSRT); - + const TexCoordGen* const resTexCoordGens = detail::ConvertOffsToPtr(pRes, resOffs); resOffs += pRes->resNum.GetTexCoordGenNum() * sizeof(TexCoordGen); - u8 texMapNum = ut::Min(pRes->resNum.GetTexMapNum(), GX_MAX_TEXMAP); - u8 texSRTNum = ut::Min(pRes->resNum.GetTexSRTNum(), MAX_TEX_SRT); - u8 texCoordGenNum = ut::Min(pRes->resNum.GetTexCoordGenNum(), GX_MAX_TEXCOORD); + u8 texMapNum = ut::Min(pRes->resNum.GetTexMapNum(), GX_MAX_TEXMAP); + u8 texSRTNum = ut::Min(pRes->resNum.GetTexSRTNum(), MAX_TEX_SRT); + u8 texCoordGenNum = ut::Min(pRes->resNum.GetTexCoordGenNum(), GX_MAX_TEXCOORD); - bool allocChanCtrl = pRes->resNum.GetChanCtrlNum() != 0; - bool allocMatCol = pRes->resNum.GetMatColNum() != 0; - bool allocTevSwap = pRes->resNum.HasTevSwapTable(); - bool allocAlpComp = pRes->resNum.HasAlphaCompare(); + bool allocChanCtrl = pRes->resNum.GetChanCtrlNum() != 0; + bool allocMatCol = pRes->resNum.GetMatColNum() != 0; + bool allocTevSwap = pRes->resNum.HasTevSwapTable(); + bool allocAlpComp = pRes->resNum.HasAlphaCompare(); bool allocBlendMode = pRes->resNum.HasBlendMode(); - u8 indTexSRTNum = ut::Min(pRes->resNum.GetIndTexSRTNum(), MAX_IND_SRT); - u8 indStageNum = ut::Min(pRes->resNum.GetIndTexStageNum(), GX_MAX_INDTEXSTAGE); - u8 tevStageNum = ut::Min(pRes->resNum.GetTevStageNum(), GX_MAX_TEVSTAGE); + u8 indTexSRTNum = ut::Min(pRes->resNum.GetIndTexSRTNum(), MAX_IND_SRT); + u8 indStageNum = ut::Min(pRes->resNum.GetIndTexStageNum(), GX_MAX_INDTEXSTAGE); + u8 tevStageNum = ut::Min(pRes->resNum.GetTevStageNum(), GX_MAX_TEVSTAGE); - ReserveGXMem(texMapNum, texSRTNum, texCoordGenNum, tevStageNum, - allocTevSwap, indStageNum, indTexSRTNum, allocChanCtrl, - allocMatCol, allocAlpComp, allocBlendMode); + ReserveGXMem(texMapNum, texSRTNum, texCoordGenNum, tevStageNum, allocTevSwap, indStageNum, indTexSRTNum, allocChanCtrl, allocMatCol, + allocAlpComp, allocBlendMode); if (mpGXMem != NULL) { SetTextureNum(texMapNum); if (texMapNum) { - const res::Texture* const textures = detail::ConvertOffsToPtr(resBlockSet.pTextureList, - sizeof(*resBlockSet.pTextureList)); + const res::Texture* const textures = + detail::ConvertOffsToPtr(resBlockSet.pTextureList, sizeof(*resBlockSet.pTextureList)); GXTexObj* const texMaps = GetTexMapAry(); for (u8 i = 0; i < mGXMemNum.texMap; i++) { - const char* fileName = detail::ConvertOffsToPtr(textures, - textures[pResTexMap[i].texIdx].nameStrOffset); + const char* fileName = detail::ConvertOffsToPtr(textures, textures[pResTexMap[i].texIdx].nameStrOffset); void* pTplRes = resBlockSet.pResAccessor->GetResource(RESOURCE_TYPE_TEXTURE, fileName, NULL); SetTexture(i, static_cast(pTplRes)); - GXInitTexObjWrapMode(&texMaps[i], static_cast(pResTexMap[i].wrapS), static_cast(pResTexMap[i].wrapT)); + GXInitTexObjWrapMode(&texMaps[i], static_cast(pResTexMap[i].wrapS), + static_cast(pResTexMap[i].wrapT)); } } @@ -302,8 +319,7 @@ namespace nw4r { if (indTexSRTNum) { TexSRT* indTexSRTs = GetIndTexSRTAry(); - const TexSRT* pResIndMtx = detail::ConvertOffsToPtr(pRes, - resOffs); + const TexSRT* pResIndMtx = detail::ConvertOffsToPtr(pRes, resOffs); for (int i = 0; i < indTexSRTNum; i++) { indTexSRTs[i] = pResIndMtx[i]; } @@ -387,21 +403,18 @@ namespace nw4r { ptr->blendMode = 0; } - void Material::ReserveGXMem(u8 texMapNum, u8 texSRTNum, u8 texCoordGenNum, - u8 tevStageNum, bool allocTevSwap, u8 indStageNum, - u8 indSRTNum, bool allocChanCtrl, bool allocMatCol, - bool allocAlpComp, bool allocBlendMode) { - int tevSwapNum = allocTevSwap ? 1 : 0; - int chanCtrlNum = allocChanCtrl ? 1 : 0; - int matColNum = allocMatCol ? 1 : 0; - int alpCompNum = allocAlpComp ? 1 : 0; + void Material::ReserveGXMem(u8 texMapNum, u8 texSRTNum, u8 texCoordGenNum, u8 tevStageNum, bool allocTevSwap, u8 indStageNum, u8 indSRTNum, + bool allocChanCtrl, bool allocMatCol, bool allocAlpComp, bool allocBlendMode) { + int tevSwapNum = allocTevSwap ? 1 : 0; + int chanCtrlNum = allocChanCtrl ? 1 : 0; + int matColNum = allocMatCol ? 1 : 0; + int alpCompNum = allocAlpComp ? 1 : 0; int blendModeNum = allocBlendMode ? 1 : 0; - if (mGXMemCap.texMap >= texMapNum && mGXMemCap.texSRT >= texSRTNum && mGXMemCap.texCoordGen >= texCoordGenNum - && mGXMemCap.tevStage >= tevStageNum && mGXMemCap.tevSwap >= tevSwapNum - && mGXMemCap.indStage >= indStageNum && mGXMemCap.indSRT >= indSRTNum - && mGXMemCap.chanCtrl >= chanCtrlNum && mGXMemCap.matCol >= matColNum - && mGXMemCap.alpComp >= alpCompNum && mGXMemCap.blendMode >= blendModeNum) { + if (mGXMemCap.texMap >= texMapNum && mGXMemCap.texSRT >= texSRTNum && mGXMemCap.texCoordGen >= texCoordGenNum && + mGXMemCap.tevStage >= tevStageNum && mGXMemCap.tevSwap >= tevSwapNum && mGXMemCap.indStage >= indStageNum && + mGXMemCap.indSRT >= indSRTNum && mGXMemCap.chanCtrl >= chanCtrlNum && mGXMemCap.matCol >= matColNum && + mGXMemCap.alpComp >= alpCompNum && mGXMemCap.blendMode >= blendModeNum) { return; } @@ -412,13 +425,9 @@ namespace nw4r { InitBitGXNums(&mGXMemNum); } - mpGXMem = Layout::AllocMemory( - 4 - * (matColNum + chanCtrlNum + texCoordGenNum + tevSwapNum + alpCompNum + blendModeNum + indStageNum) - + ((int)sizeof(TexSRT) * texSRTNum) - + ((int)sizeof(GXTexObj) * texMapNum) - + ((int)sizeof(TexSRT) * indSRTNum) - + ((int)sizeof(TevStage) * tevStageNum)); + mpGXMem = Layout::AllocMemory(4 * (matColNum + chanCtrlNum + texCoordGenNum + tevSwapNum + alpCompNum + blendModeNum + indStageNum) + + ((int)sizeof(TexSRT) * texSRTNum) + ((int)sizeof(GXTexObj) * texMapNum) + + ((int)sizeof(TexSRT) * indSRTNum) + ((int)sizeof(TevStage) * tevStageNum)); if (mpGXMem == NULL) { return; @@ -529,7 +538,7 @@ namespace nw4r { } const BlendMode* Material::GetBlendModePtr() const { - return detail::ConvertOffsToPtr(mpGXMem,CalcOffsetBlendMode(mGXMemCap)); + return detail::ConvertOffsToPtr(mpGXMem, CalcOffsetBlendMode(mGXMemCap)); } BlendMode* Material::GetBlendModePtr() { @@ -612,7 +621,7 @@ namespace nw4r { } void Material::GetTexture(GXTexObj* pTexObj, u8 texMapIdx) const { - CopyGXTexObj(pTexObj,&GetTexMapAry()[texMapIdx]); + CopyGXTexObj(pTexObj, &GetTexMapAry()[texMapIdx]); } void Material::SetTexture(u8 texMapIdx, TPLPalette* pTplRes) { @@ -643,7 +652,7 @@ namespace nw4r { ut::Color* matCols = GetMatColAry(); SetColorComponentValue(matCols, colorType & 3, value); } - + break; } case ANIMTARGET_MATCOLOR_TEV0R: @@ -703,26 +712,10 @@ namespace nw4r { } bool Material::SetupGX(bool bModVtxCol, u8 alpha) { - static GXTevKColorSel kColSels[GX_MAX_TEXMAP] = { - GX_TEV_KCSEL_K3_A, - GX_TEV_KCSEL_K3_B, - GX_TEV_KCSEL_K3_G, - GX_TEV_KCSEL_K3_R, - GX_TEV_KCSEL_K2_A, - GX_TEV_KCSEL_K2_B, - GX_TEV_KCSEL_K2_G, - GX_TEV_KCSEL_K2_R - }; - static GXTevKAlphaSel kAlpSels[GX_MAX_TEXMAP] = { - GX_TEV_KASEL_K3_A, - GX_TEV_KASEL_K3_B, - GX_TEV_KASEL_K3_G, - GX_TEV_KASEL_K3_R, - GX_TEV_KASEL_K2_A, - GX_TEV_KASEL_K2_B, - GX_TEV_KASEL_K2_G, - GX_TEV_KASEL_K2_R - }; + static GXTevKColorSel kColSels[GX_MAX_TEXMAP] = {GX_TEV_KCSEL_K3_A, GX_TEV_KCSEL_K3_B, GX_TEV_KCSEL_K3_G, GX_TEV_KCSEL_K3_R, + GX_TEV_KCSEL_K2_A, GX_TEV_KCSEL_K2_B, GX_TEV_KCSEL_K2_G, GX_TEV_KCSEL_K2_R}; + static GXTevKAlphaSel kAlpSels[GX_MAX_TEXMAP] = {GX_TEV_KASEL_K3_A, GX_TEV_KASEL_K3_B, GX_TEV_KASEL_K3_G, GX_TEV_KASEL_K3_R, + GX_TEV_KASEL_K2_A, GX_TEV_KASEL_K2_B, GX_TEV_KASEL_K2_G, GX_TEV_KASEL_K2_R}; bool bUseVtxCol = true; bool bUseMatCol = false; @@ -737,8 +730,7 @@ namespace nw4r { bUseVtxCol = chanCtrls->GetColorSrc() == GX_SRC_VTX || chanCtrls->GetAlphaSrc() == GX_SRC_VTX; bUseMatCol = chanCtrls->GetColorSrc() == GX_SRC_REG || chanCtrls->GetAlphaSrc() == GX_SRC_REG; - } - else { + } else { GXSetChanCtrl(GX_COLOR0A0, false, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); } @@ -834,12 +826,10 @@ namespace nw4r { if (IsTevSwapCap()) { TevSwapMode* tevSwaps = GetTevSwapAry(); for (int i = 0; i < GX_MAX_TEVSWAP; i++) { - GXSetTevSwapModeTable(static_cast(i), - tevSwaps[i].GetR(), tevSwaps[i].GetG(), - tevSwaps[i].GetB(), tevSwaps[i].GetA()); + GXSetTevSwapModeTable(static_cast(i), tevSwaps[i].GetR(), tevSwaps[i].GetG(), tevSwaps[i].GetB(), + tevSwaps[i].GetA()); } - } - else { + } else { GXSetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA); GXSetTevSwapModeTable(GX_TEV_SWAP1, GX_CH_RED, GX_CH_RED, GX_CH_RED, GX_CH_ALPHA); GXSetTevSwapModeTable(GX_TEV_SWAP2, GX_CH_GREEN, GX_CH_GREEN, GX_CH_GREEN, GX_CH_ALPHA); @@ -860,42 +850,30 @@ namespace nw4r { for (int i = 0; i < mGXMemNum.tevStage; i++) { GXTevStageID tevStage = static_cast(i); - GXSetTevOrder(tevStage, tevStages[i].GetTexCoordGen(), - tevStages[i].GetTexMap(), - tevStages[i].GetColorChan()); + GXSetTevOrder(tevStage, tevStages[i].GetTexCoordGen(), tevStages[i].GetTexMap(), tevStages[i].GetColorChan()); GXSetTevSwapMode(tevStage, tevStages[i].GetRasSwapSel(), tevStages[i].GetTexSwapSel()); - GXSetTevColorIn(tevStage, - tevStages[i].GetColorInA(), - tevStages[i].GetColorInB(), - tevStages[i].GetColorInC(), + GXSetTevColorIn(tevStage, tevStages[i].GetColorInA(), tevStages[i].GetColorInB(), tevStages[i].GetColorInC(), tevStages[i].GetColorInD()); - GXSetTevColorOp(tevStage, tevStages[i].GetColorOp(), - tevStages[i].GetColorBias(), tevStages[i].GetColorScale(), + GXSetTevColorOp(tevStage, tevStages[i].GetColorOp(), tevStages[i].GetColorBias(), tevStages[i].GetColorScale(), tevStages[i].IsColorClamp(), tevStages[i].GetColorOutReg()); GXSetTevKColorSel(tevStage, tevStages[i].GetKColorSel()); - GXSetTevAlphaIn(tevStage, - tevStages[i].GetAlphaInA(), - tevStages[i].GetAlphaInB(), - tevStages[i].GetAlphaInC(), + GXSetTevAlphaIn(tevStage, tevStages[i].GetAlphaInA(), tevStages[i].GetAlphaInB(), tevStages[i].GetAlphaInC(), tevStages[i].GetAlphaInD()); - GXSetTevAlphaOp(tevStage, tevStages[i].GetAlphaOp(), - tevStages[i].GetAlphaBias(), tevStages[i].GetAlphaScale(), + GXSetTevAlphaOp(tevStage, tevStages[i].GetAlphaOp(), tevStages[i].GetAlphaBias(), tevStages[i].GetAlphaScale(), tevStages[i].IsAlphaClamp(), tevStages[i].GetAlphaOutReg()); GXSetTevKAlphaSel(tevStage, tevStages[i].GetKAlphaSel()); GXIndTexMtxID indMtxSel = tevStages[i].GetIndMtxSel(); - GXSetTevIndirect(tevStage, tevStages[i].GetIndStage(), - tevStages[i].GetIndFormat(), tevStages[i].GetIndBiasSel(), - indMtxSel, tevStages[i].GetIndWrapS(), - tevStages[i].GetIndWrapT(), tevStages[i].IsIndAddPrev(), - tevStages[i].IsIndUtcLod(), tevStages[i].GetIndAlphaSel()); + GXSetTevIndirect(tevStage, tevStages[i].GetIndStage(), tevStages[i].GetIndFormat(), tevStages[i].GetIndBiasSel(), indMtxSel, + tevStages[i].GetIndWrapS(), tevStages[i].GetIndWrapT(), tevStages[i].IsIndAddPrev(), tevStages[i].IsIndUtcLod(), + tevStages[i].GetIndAlphaSel()); if (GX_ITM_0 <= indMtxSel && indMtxSel <= GX_ITM_2) { bUseIndTexMtx[indMtxSel - 1] = true; @@ -904,8 +882,7 @@ namespace nw4r { } bUseRasStage = true; - } - else { + } else { u8 tevStageID = GX_TEVSTAGE0; if (mGXMemNum.texMap == GX_TEXMAP0) { @@ -917,8 +894,7 @@ namespace nw4r { tevStageID++; bUseRasStage = true; - } - else { + } else { if (mGXMemNum.texMap == GX_TEXMAP1) { GXTevStageID tevStage = static_cast(tevStageID); @@ -927,8 +903,7 @@ namespace nw4r { GXSetTevAlphaIn(tevStage, GX_CA_A0, GX_CA_A1, GX_CA_TEXA, GX_CA_ZERO); tevStageID++; - } - else { + } else { if (mGXMemNum.texMap == GX_TEXMAP2) { GXTevStageID tevStage; @@ -948,8 +923,7 @@ namespace nw4r { GXSetTevKAlphaSel(tevStage, kAlpSels[GX_TEXMAP0]); tevStageID++; - } - else { + } else { for (int i = 0; i < mGXMemNum.texMap; i++) { GXTevStageID tevStage = static_cast(tevStageID); @@ -1032,19 +1006,15 @@ namespace nw4r { if (IsAlphaCompareCap()) { AlphaCompare* pAlpComp = GetAlphaComparePtr(); - GXSetAlphaCompare(pAlpComp->GetComp0(), pAlpComp->GetRef0(), - pAlpComp->GetOp(), pAlpComp->GetComp1(), - pAlpComp->GetRef1()); - } - else { + GXSetAlphaCompare(pAlpComp->GetComp0(), pAlpComp->GetRef0(), pAlpComp->GetOp(), pAlpComp->GetComp1(), pAlpComp->GetRef1()); + } else { GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0); } if (IsBlendModeCap()) { BlendMode* pBlendMode = GetBlendModePtr(); GXSetBlendMode(pBlendMode->GetType(), pBlendMode->GetSrcFactor(), pBlendMode->GetDstFactor(), pBlendMode->GetOp()); - } - else { + } else { GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET); } @@ -1103,5 +1073,5 @@ namespace nw4r { return Size(GXGetTexObjWidth(&texObj), GXGetTexObjHeight(&texObj)); } - } -} + } // namespace lyt +} // namespace nw4r diff --git a/libs/NW4R/src/lyt/lyt_pane.cpp b/libs/NW4R/src/lyt/lyt_pane.cpp index ae5011eb..2611ef73 100644 --- a/libs/NW4R/src/lyt/lyt_pane.cpp +++ b/libs/NW4R/src/lyt/lyt_pane.cpp @@ -1,6 +1,6 @@ -#include -#include #include +#include +#include #include @@ -16,7 +16,7 @@ namespace { pMtx->m[1][1] = -pMtx->m[1][1]; pMtx->m[2][1] = -pMtx->m[2][1]; } -} +} // namespace namespace nw4r { namespace lyt { @@ -30,15 +30,15 @@ namespace nw4r { memset(mName, 0, sizeof(mName)); memset(mUserData, 0, sizeof(mUserData)); - mTranslate = math::VEC3(0.0f, 0.0f, 0.0f); + mTranslate = math::VEC3(0.0f, 0.0f, 0.0f); - mRotate = math::VEC3(0.0f, 0.0f, 0.0f); + mRotate = math::VEC3(0.0f, 0.0f, 0.0f); - mScale = math::VEC2(1.0f, 1.0f); - mSize = Size(0.0f, 0.0f); + mScale = math::VEC2(1.0f, 1.0f); + mSize = Size(0.0f, 0.0f); - mAlpha = ut::Color(255); - mGlbAlpha = mAlpha; + mAlpha = ut::Color(255); + mGlbAlpha = mAlpha; mFlag = 0; @@ -53,17 +53,17 @@ namespace nw4r { SetName(pBlock->name); SetUserData(pBlock->userData); - mTranslate = pBlock->translate; + mTranslate = pBlock->translate; - mRotate = pBlock->rotate; + mRotate = pBlock->rotate; - mScale = pBlock->scale; - mSize = pBlock->size; + mScale = pBlock->scale; + mSize = pBlock->size; - mAlpha = pBlock->alpha; - mGlbAlpha = mAlpha; + mAlpha = pBlock->alpha; + mGlbAlpha = mAlpha; - mFlag = pBlock->flag; + mFlag = pBlock->flag; } void Pane::Init() { @@ -142,7 +142,8 @@ namespace nw4r { return ut::Color(ut::Color::WHITE); } - void Pane::SetVtxColor(u32, ut::Color) {} + void Pane::SetVtxColor(u32, ut::Color) { + } u8 Pane::GetColorElement(u32 idx) const { NW4R_ASSERT(idx < ANIMTARGET_PANE_COLOR_MAX); @@ -162,7 +163,7 @@ namespace nw4r { case ANIMTARGET_PANE_COLOR_ALPHA: { mAlpha = value; break; - } + } default: { SetVtxColorElement(idx, value); break; @@ -174,7 +175,8 @@ namespace nw4r { return 255; } - void Pane::SetVtxColorElement(u32 idx, u8 alpha) {} + void Pane::SetVtxColorElement(u32 idx, u8 alpha) { + } Pane* Pane::FindPaneByName(const char* findName, bool bRecursive) { if (detail::EqualsPaneName(mName, findName)) { @@ -245,18 +247,15 @@ namespace nw4r { if (mpParent != NULL) { math::MTX34Mult(&mGlbMtx, &mpParent->mGlbMtx, &mMtx); - } - else if (drawInfo.IsMultipleViewMtxOnDraw()) { + } else if (drawInfo.IsMultipleViewMtxOnDraw()) { mGlbMtx = mMtx; - } - else { + } else { math::MTX34Mult(&mGlbMtx, &drawInfo.GetViewMtx(), &mMtx); } if (drawInfo.IsInfluencedAlpha() && mpParent != NULL) { mGlbAlpha = mAlpha * drawInfo.GetGlobalAlpha(); - } - else { + } else { mGlbAlpha = mAlpha; } @@ -266,7 +265,7 @@ namespace nw4r { bool bModDrawInfo = IsInfluencedAlpha() && mAlpha != 0xFF; if (bModDrawInfo) { - DrawInfo& mtDrawInfo = const_cast(drawInfo); + DrawInfo& mtDrawInfo = const_cast(drawInfo); mtDrawInfo.SetGlobalAlpha(crGlobalAlpha * mAlpha * invAlpha); mtDrawInfo.SetInfluencedAlpha(true); @@ -275,7 +274,7 @@ namespace nw4r { CalculateMtxChild(drawInfo); if (bModDrawInfo) { - DrawInfo& mtDrawInfo = const_cast(drawInfo); + DrawInfo& mtDrawInfo = const_cast(drawInfo); mtDrawInfo.SetGlobalAlpha(crGlobalAlpha); mtDrawInfo.SetInfluencedAlpha(bCrInfluenced); @@ -298,37 +297,38 @@ namespace nw4r { } } - void Pane::DrawSelf(const DrawInfo& drawInfo) {} - + void Pane::DrawSelf(const DrawInfo& drawInfo) { + } + void Pane::Animate(u32 option) { AnimateSelf(option); - + if (IsVisible() || !(option & ANIMOPTION_SKIP_INVISIBLE)) { for (PaneList::Iterator it = mChildList.GetBeginIter(); it != mChildList.GetEndIter(); it++) { it->Animate(option); } } } - + void Pane::AnimateSelf(u32 option) { for (AnimationLinkList::Iterator it = mAnimList.GetBeginIter(); it != mAnimList.GetEndIter(); it++) { if (it->IsEnable()) { - AnimTransform *animTrans = it->GetAnimTransform(); - + AnimTransform* animTrans = it->GetAnimTransform(); + animTrans->Animate(it->GetIndex(), this); } } - + if ((IsVisible() || !(option & ANIMOPTION_SKIP_INVISIBLE)) && mpMaterial != NULL) { mpMaterial->Animate(); } } - void Pane::BindAnimation(AnimTransform *animTrans, bool bRecursive) { + void Pane::BindAnimation(AnimTransform* animTrans, bool bRecursive) { animTrans->Bind(this, bRecursive); } - void Pane::UnbindAnimation(AnimTransform *animTrans, bool bRecursive) { + void Pane::UnbindAnimation(AnimTransform* animTrans, bool bRecursive) { UnbindAnimationSelf(animTrans); if (bRecursive) { @@ -342,7 +342,7 @@ namespace nw4r { UnbindAnimation(NULL, bRecursive); } - void Pane::UnbindAnimationSelf(AnimTransform *animTrans) { + void Pane::UnbindAnimationSelf(AnimTransform* animTrans) { if (mpMaterial != NULL) { mpMaterial->UnbindAnimation(animTrans); } @@ -357,17 +357,17 @@ namespace nw4r { } } - void Pane::AddAnimationLink(AnimationLink *animationLink) { + void Pane::AddAnimationLink(AnimationLink* animationLink) { mAnimList.PushBack(animationLink); } - AnimationLink *Pane::FindAnimationLink(AnimTransform *animTrans) { - if (AnimationLink *ret = detail::FindAnimationLink(&mAnimList, animTrans)) { + AnimationLink* Pane::FindAnimationLink(AnimTransform* animTrans) { + if (AnimationLink* ret = detail::FindAnimationLink(&mAnimList, animTrans)) { return ret; } if (mpMaterial != NULL) { - if (AnimationLink *ret = mpMaterial->FindAnimationLink(animTrans)) { + if (AnimationLink* ret = mpMaterial->FindAnimationLink(animTrans)) { return ret; } } @@ -375,8 +375,8 @@ namespace nw4r { return NULL; } - void Pane::SetAnimationEnable(AnimTransform *animTrans, bool bEnable, bool bRecursive) { - if (AnimationLink *animLink = detail::FindAnimationLink(&mAnimList, animTrans)) { + void Pane::SetAnimationEnable(AnimTransform* animTrans, bool bEnable, bool bRecursive) { + if (AnimationLink* animLink = detail::FindAnimationLink(&mAnimList, animTrans)) { animLink->SetEnable(bEnable); } @@ -403,13 +403,11 @@ namespace nw4r { } mtxPtr = mtx; - } - else if (drawInfo.IsYAxisUp()) { + } else if (drawInfo.IsYAxisUp()) { math::MTX34Copy(&mtx, &mGlbMtx); ReverseYAxis(&mtx); mtxPtr = mtx; - } - else { + } else { mtxPtr = mGlbMtx; } @@ -455,8 +453,8 @@ namespace nw4r { return basePt; } - Material *Pane::GetMaterial() const { + Material* Pane::GetMaterial() const { return mpMaterial; } - } -} + } // namespace lyt +} // namespace nw4r diff --git a/libs/NW4R/src/lyt/lyt_picture.cpp b/libs/NW4R/src/lyt/lyt_picture.cpp index 3aae98b9..1db2120d 100644 --- a/libs/NW4R/src/lyt/lyt_picture.cpp +++ b/libs/NW4R/src/lyt/lyt_picture.cpp @@ -1,6 +1,6 @@ -#include -#include #include +#include +#include #include @@ -13,13 +13,12 @@ namespace nw4r { Material* pMemMaterial = static_cast(Layout::AllocMemory(sizeof(*pMemMaterial))); if (pMemMaterial != NULL) { - mpMaterial = new(pMemMaterial) Material(); + mpMaterial = new (pMemMaterial) Material(); mpMaterial->ReserveGXMem(num, num, num, 0, false, 0, 0, false, false, false, false); } } - Picture::Picture(const res::Picture* pResPic, const ResBlockSet& resBlockSet) : - Pane(pResPic) { + Picture::Picture(const res::Picture* pResPic, const ResBlockSet& resBlockSet) : Pane(pResPic) { u8 texCoordNum = ut::Min(pResPic->texCoordNum, GX_MAX_TEXCOORD); Init(texCoordNum); @@ -34,12 +33,11 @@ namespace nw4r { Material* pMemMaterial = static_cast(Layout::AllocMemory(sizeof(*pMemMaterial))); if (pMemMaterial != NULL) { - const u32* matOffsTbl = detail::ConvertOffsToPtr(resBlockSet.pMaterialList, - sizeof(*resBlockSet.pMaterialList)); - const res::Material* pResMaterial = detail::ConvertOffsToPtr(resBlockSet.pMaterialList, - matOffsTbl[pResPic->materialIdx]); + const u32* matOffsTbl = detail::ConvertOffsToPtr(resBlockSet.pMaterialList, sizeof(*resBlockSet.pMaterialList)); + const res::Material* pResMaterial = + detail::ConvertOffsToPtr(resBlockSet.pMaterialList, matOffsTbl[pResPic->materialIdx]); - mpMaterial = new(pMemMaterial) Material(pResMaterial, resBlockSet); + mpMaterial = new (pMemMaterial) Material(pResMaterial, resBlockSet); } } @@ -65,8 +63,7 @@ namespace nw4r { } void Picture::Append(const GXTexObj& texObj) { - if (mpMaterial->GetTextureNum() >= mpMaterial->GetTextureCap() - || mpMaterial->GetTextureNum() >= mpMaterial->GetTexCoordGenCap()) { + if (mpMaterial->GetTextureNum() >= mpMaterial->GetTextureCap() || mpMaterial->GetTextureNum() >= mpMaterial->GetTexCoordGenCap()) { return; } @@ -132,9 +129,7 @@ namespace nw4r { bool bUseVtxCol = mpMaterial->SetupGX(detail::IsModulateVertexColor(mVtxColors, mGlbAlpha), mGlbAlpha); detail::SetVertexFormat(bUseVtxCol, mTexCoordAry.GetSize()); - detail::DrawQuad(GetVtxPos(), mSize, - mTexCoordAry.GetSize(), mTexCoordAry.GetArray(), - bUseVtxCol ? mVtxColors : NULL, mGlbAlpha); + detail::DrawQuad(GetVtxPos(), mSize, mTexCoordAry.GetSize(), mTexCoordAry.GetArray(), bUseVtxCol ? mVtxColors : NULL, mGlbAlpha); } - } -} + } // namespace lyt +} // namespace nw4r diff --git a/libs/NW4R/src/lyt/lyt_resourceAccessor.cpp b/libs/NW4R/src/lyt/lyt_resourceAccessor.cpp index e379e95e..2b8719a1 100644 --- a/libs/NW4R/src/lyt/lyt_resourceAccessor.cpp +++ b/libs/NW4R/src/lyt/lyt_resourceAccessor.cpp @@ -2,11 +2,13 @@ namespace nw4r { namespace lyt { - ResourceAccessor::~ResourceAccessor() {} - ResourceAccessor::ResourceAccessor() {} + ResourceAccessor::~ResourceAccessor() { + } + ResourceAccessor::ResourceAccessor() { + } ut::Font* ResourceAccessor::GetFont(const char* name) { return NULL; } - } -} + } // namespace lyt +} // namespace nw4r diff --git a/libs/NW4R/src/lyt/lyt_textBox.cpp b/libs/NW4R/src/lyt/lyt_textBox.cpp index f2dbb773..47eef443 100644 --- a/libs/NW4R/src/lyt/lyt_textBox.cpp +++ b/libs/NW4R/src/lyt/lyt_textBox.cpp @@ -1,6 +1,6 @@ -#include -#include #include +#include +#include #include #include @@ -14,7 +14,7 @@ namespace nw4r { namespace lyt { NW4R_UT_GET_DERIVED_RUNTIME_TYPEINFO(TextBox, Pane); } -} +} // namespace nw4r namespace { using namespace nw4r; @@ -36,9 +36,11 @@ namespace { return value < 0 ? 0 : (value > 255 ? 255 : value); } - template int CalcLineRectImpl(ut::Rect* pRect, ut::TextWriterBase* pTextWriter, const T* str, int length, f32 maxWidth, bool* pbOver); + template + int CalcLineRectImpl(ut::Rect* pRect, ut::TextWriterBase* pTextWriter, const T* str, int length, f32 maxWidth, bool* pbOver); - template int CalcLineStrNum(f32* pWidth, ut::TextWriterBase* pTextWriter, const T* str, int length, f32 maxWidth, bool* pbOver) { + template + int CalcLineStrNum(f32* pWidth, ut::TextWriterBase* pTextWriter, const T* str, int length, f32 maxWidth, bool* pbOver) { ut::Rect rect; ut::TextWriterBase myCopy = *pTextWriter; myCopy.SetCursor(0.0f, 0.0f); @@ -49,7 +51,8 @@ namespace { return ret; } - template int CalcLineRectImpl(ut::Rect* pRect, ut::TextWriterBase* pTextWriter, const T* str, int length, f32 maxWidth, bool* pbOver) { + template + int CalcLineRectImpl(ut::Rect* pRect, ut::TextWriterBase* pTextWriter, const T* str, int length, f32 maxWidth, bool* pbOver) { ut::PrintContext context = {pTextWriter, str, 0.0f, 0.0f, 0}; const ut::Font* font = pTextWriter->GetFont(); @@ -65,13 +68,13 @@ namespace { pRect->bottom = ut::Max(0.0f, pTextWriter->GetLineHeight()); *pbOver = false; - + reader.Set(str); ut::Rect prMaxRect = *pRect; for (u16 code = reader.Next(); static_cast(reader.GetCurrentPos()) - str <= length; - prStrPos = static_cast(reader.GetCurrentPos()), code = reader.Next(), prMaxRect = *pRect) { + prStrPos = static_cast(reader.GetCurrentPos()), code = reader.Next(), prMaxRect = *pRect) { if ((int)code < L' ') { ut::Operation operation; ut::Rect rect(x, 0.0f, 0.0f, 0.0f); @@ -100,18 +103,14 @@ namespace { if (operation == ut::OPERATION_END_DRAW) { return length; - } - else if (operation == ut::OPERATION_NO_CHAR_SPACE) { + } else if (operation == ut::OPERATION_NO_CHAR_SPACE) { bCharSpace = false; - } - else if (operation == ut::OPERATION_CHAR_SPACE) { + } else if (operation == ut::OPERATION_CHAR_SPACE) { bCharSpace = true; - } - else if (operation == ut::OPERATION_NEXT_LINE) { + } else if (operation == ut::OPERATION_NEXT_LINE) { goto end_draw; } - } - else { + } else { if (bCharSpace) { x += pTextWriter->GetCharSpace(); } @@ -120,10 +119,8 @@ namespace { if (pTextWriter->IsWidthFixed()) { x += pTextWriter->GetFixedWidth(); - } - else { - x += pTextWriter->GetFont()->GetCharWidth(code) - *pTextWriter->GetScaleH(); + } else { + x += pTextWriter->GetFont()->GetCharWidth(code) * pTextWriter->GetScaleH(); } pRect->left = ut::Min(pRect->left, x); @@ -140,20 +137,22 @@ namespace { if (*pbOver && prStrPos) { *pRect = prMaxRect; return prStrPos - str; - } - else { + } else { return static_cast(reader.GetCurrentPos()) - str; } } - template void CalcStringRectImpl(ut::Rect* pRect, ut::TextWriterBase* pTextWriter, const T* str, int length, f32 maxWidth); + template + void CalcStringRectImpl(ut::Rect* pRect, ut::TextWriterBase* pTextWriter, const T* str, int length, f32 maxWidth); - template void CalcStringRect(ut::Rect* pRect, ut::TextWriterBase* pTextWriter, const T* str, int length, f32 maxWidth) { + template + void CalcStringRect(ut::Rect* pRect, ut::TextWriterBase* pTextWriter, const T* str, int length, f32 maxWidth) { ut::TextWriterBase myCopy = *pTextWriter; - CalcStringRectImpl(pRect,&myCopy, str, length, maxWidth); + CalcStringRectImpl(pRect, &myCopy, str, length, maxWidth); } - template void CalcStringRectImpl(ut::Rect* pRect, ut::TextWriterBase* pTextWriter, const T* str, int length, f32 maxWidth) { + template + void CalcStringRectImpl(ut::Rect* pRect, ut::TextWriterBase* pTextWriter, const T* str, int length, f32 maxWidth) { int remain = length; const T* pos = str; @@ -181,7 +180,7 @@ namespace { pRect->bottom = ut::Max(pRect->bottom, rect.bottom); } while (remain > 0); } -} +} // namespace namespace nw4r { namespace lyt { @@ -191,8 +190,7 @@ namespace nw4r { SetFont(pFont); } - TextBox::TextBox(const res::TextBox* pBlock, const ResBlockSet& resBlockSet) : - Pane(pBlock) { + TextBox::TextBox(const res::TextBox* pBlock, const ResBlockSet& resBlockSet) : Pane(pBlock) { u16 allocStrBufLen = pBlock->textBufBytes / sizeof(wchar_t); if (allocStrBufLen) { allocStrBufLen = allocStrBufLen - 1; @@ -222,10 +220,9 @@ namespace nw4r { if (ut::Font* pFont = resBlockSet.pResAccessor->GetFont(fontName)) { mpFont = pFont; - } - else if (void* fontRes = resBlockSet.pResAccessor->GetResource('font', fontName, NULL)) { + } else if (void* fontRes = resBlockSet.pResAccessor->GetResource('font', fontName, NULL)) { if (void* pMemFont = Layout::AllocMemory(sizeof(ut::ResFont))) { - ut::ResFont* pResFont = new(pMemFont) ut::ResFont(); + ut::ResFont* pResFont = new (pMemFont) ut::ResFont(); bool bSuccess = pResFont->SetResource(fontRes); mpFont = pResFont; @@ -234,13 +231,12 @@ namespace nw4r { } if (void* pMemMaterial = Layout::AllocMemory(sizeof(Material))) { - const u32* matOffsTbl = detail::ConvertOffsToPtr(resBlockSet.pMaterialList, - sizeof(*resBlockSet.pMaterialList)); + const u32* matOffsTbl = detail::ConvertOffsToPtr(resBlockSet.pMaterialList, sizeof(*resBlockSet.pMaterialList)); - const res::Material* pResMaterial = detail::ConvertOffsToPtr(resBlockSet.pMaterialList, - matOffsTbl[pBlock->materialIdx]); + const res::Material* pResMaterial = + detail::ConvertOffsToPtr(resBlockSet.pMaterialList, matOffsTbl[pBlock->materialIdx]); - mpMaterial = new(pMemMaterial) Material(pResMaterial, resBlockSet); + mpMaterial = new (pMemMaterial) Material(pResMaterial, resBlockSet); } } @@ -313,7 +309,7 @@ namespace nw4r { ut::Rect rect = GetTextDrawRect(&writer); if (drawInfo.IsYAxisUp()) { - rect.top = -rect.top; + rect.top = -rect.top; rect.bottom = -rect.bottom; } @@ -335,8 +331,7 @@ namespace nw4r { ut::Color topCol = detail::MultipleAlpha(mTextColors[TEXTCOLOR_TOP], mGlbAlpha); ut::Color btmCol = detail::MultipleAlpha(mTextColors[TEXTCOLOR_BOTTOM], mGlbAlpha); - writer.SetGradationMode(topCol != btmCol ? ut::CharWriter::GRADMODE_V - : ut::CharWriter::GRADMODE_NONE); + writer.SetGradationMode(topCol != btmCol ? ut::CharWriter::GRADMODE_V : ut::CharWriter::GRADMODE_NONE); writer.SetTextColor(topCol, btmCol); @@ -432,8 +427,8 @@ namespace nw4r { return cpLen; } - const ut::Font* TextBox::GetFont() const - { return mpFont; + const ut::Font* TextBox::GetFont() const { + return mpFont; } void TextBox::SetFont(const ut::Font* pFont) { @@ -447,8 +442,7 @@ namespace nw4r { if (mpFont) { SetFontSize(Size(mpFont->GetWidth(), mpFont->GetHeight())); - } - else { + } else { SetFontSize(Size(0.0f, 0.0f)); } } @@ -461,7 +455,7 @@ namespace nw4r { math::VEC2 basePt = Pane::GetVtxPos(); - textRect.MoveTo(basePt.x + (mSize.width - textRect.GetWidth()) * GetTextMagH(), + textRect.MoveTo(basePt.x + (mSize.width - textRect.GetWidth()) * GetTextMagH(), basePt.y + (mSize.height - textRect.GetHeight()) * GetTextMagV()); return textRect; @@ -510,5 +504,5 @@ namespace nw4r { return vMag; } - } -} + } // namespace lyt +} // namespace nw4r diff --git a/libs/NW4R/src/lyt/lyt_window.cpp b/libs/NW4R/src/lyt/lyt_window.cpp index 763d2030..0390d50b 100644 --- a/libs/NW4R/src/lyt/lyt_window.cpp +++ b/libs/NW4R/src/lyt/lyt_window.cpp @@ -1,9 +1,10 @@ #include +#include +#include #include #include -#include -#include + #include @@ -13,7 +14,7 @@ namespace nw4r { namespace lyt { NW4R_UT_GET_DERIVED_RUNTIME_TYPEINFO(Window, Pane); } -} +} // namespace nw4r namespace { using namespace nw4r; @@ -27,6 +28,7 @@ namespace { TextureFlipInfo& GetTexutreFlipInfo(u8 textureFlip) { NW4R_ASSERT(textureFlip < TEXTUREFLIP_MAX); + // clang-format off static TextureFlipInfo flipInfos[] = { // 0 1 2 3 // in order of LT RT LB RB {{{0, 0}, {1, 0}, {0, 1}, {1, 1}}, {0, 1}}, // 0 1 2 3 No flip @@ -36,6 +38,7 @@ namespace { {{{1, 1}, {0, 1}, {1, 0}, {0, 0}}, {0, 1}}, // 3 2 1 0 Clockwise 180 degrees {{{1, 0}, {1, 1}, {0, 0}, {0, 1}}, {1, 0}} // 1 3 0 2, Index flip Clockwise 270 degrees }; + // clang-format on return flipInfos[textureFlip]; } @@ -53,19 +56,17 @@ namespace { const math::VEC2 tSz(texSize.width, texSize.height); - texCds[VERTEXCOLOR_LT][ix] = texCds[VERTEXCOLOR_LB][ix] = - flipInfo.coords[VERTEXCOLOR_LT][ix]; + texCds[VERTEXCOLOR_LT][ix] = texCds[VERTEXCOLOR_LB][ix] = flipInfo.coords[VERTEXCOLOR_LT][ix]; - texCds[VERTEXCOLOR_LT][iy] = texCds[VERTEXCOLOR_RT][iy] = - flipInfo.coords[VERTEXCOLOR_LT][iy]; + texCds[VERTEXCOLOR_LT][iy] = texCds[VERTEXCOLOR_RT][iy] = flipInfo.coords[VERTEXCOLOR_LT][iy]; texCds[VERTEXCOLOR_RB][ix] = texCds[VERTEXCOLOR_RT][ix] = - flipInfo.coords[VERTEXCOLOR_LT][ix] + polSize.width / - ((flipInfo.coords[VERTEXCOLOR_RT][ix] - flipInfo.coords[VERTEXCOLOR_LT][ix]) * tSz[ix]); - + flipInfo.coords[VERTEXCOLOR_LT][ix] + + polSize.width / ((flipInfo.coords[VERTEXCOLOR_RT][ix] - flipInfo.coords[VERTEXCOLOR_LT][ix]) * tSz[ix]); + texCds[VERTEXCOLOR_RB][iy] = texCds[VERTEXCOLOR_LB][iy] = - flipInfo.coords[VERTEXCOLOR_LT][iy] + polSize.height / - ((flipInfo.coords[VERTEXCOLOR_LB][iy] - flipInfo.coords[VERTEXCOLOR_LT][iy]) * tSz[iy]); + flipInfo.coords[VERTEXCOLOR_LT][iy] + + polSize.height / ((flipInfo.coords[VERTEXCOLOR_LB][iy] - flipInfo.coords[VERTEXCOLOR_LT][iy]) * tSz[iy]); } void GetRTFrameSize(math::VEC2* pPt, Size* pSize, const math::VEC2& basePt, const Size& winSize, const WindowFrameSize& frameSize) { @@ -81,19 +82,17 @@ namespace { const math::VEC2 tSz(texSize.width, texSize.height); - texCds[VERTEXCOLOR_RT][ix] = texCds[VERTEXCOLOR_RB][ix] = - flipInfo.coords[VERTEXCOLOR_RT][ix]; + texCds[VERTEXCOLOR_RT][ix] = texCds[VERTEXCOLOR_RB][ix] = flipInfo.coords[VERTEXCOLOR_RT][ix]; - texCds[VERTEXCOLOR_RT][iy] = texCds[VERTEXCOLOR_LT][iy] = - flipInfo.coords[VERTEXCOLOR_RT][iy]; + texCds[VERTEXCOLOR_RT][iy] = texCds[VERTEXCOLOR_LT][iy] = flipInfo.coords[VERTEXCOLOR_RT][iy]; texCds[VERTEXCOLOR_LB][ix] = texCds[VERTEXCOLOR_LT][ix] = - flipInfo.coords[VERTEXCOLOR_RT][ix] + polSize.width / - ((flipInfo.coords[VERTEXCOLOR_LT][ix] - flipInfo.coords[VERTEXCOLOR_RT][ix]) * tSz[ix]); - + flipInfo.coords[VERTEXCOLOR_RT][ix] + + polSize.width / ((flipInfo.coords[VERTEXCOLOR_LT][ix] - flipInfo.coords[VERTEXCOLOR_RT][ix]) * tSz[ix]); + texCds[VERTEXCOLOR_LB][iy] = texCds[VERTEXCOLOR_RB][iy] = - flipInfo.coords[VERTEXCOLOR_RT][iy] + polSize.height / - ((flipInfo.coords[VERTEXCOLOR_RB][iy] - flipInfo.coords[VERTEXCOLOR_RT][iy]) * tSz[iy]); + flipInfo.coords[VERTEXCOLOR_RT][iy] + + polSize.height / ((flipInfo.coords[VERTEXCOLOR_RB][iy] - flipInfo.coords[VERTEXCOLOR_RT][iy]) * tSz[iy]); } void GetLBFrameSize(math::VEC2* pPt, Size* pSize, const math::VEC2& basePt, const Size& winSize, const WindowFrameSize& frameSize) { @@ -109,19 +108,17 @@ namespace { const math::VEC2 tSz(texSize.width, texSize.height); - texCds[VERTEXCOLOR_LB][ix] = texCds[VERTEXCOLOR_LT][ix] = - flipInfo.coords[VERTEXCOLOR_LB][ix]; + texCds[VERTEXCOLOR_LB][ix] = texCds[VERTEXCOLOR_LT][ix] = flipInfo.coords[VERTEXCOLOR_LB][ix]; - texCds[VERTEXCOLOR_LB][iy] = texCds[VERTEXCOLOR_RB][iy] = - flipInfo.coords[VERTEXCOLOR_LB][iy]; + texCds[VERTEXCOLOR_LB][iy] = texCds[VERTEXCOLOR_RB][iy] = flipInfo.coords[VERTEXCOLOR_LB][iy]; texCds[VERTEXCOLOR_RT][ix] = texCds[VERTEXCOLOR_RB][ix] = - flipInfo.coords[VERTEXCOLOR_LB][ix] + polSize.width / - ((flipInfo.coords[VERTEXCOLOR_RB][ix] - flipInfo.coords[VERTEXCOLOR_LB][ix]) * tSz[ix]); - + flipInfo.coords[VERTEXCOLOR_LB][ix] + + polSize.width / ((flipInfo.coords[VERTEXCOLOR_RB][ix] - flipInfo.coords[VERTEXCOLOR_LB][ix]) * tSz[ix]); + texCds[VERTEXCOLOR_RT][iy] = texCds[VERTEXCOLOR_LT][iy] = - flipInfo.coords[VERTEXCOLOR_LB][iy] + polSize.height / - ((flipInfo.coords[VERTEXCOLOR_LT][iy] - flipInfo.coords[VERTEXCOLOR_LB][iy]) * tSz[iy]); + flipInfo.coords[VERTEXCOLOR_LB][iy] + + polSize.height / ((flipInfo.coords[VERTEXCOLOR_LT][iy] - flipInfo.coords[VERTEXCOLOR_LB][iy]) * tSz[iy]); } void GetRBFrameSize(math::VEC2* pPt, Size* pSize, const math::VEC2& basePt, const Size& winSize, const WindowFrameSize& frameSize) { @@ -137,34 +134,29 @@ namespace { const math::VEC2 tSz(texSize.width, texSize.height); - texCds[VERTEXCOLOR_RB][ix] = texCds[VERTEXCOLOR_RT][ix] = - flipInfo.coords[VERTEXCOLOR_RB][ix]; + texCds[VERTEXCOLOR_RB][ix] = texCds[VERTEXCOLOR_RT][ix] = flipInfo.coords[VERTEXCOLOR_RB][ix]; - texCds[VERTEXCOLOR_RB][iy] = texCds[VERTEXCOLOR_LB][iy] = - flipInfo.coords[VERTEXCOLOR_RB][iy]; + texCds[VERTEXCOLOR_RB][iy] = texCds[VERTEXCOLOR_LB][iy] = flipInfo.coords[VERTEXCOLOR_RB][iy]; texCds[VERTEXCOLOR_LT][ix] = texCds[VERTEXCOLOR_LB][ix] = - flipInfo.coords[VERTEXCOLOR_RB][ix] + polSize.width / - ((flipInfo.coords[VERTEXCOLOR_LB][ix] - flipInfo.coords[VERTEXCOLOR_RB][ix]) * tSz[ix]); + flipInfo.coords[VERTEXCOLOR_RB][ix] + + polSize.width / ((flipInfo.coords[VERTEXCOLOR_LB][ix] - flipInfo.coords[VERTEXCOLOR_RB][ix]) * tSz[ix]); texCds[VERTEXCOLOR_LT][iy] = texCds[VERTEXCOLOR_RT][iy] = - flipInfo.coords[VERTEXCOLOR_RB][iy] + polSize.height / - ((flipInfo.coords[VERTEXCOLOR_RT][iy] - flipInfo.coords[VERTEXCOLOR_RB][iy]) * tSz[iy]); + flipInfo.coords[VERTEXCOLOR_RB][iy] + + polSize.height / ((flipInfo.coords[VERTEXCOLOR_RT][iy] - flipInfo.coords[VERTEXCOLOR_RB][iy]) * tSz[iy]); } -} +} // namespace namespace nw4r { namespace lyt { - Window::Window(const res::Window* pBlock, const ResBlockSet& resBlockSet) : - Pane(pBlock) { + Window::Window(const res::Window* pBlock, const ResBlockSet& resBlockSet) : Pane(pBlock) { mContentInflation = pBlock->inflation; - const u32* const matOffsTbl = detail::ConvertOffsToPtr(resBlockSet.pMaterialList, - sizeof(*resBlockSet.pMaterialList)); + const u32* const matOffsTbl = detail::ConvertOffsToPtr(resBlockSet.pMaterialList, sizeof(*resBlockSet.pMaterialList)); { - const res::WindowContent* pResContent = detail::ConvertOffsToPtr(pBlock, - pBlock->contentOffset); + const res::WindowContent* pResContent = detail::ConvertOffsToPtr(pBlock, pBlock->contentOffset); for (int i = 0; i < (int)ARRAY_LENGTH(mContent.vtxColors); i++) { mContent.vtxColors[i] = pResContent->vtxCols[i]; @@ -181,9 +173,9 @@ namespace nw4r { void* pMemMaterial = Layout::AllocMemory(sizeof(Material)); if (pMemMaterial != NULL) { - const res::Material* pResMaterial = detail::ConvertOffsToPtr(resBlockSet.pMaterialList, - matOffsTbl[pResContent->materialIdx]); - mpMaterial = new(pMemMaterial) Material(pResMaterial, resBlockSet); + const res::Material* pResMaterial = + detail::ConvertOffsToPtr(resBlockSet.pMaterialList, matOffsTbl[pResContent->materialIdx]); + mpMaterial = new (pMemMaterial) Material(pResMaterial, resBlockSet); } } @@ -194,19 +186,17 @@ namespace nw4r { mFrames = static_cast(Layout::AllocMemory(sizeof(*mFrames) * pBlock->frameNum)); if (mFrames != NULL) { mFrameNum = pBlock->frameNum; - const u32* frameOffsetTable = detail::ConvertOffsToPtr(pBlock, - pBlock->frameOffsetTableOffset); + const u32* frameOffsetTable = detail::ConvertOffsToPtr(pBlock, pBlock->frameOffsetTableOffset); for (int i = 0; i < mFrameNum; i++) { - const res::WindowFrame* pResWindowFrame = detail::ConvertOffsToPtr(pBlock, - frameOffsetTable[i]); + const res::WindowFrame* pResWindowFrame = detail::ConvertOffsToPtr(pBlock, frameOffsetTable[i]); mFrames[i].textureFlip = pResWindowFrame->textureFlip; mFrames[i].pMaterial = NULL; if (void* pMemMaterial = Layout::AllocMemory(sizeof(Material))) { - const res::Material* pResMaterial = detail::ConvertOffsToPtr(resBlockSet.pMaterialList, - matOffsTbl[pResWindowFrame->materialIdx]); - mFrames[i].pMaterial = new(pMemMaterial) Material(pResMaterial, resBlockSet); + const res::Material* pResMaterial = + detail::ConvertOffsToPtr(resBlockSet.pMaterialList, matOffsTbl[pResWindowFrame->materialIdx]); + mFrames[i].pMaterial = new (pMemMaterial) Material(pResMaterial, resBlockSet); } } } @@ -304,7 +294,7 @@ namespace nw4r { switch (mFrameNum) { case 1: { - DrawFrame(basePt,* mFrames, frameSize, mGlbAlpha); + DrawFrame(basePt, *mFrames, frameSize, mGlbAlpha); break; } case 4: { @@ -338,15 +328,13 @@ namespace nw4r { void Window::DrawContent(const math::VEC2& basePt, const WindowFrameSize& frameSize, u8 alpha) { bool bUseVtxCol = mpMaterial->SetupGX(detail::IsModulateVertexColor(mContent.vtxColors, alpha), alpha); - + detail::SetVertexFormat(bUseVtxCol, mContent.texCoordAry.GetSize()); - + detail::DrawQuad(math::VEC2(basePt.x + frameSize.l - mContentInflation.l, basePt.y + frameSize.t - mContentInflation.t), - Size(mSize.width - frameSize.l + mContentInflation.l - frameSize.r + mContentInflation.r, + Size(mSize.width - frameSize.l + mContentInflation.l - frameSize.r + mContentInflation.r, mSize.height - frameSize.t + mContentInflation.t - frameSize.b + mContentInflation.b), - mContent.texCoordAry.GetSize(), - mContent.texCoordAry.GetArray(), - bUseVtxCol ? mContent.vtxColors : NULL, alpha); + mContent.texCoordAry.GetSize(), mContent.texCoordAry.GetArray(), bUseVtxCol ? mContent.vtxColors : NULL, alpha); } void Window::DrawFrame(const math::VEC2& basePt, const Frame& frame, const WindowFrameSize& frameSize, u8 alpha) { @@ -365,18 +353,19 @@ namespace nw4r { math::VEC2 polPt; Size polSize; - #define DRAW_QUAD_FOR_FRAME_1(corner_, frameIdx_) { \ - Get##corner_##FrameSize(&polPt, &polSize, basePt, mSize, frameSize); \ - Get##corner_##TexCoord(*texCds, polSize, texSize, frameIdx_); \ - detail::DrawQuad(polPt, polSize, GX_TEXMAP1, texCds, bUseVtxCol ? vtxColors : NULL, alpha); \ - } +#define DRAW_QUAD_FOR_FRAME_1(corner_, frameIdx_) \ + { \ + Get##corner_##FrameSize(&polPt, &polSize, basePt, mSize, frameSize); \ + Get##corner_##TexCoord(*texCds, polSize, texSize, frameIdx_); \ + detail::DrawQuad(polPt, polSize, GX_TEXMAP1, texCds, bUseVtxCol ? vtxColors : NULL, alpha); \ + } DRAW_QUAD_FOR_FRAME_1(LT, TEXTUREFLIP_NONE); DRAW_QUAD_FOR_FRAME_1(RT, TEXTUREFLIP_H); DRAW_QUAD_FOR_FRAME_1(RB, TEXTUREFLIP_180); DRAW_QUAD_FOR_FRAME_1(LB, TEXTUREFLIP_V); - #undef DRAW_QUAD_FOR_FRAME_1 +#undef DRAW_QUAD_FOR_FRAME_1 } void Window::DrawFrame4(const math::VEC2& basePt, const Frame* frames, const WindowFrameSize& frameSize, u8 alpha) { @@ -389,23 +378,24 @@ namespace nw4r { bool bModVtxCol = detail::IsModulateVertexColor(NULL, alpha); - #define DRAW_QUAD_FOR_FRAME_4(corner_, frameIdx_) { \ - if (frames[frameIdx_].pMaterial->GetTextureNum() > GX_TEXMAP0) { \ - bool bUseVtxCol = frames[frameIdx_].pMaterial->SetupGX(bModVtxCol, alpha); \ - Get##corner_##FrameSize(&polPt, &polSize, basePt, mSize, frameSize); \ - Get##corner_##TexCoord(*texCds, polSize, \ - detail::GetTextureSize(frames[frameIdx_].pMaterial, GX_TEXMAP0), frames[frameIdx_].textureFlip); \ - detail::SetVertexFormat(bUseVtxCol, GX_TEXMAP1); \ - detail::DrawQuad(polPt, polSize, GX_TEXMAP1, texCds, bUseVtxCol ? vtxColors : NULL, alpha); \ - } \ - } +#define DRAW_QUAD_FOR_FRAME_4(corner_, frameIdx_) \ + { \ + if (frames[frameIdx_].pMaterial->GetTextureNum() > GX_TEXMAP0) { \ + bool bUseVtxCol = frames[frameIdx_].pMaterial->SetupGX(bModVtxCol, alpha); \ + Get##corner_##FrameSize(&polPt, &polSize, basePt, mSize, frameSize); \ + Get##corner_##TexCoord(*texCds, polSize, detail::GetTextureSize(frames[frameIdx_].pMaterial, GX_TEXMAP0), \ + frames[frameIdx_].textureFlip); \ + detail::SetVertexFormat(bUseVtxCol, GX_TEXMAP1); \ + detail::DrawQuad(polPt, polSize, GX_TEXMAP1, texCds, bUseVtxCol ? vtxColors : NULL, alpha); \ + } \ + } DRAW_QUAD_FOR_FRAME_4(LT, TEXTUREFLIP_NONE); DRAW_QUAD_FOR_FRAME_4(RT, TEXTUREFLIP_H); DRAW_QUAD_FOR_FRAME_4(RB, TEXTUREFLIP_90); DRAW_QUAD_FOR_FRAME_4(LB, TEXTUREFLIP_V); - #undef DRAW_QUAD_FOR_FRAME_4 +#undef DRAW_QUAD_FOR_FRAME_4 } void Window::DrawFrame8(const math::VEC2& basePt, const Frame* frames, const WindowFrameSize& frameSize, u8 alpha) { @@ -417,42 +407,38 @@ namespace nw4r { bool bModVtxCol = detail::IsModulateVertexColor(NULL, alpha); - #define DRAW_QUAD_FOR_FRAME_8(corner_, frameIdx_, polSizeInit_, basePtInit_) { \ - if (frames[WINDOWFRAME_##frameIdx_].pMaterial->GetTextureNum() > GX_TEXMAP0) { \ - bool bUseVtxCol = frames[WINDOWFRAME_##frameIdx_].pMaterial->SetupGX(bModVtxCol, alpha); \ - polSize = polSizeInit_; \ - Get##corner_##TexCoord(*texCds, polSize, \ - detail::GetTextureSize(frames[WINDOWFRAME_##frameIdx_].pMaterial, GX_TEXMAP0), \ - frames[WINDOWFRAME_##frameIdx_].textureFlip); \ - detail::SetVertexFormat(bUseVtxCol, GX_TEXMAP1); \ - detail::DrawQuad(basePtInit_, polSize, GX_TEXMAP1, texCds, bUseVtxCol ? vtxColors : NULL, alpha); \ - } \ - } +#define DRAW_QUAD_FOR_FRAME_8(corner_, frameIdx_, polSizeInit_, basePtInit_) \ + { \ + if (frames[WINDOWFRAME_##frameIdx_].pMaterial->GetTextureNum() > GX_TEXMAP0) { \ + bool bUseVtxCol = frames[WINDOWFRAME_##frameIdx_].pMaterial->SetupGX(bModVtxCol, alpha); \ + polSize = polSizeInit_; \ + Get##corner_##TexCoord(*texCds, polSize, detail::GetTextureSize(frames[WINDOWFRAME_##frameIdx_].pMaterial, GX_TEXMAP0), \ + frames[WINDOWFRAME_##frameIdx_].textureFlip); \ + detail::SetVertexFormat(bUseVtxCol, GX_TEXMAP1); \ + detail::DrawQuad(basePtInit_, polSize, GX_TEXMAP1, texCds, bUseVtxCol ? vtxColors : NULL, alpha); \ + } \ + } DRAW_QUAD_FOR_FRAME_8(LT, LT, Size(frameSize.l, frameSize.t), basePt); - DRAW_QUAD_FOR_FRAME_8(LT, T, Size(mSize.width - frameSize.l - frameSize.r, frameSize.t), - math::VEC2(basePt.x + frameSize.l, basePt.y)); + DRAW_QUAD_FOR_FRAME_8(LT, T, Size(mSize.width - frameSize.l - frameSize.r, frameSize.t), math::VEC2(basePt.x + frameSize.l, basePt.y)); - DRAW_QUAD_FOR_FRAME_8(RT, RT, Size(frameSize.r, frameSize.t), - math::VEC2(basePt.x + mSize.width - frameSize.r, basePt.y)); + DRAW_QUAD_FOR_FRAME_8(RT, RT, Size(frameSize.r, frameSize.t), math::VEC2(basePt.x + mSize.width - frameSize.r, basePt.y)); DRAW_QUAD_FOR_FRAME_8(RT, R, Size(frameSize.r, mSize.height - frameSize.t - frameSize.b), - math::VEC2(basePt.x + mSize.width - frameSize.r, basePt.y + frameSize.t)); + math::VEC2(basePt.x + mSize.width - frameSize.r, basePt.y + frameSize.t)); DRAW_QUAD_FOR_FRAME_8(RB, RB, Size(frameSize.r, frameSize.b), - math::VEC2(basePt.x + mSize.width - frameSize.r, basePt.y + mSize.height - frameSize.b)); + math::VEC2(basePt.x + mSize.width - frameSize.r, basePt.y + mSize.height - frameSize.b)); DRAW_QUAD_FOR_FRAME_8(RB, B, Size(mSize.width - frameSize.l - frameSize.r, frameSize.b), - math::VEC2(basePt.x + frameSize.l, basePt.y + mSize.height - frameSize.b)); + math::VEC2(basePt.x + frameSize.l, basePt.y + mSize.height - frameSize.b)); - DRAW_QUAD_FOR_FRAME_8(LB, LB, Size(frameSize.l, frameSize.b), - math::VEC2(basePt.x, basePt.y + mSize.height - frameSize.b)); + DRAW_QUAD_FOR_FRAME_8(LB, LB, Size(frameSize.l, frameSize.b), math::VEC2(basePt.x, basePt.y + mSize.height - frameSize.b)); - DRAW_QUAD_FOR_FRAME_8(LB, L, Size(frameSize.l, mSize.height - frameSize.t - frameSize.b), - math::VEC2(basePt.x, basePt.y + frameSize.t)); + DRAW_QUAD_FOR_FRAME_8(LB, L, Size(frameSize.l, mSize.height - frameSize.t - frameSize.b), math::VEC2(basePt.x, basePt.y + frameSize.t)); - #undef DRAW_QUAD_FOR_FRAME_8 +#undef DRAW_QUAD_FOR_FRAME_8 } WindowFrameSize Window::GetFrameSize(u8 frameNum, const Frame* frames) { @@ -494,5 +480,5 @@ namespace nw4r { Material* Window::GetContentMaterial() const { return GetMaterial(); } - } -} + } // namespace lyt +} // namespace nw4r diff --git a/libs/NW4R/src/math/math_arithmetic.cpp b/libs/NW4R/src/math/math_arithmetic.cpp index a6725950..8ac230ee 100644 --- a/libs/NW4R/src/math/math_arithmetic.cpp +++ b/libs/NW4R/src/math/math_arithmetic.cpp @@ -6,6 +6,7 @@ namespace nw4r { register f32 rsqrt; register f32 c_half = 0.5f, c_three = 3.0f; register f32 work0, work1; + // clang-format off #ifdef __MWERKS__ asm { // Estimate reciprocal square root @@ -18,19 +19,18 @@ namespace nw4r { fnmsubs work0, work0, x, c_three // (3 - x * rsqrt^2) fmuls work1, work0, work1 // (3 - x * rsqrt^2) * (rsqrt * 0.5) } - #endif + #endif // __MWERKS__ + // clang-format on return work1; } u32 CntBit1(register u32 x) { - x = x - ((x >> 1)& 0x55555555); - x = (x& 0x33333333) + ((x >> 2)& 0x33333333); - x = (x + (x >> 4))& 0x0f0f0f0f; + x = x - ((x >> 1) & 0x55555555); + x = (x & 0x33333333) + ((x >> 2) & 0x33333333); + x = (x + (x >> 4)) & 0x0f0f0f0f; x = x + (x >> 8); x = x + (x >> 16); - return x& 0x0000003f; + return x & 0x0000003f; } - } -} - - + } // namespace math +} // namespace nw4r diff --git a/libs/NW4R/src/math/math_triangular.cpp b/libs/NW4R/src/math/math_triangular.cpp index 22d89e49..c903fd55 100644 --- a/libs/NW4R/src/math/math_triangular.cpp +++ b/libs/NW4R/src/math/math_triangular.cpp @@ -1,315 +1,161 @@ #include struct SinCosSample { - f32 sin_val; // 0x00 - f32 cos_val; // 0x04 - f32 sin_delta; // 0x08 - f32 cos_delta; // 0x0C + f32 sin_val; // 0x00 + f32 cos_val; // 0x04 + f32 sin_delta; // 0x08 + f32 cos_delta; // 0x0C }; struct ArcTanSample { - f32 atan_val; // 0x00 - f32 atan_delta; // 0x04 + f32 atan_val; // 0x00 + f32 atan_delta; // 0x04 }; namespace nw4r { namespace math { namespace { static SinCosSample sSinCosTbl[] = { - { 0.000000000f, 1.000000000f, 0.024541000f, -0.000301000f}, - { 0.024541000f, 0.999698997f, 0.024526000f, -0.000903000f}, - { 0.049068000f, 0.998794973f, 0.024497001f, -0.001505000f}, - { 0.073564999f, 0.997290015f, 0.024452999f, -0.002106000f}, - { 0.098017000f, 0.995185018f, 0.024394000f, -0.002705000f}, - { 0.122410998f, 0.992479980f, 0.024320001f, -0.003303000f}, - { 0.146730006f, 0.989176989f, 0.024231000f, -0.003899000f}, - { 0.170962006f, 0.985278010f, 0.024127999f, -0.004492000f}, - { 0.195089996f, 0.980785012f, 0.024010999f, -0.005083000f}, - { 0.219100997f, 0.975701988f, 0.023879001f, -0.005671000f}, - { 0.242980003f, 0.970031023f, 0.023732999f, -0.006255000f}, - { 0.266712993f, 0.963775992f, 0.023572000f, -0.006836000f}, - { 0.290284991f, 0.956939995f, 0.023397001f, -0.007412000f}, - { 0.313681990f, 0.949527979f, 0.023208000f, -0.007984000f}, - { 0.336890012f, 0.941543996f, 0.023004999f, -0.008551000f}, - { 0.359894991f, 0.932992995f, 0.022787999f, -0.009113000f}, - { 0.382683009f, 0.923879981f, 0.022558000f, -0.009670000f}, - { 0.405241013f, 0.914210021f, 0.022314001f, -0.010220000f}, - { 0.427554995f, 0.903989017f, 0.022056000f, -0.010765000f}, - { 0.449611008f, 0.893224001f, 0.021785000f, -0.011303000f}, - { 0.471397012f, 0.881920993f, 0.021500999f, -0.011834000f}, - { 0.492897987f, 0.870087028f, 0.021205001f, -0.012358000f}, - { 0.514102995f, 0.857729018f, 0.020895001f, -0.012875000f}, - { 0.534998000f, 0.844853997f, 0.020572999f, -0.013384000f}, - { 0.555570006f, 0.831470013f, 0.020238001f, -0.013885000f}, - { 0.575807989f, 0.817584991f, 0.019890999f, -0.014377000f}, - { 0.595699012f, 0.803207994f, 0.019532001f, -0.014861000f}, - { 0.615231991f, 0.788345993f, 0.019161999f, -0.015336000f}, - { 0.634392977f, 0.773010015f, 0.018780001f, -0.015802000f}, - { 0.653173029f, 0.757209003f, 0.018386001f, -0.016257999f}, - { 0.671558976f, 0.740951002f, 0.017982000f, -0.016704001f}, - { 0.689540982f, 0.724246979f, 0.017565999f, -0.017139999f}, - { 0.707107008f, 0.707107008f, 0.017139999f, -0.017565999f}, - { 0.724246979f, 0.689540982f, 0.016704001f, -0.017982000f}, - { 0.740951002f, 0.671558976f, 0.016257999f, -0.018386001f}, - { 0.757209003f, 0.653173029f, 0.015802000f, -0.018780001f}, - { 0.773010015f, 0.634392977f, 0.015336000f, -0.019161999f}, - { 0.788345993f, 0.615231991f, 0.014861000f, -0.019532001f}, - { 0.803207994f, 0.595699012f, 0.014377000f, -0.019890999f}, - { 0.817584991f, 0.575807989f, 0.013885000f, -0.020238001f}, - { 0.831470013f, 0.555570006f, 0.013384000f, -0.020572999f}, - { 0.844853997f, 0.534998000f, 0.012875000f, -0.020895001f}, - { 0.857729018f, 0.514102995f, 0.012358000f, -0.021205001f}, - { 0.870087028f, 0.492897987f, 0.011834000f, -0.021500999f}, - { 0.881920993f, 0.471397012f, 0.011303000f, -0.021785000f}, - { 0.893224001f, 0.449611008f, 0.010765000f, -0.022056000f}, - { 0.903989017f, 0.427554995f, 0.010220000f, -0.022314001f}, - { 0.914210021f, 0.405241013f, 0.009670000f, -0.022558000f}, - { 0.923879981f, 0.382683009f, 0.009113000f, -0.022787999f}, - { 0.932992995f, 0.359894991f, 0.008551000f, -0.023004999f}, - { 0.941543996f, 0.336890012f, 0.007984000f, -0.023208000f}, - { 0.949527979f, 0.313681990f, 0.007412000f, -0.023397001f}, - { 0.956939995f, 0.290284991f, 0.006836000f, -0.023572000f}, - { 0.963775992f, 0.266712993f, 0.006255000f, -0.023732999f}, - { 0.970031023f, 0.242980003f, 0.005671000f, -0.023879001f}, - { 0.975701988f, 0.219100997f, 0.005083000f, -0.024010999f}, - { 0.980785012f, 0.195089996f, 0.004492000f, -0.024127999f}, - { 0.985278010f, 0.170962006f, 0.003899000f, -0.024231000f}, - { 0.989176989f, 0.146730006f, 0.003303000f, -0.024320001f}, - { 0.992479980f, 0.122410998f, 0.002705000f, -0.024394000f}, - { 0.995185018f, 0.098017000f, 0.002106000f, -0.024452999f}, - { 0.997290015f, 0.073564999f, 0.001505000f, -0.024497001f}, - { 0.998794973f, 0.049068000f, 0.000903000f, -0.024526000f}, - { 0.999698997f, 0.024541000f, 0.000301000f, -0.024541000f}, - { 1.000000000f, 0.000000000f, -0.000301000f, -0.024541000f}, - { 0.999698997f, -0.024541000f, -0.000903000f, -0.024526000f}, - { 0.998794973f, -0.049068000f, -0.001505000f, -0.024497001f}, - { 0.997290015f, -0.073564999f, -0.002106000f, -0.024452999f}, - { 0.995185018f, -0.098017000f, -0.002705000f, -0.024394000f}, - { 0.992479980f, -0.122410998f, -0.003303000f, -0.024320001f}, - { 0.989176989f, -0.146730006f, -0.003899000f, -0.024231000f}, - { 0.985278010f, -0.170962006f, -0.004492000f, -0.024127999f}, - { 0.980785012f, -0.195089996f, -0.005083000f, -0.024010999f}, - { 0.975701988f, -0.219100997f, -0.005671000f, -0.023879001f}, - { 0.970031023f, -0.242980003f, -0.006255000f, -0.023732999f}, - { 0.963775992f, -0.266712993f, -0.006836000f, -0.023572000f}, - { 0.956939995f, -0.290284991f, -0.007412000f, -0.023397001f}, - { 0.949527979f, -0.313681990f, -0.007984000f, -0.023208000f}, - { 0.941543996f, -0.336890012f, -0.008551000f, -0.023004999f}, - { 0.932992995f, -0.359894991f, -0.009113000f, -0.022787999f}, - { 0.923879981f, -0.382683009f, -0.009670000f, -0.022558000f}, - { 0.914210021f, -0.405241013f, -0.010220000f, -0.022314001f}, - { 0.903989017f, -0.427554995f, -0.010765000f, -0.022056000f}, - { 0.893224001f, -0.449611008f, -0.011303000f, -0.021785000f}, - { 0.881920993f, -0.471397012f, -0.011834000f, -0.021500999f}, - { 0.870087028f, -0.492897987f, -0.012358000f, -0.021205001f}, - { 0.857729018f, -0.514102995f, -0.012875000f, -0.020895001f}, - { 0.844853997f, -0.534998000f, -0.013384000f, -0.020572999f}, - { 0.831470013f, -0.555570006f, -0.013885000f, -0.020238001f}, - { 0.817584991f, -0.575807989f, -0.014377000f, -0.019890999f}, - { 0.803207994f, -0.595699012f, -0.014861000f, -0.019532001f}, - { 0.788345993f, -0.615231991f, -0.015336000f, -0.019161999f}, - { 0.773010015f, -0.634392977f, -0.015802000f, -0.018780001f}, - { 0.757209003f, -0.653173029f, -0.016257999f, -0.018386001f}, - { 0.740951002f, -0.671558976f, -0.016704001f, -0.017982000f}, - { 0.724246979f, -0.689540982f, -0.017139999f, -0.017565999f}, - { 0.707107008f, -0.707107008f, -0.017565999f, -0.017139999f}, - { 0.689540982f, -0.724246979f, -0.017982000f, -0.016704001f}, - { 0.671558976f, -0.740951002f, -0.018386001f, -0.016257999f}, - { 0.653173029f, -0.757209003f, -0.018780001f, -0.015802000f}, - { 0.634392977f, -0.773010015f, -0.019161999f, -0.015336000f}, - { 0.615231991f, -0.788345993f, -0.019532001f, -0.014861000f}, - { 0.595699012f, -0.803207994f, -0.019890999f, -0.014377000f}, - { 0.575807989f, -0.817584991f, -0.020238001f, -0.013885000f}, - { 0.555570006f, -0.831470013f, -0.020572999f, -0.013384000f}, - { 0.534998000f, -0.844853997f, -0.020895001f, -0.012875000f}, - { 0.514102995f, -0.857729018f, -0.021205001f, -0.012358000f}, - { 0.492897987f, -0.870087028f, -0.021500999f, -0.011834000f}, - { 0.471397012f, -0.881920993f, -0.021785000f, -0.011303000f}, - { 0.449611008f, -0.893224001f, -0.022056000f, -0.010765000f}, - { 0.427554995f, -0.903989017f, -0.022314001f, -0.010220000f}, - { 0.405241013f, -0.914210021f, -0.022558000f, -0.009670000f}, - { 0.382683009f, -0.923879981f, -0.022787999f, -0.009113000f}, - { 0.359894991f, -0.932992995f, -0.023004999f, -0.008551000f}, - { 0.336890012f, -0.941543996f, -0.023208000f, -0.007984000f}, - { 0.313681990f, -0.949527979f, -0.023397001f, -0.007412000f}, - { 0.290284991f, -0.956939995f, -0.023572000f, -0.006836000f}, - { 0.266712993f, -0.963775992f, -0.023732999f, -0.006255000f}, - { 0.242980003f, -0.970031023f, -0.023879001f, -0.005671000f}, - { 0.219100997f, -0.975701988f, -0.024010999f, -0.005083000f}, - { 0.195089996f, -0.980785012f, -0.024127999f, -0.004492000f}, - { 0.170962006f, -0.985278010f, -0.024231000f, -0.003899000f}, - { 0.146730006f, -0.989176989f, -0.024320001f, -0.003303000f}, - { 0.122410998f, -0.992479980f, -0.024394000f, -0.002705000f}, - { 0.098017000f, -0.995185018f, -0.024452999f, -0.002106000f}, - { 0.073564999f, -0.997290015f, -0.024497001f, -0.001505000f}, - { 0.049068000f, -0.998794973f, -0.024526000f, -0.000903000f}, - { 0.024541000f, -0.999698997f, -0.024541000f, -0.000301000f}, - { 0.000000000f, -1.000000000f, -0.024541000f, 0.000301000f}, - {-0.024541000f, -0.999698997f, -0.024526000f, 0.000903000f}, - {-0.049068000f, -0.998794973f, -0.024497001f, 0.001505000f}, - {-0.073564999f, -0.997290015f, -0.024452999f, 0.002106000f}, - {-0.098017000f, -0.995185018f, -0.024394000f, 0.002705000f}, - {-0.122410998f, -0.992479980f, -0.024320001f, 0.003303000f}, - {-0.146730006f, -0.989176989f, -0.024231000f, 0.003899000f}, - {-0.170962006f, -0.985278010f, -0.024127999f, 0.004492000f}, - {-0.195089996f, -0.980785012f, -0.024010999f, 0.005083000f}, - {-0.219100997f, -0.975701988f, -0.023879001f, 0.005671000f}, - {-0.242980003f, -0.970031023f, -0.023732999f, 0.006255000f}, - {-0.266712993f, -0.963775992f, -0.023572000f, 0.006836000f}, - {-0.290284991f, -0.956939995f, -0.023397001f, 0.007412000f}, - {-0.313681990f, -0.949527979f, -0.023208000f, 0.007984000f}, - {-0.336890012f, -0.941543996f, -0.023004999f, 0.008551000f}, - {-0.359894991f, -0.932992995f, -0.022787999f, 0.009113000f}, - {-0.382683009f, -0.923879981f, -0.022558000f, 0.009670000f}, - {-0.405241013f, -0.914210021f, -0.022314001f, 0.010220000f}, - {-0.427554995f, -0.903989017f, -0.022056000f, 0.010765000f}, - {-0.449611008f, -0.893224001f, -0.021785000f, 0.011303000f}, - {-0.471397012f, -0.881920993f, -0.021500999f, 0.011834000f}, - {-0.492897987f, -0.870087028f, -0.021205001f, 0.012358000f}, - {-0.514102995f, -0.857729018f, -0.020895001f, 0.012875000f}, - {-0.534998000f, -0.844853997f, -0.020572999f, 0.013384000f}, - {-0.555570006f, -0.831470013f, -0.020238001f, 0.013885000f}, - {-0.575807989f, -0.817584991f, -0.019890999f, 0.014377000f}, - {-0.595699012f, -0.803207994f, -0.019532001f, 0.014861000f}, - {-0.615231991f, -0.788345993f, -0.019161999f, 0.015336000f}, - {-0.634392977f, -0.773010015f, -0.018780001f, 0.015802000f}, - {-0.653173029f, -0.757209003f, -0.018386001f, 0.016257999f}, - {-0.671558976f, -0.740951002f, -0.017982000f, 0.016704001f}, - {-0.689540982f, -0.724246979f, -0.017565999f, 0.017139999f}, - {-0.707107008f, -0.707107008f, -0.017139999f, 0.017565999f}, - {-0.724246979f, -0.689540982f, -0.016704001f, 0.017982000f}, - {-0.740951002f, -0.671558976f, -0.016257999f, 0.018386001f}, - {-0.757209003f, -0.653173029f, -0.015802000f, 0.018780001f}, - {-0.773010015f, -0.634392977f, -0.015336000f, 0.019161999f}, - {-0.788345993f, -0.615231991f, -0.014861000f, 0.019532001f}, - {-0.803207994f, -0.595699012f, -0.014377000f, 0.019890999f}, - {-0.817584991f, -0.575807989f, -0.013885000f, 0.020238001f}, - {-0.831470013f, -0.555570006f, -0.013384000f, 0.020572999f}, - {-0.844853997f, -0.534998000f, -0.012875000f, 0.020895001f}, - {-0.857729018f, -0.514102995f, -0.012358000f, 0.021205001f}, - {-0.870087028f, -0.492897987f, -0.011834000f, 0.021500999f}, - {-0.881920993f, -0.471397012f, -0.011303000f, 0.021785000f}, - {-0.893224001f, -0.449611008f, -0.010765000f, 0.022056000f}, - {-0.903989017f, -0.427554995f, -0.010220000f, 0.022314001f}, - {-0.914210021f, -0.405241013f, -0.009670000f, 0.022558000f}, - {-0.923879981f, -0.382683009f, -0.009113000f, 0.022787999f}, - {-0.932992995f, -0.359894991f, -0.008551000f, 0.023004999f}, - {-0.941543996f, -0.336890012f, -0.007984000f, 0.023208000f}, - {-0.949527979f, -0.313681990f, -0.007412000f, 0.023397001f}, - {-0.956939995f, -0.290284991f, -0.006836000f, 0.023572000f}, - {-0.963775992f, -0.266712993f, -0.006255000f, 0.023732999f}, - {-0.970031023f, -0.242980003f, -0.005671000f, 0.023879001f}, - {-0.975701988f, -0.219100997f, -0.005083000f, 0.024010999f}, - {-0.980785012f, -0.195089996f, -0.004492000f, 0.024127999f}, - {-0.985278010f, -0.170962006f, -0.003899000f, 0.024231000f}, - {-0.989176989f, -0.146730006f, -0.003303000f, 0.024320001f}, - {-0.992479980f, -0.122410998f, -0.002705000f, 0.024394000f}, - {-0.995185018f, -0.098017000f, -0.002106000f, 0.024452999f}, - {-0.997290015f, -0.073564999f, -0.001505000f, 0.024497001f}, - {-0.998794973f, -0.049068000f, -0.000903000f, 0.024526000f}, - {-0.999698997f, -0.024541000f, -0.000301000f, 0.024541000f}, - {-1.000000000f, -0.000000000f, 0.000301000f, 0.024541000f}, - {-0.999698997f, 0.024541000f, 0.000903000f, 0.024526000f}, - {-0.998794973f, 0.049068000f, 0.001505000f, 0.024497001f}, - {-0.997290015f, 0.073564999f, 0.002106000f, 0.024452999f}, - {-0.995185018f, 0.098017000f, 0.002705000f, 0.024394000f}, - {-0.992479980f, 0.122410998f, 0.003303000f, 0.024320001f}, - {-0.989176989f, 0.146730006f, 0.003899000f, 0.024231000f}, - {-0.985278010f, 0.170962006f, 0.004492000f, 0.024127999f}, - {-0.980785012f, 0.195089996f, 0.005083000f, 0.024010999f}, - {-0.975701988f, 0.219100997f, 0.005671000f, 0.023879001f}, - {-0.970031023f, 0.242980003f, 0.006255000f, 0.023732999f}, - {-0.963775992f, 0.266712993f, 0.006836000f, 0.023572000f}, - {-0.956939995f, 0.290284991f, 0.007412000f, 0.023397001f}, - {-0.949527979f, 0.313681990f, 0.007984000f, 0.023208000f}, - {-0.941543996f, 0.336890012f, 0.008551000f, 0.023004999f}, - {-0.932992995f, 0.359894991f, 0.009113000f, 0.022787999f}, - {-0.923879981f, 0.382683009f, 0.009670000f, 0.022558000f}, - {-0.914210021f, 0.405241013f, 0.010220000f, 0.022314001f}, - {-0.903989017f, 0.427554995f, 0.010765000f, 0.022056000f}, - {-0.893224001f, 0.449611008f, 0.011303000f, 0.021785000f}, - {-0.881920993f, 0.471397012f, 0.011834000f, 0.021500999f}, - {-0.870087028f, 0.492897987f, 0.012358000f, 0.021205001f}, - {-0.857729018f, 0.514102995f, 0.012875000f, 0.020895001f}, - {-0.844853997f, 0.534998000f, 0.013384000f, 0.020572999f}, - {-0.831470013f, 0.555570006f, 0.013885000f, 0.020238001f}, - {-0.817584991f, 0.575807989f, 0.014377000f, 0.019890999f}, - {-0.803207994f, 0.595699012f, 0.014861000f, 0.019532001f}, - {-0.788345993f, 0.615231991f, 0.015336000f, 0.019161999f}, - {-0.773010015f, 0.634392977f, 0.015802000f, 0.018780001f}, - {-0.757209003f, 0.653173029f, 0.016257999f, 0.018386001f}, - {-0.740951002f, 0.671558976f, 0.016704001f, 0.017982000f}, - {-0.724246979f, 0.689540982f, 0.017139999f, 0.017565999f}, - {-0.707107008f, 0.707107008f, 0.017565999f, 0.017139999f}, - {-0.689540982f, 0.724246979f, 0.017982000f, 0.016704001f}, - {-0.671558976f, 0.740951002f, 0.018386001f, 0.016257999f}, - {-0.653173029f, 0.757209003f, 0.018780001f, 0.015802000f}, - {-0.634392977f, 0.773010015f, 0.019161999f, 0.015336000f}, - {-0.615231991f, 0.788345993f, 0.019532001f, 0.014861000f}, - {-0.595699012f, 0.803207994f, 0.019890999f, 0.014377000f}, - {-0.575807989f, 0.817584991f, 0.020238001f, 0.013885000f}, - {-0.555570006f, 0.831470013f, 0.020572999f, 0.013384000f}, - {-0.534998000f, 0.844853997f, 0.020895001f, 0.012875000f}, - {-0.514102995f, 0.857729018f, 0.021205001f, 0.012358000f}, - {-0.492897987f, 0.870087028f, 0.021500999f, 0.011834000f}, - {-0.471397012f, 0.881920993f, 0.021785000f, 0.011303000f}, - {-0.449611008f, 0.893224001f, 0.022056000f, 0.010765000f}, - {-0.427554995f, 0.903989017f, 0.022314001f, 0.010220000f}, - {-0.405241013f, 0.914210021f, 0.022558000f, 0.009670000f}, - {-0.382683009f, 0.923879981f, 0.022787999f, 0.009113000f}, - {-0.359894991f, 0.932992995f, 0.023004999f, 0.008551000f}, - {-0.336890012f, 0.941543996f, 0.023208000f, 0.007984000f}, - {-0.313681990f, 0.949527979f, 0.023397001f, 0.007412000f}, - {-0.290284991f, 0.956939995f, 0.023572000f, 0.006836000f}, - {-0.266712993f, 0.963775992f, 0.023732999f, 0.006255000f}, - {-0.242980003f, 0.970031023f, 0.023879001f, 0.005671000f}, - {-0.219100997f, 0.975701988f, 0.024010999f, 0.005083000f}, - {-0.195089996f, 0.980785012f, 0.024127999f, 0.004492000f}, - {-0.170962006f, 0.985278010f, 0.024231000f, 0.003899000f}, - {-0.146730006f, 0.989176989f, 0.024320001f, 0.003303000f}, - {-0.122410998f, 0.992479980f, 0.024394000f, 0.002705000f}, - {-0.098017000f, 0.995185018f, 0.024452999f, 0.002106000f}, - {-0.073564999f, 0.997290015f, 0.024497001f, 0.001505000f}, - {-0.049068000f, 0.998794973f, 0.024526000f, 0.000903000f}, - {-0.024541000f, 0.999698997f, 0.024541000f, 0.000301000f}, - {-0.000000000f, 1.000000000f, 0.024541000f, -0.000301000f} - }; + {0.000000000f, 1.000000000f, 0.024541000f, -0.000301000f}, {0.024541000f, 0.999698997f, 0.024526000f, -0.000903000f}, + {0.049068000f, 0.998794973f, 0.024497001f, -0.001505000f}, {0.073564999f, 0.997290015f, 0.024452999f, -0.002106000f}, + {0.098017000f, 0.995185018f, 0.024394000f, -0.002705000f}, {0.122410998f, 0.992479980f, 0.024320001f, -0.003303000f}, + {0.146730006f, 0.989176989f, 0.024231000f, -0.003899000f}, {0.170962006f, 0.985278010f, 0.024127999f, -0.004492000f}, + {0.195089996f, 0.980785012f, 0.024010999f, -0.005083000f}, {0.219100997f, 0.975701988f, 0.023879001f, -0.005671000f}, + {0.242980003f, 0.970031023f, 0.023732999f, -0.006255000f}, {0.266712993f, 0.963775992f, 0.023572000f, -0.006836000f}, + {0.290284991f, 0.956939995f, 0.023397001f, -0.007412000f}, {0.313681990f, 0.949527979f, 0.023208000f, -0.007984000f}, + {0.336890012f, 0.941543996f, 0.023004999f, -0.008551000f}, {0.359894991f, 0.932992995f, 0.022787999f, -0.009113000f}, + {0.382683009f, 0.923879981f, 0.022558000f, -0.009670000f}, {0.405241013f, 0.914210021f, 0.022314001f, -0.010220000f}, + {0.427554995f, 0.903989017f, 0.022056000f, -0.010765000f}, {0.449611008f, 0.893224001f, 0.021785000f, -0.011303000f}, + {0.471397012f, 0.881920993f, 0.021500999f, -0.011834000f}, {0.492897987f, 0.870087028f, 0.021205001f, -0.012358000f}, + {0.514102995f, 0.857729018f, 0.020895001f, -0.012875000f}, {0.534998000f, 0.844853997f, 0.020572999f, -0.013384000f}, + {0.555570006f, 0.831470013f, 0.020238001f, -0.013885000f}, {0.575807989f, 0.817584991f, 0.019890999f, -0.014377000f}, + {0.595699012f, 0.803207994f, 0.019532001f, -0.014861000f}, {0.615231991f, 0.788345993f, 0.019161999f, -0.015336000f}, + {0.634392977f, 0.773010015f, 0.018780001f, -0.015802000f}, {0.653173029f, 0.757209003f, 0.018386001f, -0.016257999f}, + {0.671558976f, 0.740951002f, 0.017982000f, -0.016704001f}, {0.689540982f, 0.724246979f, 0.017565999f, -0.017139999f}, + {0.707107008f, 0.707107008f, 0.017139999f, -0.017565999f}, {0.724246979f, 0.689540982f, 0.016704001f, -0.017982000f}, + {0.740951002f, 0.671558976f, 0.016257999f, -0.018386001f}, {0.757209003f, 0.653173029f, 0.015802000f, -0.018780001f}, + {0.773010015f, 0.634392977f, 0.015336000f, -0.019161999f}, {0.788345993f, 0.615231991f, 0.014861000f, -0.019532001f}, + {0.803207994f, 0.595699012f, 0.014377000f, -0.019890999f}, {0.817584991f, 0.575807989f, 0.013885000f, -0.020238001f}, + {0.831470013f, 0.555570006f, 0.013384000f, -0.020572999f}, {0.844853997f, 0.534998000f, 0.012875000f, -0.020895001f}, + {0.857729018f, 0.514102995f, 0.012358000f, -0.021205001f}, {0.870087028f, 0.492897987f, 0.011834000f, -0.021500999f}, + {0.881920993f, 0.471397012f, 0.011303000f, -0.021785000f}, {0.893224001f, 0.449611008f, 0.010765000f, -0.022056000f}, + {0.903989017f, 0.427554995f, 0.010220000f, -0.022314001f}, {0.914210021f, 0.405241013f, 0.009670000f, -0.022558000f}, + {0.923879981f, 0.382683009f, 0.009113000f, -0.022787999f}, {0.932992995f, 0.359894991f, 0.008551000f, -0.023004999f}, + {0.941543996f, 0.336890012f, 0.007984000f, -0.023208000f}, {0.949527979f, 0.313681990f, 0.007412000f, -0.023397001f}, + {0.956939995f, 0.290284991f, 0.006836000f, -0.023572000f}, {0.963775992f, 0.266712993f, 0.006255000f, -0.023732999f}, + {0.970031023f, 0.242980003f, 0.005671000f, -0.023879001f}, {0.975701988f, 0.219100997f, 0.005083000f, -0.024010999f}, + {0.980785012f, 0.195089996f, 0.004492000f, -0.024127999f}, {0.985278010f, 0.170962006f, 0.003899000f, -0.024231000f}, + {0.989176989f, 0.146730006f, 0.003303000f, -0.024320001f}, {0.992479980f, 0.122410998f, 0.002705000f, -0.024394000f}, + {0.995185018f, 0.098017000f, 0.002106000f, -0.024452999f}, {0.997290015f, 0.073564999f, 0.001505000f, -0.024497001f}, + {0.998794973f, 0.049068000f, 0.000903000f, -0.024526000f}, {0.999698997f, 0.024541000f, 0.000301000f, -0.024541000f}, + {1.000000000f, 0.000000000f, -0.000301000f, -0.024541000f}, {0.999698997f, -0.024541000f, -0.000903000f, -0.024526000f}, + {0.998794973f, -0.049068000f, -0.001505000f, -0.024497001f}, {0.997290015f, -0.073564999f, -0.002106000f, -0.024452999f}, + {0.995185018f, -0.098017000f, -0.002705000f, -0.024394000f}, {0.992479980f, -0.122410998f, -0.003303000f, -0.024320001f}, + {0.989176989f, -0.146730006f, -0.003899000f, -0.024231000f}, {0.985278010f, -0.170962006f, -0.004492000f, -0.024127999f}, + {0.980785012f, -0.195089996f, -0.005083000f, -0.024010999f}, {0.975701988f, -0.219100997f, -0.005671000f, -0.023879001f}, + {0.970031023f, -0.242980003f, -0.006255000f, -0.023732999f}, {0.963775992f, -0.266712993f, -0.006836000f, -0.023572000f}, + {0.956939995f, -0.290284991f, -0.007412000f, -0.023397001f}, {0.949527979f, -0.313681990f, -0.007984000f, -0.023208000f}, + {0.941543996f, -0.336890012f, -0.008551000f, -0.023004999f}, {0.932992995f, -0.359894991f, -0.009113000f, -0.022787999f}, + {0.923879981f, -0.382683009f, -0.009670000f, -0.022558000f}, {0.914210021f, -0.405241013f, -0.010220000f, -0.022314001f}, + {0.903989017f, -0.427554995f, -0.010765000f, -0.022056000f}, {0.893224001f, -0.449611008f, -0.011303000f, -0.021785000f}, + {0.881920993f, -0.471397012f, -0.011834000f, -0.021500999f}, {0.870087028f, -0.492897987f, -0.012358000f, -0.021205001f}, + {0.857729018f, -0.514102995f, -0.012875000f, -0.020895001f}, {0.844853997f, -0.534998000f, -0.013384000f, -0.020572999f}, + {0.831470013f, -0.555570006f, -0.013885000f, -0.020238001f}, {0.817584991f, -0.575807989f, -0.014377000f, -0.019890999f}, + {0.803207994f, -0.595699012f, -0.014861000f, -0.019532001f}, {0.788345993f, -0.615231991f, -0.015336000f, -0.019161999f}, + {0.773010015f, -0.634392977f, -0.015802000f, -0.018780001f}, {0.757209003f, -0.653173029f, -0.016257999f, -0.018386001f}, + {0.740951002f, -0.671558976f, -0.016704001f, -0.017982000f}, {0.724246979f, -0.689540982f, -0.017139999f, -0.017565999f}, + {0.707107008f, -0.707107008f, -0.017565999f, -0.017139999f}, {0.689540982f, -0.724246979f, -0.017982000f, -0.016704001f}, + {0.671558976f, -0.740951002f, -0.018386001f, -0.016257999f}, {0.653173029f, -0.757209003f, -0.018780001f, -0.015802000f}, + {0.634392977f, -0.773010015f, -0.019161999f, -0.015336000f}, {0.615231991f, -0.788345993f, -0.019532001f, -0.014861000f}, + {0.595699012f, -0.803207994f, -0.019890999f, -0.014377000f}, {0.575807989f, -0.817584991f, -0.020238001f, -0.013885000f}, + {0.555570006f, -0.831470013f, -0.020572999f, -0.013384000f}, {0.534998000f, -0.844853997f, -0.020895001f, -0.012875000f}, + {0.514102995f, -0.857729018f, -0.021205001f, -0.012358000f}, {0.492897987f, -0.870087028f, -0.021500999f, -0.011834000f}, + {0.471397012f, -0.881920993f, -0.021785000f, -0.011303000f}, {0.449611008f, -0.893224001f, -0.022056000f, -0.010765000f}, + {0.427554995f, -0.903989017f, -0.022314001f, -0.010220000f}, {0.405241013f, -0.914210021f, -0.022558000f, -0.009670000f}, + {0.382683009f, -0.923879981f, -0.022787999f, -0.009113000f}, {0.359894991f, -0.932992995f, -0.023004999f, -0.008551000f}, + {0.336890012f, -0.941543996f, -0.023208000f, -0.007984000f}, {0.313681990f, -0.949527979f, -0.023397001f, -0.007412000f}, + {0.290284991f, -0.956939995f, -0.023572000f, -0.006836000f}, {0.266712993f, -0.963775992f, -0.023732999f, -0.006255000f}, + {0.242980003f, -0.970031023f, -0.023879001f, -0.005671000f}, {0.219100997f, -0.975701988f, -0.024010999f, -0.005083000f}, + {0.195089996f, -0.980785012f, -0.024127999f, -0.004492000f}, {0.170962006f, -0.985278010f, -0.024231000f, -0.003899000f}, + {0.146730006f, -0.989176989f, -0.024320001f, -0.003303000f}, {0.122410998f, -0.992479980f, -0.024394000f, -0.002705000f}, + {0.098017000f, -0.995185018f, -0.024452999f, -0.002106000f}, {0.073564999f, -0.997290015f, -0.024497001f, -0.001505000f}, + {0.049068000f, -0.998794973f, -0.024526000f, -0.000903000f}, {0.024541000f, -0.999698997f, -0.024541000f, -0.000301000f}, + {0.000000000f, -1.000000000f, -0.024541000f, 0.000301000f}, {-0.024541000f, -0.999698997f, -0.024526000f, 0.000903000f}, + {-0.049068000f, -0.998794973f, -0.024497001f, 0.001505000f}, {-0.073564999f, -0.997290015f, -0.024452999f, 0.002106000f}, + {-0.098017000f, -0.995185018f, -0.024394000f, 0.002705000f}, {-0.122410998f, -0.992479980f, -0.024320001f, 0.003303000f}, + {-0.146730006f, -0.989176989f, -0.024231000f, 0.003899000f}, {-0.170962006f, -0.985278010f, -0.024127999f, 0.004492000f}, + {-0.195089996f, -0.980785012f, -0.024010999f, 0.005083000f}, {-0.219100997f, -0.975701988f, -0.023879001f, 0.005671000f}, + {-0.242980003f, -0.970031023f, -0.023732999f, 0.006255000f}, {-0.266712993f, -0.963775992f, -0.023572000f, 0.006836000f}, + {-0.290284991f, -0.956939995f, -0.023397001f, 0.007412000f}, {-0.313681990f, -0.949527979f, -0.023208000f, 0.007984000f}, + {-0.336890012f, -0.941543996f, -0.023004999f, 0.008551000f}, {-0.359894991f, -0.932992995f, -0.022787999f, 0.009113000f}, + {-0.382683009f, -0.923879981f, -0.022558000f, 0.009670000f}, {-0.405241013f, -0.914210021f, -0.022314001f, 0.010220000f}, + {-0.427554995f, -0.903989017f, -0.022056000f, 0.010765000f}, {-0.449611008f, -0.893224001f, -0.021785000f, 0.011303000f}, + {-0.471397012f, -0.881920993f, -0.021500999f, 0.011834000f}, {-0.492897987f, -0.870087028f, -0.021205001f, 0.012358000f}, + {-0.514102995f, -0.857729018f, -0.020895001f, 0.012875000f}, {-0.534998000f, -0.844853997f, -0.020572999f, 0.013384000f}, + {-0.555570006f, -0.831470013f, -0.020238001f, 0.013885000f}, {-0.575807989f, -0.817584991f, -0.019890999f, 0.014377000f}, + {-0.595699012f, -0.803207994f, -0.019532001f, 0.014861000f}, {-0.615231991f, -0.788345993f, -0.019161999f, 0.015336000f}, + {-0.634392977f, -0.773010015f, -0.018780001f, 0.015802000f}, {-0.653173029f, -0.757209003f, -0.018386001f, 0.016257999f}, + {-0.671558976f, -0.740951002f, -0.017982000f, 0.016704001f}, {-0.689540982f, -0.724246979f, -0.017565999f, 0.017139999f}, + {-0.707107008f, -0.707107008f, -0.017139999f, 0.017565999f}, {-0.724246979f, -0.689540982f, -0.016704001f, 0.017982000f}, + {-0.740951002f, -0.671558976f, -0.016257999f, 0.018386001f}, {-0.757209003f, -0.653173029f, -0.015802000f, 0.018780001f}, + {-0.773010015f, -0.634392977f, -0.015336000f, 0.019161999f}, {-0.788345993f, -0.615231991f, -0.014861000f, 0.019532001f}, + {-0.803207994f, -0.595699012f, -0.014377000f, 0.019890999f}, {-0.817584991f, -0.575807989f, -0.013885000f, 0.020238001f}, + {-0.831470013f, -0.555570006f, -0.013384000f, 0.020572999f}, {-0.844853997f, -0.534998000f, -0.012875000f, 0.020895001f}, + {-0.857729018f, -0.514102995f, -0.012358000f, 0.021205001f}, {-0.870087028f, -0.492897987f, -0.011834000f, 0.021500999f}, + {-0.881920993f, -0.471397012f, -0.011303000f, 0.021785000f}, {-0.893224001f, -0.449611008f, -0.010765000f, 0.022056000f}, + {-0.903989017f, -0.427554995f, -0.010220000f, 0.022314001f}, {-0.914210021f, -0.405241013f, -0.009670000f, 0.022558000f}, + {-0.923879981f, -0.382683009f, -0.009113000f, 0.022787999f}, {-0.932992995f, -0.359894991f, -0.008551000f, 0.023004999f}, + {-0.941543996f, -0.336890012f, -0.007984000f, 0.023208000f}, {-0.949527979f, -0.313681990f, -0.007412000f, 0.023397001f}, + {-0.956939995f, -0.290284991f, -0.006836000f, 0.023572000f}, {-0.963775992f, -0.266712993f, -0.006255000f, 0.023732999f}, + {-0.970031023f, -0.242980003f, -0.005671000f, 0.023879001f}, {-0.975701988f, -0.219100997f, -0.005083000f, 0.024010999f}, + {-0.980785012f, -0.195089996f, -0.004492000f, 0.024127999f}, {-0.985278010f, -0.170962006f, -0.003899000f, 0.024231000f}, + {-0.989176989f, -0.146730006f, -0.003303000f, 0.024320001f}, {-0.992479980f, -0.122410998f, -0.002705000f, 0.024394000f}, + {-0.995185018f, -0.098017000f, -0.002106000f, 0.024452999f}, {-0.997290015f, -0.073564999f, -0.001505000f, 0.024497001f}, + {-0.998794973f, -0.049068000f, -0.000903000f, 0.024526000f}, {-0.999698997f, -0.024541000f, -0.000301000f, 0.024541000f}, + {-1.000000000f, -0.000000000f, 0.000301000f, 0.024541000f}, {-0.999698997f, 0.024541000f, 0.000903000f, 0.024526000f}, + {-0.998794973f, 0.049068000f, 0.001505000f, 0.024497001f}, {-0.997290015f, 0.073564999f, 0.002106000f, 0.024452999f}, + {-0.995185018f, 0.098017000f, 0.002705000f, 0.024394000f}, {-0.992479980f, 0.122410998f, 0.003303000f, 0.024320001f}, + {-0.989176989f, 0.146730006f, 0.003899000f, 0.024231000f}, {-0.985278010f, 0.170962006f, 0.004492000f, 0.024127999f}, + {-0.980785012f, 0.195089996f, 0.005083000f, 0.024010999f}, {-0.975701988f, 0.219100997f, 0.005671000f, 0.023879001f}, + {-0.970031023f, 0.242980003f, 0.006255000f, 0.023732999f}, {-0.963775992f, 0.266712993f, 0.006836000f, 0.023572000f}, + {-0.956939995f, 0.290284991f, 0.007412000f, 0.023397001f}, {-0.949527979f, 0.313681990f, 0.007984000f, 0.023208000f}, + {-0.941543996f, 0.336890012f, 0.008551000f, 0.023004999f}, {-0.932992995f, 0.359894991f, 0.009113000f, 0.022787999f}, + {-0.923879981f, 0.382683009f, 0.009670000f, 0.022558000f}, {-0.914210021f, 0.405241013f, 0.010220000f, 0.022314001f}, + {-0.903989017f, 0.427554995f, 0.010765000f, 0.022056000f}, {-0.893224001f, 0.449611008f, 0.011303000f, 0.021785000f}, + {-0.881920993f, 0.471397012f, 0.011834000f, 0.021500999f}, {-0.870087028f, 0.492897987f, 0.012358000f, 0.021205001f}, + {-0.857729018f, 0.514102995f, 0.012875000f, 0.020895001f}, {-0.844853997f, 0.534998000f, 0.013384000f, 0.020572999f}, + {-0.831470013f, 0.555570006f, 0.013885000f, 0.020238001f}, {-0.817584991f, 0.575807989f, 0.014377000f, 0.019890999f}, + {-0.803207994f, 0.595699012f, 0.014861000f, 0.019532001f}, {-0.788345993f, 0.615231991f, 0.015336000f, 0.019161999f}, + {-0.773010015f, 0.634392977f, 0.015802000f, 0.018780001f}, {-0.757209003f, 0.653173029f, 0.016257999f, 0.018386001f}, + {-0.740951002f, 0.671558976f, 0.016704001f, 0.017982000f}, {-0.724246979f, 0.689540982f, 0.017139999f, 0.017565999f}, + {-0.707107008f, 0.707107008f, 0.017565999f, 0.017139999f}, {-0.689540982f, 0.724246979f, 0.017982000f, 0.016704001f}, + {-0.671558976f, 0.740951002f, 0.018386001f, 0.016257999f}, {-0.653173029f, 0.757209003f, 0.018780001f, 0.015802000f}, + {-0.634392977f, 0.773010015f, 0.019161999f, 0.015336000f}, {-0.615231991f, 0.788345993f, 0.019532001f, 0.014861000f}, + {-0.595699012f, 0.803207994f, 0.019890999f, 0.014377000f}, {-0.575807989f, 0.817584991f, 0.020238001f, 0.013885000f}, + {-0.555570006f, 0.831470013f, 0.020572999f, 0.013384000f}, {-0.534998000f, 0.844853997f, 0.020895001f, 0.012875000f}, + {-0.514102995f, 0.857729018f, 0.021205001f, 0.012358000f}, {-0.492897987f, 0.870087028f, 0.021500999f, 0.011834000f}, + {-0.471397012f, 0.881920993f, 0.021785000f, 0.011303000f}, {-0.449611008f, 0.893224001f, 0.022056000f, 0.010765000f}, + {-0.427554995f, 0.903989017f, 0.022314001f, 0.010220000f}, {-0.405241013f, 0.914210021f, 0.022558000f, 0.009670000f}, + {-0.382683009f, 0.923879981f, 0.022787999f, 0.009113000f}, {-0.359894991f, 0.932992995f, 0.023004999f, 0.008551000f}, + {-0.336890012f, 0.941543996f, 0.023208000f, 0.007984000f}, {-0.313681990f, 0.949527979f, 0.023397001f, 0.007412000f}, + {-0.290284991f, 0.956939995f, 0.023572000f, 0.006836000f}, {-0.266712993f, 0.963775992f, 0.023732999f, 0.006255000f}, + {-0.242980003f, 0.970031023f, 0.023879001f, 0.005671000f}, {-0.219100997f, 0.975701988f, 0.024010999f, 0.005083000f}, + {-0.195089996f, 0.980785012f, 0.024127999f, 0.004492000f}, {-0.170962006f, 0.985278010f, 0.024231000f, 0.003899000f}, + {-0.146730006f, 0.989176989f, 0.024320001f, 0.003303000f}, {-0.122410998f, 0.992479980f, 0.024394000f, 0.002705000f}, + {-0.098017000f, 0.995185018f, 0.024452999f, 0.002106000f}, {-0.073564999f, 0.997290015f, 0.024497001f, 0.001505000f}, + {-0.049068000f, 0.998794973f, 0.024526000f, 0.000903000f}, {-0.024541000f, 0.999698997f, 0.024541000f, 0.000301000f}, + {-0.000000000f, 1.000000000f, 0.024541000f, -0.000301000f}}; static ArcTanSample sArcTanTbl[] = { - {0.000000000f, 1.272825360f}, - {1.272825360f, 1.270345807f}, - {2.543171167f, 1.265415549f}, - {3.808586597f, 1.258091569f}, - {5.066678524f, 1.248457074f}, - {6.315135479f, 1.236619473f}, - {7.551754951f, 1.222707152f}, - {8.774461746f, 1.206866622f}, - {9.981328964f, 1.189258218f}, - {11.170586586f, 1.170052886f}, - {12.340640068f, 1.149428010f}, - {13.490067482f, 1.127564430f}, - {14.617631912f, 1.104642272f}, - {15.722274780f, 1.080838680f}, - {16.803113937f, 1.056325078f}, - {17.859437943f, 1.031264901f}, - {18.890703201f, 1.005812049f}, - {19.896514893f, 0.980109632f}, - {20.876625061f, 0.954289079f}, - {21.830913544f, 0.928469777f}, - {22.759384155f, 0.902758956f}, - {23.662141800f, 0.877251565f}, - {24.539394379f, 0.852030873f}, - {25.391424179f, 0.827168882f}, - {26.218593597f, 0.802726984f}, - {27.021320343f, 0.778756559f}, - {27.800077438f, 0.755300105f}, - {28.555377960f, 0.732391477f}, - {29.287769318f, 0.710057378f}, - {29.997825623f, 0.688317478f}, - {30.686143875f, 0.667185664f}, - {31.353328705f, 0.646670520f}, - {32.000000000f, 0.626776159f} - }; + {0.000000000f, 1.272825360f}, {1.272825360f, 1.270345807f}, {2.543171167f, 1.265415549f}, {3.808586597f, 1.258091569f}, + {5.066678524f, 1.248457074f}, {6.315135479f, 1.236619473f}, {7.551754951f, 1.222707152f}, {8.774461746f, 1.206866622f}, + {9.981328964f, 1.189258218f}, {11.170586586f, 1.170052886f}, {12.340640068f, 1.149428010f}, {13.490067482f, 1.127564430f}, + {14.617631912f, 1.104642272f}, {15.722274780f, 1.080838680f}, {16.803113937f, 1.056325078f}, {17.859437943f, 1.031264901f}, + {18.890703201f, 1.005812049f}, {19.896514893f, 0.980109632f}, {20.876625061f, 0.954289079f}, {21.830913544f, 0.928469777f}, + {22.759384155f, 0.902758956f}, {23.662141800f, 0.877251565f}, {24.539394379f, 0.852030873f}, {25.391424179f, 0.827168882f}, + {26.218593597f, 0.802726984f}, {27.021320343f, 0.778756559f}, {27.800077438f, 0.755300105f}, {28.555377960f, 0.732391477f}, + {29.287769318f, 0.710057378f}, {29.997825623f, 0.688317478f}, {30.686143875f, 0.667185664f}, {31.353328705f, 0.646670520f}, + {32.000000000f, 0.626776159f}}; f32 AtanFIdx_(f32 x) { x *= 32.0f; @@ -321,7 +167,7 @@ namespace nw4r { return atan; } - } + } // namespace f32 SinFIdx(f32 fidx) { f32 abs_fidx = FAbs(fidx); @@ -333,7 +179,7 @@ namespace nw4r { u16 whole = F32ToU16(abs_fidx); f32 frac = abs_fidx - U16ToF32(whole); - f32 sin = sSinCosTbl[whole& 255].sin_val + frac * sSinCosTbl[whole& 255].sin_delta; + f32 sin = sSinCosTbl[whole & 255].sin_val + frac * sSinCosTbl[whole & 255].sin_delta; return (fidx < 0.0f) ? -sin : sin; } @@ -348,7 +194,7 @@ namespace nw4r { u16 whole = F32ToU16(abs_fidx); f32 frac = abs_fidx - U16ToF32(whole); - f32 cos = sSinCosTbl[whole& 255].cos_val + frac * sSinCosTbl[whole& 255].cos_delta; + f32 cos = sSinCosTbl[whole & 255].cos_val + frac * sSinCosTbl[whole & 255].cos_delta; return cos; } @@ -357,16 +203,13 @@ namespace nw4r { if (x >= 0.0f) { if (x > 1.0f) { return 64.0f - AtanFIdx_(1.0f / x); - } - else { + } else { return AtanFIdx_(x); } - } - else { + } else { if (x < -1.0f) { return AtanFIdx_(-1.0f / x) + -64.0f; - } - else { + } else { return -AtanFIdx_(-x); } } @@ -389,58 +232,51 @@ namespace nw4r { c = 0.0f; minus = false; - } - else { + } else { a = y; b = x; c = 64.0f; minus = true; } - } - else { + } else { if (x >= -y) { - a = x; + a = x; b = -y; c = 0.0f; minus = true; - } - else { + } else { a = -y; - b = x; + b = x; c = -64.0f; minus = false; } } - } - else { + } else { if (y >= 0.0f) { if (-x >= y) { a = -x; - b = y; + b = y; c = 128.0f; minus = true; - } - else { - a = y; + } else { + a = y; b = -x; c = 64.0f; minus = false; } - } - else { + } else { if (-x >= -y) { a = -x; b = -y; c = -128.0f; minus = false; - } - else { + } else { a = -y; b = -x; c = -64.0f; @@ -452,5 +288,5 @@ namespace nw4r { return minus ? c - AtanFIdx_(b / a) : c + AtanFIdx_(b / a); } - } -} + } // namespace math +} // namespace nw4r diff --git a/libs/NW4R/src/math/math_types.cpp b/libs/NW4R/src/math/math_types.cpp index 1e7ef4c1..43140e14 100644 --- a/libs/NW4R/src/math/math_types.cpp +++ b/libs/NW4R/src/math/math_types.cpp @@ -6,6 +6,7 @@ namespace nw4r { register f32 a, b, c; a = 0.0f; b = 1.0f; + // clang-format off #ifdef __MWERKS__ asm { psq_st a, 8(pMtx), 0, 0 @@ -19,7 +20,8 @@ namespace nw4r { psq_st a, 48(pMtx), 0, 0 psq_st c, 56(pMtx), 0, 0 } - #endif + #endif // __MWERKS__ + // clang-format on } VEC4* VEC4Transform(VEC4* pOut, const MTX44* pM, const VEC4* pV) { @@ -35,5 +37,5 @@ namespace nw4r { pOut->w = tmp.w; return pOut; } - } -} + } // namespace math +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_AxManager.cpp b/libs/NW4R/src/snd/snd_AxManager.cpp index 09d1f53a..f9d0cace 100644 --- a/libs/NW4R/src/snd/snd_AxManager.cpp +++ b/libs/NW4R/src/snd/snd_AxManager.cpp @@ -3,35 +3,23 @@ #include -#include #include +#include + -#include #include +#include + namespace nw4r { namespace snd { namespace detail { u8 AxManager::sZeroBuffer[ZERO_BUFFER_SIZE]; - AxManager::AxManager() : - mOutputMode(OUTPUT_MODE_STEREO), - mZeroBufferAddress(NULL), - mCallbackList(), - mPrioVoiceList(), - mFreeVoiceList(), - mVoices(), - mInitialized(false), - mUpdateVoicePrioFlag(true), - mHomeButtonMuteFlag(false), - mDiskErrorFlag(false), - mHomeButtonMenuVolume(), - mMasterVolume(), - mVolumeForReset(), - mOldAidCallback(NULL), - mResetReadyCounter(-1), - mAuxUserVolume(), - mFxList() { + AxManager::AxManager() + : mOutputMode(OUTPUT_MODE_STEREO), mZeroBufferAddress(NULL), mCallbackList(), mPrioVoiceList(), mFreeVoiceList(), mVoices(), + mInitialized(false), mUpdateVoicePrioFlag(true), mHomeButtonMuteFlag(false), mDiskErrorFlag(false), mHomeButtonMenuVolume(), + mMasterVolume(), mVolumeForReset(), mOldAidCallback(NULL), mResetReadyCounter(-1), mAuxUserVolume(), mFxList() { mHomeButtonMenuVolume.InitValue(1.0f); mMasterVolume.InitValue(1.0f); mVolumeForReset.InitValue(1.0f); @@ -48,8 +36,8 @@ namespace nw4r { return instance; } - #pragma push - #pragma ppc_iro_level 0 // uh +#pragma push +#pragma ppc_iro_level 0 // uh void AxManager::Init() { if (mInitialized) { return; @@ -72,7 +60,7 @@ namespace nw4r { mNextAxRegisterCallback = AXRegisterCallback(AxCallbackFunc); mInitialized = true; } - #pragma pop +#pragma pop f32 AxManager::GetOutputVolume() const { f32 volume = mMasterVolume.GetValue(); @@ -89,8 +77,7 @@ namespace nw4r { mDiskErrorFlag = false; UpdateAllVoicesSync(AxVoice::SYNC_AX_VOICE); } - } - else if (status != DVD_STATE_BUSY) { + } else if (status != DVD_STATE_BUSY) { if (!mDiskErrorFlag) { mDiskErrorFlag = true; UpdateAllVoicesSync(AxVoice::SYNC_AX_VOICE); @@ -268,7 +255,7 @@ namespace nw4r { UpdateAllVoicesSync(AxVoice::SYNC_AX_VE); } } - + void AxManager::AxCallbackFunc() { for (CallbackList::Iterator it = GetInstance().mCallbackList.GetBeginIter(); it != GetInstance().mCallbackList.GetEndIter();) { CallbackList::Iterator currIt = it++; @@ -385,8 +372,7 @@ namespace nw4r { buffer[AX_DPL2_R] = ppChans[AX_DPL2_R]; buffer[AX_DPL2_LS] = ppChans[AX_DPL2_LS]; buffer[AX_DPL2_RS] = ppChans[AX_DPL2_RS]; - } - else { + } else { num = AX_STEREO_MAX; buffer[AX_STEREO_L] = ppChans[AX_STEREO_L]; @@ -400,20 +386,17 @@ namespace nw4r { for (int i = 0; i < num; i++) { memset(buffer[i], 0, FX_BUFFER_SIZE); } - } - else if (GetInstance().GetEffectList(bus).IsEmpty()) { + } else if (GetInstance().GetEffectList(bus).IsEmpty()) { for (int i = 0; i < num; i++) { memset(buffer[i], 0, FX_BUFFER_SIZE); } - } - else { - for (FxList::Iterator it = GetInstance().GetEffectList(bus).GetBeginIter(); - it != GetInstance().GetEffectList(bus).GetEndIter(); it++) { - + } else { + for (FxList::Iterator it = GetInstance().GetEffectList(bus).GetBeginIter(); it != GetInstance().GetEffectList(bus).GetEndIter(); + it++) { it->UpdateBuffer(num, buffer, FX_BUFFER_SIZE, FX_SAMPLE_FORMAT, FX_SAMPLE_RATE, GetInstance().GetOutputMode()); } } } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_AxVoice.cpp b/libs/NW4R/src/snd/snd_AxVoice.cpp index 6e2a10cf..44568655 100644 --- a/libs/NW4R/src/snd/snd_AxVoice.cpp +++ b/libs/NW4R/src/snd/snd_AxVoice.cpp @@ -1,15 +1,19 @@ -#include #include +#include #include -#include + #include +#include + -#include #include +#include + -#include #include +#include + #include @@ -20,17 +24,11 @@ namespace nw4r { void SetVoiceLoop(AXVPB* vpb, u32 loopAddr); void SetVoiceLoopAddr(AXVPB* vpb, u32 loopAddr); void SetVoiceEndAddr(AXVPB* vpb, u32 endAddr); - } + } // namespace - AxVoice::AxVoice() : - mCallback(NULL), - mActiveFlag(false), - mStartFlag(false), - mStartedFlag(false), - mPauseFlag(false), - mFirstVeUpdateFlag(0), - mHomeButtonMuteFlag(0), - mSyncFlag(0) { + AxVoice::AxVoice() + : mCallback(NULL), mActiveFlag(false), mStartFlag(false), mStartedFlag(false), mPauseFlag(false), mFirstVeUpdateFlag(0), + mHomeButtonMuteFlag(0), mSyncFlag(0) { for (int i = 0; i < CHANNEL_MAX; i++) { for (int j = 0; j < VOICES_MAX; j++) { mVpb[i][j] = NULL; @@ -53,7 +51,7 @@ namespace nw4r { for (int i = 0; i < channels; i++) { mVoiceChannelParam[i].waveData = NULL; } - + mChannelCount = channels; mVoiceOutCount = voices; mCallback = callback; @@ -100,7 +98,7 @@ namespace nw4r { if (mActiveFlag) { if (mStartedFlag && IsPlayFinished()) { if (mCallback) { - mCallback(this, CALLBACK_STATUS_FINISH_WAVE, mCallbackData); + mCallback(this, CALLBACK_STATUS_FINISH_WAVE, mCallbackData); } mStartedFlag = false; mStartFlag = false; @@ -119,8 +117,7 @@ namespace nw4r { if (mPauseFlag || mHomeButtonMuteFlag || AxManager::GetInstance().IsDiskError()) { SetAxParam(AXSetVoiceState, (u16)AX_VOICE_STOP); mPausingFlag = true; - } - else { + } else { SetAxParam(AXSetVoiceState, (u16)AX_VOICE_STREAM); mPausingFlag = false; } @@ -161,8 +158,7 @@ namespace nw4r { u32 axPrio; if (priority == PRIORITY_MAX) { axPrio = AX_PRIORITY_MAX; - } - else { + } else { axPrio = (AX_PRIORITY_MAX / 2) + 1; } @@ -177,9 +173,7 @@ namespace nw4r { const AxVoiceList& rVoiceList = AxManager::GetInstance().GetVoiceList(); - for (AxVoiceList::ConstIterator it = rVoiceList.GetBeginIter(); - it != rVoiceList.GetEndIter(); it++) { - + for (AxVoiceList::ConstIterator it = rVoiceList.GetBeginIter(); it != rVoiceList.GetEndIter(); it++) { if (priority < it->GetPriority()) { break; } @@ -200,9 +194,8 @@ namespace nw4r { u32 allocPrio; if (axPrio < AX_PRIORITY_MAX) { - allocPrio = axPrio+1; - } - else { + allocPrio = axPrio + 1; + } else { allocPrio = axPrio; } @@ -335,11 +328,10 @@ namespace nw4r { bool AxVoice::IsRun() { ut::AutoInterruptLock lock; - + if (mVpb[0][0] == NULL) { return false; - } - else { + } else { return mVpb[0][0]->pb.state == AX_VOICE_RUN; } } @@ -360,8 +352,7 @@ namespace nw4r { mVeTargetVolume = target; mSyncFlag |= SYNC_AX_VE; } - } - else { + } else { target = ut::Clamp(target, 0.0f, 1.0f); init = ut::Clamp(init, 0.0f, 1.0f); if (init != mVeInitVolume || target != mVeTargetVolume) { @@ -419,7 +410,6 @@ namespace nw4r { } } - void AxVoice::SetOutputLine(int flag) { if (flag != mOutputLineFlag) { mOutputLineFlag = flag; @@ -494,8 +484,7 @@ namespace nw4r { const AXPB* vpb = &mVpb[0][0]->pb; if (vpb == NULL) { return 0; - } - else { + } else { return ((vpb->addr.currentAddressHi << 16) + vpb->addr.currentAddressLo); } } @@ -506,8 +495,7 @@ namespace nw4r { const AXPB* vpb = &mVpb[0][0]->pb; if (vpb == NULL) { return 0; - } - else { + } else { return ((vpb->addr.endAddressHi << 16) + vpb->addr.endAddressLo); } } @@ -551,8 +539,7 @@ namespace nw4r { if (samples <= dspAddr && dspAddr < addr) { return true; - } - else { + } else { return false; } } @@ -581,14 +568,13 @@ namespace nw4r { if (loopFlag) { loopAddr = GetDspAddressBySample(waveAddr, loopStart, mFormat); - } - else { + } else { void* zeroAddr = AxManager::GetInstance().GetZeroBufferAddress(); loopAddr = GetDspAddressBySample(zeroAddr, 0, mFormat); } u32 startAddr = GetDspAddressBySample(waveAddr, 0, mFormat); - u32 endAddr = GetDspAddressBySample(waveAddr, loopEnd-1, mFormat); + u32 endAddr = GetDspAddressBySample(waveAddr, loopEnd - 1, mFormat); AXPBADDR addr; @@ -619,7 +605,7 @@ namespace nw4r { void AxVoice::SetLoopEnd(int channelIndex, const void* baseAddress, u32 samples) { ut::AutoInterruptLock lock; - u32 addr = GetDspAddressBySample(baseAddress, samples-1, mFormat); + u32 addr = GetDspAddressBySample(baseAddress, samples - 1, mFormat); for (int i = 0; i < mVoiceOutCount; i++) { SetVoiceEndAddr(mVpb[channelIndex][i], addr); } @@ -639,7 +625,7 @@ namespace nw4r { void* zeroAddr = AxManager::GetInstance().GetZeroBufferAddress(); u32 startAddr = GetDspAddressBySample(zeroAddr, 0, mFormat); - u32 endAddr = GetDspAddressBySample(baseAddress, samples-1, mFormat); + u32 endAddr = GetDspAddressBySample(baseAddress, samples - 1, mFormat); for (int i = 0; i < mVoiceOutCount; i++) { AXVPB* vpb = mVpb[channelIndex][i]; @@ -677,8 +663,7 @@ namespace nw4r { for (int j = 0; j < mChannelCount; j++) { AXSetVoiceSrc(mVpb[j][i], &src); } - } - else { + } else { for (int j = 0; j < mChannelCount; j++) { AXSetVoiceSrcRatio(mVpb[j][i], ratio * pitch); } @@ -726,8 +711,7 @@ namespace nw4r { adpcmLoop.loop_pred_scale = param->loop_pred_scale; adpcmLoop.loop_yn1 = param->loop_yn1; adpcmLoop.loop_yn2 = param->loop_yn2; - } - else { + } else { adpcmLoop.loop_pred_scale = 0; adpcmLoop.loop_yn1 = 0; adpcmLoop.loop_yn2 = 0; @@ -744,11 +728,11 @@ namespace nw4r { f32 baseVolume = 1.0f; baseVolume *= mVolume; baseVolume *= AxManager::GetInstance().GetOutputVolume(); - + if (mHomeButtonMuteFlag) { baseVolume = 0.0f; } - + for (int i = 0; i < mVoiceOutCount; i++) { f32& volumePrev = mVolumePrev[i]; f32 volume = baseVolume * mVoiceOutParam[i].volume; @@ -760,12 +744,11 @@ namespace nw4r { u16 targetVol; if (mFirstVeUpdateFlag || !IsRun()) { - initVol = volume * mVeInitVolume * (AX_MAX_VOLUME-1); - targetVol = volume * mVeTargetVolume * (AX_MAX_VOLUME-1); - } - else { - initVol = volumePrev * mVeInitVolume * (AX_MAX_VOLUME-1); - targetVol = volume * mVeTargetVolume * (AX_MAX_VOLUME-1); + initVol = volume * mVeInitVolume * (AX_MAX_VOLUME - 1); + targetVol = volume * mVeTargetVolume * (AX_MAX_VOLUME - 1); + } else { + initVol = volumePrev * mVeInitVolume * (AX_MAX_VOLUME - 1); + targetVol = volume * mVeTargetVolume * (AX_MAX_VOLUME - 1); } pbVe.currentVolume = initVol; @@ -792,20 +775,19 @@ namespace nw4r { void AxVoice::UpdateAxMix() { AXPBRMTMIX rmtMix; AXPBMIX mix; - + for (int i = 0; i < mChannelCount; i = i + 1) { for (int j = 0; j < mVoiceOutCount; j = j + 1) { - CalcAXPBMIX(i,j,&mix); + CalcAXPBMIX(i, j, &mix); - AXSetVoiceMix(mVpb[i][j],&mix); + AXSetVoiceMix(mVpb[i][j], &mix); if (mOutputLineFlag == 0 || mOutputLineFlag == OUTPUT_LINE_MAIN) { - AXSetVoiceRmtOn(mVpb[i][j],0); - } - else { - CalcAXPBRMTMIX(i,j,&rmtMix); - AXSetVoiceRmtOn(mVpb[i][j],1); - AXSetVoiceRmtMix(mVpb[i][j],&rmtMix); + AXSetVoiceRmtOn(mVpb[i][j], 0); + } else { + CalcAXPBRMTMIX(i, j, &rmtMix); + AXSetVoiceRmtOn(mVpb[i][j], 1); + AXSetVoiceRmtMix(mVpb[i][j], &rmtMix); } } } @@ -823,8 +805,7 @@ namespace nw4r { for (int j = 0; j < mChannelCount; j++) { AXSetVoiceLpf(mVpb[j][i], &lpf); } - } - else { + } else { u16 a0, b0; if (mVpb[0][0]->pb.lpf.on == TRUE) { @@ -833,8 +814,7 @@ namespace nw4r { for (int j = 0; j < mChannelCount; j++) { AXSetVoiceLpfCoefs(mVpb[j][i], a0, b0); } - } - else { + } else { AXPBLPF lpf; lpf.on = TRUE; @@ -887,8 +867,8 @@ namespace nw4r { switch (fmt) { case FORMAT_ADPCM: { - addr = (samples / AX_ADPCM_SAMPLES_PER_FRAME * AX_ADPCM_NIBBLES_PER_FRAME) + (samples % AX_ADPCM_SAMPLES_PER_FRAME) - + (reinterpret_cast(base) * sizeof(u16)) + sizeof(u16); + addr = (samples / AX_ADPCM_SAMPLES_PER_FRAME * AX_ADPCM_NIBBLES_PER_FRAME) + (samples % AX_ADPCM_SAMPLES_PER_FRAME) + + (reinterpret_cast(base) * sizeof(u16)) + sizeof(u16); break; } @@ -915,7 +895,8 @@ namespace nw4r { switch (fmt) { case FORMAT_ADPCM: { samples = addr - reinterpret_cast(base) * sizeof(u16); - samples = (samples % AX_ADPCM_NIBBLES_PER_FRAME) + (samples / AX_ADPCM_NIBBLES_PER_FRAME * AX_ADPCM_SAMPLES_PER_FRAME) - sizeof(u16); + samples = (samples % AX_ADPCM_NIBBLES_PER_FRAME) + (samples / AX_ADPCM_NIBBLES_PER_FRAME * AX_ADPCM_SAMPLES_PER_FRAME) - + sizeof(u16); break; } @@ -965,11 +946,9 @@ namespace nw4r { if (ratio > 4.0f / 3.0f) { type = SRC_4TAP_8K; - } - else if (ratio > 1.0f) { + } else if (ratio > 1.0f) { type = SRC_4TAP_12K; - } - else { + } else { type = SRC_4TAP_16K; } } @@ -983,28 +962,22 @@ namespace nw4r { if (surroundPan <= 0.0f) { *pPan = pan; *pSurroundPan = -0.12f + 0.88f * surroundPan; - } - else { + } else { *pPan = 0.5f * pan; *pSurroundPan = -0.12f + 1.12f * surroundPan; } - } - else if (pan >= 0.0f) { + } else if (pan >= 0.0f) { if (surroundPan <= 0.0f) { *pPan = (0.85f + (1.0f - 0.85f) * (-surroundPan / pan)) * math::FAbs(pan); *pSurroundPan = -0.12f + (2.0f * surroundPan + 0.88f * pan); - } - else { - *pPan = - (0.85f + (1.0f - 0.65f) * (-surroundPan / pan)) * math::FAbs(pan); + } else { + *pPan = (0.85f + (1.0f - 0.65f) * (-surroundPan / pan)) * math::FAbs(pan); *pSurroundPan = -0.12f + 1.12f * pan; } - } - else if (surroundPan <= 0.0f) { + } else if (surroundPan <= 0.0f) { *pPan = ((1.0f - 0.85f) * (-surroundPan / pan) - 0.85f) * math::FAbs(pan); *pSurroundPan = -0.12f + (2.0f * surroundPan - 1.12f * pan); - } - else { + } else { *pPan = ((1.0f - 0.65f) * (-surroundPan / pan) - 0.85f) * math::FAbs(pan); *pSurroundPan = -0.12f + 1.12f * -pan; } @@ -1054,8 +1027,7 @@ namespace nw4r { f32 volume = 1.0f; if (mOutputLineFlag & OUTPUT_LINE_MAIN) { volume *= mMainOutVolume; - } - else { + } else { volume = 0.0f; } @@ -1122,9 +1094,8 @@ namespace nw4r { f32 pan, surroundPan; switch (AxManager::GetInstance().GetOutputMode()) { case OUTPUT_MODE_DPL2: { - TransformDpl2Pan(&pan, &surroundPan, - mPan + mPan2 + vPan + mVoiceOutParam[voiceIndex].pan, - mSurroundPan + mSurroundPan2 + mVoiceOutParam[voiceIndex].surroundPan); + TransformDpl2Pan(&pan, &surroundPan, mPan + mPan2 + vPan + mVoiceOutParam[voiceIndex].pan, + mSurroundPan + mSurroundPan2 + mVoiceOutParam[voiceIndex].surroundPan); break; } case OUTPUT_MODE_MONO: { @@ -1135,7 +1106,7 @@ namespace nw4r { case OUTPUT_MODE_STEREO: case OUTPUT_MODE_SURROUND: default: { - pan = mPan + mPan2 + vPan + mVoiceOutParam[voiceIndex].pan; + pan = mPan + mPan2 + vPan + mVoiceOutParam[voiceIndex].pan; surroundPan = mSurroundPan + mSurroundPan2 + mVoiceOutParam[voiceIndex].surroundPan; break; } @@ -1180,12 +1151,12 @@ namespace nw4r { vR *= rightVol; vSL *= leftVol; vSR *= rightVol; - vAuxAL *= leftVol; - vAuxAR *= rightVol; + vAuxAL *= leftVol; + vAuxAR *= rightVol; vAuxASL *= leftVol; vAuxASR *= rightVol; - vAuxBL *= leftVol; - vAuxBR *= rightVol; + vAuxBL *= leftVol; + vAuxBR *= rightVol; vAuxBSL *= leftVol; vAuxBSR *= rightVol; break; @@ -1340,8 +1311,7 @@ namespace nw4r { f32 volume = 1.0f; if (mOutputLineFlag & (OUTPUT_LINE_REMOTE_N << i)) { volume *= mRemoteOutVolume[i]; - } - else { + } else { volume = 0.0f; } rmt *= volume; @@ -1406,7 +1376,7 @@ namespace nw4r { vpb->sync |= 0x2000; } } - } + } // namespace void AxVoice::InvalidateWaveData(const void* start, const void* end) { ut::AutoInterruptLock lock; @@ -1428,6 +1398,6 @@ namespace nw4r { } } } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_AxfxImpl.cpp b/libs/NW4R/src/snd/snd_AxfxImpl.cpp index 302bced9..1c873b84 100644 --- a/libs/NW4R/src/snd/snd_AxfxImpl.cpp +++ b/libs/NW4R/src/snd/snd_AxfxImpl.cpp @@ -7,8 +7,8 @@ namespace nw4r { namespace snd { namespace detail { - AxfxImpl* AxfxImpl::mCurrentFx = NULL; - u32 AxfxImpl::mAllocatedSize = 0; + AxfxImpl* AxfxImpl::mCurrentFx = NULL; + u32 AxfxImpl::mAllocatedSize = 0; bool AxfxImpl::CreateHeap(void* buffer, u32 size) { mHeap = MEMCreateFrmHeap(buffer, size); @@ -39,6 +39,6 @@ namespace nw4r { MEMFreeToFrmHeap(mCurrentFx->mHeap, MEM_FRM_HEAP_FREE_ALL); } } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_Bank.cpp b/libs/NW4R/src/snd/snd_Bank.cpp index bc8d9ac3..5aabb09f 100644 --- a/libs/NW4R/src/snd/snd_Bank.cpp +++ b/libs/NW4R/src/snd/snd_Bank.cpp @@ -3,9 +3,11 @@ namespace nw4r { namespace snd { namespace detail { - Bank::Bank(const void* bankData) : mBankReader(bankData), mWaveDataAddress(NULL) {} + Bank::Bank(const void* bankData) : mBankReader(bankData), mWaveDataAddress(NULL) { + } - Bank::~Bank() {} + Bank::~Bank() { + } Channel* Bank::NoteOn(const NoteOnInfo& noteOnInfo) const { InstInfo instInfo; @@ -18,9 +20,8 @@ namespace nw4r { return NULL; } - Channel* channel = Channel::AllocChannel(ut::Min(waveData.numChannels, CHANNEL_MAX), - noteOnInfo.voiceOutCount, noteOnInfo.priority, - noteOnInfo.channelCallback, noteOnInfo.channelCallbackData); + Channel* channel = Channel::AllocChannel(ut::Min(waveData.numChannels, CHANNEL_MAX), noteOnInfo.voiceOutCount, + noteOnInfo.priority, noteOnInfo.channelCallback, noteOnInfo.channelCallbackData); if (channel == NULL) { return NULL; @@ -49,6 +50,6 @@ namespace nw4r { return channel; } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_BankFile.cpp b/libs/NW4R/src/snd/snd_BankFile.cpp index cf0a9d13..b736e929 100644 --- a/libs/NW4R/src/snd/snd_BankFile.cpp +++ b/libs/NW4R/src/snd/snd_BankFile.cpp @@ -30,10 +30,7 @@ namespace nw4r { return true; } - BankFileReader::BankFileReader(const void* bankData) : - mHeader(NULL), - mDataBlock(NULL), - mWaveBlock(NULL) { + BankFileReader::BankFileReader(const void* bankData) : mHeader(NULL), mDataBlock(NULL), mWaveBlock(NULL) { if (!IsValidFileHeader(bankData)) { return; } @@ -100,8 +97,7 @@ namespace nw4r { if (mHeader->fileHeader.version == VERSION) { info->volume = param->volume; info->tune = param->tune; - } - else { + } else { info->volume = 127; info->tune = 1.0f; } @@ -121,8 +117,7 @@ namespace nw4r { break; } case DATATYPE_RANGETABLE: { - const BankFile::RangeTable* pRangeTable = - Util::GetDataRefAddress2(*ref, &mDataBlock->instTable); + const BankFile::RangeTable* pRangeTable = Util::GetDataRefAddress2(*ref, &mDataBlock->instTable); if (pRangeTable == NULL) { return NULL; @@ -143,8 +138,7 @@ namespace nw4r { break; } case DATATYPE_INDEXTABLE: { - const BankFile::IndexTable* pIndexTable = - Util::GetDataRefAddress3(*ref, &mDataBlock->instTable); + const BankFile::IndexTable* pIndexTable = Util::GetDataRefAddress3(*ref, &mDataBlock->instTable); if (pIndexTable == NULL) { return NULL; @@ -185,6 +179,6 @@ namespace nw4r { WaveFileReader wfr(info); return wfr.ReadWaveParam(data, waveAddr); } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_BasicSound.cpp b/libs/NW4R/src/snd/snd_BasicSound.cpp index 5de96659..7e4b69bb 100644 --- a/libs/NW4R/src/snd/snd_BasicSound.cpp +++ b/libs/NW4R/src/snd/snd_BasicSound.cpp @@ -1,8 +1,10 @@ -#include #include +#include + -#include #include +#include + #include @@ -11,17 +13,11 @@ namespace nw4r { namespace detail { NW4R_UT_GET_RUNTIME_TYPEINFO(BasicSound); - BasicSound::BasicSound() : - mHeap(NULL), - mGeneralHandle(NULL), - mTempGeneralHandle(NULL), - mSoundPlayer(NULL), - mExtSoundPlayer(NULL), - mAmbientParamUpdateCallback(NULL), - mAmbientArgUpdateCallback(NULL), - mAmbientArgAllocaterCallback(NULL), - mAmbientArg(NULL), - mId(INVALID_ID) {} + BasicSound::BasicSound() + : mHeap(NULL), mGeneralHandle(NULL), mTempGeneralHandle(NULL), mSoundPlayer(NULL), mExtSoundPlayer(NULL), + mAmbientParamUpdateCallback(NULL), mAmbientArgUpdateCallback(NULL), mAmbientArgAllocaterCallback(NULL), mAmbientArg(NULL), + mId(INVALID_ID) { + } void BasicSound::InitParam() { mPauseFlag = false; @@ -70,8 +66,7 @@ namespace nw4r { void BasicSound::Stop(int frames) { BasicPlayer& rPlayer = GetBasicPlayer(); - if (frames == 0 || !rPlayer.IsActive() || !rPlayer.IsStarted() || - rPlayer.IsPause()) { + if (frames == 0 || !rPlayer.IsActive() || !rPlayer.IsStarted() || rPlayer.IsPause()) { Shutdown(); return; } @@ -98,8 +93,7 @@ namespace nw4r { } mPauseFadeVolume.SetTarget(0.0f, t); - } - else { + } else { // what if ((mPauseFlag != false) != flag) { rPlayer.Pause(false); @@ -173,8 +167,7 @@ namespace nw4r { if (mPauseFadeFlag) { mPauseFadeVolume.Update(); - } - else { + } else { mFadeVolume.Update(); mExtMoveVolume.Update(); } @@ -401,10 +394,8 @@ namespace nw4r { return mRemoteOutVolume[remote]; } - void BasicSound::SetAmbientParamCallback(AmbientParamUpdateCallback* paramUpdateCallback, - AmbientArgUpdateCallback* argUpdateCallback, - AmbientArgAllocaterCallback* argAllocaterCallback, - void* arg) { + void BasicSound::SetAmbientParamCallback(AmbientParamUpdateCallback* paramUpdateCallback, AmbientArgUpdateCallback* argUpdateCallback, + AmbientArgAllocaterCallback* argAllocaterCallback, void* arg) { mAmbientParamUpdateCallback = paramUpdateCallback; mAmbientArgUpdateCallback = argUpdateCallback; mAmbientArgAllocaterCallback = argAllocaterCallback; @@ -431,6 +422,6 @@ namespace nw4r { mId = id; GetBasicPlayer().SetId(id); } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_Channel.cpp b/libs/NW4R/src/snd/snd_Channel.cpp index 99518638..ddf6124e 100644 --- a/libs/NW4R/src/snd/snd_Channel.cpp +++ b/libs/NW4R/src/snd/snd_Channel.cpp @@ -10,13 +10,9 @@ namespace nw4r { namespace snd { namespace detail { - Channel Channel::mChannel[AX_VOICE_MAX+1]; + Channel Channel::mChannel[AX_VOICE_MAX + 1]; - Channel::Channel() : - mPauseFlag(0), - mActiveFlag(false), - mAllocFlag(false), - mVoice(NULL) { + Channel::Channel() : mPauseFlag(0), mActiveFlag(false), mAllocFlag(false), mVoice(NULL) { ChannelManager::GetInstance().Append(this); } @@ -361,6 +357,6 @@ namespace nw4r { currIt->Update(true); } } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_DisposeCallbackManager.cpp b/libs/NW4R/src/snd/snd_DisposeCallbackManager.cpp index fae210a4..2b1b4eb7 100644 --- a/libs/NW4R/src/snd/snd_DisposeCallbackManager.cpp +++ b/libs/NW4R/src/snd/snd_DisposeCallbackManager.cpp @@ -11,7 +11,8 @@ namespace nw4r { return instance; } - DisposeCallbackManager::DisposeCallbackManager() {} + DisposeCallbackManager::DisposeCallbackManager() { + } void DisposeCallbackManager::RegisterDisposeCallback(DisposeCallback* callback) { ut::AutoInterruptLock lock; @@ -52,6 +53,6 @@ namespace nw4r { currIt++->InvalidateWaveData(start, end); } } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_DvdSoundArchive.cpp b/libs/NW4R/src/snd/snd_DvdSoundArchive.cpp index b9c21384..83fc1b11 100644 --- a/libs/NW4R/src/snd/snd_DvdSoundArchive.cpp +++ b/libs/NW4R/src/snd/snd_DvdSoundArchive.cpp @@ -8,24 +8,24 @@ namespace nw4r { namespace snd { class DvdSoundArchive::DvdFileStream : public ut::DvdLockedFileStream { - public: - DvdFileStream(const DVDFileInfo* fileInfo, u32 offset, u32 size); - DvdFileStream(s32 entrynum, u32 offset, u32 size); + public: + DvdFileStream(const DVDFileInfo* fileInfo, u32 offset, u32 size); + DvdFileStream(s32 entrynum, u32 offset, u32 size); - virtual s32 Read(void* dst, u32 size); // 0x14 - virtual void Seek(s32 offset, u32 origin); // 0x44 + virtual s32 Read(void* dst, u32 size); // 0x14 + virtual void Seek(s32 offset, u32 origin); // 0x44 - virtual u32 Tell() const { return ut::DvdFileStream::Tell() - mOffset; } // 0x58 + virtual u32 Tell() const { return ut::DvdFileStream::Tell() - mOffset; } // 0x58 - virtual u32 GetSize() const { return mSize; } // 0x40 + virtual u32 GetSize() const { return mSize; } // 0x40 - private: - s32 mOffset; // 0x70 - s32 mSize; // 0x74 + private: + s32 mOffset; // 0x70 + s32 mSize; // 0x74 }; - DvdSoundArchive::DvdSoundArchive() : - mOpen(false) {} + DvdSoundArchive::DvdSoundArchive() : mOpen(false) { + } DvdSoundArchive::~DvdSoundArchive() { Close(); @@ -80,7 +80,7 @@ namespace nw4r { return NULL; } - return new(buffer) DvdFileStream(&mFileInfo, offset, length); + return new (buffer) DvdFileStream(&mFileInfo, offset, length); } ut::FileStream* DvdSoundArchive::OpenExtStream(void* buffer, int size, const char* extPath, u32 offset, u32 length) const { @@ -97,7 +97,7 @@ namespace nw4r { return NULL; } - return new(buffer) DvdFileStream(entrynum, offset, length); + return new (buffer) DvdFileStream(entrynum, offset, length); } int DvdSoundArchive::detail_GetRequiredStreamBufferSize() const { @@ -159,10 +159,8 @@ namespace nw4r { return true; } - DvdSoundArchive::DvdFileStream::DvdFileStream(const DVDFileInfo* fileInfo, u32 offset, u32 size) : - DvdLockedFileStream(fileInfo, false), - mOffset(offset), - mSize(size) { + DvdSoundArchive::DvdFileStream::DvdFileStream(const DVDFileInfo* fileInfo, u32 offset, u32 size) + : DvdLockedFileStream(fileInfo, false), mOffset(offset), mSize(size) { if (mSize == 0) { mSize = ut::DvdFileStream::GetSize(); } @@ -170,10 +168,8 @@ namespace nw4r { ut::DvdFileStream::Seek(mOffset, SEEK_BEG); } - DvdSoundArchive::DvdFileStream::DvdFileStream(s32 entrynum, u32 offset, u32 size) : - DvdLockedFileStream(entrynum), - mOffset(offset), - mSize(size) { + DvdSoundArchive::DvdFileStream::DvdFileStream(s32 entrynum, u32 offset, u32 size) + : DvdLockedFileStream(entrynum), mOffset(offset), mSize(size) { if (mSize == 0) { mSize = ut::DvdFileStream::GetSize(); } @@ -213,12 +209,11 @@ namespace nw4r { if (offset < mOffset) { offset = mOffset; - } - else if (offset > mOffset + mSize) { + } else if (offset > mOffset + mSize) { offset = mOffset + mSize; } ut::DvdFileStream::Seek(offset, SEEK_BEG); } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_EnvGenerator.cpp b/libs/NW4R/src/snd/snd_EnvGenerator.cpp index 0f2f5ff7..d63d860a 100644 --- a/libs/NW4R/src/snd/snd_EnvGenerator.cpp +++ b/libs/NW4R/src/snd/snd_EnvGenerator.cpp @@ -1,23 +1,18 @@ #include -#include #include +#include + namespace nw4r { namespace snd { namespace detail { const s16 EnvGenerator::DecibelSquareTable[EnvGenerator::DECIBEL_SQUARE_TABLE_SIZE] = { - -723, -722, -721, -651, -601, -562, -530, -503, -480, -460, -442, -425, - -410, -396, -383, -371, -360, -349, -339, -330, -321, -313, -305, -297, - -289, -282, -276, -269, -263, -257, -251, -245, -239, -234, -229, -224, - -219, -214, -210, -205, -201, -196, -192, -188, -184, -180, -176, -173, - -169, -165, -162, -158, -155, -152, -149, -145, -142, -139, -136, -133, - -130, -127, -125, -122, -119, -116, -114, -111, -109, -106, -103, -101, - -99, -96, -94, -91, -89, -87, -85, -82, -80, -78, -76, -74, - -72, -70, -68, -66, -64, -62, -60, -58, -56, -54, -52, -50, - -49, -47, -45, -43, -42, -40, -38, -36, -35, -33, -31, -30, - -28, -27, -25, -23, -22, -20, -19, -17, -16, -14, -13, -11, - -10, -8, -7, -6, -4, -3, -1, 0 - }; + -723, -722, -721, -651, -601, -562, -530, -503, -480, -460, -442, -425, -410, -396, -383, -371, -360, -349, -339, -330, -321, -313, + -305, -297, -289, -282, -276, -269, -263, -257, -251, -245, -239, -234, -229, -224, -219, -214, -210, -205, -201, -196, -192, -188, + -184, -180, -176, -173, -169, -165, -162, -158, -155, -152, -149, -145, -142, -139, -136, -133, -130, -127, -125, -122, -119, -116, + -114, -111, -109, -106, -103, -101, -99, -96, -94, -91, -89, -87, -85, -82, -80, -78, -76, -74, -72, -70, -68, -66, + -64, -62, -60, -58, -56, -54, -52, -50, -49, -47, -45, -43, -42, -40, -38, -36, -35, -33, -31, -30, -28, -27, + -25, -23, -22, -20, -19, -17, -16, -14, -13, -11, -10, -8, -7, -6, -4, -3, -1, 0}; EnvGenerator::EnvGenerator() { Init(); @@ -88,29 +83,19 @@ namespace nw4r { void EnvGenerator::SetAttack(int attack) { static const f32 attackTable[128] = { - 0.9992175f, 0.9984326f, 0.9976452f, 0.9968553f, 0.9960629f, 0.9952679f, - 0.9944704f, 0.9936704f, 0.9928677f, 0.9920625f, 0.9912546f, 0.9904441f, - 0.9896309f, 0.9888151f, 0.9879965f, 0.9871752f, 0.9863512f, 0.9855244f, - 0.9846949f, 0.9838625f, 0.9830273f, 0.9821893f, 0.9813483f, 0.9805045f, - 0.9796578f, 0.9788081f, 0.9779555f, 0.9770999f, 0.9762413f, 0.9753797f, - 0.9745150f, 0.9736472f, 0.9727763f, 0.9719023f, 0.9710251f, 0.9701448f, - 0.9692612f, 0.9683744f, 0.9674844f, 0.9665910f, 0.9656944f, 0.9647944f, - 0.9638910f, 0.9629842f, 0.9620740f, 0.9611604f, 0.9602433f, 0.9593226f, - 0.9583984f, 0.9574706f, 0.9565392f, 0.9556042f, 0.9546655f, 0.9537231f, - 0.9527769f, 0.9518270f, 0.9508732f, 0.9499157f, 0.9489542f, 0.9479888f, - 0.9470195f, 0.9460462f, 0.9450689f, 0.9440875f, 0.9431020f, 0.9421124f, - 0.9411186f, 0.9401206f, 0.9391184f, 0.9381118f, 0.9371009f, 0.9360856f, - 0.9350659f, 0.9340417f, 0.9330131f, 0.9319798f, 0.9309420f, 0.9298995f, - 0.9288523f, 0.9278004f, 0.9267436f, 0.9256821f, 0.9246156f, 0.9235442f, - 0.9224678f, 0.9213864f, 0.9202998f, 0.9192081f, 0.9181112f, 0.9170091f, - 0.9159016f, 0.9147887f, 0.9136703f, 0.9125465f, 0.9114171f, 0.9102821f, - 0.9091414f, 0.9079949f, 0.9068427f, 0.9056845f, 0.9045204f, 0.9033502f, - 0.9021740f, 0.9009916f, 0.8998029f, 0.8986080f, 0.8974066f, 0.8961988f, - 0.8949844f, 0.8900599f, 0.8824622f, 0.8759247f, 0.8691861f, 0.8636406f, - 0.8535788f, 0.8430189f, 0.8286135f, 0.8149099f, 0.8002172f, 0.7780663f, - 0.7554750f, 0.7242125f, 0.6828239f, 0.6329169f, 0.5592135f, 0.4551411f, - 0.3298770f, 0.0000000f - }; + 0.9992175f, 0.9984326f, 0.9976452f, 0.9968553f, 0.9960629f, 0.9952679f, 0.9944704f, 0.9936704f, 0.9928677f, 0.9920625f, + 0.9912546f, 0.9904441f, 0.9896309f, 0.9888151f, 0.9879965f, 0.9871752f, 0.9863512f, 0.9855244f, 0.9846949f, 0.9838625f, + 0.9830273f, 0.9821893f, 0.9813483f, 0.9805045f, 0.9796578f, 0.9788081f, 0.9779555f, 0.9770999f, 0.9762413f, 0.9753797f, + 0.9745150f, 0.9736472f, 0.9727763f, 0.9719023f, 0.9710251f, 0.9701448f, 0.9692612f, 0.9683744f, 0.9674844f, 0.9665910f, + 0.9656944f, 0.9647944f, 0.9638910f, 0.9629842f, 0.9620740f, 0.9611604f, 0.9602433f, 0.9593226f, 0.9583984f, 0.9574706f, + 0.9565392f, 0.9556042f, 0.9546655f, 0.9537231f, 0.9527769f, 0.9518270f, 0.9508732f, 0.9499157f, 0.9489542f, 0.9479888f, + 0.9470195f, 0.9460462f, 0.9450689f, 0.9440875f, 0.9431020f, 0.9421124f, 0.9411186f, 0.9401206f, 0.9391184f, 0.9381118f, + 0.9371009f, 0.9360856f, 0.9350659f, 0.9340417f, 0.9330131f, 0.9319798f, 0.9309420f, 0.9298995f, 0.9288523f, 0.9278004f, + 0.9267436f, 0.9256821f, 0.9246156f, 0.9235442f, 0.9224678f, 0.9213864f, 0.9202998f, 0.9192081f, 0.9181112f, 0.9170091f, + 0.9159016f, 0.9147887f, 0.9136703f, 0.9125465f, 0.9114171f, 0.9102821f, 0.9091414f, 0.9079949f, 0.9068427f, 0.9056845f, + 0.9045204f, 0.9033502f, 0.9021740f, 0.9009916f, 0.8998029f, 0.8986080f, 0.8974066f, 0.8961988f, 0.8949844f, 0.8900599f, + 0.8824622f, 0.8759247f, 0.8691861f, 0.8636406f, 0.8535788f, 0.8430189f, 0.8286135f, 0.8149099f, 0.8002172f, 0.7780663f, + 0.7554750f, 0.7242125f, 0.6828239f, 0.6329169f, 0.5592135f, 0.4551411f, 0.3298770f, 0.0000000f}; mAttack = attackTable[attack]; } @@ -143,6 +128,6 @@ namespace nw4r { int EnvGenerator::CalcDecibelSquare(int scale) { return DecibelSquareTable[scale]; } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_ExternalSoundPlayer.cpp b/libs/NW4R/src/snd/snd_ExternalSoundPlayer.cpp index d0a69be9..8f02788d 100644 --- a/libs/NW4R/src/snd/snd_ExternalSoundPlayer.cpp +++ b/libs/NW4R/src/snd/snd_ExternalSoundPlayer.cpp @@ -17,9 +17,7 @@ namespace nw4r { int lowestPrio = BasicSound::PRIORITY_MAX + 1; BasicSound* pLowest = NULL; - for (BasicSoundExtPlayList::Iterator it = mSoundList.GetBeginIter(); - it != mSoundList.GetEndIter(); it++) { - + for (BasicSoundExtPlayList::Iterator it = mSoundList.GetBeginIter(); it != mSoundList.GetEndIter(); it++) { int priority = it->CalcCurrentPlayerPriority(); if (lowestPrio > priority) { @@ -30,6 +28,6 @@ namespace nw4r { return pLowest; } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_FrameHeap.cpp b/libs/NW4R/src/snd/snd_FrameHeap.cpp index 87d5c870..c01e0d97 100644 --- a/libs/NW4R/src/snd/snd_FrameHeap.cpp +++ b/libs/NW4R/src/snd/snd_FrameHeap.cpp @@ -5,8 +5,8 @@ namespace nw4r { namespace snd { namespace detail { - FrameHeap::FrameHeap() : - mHandle(NULL) {} + FrameHeap::FrameHeap() : mHandle(NULL) { + } FrameHeap::~FrameHeap() { if (IsValid()) { @@ -63,7 +63,7 @@ namespace nw4r { return NULL; } - Block* pBlock = new(buffer) Block(size, callback, callbackArg); + Block* pBlock = new (buffer) Block(size, callback, callbackArg); mSectionList.GetBack().AppendBlock(pBlock); return pBlock->GetBufferAddr(); @@ -119,7 +119,7 @@ namespace nw4r { return false; } - mSectionList.PushBack(new(pSection) Section()); + mSectionList.PushBack(new (pSection) Section()); return true; } @@ -130,6 +130,6 @@ namespace nw4r { mSectionList.Erase(&rSection); } } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_FxChorus.cpp b/libs/NW4R/src/snd/snd_FxChorus.cpp index bf3e2701..cb6012fd 100644 --- a/libs/NW4R/src/snd/snd_FxChorus.cpp +++ b/libs/NW4R/src/snd/snd_FxChorus.cpp @@ -36,7 +36,7 @@ namespace nw4r { BOOL success = AXFXChorusInit(&mAxfxParam); - AXFXChorusGetMemSize(&mAxfxParam); // Debug leftover + AXFXChorusGetMemSize(&mAxfxParam); // Debug leftover mImpl.mCurrentFx = NULL; mImpl.mIsActive = true; @@ -89,5 +89,5 @@ namespace nw4r { AXFXChorusCallback(chans, &mAxfxParam); } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_FxDelay.cpp b/libs/NW4R/src/snd/snd_FxDelay.cpp index 3eccc04e..ace75949 100644 --- a/libs/NW4R/src/snd/snd_FxDelay.cpp +++ b/libs/NW4R/src/snd/snd_FxDelay.cpp @@ -36,7 +36,7 @@ namespace nw4r { BOOL success = AXFXDelayInit(&mAxfxParam); - AXFXDelayGetMemSize(&mAxfxParam); // Debug leftover + AXFXDelayGetMemSize(&mAxfxParam); // Debug leftover mImpl.mCurrentFx = NULL; mImpl.mIsActive = true; @@ -44,7 +44,7 @@ namespace nw4r { } void FxDelay::Shutdown() { - mImpl.mIsActive = false; + mImpl.mIsActive = false; mImpl.mCurrentFx = &mImpl; AXFXSetHooks(detail::AxfxImpl::Alloc, detail::AxfxImpl::Free); @@ -84,5 +84,5 @@ namespace nw4r { AXFXDelayCallback(chans, &mAxfxParam); } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_FxReverbHi.cpp b/libs/NW4R/src/snd/snd_FxReverbHi.cpp index 514ceaec..7ff32344 100644 --- a/libs/NW4R/src/snd/snd_FxReverbHi.cpp +++ b/libs/NW4R/src/snd/snd_FxReverbHi.cpp @@ -36,7 +36,7 @@ namespace nw4r { BOOL success = AXFXReverbHiInit(&mAxfxParam); - AXFXReverbHiGetMemSize(&mAxfxParam); // Debug leftover + AXFXReverbHiGetMemSize(&mAxfxParam); // Debug leftover mImpl.mCurrentFx = NULL; mImpl.mIsActive = true; @@ -87,5 +87,5 @@ namespace nw4r { AXFXReverbHiCallback(chans, &mAxfxParam); } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_FxReverbHiDpl2.cpp b/libs/NW4R/src/snd/snd_FxReverbHiDpl2.cpp index a42f5d85..344c74f6 100644 --- a/libs/NW4R/src/snd/snd_FxReverbHiDpl2.cpp +++ b/libs/NW4R/src/snd/snd_FxReverbHiDpl2.cpp @@ -36,7 +36,7 @@ namespace nw4r { BOOL success = AXFXReverbHiInitDpl2(&mAxfxParam); - AXFXReverbHiGetMemSizeDpl2(&mAxfxParam); // Debug leftover + AXFXReverbHiGetMemSizeDpl2(&mAxfxParam); // Debug leftover mImpl.mCurrentFx = NULL; mImpl.mIsActive = true; @@ -88,5 +88,5 @@ namespace nw4r { AXFXReverbHiCallbackDpl2(chans, &mAxfxParam); } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_FxReverbStd.cpp b/libs/NW4R/src/snd/snd_FxReverbStd.cpp index 5e6882bf..16fe6e4e 100644 --- a/libs/NW4R/src/snd/snd_FxReverbStd.cpp +++ b/libs/NW4R/src/snd/snd_FxReverbStd.cpp @@ -36,7 +36,7 @@ namespace nw4r { BOOL success = AXFXReverbStdInit(&mAxfxParam); - AXFXReverbStdGetMemSize(&mAxfxParam); // Debug leftover + AXFXReverbStdGetMemSize(&mAxfxParam); // Debug leftover mImpl.mCurrentFx = NULL; mImpl.mIsActive = true; @@ -86,5 +86,5 @@ namespace nw4r { AXFXReverbStdCallback(chans, &mAxfxParam); } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_InstancePool.cpp b/libs/NW4R/src/snd/snd_InstancePool.cpp index c9a11656..94fc1bf3 100644 --- a/libs/NW4R/src/snd/snd_InstancePool.cpp +++ b/libs/NW4R/src/snd/snd_InstancePool.cpp @@ -34,8 +34,7 @@ namespace nw4r { for (; it != NULL; it = it->mNext) { if (begin <= it && it < end) { pPrev->mNext = it->mNext; - } - else { + } else { pPrev = it; } } @@ -73,6 +72,6 @@ namespace nw4r { pHead->mNext = mNext; mNext = pHead; } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_Lfo.cpp b/libs/NW4R/src/snd/snd_Lfo.cpp index 5f331a15..4fce9756 100644 --- a/libs/NW4R/src/snd/snd_Lfo.cpp +++ b/libs/NW4R/src/snd/snd_Lfo.cpp @@ -31,10 +31,8 @@ namespace nw4r { } s8 Lfo::GetSinIdx(int idx) { - static const u8 sinTable[TABLE_SIZE + 1] = { - 0, 6, 12, 19, 25, 31, 37, 43, 49, 54, 60, - 65, 71, 76, 81, 85, 90, 94, 98, 102, 106, 109, - 112, 115, 117, 120, 122, 123, 125, 126, 126, 127, 127}; + static const u8 sinTable[TABLE_SIZE + 1] = {0, 6, 12, 19, 25, 31, 37, 43, 49, 54, 60, 65, 71, 76, 81, 85, 90, + 94, 98, 102, 106, 109, 112, 115, 117, 120, 122, 123, 125, 126, 126, 127, 127}; if (idx < TABLE_SIZE) { return sinTable[idx]; @@ -67,6 +65,6 @@ namespace nw4r { return value; } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_McsSoundArchive.cpp b/libs/NW4R/src/snd/snd_McsSoundArchive.cpp index 0a27641d..90a96dfa 100644 --- a/libs/NW4R/src/snd/snd_McsSoundArchive.cpp +++ b/libs/NW4R/src/snd/snd_McsSoundArchive.cpp @@ -4,16 +4,18 @@ namespace nw4r { namespace snd { class McsSoundArchive::McsFileStream : public ut::FileStream { NW4R_UT_RUNTIME_TYPEINFO; - - public: - McsFileStream(); + + public: + McsFileStream(); }; /** * Sorry, nothing. * This file is needed for those left over weak functions. */ - McsSoundArchive::McsSoundArchive() {} - McsSoundArchive::McsFileStream::McsFileStream() {} - } -} + McsSoundArchive::McsSoundArchive() { + } + McsSoundArchive::McsFileStream::McsFileStream() { + } + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_MemorySoundArchive.cpp b/libs/NW4R/src/snd/snd_MemorySoundArchive.cpp index bb0a4f6c..fe67ca41 100644 --- a/libs/NW4R/src/snd/snd_MemorySoundArchive.cpp +++ b/libs/NW4R/src/snd/snd_MemorySoundArchive.cpp @@ -8,33 +8,34 @@ namespace nw4r { namespace snd { class MemorySoundArchive::MemoryFileStream : public ut::FileStream { - public: - MemoryFileStream(const void* buffer, u32 size); + public: + MemoryFileStream(const void* buffer, u32 size); - virtual void Close(); // 0x10 - virtual s32 Read(void* dst, u32 size); // 0x14 - virtual void Seek(s32 offset, u32 origin); // 0x44 + virtual void Close(); // 0x10 + virtual s32 Read(void* dst, u32 size); // 0x14 + virtual void Seek(s32 offset, u32 origin); // 0x44 - virtual bool CanSeek() const { return true; } // 0x50 - virtual bool CanCancel() const { return true; } // 0x54 - virtual bool CanAsync() const { return false; } // 0x28 - virtual bool CanRead() const { return true; } // 0x2C - virtual bool CanWrite() const { return false; } // 0x30 + virtual bool CanSeek() const { return true; } // 0x50 + virtual bool CanCancel() const { return true; } // 0x54 + virtual bool CanAsync() const { return false; } // 0x28 + virtual bool CanRead() const { return true; } // 0x2C + virtual bool CanWrite() const { return false; } // 0x30 - virtual u32 Tell() const { return mOffset; } // 0x58 + virtual u32 Tell() const { return mOffset; } // 0x58 - virtual u32 GetSize() const { return mSize; } // 0x40 + virtual u32 GetSize() const { return mSize; } // 0x40 - private: - const void* mData; // 0x14 - s32 mSize; // 0x18 - s32 mOffset; // 0x1C + private: + const void* mData; // 0x14 + s32 mSize; // 0x18 + s32 mOffset; // 0x1C }; - MemorySoundArchive::MemorySoundArchive() : - mData(NULL) {} + MemorySoundArchive::MemorySoundArchive() : mData(NULL) { + } - MemorySoundArchive::~MemorySoundArchive() {} + MemorySoundArchive::~MemorySoundArchive() { + } bool MemorySoundArchive::Setup(const void* buffer) { mFileReader.Init(buffer); @@ -103,10 +104,8 @@ namespace nw4r { return ut::AddOffsetToPtr(mData, groupInfo.waveDataOffset + itemInfo.waveDataOffset); } - MemorySoundArchive::MemoryFileStream::MemoryFileStream(const void* buffer, u32 size) : - mData(buffer), - mSize(size), - mOffset(0) {} + MemorySoundArchive::MemoryFileStream::MemoryFileStream(const void* buffer, u32 size) : mData(buffer), mSize(size), mOffset(0) { + } ut::FileStream* MemorySoundArchive::OpenStream(void* buffer, int size, u32 offset, u32 length) const { if (mData == NULL) { @@ -117,7 +116,7 @@ namespace nw4r { return NULL; } - return new(buffer) MemoryFileStream(ut::AddOffsetToPtr(mData, offset), length); + return new (buffer) MemoryFileStream(ut::AddOffsetToPtr(mData, offset), length); } ut::FileStream* MemorySoundArchive::OpenExtStream(void* buffer, int size, const char* extPath, u32 offset, u32 length) const { @@ -160,5 +159,5 @@ namespace nw4r { } } } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_MidiSeqPlayer.cpp b/libs/NW4R/src/snd/snd_MidiSeqPlayer.cpp index 240898e5..3edd1fc3 100644 --- a/libs/NW4R/src/snd/snd_MidiSeqPlayer.cpp +++ b/libs/NW4R/src/snd/snd_MidiSeqPlayer.cpp @@ -3,11 +3,12 @@ namespace nw4r { namespace snd { namespace detail { - /** - * Sorry, nothing. - * This file is needed for those left over weak functions. - */ - MidiSeqPlayer::MidiSeqPlayer() : SeqPlayer() {} - } - } -} + /** + * Sorry, nothing. + * This file is needed for those left over weak functions. + */ + MidiSeqPlayer::MidiSeqPlayer() : SeqPlayer() { + } + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_MidiSeqTrack.cpp b/libs/NW4R/src/snd/snd_MidiSeqTrack.cpp index 16ec5175..fc16fd34 100644 --- a/libs/NW4R/src/snd/snd_MidiSeqTrack.cpp +++ b/libs/NW4R/src/snd/snd_MidiSeqTrack.cpp @@ -4,10 +4,11 @@ namespace nw4r { namespace snd { namespace detail { /** - * Sorry, nothing. - * This file is needed for those left over weak functions. - */ - MidiSeqTrack::MidiSeqTrack() : SeqTrack() {} - } - } -} + * Sorry, nothing. + * This file is needed for those left over weak functions. + */ + MidiSeqTrack::MidiSeqTrack() : SeqTrack() { + } + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_MmlParser.cpp b/libs/NW4R/src/snd/snd_MmlParser.cpp index a4208bb4..243b2398 100644 --- a/libs/NW4R/src/snd/snd_MmlParser.cpp +++ b/libs/NW4R/src/snd/snd_MmlParser.cpp @@ -89,8 +89,7 @@ namespace nw4r { } case MML_SET_PRGNO: { - arg1 = ReadArg(&rTrackParam.currentAddr, seqPlayer, track, - useArgType ? argType : SEQ_ARG_VMIDI); + arg1 = ReadArg(&rTrackParam.currentAddr, seqPlayer, track, useArgType ? argType : SEQ_ARG_VMIDI); if (doExecCommand) { CommandProc(track, cmd, arg1, arg2); @@ -190,7 +189,8 @@ namespace nw4r { switch (cmdex & MML_CMD_SET_MASK) { case MML_EX_USERPROC: { - arg1 = static_cast(ReadArg(&rTrackParam.currentAddr, seqPlayer, track, useArgType ? argType : SEQ_ARG_S16)); + arg1 = static_cast( + ReadArg(&rTrackParam.currentAddr, seqPlayer, track, useArgType ? argType : SEQ_ARG_S16)); if (doExecCommand) { CommandProc(track, (cmd << 8) + cmdex, arg1, arg2); @@ -201,7 +201,8 @@ namespace nw4r { case MML_EX_ARITHMETIC: case MML_EX_LOGIC: { arg1 = ReadByte(&rTrackParam.currentAddr); - arg2 = static_cast(ReadArg(&rTrackParam.currentAddr, seqPlayer, track, useArgType ? argType : SEQ_ARG_S16)); + arg2 = static_cast( + ReadArg(&rTrackParam.currentAddr, seqPlayer, track, useArgType ? argType : SEQ_ARG_S16)); if (doExecCommand) { CommandProc(track, (cmd << 8) + cmdex, arg1, arg2); @@ -235,271 +236,260 @@ namespace nw4r { SeqTrack::ParserTrackParam& rTrackParam = track->GetParserTrackParam(); MmlSeqTrack::MmlParserParam& rMmlParam = track->GetMmlParserParam(); - SeqPlayer::ParserPlayerParam& rPlayerParam = - seqPlayer->GetParserPlayerParam(); + SeqPlayer::ParserPlayerParam& rPlayerParam = seqPlayer->GetParserPlayerParam(); if (command <= MML_CMD_MAX) { switch (command) { - case MML_SET_TEMPO: { - rPlayerParam.tempo = arg1; - break; - } - case MML_SET_PRGNO: { - if (arg1 < SeqTrack::PRGNO_MAX + 1) { - rTrackParam.prgNo = arg1 & SeqTrack::PRGNO_MAX; + case MML_SET_TEMPO: { + rPlayerParam.tempo = arg1; + break; } - break; - } - - case MML_SET_MUTE: { - track->SetMute(static_cast(arg1)); - break; - } - - case MML_SET_TRACK_VOLUME: { - rTrackParam.volume = arg1; - break; - } - case MML_SET_TRACK_VOLUME2: { - rTrackParam.volume2 = arg1; - break; - } - case MML_SET_PLAYER_VOLUME: { - rPlayerParam.volume = arg1; - break; - } - - case MML_SET_TRANSPOSE: { - rTrackParam.transpose = arg1; - break; - } - - case MML_SET_PITCHBEND: { - rTrackParam.pitchBend = arg1; - break; - } - case MML_SET_BENDRANGE: { - rTrackParam.bendRange = arg1; - break; - } - case MML_SET_PAN: { - if (arg1 <= 1) { - arg1++; - } - rTrackParam.pan = arg1 - 64; - break; - } - case MML_SET_INITPAN: { - if (arg1 <= 1) { - arg1++; - } - rTrackParam.initPan = arg1 - 64; - break; - } - case MML_SET_SURROUNDPAN: { - if (arg1 <= 1) { - arg1++; - } - rTrackParam.surroundPan = arg1; - break; - } - case MML_SET_PRIORITY: { - rTrackParam.priority = arg1; - break; - } - - case MML_SET_NOTEWAIT: { - rMmlParam.noteWaitFlag = arg1; - break; - } - - case MML_SET_PORTATIME: { - rTrackParam.portaTime = arg1; - break; - } - - case MML_SET_LFODEPTH: { - rTrackParam.lfoParam.depth = static_cast(arg1) / 128.0f; - break; - } - case MML_SET_LFOSPEED: { - rTrackParam.lfoParam.speed = - static_cast(arg1) * (100.0f / 256.0f); - break; - } - case MML_SET_LFOTARGET: { - rTrackParam.lfoTarget = arg1; - break; - } - case MML_SET_LFORANGE: { - rTrackParam.lfoParam.range = arg1; - break; - } - case MML_SET_LFODELAY: { - rTrackParam.lfoParam.delay = arg1 * 5; - break; - } - - case MML_SET_SWEEPPITCH: { - rTrackParam.sweepPitch = arg1 / 32.0f; - break; - } - - case MML_SET_ATTACK: { - rTrackParam.attack = arg1; - break; - } - case MML_SET_DECAY: { - rTrackParam.decay = arg1; - break; - } - case MML_SET_SUSTAIN: { - rTrackParam.sustain = arg1; - break; - } - case MML_SET_RELEASE: { - rTrackParam.release = arg1; - break; - } - case MML_SET_TIE: { - rMmlParam.tieFlag = arg1; - track->ReleaseAllChannel(-1); - track->FreeAllChannel(); - break; - } - - case MML_SET_PORTAMENTO: { - rTrackParam.portaKey = arg1 + rTrackParam.transpose; - rTrackParam.portaFlag = true; - break; - } - case MML_SET_PORTASPEED: { - rTrackParam.portaFlag = arg1 != 0; - break; - } - case MML_SET_LPFFREQ: { - rTrackParam.lpfFreq = arg1; - break; - } - - case MML_SET_FXSEND_A: { - rTrackParam.fxSend[AUX_A] = arg1; - break; - } - case MML_SET_FXSEND_B: { - rTrackParam.fxSend[AUX_B] = arg1; - break; - } - case MML_SET_FXSEND_C: { - rTrackParam.fxSend[AUX_C] = arg1; - break; - } - case MML_SET_MAINSEND: { - rTrackParam.mainSend = arg1; - break; - } - - case MML_PRINTVAR: { - if (!mPrintVarEnabledFlag) { + case MML_SET_PRGNO: { + if (arg1 < SeqTrack::PRGNO_MAX + 1) { + rTrackParam.prgNo = arg1 & SeqTrack::PRGNO_MAX; + } break; } - const vs16* pVar = GetVariablePtr(seqPlayer, track, arg1); - - // Convert absolute index into variable type-relative index - int varNo = arg1 >= SeqPlayer::VARIABLE_NUM ? arg1 - SeqPlayer::VARIABLE_NUM - : (arg1 >= SeqPlayer::LOCAL_VARIABLE_NUM ? arg1 - SeqPlayer::LOCAL_VARIABLE_NUM : arg1); - - // Determine variable type prefix from absolute index - // 'T' = Track variable, 'G' = Global (player) variable - const char* pVarType = arg1 >= SeqPlayer::VARIABLE_NUM ? "T" - : (arg1 >= SeqPlayer::LOCAL_VARIABLE_NUM ? "G" : ""); - - OSReport("#%08x[%d]: printvar %sVAR_%d(%d) = %d\n", seqPlayer, - track->GetPlayerTrackNo(), pVarType, varNo, arg1, *pVar); - break; - } - - case MML_OPENTRACK: { - SeqTrack* pNewTrack = seqPlayer->GetPlayerTrack(arg1); - - if (pNewTrack != NULL && pNewTrack != track) { - pNewTrack->Close(); - pNewTrack->SetSeqData(rTrackParam.baseAddr, arg2); - } - break; - } - - case MML_JUMP: { - rTrackParam.currentAddr = rTrackParam.baseAddr + arg1; - break; - } - - case MML_CALL: { - if (rMmlParam.callStackDepth >= CALL_STACK_MAX_DEPTH) { + case MML_SET_MUTE: { + track->SetMute(static_cast(arg1)); break; } - rMmlParam.callStack[rMmlParam.callStackDepth] = - rTrackParam.currentAddr; - - rMmlParam.callStackDepth++; - rTrackParam.currentAddr = rTrackParam.baseAddr + arg1; - break; - } - - case MML_RET: { - if (rMmlParam.callStackDepth == 0) { + case MML_SET_TRACK_VOLUME: { + rTrackParam.volume = arg1; + break; + } + case MML_SET_TRACK_VOLUME2: { + rTrackParam.volume2 = arg1; + break; + } + case MML_SET_PLAYER_VOLUME: { + rPlayerParam.volume = arg1; break; } - rMmlParam.callStackDepth--; - - rTrackParam.currentAddr = - rMmlParam.callStack[rMmlParam.callStackDepth]; - break; - } - - case MML_LOOP_START: { - if (rMmlParam.callStackDepth >= CALL_STACK_MAX_DEPTH) { + case MML_SET_TRANSPOSE: { + rTrackParam.transpose = arg1; break; } - rMmlParam.callStack[rMmlParam.callStackDepth] = - rTrackParam.currentAddr; - - rMmlParam.loopCount[rMmlParam.callStackDepth] = arg1; - rMmlParam.callStackDepth++; - break; - } - - case MML_LOOP_END: { - if (rMmlParam.callStackDepth == 0) { + case MML_SET_PITCHBEND: { + rTrackParam.pitchBend = arg1; + break; + } + case MML_SET_BENDRANGE: { + rTrackParam.bendRange = arg1; + break; + } + case MML_SET_PAN: { + if (arg1 <= 1) { + arg1++; + } + rTrackParam.pan = arg1 - 64; + break; + } + case MML_SET_INITPAN: { + if (arg1 <= 1) { + arg1++; + } + rTrackParam.initPan = arg1 - 64; + break; + } + case MML_SET_SURROUNDPAN: { + if (arg1 <= 1) { + arg1++; + } + rTrackParam.surroundPan = arg1; + break; + } + case MML_SET_PRIORITY: { + rTrackParam.priority = arg1; break; } - u8 count = rMmlParam.loopCount[rMmlParam.callStackDepth - 1]; + case MML_SET_NOTEWAIT: { + rMmlParam.noteWaitFlag = arg1; + break; + } + + case MML_SET_PORTATIME: { + rTrackParam.portaTime = arg1; + break; + } + + case MML_SET_LFODEPTH: { + rTrackParam.lfoParam.depth = static_cast(arg1) / 128.0f; + break; + } + case MML_SET_LFOSPEED: { + rTrackParam.lfoParam.speed = static_cast(arg1) * (100.0f / 256.0f); + break; + } + case MML_SET_LFOTARGET: { + rTrackParam.lfoTarget = arg1; + break; + } + case MML_SET_LFORANGE: { + rTrackParam.lfoParam.range = arg1; + break; + } + case MML_SET_LFODELAY: { + rTrackParam.lfoParam.delay = arg1 * 5; + break; + } + + case MML_SET_SWEEPPITCH: { + rTrackParam.sweepPitch = arg1 / 32.0f; + break; + } + + case MML_SET_ATTACK: { + rTrackParam.attack = arg1; + break; + } + case MML_SET_DECAY: { + rTrackParam.decay = arg1; + break; + } + case MML_SET_SUSTAIN: { + rTrackParam.sustain = arg1; + break; + } + case MML_SET_RELEASE: { + rTrackParam.release = arg1; + break; + } + case MML_SET_TIE: { + rMmlParam.tieFlag = arg1; + track->ReleaseAllChannel(-1); + track->FreeAllChannel(); + break; + } + + case MML_SET_PORTAMENTO: { + rTrackParam.portaKey = arg1 + rTrackParam.transpose; + rTrackParam.portaFlag = true; + break; + } + case MML_SET_PORTASPEED: { + rTrackParam.portaFlag = arg1 != 0; + break; + } + case MML_SET_LPFFREQ: { + rTrackParam.lpfFreq = arg1; + break; + } + + case MML_SET_FXSEND_A: { + rTrackParam.fxSend[AUX_A] = arg1; + break; + } + case MML_SET_FXSEND_B: { + rTrackParam.fxSend[AUX_B] = arg1; + break; + } + case MML_SET_FXSEND_C: { + rTrackParam.fxSend[AUX_C] = arg1; + break; + } + case MML_SET_MAINSEND: { + rTrackParam.mainSend = arg1; + break; + } + + case MML_PRINTVAR: { + if (!mPrintVarEnabledFlag) { + break; + } + + const vs16* pVar = GetVariablePtr(seqPlayer, track, arg1); + + // Convert absolute index into variable type-relative index + int varNo = arg1 >= SeqPlayer::VARIABLE_NUM ? + arg1 - SeqPlayer::VARIABLE_NUM : + (arg1 >= SeqPlayer::LOCAL_VARIABLE_NUM ? arg1 - SeqPlayer::LOCAL_VARIABLE_NUM : arg1); + + // Determine variable type prefix from absolute index + // 'T' = Track variable, 'G' = Global (player) variable + const char* pVarType = arg1 >= SeqPlayer::VARIABLE_NUM ? "T" : (arg1 >= SeqPlayer::LOCAL_VARIABLE_NUM ? "G" : ""); + + OSReport("#%08x[%d]: printvar %sVAR_%d(%d) = %d\n", seqPlayer, track->GetPlayerTrackNo(), pVarType, varNo, arg1, *pVar); + break; + } + + case MML_OPENTRACK: { + SeqTrack* pNewTrack = seqPlayer->GetPlayerTrack(arg1); + + if (pNewTrack != NULL && pNewTrack != track) { + pNewTrack->Close(); + pNewTrack->SetSeqData(rTrackParam.baseAddr, arg2); + } + break; + } + + case MML_JUMP: { + rTrackParam.currentAddr = rTrackParam.baseAddr + arg1; + break; + } + + case MML_CALL: { + if (rMmlParam.callStackDepth >= CALL_STACK_MAX_DEPTH) { + break; + } + + rMmlParam.callStack[rMmlParam.callStackDepth] = rTrackParam.currentAddr; + + rMmlParam.callStackDepth++; + rTrackParam.currentAddr = rTrackParam.baseAddr + arg1; + break; + } + + case MML_RET: { + if (rMmlParam.callStackDepth == 0) { + break; + } - if (count != 0 && --count == 0) { rMmlParam.callStackDepth--; - } - else { - rMmlParam.loopCount[rMmlParam.callStackDepth - 1] = count; - rTrackParam.currentAddr = - rMmlParam.callStack[rMmlParam.callStackDepth - 1]; + rTrackParam.currentAddr = rMmlParam.callStack[rMmlParam.callStackDepth]; + break; + } + + case MML_LOOP_START: { + if (rMmlParam.callStackDepth >= CALL_STACK_MAX_DEPTH) { + break; + } + + rMmlParam.callStack[rMmlParam.callStackDepth] = rTrackParam.currentAddr; + + rMmlParam.loopCount[rMmlParam.callStackDepth] = arg1; + rMmlParam.callStackDepth++; + break; + } + + case MML_LOOP_END: { + if (rMmlParam.callStackDepth == 0) { + break; + } + + u8 count = rMmlParam.loopCount[rMmlParam.callStackDepth - 1]; + + if (count != 0 && --count == 0) { + rMmlParam.callStackDepth--; + } else { + rMmlParam.loopCount[rMmlParam.callStackDepth - 1] = count; + + rTrackParam.currentAddr = rMmlParam.callStack[rMmlParam.callStackDepth - 1]; + } + break; } - break; } - } - } - else if (command <= MML_EX_CMD_MAX) { + } else if (command <= MML_EX_CMD_MAX) { u32 cmdex = command & 0xFF; vs16* pVar = NULL; - if ((cmdex & 0xF0) == MML_EX_ARITHMETIC || - (cmdex & 0xF0) == MML_EX_LOGIC) { - + if ((cmdex & 0xF0) == MML_EX_ARITHMETIC || (cmdex & 0xF0) == MML_EX_LOGIC) { pVar = GetVariablePtr(seqPlayer, track, arg1); if (pVar == NULL) { return; @@ -538,8 +528,7 @@ namespace nw4r { if (arg2 >= 0) { *pVar <<= arg2; - } - else { + } else { *pVar >>= -arg2; } break; @@ -629,9 +618,7 @@ namespace nw4r { } } - Channel* MmlParser::NoteOnCommandProc(MmlSeqTrack* track, int key, - int velocity, s32 length, - bool tie) const { + Channel* MmlParser::NoteOnCommandProc(MmlSeqTrack* track, int key, int velocity, s32 length, bool tie) const { return track->NoteOn(key, velocity, length, tie); } @@ -669,8 +656,7 @@ namespace nw4r { return val; } - s32 MmlParser::ReadArg(const u8** ppData, SeqPlayer* seqPlayer, SeqTrack* track, - SeqArgType type) const { + s32 MmlParser::ReadArg(const u8** ppData, SeqPlayer* seqPlayer, SeqTrack* track, SeqArgType type) const { s32 arg; switch (type) { @@ -723,6 +709,6 @@ namespace nw4r { return NULL; } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_MmlSeqTrack.cpp b/libs/NW4R/src/snd/snd_MmlSeqTrack.cpp index bf07e81b..8e184a30 100644 --- a/libs/NW4R/src/snd/snd_MmlSeqTrack.cpp +++ b/libs/NW4R/src/snd/snd_MmlSeqTrack.cpp @@ -13,6 +13,6 @@ namespace nw4r { ParseResult MmlSeqTrack::Parse(bool doNoteOn) { return mParser->Parse(this, doNoteOn); } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_MmlSeqTrackAllocator.cpp b/libs/NW4R/src/snd/snd_MmlSeqTrackAllocator.cpp index 14ac859a..ceb179a6 100644 --- a/libs/NW4R/src/snd/snd_MmlSeqTrackAllocator.cpp +++ b/libs/NW4R/src/snd/snd_MmlSeqTrackAllocator.cpp @@ -1,5 +1,6 @@ -#include #include +#include + namespace nw4r { namespace snd { @@ -27,6 +28,6 @@ namespace nw4r { void MmlSeqTrackAllocator::Destroy(void* buffer, u32 size) { mTrackPool.Destroy(buffer, size); } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_NandSoundArchive.cpp b/libs/NW4R/src/snd/snd_NandSoundArchive.cpp index 992a0c47..94ec018c 100644 --- a/libs/NW4R/src/snd/snd_NandSoundArchive.cpp +++ b/libs/NW4R/src/snd/snd_NandSoundArchive.cpp @@ -10,23 +10,24 @@ namespace nw4r { namespace snd { class NandSoundArchive::NandFileStream : public ut::NandFileStream { - public: - NandFileStream(const NANDFileInfo* pFileInfo, u32 offset, u32 size); - NandFileStream(const char* path, u32 offset, u32 size); + public: + NandFileStream(const NANDFileInfo* pFileInfo, u32 offset, u32 size); + NandFileStream(const char* path, u32 offset, u32 size); - virtual s32 Read(void* dst, u32 size); // 0x14 - virtual void Seek(s32 offset, u32 origin); // 0x44 + virtual s32 Read(void* dst, u32 size); // 0x14 + virtual void Seek(s32 offset, u32 origin); // 0x44 - virtual u32 Tell() const { return ut::NandFileStream::Tell() - mOffset; } // 0x58 + virtual u32 Tell() const { return ut::NandFileStream::Tell() - mOffset; } // 0x58 - virtual u32 GetSize() const { return mSize; } // 0x40 + virtual u32 GetSize() const { return mSize; } // 0x40 - private: - s32 mOffset; // 0x16C - s32 mSize; // 0x170 + private: + s32 mOffset; // 0x16C + s32 mSize; // 0x170 }; - NandSoundArchive::NandSoundArchive() : mOpen(false) {} + NandSoundArchive::NandSoundArchive() : mOpen(false) { + } NandSoundArchive::~NandSoundArchive() { Close(); @@ -85,7 +86,7 @@ namespace nw4r { return NULL; } - return new(buffer) NandFileStream(&mFileInfo, offset, length); + return new (buffer) NandFileStream(&mFileInfo, offset, length); } ut::FileStream* NandSoundArchive::OpenExtStream(void* buffer, int size, const char* extPath, u32 offset, u32 length) const { @@ -97,8 +98,7 @@ namespace nw4r { return NULL; } - NandFileStream* pExtStream = - new(buffer) NandFileStream(extPath, offset, length); + NandFileStream* pExtStream = new (buffer) NandFileStream(extPath, offset, length); if (!pExtStream->IsAvailable()) { pExtStream->~NandFileStream(); @@ -182,11 +182,8 @@ namespace nw4r { return true; } - NandSoundArchive::NandFileStream::NandFileStream(const NANDFileInfo* pFileInfo, u32 offset, u32 size) : - ut::NandFileStream(pFileInfo, NAND_ACCESS_READ, false), - mOffset(offset), - mSize(size) { - + NandSoundArchive::NandFileStream::NandFileStream(const NANDFileInfo* pFileInfo, u32 offset, u32 size) + : ut::NandFileStream(pFileInfo, NAND_ACCESS_READ, false), mOffset(offset), mSize(size) { if (IsAvailable()) { if (mSize == 0) { mSize = ut::NandFileStream::GetSize(); @@ -196,11 +193,8 @@ namespace nw4r { } } - NandSoundArchive::NandFileStream::NandFileStream(const char* path, u32 offset, u32 size) : - ut::NandFileStream(path, NAND_ACCESS_READ), - mOffset(offset), - mSize(size) { - + NandSoundArchive::NandFileStream::NandFileStream(const char* path, u32 offset, u32 size) + : ut::NandFileStream(path, NAND_ACCESS_READ), mOffset(offset), mSize(size) { if (IsAvailable()) { if (mSize == 0) { mSize = ut::NandFileStream::GetSize(); @@ -245,12 +239,11 @@ namespace nw4r { if (offset < mOffset) { offset = mOffset; - } - else if (offset > mOffset + mSize) { + } else if (offset > mOffset + mSize) { offset = mOffset + mSize; } ut::NandFileStream::Seek(offset, SEEK_BEG); } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_RemoteSpeaker.cpp b/libs/NW4R/src/snd/snd_RemoteSpeaker.cpp index b6c7f904..e0e77a48 100644 --- a/libs/NW4R/src/snd/snd_RemoteSpeaker.cpp +++ b/libs/NW4R/src/snd/snd_RemoteSpeaker.cpp @@ -8,15 +8,9 @@ namespace nw4r { namespace snd { - RemoteSpeaker::RemoteSpeaker() : - mInitFlag(false), - mRemoteInitFlag(false), - mPlayFlag(false), - mEnableFlag(false), - mSetupBusyFlag(false), - mSetupCallback(NULL), - mFirstEncodeFlag(false), - mForceResumeFlag(false) { + RemoteSpeaker::RemoteSpeaker() + : mInitFlag(false), mRemoteInitFlag(false), mPlayFlag(false), mEnableFlag(false), mSetupBusyFlag(false), mSetupCallback(NULL), + mFirstEncodeFlag(false), mForceResumeFlag(false) { OSCreateAlarm(&mContinueAlarm); OSSetAlarmUserData(&mContinueAlarm, this); @@ -68,33 +62,29 @@ namespace nw4r { if (mPlayFlag) { if (playFlag) { wencMode = 1; - } - else { + } else { wencMode = 1; lastFlag = true; } - } - else { + } else { if (playFlag) { if (mFirstEncodeFlag) { wencMode = 0; - } - else { + } else { wencMode = 1; } mFirstEncodeFlag = false; firstFlag = true; - } - else { + } else { wencMode = -1; } } if (wencMode != -1) { u8 adpcmBuffer[SAMPLES_PER_ENCODED_PACKET]; - WENCGetEncodeData(&mEncodeInfo, wencMode, pRmtSamples, - wencMode == 2 ? SAMPLES_PER_AUDIO_PACKET-8 : SAMPLES_PER_AUDIO_PACKET, adpcmBuffer); + WENCGetEncodeData(&mEncodeInfo, wencMode, pRmtSamples, wencMode == 2 ? SAMPLES_PER_AUDIO_PACKET - 8 : SAMPLES_PER_AUDIO_PACKET, + adpcmBuffer); s32 result = WPADSendStreamData(mChannelIndex, adpcmBuffer, SAMPLES_PER_ENCODED_PACKET); } @@ -158,5 +148,5 @@ namespace nw4r { speaker->mIntervalFlag = false; } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_RemoteSpeakerManager.cpp b/libs/NW4R/src/snd/snd_RemoteSpeakerManager.cpp index b94fd5e4..a4bafb53 100644 --- a/libs/NW4R/src/snd/snd_RemoteSpeakerManager.cpp +++ b/libs/NW4R/src/snd/snd_RemoteSpeakerManager.cpp @@ -1,7 +1,8 @@ #include -#include #include +#include + namespace nw4r { namespace snd { @@ -53,6 +54,6 @@ namespace nw4r { AXRmtAdvancePtr(RemoteSpeaker::SAMPLES_PER_AUDIO_PACKET); } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SeqFile.cpp b/libs/NW4R/src/snd/snd_SeqFile.cpp index 2f275ffd..def83172 100644 --- a/libs/NW4R/src/snd/snd_SeqFile.cpp +++ b/libs/NW4R/src/snd/snd_SeqFile.cpp @@ -24,9 +24,7 @@ namespace nw4r { return true; } - SeqFileReader::SeqFileReader(const void* seqData) : - mHeader(NULL), - mDataBlock(NULL) { + SeqFileReader::SeqFileReader(const void* seqData) : mHeader(NULL), mDataBlock(NULL) { if (!IsValidFileHeader(seqData)) { return; } @@ -36,8 +34,8 @@ namespace nw4r { } const void* SeqFileReader::GetBaseAddress() const { - return ut::AddOffsetToPtr(mDataBlock,Util::ReadBigEndian(mDataBlock->baseOffset)); + return ut::AddOffsetToPtr(mDataBlock, Util::ReadBigEndian(mDataBlock->baseOffset)); } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SeqPlayer.cpp b/libs/NW4R/src/snd/snd_SeqPlayer.cpp index 32e186d3..d4cea5eb 100644 --- a/libs/NW4R/src/snd/snd_SeqPlayer.cpp +++ b/libs/NW4R/src/snd/snd_SeqPlayer.cpp @@ -1,5 +1,6 @@ -#include #include +#include + #include @@ -17,8 +18,8 @@ namespace nw4r { } vs16 SeqPlayer::mGlobalVariable[GLOBAL_VARIABLE_NUM]; - SeqPlayer::SeqPlayer() : - mActiveFlag(false) {} + SeqPlayer::SeqPlayer() : mActiveFlag(false) { + } SeqPlayer::~SeqPlayer() { if (mActiveFlag) { @@ -81,7 +82,7 @@ namespace nw4r { { u32 trackFlags = allocTrackFlags; bool allocated = true; - + for (int i = 0; trackFlags != 0; trackFlags >>= 1, i++) { if (trackFlags & 1) { SeqTrack* track = allocator->AllocTrack(this); @@ -291,7 +292,7 @@ namespace nw4r { mSeqTrackAllocator->FreeTrack(mTracks[trackNo]); mTracks[trackNo] = NULL; } - + SeqTrack* SeqPlayer::GetPlayerTrack(int trackNo) { if (trackNo > TRACK_NUM - 1) { return NULL; @@ -340,8 +341,7 @@ namespace nw4r { if (track->ParseNextTick(doNoteOn) == 0) { active = true; - } - else { + } else { CloseTrack(i); } } @@ -430,8 +430,10 @@ namespace nw4r { return mParserParam.callback->NoteOn(this, bankNo, noteOnInfo); } - // Blank. Not sure if this was explicitly defined here but if the function is defined in the header, it would link to MidiSeqPlayer instead. - void SeqPlayer::ChannelCallback(Channel* channel) {} - } - } -} + // Blank. Not sure if this was explicitly defined here but if the function is defined in the header, it would link to MidiSeqPlayer + // instead. + void SeqPlayer::ChannelCallback(Channel* channel) { + } + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SeqSound.cpp b/libs/NW4R/src/snd/snd_SeqSound.cpp index 2a411818..30208b1c 100644 --- a/libs/NW4R/src/snd/snd_SeqSound.cpp +++ b/libs/NW4R/src/snd/snd_SeqSound.cpp @@ -8,11 +8,9 @@ namespace nw4r { namespace detail { NW4R_UT_GET_DERIVED_RUNTIME_TYPEINFO(SeqSound, BasicSound); - SeqSound::SeqSound(SoundInstanceManager* manager) : - mTempSpecialHandle(NULL), - mManager(manager), - mCallback(NULL), - mLoadingFlag(false) {} + SeqSound::SeqSound(SoundInstanceManager* manager) + : mTempSpecialHandle(NULL), mManager(manager), mCallback(NULL), mLoadingFlag(false) { + } void SeqSound::InitParam() { BasicSound::InitParam(); @@ -77,6 +75,6 @@ namespace nw4r { void SeqSound::DetachTempSpecialHandle() { mTempSpecialHandle->DetachSound(); } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SeqSoundHandle.cpp b/libs/NW4R/src/snd/snd_SeqSoundHandle.cpp index ed5f37b7..0dbcc1c9 100644 --- a/libs/NW4R/src/snd/snd_SeqSoundHandle.cpp +++ b/libs/NW4R/src/snd/snd_SeqSoundHandle.cpp @@ -13,5 +13,5 @@ namespace nw4r { mSound = NULL; } } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SeqTrack.cpp b/libs/NW4R/src/snd/snd_SeqTrack.cpp index aeb27d8d..02b0fcd8 100644 --- a/libs/NW4R/src/snd/snd_SeqTrack.cpp +++ b/libs/NW4R/src/snd/snd_SeqTrack.cpp @@ -1,6 +1,6 @@ -#include -#include #include +#include +#include #include @@ -93,11 +93,9 @@ namespace nw4r { } void SeqTrack::UpdateChannelLength() { - for (Channel* it = mChannelList; it != NULL; - it = it->GetNextTrackChannel()) { - + for (Channel* it = mChannelList; it != NULL; it = it->GetNextTrackChannel()) { if (it->GetLength() > 0) { - it->SetLength(it->GetLength()-1); + it->SetLength(it->GetLength() - 1); if (it->GetLength() == 0) { it->Release(); } @@ -123,9 +121,7 @@ namespace nw4r { } if (mParserTrackParam.currentAddr != NULL) { - while (mParserTrackParam.wait == 0 && - !mParserTrackParam.noteFinishWait) { - + while (mParserTrackParam.wait == 0 && !mParserTrackParam.noteFinishWait) { if (Parse(doNoteOn) == PARSE_RESULT_FINISH) { return -1; } @@ -137,9 +133,7 @@ namespace nw4r { void SeqTrack::StopAllChannel() { ut::AutoInterruptLock lock; - for (Channel* it = mChannelList; it != NULL; - it = it->GetNextTrackChannel()) { - + for (Channel* it = mChannelList; it != NULL; it = it->GetNextTrackChannel()) { Channel::FreeChannel(it); it->Stop(); } @@ -153,9 +147,7 @@ namespace nw4r { ut::AutoInterruptLock lock; AxManager::GetInstance().LockUpdateVoicePriority(); - for (Channel* it = mChannelList; it != NULL; - it = it->GetNextTrackChannel()) { - + for (Channel* it = mChannelList; it != NULL; it = it->GetNextTrackChannel()) { if (it->IsActive()) { if (release >= 0) { it->SetRelease(static_cast(release)); @@ -171,9 +163,7 @@ namespace nw4r { void SeqTrack::PauseAllChannel(bool flag) { ut::AutoInterruptLock lock; - for (Channel* it = mChannelList; it != NULL; - it = it->GetNextTrackChannel()) { - + for (Channel* it = mChannelList; it != NULL; it = it->GetNextTrackChannel()) { if (it->IsActive() && flag != it->IsPause()) { it->Pause(flag); } @@ -251,9 +241,7 @@ namespace nw4r { } ut::AutoInterruptLock lock; - for (Channel* it = mChannelList; it != NULL; - it = it->GetNextTrackChannel()) { - + for (Channel* it = mChannelList; it != NULL; it = it->GetNextTrackChannel()) { it->SetUserVolume(volume); it->SetUserPitch(pitch); it->SetUserPitchRatio(pitchRatio); @@ -283,16 +271,13 @@ namespace nw4r { void SeqTrack::FreeAllChannel() { ut::AutoInterruptLock lock; - for (Channel* it = mChannelList; it != NULL; - it = it->GetNextTrackChannel()) { - + for (Channel* it = mChannelList; it != NULL; it = it->GetNextTrackChannel()) { Channel::FreeChannel(it); } mChannelList = NULL; } - void SeqTrack::ChannelCallbackFunc(Channel* dropChannel, Channel::ChannelCallbackStatus status, u32 arg) { SeqTrack* p = reinterpret_cast(arg); @@ -314,9 +299,7 @@ namespace nw4r { return; } - for (Channel* it = p->mChannelList; it->GetNextTrackChannel() != NULL; - it = it->GetNextTrackChannel()) { - + for (Channel* it = p->mChannelList; it->GetNextTrackChannel() != NULL; it = it->GetNextTrackChannel()) { if (it->GetNextTrackChannel() == dropChannel) { it->SetNextTrackChannel(dropChannel->GetNextTrackChannel()); return; @@ -372,16 +355,16 @@ namespace nw4r { if (channel == NULL) { NoteOnInfo info = { - mParserTrackParam.prgNo, // prgNo - key, // key - velocity, // velocity - tie ? -1 : length, // length - mParserTrackParam.initPan, // initPan - seqPlayer->GetParserPlayerParam().priority + // priority + mParserTrackParam.prgNo, // prgNo + key, // key + velocity, // velocity + tie ? -1 : length, // length + mParserTrackParam.initPan, // initPan + seqPlayer->GetParserPlayerParam().priority + // priority GetParserTrackParam().priority, - mSeqPlayer->GetVoiceOutCount(), // voiceOuCount - ChannelCallbackFunc, // channelCallback - reinterpret_cast(this) // channelCallbackData + mSeqPlayer->GetVoiceOutCount(), // voiceOuCount + ChannelCallbackFunc, // channelCallback + reinterpret_cast(this) // channelCallbackData }; channel = mSeqPlayer->NoteOn(mParserTrackParam.bankNo, info); @@ -412,8 +395,7 @@ namespace nw4r { if (mParserTrackParam.portaTime == 0) { channel->SetSweepParam(sweepPitch, length, false); - } - else { + } else { int time = mParserTrackParam.portaTime; time *= time; time *= sweepPitch >= 0.0f ? sweepPitch : -sweepPitch; @@ -427,6 +409,6 @@ namespace nw4r { return channel; } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SoundArchive.cpp b/libs/NW4R/src/snd/snd_SoundArchive.cpp index f22c5d5f..7e4c80cd 100644 --- a/libs/NW4R/src/snd/snd_SoundArchive.cpp +++ b/libs/NW4R/src/snd/snd_SoundArchive.cpp @@ -10,7 +10,8 @@ namespace nw4r { mExtFileRoot[1] = '\0'; } - SoundArchive::~SoundArchive() {} + SoundArchive::~SoundArchive() { + } bool SoundArchive::IsAvailable() const { return mFileReader; @@ -163,15 +164,13 @@ namespace nw4r { return OpenStream(buffer, bufferSize, groupInfo.waveDataOffset, groupInfo.waveDataSize); } - ut::FileStream* SoundArchive::OpenExtStreamImpl(void* buffer, int bufferSize, const char* extPath, u32 offset, u32 size) const { char pathBuffer[FILE_PATH_MAX]; const char* pFullPath; if (extPath[0] == '/') { pFullPath = extPath; - } - else { + } else { u32 fileLen = strlen(extPath); u32 dirLen = strlen(mExtFileRoot); @@ -202,5 +201,5 @@ namespace nw4r { // @bug Long path can overflow mExtFileRoot buffer strncpy(mExtFileRoot, pExtFileRoot, len); } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SoundArchiveFile.cpp b/libs/NW4R/src/snd/snd_SoundArchiveFile.cpp index 4122d745..f2ef326d 100644 --- a/libs/NW4R/src/snd/snd_SoundArchiveFile.cpp +++ b/libs/NW4R/src/snd/snd_SoundArchiveFile.cpp @@ -8,14 +8,10 @@ namespace nw4r { namespace snd { namespace detail { - SoundArchiveFileReader::SoundArchiveFileReader() : - mInfo(NULL), - mStringBase(NULL), - mStringTable(NULL), - mStringTreeSound(NULL), - mStringTreePlayer(NULL), - mStringTreeGroup(NULL), - mStringTreeBank(NULL) {} + SoundArchiveFileReader::SoundArchiveFileReader() + : mInfo(NULL), mStringBase(NULL), mStringTable(NULL), mStringTreeSound(NULL), mStringTreePlayer(NULL), mStringTreeGroup(NULL), + mStringTreeBank(NULL) { + } void SoundArchiveFileReader::Init(const void* soundArchiveData) { if (!IsValidFileHeader(soundArchiveData)) { @@ -50,10 +46,14 @@ namespace nw4r { mStringBase = pStringBlock; mStringTable = static_cast(GetPtrConst(mStringBase, pStringBlock->stringChunk.tableOffset)); - mStringTreeSound = static_cast(GetPtrConst(mStringBase, pStringBlock->stringChunk.soundTreeOffset)); - mStringTreePlayer = static_cast(GetPtrConst(mStringBase, pStringBlock->stringChunk.playerTreeOffset)); - mStringTreeGroup = static_cast(GetPtrConst(mStringBase, pStringBlock->stringChunk.groupTreeOffset)); - mStringTreeBank = static_cast(GetPtrConst(mStringBase, pStringBlock->stringChunk.bankTreeOffset)); + mStringTreeSound = + static_cast(GetPtrConst(mStringBase, pStringBlock->stringChunk.soundTreeOffset)); + mStringTreePlayer = + static_cast(GetPtrConst(mStringBase, pStringBlock->stringChunk.playerTreeOffset)); + mStringTreeGroup = + static_cast(GetPtrConst(mStringBase, pStringBlock->stringChunk.groupTreeOffset)); + mStringTreeBank = + static_cast(GetPtrConst(mStringBase, pStringBlock->stringChunk.bankTreeOffset)); } void SoundArchiveFileReader::SetInfoChunk(const void* pChunk, u32 size) { @@ -82,8 +82,7 @@ namespace nw4r { } soundType = static_cast(pCmnInfo->soundType); - } - else { + } else { soundType = static_cast(pTable->items[id].dataType); } @@ -104,7 +103,6 @@ namespace nw4r { } bool SoundArchiveFileReader::ReadSoundInfo(u32 id, SoundArchive::SoundInfo* soundInfo) const { - const SoundArchiveFile::SoundCommonInfo* pCmnInfo = impl_GetSoundInfo(id); if (pCmnInfo == NULL) { @@ -120,7 +118,6 @@ namespace nw4r { } bool SoundArchiveFileReader::ReadSeqSoundInfo(u32 id, SoundArchive::SeqSoundInfo* info) const { - const SoundArchiveFile::SeqSoundInfo* pSrc = impl_GetSeqSoundInfo(id); if (pSrc == NULL) { @@ -147,7 +144,6 @@ namespace nw4r { } bool SoundArchiveFileReader::ReadWaveSoundInfo(u32 id, SoundArchive::WaveSoundInfo* info) const { - const SoundArchiveFile::WaveSoundInfo* pSrc = impl_GetWaveSoundInfo(id); if (pSrc == NULL) { @@ -209,7 +205,6 @@ namespace nw4r { } bool SoundArchiveFileReader::ReadGroupItemInfo(u32 groupId, u32 itemId, SoundArchive::GroupItemInfo* info) const { - const SoundArchiveFile::GroupInfo* pGroup = impl_GetGroupInfo(groupId); if (pGroup == NULL) { @@ -242,7 +237,6 @@ namespace nw4r { } bool SoundArchiveFileReader::ReadSoundArchivePlayerInfo(SoundArchive::SoundArchivePlayerInfo* info) const { - const SoundArchiveFile::SoundArchivePlayerInfo* pSrc = Util::GetDataRefAddress0(mInfo->soundArchivePlayerInfoRef, mInfo); // @bug Doesn't check dataref result @@ -387,7 +381,6 @@ namespace nw4r { } u32 SoundArchiveFileReader::ConvertLabelStringToId(const SoundArchiveFile::StringTree* pTree, const char* label) const { - if (pTree == NULL) { return SoundArchive::INVALID_ID; } @@ -407,8 +400,7 @@ namespace nw4r { u32 nodeIndex; if (pos < length && (1 << (7 - bit)) & label[pos]) { nodeIndex = pNode->rightIdx; - } - else { + } else { nodeIndex = pNode->leftIdx; } @@ -437,8 +429,7 @@ namespace nw4r { if (GetVersion() >= NW4R_VERSION(1, 1)) { return Util::GetDataRefAddress0(pTable->items[id], mInfo); - } - else { + } else { return static_cast(ut::AddOffsetToPtr(mInfo, pTable->items[id].value)); } } @@ -532,6 +523,6 @@ namespace nw4r { return Util::GetDataRefAddress0(pTable->items[id], mInfo); } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SoundArchiveLoader.cpp b/libs/NW4R/src/snd/snd_SoundArchiveLoader.cpp index 3e1d0fb3..a6926e90 100644 --- a/libs/NW4R/src/snd/snd_SoundArchiveLoader.cpp +++ b/libs/NW4R/src/snd/snd_SoundArchiveLoader.cpp @@ -1,6 +1,6 @@ -#include #include #include +#include #include @@ -9,13 +9,12 @@ namespace nw4r { namespace snd { namespace detail { - SoundArchiveLoader::SoundArchiveLoader(const SoundArchive& soundArchive) : - mArc(soundArchive), - mStream(NULL) { + SoundArchiveLoader::SoundArchiveLoader(const SoundArchive& soundArchive) : mArc(soundArchive), mStream(NULL) { OSInitMutex(&mMutex); } - SoundArchiveLoader::~SoundArchiveLoader() {} + SoundArchiveLoader::~SoundArchiveLoader() { + } void* SoundArchiveLoader::LoadGroup(u32 id, SoundMemoryAllocatable* allocatable, void** ppWaveBuffer, u32 blockSize) { ut::AutoMutexLock lock(mMutex); @@ -44,8 +43,7 @@ namespace nw4r { mStream = NULL; return NULL; } - } - else { + } else { u8* pReadPtr = static_cast(pGroupBuffer); u32 bytesLeft = groupHandle->GetSize(); @@ -60,8 +58,7 @@ namespace nw4r { if (bytesLeft > blockSize) { bytesLeft -= blockSize; pReadPtr += blockSize; - } - else { + } else { bytesLeft = 0; } } @@ -93,21 +90,18 @@ namespace nw4r { mStream = waveHandle.GetFileStream(); if (blockSize == 0) { - s32 bytesRead = - waveHandle->Read(waveBuffer, waveHandle->GetSize()); + s32 bytesRead = waveHandle->Read(waveBuffer, waveHandle->GetSize()); if (bytesRead == 0) { mStream = NULL; return NULL; } - } - else { + } else { u8* pReadPtr = static_cast(waveBuffer); u32 bytesLeft = waveHandle->GetSize(); while (bytesLeft) { - s32 bytesRead = - waveHandle->Read(pReadPtr, ut::Min(blockSize, bytesLeft)); + s32 bytesRead = waveHandle->Read(pReadPtr, ut::Min(blockSize, bytesLeft)); if (bytesRead == 0) { mStream = NULL; @@ -117,8 +111,7 @@ namespace nw4r { if (bytesLeft > blockSize) { bytesLeft -= blockSize; pReadPtr += blockSize; - } - else { + } else { bytesLeft = 0; } } @@ -129,8 +122,7 @@ namespace nw4r { if (ppWaveBuffer != NULL) { *ppWaveBuffer = waveBuffer; } - } - else if (ppWaveBuffer != NULL) { + } else if (ppWaveBuffer != NULL) { *ppWaveBuffer = NULL; } @@ -162,7 +154,7 @@ namespace nw4r { return size; } - void *SoundArchiveLoader::LoadFile(u32 id, SoundMemoryAllocatable* allocatable) { + void* SoundArchiveLoader::LoadFile(u32 id, SoundMemoryAllocatable* allocatable) { SoundArchive::FileInfo info; if (!mArc.detail_ReadFileInfo(id, &info)) { return NULL; @@ -173,7 +165,7 @@ namespace nw4r { return NULL; } - void *buf = allocatable->Alloc(size); + void* buf = allocatable->Alloc(size); if (buf == NULL) { return NULL; } @@ -189,12 +181,11 @@ namespace nw4r { if (mStream && (mStream->CanCancel())) { if (mStream->CanAsync()) { mStream->CancelAsync(NULL, NULL); - } - else { + } else { mStream->Cancel(); } } } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SoundArchivePlayer.cpp b/libs/NW4R/src/snd/snd_SoundArchivePlayer.cpp index 72781bd8..2822a931 100644 --- a/libs/NW4R/src/snd/snd_SoundArchivePlayer.cpp +++ b/libs/NW4R/src/snd/snd_SoundArchivePlayer.cpp @@ -1,11 +1,11 @@ #include -#include -#include -#include #include #include #include +#include +#include +#include #include #include @@ -13,27 +13,17 @@ #include -#include #include +#include #include namespace nw4r { namespace snd { - SoundArchivePlayer::SoundArchivePlayer() : - mSoundArchive(NULL), - mSeqLoadCallback(*this), - mSeqCallback(*this), - mStrmCallback(*this), - mWsdCallback(*this), - mGroupTable (NULL), - mFileManager(NULL), - mSoundPlayerCount(0), - mSoundPlayers(NULL), - mSetupBufferAddress(NULL), - mSetupBufferSize(0), - mMmlSeqTrackAllocator(&mMmlParser), - mSeqTrackAllocator(&mMmlSeqTrackAllocator) { + SoundArchivePlayer::SoundArchivePlayer() + : mSoundArchive(NULL), mSeqLoadCallback(*this), mSeqCallback(*this), mStrmCallback(*this), mWsdCallback(*this), mGroupTable(NULL), + mFileManager(NULL), mSoundPlayerCount(0), mSoundPlayers(NULL), mSetupBufferAddress(NULL), mSetupBufferSize(0), + mMmlSeqTrackAllocator(&mMmlParser), mSeqTrackAllocator(&mMmlSeqTrackAllocator) { detail::DisposeCallbackManager::GetInstance().RegisterDisposeCallback(this); } @@ -109,10 +99,10 @@ namespace nw4r { SoundArchive::SoundArchivePlayerInfo info; if (soundArchive->ReadSoundArchivePlayerInfo(&info)) { - size += ut::RoundUp(info.seqSoundCount * sizeof(detail::SeqSound), 4); - size += ut::RoundUp(info.strmSoundCount * sizeof(detail::StrmSound), 4); - size += ut::RoundUp(info.waveSoundCount * sizeof(detail::WaveSound), 4); - size += ut::RoundUp(info.seqTrackCount * sizeof(detail::MmlSeqTrack), 4); + size += ut::RoundUp(info.seqSoundCount * sizeof(detail::SeqSound), 4); + size += ut::RoundUp(info.strmSoundCount * sizeof(detail::StrmSound), 4); + size += ut::RoundUp(info.waveSoundCount * sizeof(detail::WaveSound), 4); + size += ut::RoundUp(info.seqTrackCount * sizeof(detail::MmlSeqTrack), 4); } return size; @@ -169,7 +159,7 @@ namespace nw4r { } detail::PlayerHeap* SoundArchivePlayer::CreatePlayerHeap(void* buffer, u32 bufferSize) { - detail::PlayerHeap* pHeap = new(buffer) detail::PlayerHeap(); + detail::PlayerHeap* pHeap = new (buffer) detail::PlayerHeap(); buffer = ut::AddOffsetToPtr(buffer, sizeof(detail::PlayerHeap)); @@ -199,7 +189,7 @@ namespace nw4r { u8* pPtr = static_cast(pPlayerBuffer); for (u32 i = 0; i < playerCount; i++, pPtr += sizeof(SoundPlayer)) { - SoundPlayer* player = new(pPtr) SoundPlayer(); + SoundPlayer* player = new (pPtr) SoundPlayer(); SoundArchive::PlayerInfo info; if (!soundArchive->ReadPlayerInfo(i, &info)) { @@ -239,7 +229,7 @@ namespace nw4r { } bool SoundArchivePlayer::CreateGroupAddressTable(const SoundArchive* soundArchive, void** buffer, void* end) { - u32 requireSize = soundArchive->GetGroupCount() * sizeof(Group) + (sizeof(GroupTable) - sizeof(Group)); + u32 requireSize = soundArchive->GetGroupCount() * sizeof(Group) + (sizeof(GroupTable) - sizeof(Group)); void* pTableEnd = ut::RoundUp(ut::AddOffsetToPtr(*buffer, requireSize), 4); @@ -275,7 +265,7 @@ namespace nw4r { return true; } - bool SoundArchivePlayer::SetupWaveSound(const SoundArchive* soundArchive, int sounds, void** buffer,void* end) { + bool SoundArchivePlayer::SetupWaveSound(const SoundArchive* soundArchive, int sounds, void** buffer, void* end) { u32 requireSize = sounds * sizeof(detail::WaveSound); void* soundEnd = ut::RoundUp(ut::AddOffsetToPtr(*buffer, requireSize), 4); @@ -474,10 +464,11 @@ namespace nw4r { } SoundStartable::StartResult SoundArchivePlayer::detail_SetupSound(SoundHandle* handle, u32 soundId, - detail::BasicSound::AmbientArgInfo* ambientArgInfo, detail::ExternalSoundPlayer* extPlayer, - bool holdFlag, const StartInfo* startInfo) { + detail::BasicSound::AmbientArgInfo* ambientArgInfo, + detail::ExternalSoundPlayer* extPlayer, bool holdFlag, + const StartInfo* startInfo) { u8 streamBuffer[STREAM_BUFFER_SIZE]; - + if (!IsAvailable()) { return SoundStartable::START_ERR_NOT_AVAILABLE; } @@ -525,9 +516,8 @@ namespace nw4r { return SoundStartable::START_ERR_INVALID_SOUNDID; } - detail::SeqSound* seqSound = rPlayer.detail_AllocSeqSound(playerPriority, playerPriorityStart, - ambientArgInfo, extPlayer, soundId, - &mSeqSoundInstanceManager); + detail::SeqSound* seqSound = rPlayer.detail_AllocSeqSound(playerPriority, playerPriorityStart, ambientArgInfo, extPlayer, soundId, + &mSeqSoundInstanceManager); if (seqSound == NULL) { return SoundStartable::START_ERR_LOW_PRIORITY; @@ -557,9 +547,8 @@ namespace nw4r { } stream->Close(); - detail::StrmSound* pStrmSound = rPlayer.detail_AllocStrmSound(playerPriority, playerPriorityStart, - ambientArgInfo, extPlayer, soundId, - &mStrmSoundInstanceManager); + detail::StrmSound* pStrmSound = rPlayer.detail_AllocStrmSound(playerPriority, playerPriorityStart, ambientArgInfo, extPlayer, + soundId, &mStrmSoundInstanceManager); if (pStrmSound == NULL) { return SoundStartable::START_ERR_LOW_PRIORITY; @@ -583,9 +572,8 @@ namespace nw4r { return SoundStartable::START_ERR_INVALID_SOUNDID; } - detail::WaveSound* waveSound = rPlayer.detail_AllocWaveSound(playerPriority, playerPriorityStart, - ambientArgInfo, extPlayer, soundId, - &mWaveSoundInstanceManager); + detail::WaveSound* waveSound = rPlayer.detail_AllocWaveSound(playerPriority, playerPriorityStart, ambientArgInfo, extPlayer, + soundId, &mWaveSoundInstanceManager); if (waveSound == NULL) { return SoundStartable::START_ERR_LOW_PRIORITY; @@ -612,7 +600,8 @@ namespace nw4r { return SoundStartable::START_SUCCESS; } - SoundStartable::StartResult SoundArchivePlayer::PrepareSeqImpl(detail::SeqSound* sound, const SoundArchive::SoundInfo* soundInfo, const SoundArchive::SeqSoundInfo* info, int voices) { + SoundStartable::StartResult SoundArchivePlayer::PrepareSeqImpl(detail::SeqSound* sound, const SoundArchive::SoundInfo* soundInfo, + const SoundArchive::SeqSoundInfo* info, int voices) { u8 streamBuffer[STREAM_BUFFER_SIZE]; const void* seqData = detail_GetFileAddress(soundInfo->fileId); @@ -635,8 +624,7 @@ namespace nw4r { if (result != detail::SeqPlayer::SETUP_SUCCESS) { if (result == detail::SeqPlayer::SETUP_ERR_CANNOT_ALLOCATE_TRACK) { return SoundStartable::START_ERR_CANNOT_ALLOCATE_TRACK; - } - else { + } else { return SoundStartable::START_ERR_UNKNOWN; } } @@ -647,17 +635,19 @@ namespace nw4r { if (seqData != NULL) { detail::SeqFileReader reader(seqData); sound->Prepare(reader.GetBaseAddress(), info->dataOffset); - } - else { + } else { sound->Prepare(&mSeqLoadCallback, reinterpret_cast(sound)); } return SoundStartable::START_SUCCESS; } - SoundStartable::StartResult SoundArchivePlayer::PrepareStrmImpl(detail::StrmSound* sound, const SoundArchive::SoundInfo* soundInfo, const SoundArchive::StrmSoundInfo* info, SoundStartable::StartInfo::StartOffsetType startOffsetType, int startOffset, int voices) { + SoundStartable::StartResult SoundArchivePlayer::PrepareStrmImpl(detail::StrmSound* sound, const SoundArchive::SoundInfo* soundInfo, + const SoundArchive::StrmSoundInfo* info, + SoundStartable::StartInfo::StartOffsetType startOffsetType, int startOffset, + int voices) { detail::StrmPlayer::StartOffsetType strmOffsetType = detail::StrmPlayer::START_OFFSET_TYPE_SAMPLE; - + if (startOffsetType == SoundStartable::StartInfo::START_OFFSET_TYPE_MILLISEC) { strmOffsetType = detail::StrmPlayer::START_OFFSET_TYPE_MILLISEC; } @@ -671,7 +661,8 @@ namespace nw4r { return SoundStartable::START_SUCCESS; } - SoundStartable::StartResult SoundArchivePlayer::PrepareWaveSoundImpl(detail::WaveSound* sound, const SoundArchive::SoundInfo* soundInfo, const SoundArchive::WaveSoundInfo* info, int voices) { + SoundStartable::StartResult SoundArchivePlayer::PrepareWaveSoundImpl(detail::WaveSound* sound, const SoundArchive::SoundInfo* soundInfo, + const SoundArchive::WaveSoundInfo* info, int voices) { const void* waveData = detail_GetFileAddress(soundInfo->fileId); if (waveData == NULL) { return SoundStartable::START_ERR_NOT_DATA_LOADED; @@ -756,12 +747,12 @@ namespace nw4r { } } - SoundArchivePlayer::SeqLoadCallback::SeqLoadCallback(const SoundArchivePlayer& player) : - mSoundArchivePlayer(player) { + SoundArchivePlayer::SeqLoadCallback::SeqLoadCallback(const SoundArchivePlayer& player) : mSoundArchivePlayer(player) { OSInitMutex(&mMutex); } - detail::SeqSound::SeqLoadCallback::Result SoundArchivePlayer::SeqLoadCallback::LoadData(detail::SeqSound::NotifyAsyncEndCallback callback, void* callbackArg, u32 userData) const { + detail::SeqSound::SeqLoadCallback::Result SoundArchivePlayer::SeqLoadCallback::LoadData(detail::SeqSound::NotifyAsyncEndCallback callback, + void* callbackArg, u32 userData) const { if (!mSoundArchivePlayer.IsAvailable()) { return RESULT_FAILED; } @@ -785,9 +776,8 @@ namespace nw4r { } void* allocBuf = detail::TaskManager::GetInstance().Alloc(); - SeqLoadTask* task = new(allocBuf) SeqLoadTask(callback, callbackArg, - soundArchive, soundInfo.fileId, info.dataOffset, *playerHeap, - userData, mMutex); + SeqLoadTask* task = + new (allocBuf) SeqLoadTask(callback, callbackArg, soundArchive, soundInfo.fileId, info.dataOffset, *playerHeap, userData, mMutex); detail::TaskManager::GetInstance().AppendTask(task, detail::TaskManager::PRIORITY_MIDDLE); detail::TaskThread::GetInstance().SendWakeupMessage(); @@ -799,7 +789,8 @@ namespace nw4r { detail::TaskManager::GetInstance().CancelByTaskId(userData); } - detail::Channel* SoundArchivePlayer::SeqNoteOnCallback::NoteOn(detail::SeqPlayer* seqPlayer, int bankNo, const detail::NoteOnInfo& noteOnInfo) { + detail::Channel* SoundArchivePlayer::SeqNoteOnCallback::NoteOn(detail::SeqPlayer* seqPlayer, int bankNo, + const detail::NoteOnInfo& noteOnInfo) { if (!mSoundArchivePlayer.IsAvailable()) { return NULL; } @@ -836,17 +827,15 @@ namespace nw4r { } bool SoundArchivePlayer::WsdCallback::GetWaveSoundData(detail::WaveSoundInfo* waveSoundInfo, detail::WaveSoundNoteInfo* noteInfo, - detail::WaveData* waveData, const void* pWsdData, int index, int noteIndex, - u32 userData) const { - + detail::WaveData* waveData, const void* pWsdData, int index, int noteIndex, + u32 userData) const { u32 fileId = userData; if (!mSoundArchivePlayer.IsAvailable()) { return false; } - const void* waveAddr = - mSoundArchivePlayer.detail_GetFileWaveDataAddress(fileId); + const void* waveAddr = mSoundArchivePlayer.detail_GetFileWaveDataAddress(fileId); if (waveAddr == NULL) { return false; @@ -869,23 +858,22 @@ namespace nw4r { return true; } - SoundArchivePlayer::StrmCallback::StrmCallback(const SoundArchivePlayer& player) : - mSoundArchivePlayer(player) { + SoundArchivePlayer::StrmCallback::StrmCallback(const SoundArchivePlayer& player) : mSoundArchivePlayer(player) { OSInitMutex(&mMutex); } - detail::StrmPlayer::StrmCallback::Result SoundArchivePlayer::StrmCallback::LoadHeader(detail::StrmPlayer::NotifyLoadHeaderAsyncEndCallback callback, void* callbackData, u32 userId, u32 userData) const { + detail::StrmPlayer::StrmCallback::Result + SoundArchivePlayer::StrmCallback::LoadHeader(detail::StrmPlayer::NotifyLoadHeaderAsyncEndCallback callback, void* callbackData, u32 userId, + u32 userData) const { if (!mSoundArchivePlayer.IsAvailable()) { return RESULT_FAILED; } - void *addr = detail::TaskManager::GetInstance().Alloc(); + void* addr = detail::TaskManager::GetInstance().Alloc(); const SoundArchive& sndArc = mSoundArchivePlayer.GetSoundArchive(); - StrmHeaderLoadTask* task = new(addr) StrmHeaderLoadTask(callback, callbackData, - sndArc, userData, - userId, mMutex); + StrmHeaderLoadTask* task = new (addr) StrmHeaderLoadTask(callback, callbackData, sndArc, userData, userId, mMutex); detail::TaskManager::GetInstance().AppendTask(task, detail::TaskManager::PRIORITY_MIDDLE); detail::TaskThread::GetInstance().SendWakeupMessage(); @@ -894,20 +882,20 @@ namespace nw4r { } detail::StrmPlayer::StrmCallback::Result SoundArchivePlayer::StrmCallback::LoadStream(void* mramAddr, u32 size, s32 offset, int numChannels, - u32 blockSize, s32 blockHeaderOffset, bool needUpdateAdpcmLoop, - detail::StrmPlayer::LoadCommand& callback, u32 userId, u32 userData) const { + u32 blockSize, s32 blockHeaderOffset, + bool needUpdateAdpcmLoop, + detail::StrmPlayer::LoadCommand& callback, u32 userId, + u32 userData) const { if (!mSoundArchivePlayer.IsAvailable()) { return RESULT_FAILED; } const SoundArchive& sndArc = mSoundArchivePlayer.GetSoundArchive(); - void *addr = detail::TaskManager::GetInstance().Alloc(); + void* addr = detail::TaskManager::GetInstance().Alloc(); - StrmDataLoadTask* task = new(addr) StrmDataLoadTask(mramAddr, size, offset, numChannels, - blockSize, blockHeaderOffset, needUpdateAdpcmLoop, - callback, sndArc, userData, - userId, mMutex); + StrmDataLoadTask* task = new (addr) StrmDataLoadTask(mramAddr, size, offset, numChannels, blockSize, blockHeaderOffset, + needUpdateAdpcmLoop, callback, sndArc, userData, userId, mMutex); detail::TaskManager::GetInstance().AppendTask(task, detail::TaskManager::PRIORITY_HIGH); detail::TaskThread::GetInstance().SendWakeupMessage(); @@ -919,17 +907,11 @@ namespace nw4r { detail::TaskManager::GetInstance().CancelByTaskId(userId); } - SoundArchivePlayer::SeqLoadTask::SeqLoadTask(detail::SeqSound::NotifyAsyncEndCallback callback, void* callbackArg, - const SoundArchive& arc, u32 fileId, u32 dataOffset, SoundHeap& heap, - u32 taskId, OSMutex& mutex) : - mCallback(callback), - mCallbackData(callbackArg), - mSoundArchive(arc), - mFileId(fileId), - mDataOffset(dataOffset), - mHeap(heap), - Task(taskId), - mMutex(mutex) {} + SoundArchivePlayer::SeqLoadTask::SeqLoadTask(detail::SeqSound::NotifyAsyncEndCallback callback, void* callbackArg, const SoundArchive& arc, + u32 fileId, u32 dataOffset, SoundHeap& heap, u32 taskId, OSMutex& mutex) + : mCallback(callback), mCallbackData(callbackArg), mSoundArchive(arc), mFileId(fileId), mDataOffset(dataOffset), mHeap(heap), + Task(taskId), mMutex(mutex) { + } void SoundArchivePlayer::SeqLoadTask::Execute() { detail::SoundArchiveLoader loader(mSoundArchive); @@ -969,15 +951,9 @@ namespace nw4r { } SoundArchivePlayer::StrmHeaderLoadTask::StrmHeaderLoadTask(detail::StrmPlayer::NotifyLoadHeaderAsyncEndCallback callback, void* callbackData, - const SoundArchive& arc, u32 fileId, - u32 taskId, OSMutex& mutex) : - Task(taskId), - mSoundArchive(arc), - mFileId(fileId), - mCallback(callback), - mCallbackData(callbackData), - mStream(NULL), - mMutex(mutex) {} + const SoundArchive& arc, u32 fileId, u32 taskId, OSMutex& mutex) + : Task(taskId), mSoundArchive(arc), mFileId(fileId), mCallback(callback), mCallbackData(callbackData), mStream(NULL), mMutex(mutex) { + } void SoundArchivePlayer::StrmHeaderLoadTask::Execute() { static u8 buffer[STREAM_BUFFER_SIZE] ALIGN32; @@ -1048,36 +1024,26 @@ namespace nw4r { void SoundArchivePlayer::StrmHeaderLoadTask::Cancel() { ut::AutoMutexLock lock(mMutex); - + mCallback = NULL; if (mStream != NULL && mStream->CanCancel()) { if (mStream->CanAsync()) { mStream->CancelAsync(NULL, NULL); - } - else { + } else { mStream->Cancel(); } } } - SoundArchivePlayer::StrmDataLoadTask::StrmDataLoadTask(void* addr, u32 size, s32 offset, int numChannels, - u32 blockSize, s32 blockHeaderOffset, bool needUpdateAdpcmLoop, - detail::StrmPlayer::LoadCommand& callback, const SoundArchive& arc, u32 fileId, - u32 taskId, OSMutex& mutex) : - Task(taskId), - mAddr(addr), - mSize(size), - mOffset(offset), - mSoundArchive(arc), - mFileId(fileId), - mStream(NULL), - mNumChannels(numChannels), - mCallback(&callback), - mBlockSize(blockSize), - mBlockHeaderOffset(blockHeaderOffset), - mNeedUpdateAdpcmLoop(needUpdateAdpcmLoop), - mMutex(mutex) {} + SoundArchivePlayer::StrmDataLoadTask::StrmDataLoadTask(void* addr, u32 size, s32 offset, int numChannels, u32 blockSize, + s32 blockHeaderOffset, bool needUpdateAdpcmLoop, + detail::StrmPlayer::LoadCommand& callback, const SoundArchive& arc, u32 fileId, + u32 taskId, OSMutex& mutex) + : Task(taskId), mAddr(addr), mSize(size), mOffset(offset), mSoundArchive(arc), mFileId(fileId), mStream(NULL), mNumChannels(numChannels), + mCallback(&callback), mBlockSize(blockSize), mBlockHeaderOffset(blockHeaderOffset), mNeedUpdateAdpcmLoop(needUpdateAdpcmLoop), + mMutex(mutex) { + } void SoundArchivePlayer::StrmDataLoadTask::Execute() { DCInvalidateRange(mAddr, mSize); @@ -1125,7 +1091,7 @@ namespace nw4r { if (bytesRead != mSize) { detail::TaskManager::GetInstance().CancelByTaskId(GetTaskId()); - + if (mCallback != NULL) { mCallback->NotifyAsyncEnd(false); } @@ -1164,17 +1130,16 @@ namespace nw4r { void SoundArchivePlayer::StrmDataLoadTask::Cancel() { ut::AutoMutexLock lock(mMutex); - + mCallback = NULL; if (mStream && mStream->CanCancel()) { if (mStream->CanAsync()) { mStream->CancelAsync(NULL, NULL); - } - else { + } else { mStream->Cancel(); } } } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SoundHandle.cpp b/libs/NW4R/src/snd/snd_SoundHandle.cpp index f046d1a4..94260a1d 100644 --- a/libs/NW4R/src/snd/snd_SoundHandle.cpp +++ b/libs/NW4R/src/snd/snd_SoundHandle.cpp @@ -28,5 +28,5 @@ namespace nw4r { mSound = NULL; } } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SoundHeap.cpp b/libs/NW4R/src/snd/snd_SoundHeap.cpp index 5a06215a..6da710f0 100644 --- a/libs/NW4R/src/snd/snd_SoundHeap.cpp +++ b/libs/NW4R/src/snd/snd_SoundHeap.cpp @@ -1,5 +1,5 @@ -#include #include +#include namespace nw4r { namespace snd { @@ -33,5 +33,5 @@ namespace nw4r { detail::DisposeCallbackManager::Dispose(buffer, size, callbackArg); detail::DisposeCallbackManager::DisposeWave(buffer, size, callbackArg); } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SoundPlayer.cpp b/libs/NW4R/src/snd/snd_SoundPlayer.cpp index 1648b095..ce37732c 100644 --- a/libs/NW4R/src/snd/snd_SoundPlayer.cpp +++ b/libs/NW4R/src/snd/snd_SoundPlayer.cpp @@ -1,17 +1,14 @@ #include -#include #include +#include #include -#include #include +#include namespace nw4r { namespace snd { - SoundPlayer::SoundPlayer() : - mPlayableCount(1), - mPlayableLimit(1), - mUsePlayerHeap(false) { + SoundPlayer::SoundPlayer() : mPlayableCount(1), mPlayableLimit(1), mUsePlayerHeap(false) { InitParam(); } @@ -72,12 +69,10 @@ namespace nw4r { } void SoundPlayer::detail_InsertPriorityList(detail::BasicSound* sound) { - detail::BasicSoundPlayerPrioList::Iterator it = - mPriorityList.GetBeginIter(); + detail::BasicSoundPlayerPrioList::Iterator it = mPriorityList.GetBeginIter(); for (; it != mPriorityList.GetEndIter(); it++) { - if (sound->CalcCurrentPlayerPriority() < - it->CalcCurrentPlayerPriority()) { + if (sound->CalcCurrentPlayerPriority() < it->CalcCurrentPlayerPriority()) { break; } } @@ -107,8 +102,7 @@ namespace nw4r { } } - detail::SeqSound* SoundPlayer::detail_AllocSeqSound(int priority, int startPriority, - detail::BasicSound::AmbientArgInfo* ambientArgInfo, + detail::SeqSound* SoundPlayer::detail_AllocSeqSound(int priority, int startPriority, detail::BasicSound::AmbientArgInfo* ambientArgInfo, detail::ExternalSoundPlayer* extPlayer, u32 id, detail::SoundInstanceManager* manager) { if (manager == NULL) { @@ -148,10 +142,9 @@ namespace nw4r { return sound; } - detail::StrmSound* SoundPlayer::detail_AllocStrmSound(int priority, int startPriority, - detail::BasicSound::AmbientArgInfo* ambientArgInfo, - detail::ExternalSoundPlayer* extPlayer, u32 id, - detail::SoundInstanceManager* manager) { + detail::StrmSound* SoundPlayer::detail_AllocStrmSound(int priority, int startPriority, detail::BasicSound::AmbientArgInfo* ambientArgInfo, + detail::ExternalSoundPlayer* extPlayer, u32 id, + detail::SoundInstanceManager* manager) { if (manager == NULL) { return NULL; } @@ -189,19 +182,16 @@ namespace nw4r { return sound; } - detail::WaveSound* SoundPlayer::detail_AllocWaveSound(int priority, int startPriority, - detail::BasicSound::AmbientArgInfo* ambientArgInfo, - detail::ExternalSoundPlayer* extPlayer, u32 id, - detail::SoundInstanceManager* manager) { - + detail::WaveSound* SoundPlayer::detail_AllocWaveSound(int priority, int startPriority, detail::BasicSound::AmbientArgInfo* ambientArgInfo, + detail::ExternalSoundPlayer* extPlayer, u32 id, + detail::SoundInstanceManager* manager) { if (manager == NULL) { return NULL; } int priorityReduction = CalcPriorityReduction(ambientArgInfo, id); - startPriority = ut::Clamp(startPriority - priorityReduction, 0, - detail::BasicSound::PRIORITY_MAX); + startPriority = ut::Clamp(startPriority - priorityReduction, 0, detail::BasicSound::PRIORITY_MAX); if (!CheckPlayableSoundCount(startPriority, extPlayer)) { return NULL; @@ -238,7 +228,8 @@ namespace nw4r { if (ambientArgInfo != NULL) { SoundParam param; - ambientArgInfo->paramUpdateCallback->detail_Update(¶m, id, NULL, ambientArgInfo->arg, detail::BasicSound::AmbientParamUpdateCallback::PARAM_UPDATE_PRIORITY); + ambientArgInfo->paramUpdateCallback->detail_Update(¶m, id, NULL, ambientArgInfo->arg, + detail::BasicSound::AmbientParamUpdateCallback::PARAM_UPDATE_PRIORITY); priority = param.priority; } @@ -246,7 +237,7 @@ namespace nw4r { return priority; } - void SoundPlayer::InitAmbientArg(detail::BasicSound* sound,detail::BasicSound::AmbientArgInfo* ambientArgInfo) { + void SoundPlayer::InitAmbientArg(detail::BasicSound* sound, detail::BasicSound::AmbientArgInfo* ambientArgInfo) { if (ambientArgInfo == NULL) { return; } @@ -259,10 +250,8 @@ namespace nw4r { memcpy(pExtArg, ambientArgInfo->arg, ambientArgInfo->argSize); - sound->SetAmbientParamCallback(ambientArgInfo->paramUpdateCallback, - ambientArgInfo->argUpdateCallback, - ambientArgInfo->argAllocaterCallback, - pExtArg); + sound->SetAmbientParamCallback(ambientArgInfo->paramUpdateCallback, ambientArgInfo->argUpdateCallback, + ambientArgInfo->argAllocaterCallback, pExtArg); } void SoundPlayer::SetPlayableSoundCount(int count) { @@ -360,5 +349,5 @@ namespace nw4r { sound->SetPlayerHeap(NULL); } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SoundStartable.cpp b/libs/NW4R/src/snd/snd_SoundStartable.cpp index ca7faa3c..36ec6355 100644 --- a/libs/NW4R/src/snd/snd_SoundStartable.cpp +++ b/libs/NW4R/src/snd/snd_SoundStartable.cpp @@ -1,9 +1,11 @@ -#include #include +#include namespace nw4r { namespace snd { - SoundStartable::StartResult SoundStartable::detail_StartSound(SoundHandle* soundHandle, u32 id, detail::BasicSound::AmbientArgInfo* ambientArgInfo, detail::ExternalSoundPlayer* extPlayer, const StartInfo* pStartInfo) { + SoundStartable::StartResult SoundStartable::detail_StartSound(SoundHandle* soundHandle, u32 id, + detail::BasicSound::AmbientArgInfo* ambientArgInfo, + detail::ExternalSoundPlayer* extPlayer, const StartInfo* pStartInfo) { StartResult result = detail_SetupSound(soundHandle, id, ambientArgInfo, extPlayer, false, pStartInfo); if (result != START_SUCCESS) { @@ -14,7 +16,9 @@ namespace nw4r { return START_SUCCESS; } - SoundStartable::StartResult SoundStartable::detail_HoldSound(SoundHandle* soundHandle, u32 id, detail::BasicSound::AmbientArgInfo* ambientArgInfo, detail::ExternalSoundPlayer* extPlayer, const StartInfo* pStartInfo) { + SoundStartable::StartResult SoundStartable::detail_HoldSound(SoundHandle* soundHandle, u32 id, + detail::BasicSound::AmbientArgInfo* ambientArgInfo, + detail::ExternalSoundPlayer* extPlayer, const StartInfo* pStartInfo) { if (soundHandle->IsAttachedSound() && id == soundHandle->GetId()) { soundHandle->detail_GetAttachedSound()->SetAutoStopCounter(1); return START_SUCCESS; @@ -31,8 +35,10 @@ namespace nw4r { return START_SUCCESS; } - SoundStartable::StartResult SoundStartable::detail_PrepareSound(SoundHandle* handle, u32 targetID, detail::BasicSound::AmbientArgInfo* argInfo, detail::ExternalSoundPlayer* player, const StartInfo* startInfo) { + SoundStartable::StartResult SoundStartable::detail_PrepareSound(SoundHandle* handle, u32 targetID, + detail::BasicSound::AmbientArgInfo* argInfo, + detail::ExternalSoundPlayer* player, const StartInfo* startInfo) { return detail_SetupSound(handle, targetID, argInfo, player, false, startInfo); } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SoundSystem.cpp b/libs/NW4R/src/snd/snd_SoundSystem.cpp index 61fad694..442a1f18 100644 --- a/libs/NW4R/src/snd/snd_SoundSystem.cpp +++ b/libs/NW4R/src/snd/snd_SoundSystem.cpp @@ -1,10 +1,10 @@ #include -#include #include +#include -#include #include +#include namespace nw4r { namespace snd { @@ -52,5 +52,5 @@ namespace nw4r { detail::TaskThread::GetInstance().Create(dvdThreadPriority); detail::SoundThread::GetInstance().Create(soundThreadPriority); } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_SoundThread.cpp b/libs/NW4R/src/snd/snd_SoundThread.cpp index ddc45061..2ec5c139 100644 --- a/libs/NW4R/src/snd/snd_SoundThread.cpp +++ b/libs/NW4R/src/snd/snd_SoundThread.cpp @@ -1,9 +1,9 @@ #include -#include #include -#include #include +#include +#include #include @@ -14,7 +14,7 @@ namespace nw4r { static SoundThread instance; return instance; } - + bool SoundThread::Create(s32 priority) { if (mCreateFlag) { return true; @@ -25,10 +25,8 @@ namespace nw4r { OSInitThreadQueue(&mThreadQueue); OSInitMutex(&mMutex); - BOOL success = OSCreateThread(&mThread, SoundThreadFunc, &GetInstance(), - mThreadStack + THREAD_STACK_SIZE, - THREAD_STACK_SIZE * 8, - priority, 0); + BOOL success = + OSCreateThread(&mThread, SoundThreadFunc, &GetInstance(), mThreadStack + THREAD_STACK_SIZE, THREAD_STACK_SIZE * 8, priority, 0); if (success) { OSResumeThread(&mThread); @@ -93,8 +91,7 @@ namespace nw4r { CallbackList::Iterator currIt = it++; currIt->EndSoundFrame(); } - } - else if (reinterpret_cast(message) == MSG_SHUTDOWN) { + } else if (reinterpret_cast(message) == MSG_SHUTDOWN) { SeqPlayer::StopAllPlayers(); WsdPlayer::StopAllPlayers(); StrmPlayer::StopAllPlayers(); @@ -104,6 +101,6 @@ namespace nw4r { } } } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_StrmChannel.cpp b/libs/NW4R/src/snd/snd_StrmChannel.cpp index b20a4814..ef2fd740 100644 --- a/libs/NW4R/src/snd/snd_StrmChannel.cpp +++ b/libs/NW4R/src/snd/snd_StrmChannel.cpp @@ -80,6 +80,6 @@ namespace nw4r { mAllocFlags[byte] &= ~(1 << bit); mAllocCount--; } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_StrmFile.cpp b/libs/NW4R/src/snd/snd_StrmFile.cpp index e0d84d62..ddfb3878 100644 --- a/libs/NW4R/src/snd/snd_StrmFile.cpp +++ b/libs/NW4R/src/snd/snd_StrmFile.cpp @@ -24,7 +24,8 @@ namespace nw4r { return true; } - StrmFileReader::StrmFileReader() : mHeader(NULL), mHeadBlock(NULL) {} + StrmFileReader::StrmFileReader() : mHeader(NULL), mHeadBlock(NULL) { + } void StrmFileReader::Setup(const void* strmData) { if (!IsValidFileHeader(strmData)) { @@ -35,7 +36,7 @@ namespace nw4r { mHeadBlock = static_cast(ut::AddOffsetToPtr(mHeader, mHeader->headBlockOffset)); - Util::GetDataRefAddress0(mHeadBlock->refDataHeader, &mHeadBlock->refDataHeader); // debug leftover + Util::GetDataRefAddress0(mHeadBlock->refDataHeader, &mHeadBlock->refDataHeader); // debug leftover } bool StrmFileReader::ReadStrmInfo(StrmInfo* strmInfo) const { @@ -74,7 +75,8 @@ namespace nw4r { return false; } - const StrmFile::ChannelInfo* pChannelInfo = Util::GetDataRefAddress0(pChannelTable->refChannelHeader[channels], &mHeadBlock->refDataHeader); + const StrmFile::ChannelInfo* pChannelInfo = + Util::GetDataRefAddress0(pChannelTable->refChannelHeader[channels], &mHeadBlock->refDataHeader); const AdpcmInfo* pSrcInfo = Util::GetDataRefAddress0(pChannelInfo->refAdpcmInfo, &mHeadBlock->refDataHeader); *adpcmInfo = *pSrcInfo; @@ -119,9 +121,7 @@ namespace nw4r { return false; } - s32 offset = mReader.GetAdpcBlockOffset() + - block * channels * (2 * sizeof(u16)) + - sizeof(ut::BinaryBlockHeader); + s32 offset = mReader.GetAdpcBlockOffset() + block * channels * (2 * sizeof(u16)) + sizeof(ut::BinaryBlockHeader); mStream.Seek(offset, ut::FileStream::SEEK_BEG); @@ -136,6 +136,6 @@ namespace nw4r { return true; } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_StrmPlayer.cpp b/libs/NW4R/src/snd/snd_StrmPlayer.cpp index e3a4bf40..ec403a11 100644 --- a/libs/NW4R/src/snd/snd_StrmPlayer.cpp +++ b/libs/NW4R/src/snd/snd_StrmPlayer.cpp @@ -1,6 +1,6 @@ +#include #include #include -#include #include #include @@ -16,9 +16,7 @@ namespace nw4r { } u8 StrmPlayer::LoadCommand::mMramBuf[LOAD_BUFFER_SIZE] ALIGN32; - StrmPlayer::StrmPlayer() : - mActiveFlag(false), - mVoice(NULL) { + StrmPlayer::StrmPlayer() : mActiveFlag(false), mVoice(NULL) { for (u32 i = 0; i < 32; i++) { LoadCommand& loadCommand = mLoadCoammndArray[i]; loadCommand.mPlayer = this; @@ -26,7 +24,8 @@ namespace nw4r { } } - bool StrmPlayer::Prepare(StrmBufferPool* bufferPool, StartOffsetType startOffsetType, s32 startOffset, int voices, StrmCallback* callback, u32 callbackData) { + bool StrmPlayer::Prepare(StrmBufferPool* bufferPool, StartOffsetType startOffsetType, s32 startOffset, int voices, StrmCallback* callback, + u32 callbackData) { if (mActiveFlag) { ForceStop(); } @@ -104,8 +103,7 @@ namespace nw4r { if (driveStatus == DVD_STATE_IDLE) { mDiskErrorFlag = false; UpdatePauseStatus(); - } - else if (driveStatus != DVD_STATE_BUSY) { + } else if (driveStatus != DVD_STATE_BUSY) { mDiskErrorFlag = true; mLoadWaitFlag = true; UpdatePauseStatus(); @@ -116,8 +114,7 @@ namespace nw4r { mLoadWaitFlag = true; UpdatePauseStatus(); } - } - else { + } else { if (mFillBufferCommandList.IsEmpty()) { mLoadWaitFlag = false; UpdatePauseStatus(); @@ -185,7 +182,7 @@ namespace nw4r { remoteSend[i] += mRemoteSend[i]; remoteFxSend[i] = 0.0f; - remoteFxSend[i] += mRemoteSend[i]; // @bug Should be mRemoteFxSend + remoteFxSend[i] += mRemoteSend[i]; // @bug Should be mRemoteFxSend } mVoice->SetVolume(volume); @@ -244,9 +241,7 @@ namespace nw4r { UpdateLoopAddress(0, mPlayingBufferBlockCount * mStrmInfo.blockSamples); } - if (mPlayingBufferBlockIndex == mPlayingBufferBlockCount - 1 && - mVoice->GetFormat() == AxVoice::FORMAT_ADPCM) { - + if (mPlayingBufferBlockIndex == mPlayingBufferBlockCount - 1 && mVoice->GetFormat() == AxVoice::FORMAT_ADPCM) { if (!mSkipUpdateAdpcmLoop && mValidAdpcmLoop) { ut::AutoInterruptLock lock; @@ -329,21 +324,21 @@ namespace nw4r { param->mBufferBlockIndex = mLoadingBufferBlockIndex; param->mStreamBlockIndex = mLoadingDataBlockIndex; - u32 blockSize = mLoadingDataBlockIndex < static_cast(mStrmInfo.numBlocks - 1) ? mStrmInfo.blockSize : mStrmInfo.lastBlockPaddedSize; + u32 blockSize = + mLoadingDataBlockIndex < static_cast(mStrmInfo.numBlocks - 1) ? mStrmInfo.blockSize : mStrmInfo.lastBlockPaddedSize; u32 loadSize = mStrmInfo.blockHeaderOffset + mChannelCount * ut::RoundUp(blockSize, 32); - s32 loadOffset = mStrmInfo.dataOffset + - mLoadingDataBlockIndex * (mStrmInfo.blockHeaderOffset + - mStrmInfo.blockSize * mStrmInfo.numChannels); + s32 loadOffset = + mStrmInfo.dataOffset + mLoadingDataBlockIndex * (mStrmInfo.blockHeaderOffset + mStrmInfo.blockSize * mStrmInfo.numChannels); mFillBufferCommandList.PushBack(param); bool needUpdateAdpcmLoop = mLoadingBufferBlockIndex == 0 && mStrmInfo.format == WaveFile::FORMAT_ADPCM; - StrmCallback::Result result = mCallback->LoadStream(param->mMramBuf, loadSize, loadOffset, mChannelCount, - blockSize, mStrmInfo.blockHeaderOffset, needUpdateAdpcmLoop, - *param, reinterpret_cast(this), mCallbackData); + StrmCallback::Result result = + mCallback->LoadStream(param->mMramBuf, loadSize, loadOffset, mChannelCount, blockSize, mStrmInfo.blockHeaderOffset, + needUpdateAdpcmLoop, *param, reinterpret_cast(this), mCallbackData); switch (result) { case StrmCallback::RESULT_FAILED: { ForceStop(); @@ -363,8 +358,7 @@ namespace nw4r { if (mLoadingDataBlockIndex > mLastBlockIndex) { if (mStrmInfo.loopFlag) { mLoadingDataBlockIndex = mLoopStartBlockIndex; - } - else { + } else { mLoadFinishFlag = true; return; } @@ -552,7 +546,7 @@ namespace nw4r { } } - if (mStrmInfo.numBlocks <= 2 && !mStrmInfo.loopFlag) { + if (mStrmInfo.numBlocks <= 2 && !mStrmInfo.loopFlag) { SetLoopEndToZeroBuffer(mStrmInfo.numBlocks - 1); } } @@ -581,8 +575,7 @@ namespace nw4r { mBufferBlockCount = poolBlockSize / mDataBlockSize; if (mBufferBlockCount < DATA_BLOCK_COUNT_MIN) { return false; - } - else if (mBufferBlockCount > DATA_BLOCK_COUNT_MAX) { + } else if (mBufferBlockCount > DATA_BLOCK_COUNT_MAX) { mBufferBlockCount = DATA_BLOCK_COUNT_MAX; } @@ -593,8 +586,7 @@ namespace nw4r { if (mStrmInfo.blockSamples > 0) { if (mStartOffsetType == START_OFFSET_TYPE_SAMPLE) { blockIndex = static_cast(mStartOffset) / static_cast(mStrmInfo.blockSamples); - } - else if (mStartOffsetType == START_OFFSET_TYPE_MILLISEC) { + } else if (mStartOffsetType == START_OFFSET_TYPE_MILLISEC) { blockIndex = static_cast(mStrmInfo.sampleRate * mStartOffset / 1000) / static_cast(mStrmInfo.blockSamples); } } @@ -606,8 +598,7 @@ namespace nw4r { if (mNoRealtimeLoadFlag) { mLoadingBufferBlockCount = mStrmInfo.numBlocks; - } - else { + } else { mLoadingBufferBlockCount = CalcLoadingBufferBlockCount(); } @@ -630,7 +621,8 @@ namespace nw4r { waveData.numChannels = static_cast(mChannelCount); waveData.sampleRate = mStrmInfo.sampleRate; waveData.loopStart = 0; - waveData.loopEnd = AxVoice::GetSampleByByte(static_cast(mDataBlockSize * mPlayingBufferBlockCount), WaveFormatToAxFormat(mStrmInfo.format)); + waveData.loopEnd = + AxVoice::GetSampleByByte(static_cast(mDataBlockSize * mPlayingBufferBlockCount), WaveFormatToAxFormat(mStrmInfo.format)); for (int i = 0; i < mChannelCount; i++) { ChannelParam& channelParam = waveData.channelParam[i]; @@ -729,8 +721,7 @@ namespace nw4r { StrmPlayer* player = reinterpret_cast(userData); if (result) { player->Setup(header); - } - else { + } else { player->ForceStop(); } } @@ -768,8 +759,7 @@ namespace nw4r { mPlayer->mPreparedFlag = true; } } - } - else { + } else { mPlayer->ForceStop(); } @@ -777,7 +767,8 @@ namespace nw4r { } void StrmPlayer::LoadCommand::SetAdpcmLoopContext(int channelNum, u16* predScale) { - if (mPlayer->mStrmInfo.format != WaveFile::FORMAT_ADPCM) return; + if (mPlayer->mStrmInfo.format != WaveFile::FORMAT_ADPCM) + return; for (int i = 0; i < channelNum && i < CHANNEL_MAX; i++) { mPlayer->mAdpcmPredScale[i] = predScale[i]; @@ -792,6 +783,6 @@ namespace nw4r { } return static_cast(mPlayer->mChannels[channelNum].mBuffer) + mPlayer->mDataBlockSize * mBufferBlockIndex; } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_StrmSound.cpp b/libs/NW4R/src/snd/snd_StrmSound.cpp index c9de233f..c450cd95 100644 --- a/libs/NW4R/src/snd/snd_StrmSound.cpp +++ b/libs/NW4R/src/snd/snd_StrmSound.cpp @@ -8,11 +8,11 @@ namespace nw4r { namespace detail { NW4R_UT_GET_DERIVED_RUNTIME_TYPEINFO(StrmSound, BasicSound); - StrmSound::StrmSound(SoundInstanceManager* manager) : - mTempSpecialHandle(NULL), - mManager(manager) {} + StrmSound::StrmSound(SoundInstanceManager* manager) : mTempSpecialHandle(NULL), mManager(manager) { + } - bool StrmSound::Prepare(StrmBufferPool* bufferPool, StrmPlayer::StartOffsetType startOffsetType, s32 offset, int voices, StrmPlayer::StrmCallback* callback, u32 callbackData) { + bool StrmSound::Prepare(StrmBufferPool* bufferPool, StrmPlayer::StartOffsetType startOffsetType, s32 offset, int voices, + StrmPlayer::StrmCallback* callback, u32 callbackData) { if (bufferPool == NULL) { return NULL; } @@ -37,6 +37,6 @@ namespace nw4r { void StrmSound::DetachTempSpecialHandle() { mTempSpecialHandle->DetachSound(); } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_StrmSoundHandle.cpp b/libs/NW4R/src/snd/snd_StrmSoundHandle.cpp index 20b56c4b..287f5aad 100644 --- a/libs/NW4R/src/snd/snd_StrmSoundHandle.cpp +++ b/libs/NW4R/src/snd/snd_StrmSoundHandle.cpp @@ -13,5 +13,5 @@ namespace nw4r { mSound = NULL; } } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_TaskManager.cpp b/libs/NW4R/src/snd/snd_TaskManager.cpp index c9c454d2..46de446f 100644 --- a/libs/NW4R/src/snd/snd_TaskManager.cpp +++ b/libs/NW4R/src/snd/snd_TaskManager.cpp @@ -12,10 +12,7 @@ namespace nw4r { return instance; } - TaskManager::TaskManager() : - mMutex(), - mCurrentTask(NULL), - mTaskList() { + TaskManager::TaskManager() : mMutex(), mCurrentTask(NULL), mTaskList() { OSInitMutex(&mMutex); mHeapHandle = MEMCreateUnitHeap(mTaskArea, sizeof(mTaskArea), 64); } @@ -56,7 +53,8 @@ namespace nw4r { } void TaskManager::Execute() { - while (ExecuteSingle()) {} + while (ExecuteSingle()) { + } } bool TaskManager::ExecuteSingle() { @@ -97,6 +95,6 @@ namespace nw4r { mCurrentTask->Cancel(); } } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_TaskThread.cpp b/libs/NW4R/src/snd/snd_TaskThread.cpp index 69a819c6..f0106f8d 100644 --- a/libs/NW4R/src/snd/snd_TaskThread.cpp +++ b/libs/NW4R/src/snd/snd_TaskThread.cpp @@ -1,5 +1,5 @@ -#include #include +#include namespace nw4r { namespace snd { @@ -18,10 +18,8 @@ namespace nw4r { OSInitThreadQueue(&mThreadQueue); - BOOL result = OSCreateThread(&mThread, ThreadFunc, &GetInstance(), - mThreadStack + THREAD_STACK_SIZE, - THREAD_STACK_SIZE * 8, - threadPrio, 0); + BOOL result = + OSCreateThread(&mThread, ThreadFunc, &GetInstance(), mThreadStack + THREAD_STACK_SIZE, THREAD_STACK_SIZE * 8, threadPrio, 0); if (result) { OSResumeThread(&mThread); } @@ -50,12 +48,11 @@ namespace nw4r { if (reinterpret_cast(msg) == MSG_EXECUTE) { TaskManager::GetInstance().Execute(); - } - else if (reinterpret_cast(msg) == MSG_DONE) { + } else if (reinterpret_cast(msg) == MSG_DONE) { return; } } } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_Util.cpp b/libs/NW4R/src/snd/snd_Util.cpp index c6932b7d..dfc58be3 100644 --- a/libs/NW4R/src/snd/snd_Util.cpp +++ b/libs/NW4R/src/snd/snd_Util.cpp @@ -67,7 +67,7 @@ namespace nw4r { u16 Util::CalcRandom() { static int u = 0x12345678; - u = u * 0x19660D + 0x3C6EF35F; // randq1 :D + u = u * 0x19660D + 0x3C6EF35F; // randq1 :D return u >> 16; } @@ -83,313 +83,177 @@ namespace nw4r { return NULL; } - const f32 Util::NoteTable[SEMITONE_MAX] = { - 1.0000000f, 1.0594631f, 1.1224620f, 1.1892071f, 1.2599211f, 1.3348398f, - 1.4142135f, 1.4983071f, 1.5874010f, 1.6817929f, 1.7817974f, 1.8877486f}; + const f32 Util::NoteTable[SEMITONE_MAX] = {1.0000000f, 1.0594631f, 1.1224620f, 1.1892071f, 1.2599211f, 1.3348398f, + 1.4142135f, 1.4983071f, 1.5874010f, 1.6817929f, 1.7817974f, 1.8877486f}; const f32 Util::PitchTable[MICROTONE_MAX] = { - 1.00000000f, 1.00022566f, 1.00045133f, 1.00067711f, 1.00090289f, - 1.00112879f, 1.00135469f, 1.00158072f, 1.00180674f, 1.00203276f, - 1.00225890f, 1.00248504f, 1.00271130f, 1.00293756f, 1.00316381f, - 1.00339019f, 1.00361669f, 1.00384319f, 1.00406969f, 1.00429630f, - 1.00452292f, 1.00474954f, 1.00497627f, 1.00520301f, 1.00542986f, - 1.00565684f, 1.00588369f, 1.00611067f, 1.00633776f, 1.00656486f, - 1.00679195f, 1.00701916f, 1.00724638f, 1.00747371f, 1.00770104f, - 1.00792849f, 1.00815594f, 1.00838339f, 1.00861096f, 1.00883853f, - 1.00906622f, 1.00929391f, 1.00952172f, 1.00974953f, 1.00997734f, - 1.01020527f, 1.01043320f, 1.01066124f, 1.01088929f, 1.01111746f, - 1.01134562f, 1.01157379f, 1.01180208f, 1.01203036f, 1.01225877f, - 1.01248717f, 1.01271570f, 1.01294422f, 1.01317275f, 1.01340139f, - 1.01363003f, 1.01385880f, 1.01408756f, 1.01431644f, 1.01454532f, - 1.01477432f, 1.01500332f, 1.01523232f, 1.01546144f, 1.01569057f, - 1.01591980f, 1.01614904f, 1.01637828f, 1.01660764f, 1.01683712f, - 1.01706648f, 1.01729608f, 1.01752555f, 1.01775527f, 1.01798487f, - 1.01821458f, 1.01844442f, 1.01867425f, 1.01890409f, 1.01913404f, - 1.01936400f, 1.01959395f, 1.01982403f, 1.02005422f, 1.02028441f, - 1.02051461f, 1.02074492f, 1.02097523f, 1.02120566f, 1.02143610f, - 1.02166665f, 1.02189720f, 1.02212775f, 1.02235842f, 1.02258909f, - 1.02281988f, 1.02305067f, 1.02328157f, 1.02351248f, 1.02374339f, - 1.02397442f, 1.02420545f, 1.02443659f, 1.02466774f, 1.02489901f, - 1.02513027f, 1.02536166f, 1.02559304f, 1.02582443f, 1.02605593f, - 1.02628744f, 1.02651906f, 1.02675068f, 1.02698243f, 1.02721417f, - 1.02744591f, 1.02767777f, 1.02790976f, 1.02814162f, 1.02837372f, - 1.02860570f, 1.02883780f, 1.02907002f, 1.02930224f, 1.02953446f, - 1.02976680f, 1.02999926f, 1.03023160f, 1.03046417f, 1.03069663f, - 1.03092921f, 1.03116190f, 1.03139460f, 1.03162730f, 1.03186011f, - 1.03209293f, 1.03232586f, 1.03255880f, 1.03279185f, 1.03302491f, - 1.03325796f, 1.03349113f, 1.03372443f, 1.03395760f, 1.03419101f, - 1.03442430f, 1.03465772f, 1.03489125f, 1.03512478f, 1.03535831f, - 1.03559196f, 1.03582573f, 1.03605938f, 1.03629327f, 1.03652704f, - 1.03676093f, 1.03699493f, 1.03722894f, 1.03746295f, 1.03769708f, - 1.03793132f, 1.03816545f, 1.03839982f, 1.03863406f, 1.03886843f, - 1.03910291f, 1.03933740f, 1.03957188f, 1.03980649f, 1.04004121f, - 1.04027581f, 1.04051065f, 1.04074538f, 1.04098022f, 1.04121518f, - 1.04145014f, 1.04168510f, 1.04192019f, 1.04215527f, 1.04239047f, - 1.04262567f, 1.04286098f, 1.04309630f, 1.04333174f, 1.04356718f, - 1.04380262f, 1.04403818f, 1.04427373f, 1.04450941f, 1.04474509f, - 1.04498088f, 1.04521668f, 1.04545259f, 1.04568851f, 1.04592443f, - 1.04616046f, 1.04639649f, 1.04663265f, 1.04686880f, 1.04710507f, - 1.04734135f, 1.04757774f, 1.04781413f, 1.04805052f, 1.04828703f, - 1.04852366f, 1.04876029f, 1.04899693f, 1.04923368f, 1.04947042f, - 1.04970717f, 1.04994404f, 1.05018103f, 1.05041802f, 1.05065501f, - 1.05089211f, 1.05112922f, 1.05136645f, 1.05160367f, 1.05184102f, - 1.05207837f, 1.05231583f, 1.05255330f, 1.05279076f, 1.05302835f, - 1.05326593f, 1.05350363f, 1.05374134f, 1.05397916f, 1.05421698f, - 1.05445492f, 1.05469286f, 1.05493081f, 1.05516887f, 1.05540705f, - 1.05564523f, 1.05588341f, 1.05612171f, 1.05636001f, 1.05659842f, - 1.05683684f, 1.05707526f, 1.05731380f, 1.05755246f, 1.05779111f, - 1.05802977f, 1.05826855f, 1.05850732f, 1.05874622f, 1.05898511f, - 1.05922413f}; + 1.00000000f, 1.00022566f, 1.00045133f, 1.00067711f, 1.00090289f, 1.00112879f, 1.00135469f, 1.00158072f, 1.00180674f, 1.00203276f, + 1.00225890f, 1.00248504f, 1.00271130f, 1.00293756f, 1.00316381f, 1.00339019f, 1.00361669f, 1.00384319f, 1.00406969f, 1.00429630f, + 1.00452292f, 1.00474954f, 1.00497627f, 1.00520301f, 1.00542986f, 1.00565684f, 1.00588369f, 1.00611067f, 1.00633776f, 1.00656486f, + 1.00679195f, 1.00701916f, 1.00724638f, 1.00747371f, 1.00770104f, 1.00792849f, 1.00815594f, 1.00838339f, 1.00861096f, 1.00883853f, + 1.00906622f, 1.00929391f, 1.00952172f, 1.00974953f, 1.00997734f, 1.01020527f, 1.01043320f, 1.01066124f, 1.01088929f, 1.01111746f, + 1.01134562f, 1.01157379f, 1.01180208f, 1.01203036f, 1.01225877f, 1.01248717f, 1.01271570f, 1.01294422f, 1.01317275f, 1.01340139f, + 1.01363003f, 1.01385880f, 1.01408756f, 1.01431644f, 1.01454532f, 1.01477432f, 1.01500332f, 1.01523232f, 1.01546144f, 1.01569057f, + 1.01591980f, 1.01614904f, 1.01637828f, 1.01660764f, 1.01683712f, 1.01706648f, 1.01729608f, 1.01752555f, 1.01775527f, 1.01798487f, + 1.01821458f, 1.01844442f, 1.01867425f, 1.01890409f, 1.01913404f, 1.01936400f, 1.01959395f, 1.01982403f, 1.02005422f, 1.02028441f, + 1.02051461f, 1.02074492f, 1.02097523f, 1.02120566f, 1.02143610f, 1.02166665f, 1.02189720f, 1.02212775f, 1.02235842f, 1.02258909f, + 1.02281988f, 1.02305067f, 1.02328157f, 1.02351248f, 1.02374339f, 1.02397442f, 1.02420545f, 1.02443659f, 1.02466774f, 1.02489901f, + 1.02513027f, 1.02536166f, 1.02559304f, 1.02582443f, 1.02605593f, 1.02628744f, 1.02651906f, 1.02675068f, 1.02698243f, 1.02721417f, + 1.02744591f, 1.02767777f, 1.02790976f, 1.02814162f, 1.02837372f, 1.02860570f, 1.02883780f, 1.02907002f, 1.02930224f, 1.02953446f, + 1.02976680f, 1.02999926f, 1.03023160f, 1.03046417f, 1.03069663f, 1.03092921f, 1.03116190f, 1.03139460f, 1.03162730f, 1.03186011f, + 1.03209293f, 1.03232586f, 1.03255880f, 1.03279185f, 1.03302491f, 1.03325796f, 1.03349113f, 1.03372443f, 1.03395760f, 1.03419101f, + 1.03442430f, 1.03465772f, 1.03489125f, 1.03512478f, 1.03535831f, 1.03559196f, 1.03582573f, 1.03605938f, 1.03629327f, 1.03652704f, + 1.03676093f, 1.03699493f, 1.03722894f, 1.03746295f, 1.03769708f, 1.03793132f, 1.03816545f, 1.03839982f, 1.03863406f, 1.03886843f, + 1.03910291f, 1.03933740f, 1.03957188f, 1.03980649f, 1.04004121f, 1.04027581f, 1.04051065f, 1.04074538f, 1.04098022f, 1.04121518f, + 1.04145014f, 1.04168510f, 1.04192019f, 1.04215527f, 1.04239047f, 1.04262567f, 1.04286098f, 1.04309630f, 1.04333174f, 1.04356718f, + 1.04380262f, 1.04403818f, 1.04427373f, 1.04450941f, 1.04474509f, 1.04498088f, 1.04521668f, 1.04545259f, 1.04568851f, 1.04592443f, + 1.04616046f, 1.04639649f, 1.04663265f, 1.04686880f, 1.04710507f, 1.04734135f, 1.04757774f, 1.04781413f, 1.04805052f, 1.04828703f, + 1.04852366f, 1.04876029f, 1.04899693f, 1.04923368f, 1.04947042f, 1.04970717f, 1.04994404f, 1.05018103f, 1.05041802f, 1.05065501f, + 1.05089211f, 1.05112922f, 1.05136645f, 1.05160367f, 1.05184102f, 1.05207837f, 1.05231583f, 1.05255330f, 1.05279076f, 1.05302835f, + 1.05326593f, 1.05350363f, 1.05374134f, 1.05397916f, 1.05421698f, 1.05445492f, 1.05469286f, 1.05493081f, 1.05516887f, 1.05540705f, + 1.05564523f, 1.05588341f, 1.05612171f, 1.05636001f, 1.05659842f, 1.05683684f, 1.05707526f, 1.05731380f, 1.05755246f, 1.05779111f, + 1.05802977f, 1.05826855f, 1.05850732f, 1.05874622f, 1.05898511f, 1.05922413f}; const f32 Util::Decibel2RatioTable[VOLUME_TABLE_SIZE] = { - 0.0000000000f, 0.0000305492f, 0.0000309030f, 0.0000312608f, 0.0000316228f, - 0.0000319890f, 0.0000323594f, 0.0000327341f, 0.0000331131f, 0.0000334965f, - 0.0000338844f, 0.0000342768f, 0.0000346737f, 0.0000350752f, 0.0000354813f, - 0.0000358922f, 0.0000363078f, 0.0000367282f, 0.0000371535f, 0.0000375837f, - 0.0000380189f, 0.0000384592f, 0.0000389045f, 0.0000393550f, 0.0000398107f, - 0.0000402717f, 0.0000407380f, 0.0000412098f, 0.0000416869f, 0.0000421697f, - 0.0000426580f, 0.0000431519f, 0.0000436516f, 0.0000441570f, 0.0000446684f, - 0.0000451856f, 0.0000457088f, 0.0000462381f, 0.0000467735f, 0.0000473151f, - 0.0000478630f, 0.0000484172f, 0.0000489779f, 0.0000495450f, 0.0000501187f, - 0.0000506991f, 0.0000512861f, 0.0000518800f, 0.0000524807f, 0.0000530884f, - 0.0000537032f, 0.0000543250f, 0.0000549541f, 0.0000555904f, 0.0000562341f, - 0.0000568853f, 0.0000575440f, 0.0000582103f, 0.0000588844f, 0.0000595662f, - 0.0000602560f, 0.0000609537f, 0.0000616595f, 0.0000623735f, 0.0000630957f, - 0.0000638263f, 0.0000645654f, 0.0000653131f, 0.0000660693f, 0.0000668344f, - 0.0000676083f, 0.0000683912f, 0.0000691831f, 0.0000699842f, 0.0000707946f, - 0.0000716143f, 0.0000724436f, 0.0000732825f, 0.0000741310f, 0.0000749894f, - 0.0000758578f, 0.0000767361f, 0.0000776247f, 0.0000785236f, 0.0000794328f, - 0.0000803526f, 0.0000812831f, 0.0000822243f, 0.0000831764f, 0.0000841395f, - 0.0000851138f, 0.0000860994f, 0.0000870964f, 0.0000881049f, 0.0000891251f, - 0.0000901571f, 0.0000912011f, 0.0000922571f, 0.0000933254f, 0.0000944061f, - 0.0000954993f, 0.0000966051f, 0.0000977237f, 0.0000988553f, 0.0001000000f, - 0.0001011580f, 0.0001023290f, 0.0001035140f, 0.0001047130f, 0.0001059250f, - 0.0001071520f, 0.0001083930f, 0.0001096480f, 0.0001109170f, 0.0001122020f, - 0.0001135010f, 0.0001148150f, 0.0001161450f, 0.0001174900f, 0.0001188500f, - 0.0001202260f, 0.0001216190f, 0.0001230270f, 0.0001244510f, 0.0001258930f, - 0.0001273500f, 0.0001288250f, 0.0001303170f, 0.0001318260f, 0.0001333520f, - 0.0001348960f, 0.0001364580f, 0.0001380380f, 0.0001396370f, 0.0001412540f, - 0.0001428890f, 0.0001445440f, 0.0001462180f, 0.0001479110f, 0.0001496240f, - 0.0001513560f, 0.0001531090f, 0.0001548820f, 0.0001566750f, 0.0001584890f, - 0.0001603250f, 0.0001621810f, 0.0001640590f, 0.0001659590f, 0.0001678800f, - 0.0001698240f, 0.0001717910f, 0.0001737800f, 0.0001757920f, 0.0001778280f, - 0.0001798870f, 0.0001819700f, 0.0001840770f, 0.0001862090f, 0.0001883650f, - 0.0001905460f, 0.0001927520f, 0.0001949840f, 0.0001972420f, 0.0001995260f, - 0.0002018370f, 0.0002041740f, 0.0002065380f, 0.0002089300f, 0.0002113490f, - 0.0002137960f, 0.0002162720f, 0.0002187760f, 0.0002213090f, 0.0002238720f, - 0.0002264640f, 0.0002290870f, 0.0002317390f, 0.0002344230f, 0.0002371370f, - 0.0002398830f, 0.0002426610f, 0.0002454710f, 0.0002483130f, 0.0002511890f, - 0.0002540970f, 0.0002570400f, 0.0002600160f, 0.0002630270f, 0.0002660730f, - 0.0002691530f, 0.0002722700f, 0.0002754230f, 0.0002786120f, 0.0002818380f, - 0.0002851020f, 0.0002884030f, 0.0002917430f, 0.0002951210f, 0.0002985380f, - 0.0003019950f, 0.0003054920f, 0.0003090300f, 0.0003126080f, 0.0003162280f, - 0.0003198900f, 0.0003235940f, 0.0003273410f, 0.0003311310f, 0.0003349650f, - 0.0003388440f, 0.0003427680f, 0.0003467370f, 0.0003507520f, 0.0003548130f, - 0.0003589220f, 0.0003630780f, 0.0003672820f, 0.0003715350f, 0.0003758370f, - 0.0003801890f, 0.0003845920f, 0.0003890450f, 0.0003935500f, 0.0003981070f, - 0.0004027170f, 0.0004073800f, 0.0004120980f, 0.0004168690f, 0.0004216970f, - 0.0004265800f, 0.0004315190f, 0.0004365160f, 0.0004415700f, 0.0004466840f, - 0.0004518560f, 0.0004570880f, 0.0004623810f, 0.0004677350f, 0.0004731510f, - 0.0004786300f, 0.0004841720f, 0.0004897790f, 0.0004954500f, 0.0005011870f, - 0.0005069910f, 0.0005128610f, 0.0005188000f, 0.0005248070f, 0.0005308840f, - 0.0005370320f, 0.0005432500f, 0.0005495410f, 0.0005559040f, 0.0005623410f, - 0.0005688530f, 0.0005754400f, 0.0005821030f, 0.0005888440f, 0.0005956620f, - 0.0006025600f, 0.0006095370f, 0.0006165950f, 0.0006237350f, 0.0006309570f, - 0.0006382630f, 0.0006456540f, 0.0006531310f, 0.0006606930f, 0.0006683440f, - 0.0006760830f, 0.0006839120f, 0.0006918310f, 0.0006998420f, 0.0007079460f, - 0.0007161430f, 0.0007244360f, 0.0007328250f, 0.0007413100f, 0.0007498940f, - 0.0007585780f, 0.0007673610f, 0.0007762470f, 0.0007852360f, 0.0007943280f, - 0.0008035260f, 0.0008128310f, 0.0008222430f, 0.0008317640f, 0.0008413950f, - 0.0008511380f, 0.0008609940f, 0.0008709640f, 0.0008810490f, 0.0008912510f, - 0.0009015710f, 0.0009120110f, 0.0009225710f, 0.0009332540f, 0.0009440610f, - 0.0009549930f, 0.0009660510f, 0.0009772370f, 0.0009885530f, 0.0010000000f, - 0.0010115789f, 0.0010232930f, 0.0010351420f, 0.0010471290f, 0.0010592540f, - 0.0010715190f, 0.0010839270f, 0.0010964780f, 0.0011091750f, 0.0011220180f, - 0.0011350110f, 0.0011481540f, 0.0011614490f, 0.0011748980f, 0.0011885019f, - 0.0012022640f, 0.0012161860f, 0.0012302690f, 0.0012445149f, 0.0012589250f, - 0.0012735029f, 0.0012882500f, 0.0013031670f, 0.0013182570f, 0.0013335210f, - 0.0013489630f, 0.0013645830f, 0.0013803840f, 0.0013963680f, 0.0014125380f, - 0.0014288940f, 0.0014454400f, 0.0014621770f, 0.0014791080f, 0.0014962360f, - 0.0015135610f, 0.0015310870f, 0.0015488170f, 0.0015667510f, 0.0015848930f, - 0.0016032450f, 0.0016218100f, 0.0016405900f, 0.0016595870f, 0.0016788041f, - 0.0016982440f, 0.0017179080f, 0.0017378010f, 0.0017579240f, 0.0017782790f, - 0.0017988710f, 0.0018197011f, 0.0018407720f, 0.0018620871f, 0.0018836490f, - 0.0019054610f, 0.0019275250f, 0.0019498450f, 0.0019724229f, 0.0019952620f, - 0.0020183660f, 0.0020417380f, 0.0020653801f, 0.0020892960f, 0.0021134890f, - 0.0021379620f, 0.0021627189f, 0.0021877619f, 0.0022130951f, 0.0022387209f, - 0.0022646440f, 0.0022908680f, 0.0023173951f, 0.0023442290f, 0.0023713741f, - 0.0023988329f, 0.0024266101f, 0.0024547090f, 0.0024831330f, 0.0025118859f, - 0.0025409730f, 0.0025703961f, 0.0026001600f, 0.0026302680f, 0.0026607250f, - 0.0026915350f, 0.0027227011f, 0.0027542289f, 0.0027861211f, 0.0028183830f, - 0.0028510180f, 0.0028840320f, 0.0029174271f, 0.0029512090f, 0.0029853829f, - 0.0030199520f, 0.0030549210f, 0.0030902950f, 0.0031260790f, 0.0031622781f, - 0.0031988949f, 0.0032359371f, 0.0032734070f, 0.0033113109f, 0.0033496539f, - 0.0033884421f, 0.0034276780f, 0.0034673689f, 0.0035075189f, 0.0035481339f, - 0.0035892189f, 0.0036307811f, 0.0036728231f, 0.0037153519f, 0.0037583739f, - 0.0038018939f, 0.0038459180f, 0.0038904510f, 0.0039355010f, 0.0039810720f, - 0.0040271701f, 0.0040738028f, 0.0041209748f, 0.0041686939f, 0.0042169648f, - 0.0042657950f, 0.0043151909f, 0.0043651578f, 0.0044157039f, 0.0044668359f, - 0.0045185592f, 0.0045708818f, 0.0046238098f, 0.0046773511f, 0.0047315131f, - 0.0047863009f, 0.0048417239f, 0.0048977882f, 0.0049545020f, 0.0050118719f, - 0.0050699068f, 0.0051286141f, 0.0051879999f, 0.0052480749f, 0.0053088441f, - 0.0053703180f, 0.0054325028f, 0.0054954090f, 0.0055590430f, 0.0056234128f, - 0.0056885290f, 0.0057543991f, 0.0058210320f, 0.0058884369f, 0.0059566209f, - 0.0060255961f, 0.0060953689f, 0.0061659501f, 0.0062373481f, 0.0063095731f, - 0.0063826349f, 0.0064565418f, 0.0065313061f, 0.0066069341f, 0.0066834390f, - 0.0067608301f, 0.0068391161f, 0.0069183102f, 0.0069984202f, 0.0070794579f, - 0.0071614338f, 0.0072443602f, 0.0073282449f, 0.0074131018f, 0.0074989418f, - 0.0075857760f, 0.0076736151f, 0.0077624712f, 0.0078523559f, 0.0079432819f, - 0.0080352612f, 0.0081283050f, 0.0082224263f, 0.0083176382f, 0.0084139509f, - 0.0085113803f, 0.0086099384f, 0.0087096356f, 0.0088104894f, 0.0089125093f, - 0.0090157110f, 0.0091201076f, 0.0092257140f, 0.0093325432f, 0.0094406093f, - 0.0095499260f, 0.0096605094f, 0.0097723724f, 0.0098855309f, 0.0099999998f, - 0.0101157948f, 0.0102329301f, 0.0103514222f, 0.0104712853f, 0.0105925370f, - 0.0107151931f, 0.0108392686f, 0.0109647820f, 0.0110917483f, 0.0112201851f, - 0.0113501083f, 0.0114815356f, 0.0116144856f, 0.0117489761f, 0.0118850218f, - 0.0120226443f, 0.0121618602f, 0.0123026883f, 0.0124451462f, 0.0125892544f, - 0.0127350306f, 0.0128824962f, 0.0130316680f, 0.0131825674f, 0.0133352140f, - 0.0134896291f, 0.0136458306f, 0.0138038434f, 0.0139636844f, 0.0141253751f, - 0.0142889395f, 0.0144543983f, 0.0146217719f, 0.0147910845f, 0.0149623565f, - 0.0151356123f, 0.0153108751f, 0.0154881664f, 0.0156675112f, 0.0158489328f, - 0.0160324536f, 0.0162181016f, 0.0164058972f, 0.0165958684f, 0.0167880394f, - 0.0169824362f, 0.0171790831f, 0.0173780080f, 0.0175792351f, 0.0177827943f, - 0.0179887097f, 0.0181970093f, 0.0184077192f, 0.0186208710f, 0.0188364908f, - 0.0190546066f, 0.0192752499f, 0.0194984451f, 0.0197242275f, 0.0199526232f, - 0.0201836638f, 0.0204173792f, 0.0206538029f, 0.0208929610f, 0.0211348906f, - 0.0213796217f, 0.0216271859f, 0.0218776166f, 0.0221309476f, 0.0223872103f, - 0.0226464439f, 0.0229086764f, 0.0231739469f, 0.0234422889f, 0.0237137377f, - 0.0239883289f, 0.0242661014f, 0.0245470889f, 0.0248313304f, 0.0251188632f, - 0.0254097264f, 0.0257039573f, 0.0260015968f, 0.0263026804f, 0.0266072508f, - 0.0269153472f, 0.0272270124f, 0.0275422875f, 0.0278612114f, 0.0281838290f, - 0.0285101831f, 0.0288403146f, 0.0291742701f, 0.0295120925f, 0.0298538264f, - 0.0301995166f, 0.0305492114f, 0.0309029538f, 0.0312607922f, 0.0316227786f, - 0.0319889523f, 0.0323593654f, 0.0327340700f, 0.0331131108f, 0.0334965438f, - 0.0338844173f, 0.0342767797f, 0.0346736833f, 0.0350751877f, 0.0354813375f, - 0.0358921923f, 0.0363078043f, 0.0367282294f, 0.0371535234f, 0.0375837386f, - 0.0380189382f, 0.0384591781f, 0.0389045142f, 0.0393550098f, 0.0398107171f, - 0.0402717032f, 0.0407380275f, 0.0412097536f, 0.0416869372f, 0.0421696492f, - 0.0426579528f, 0.0431519076f, 0.0436515845f, 0.0441570468f, 0.0446683578f, - 0.0451855958f, 0.0457088202f, 0.0462381020f, 0.0467735156f, 0.0473151244f, - 0.0478630103f, 0.0484172367f, 0.0489778817f, 0.0495450199f, 0.0501187220f, - 0.0506990701f, 0.0512861386f, 0.0518800057f, 0.0524807461f, 0.0530884452f, - 0.0537031814f, 0.0543250330f, 0.0549540855f, 0.0555904247f, 0.0562341325f, - 0.0568852946f, 0.0575439930f, 0.0582103208f, 0.0588843673f, 0.0595662147f, - 0.0602559596f, 0.0609536916f, 0.0616595000f, 0.0623734854f, 0.0630957335f, - 0.0638263524f, 0.0645654202f, 0.0653130561f, 0.0660693422f, 0.0668343902f, - 0.0676082969f, 0.0683911666f, 0.0691830963f, 0.0699841976f, 0.0707945749f, - 0.0716143399f, 0.0724435970f, 0.0732824504f, 0.0741310269f, 0.0749894232f, - 0.0758577585f, 0.0767361522f, 0.0776247084f, 0.0785235614f, 0.0794328228f, - 0.0803526118f, 0.0812830552f, 0.0822242647f, 0.0831763744f, 0.0841395110f, - 0.0851138011f, 0.0860993713f, 0.0870963559f, 0.0881048888f, 0.0891250968f, - 0.0901571140f, 0.0912010819f, 0.0922571421f, 0.0933254287f, 0.0944060907f, - 0.0954992622f, 0.0966050848f, 0.0977237225f, 0.0988553092f, 0.1000000015f, - 0.1011579484f, 0.1023292989f, 0.1035142168f, 0.1047128513f, 0.1059253737f, - 0.1071519330f, 0.1083926931f, 0.1096478179f, 0.1109174788f, 0.1122018471f, - 0.1135010794f, 0.1148153618f, 0.1161448583f, 0.1174897552f, 0.1188502237f, - 0.1202264428f, 0.1216185987f, 0.1230268776f, 0.1244514585f, 0.1258925349f, - 0.1273503006f, 0.1288249493f, 0.1303166747f, 0.1318256706f, 0.1333521456f, - 0.1348962933f, 0.1364583075f, 0.1380384266f, 0.1396368295f, 0.1412537545f, - 0.1428893954f, 0.1445439756f, 0.1462177187f, 0.1479108334f, 0.1496235728f, - 0.1513561308f, 0.1531087458f, 0.1548816562f, 0.1566751003f, 0.1584893167f, - 0.1603245437f, 0.1621810049f, 0.1640589833f, 0.1659586877f, 0.1678804010f, - 0.1698243618f, 0.1717908382f, 0.1737800837f, 0.1757923663f, 0.1778279394f, - 0.1798870862f, 0.1819700897f, 0.1840772033f, 0.1862087101f, 0.1883649081f, - 0.1905460656f, 0.1927524954f, 0.1949844658f, 0.1972422749f, 0.1995262355f, - 0.2018366307f, 0.2041737884f, 0.2065380216f, 0.2089296132f, 0.2113489062f, - 0.2137962133f, 0.2162718475f, 0.2187761664f, 0.2213094682f, 0.2238721102f, - 0.2264644355f, 0.2290867716f, 0.2317394614f, 0.2344228774f, 0.2371373773f, - 0.2398832887f, 0.2426610142f, 0.2454708964f, 0.2483133078f, 0.2511886358f, - 0.2540972829f, 0.2570395768f, 0.2600159645f, 0.2630268037f, 0.2660725117f, - 0.2691534758f, 0.2722701430f, 0.2754228711f, 0.2786121070f, 0.2818382978f, - 0.2851018310f, 0.2884031534f, 0.2917427123f, 0.2951209247f, 0.2985382676f, - 0.3019951582f, 0.3054921031f, 0.3090295494f, 0.3126079440f, 0.3162277639f, - 0.3198895156f, 0.3235936463f, 0.3273406923f, 0.3311311305f, 0.3349654377f, - 0.3388441503f, 0.3427677751f, 0.3467368484f, 0.3507518768f, 0.3548133969f, - 0.3589219451f, 0.3630780578f, 0.3672823012f, 0.3715352416f, 0.3758374155f, - 0.3801893890f, 0.3845917881f, 0.3890451491f, 0.3935500681f, 0.3981071711f, - 0.4027170241f, 0.4073802829f, 0.4120975137f, 0.4168693721f, 0.4216965139f, - 0.4265795052f, 0.4315190911f, 0.4365158379f, 0.4415704608f, 0.4466835856f, - 0.4518559575f, 0.4570882022f, 0.4623810351f, 0.4677351415f, 0.4731512666f, - 0.4786300957f, 0.4841723740f, 0.4897788167f, 0.4954501987f, 0.5011872053f, - 0.5069907308f, 0.5128613710f, 0.5188000202f, 0.5248074532f, 0.5308844447f, - 0.5370317698f, 0.5432503223f, 0.5495408773f, 0.5559042692f, 0.5623413324f, - 0.5688529015f, 0.5754399300f, 0.5821031928f, 0.5888436437f, 0.5956621170f, - 0.6025595665f, 0.6095368862f, 0.6165950298f, 0.6237348318f, 0.6309573650f, - 0.6382634640f, 0.6456542015f, 0.6531305313f, 0.6606934667f, 0.6683439016f, - 0.6760829687f, 0.6839116216f, 0.6918309927f, 0.6998419762f, 0.7079457641f, - 0.7161434293f, 0.7244359851f, 0.7328245044f, 0.7413102388f, 0.7498942018f, - 0.7585775852f, 0.7673614621f, 0.7762471437f, 0.7852356434f, 0.7943282127f, - 0.8035261035f, 0.8128305078f, 0.8222426772f, 0.8317637444f, 0.8413951397f, - 0.8511380553f, 0.8609937429f, 0.8709635735f, 0.8810488582f, 0.8912509084f, - 0.9015711546f, 0.9120108485f, 0.9225714207f, 0.9332543015f, 0.9440608621f, - 0.9549925923f, 0.9660508633f, 0.9772372246f, 0.9885531068f, 1.0000000000f, - 1.0115795135f, 1.0232930183f, 1.0351421833f, 1.0471285582f, 1.0592536926f, - 1.0715192556f, 1.0839269161f, 1.0964782238f, 1.1091748476f, 1.1220184565f, - 1.1350108385f, 1.1481536627f, 1.1614485979f, 1.1748975515f, 1.1885021925f, - 1.2022644281f, 1.2161860466f, 1.2302687168f, 1.2445145845f, 1.2589254379f, - 1.2735030651f, 1.2882494926f, 1.3031667471f, 1.3182567358f, 1.3335214853f, - 1.3489629030f, 1.3645831347f, 1.3803842068f, 1.3963683844f, 1.4125375748f, - 1.4288939238f, 1.4454398155f, 1.4621771574f, 1.4791083336f, 1.4962356091f, - 1.5135612488f, 1.5310875177f, 1.5488165617f, 1.5667511225f, 1.5848932266f, - 1.6032453775f, 1.6218100786f, 1.6405897141f, 1.6595869064f, 1.6788040400f, - 1.6982436180f, 1.7179083824f, 1.7378008366f, 1.7579236031f, 1.7782794237f, - 1.7988709211f, 1.8197008371f, 1.8407720327f, 1.8620871305f, 1.8836491108f, - 1.9054607153f, 1.9275249243f, 1.9498445988f, 1.9724227190f, 1.9952622652f}; + 0.0000000000f, 0.0000305492f, 0.0000309030f, 0.0000312608f, 0.0000316228f, 0.0000319890f, 0.0000323594f, 0.0000327341f, 0.0000331131f, + 0.0000334965f, 0.0000338844f, 0.0000342768f, 0.0000346737f, 0.0000350752f, 0.0000354813f, 0.0000358922f, 0.0000363078f, 0.0000367282f, + 0.0000371535f, 0.0000375837f, 0.0000380189f, 0.0000384592f, 0.0000389045f, 0.0000393550f, 0.0000398107f, 0.0000402717f, 0.0000407380f, + 0.0000412098f, 0.0000416869f, 0.0000421697f, 0.0000426580f, 0.0000431519f, 0.0000436516f, 0.0000441570f, 0.0000446684f, 0.0000451856f, + 0.0000457088f, 0.0000462381f, 0.0000467735f, 0.0000473151f, 0.0000478630f, 0.0000484172f, 0.0000489779f, 0.0000495450f, 0.0000501187f, + 0.0000506991f, 0.0000512861f, 0.0000518800f, 0.0000524807f, 0.0000530884f, 0.0000537032f, 0.0000543250f, 0.0000549541f, 0.0000555904f, + 0.0000562341f, 0.0000568853f, 0.0000575440f, 0.0000582103f, 0.0000588844f, 0.0000595662f, 0.0000602560f, 0.0000609537f, 0.0000616595f, + 0.0000623735f, 0.0000630957f, 0.0000638263f, 0.0000645654f, 0.0000653131f, 0.0000660693f, 0.0000668344f, 0.0000676083f, 0.0000683912f, + 0.0000691831f, 0.0000699842f, 0.0000707946f, 0.0000716143f, 0.0000724436f, 0.0000732825f, 0.0000741310f, 0.0000749894f, 0.0000758578f, + 0.0000767361f, 0.0000776247f, 0.0000785236f, 0.0000794328f, 0.0000803526f, 0.0000812831f, 0.0000822243f, 0.0000831764f, 0.0000841395f, + 0.0000851138f, 0.0000860994f, 0.0000870964f, 0.0000881049f, 0.0000891251f, 0.0000901571f, 0.0000912011f, 0.0000922571f, 0.0000933254f, + 0.0000944061f, 0.0000954993f, 0.0000966051f, 0.0000977237f, 0.0000988553f, 0.0001000000f, 0.0001011580f, 0.0001023290f, 0.0001035140f, + 0.0001047130f, 0.0001059250f, 0.0001071520f, 0.0001083930f, 0.0001096480f, 0.0001109170f, 0.0001122020f, 0.0001135010f, 0.0001148150f, + 0.0001161450f, 0.0001174900f, 0.0001188500f, 0.0001202260f, 0.0001216190f, 0.0001230270f, 0.0001244510f, 0.0001258930f, 0.0001273500f, + 0.0001288250f, 0.0001303170f, 0.0001318260f, 0.0001333520f, 0.0001348960f, 0.0001364580f, 0.0001380380f, 0.0001396370f, 0.0001412540f, + 0.0001428890f, 0.0001445440f, 0.0001462180f, 0.0001479110f, 0.0001496240f, 0.0001513560f, 0.0001531090f, 0.0001548820f, 0.0001566750f, + 0.0001584890f, 0.0001603250f, 0.0001621810f, 0.0001640590f, 0.0001659590f, 0.0001678800f, 0.0001698240f, 0.0001717910f, 0.0001737800f, + 0.0001757920f, 0.0001778280f, 0.0001798870f, 0.0001819700f, 0.0001840770f, 0.0001862090f, 0.0001883650f, 0.0001905460f, 0.0001927520f, + 0.0001949840f, 0.0001972420f, 0.0001995260f, 0.0002018370f, 0.0002041740f, 0.0002065380f, 0.0002089300f, 0.0002113490f, 0.0002137960f, + 0.0002162720f, 0.0002187760f, 0.0002213090f, 0.0002238720f, 0.0002264640f, 0.0002290870f, 0.0002317390f, 0.0002344230f, 0.0002371370f, + 0.0002398830f, 0.0002426610f, 0.0002454710f, 0.0002483130f, 0.0002511890f, 0.0002540970f, 0.0002570400f, 0.0002600160f, 0.0002630270f, + 0.0002660730f, 0.0002691530f, 0.0002722700f, 0.0002754230f, 0.0002786120f, 0.0002818380f, 0.0002851020f, 0.0002884030f, 0.0002917430f, + 0.0002951210f, 0.0002985380f, 0.0003019950f, 0.0003054920f, 0.0003090300f, 0.0003126080f, 0.0003162280f, 0.0003198900f, 0.0003235940f, + 0.0003273410f, 0.0003311310f, 0.0003349650f, 0.0003388440f, 0.0003427680f, 0.0003467370f, 0.0003507520f, 0.0003548130f, 0.0003589220f, + 0.0003630780f, 0.0003672820f, 0.0003715350f, 0.0003758370f, 0.0003801890f, 0.0003845920f, 0.0003890450f, 0.0003935500f, 0.0003981070f, + 0.0004027170f, 0.0004073800f, 0.0004120980f, 0.0004168690f, 0.0004216970f, 0.0004265800f, 0.0004315190f, 0.0004365160f, 0.0004415700f, + 0.0004466840f, 0.0004518560f, 0.0004570880f, 0.0004623810f, 0.0004677350f, 0.0004731510f, 0.0004786300f, 0.0004841720f, 0.0004897790f, + 0.0004954500f, 0.0005011870f, 0.0005069910f, 0.0005128610f, 0.0005188000f, 0.0005248070f, 0.0005308840f, 0.0005370320f, 0.0005432500f, + 0.0005495410f, 0.0005559040f, 0.0005623410f, 0.0005688530f, 0.0005754400f, 0.0005821030f, 0.0005888440f, 0.0005956620f, 0.0006025600f, + 0.0006095370f, 0.0006165950f, 0.0006237350f, 0.0006309570f, 0.0006382630f, 0.0006456540f, 0.0006531310f, 0.0006606930f, 0.0006683440f, + 0.0006760830f, 0.0006839120f, 0.0006918310f, 0.0006998420f, 0.0007079460f, 0.0007161430f, 0.0007244360f, 0.0007328250f, 0.0007413100f, + 0.0007498940f, 0.0007585780f, 0.0007673610f, 0.0007762470f, 0.0007852360f, 0.0007943280f, 0.0008035260f, 0.0008128310f, 0.0008222430f, + 0.0008317640f, 0.0008413950f, 0.0008511380f, 0.0008609940f, 0.0008709640f, 0.0008810490f, 0.0008912510f, 0.0009015710f, 0.0009120110f, + 0.0009225710f, 0.0009332540f, 0.0009440610f, 0.0009549930f, 0.0009660510f, 0.0009772370f, 0.0009885530f, 0.0010000000f, 0.0010115789f, + 0.0010232930f, 0.0010351420f, 0.0010471290f, 0.0010592540f, 0.0010715190f, 0.0010839270f, 0.0010964780f, 0.0011091750f, 0.0011220180f, + 0.0011350110f, 0.0011481540f, 0.0011614490f, 0.0011748980f, 0.0011885019f, 0.0012022640f, 0.0012161860f, 0.0012302690f, 0.0012445149f, + 0.0012589250f, 0.0012735029f, 0.0012882500f, 0.0013031670f, 0.0013182570f, 0.0013335210f, 0.0013489630f, 0.0013645830f, 0.0013803840f, + 0.0013963680f, 0.0014125380f, 0.0014288940f, 0.0014454400f, 0.0014621770f, 0.0014791080f, 0.0014962360f, 0.0015135610f, 0.0015310870f, + 0.0015488170f, 0.0015667510f, 0.0015848930f, 0.0016032450f, 0.0016218100f, 0.0016405900f, 0.0016595870f, 0.0016788041f, 0.0016982440f, + 0.0017179080f, 0.0017378010f, 0.0017579240f, 0.0017782790f, 0.0017988710f, 0.0018197011f, 0.0018407720f, 0.0018620871f, 0.0018836490f, + 0.0019054610f, 0.0019275250f, 0.0019498450f, 0.0019724229f, 0.0019952620f, 0.0020183660f, 0.0020417380f, 0.0020653801f, 0.0020892960f, + 0.0021134890f, 0.0021379620f, 0.0021627189f, 0.0021877619f, 0.0022130951f, 0.0022387209f, 0.0022646440f, 0.0022908680f, 0.0023173951f, + 0.0023442290f, 0.0023713741f, 0.0023988329f, 0.0024266101f, 0.0024547090f, 0.0024831330f, 0.0025118859f, 0.0025409730f, 0.0025703961f, + 0.0026001600f, 0.0026302680f, 0.0026607250f, 0.0026915350f, 0.0027227011f, 0.0027542289f, 0.0027861211f, 0.0028183830f, 0.0028510180f, + 0.0028840320f, 0.0029174271f, 0.0029512090f, 0.0029853829f, 0.0030199520f, 0.0030549210f, 0.0030902950f, 0.0031260790f, 0.0031622781f, + 0.0031988949f, 0.0032359371f, 0.0032734070f, 0.0033113109f, 0.0033496539f, 0.0033884421f, 0.0034276780f, 0.0034673689f, 0.0035075189f, + 0.0035481339f, 0.0035892189f, 0.0036307811f, 0.0036728231f, 0.0037153519f, 0.0037583739f, 0.0038018939f, 0.0038459180f, 0.0038904510f, + 0.0039355010f, 0.0039810720f, 0.0040271701f, 0.0040738028f, 0.0041209748f, 0.0041686939f, 0.0042169648f, 0.0042657950f, 0.0043151909f, + 0.0043651578f, 0.0044157039f, 0.0044668359f, 0.0045185592f, 0.0045708818f, 0.0046238098f, 0.0046773511f, 0.0047315131f, 0.0047863009f, + 0.0048417239f, 0.0048977882f, 0.0049545020f, 0.0050118719f, 0.0050699068f, 0.0051286141f, 0.0051879999f, 0.0052480749f, 0.0053088441f, + 0.0053703180f, 0.0054325028f, 0.0054954090f, 0.0055590430f, 0.0056234128f, 0.0056885290f, 0.0057543991f, 0.0058210320f, 0.0058884369f, + 0.0059566209f, 0.0060255961f, 0.0060953689f, 0.0061659501f, 0.0062373481f, 0.0063095731f, 0.0063826349f, 0.0064565418f, 0.0065313061f, + 0.0066069341f, 0.0066834390f, 0.0067608301f, 0.0068391161f, 0.0069183102f, 0.0069984202f, 0.0070794579f, 0.0071614338f, 0.0072443602f, + 0.0073282449f, 0.0074131018f, 0.0074989418f, 0.0075857760f, 0.0076736151f, 0.0077624712f, 0.0078523559f, 0.0079432819f, 0.0080352612f, + 0.0081283050f, 0.0082224263f, 0.0083176382f, 0.0084139509f, 0.0085113803f, 0.0086099384f, 0.0087096356f, 0.0088104894f, 0.0089125093f, + 0.0090157110f, 0.0091201076f, 0.0092257140f, 0.0093325432f, 0.0094406093f, 0.0095499260f, 0.0096605094f, 0.0097723724f, 0.0098855309f, + 0.0099999998f, 0.0101157948f, 0.0102329301f, 0.0103514222f, 0.0104712853f, 0.0105925370f, 0.0107151931f, 0.0108392686f, 0.0109647820f, + 0.0110917483f, 0.0112201851f, 0.0113501083f, 0.0114815356f, 0.0116144856f, 0.0117489761f, 0.0118850218f, 0.0120226443f, 0.0121618602f, + 0.0123026883f, 0.0124451462f, 0.0125892544f, 0.0127350306f, 0.0128824962f, 0.0130316680f, 0.0131825674f, 0.0133352140f, 0.0134896291f, + 0.0136458306f, 0.0138038434f, 0.0139636844f, 0.0141253751f, 0.0142889395f, 0.0144543983f, 0.0146217719f, 0.0147910845f, 0.0149623565f, + 0.0151356123f, 0.0153108751f, 0.0154881664f, 0.0156675112f, 0.0158489328f, 0.0160324536f, 0.0162181016f, 0.0164058972f, 0.0165958684f, + 0.0167880394f, 0.0169824362f, 0.0171790831f, 0.0173780080f, 0.0175792351f, 0.0177827943f, 0.0179887097f, 0.0181970093f, 0.0184077192f, + 0.0186208710f, 0.0188364908f, 0.0190546066f, 0.0192752499f, 0.0194984451f, 0.0197242275f, 0.0199526232f, 0.0201836638f, 0.0204173792f, + 0.0206538029f, 0.0208929610f, 0.0211348906f, 0.0213796217f, 0.0216271859f, 0.0218776166f, 0.0221309476f, 0.0223872103f, 0.0226464439f, + 0.0229086764f, 0.0231739469f, 0.0234422889f, 0.0237137377f, 0.0239883289f, 0.0242661014f, 0.0245470889f, 0.0248313304f, 0.0251188632f, + 0.0254097264f, 0.0257039573f, 0.0260015968f, 0.0263026804f, 0.0266072508f, 0.0269153472f, 0.0272270124f, 0.0275422875f, 0.0278612114f, + 0.0281838290f, 0.0285101831f, 0.0288403146f, 0.0291742701f, 0.0295120925f, 0.0298538264f, 0.0301995166f, 0.0305492114f, 0.0309029538f, + 0.0312607922f, 0.0316227786f, 0.0319889523f, 0.0323593654f, 0.0327340700f, 0.0331131108f, 0.0334965438f, 0.0338844173f, 0.0342767797f, + 0.0346736833f, 0.0350751877f, 0.0354813375f, 0.0358921923f, 0.0363078043f, 0.0367282294f, 0.0371535234f, 0.0375837386f, 0.0380189382f, + 0.0384591781f, 0.0389045142f, 0.0393550098f, 0.0398107171f, 0.0402717032f, 0.0407380275f, 0.0412097536f, 0.0416869372f, 0.0421696492f, + 0.0426579528f, 0.0431519076f, 0.0436515845f, 0.0441570468f, 0.0446683578f, 0.0451855958f, 0.0457088202f, 0.0462381020f, 0.0467735156f, + 0.0473151244f, 0.0478630103f, 0.0484172367f, 0.0489778817f, 0.0495450199f, 0.0501187220f, 0.0506990701f, 0.0512861386f, 0.0518800057f, + 0.0524807461f, 0.0530884452f, 0.0537031814f, 0.0543250330f, 0.0549540855f, 0.0555904247f, 0.0562341325f, 0.0568852946f, 0.0575439930f, + 0.0582103208f, 0.0588843673f, 0.0595662147f, 0.0602559596f, 0.0609536916f, 0.0616595000f, 0.0623734854f, 0.0630957335f, 0.0638263524f, + 0.0645654202f, 0.0653130561f, 0.0660693422f, 0.0668343902f, 0.0676082969f, 0.0683911666f, 0.0691830963f, 0.0699841976f, 0.0707945749f, + 0.0716143399f, 0.0724435970f, 0.0732824504f, 0.0741310269f, 0.0749894232f, 0.0758577585f, 0.0767361522f, 0.0776247084f, 0.0785235614f, + 0.0794328228f, 0.0803526118f, 0.0812830552f, 0.0822242647f, 0.0831763744f, 0.0841395110f, 0.0851138011f, 0.0860993713f, 0.0870963559f, + 0.0881048888f, 0.0891250968f, 0.0901571140f, 0.0912010819f, 0.0922571421f, 0.0933254287f, 0.0944060907f, 0.0954992622f, 0.0966050848f, + 0.0977237225f, 0.0988553092f, 0.1000000015f, 0.1011579484f, 0.1023292989f, 0.1035142168f, 0.1047128513f, 0.1059253737f, 0.1071519330f, + 0.1083926931f, 0.1096478179f, 0.1109174788f, 0.1122018471f, 0.1135010794f, 0.1148153618f, 0.1161448583f, 0.1174897552f, 0.1188502237f, + 0.1202264428f, 0.1216185987f, 0.1230268776f, 0.1244514585f, 0.1258925349f, 0.1273503006f, 0.1288249493f, 0.1303166747f, 0.1318256706f, + 0.1333521456f, 0.1348962933f, 0.1364583075f, 0.1380384266f, 0.1396368295f, 0.1412537545f, 0.1428893954f, 0.1445439756f, 0.1462177187f, + 0.1479108334f, 0.1496235728f, 0.1513561308f, 0.1531087458f, 0.1548816562f, 0.1566751003f, 0.1584893167f, 0.1603245437f, 0.1621810049f, + 0.1640589833f, 0.1659586877f, 0.1678804010f, 0.1698243618f, 0.1717908382f, 0.1737800837f, 0.1757923663f, 0.1778279394f, 0.1798870862f, + 0.1819700897f, 0.1840772033f, 0.1862087101f, 0.1883649081f, 0.1905460656f, 0.1927524954f, 0.1949844658f, 0.1972422749f, 0.1995262355f, + 0.2018366307f, 0.2041737884f, 0.2065380216f, 0.2089296132f, 0.2113489062f, 0.2137962133f, 0.2162718475f, 0.2187761664f, 0.2213094682f, + 0.2238721102f, 0.2264644355f, 0.2290867716f, 0.2317394614f, 0.2344228774f, 0.2371373773f, 0.2398832887f, 0.2426610142f, 0.2454708964f, + 0.2483133078f, 0.2511886358f, 0.2540972829f, 0.2570395768f, 0.2600159645f, 0.2630268037f, 0.2660725117f, 0.2691534758f, 0.2722701430f, + 0.2754228711f, 0.2786121070f, 0.2818382978f, 0.2851018310f, 0.2884031534f, 0.2917427123f, 0.2951209247f, 0.2985382676f, 0.3019951582f, + 0.3054921031f, 0.3090295494f, 0.3126079440f, 0.3162277639f, 0.3198895156f, 0.3235936463f, 0.3273406923f, 0.3311311305f, 0.3349654377f, + 0.3388441503f, 0.3427677751f, 0.3467368484f, 0.3507518768f, 0.3548133969f, 0.3589219451f, 0.3630780578f, 0.3672823012f, 0.3715352416f, + 0.3758374155f, 0.3801893890f, 0.3845917881f, 0.3890451491f, 0.3935500681f, 0.3981071711f, 0.4027170241f, 0.4073802829f, 0.4120975137f, + 0.4168693721f, 0.4216965139f, 0.4265795052f, 0.4315190911f, 0.4365158379f, 0.4415704608f, 0.4466835856f, 0.4518559575f, 0.4570882022f, + 0.4623810351f, 0.4677351415f, 0.4731512666f, 0.4786300957f, 0.4841723740f, 0.4897788167f, 0.4954501987f, 0.5011872053f, 0.5069907308f, + 0.5128613710f, 0.5188000202f, 0.5248074532f, 0.5308844447f, 0.5370317698f, 0.5432503223f, 0.5495408773f, 0.5559042692f, 0.5623413324f, + 0.5688529015f, 0.5754399300f, 0.5821031928f, 0.5888436437f, 0.5956621170f, 0.6025595665f, 0.6095368862f, 0.6165950298f, 0.6237348318f, + 0.6309573650f, 0.6382634640f, 0.6456542015f, 0.6531305313f, 0.6606934667f, 0.6683439016f, 0.6760829687f, 0.6839116216f, 0.6918309927f, + 0.6998419762f, 0.7079457641f, 0.7161434293f, 0.7244359851f, 0.7328245044f, 0.7413102388f, 0.7498942018f, 0.7585775852f, 0.7673614621f, + 0.7762471437f, 0.7852356434f, 0.7943282127f, 0.8035261035f, 0.8128305078f, 0.8222426772f, 0.8317637444f, 0.8413951397f, 0.8511380553f, + 0.8609937429f, 0.8709635735f, 0.8810488582f, 0.8912509084f, 0.9015711546f, 0.9120108485f, 0.9225714207f, 0.9332543015f, 0.9440608621f, + 0.9549925923f, 0.9660508633f, 0.9772372246f, 0.9885531068f, 1.0000000000f, 1.0115795135f, 1.0232930183f, 1.0351421833f, 1.0471285582f, + 1.0592536926f, 1.0715192556f, 1.0839269161f, 1.0964782238f, 1.1091748476f, 1.1220184565f, 1.1350108385f, 1.1481536627f, 1.1614485979f, + 1.1748975515f, 1.1885021925f, 1.2022644281f, 1.2161860466f, 1.2302687168f, 1.2445145845f, 1.2589254379f, 1.2735030651f, 1.2882494926f, + 1.3031667471f, 1.3182567358f, 1.3335214853f, 1.3489629030f, 1.3645831347f, 1.3803842068f, 1.3963683844f, 1.4125375748f, 1.4288939238f, + 1.4454398155f, 1.4621771574f, 1.4791083336f, 1.4962356091f, 1.5135612488f, 1.5310875177f, 1.5488165617f, 1.5667511225f, 1.5848932266f, + 1.6032453775f, 1.6218100786f, 1.6405897141f, 1.6595869064f, 1.6788040400f, 1.6982436180f, 1.7179083824f, 1.7378008366f, 1.7579236031f, + 1.7782794237f, 1.7988709211f, 1.8197008371f, 1.8407720327f, 1.8620871305f, 1.8836491108f, 1.9054607153f, 1.9275249243f, 1.9498445988f, + 1.9724227190f, 1.9952622652f}; const f32 Util::Pan2RatioTable[PAN_TABLE_SIZE] = { - 1.0000000000f, 0.9980449677f, 0.9960861206f, 0.9941233397f, 0.9921567440f, - 0.9901862144f, 0.9882117510f, 0.9862333536f, 0.9842509627f, 0.9822645783f, - 0.9802742004f, 0.9782797694f, 0.9762812257f, 0.9742785692f, 0.9722718000f, - 0.9702609181f, 0.9682458639f, 0.9662265778f, 0.9642030597f, 0.9621752501f, - 0.9601432085f, 0.9581068754f, 0.9560661316f, 0.9540210962f, 0.9519716501f, - 0.9499177337f, 0.9478594065f, 0.9457966089f, 0.9437292814f, 0.9416574240f, - 0.9395810366f, 0.9375000000f, 0.9354143739f, 0.9333240390f, 0.9312290549f, - 0.9291293025f, 0.9270247817f, 0.9249155521f, 0.9228014350f, 0.9206824899f, - 0.9185586572f, 0.9164298773f, 0.9142961502f, 0.9121574759f, 0.9100137353f, - 0.9078649282f, 0.9057110548f, 0.9035519958f, 0.9013878107f, 0.8992184401f, - 0.8970437646f, 0.8948638439f, 0.8926785588f, 0.8904879093f, 0.8882918954f, - 0.8860904574f, 0.8838834763f, 0.8816710114f, 0.8794529438f, 0.8772292733f, - 0.8750000000f, 0.8727650046f, 0.8705242872f, 0.8682777286f, 0.8660253882f, - 0.8637672067f, 0.8615030646f, 0.8592329621f, 0.8569568396f, 0.8546746373f, - 0.8523863554f, 0.8500919342f, 0.8477912545f, 0.8454843163f, 0.8431711197f, - 0.8408514857f, 0.8385254741f, 0.8361930251f, 0.8338540196f, 0.8315083981f, - 0.8291562200f, 0.8267973065f, 0.8244315982f, 0.8220591545f, 0.8196797967f, - 0.8172935247f, 0.8149002790f, 0.8125000000f, 0.8100925684f, 0.8076779842f, - 0.8052561879f, 0.8028270602f, 0.8003905416f, 0.7979465723f, 0.7954951525f, - 0.7930361032f, 0.7905694246f, 0.7880949974f, 0.7856128216f, 0.7831227779f, - 0.7806247473f, 0.7781187296f, 0.7756046057f, 0.7730823159f, 0.7705517411f, - 0.7680128813f, 0.7654655576f, 0.7629097104f, 0.7603453398f, 0.7577722073f, - 0.7551903725f, 0.7525996566f, 0.7500000000f, 0.7473912835f, 0.7447734475f, - 0.7421463728f, 0.7395099998f, 0.7368641496f, 0.7342087626f, 0.7315437198f, - 0.7288689613f, 0.7261843681f, 0.7234898210f, 0.7207851410f, 0.7180703282f, - 0.7153452039f, 0.7126096487f, 0.7098635435f, 0.7071067691f, 0.7043392062f, - 0.7015607357f, 0.6987712383f, 0.6959705353f, 0.6931585073f, 0.6903350353f, - 0.6875000000f, 0.6846532226f, 0.6817945242f, 0.6789237857f, 0.6760408878f, - 0.6731455922f, 0.6702378392f, 0.6673173904f, 0.6643841267f, 0.6614378095f, - 0.6584783792f, 0.6555055380f, 0.6525191665f, 0.6495190263f, 0.6465049982f, - 0.6434769034f, 0.6404344440f, 0.6373774409f, 0.6343057156f, 0.6312190294f, - 0.6281172037f, 0.6250000000f, 0.6218671203f, 0.6187184453f, 0.6155536175f, - 0.6123724580f, 0.6091746688f, 0.6059600115f, 0.6027281880f, 0.5994789600f, - 0.5962120295f, 0.5929270387f, 0.5896238089f, 0.5863019824f, 0.5829612017f, - 0.5796011686f, 0.5762215257f, 0.5728219748f, 0.5694020987f, 0.5659615993f, - 0.5625000000f, 0.5590170026f, 0.5555121303f, 0.5519850254f, 0.5484352708f, - 0.5448623896f, 0.5412659049f, 0.5376453400f, 0.5340002179f, 0.5303300619f, - 0.5266343355f, 0.5229125023f, 0.5191639662f, 0.5153881907f, 0.5115845203f, - 0.5077524185f, 0.5038911104f, 0.5000000000f, 0.4960783720f, 0.4921254814f, - 0.4881406128f, 0.4841229320f, 0.4800716043f, 0.4759858251f, 0.4718646407f, - 0.4677071869f, 0.4635123909f, 0.4592793286f, 0.4550068676f, 0.4506939054f, - 0.4463392794f, 0.4419417381f, 0.4375000000f, 0.4330126941f, 0.4284784198f, - 0.4238956273f, 0.4192627370f, 0.4145781100f, 0.4098398983f, 0.4050462842f, - 0.4001952708f, 0.3952847123f, 0.3903123736f, 0.3852758706f, 0.3801726699f, - 0.3750000000f, 0.3697549999f, 0.3644344807f, 0.3590351641f, 0.3535533845f, - 0.3479852676f, 0.3423266113f, 0.3365727961f, 0.3307189047f, 0.3247595131f, - 0.3186887205f, 0.3125000000f, 0.3061862290f, 0.2997394800f, 0.2931509912f, - 0.2864109874f, 0.2795085013f, 0.2724311948f, 0.2651650310f, 0.2576940954f, - 0.2500000000f, 0.2420614660f, 0.2338535935f, 0.2253469527f, 0.2165063471f, - 0.2072890550f, 0.1976423562f, 0.1875000000f, 0.1767766923f, 0.1653594524f, - 0.1530931145f, 0.1397542506f, 0.1250000000f, 0.1082531735f, 0.0883883461f, - 0.0625000000f, 0.0000000000f - }; - } - } -} + 1.0000000000f, 0.9980449677f, 0.9960861206f, 0.9941233397f, 0.9921567440f, 0.9901862144f, 0.9882117510f, 0.9862333536f, 0.9842509627f, + 0.9822645783f, 0.9802742004f, 0.9782797694f, 0.9762812257f, 0.9742785692f, 0.9722718000f, 0.9702609181f, 0.9682458639f, 0.9662265778f, + 0.9642030597f, 0.9621752501f, 0.9601432085f, 0.9581068754f, 0.9560661316f, 0.9540210962f, 0.9519716501f, 0.9499177337f, 0.9478594065f, + 0.9457966089f, 0.9437292814f, 0.9416574240f, 0.9395810366f, 0.9375000000f, 0.9354143739f, 0.9333240390f, 0.9312290549f, 0.9291293025f, + 0.9270247817f, 0.9249155521f, 0.9228014350f, 0.9206824899f, 0.9185586572f, 0.9164298773f, 0.9142961502f, 0.9121574759f, 0.9100137353f, + 0.9078649282f, 0.9057110548f, 0.9035519958f, 0.9013878107f, 0.8992184401f, 0.8970437646f, 0.8948638439f, 0.8926785588f, 0.8904879093f, + 0.8882918954f, 0.8860904574f, 0.8838834763f, 0.8816710114f, 0.8794529438f, 0.8772292733f, 0.8750000000f, 0.8727650046f, 0.8705242872f, + 0.8682777286f, 0.8660253882f, 0.8637672067f, 0.8615030646f, 0.8592329621f, 0.8569568396f, 0.8546746373f, 0.8523863554f, 0.8500919342f, + 0.8477912545f, 0.8454843163f, 0.8431711197f, 0.8408514857f, 0.8385254741f, 0.8361930251f, 0.8338540196f, 0.8315083981f, 0.8291562200f, + 0.8267973065f, 0.8244315982f, 0.8220591545f, 0.8196797967f, 0.8172935247f, 0.8149002790f, 0.8125000000f, 0.8100925684f, 0.8076779842f, + 0.8052561879f, 0.8028270602f, 0.8003905416f, 0.7979465723f, 0.7954951525f, 0.7930361032f, 0.7905694246f, 0.7880949974f, 0.7856128216f, + 0.7831227779f, 0.7806247473f, 0.7781187296f, 0.7756046057f, 0.7730823159f, 0.7705517411f, 0.7680128813f, 0.7654655576f, 0.7629097104f, + 0.7603453398f, 0.7577722073f, 0.7551903725f, 0.7525996566f, 0.7500000000f, 0.7473912835f, 0.7447734475f, 0.7421463728f, 0.7395099998f, + 0.7368641496f, 0.7342087626f, 0.7315437198f, 0.7288689613f, 0.7261843681f, 0.7234898210f, 0.7207851410f, 0.7180703282f, 0.7153452039f, + 0.7126096487f, 0.7098635435f, 0.7071067691f, 0.7043392062f, 0.7015607357f, 0.6987712383f, 0.6959705353f, 0.6931585073f, 0.6903350353f, + 0.6875000000f, 0.6846532226f, 0.6817945242f, 0.6789237857f, 0.6760408878f, 0.6731455922f, 0.6702378392f, 0.6673173904f, 0.6643841267f, + 0.6614378095f, 0.6584783792f, 0.6555055380f, 0.6525191665f, 0.6495190263f, 0.6465049982f, 0.6434769034f, 0.6404344440f, 0.6373774409f, + 0.6343057156f, 0.6312190294f, 0.6281172037f, 0.6250000000f, 0.6218671203f, 0.6187184453f, 0.6155536175f, 0.6123724580f, 0.6091746688f, + 0.6059600115f, 0.6027281880f, 0.5994789600f, 0.5962120295f, 0.5929270387f, 0.5896238089f, 0.5863019824f, 0.5829612017f, 0.5796011686f, + 0.5762215257f, 0.5728219748f, 0.5694020987f, 0.5659615993f, 0.5625000000f, 0.5590170026f, 0.5555121303f, 0.5519850254f, 0.5484352708f, + 0.5448623896f, 0.5412659049f, 0.5376453400f, 0.5340002179f, 0.5303300619f, 0.5266343355f, 0.5229125023f, 0.5191639662f, 0.5153881907f, + 0.5115845203f, 0.5077524185f, 0.5038911104f, 0.5000000000f, 0.4960783720f, 0.4921254814f, 0.4881406128f, 0.4841229320f, 0.4800716043f, + 0.4759858251f, 0.4718646407f, 0.4677071869f, 0.4635123909f, 0.4592793286f, 0.4550068676f, 0.4506939054f, 0.4463392794f, 0.4419417381f, + 0.4375000000f, 0.4330126941f, 0.4284784198f, 0.4238956273f, 0.4192627370f, 0.4145781100f, 0.4098398983f, 0.4050462842f, 0.4001952708f, + 0.3952847123f, 0.3903123736f, 0.3852758706f, 0.3801726699f, 0.3750000000f, 0.3697549999f, 0.3644344807f, 0.3590351641f, 0.3535533845f, + 0.3479852676f, 0.3423266113f, 0.3365727961f, 0.3307189047f, 0.3247595131f, 0.3186887205f, 0.3125000000f, 0.3061862290f, 0.2997394800f, + 0.2931509912f, 0.2864109874f, 0.2795085013f, 0.2724311948f, 0.2651650310f, 0.2576940954f, 0.2500000000f, 0.2420614660f, 0.2338535935f, + 0.2253469527f, 0.2165063471f, 0.2072890550f, 0.1976423562f, 0.1875000000f, 0.1767766923f, 0.1653594524f, 0.1530931145f, 0.1397542506f, + 0.1250000000f, 0.1082531735f, 0.0883883461f, 0.0625000000f, 0.0000000000f}; + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_WaveFile.cpp b/libs/NW4R/src/snd/snd_WaveFile.cpp index 6063b25a..04c1545e 100644 --- a/libs/NW4R/src/snd/snd_WaveFile.cpp +++ b/libs/NW4R/src/snd/snd_WaveFile.cpp @@ -4,8 +4,8 @@ namespace nw4r { namespace snd { namespace detail { - WaveFileReader::WaveFileReader(const WaveFile::WaveInfo* waveInfo) : - mWaveInfo(waveInfo) {} + WaveFileReader::WaveFileReader(const WaveFile::WaveInfo* waveInfo) : mWaveInfo(waveInfo) { + } bool WaveFileReader::ReadWaveParam(WaveData* waveData, const void* waveAddr) const { waveData->format = mWaveInfo->format; @@ -21,7 +21,8 @@ namespace nw4r { for (int i = 0; i < mWaveInfo->numChannels; i++) { ChannelParam& rParam = waveData->channelParam[i]; - const WaveFile::WaveChannelInfo* pChannelInfo = reinterpret_cast(ut::AddOffsetToPtr(mWaveInfo, pInfoOffsetTable[i])); + const WaveFile::WaveChannelInfo* pChannelInfo = + reinterpret_cast(ut::AddOffsetToPtr(mWaveInfo, pInfoOffsetTable[i])); rParam.volumeFrontLeft = pChannelInfo->volumeFrontLeft; rParam.volumeFrontRight = pChannelInfo->volumeFrontRight; @@ -50,6 +51,6 @@ namespace nw4r { return AxVoice::FORMAT_ADPCM; } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_WavePlayer.cpp b/libs/NW4R/src/snd/snd_WavePlayer.cpp index e0780223..5e5a7173 100644 --- a/libs/NW4R/src/snd/snd_WavePlayer.cpp +++ b/libs/NW4R/src/snd/snd_WavePlayer.cpp @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -11,16 +11,9 @@ namespace nw4r { WavePlayerList sPlayerList; } - WavePlayer::WavePlayer() : - mStartFlag(false), - mVoiceStartFlag(false), - mChannelCount(0), - mVoice(NULL), - mLoopSetFlag(false), - mCallback(NULL), - mCallbackArg(NULL), - mPauseFlag(false), - mPlaySampleCount(0) { + WavePlayer::WavePlayer() + : mStartFlag(false), mVoiceStartFlag(false), mChannelCount(0), mVoice(NULL), mLoopSetFlag(false), mCallback(NULL), mCallbackArg(NULL), + mPauseFlag(false), mPlaySampleCount(0) { InitParam(); } @@ -123,18 +116,18 @@ namespace nw4r { void WavePlayer::Start() { ut::AutoInterruptLock lock; - + if (mPauseFlag) { Pause(false); } - + if (!mStartFlag) { sPlayerList.PushBack(this); mStartFlag = true; } - + mPlaySampleCount = 0; - + if (!mWavePacketList.IsEmpty()) { StartVoice(); } @@ -187,7 +180,7 @@ namespace nw4r { detail::WaveData waveData; detail::AxVoice::Format axVoiceFormat; - switch(mSampleFormat) { + switch (mSampleFormat) { case SAMPLE_FORMAT_PCM_S16: { waveData.format = detail::WaveFile::FORMAT_PCM16; axVoiceFormat = detail::AxVoice::FORMAT_PCM16; @@ -352,8 +345,7 @@ namespace nw4r { } SetNextWavePacket(); - } - else { + } else { if (!mWavePacketList.IsEmpty()) { StartVoice(); } @@ -399,12 +391,10 @@ namespace nw4r { } } - WavePlayer::WavePacket::WavePacket() : - mWaveBuffer(), - mAppendFlag(false) { + WavePlayer::WavePacket::WavePacket() : mWaveBuffer(), mAppendFlag(false) { for (int i = 0; i < CHANNEL_MAX; i++) { mWaveBuffer.bufferAddress[i] = NULL; } } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_WaveSound.cpp b/libs/NW4R/src/snd/snd_WaveSound.cpp index 091187c3..90aea1b9 100644 --- a/libs/NW4R/src/snd/snd_WaveSound.cpp +++ b/libs/NW4R/src/snd/snd_WaveSound.cpp @@ -8,11 +8,11 @@ namespace nw4r { namespace detail { NW4R_UT_GET_DERIVED_RUNTIME_TYPEINFO(WaveSound, BasicSound); - WaveSound::WaveSound(SoundInstanceManager* manager) : - mManager(manager), - mTempSpecialHandle(NULL) {} + WaveSound::WaveSound(SoundInstanceManager* manager) : mManager(manager), mTempSpecialHandle(NULL) { + } - bool WaveSound::Prepare(const void* waveSoundBase, s32 waveSoundOffset, int voices, const WsdTrack::WsdCallback* callback, u32 callbackData) { + bool WaveSound::Prepare(const void* waveSoundBase, s32 waveSoundOffset, int voices, const WsdTrack::WsdCallback* callback, + u32 callbackData) { InitParam(); if (!mWsdPlayer.Prepare(waveSoundBase, waveSoundOffset, voices, callback, callbackData)) { @@ -43,6 +43,6 @@ namespace nw4r { void WaveSound::DetachTempSpecialHandle() { mTempSpecialHandle->DetachSound(); } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_WaveSoundHandle.cpp b/libs/NW4R/src/snd/snd_WaveSoundHandle.cpp index adb6a664..43913443 100644 --- a/libs/NW4R/src/snd/snd_WaveSoundHandle.cpp +++ b/libs/NW4R/src/snd/snd_WaveSoundHandle.cpp @@ -13,5 +13,5 @@ namespace nw4r { mSound = NULL; } } - } -} + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_WsdFile.cpp b/libs/NW4R/src/snd/snd_WsdFile.cpp index 3d1464ce..41248276 100644 --- a/libs/NW4R/src/snd/snd_WsdFile.cpp +++ b/libs/NW4R/src/snd/snd_WsdFile.cpp @@ -6,8 +6,7 @@ namespace nw4r { namespace snd { namespace detail { bool WsdFileReader::IsValidFileHeader(const void* waveData) { - const ut::BinaryFileHeader* pFileHeader = - static_cast(waveData); + const ut::BinaryFileHeader* pFileHeader = static_cast(waveData); if (pFileHeader->signature != SIGNATURE) { return false; @@ -24,10 +23,7 @@ namespace nw4r { return true; } - WsdFileReader::WsdFileReader(const void* waveData) : - mHeader(NULL), - mDataBlock(NULL), - mWaveBlock(NULL) { + WsdFileReader::WsdFileReader(const void* waveData) : mHeader(NULL), mDataBlock(NULL), mWaveBlock(NULL) { if (!IsValidFileHeader(waveData)) { return; } @@ -49,8 +45,7 @@ namespace nw4r { soundInfo->fxSendB = pWsdInfo->fxSendB; soundInfo->fxSendC = pWsdInfo->fxSendC; soundInfo->mainSend = pWsdInfo->mainSend; - } - else if (mHeader->fileHeader.version == NW4R_VERSION(1, 1)) { + } else if (mHeader->fileHeader.version == NW4R_VERSION(1, 1)) { soundInfo->pitch = pWsdInfo->pitch; soundInfo->pan = pWsdInfo->pan; soundInfo->surroundPan = pWsdInfo->surroundPan; @@ -58,8 +53,7 @@ namespace nw4r { soundInfo->fxSendB = 0; soundInfo->fxSendC = 0; soundInfo->mainSend = 127; - } - else { + } else { soundInfo->pitch = 1.0f; soundInfo->pan = 64; soundInfo->surroundPan = 0; @@ -89,8 +83,7 @@ namespace nw4r { soundNoteInfo->pan = noteInfo->pan; soundNoteInfo->surroundPan = noteInfo->surroundPan; soundNoteInfo->pitch = noteInfo->pitch; - } - else { + } else { soundNoteInfo->pan = 64; soundNoteInfo->surroundPan = 0; soundNoteInfo->pitch = 1.0f; @@ -105,8 +98,7 @@ namespace nw4r { if (mHeader->fileHeader.version == NW4R_VERSION(1, 0)) { const WsdFile::WaveBlockOld* waveBlockOld = reinterpret_cast(mWaveBlock); waveInfo = static_cast(ut::AddOffsetToPtr(waveBlockOld, waveBlockOld->offsetTable[id])); - } - else { + } else { if (id >= mWaveBlock->waveCount) { return false; } @@ -117,6 +109,6 @@ namespace nw4r { WaveFileReader reader(waveInfo); return reader.ReadWaveParam(waveData, waveAddr); } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_WsdPlayer.cpp b/libs/NW4R/src/snd/snd_WsdPlayer.cpp index 012b5878..d22a67b1 100644 --- a/libs/NW4R/src/snd/snd_WsdPlayer.cpp +++ b/libs/NW4R/src/snd/snd_WsdPlayer.cpp @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -12,12 +12,8 @@ namespace nw4r { WsdPlayerList sPlayerList; } - WsdPlayer::WsdPlayer() : - BasicPlayer(), - DisposeCallback(), - mPlayerLink(), - mActiveFlag(false), - mTrack() {} + WsdPlayer::WsdPlayer() : BasicPlayer(), DisposeCallback(), mPlayerLink(), mActiveFlag(false), mTrack() { + } void WsdPlayer::InitParam(int voices, const WsdTrack::WsdCallback* callback, u32 callbackData) { mPreparedFlag = false; @@ -36,7 +32,7 @@ namespace nw4r { mOutputLineFlag = OUTPUT_LINE_MAIN; mMainOutVolume = 1.0f; mMainSend = 0.0f; - for (int i = 0; i(prio); } - void WsdPlayer::InvalidateData(const void* start, const void* end) { + void WsdPlayer::InvalidateData(const void* start, const void* end) { ut::AutoInterruptLock lock; if (mActiveFlag) { @@ -230,15 +226,13 @@ namespace nw4r { if (mTrack.ParseNextTick(mCallback, mCallbackData, doNoteOn) >= 0) { active = true; - } - else { + } else { mTrack.Close(); } if (!active) { return TRUE; - } - else { + } else { return FALSE; } } @@ -278,6 +272,6 @@ namespace nw4r { currIt->Stop(); } } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/snd/snd_WsdTrack.cpp b/libs/NW4R/src/snd/snd_WsdTrack.cpp index fe1e35c3..856026ac 100644 --- a/libs/NW4R/src/snd/snd_WsdTrack.cpp +++ b/libs/NW4R/src/snd/snd_WsdTrack.cpp @@ -1,5 +1,6 @@ -#include #include +#include + #include @@ -40,7 +41,7 @@ namespace nw4r { for (Channel* channel = mChannelList; channel != NULL; channel = channel->GetNextTrackChannel()) { s32 length = channel->GetLength(); if (length > 0) { - channel->SetLength(length-1); + channel->SetLength(length - 1); if (!channel->IsAutoUpdateSweep()) { channel->UpdateSweep(1); } @@ -96,8 +97,7 @@ namespace nw4r { f32 pan = 0.0f; if (mWaveSoundInfo.pan <= 1) { pan += (mWaveSoundInfo.pan - 63) / 63.0f; - } - else { + } else { pan += (mWaveSoundInfo.pan - 64) / 63.0f; } @@ -107,8 +107,7 @@ namespace nw4r { f32 surroundPan = 0.0f; if (mWaveSoundInfo.surroundPan <= 1) { surroundPan += (mWaveSoundInfo.surroundPan + 1) / 63.0f; - } - else { + } else { surroundPan += mWaveSoundInfo.surroundPan / 63.0f; } @@ -197,9 +196,7 @@ namespace nw4r { if (mCounter == 0) { int priority = mWsdPlayer->GetChannelPriority() + mPriority; - bool result = callback->GetWaveSoundData(&mWaveSoundInfo, ¬eInfo, - &waveData, mWsdData, - mIndex, 0, callbackData); + bool result = callback->GetWaveSoundData(&mWaveSoundInfo, ¬eInfo, &waveData, mWsdData, mIndex, 0, callbackData); if (!result) { return -1; } @@ -219,10 +216,9 @@ namespace nw4r { channel->Start(waveData, -1); AddChannel(channel); - + mCounter++; - } - else { + } else { if (mChannelList == NULL) { return -1; } @@ -249,6 +245,6 @@ namespace nw4r { } } } - } - } -} + } // namespace detail + } // namespace snd +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_CharStrmReader.cpp b/libs/NW4R/src/ut/ut_CharStrmReader.cpp index 7372d52c..6f25cdf8 100644 --- a/libs/NW4R/src/ut/ut_CharStrmReader.cpp +++ b/libs/NW4R/src/ut/ut_CharStrmReader.cpp @@ -12,12 +12,10 @@ namespace nw4r { if ((GetChar(0) & 0x80) == 0x00) { code = GetChar(0); StepStrm(1); - } - else if ((GetChar(0) & 0xE0) == 0xC0) { + } else if ((GetChar(0) & 0xE0) == 0xC0) { code = (GetChar(0) & 0x1F) << 6 | (GetChar(1) & 0x3F); StepStrm(2); - } - else { + } else { code = (GetChar(0) & 0x1F) << 12 | (GetChar(1) & 0x3F) << 6 | (GetChar(2) & 0x3F); StepStrm(3); } @@ -45,13 +43,12 @@ namespace nw4r { if (IsSJISLeadByte(GetChar(0))) { code = GetChar(0) << 8 | GetChar(1); StepStrm(2); - } - else { + } else { code = GetChar(0); StepStrm(1); } return code; } - } -} + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_CharWriter.cpp b/libs/NW4R/src/ut/ut_CharWriter.cpp index a6ac3065..959850b7 100644 --- a/libs/NW4R/src/ut/ut_CharWriter.cpp +++ b/libs/NW4R/src/ut/ut_CharWriter.cpp @@ -5,17 +5,17 @@ namespace nw4r { void SetupGXCommon() { static ut::Color fog(ut::Color::NOCOLOR); - + GXSetFog(GX_FOG_NONE, 0.0f, 0.0f, 0.0f, 0.0f, fog); - + GXSetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA); GXSetZTexture(GX_ZT_DISABLE, GX_TF_Z8, 0); - + GXSetNumChans(1); - + GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); GXSetChanCtrl(GX_COLOR1A1, GX_FALSE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); - + GXSetNumTexGens(1); GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); GXSetNumIndStages(0); @@ -23,13 +23,9 @@ namespace nw4r { } namespace ut { - CharWriter::LoadingTexture CharWriter::mLoadingTexture; + CharWriter::LoadingTexture CharWriter::mLoadingTexture; - CharWriter::CharWriter() : - mAlpha(255), - mIsWidthFixed(false), - mFixedWidth(0.0f), - mFont(NULL) { + CharWriter::CharWriter() : mAlpha(255), mIsWidthFixed(false), mFixedWidth(0.0f), mFont(NULL) { mLoadingTexture.Reset(); ResetColorMapping(); SetGradationMode(GRADMODE_NONE); @@ -39,23 +35,22 @@ namespace nw4r { EnableLinearFilter(true, true); } - CharWriter::~CharWriter() {} + CharWriter::~CharWriter() { + } void CharWriter::SetFont(const Font& font) { mFont = &font; } - const Font *CharWriter::GetFont() const { + const Font* CharWriter::GetFont() const { return mFont; } void CharWriter::SetupGX() { ResetTextureCache(); - if (mColorMapping.min != DEFAULT_COLOR_MAPPING_MIN - || mColorMapping.max != DEFAULT_COLOR_MAPPING_MAX) { + if (mColorMapping.min != DEFAULT_COLOR_MAPPING_MIN || mColorMapping.max != DEFAULT_COLOR_MAPPING_MAX) { SetupGXWithColorMapping(mColorMapping.min, mColorMapping.max); - } - else if (mFont) { + } else if (mFont) { GXTexFmt format = mFont->GetTextureFormat(); switch (format) { case GX_TF_I4: @@ -79,8 +74,7 @@ namespace nw4r { break; } } - } - else { + } else { SetupGXDefault(); } } @@ -190,8 +184,7 @@ namespace nw4r { width = mFixedWidth; left = margin + widths.left * mScale.x; - } - else { + } else { width = widths.charWidth * mScale.x; left = widths.left * mScale.x; } @@ -251,7 +244,8 @@ namespace nw4r { LoadTexture(glyph, GX_TEXMAP0); - GXBegin(GX_QUADS, GX_VTXFMT0, 4); { + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + { GXPosition3f32(posLeft, posTop, posZ); GXColor1u32(mVertexColor.lu); GXTexCoord2u16(texLeft, texTop); @@ -267,7 +261,8 @@ namespace nw4r { GXPosition3f32(posLeft, posBottom, posZ); GXColor1u32(mVertexColor.ld); GXTexCoord2u16(texLeft, texBottom); - } GXEnd(); + } + GXEnd(); } void CharWriter::LoadTexture(const Glyph& glyph, GXTexMapID slot) { @@ -368,5 +363,5 @@ namespace nw4r { void CharWriter::SetupGXForRGBA() { SetupGXDefault(); } - } -} + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_DvdFileStream.cpp b/libs/NW4R/src/ut/ut_DvdFileStream.cpp index 2216f3d5..15db8498 100644 --- a/libs/NW4R/src/ut/ut_DvdFileStream.cpp +++ b/libs/NW4R/src/ut/ut_DvdFileStream.cpp @@ -8,176 +8,172 @@ namespace nw4r { void DvdFileStream::DvdAsyncCallback_(s32 result, DVDFileInfo* info) { DvdFileStream* p = reinterpret_cast(info)->stream; - + p->mIsBusy = false; p->mAsyncResult = result; - + if (p->mCallback != NULL) { p->mCallback(result, p, p->mArg); } } - + void DvdFileStream::DvdCBAsyncCallback_(s32 result, DVDCommandBlock* pcb) { DvdFileStream* p = reinterpret_cast(pcb)->stream; - + p->mIsCanceling = false; - + if (p->mCancelCallback != NULL) { p->mCancelCallback(result, p, p->mCancelArg); } } - + void DvdFileStream::Initialize_() { mCloseOnDestroyFlg = false; mCloseEnableFlg = false; - + mAvailable = false; mPriority = 2; mIsBusy = false; - + mCallback = NULL; mArg = NULL; mAsyncResult = DVD_RESULT_OK; - + mCancelCallback = NULL; mIsCanceling = false; mCancelArg = NULL; - + mFileInfo.stream = this; } - + DvdFileStream::DvdFileStream(s32 entrynum) { Initialize_(); Open(entrynum); } - + DvdFileStream::DvdFileStream(const DVDFileInfo* info, bool close) { Initialize_(); Open(info, close); } - + DvdFileStream::~DvdFileStream() { if (mCloseOnDestroyFlg) { Close(); } } - + bool DvdFileStream::Open(s32 entrynum) { if (mCloseOnDestroyFlg) { Close(); } - + if (DVDFastOpen(entrynum, &mFileInfo.dvdInfo)) { mFilePosition.SetFileSize(mFileInfo.dvdInfo.length); mFilePosition.Seek(0, SEEK_BEG); - + mCloseOnDestroyFlg = true; mCloseEnableFlg = true; mAvailable = true; - + return true; } - + return false; } - + bool DvdFileStream::Open(const DVDFileInfo* info, bool close) { if (mCloseOnDestroyFlg) { Close(); } - + mFileInfo.dvdInfo = *info; mFilePosition.SetFileSize(mFileInfo.dvdInfo.length); mFilePosition.Seek(0, SEEK_BEG); - + mCloseOnDestroyFlg = false; mCloseEnableFlg = close; mAvailable = true; - + return true; } - + void DvdFileStream::Close() { if (mCloseEnableFlg && mAvailable) { DVDClose(&mFileInfo.dvdInfo); mAvailable = false; } } - + s32 DvdFileStream::Read(void* pDst, u32 size) { size = AdjustReadLength_(size); - + s32 result = DVDReadPrio(&mFileInfo.dvdInfo, pDst, size, mFilePosition.Tell(), mPriority); - + mFilePosition.Skip(result); - + return result; } - - bool DvdFileStream::ReadAsync(void* pDst, u32 size, IOStreamCallback callback, - void* callbackArg) { + + bool DvdFileStream::ReadAsync(void* pDst, u32 size, IOStreamCallback callback, void* callbackArg) { size = AdjustReadLength_(size); - - bool success = - DvdFileStream::PeekAsync(pDst, size, callback, callbackArg); - + + bool success = DvdFileStream::PeekAsync(pDst, size, callback, callbackArg); + if (success) { mFilePosition.Skip(size); - } - else { + } else { mIsBusy = false; } - + return success; } - + s32 DvdFileStream::Peek(void* pDst, u32 size) { size = AdjustReadLength_(size); - + return DVDReadPrio(&mFileInfo.dvdInfo, pDst, size, mFilePosition.Tell(), mPriority); } - + bool DvdFileStream::PeekAsync(void* pDst, u32 size, IOStreamCallback callback, void* callbackArg) { mCallback = callback; mArg = callbackArg; mIsBusy = true; - + size = AdjustReadLength_(size); - + return DVDReadAsyncPrio(&mFileInfo.dvdInfo, pDst, size, mFilePosition.Tell(), DvdAsyncCallback_, mPriority); } - + void DvdFileStream::Seek(s32 offset, u32 origin) { mFilePosition.Seek(offset, origin); } - + void DvdFileStream::Cancel() { DVDCancel(&mFileInfo.dvdInfo.cb); } - + bool DvdFileStream::CancelAsync(IOStreamCallback callback, void* callbackArg) { mCancelCallback = callback; mCancelArg = callbackArg; - - BOOL success = - DVDCancelAsync(&mFileInfo.dvdInfo.cb, DvdCBAsyncCallback_); - + + BOOL success = DVDCancelAsync(&mFileInfo.dvdInfo.cb, DvdCBAsyncCallback_); + if (success) { mIsCanceling = true; } - + return success; } - + u32 DvdFileStream::AdjustReadLength_(u32 len) { u32 currOffset = mFilePosition.Tell(); u32 fileSize = mFilePosition.GetFileSize(); - + if (RoundUp(currOffset + len, 32) > RoundUp(fileSize, 32)) { len = RoundUp(fileSize - currOffset, 32); } - + return len; } - } -} + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_DvdLockedFileStream.cpp b/libs/NW4R/src/ut/ut_DvdLockedFileStream.cpp index 9a66b0b5..3ee171c5 100644 --- a/libs/NW4R/src/ut/ut_DvdLockedFileStream.cpp +++ b/libs/NW4R/src/ut/ut_DvdLockedFileStream.cpp @@ -20,17 +20,16 @@ namespace nw4r { OSRestoreInterrupts(enabled); } - DvdLockedFileStream::DvdLockedFileStream(s32 entrynum) : - DvdFileStream(entrynum) { + DvdLockedFileStream::DvdLockedFileStream(s32 entrynum) : DvdFileStream(entrynum) { InitMutex_(); } - DvdLockedFileStream::DvdLockedFileStream(const DVDFileInfo* info, bool close) : - DvdFileStream(info, close) { + DvdLockedFileStream::DvdLockedFileStream(const DVDFileInfo* info, bool close) : DvdFileStream(info, close) { InitMutex_(); } - DvdLockedFileStream::~DvdLockedFileStream() {} + DvdLockedFileStream::~DvdLockedFileStream() { + } s32 DvdLockedFileStream::Read(void* pDst, u32 size) { OSLockMutex(&sMutex); @@ -45,5 +44,5 @@ namespace nw4r { OSUnlockMutex(&sMutex); return result; } - } -} + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_FileStream.cpp b/libs/NW4R/src/ut/ut_FileStream.cpp index 77be5e54..5327dc07 100644 --- a/libs/NW4R/src/ut/ut_FileStream.cpp +++ b/libs/NW4R/src/ut/ut_FileStream.cpp @@ -6,54 +6,54 @@ namespace nw4r { namespace ut { NW4R_UT_GET_DERIVED_RUNTIME_TYPEINFO(FileStream, IOStream); - void FileStream::Cancel() {} - + void FileStream::Cancel() { + } + bool FileStream::CancelAsync(IOStreamCallback callback, void* callbackArg) { return true; } - + u32 FileStream::FilePosition::Skip(s32 offset) { if (offset != 0) { s64 newOffset = mPosition + offset; mPosition = Clamp(newOffset, 0, mFileSize); } - + return mPosition; } - + u32 FileStream::FilePosition::Append(s32 offset) { s64 newOffset = mPosition + offset; - + if (newOffset < 0) { mPosition = 0; - } - else { + } else { mPosition = newOffset; mFileSize = Max(mPosition, mFileSize); } - + return mPosition; } - + void FileStream::FilePosition::Seek(s32 offset, u32 origin) { switch (origin) { - case SEEK_BEG: { - mPosition = 0; - break; + case SEEK_BEG: { + mPosition = 0; + break; + } + + case SEEK_END: { + mPosition = mFileSize; + break; + } + + case SEEK_CUR: + default: { + break; + } } - - case SEEK_END: { - mPosition = mFileSize; - break; - } - - case SEEK_CUR: - default: { - break; - } - } - + Skip(offset); } - } -} + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_Font.cpp b/libs/NW4R/src/ut/ut_Font.cpp index 60062c5c..488d95ad 100644 --- a/libs/NW4R/src/ut/ut_Font.cpp +++ b/libs/NW4R/src/ut/ut_Font.cpp @@ -1,5 +1,5 @@ -#include #include +#include namespace nw4r { namespace ut { @@ -24,5 +24,5 @@ namespace nw4r { } } } - } -} + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_IOStream.cpp b/libs/NW4R/src/ut/ut_IOStream.cpp index 807f7220..e6c54b75 100644 --- a/libs/NW4R/src/ut/ut_IOStream.cpp +++ b/libs/NW4R/src/ut/ut_IOStream.cpp @@ -8,7 +8,8 @@ namespace nw4r { return false; } - void IOStream::Write(const void* pSrc, u32 size) {} + void IOStream::Write(const void* pSrc, u32 size) { + } bool IOStream::WriteAsync(const void* pSrc, u32 size, IOStreamCallback callback, void* callbackArg) { return false; @@ -17,5 +18,5 @@ namespace nw4r { bool IOStream::IsBusy() const { return false; } - } -} + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_LinkList.cpp b/libs/NW4R/src/ut/ut_LinkList.cpp index a634e508..25c2def4 100644 --- a/libs/NW4R/src/ut/ut_LinkList.cpp +++ b/libs/NW4R/src/ut/ut_LinkList.cpp @@ -3,8 +3,10 @@ namespace nw4r { namespace ut { namespace detail { - LinkListImpl::~LinkListImpl() { Clear(); } - + LinkListImpl::~LinkListImpl() { + Clear(); + } + LinkListImpl::Iterator LinkListImpl::Erase(LinkListImpl::Iterator it) { Iterator clone = it; return Erase(it, ++clone); @@ -61,6 +63,6 @@ namespace nw4r { return (Iterator)pNext; } - } - } -} + } // namespace detail + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_NandFileStream.cpp b/libs/NW4R/src/ut/ut_NandFileStream.cpp index 7e4cedd2..83007c5a 100644 --- a/libs/NW4R/src/ut/ut_NandFileStream.cpp +++ b/libs/NW4R/src/ut/ut_NandFileStream.cpp @@ -6,175 +6,172 @@ namespace nw4r { void NandFileStream::NandAsyncCallback_(s32 result, NANDCommandBlock* pBlock) { NandFileStream* p = reinterpret_cast(pBlock)->stream; - + p->mIsBusy = false; p->mAsyncResult = result; - + if (p->mCallback != NULL) { p->mCallback(result, p, p->mArg); } } - + void NandFileStream::Initialize_() { mCanRead = false; mCanWrite = false; - + mCloseOnDestroyFlg = false; mCloseEnableFlg = false; - + mAvailable = false; mIsBusy = false; - + mCallback = NULL; mArg = NULL; mAsyncResult = NAND_RESULT_OK; - + mFileInfo.stream = this; } - + NandFileStream::NandFileStream(const char* path, u32 mode) { Initialize_(); Open(path, mode); } - + NandFileStream::NandFileStream(const NANDFileInfo* info, u32 mode, bool enableClose) { Initialize_(); Open(info, mode, enableClose); } - + NandFileStream::~NandFileStream() { if (mCloseOnDestroyFlg) { Close(); } } - + bool NandFileStream::Open(const char* path, u32 mode) { if (mCloseOnDestroyFlg) { Close(); } - + mCanRead = mode & NAND_ACCESS_READ; mCanWrite = mode & NAND_ACCESS_WRITE; - + if (NANDOpen(path, &mFileInfo.nandInfo, mode) != NAND_RESULT_OK) { return false; } - + if (mCanRead) { u32 fileSize; - + if (NANDGetLength(&mFileInfo.nandInfo, &fileSize) != NAND_RESULT_OK) { NANDClose(&mFileInfo.nandInfo); return false; } - + mFilePosition.SetFileSize(fileSize); } - + mFilePosition.Seek(0, SEEK_BEG); - + mCloseOnDestroyFlg = true; mCloseEnableFlg = true; mAvailable = true; - + return true; } - + bool NandFileStream::Open(const NANDFileInfo* info, u32 mode, bool enableClose) { if (mCloseOnDestroyFlg) { Close(); } - + mCanRead = mode & NAND_ACCESS_READ; mCanWrite = mode & NAND_ACCESS_WRITE; - + mFileInfo.nandInfo = *info; - + u32 fileSize; if (NANDGetLength(&mFileInfo.nandInfo, &fileSize) != NAND_RESULT_OK) { if (enableClose) { NANDClose(&mFileInfo.nandInfo); } - + return false; } - + mFilePosition.SetFileSize(fileSize); mFilePosition.Seek(0, SEEK_BEG); - + mCloseOnDestroyFlg = false; mCloseEnableFlg = enableClose; mAvailable = true; - + return true; } - + void NandFileStream::Close() { if (mCloseEnableFlg && mAvailable) { NANDClose(&mFileInfo.nandInfo); mAvailable = false; } } - + s32 NandFileStream::Read(void* pDst, u32 size) { NANDSeek(&mFileInfo.nandInfo, mFilePosition.Tell(), NAND_SEEK_BEG); - + s32 result = NANDRead(&mFileInfo.nandInfo, pDst, size); - + mFilePosition.Skip(result); - + return result; } - + bool NandFileStream::ReadAsync(void* pDst, u32 size, IOStreamCallback callback, void* callbackArg) { mCallback = callback; mArg = callbackArg; mIsBusy = true; - + NANDSeek(&mFileInfo.nandInfo, mFilePosition.Tell(), NAND_SEEK_BEG); - + bool success = NANDReadAsync(&mFileInfo.nandInfo, pDst, size, NandAsyncCallback_, &mFileInfo.nandBlock) == NAND_RESULT_OK; - + if (success) { mFilePosition.Skip(size); - } - else { + } else { mIsBusy = false; } - + return success; } - + void NandFileStream::Write(const void* pSrc, u32 size) { NANDSeek(&mFileInfo.nandInfo, mFilePosition.Tell(), NAND_SEEK_BEG); s32 result = NANDWrite(&mFileInfo.nandInfo, pSrc, size); - + // @bug Error code will be interpreted as a negative size mFilePosition.Append(result); } - + bool NandFileStream::WriteAsync(const void* pSrc, u32 size, IOStreamCallback callback, void* callbackArg) { mCallback = callback; mArg = callbackArg; mIsBusy = true; - + NANDSeek(&mFileInfo.nandInfo, mFilePosition.Tell(), NAND_SEEK_BEG); - - s32 result = NANDWriteAsync(&mFileInfo.nandInfo, pSrc, size, - NandAsyncCallback_, &mFileInfo.nandBlock); - + + s32 result = NANDWriteAsync(&mFileInfo.nandInfo, pSrc, size, NandAsyncCallback_, &mFileInfo.nandBlock); + if (result == NAND_RESULT_OK) { mFilePosition.Append(size); - } - else { + } else { mIsBusy = false; } - + return result == NAND_RESULT_OK; } - + void NandFileStream::Seek(s32 offset, u32 origin) { mFilePosition.Seek(offset, origin); } - } -} + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_ResFont.cpp b/libs/NW4R/src/ut/ut_ResFont.cpp index 45812b81..cbabfff4 100644 --- a/libs/NW4R/src/ut/ut_ResFont.cpp +++ b/libs/NW4R/src/ut/ut_ResFont.cpp @@ -1,26 +1,29 @@ -#include #include +#include #include #include namespace nw4r { namespace ut { - #define CONVERT_OFFSET_TO_PTR(type_, ptr_, offset_) reinterpret_cast(reinterpret_cast(ptr_) + offset_) +#define CONVERT_OFFSET_TO_PTR(type_, ptr_, offset_) reinterpret_cast(reinterpret_cast(ptr_) + offset_) namespace { - template void ResolveOffset(T*& ptr, void* base) { + template + void ResolveOffset(T*& ptr, void* base) { *reinterpret_cast(&ptr) = reinterpret_cast(base) + reinterpret_cast(ptr); } + } // namespace + + ResFont::ResFont() { } - ResFont::ResFont() {} - - ResFont::~ResFont() {} + ResFont::~ResFont() { + } bool ResFont::SetResource(void* brfnt) { - FontInformation* pFontInfo = NULL; - BinaryFileHeader* fileHeader = static_cast(brfnt); + FontInformation* pFontInfo = NULL; + BinaryFileHeader* fileHeader = static_cast(brfnt); if (!IsManaging(NULL)) { return false; @@ -42,14 +45,12 @@ namespace nw4r { blockHeader = CONVERT_OFFSET_TO_PTR(BinaryBlockHeader, blockHeader, blockHeader->size); nBlocks++; } - } - else { + } else { if (fileHeader->version == NW4R_VERSION(1, 4)) { if (!IsValidBinaryFile(fileHeader, SIGNATURE_FONT, NW4R_VERSION(1, 4), 2)) { return false; } - } - else { + } else { if (!IsValidBinaryFile(fileHeader, SIGNATURE_FONT, NW4R_VERSION(1, 2), 2)) { return false; } @@ -69,8 +70,8 @@ namespace nw4r { } FontInformation* ResFont::Rebuild(BinaryFileHeader* fileHeader) { - BinaryBlockHeader* blockHeader; - FontInformation* info = NULL; + BinaryBlockHeader* blockHeader; + FontInformation* info = NULL; int nBlocks = 0; @@ -128,5 +129,5 @@ namespace nw4r { return info; } - } -} + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_ResFontBase.cpp b/libs/NW4R/src/ut/ut_ResFontBase.cpp index a03b2de0..23ed07cf 100644 --- a/libs/NW4R/src/ut/ut_ResFontBase.cpp +++ b/libs/NW4R/src/ut/ut_ResFontBase.cpp @@ -1,10 +1,10 @@ -#include #include +#include namespace nw4r { namespace ut { namespace detail { - #define GLYPH_INDEX_NOT_FOUND 0xFFFF +#define GLYPH_INDEX_NOT_FOUND 0xFFFF typedef struct CMapScanEntry { u16 ccode; // 0x00 @@ -12,15 +12,15 @@ namespace nw4r { } CMapScanEntry; typedef struct CMapInfoScan { - u16 num; // 0x00 - CMapScanEntry entries[]; // 0x02 + u16 num; // 0x00 + CMapScanEntry entries[]; // 0x02 } CMapInfoScan; - ResFontBase::ResFontBase() : - mResource(NULL), - mFontInfo(NULL) {} + ResFontBase::ResFontBase() : mResource(NULL), mFontInfo(NULL) { + } - ResFontBase::~ResFontBase() {} + ResFontBase::~ResFontBase() { + } void ResFontBase::SetResourceBuffer(void* pUserBuffer, FontInformation* pFontInfo) { mResource = pUserBuffer; @@ -85,8 +85,7 @@ namespace nw4r { if (index != GLYPH_INDEX_NOT_FOUND) { mFontInfo->alterCharIndex = index; return true; - } - else { + } else { return false; } } @@ -143,20 +142,18 @@ namespace nw4r { break; } case FONT_MAP_SCAN: { - const CMapInfoScan* scanInfo = reinterpret_cast(pMap->mapInfo); - const CMapScanEntry* first = scanInfo->entries; - const CMapScanEntry* last = scanInfo->entries + (scanInfo->num - 1); + const CMapInfoScan* scanInfo = reinterpret_cast(pMap->mapInfo); + const CMapScanEntry* first = scanInfo->entries; + const CMapScanEntry* last = scanInfo->entries + (scanInfo->num - 1); while (first <= last) { const CMapScanEntry* mid = first + (last - first) / 2; if (mid->ccode < c) { first = mid + 1; - } - else if (c < mid->ccode) { + } else if (c < mid->ccode) { last = mid - 1; - } - else { + } else { index = mid->index; break; } @@ -210,6 +207,6 @@ namespace nw4r { glyph->cellX = cellPixelX + 1; glyph->cellY = cellPixelY + 1; } - } - } -} + } // namespace detail + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_RomFont.cpp b/libs/NW4R/src/ut/ut_RomFont.cpp index b894d07c..3bb53488 100644 --- a/libs/NW4R/src/ut/ut_RomFont.cpp +++ b/libs/NW4R/src/ut/ut_RomFont.cpp @@ -2,7 +2,7 @@ namespace nw4r { namespace ut { - /* All of RomFont is deadstripped except for one generated weak function of the Font's desctructor. + /* All of RomFont is deadstripped except for one generated weak function of the Font's desctructor. All what this does is generate that said weak. */ class RomFont : public Font { @@ -10,7 +10,7 @@ namespace nw4r { virtual ~RomFont() {} }; - RomFont::RomFont() : - Font() {} - } -} + RomFont::RomFont() : Font() { + } + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_TagProcessorBase.cpp b/libs/NW4R/src/ut/ut_TagProcessorBase.cpp index 72f9f8eb..fe4ce1ed 100644 --- a/libs/NW4R/src/ut/ut_TagProcessorBase.cpp +++ b/libs/NW4R/src/ut/ut_TagProcessorBase.cpp @@ -6,10 +6,15 @@ namespace nw4r { namespace ut { - templateTagProcessorBase::TagProcessorBase() {} - template TagProcessorBase::~TagProcessorBase() {} + template + TagProcessorBase::TagProcessorBase() { + } + template + TagProcessorBase::~TagProcessorBase() { + } - template Operation TagProcessorBase::Process(u16 code, PrintContext* context) { + template + Operation TagProcessorBase::Process(u16 code, PrintContext* context) { switch (code) { case '\n': { ProcessLinefeed(context); @@ -25,7 +30,8 @@ namespace nw4r { } } - template Operation TagProcessorBase::CalcRect(Rect* pRect, u16 code, PrintContext* context) { + template + Operation TagProcessorBase::CalcRect(Rect* pRect, u16 code, PrintContext* context) { switch (code) { case '\n': { TextWriterBase& writer = *context->writer; @@ -54,7 +60,7 @@ namespace nw4r { pRect->bottom = pRect->top + writer.GetFontHeight(); pRect->Normalize(); - + return OPERATION_NO_CHAR_SPACE; } default: { @@ -63,7 +69,8 @@ namespace nw4r { } } - template void TagProcessorBase::ProcessLinefeed(PrintContext* context) { + template + void TagProcessorBase::ProcessLinefeed(PrintContext* context) { TextWriterBase& writer = *context->writer; f32 x = context->xOrigin; @@ -72,7 +79,8 @@ namespace nw4r { writer.SetCursor(x, y); } - template void TagProcessorBase::ProcessTab(PrintContext* context) { + template + void TagProcessorBase::ProcessTab(PrintContext* context) { TextWriterBase& writer = *context->writer; int tabWidth = writer.GetTabWidth(); @@ -89,5 +97,5 @@ namespace nw4r { template class TagProcessorBase; template class TagProcessorBase; - } -} + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_TextWriterBase.cpp b/libs/NW4R/src/ut/ut_TextWriterBase.cpp index ffb15e5d..996ae699 100644 --- a/libs/NW4R/src/ut/ut_TextWriterBase.cpp +++ b/libs/NW4R/src/ut/ut_TextWriterBase.cpp @@ -3,78 +3,94 @@ namespace nw4r { namespace ut { - template u32 TextWriterBase::mFormatBufferSize = 0x100; - template T* TextWriterBase::mFormatBuffer; - template TagProcessorBase TextWriterBase::mDefaultTagProcessor; + template + u32 TextWriterBase::mFormatBufferSize = 0x100; + template + T* TextWriterBase::mFormatBuffer; + template + TagProcessorBase TextWriterBase::mDefaultTagProcessor; - template TextWriterBase::TextWriterBase() : - mCharSpace(0.0f), - mLineSpace(0.0f), - mTabWidth(4), - mDrawFlag(0), - mTagProcessor(&mDefaultTagProcessor) {} + template + TextWriterBase::TextWriterBase() : mCharSpace(0.0f), mLineSpace(0.0f), mTabWidth(4), mDrawFlag(0), mTagProcessor(&mDefaultTagProcessor) { + } - template TextWriterBase::~TextWriterBase() {} + template + TextWriterBase::~TextWriterBase() { + } - template void TextWriterBase::SetLineHeight(f32 lineHeight) { + template + void TextWriterBase::SetLineHeight(f32 lineHeight) { const Font* font = GetFont(); int linefeed = font ? font->GetLineFeed() : 0; mLineSpace = lineHeight - linefeed * GetScaleV(); } - template f32 TextWriterBase::GetLineHeight() const { + template + f32 TextWriterBase::GetLineHeight() const { const Font* font = GetFont(); int linefeed = font ? font->GetLineFeed() : 0; return mLineSpace + linefeed * GetScaleV(); } - template void TextWriterBase::SetLineSpace(f32 lineSpace) { + template + void TextWriterBase::SetLineSpace(f32 lineSpace) { mLineSpace = lineSpace; } - template void TextWriterBase::SetCharSpace(f32 charSpace) { + template + void TextWriterBase::SetCharSpace(f32 charSpace) { mCharSpace = charSpace; } - template f32 TextWriterBase::GetLineSpace() const { + template + f32 TextWriterBase::GetLineSpace() const { return mLineSpace; } - template f32 TextWriterBase::GetCharSpace() const { + template + f32 TextWriterBase::GetCharSpace() const { return mCharSpace; } - template void TextWriterBase::SetTabWidth(int tabWidth) { + template + void TextWriterBase::SetTabWidth(int tabWidth) { mTabWidth = tabWidth; } - template int TextWriterBase::GetTabWidth() const { + template + int TextWriterBase::GetTabWidth() const { return mTabWidth; } - template void TextWriterBase::SetDrawFlag(u32 flags) { + template + void TextWriterBase::SetDrawFlag(u32 flags) { mDrawFlag = flags; } - template u32 TextWriterBase::GetDrawFlag() const { + template + u32 TextWriterBase::GetDrawFlag() const { return mDrawFlag; } - template void TextWriterBase::SetTagProcessor(TagProcessorBase* tagProcessor) { + template + void TextWriterBase::SetTagProcessor(TagProcessorBase* tagProcessor) { mTagProcessor = tagProcessor; } - template void TextWriterBase::ResetTagProcessor() { + template + void TextWriterBase::ResetTagProcessor() { mTagProcessor = &mDefaultTagProcessor; } - template TagProcessorBase& TextWriterBase::GetTagProcessor() const { + template + TagProcessorBase& TextWriterBase::GetTagProcessor() const { return *mTagProcessor; } - template f32 TextWriterBase::CalcFormatStringWidth(const T* format, ...) const { + template + f32 TextWriterBase::CalcFormatStringWidth(const T* format, ...) const { Rect rect; va_list vargs; @@ -85,7 +101,8 @@ namespace nw4r { return rect.GetWidth(); } - template f32 TextWriterBase::CalcFormatStringHeight(const T* format, ...) const { + template + f32 TextWriterBase::CalcFormatStringHeight(const T* format, ...) const { Rect rect; va_list vargs; @@ -96,7 +113,8 @@ namespace nw4r { return rect.GetHeight(); } - template void TextWriterBase::CalcFormatStringRect(Rect* pRect, const T* format, ...) const { + template + void TextWriterBase::CalcFormatStringRect(Rect* pRect, const T* format, ...) const { va_list vargs; va_start(vargs, format); @@ -104,9 +122,10 @@ namespace nw4r { va_end(vargs); } - template f32 TextWriterBase::AdjustCursor(f32* xOrigin, f32* yOrigin, const T* str, int length) { - f32 textWidth = 0.0f; - f32 textHeight = 0.0f; + template + f32 TextWriterBase::AdjustCursor(f32* xOrigin, f32* yOrigin, const T* str, int length) { + f32 textWidth = 0.0f; + f32 textHeight = 0.0f; if (!IsDrawFlagSet(DRAWFLAG_MASK_ALL, DRAWFLAG_MASK_ALIGN_V) && !IsDrawFlagSet(DRAWFLAG_MASK_ALL, 0)) { Rect textRect; @@ -118,15 +137,13 @@ namespace nw4r { if (IsDrawFlagSet(DRAWFLAG_MASK_ALIGN_H, DRAWFLAG_ALIGN_H_CENTER)) { *xOrigin -= textWidth / 2.0f; - } - else if (IsDrawFlagSet(DRAWFLAG_MASK_ALIGN_H, DRAWFLAG_ALIGN_H_RIGHT)) { + } else if (IsDrawFlagSet(DRAWFLAG_MASK_ALIGN_H, DRAWFLAG_ALIGN_H_RIGHT)) { *xOrigin -= textWidth; } if (IsDrawFlagSet(DRAWFLAG_MASK_ALIGN_V, DRAWFLAG_ALIGN_V_CENTER)) { *yOrigin -= textHeight / 2.0f; - } - else if (IsDrawFlagSet(DRAWFLAG_MASK_ALIGN_V, DRAWFLAG_ALIGN_V_TOP)) { + } else if (IsDrawFlagSet(DRAWFLAG_MASK_ALIGN_V, DRAWFLAG_ALIGN_V_TOP)) { *yOrigin -= textHeight; } @@ -134,27 +151,25 @@ namespace nw4r { f32 width = CalcLineWidth(str, length); f32 offset = (textWidth - width) / 2.0f; SetCursorX(*xOrigin + offset); - } - else if (IsDrawFlagSet(DRAWFLAG_MASK_ALIGN_TEXT, DRAWFLAG_ALIGN_TEXT_RIGHT)) { + } else if (IsDrawFlagSet(DRAWFLAG_MASK_ALIGN_TEXT, DRAWFLAG_ALIGN_TEXT_RIGHT)) { f32 width = CalcLineWidth(str, length); f32 offset = textWidth - width; SetCursorX(*xOrigin + offset); - } - else { + } else { SetCursorX(*xOrigin); } if (IsDrawFlagSet(DRAWFLAG_MASK_ALIGN_V, DRAWFLAG_ALIGN_V_CENTER | DRAWFLAG_ALIGN_V_TOP)) { SetCursorY(*yOrigin); - } - else { + } else { SetCursorY(*yOrigin + GetFontAscent()); } return textWidth; } - template f32 TextWriterBase::PrintImpl(const T* str, int length) { + template + f32 TextWriterBase::PrintImpl(const T* str, int length) { f32 xOrigin = GetCursorX(); f32 yOrigin = GetCursorY(); @@ -192,35 +207,29 @@ namespace nw4r { f32 offset = (textWidth - width) / 2.0f; SetCursorX(context.xOrigin + offset); - } - else if (IsDrawFlagSet(DRAWFLAG_MASK_ALIGN_TEXT, DRAWFLAG_ALIGN_TEXT_RIGHT)) { + } else if (IsDrawFlagSet(DRAWFLAG_MASK_ALIGN_TEXT, DRAWFLAG_ALIGN_TEXT_RIGHT)) { int remain = length - (context.str - str); f32 width = CalcLineWidth(context.str, remain); f32 offset = textWidth - width; SetCursorX(context.xOrigin + offset); - } - else { + } else { f32 width = GetCursorX() - context.xOrigin; textWidth = Max(textWidth, width); SetCursorX(context.xOrigin); } bCharSpace = false; - } - else if (operation == OPERATION_NO_CHAR_SPACE) { + } else if (operation == OPERATION_NO_CHAR_SPACE) { bCharSpace = false; - } - else if (operation == OPERATION_CHAR_SPACE) { + } else if (operation == OPERATION_CHAR_SPACE) { bCharSpace = true; - } - else if (operation == OPERATION_END_DRAW) { + } else if (operation == OPERATION_END_DRAW) { break; } reader.Set(context.str); - } - else { + } else { f32 baseY = GetCursorY(); if (bCharSpace) { @@ -243,15 +252,15 @@ namespace nw4r { if (IsDrawFlagSet(DRAWFLAG_MASK_ALIGN_V, DRAWFLAG_ALIGN_V_CENTER) || IsDrawFlagSet(DRAWFLAG_MASK_ALIGN_V, DRAWFLAG_ALIGN_V_TOP)) { SetCursorY(orgCursorY); - } - else { + } else { MoveCursorY(yCursorAdj); } return textWidth; } - template void TextWriterBase::CalcStringRectImpl(Rect* pRect, const T* str, int length) { + template + void TextWriterBase::CalcStringRectImpl(Rect* pRect, const T* str, int length) { int remain = length; const T* pos = str; @@ -276,11 +285,13 @@ namespace nw4r { } while (remain > 0); } - template f32 TextWriterBase::PrintMutable(const T* str, int length) { + template + f32 TextWriterBase::PrintMutable(const T* str, int length) { return PrintImpl(str, length); } - template int TextWriterBase::CalcLineRectImpl(Rect* pRect, const T* str, int length) { + template + int TextWriterBase::CalcLineRectImpl(Rect* pRect, const T* str, int length) { PrintContext context = {this, str, 0.0f, 0.0f, 0}; const Font* font = GetFont(); @@ -319,18 +330,14 @@ namespace nw4r { if (operation == OPERATION_END_DRAW) { return length; - } - else if (operation == OPERATION_NO_CHAR_SPACE) { + } else if (operation == OPERATION_NO_CHAR_SPACE) { bCharSpace = false; - } - else if (operation == OPERATION_CHAR_SPACE) { + } else if (operation == OPERATION_CHAR_SPACE) { bCharSpace = true; - } - else if (operation == OPERATION_NEXT_LINE) { + } else if (operation == OPERATION_NEXT_LINE) { break; } - } - else { + } else { if (bCharSpace) { x += GetCharSpace(); } @@ -339,8 +346,7 @@ namespace nw4r { if (IsWidthFixed()) { x += GetFixedWidth(); - } - else { + } else { x += GetFont()->GetCharWidth(code) * GetScaleH(); } @@ -352,7 +358,8 @@ namespace nw4r { return static_cast(reader.GetCurrentPos()) - str; } - template f32 TextWriterBase::CalcLineWidth(const T* str, int length) { + template + f32 TextWriterBase::CalcLineWidth(const T* str, int length) { Rect rect; TextWriterBase myCopy(*this); @@ -361,15 +368,18 @@ namespace nw4r { return rect.GetWidth(); } - template T* TextWriterBase::GetBuffer() { + template + T* TextWriterBase::GetBuffer() { return mFormatBuffer; } - template u32 TextWriterBase::GetBufferSize() { + template + u32 TextWriterBase::GetBufferSize() { return mFormatBufferSize; } - template T* TextWriterBase::SetBuffer(u32 size) { + template + T* TextWriterBase::SetBuffer(u32 size) { T* oldBuffer = mFormatBuffer; mFormatBuffer = NULL; @@ -378,7 +388,8 @@ namespace nw4r { return oldBuffer; } - template T* TextWriterBase::SetBuffer(T* buffer, u32 size) { + template + T* TextWriterBase::SetBuffer(T* buffer, u32 size) { T* oldBuffer = mFormatBuffer; mFormatBuffer = buffer; @@ -387,11 +398,13 @@ namespace nw4r { return oldBuffer; } - template f32 TextWriterBase::Print(const T* str) { + template + f32 TextWriterBase::Print(const T* str) { return Print(str, StrLen(str)); } - template f32 TextWriterBase::Print(const T* str, int length) { + template + f32 TextWriterBase::Print(const T* str, int length) { TextWriterBase myCopy(*this); f32 width = myCopy.PrintImpl(str, length); @@ -400,7 +413,8 @@ namespace nw4r { return width; } - template f32 TextWriterBase::VPrintf(const T* format, va_list args) { + template + f32 TextWriterBase::VPrintf(const T* format, va_list args) { T* buffer = mFormatBuffer ? mFormatBuffer : static_cast(__alloca(mFormatBufferSize)); int length = VSNPrintf(buffer, mFormatBufferSize, format, args); @@ -408,7 +422,8 @@ namespace nw4r { return width; } - template f32 TextWriterBase::Printf(const T* format, ...) { + template + f32 TextWriterBase::Printf(const T* format, ...) { va_list vargs; va_start(vargs, format); @@ -418,39 +433,46 @@ namespace nw4r { return width; } - template void TextWriterBase::CalcStringRect(Rect* pRect, const T* str) const { + template + void TextWriterBase::CalcStringRect(Rect* pRect, const T* str) const { CalcStringRect(pRect, str, StrLen(str)); } - template void TextWriterBase::CalcStringRect(Rect* pRect, const T* str, int length) const { + template + void TextWriterBase::CalcStringRect(Rect* pRect, const T* str, int length) const { TextWriterBase myCopy(*this); myCopy.CalcStringRectImpl(pRect, str, length); } - template f32 TextWriterBase::CalcStringHeight(const T* str) const { + template + f32 TextWriterBase::CalcStringHeight(const T* str) const { return CalcStringHeight(str, StrLen(str)); } - template f32 TextWriterBase::CalcStringHeight(const T* str, int length) const { + template + f32 TextWriterBase::CalcStringHeight(const T* str, int length) const { Rect rect; CalcStringRect(&rect, str, length); return rect.GetHeight(); } - template f32 TextWriterBase::CalcStringWidth(const T* str) const { + template + f32 TextWriterBase::CalcStringWidth(const T* str) const { return CalcStringWidth(str, StrLen(str)); } - template f32 TextWriterBase::CalcStringWidth(const T* str, int length) const { + template + f32 TextWriterBase::CalcStringWidth(const T* str, int length) const { Rect rect; CalcStringRect(&rect, str, length); return rect.GetWidth(); } - template void TextWriterBase::CalcVStringRect(Rect* pRect, const T* format, va_list args) const { + template + void TextWriterBase::CalcVStringRect(Rect* pRect, const T* format, va_list args) const { T* buffer = mFormatBuffer ? mFormatBuffer : static_cast(__alloca(mFormatBufferSize)); int length = VSNPrintf(buffer, mFormatBufferSize, format, args); @@ -459,5 +481,5 @@ namespace nw4r { template class TextWriterBase; template class TextWriterBase; - } -} + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_binaryFileFormat.cpp b/libs/NW4R/src/ut/ut_binaryFileFormat.cpp index bf4e43ce..32c83adf 100644 --- a/libs/NW4R/src/ut/ut_binaryFileFormat.cpp +++ b/libs/NW4R/src/ut/ut_binaryFileFormat.cpp @@ -18,7 +18,7 @@ namespace nw4r { return false; } // Compare size - if (header->fileSize < sizeof(*header) + sizeof(BinaryBlockHeader) * minBlocks){ + if (header->fileSize < sizeof(*header) + sizeof(BinaryBlockHeader) * minBlocks) { return false; } // And finally compare the amount of blocks @@ -28,5 +28,5 @@ namespace nw4r { // Passed all of those checks? Then it's valid! return true; } - } -} + } // namespace ut +} // namespace nw4r diff --git a/libs/NW4R/src/ut/ut_list.cpp b/libs/NW4R/src/ut/ut_list.cpp index 040b45bb..4196decb 100644 --- a/libs/NW4R/src/ut/ut_list.cpp +++ b/libs/NW4R/src/ut/ut_list.cpp @@ -2,7 +2,7 @@ namespace nw4r { namespace ut { - #define OBJ_TO_LINK(list, obj) ((Link*)(((char*)obj) + list->offset)) +#define OBJ_TO_LINK(list, obj) ((Link*)(((char*)obj) + list->offset)) static void SetFirstObject(List* list, void* object) { Link* link = OBJ_TO_LINK(list, object); @@ -25,8 +25,7 @@ namespace nw4r { void List_Append(List* list, void* object) { if (list->headObject == NULL) { SetFirstObject(list, object); - } - else { + } else { // Old tail <- New tail relationship Link* link = OBJ_TO_LINK(list, object); link->prevObject = list->tailObject; @@ -43,8 +42,7 @@ namespace nw4r { void List_Prepend(List* list, void* object) { if (list->headObject == NULL) { SetFirstObject(list, object); - } - else { + } else { // New head -> Old head relationship Link* link = OBJ_TO_LINK(list, object); link->prevObject = NULL; @@ -61,21 +59,19 @@ namespace nw4r { void List_Insert(List* list, void* pTarget, void* object) { if (pTarget == NULL) { List_Append(list, object); - } - else if (pTarget == list->headObject) { + } else if (pTarget == list->headObject) { List_Prepend(list, object); - } - else { + } else { Link* link = OBJ_TO_LINK(list, object); void* pPrev = OBJ_TO_LINK(list, pTarget)->prevObject; Link* pPrevLink = OBJ_TO_LINK(list, pPrev); - link->prevObject = pPrev; // pPrev <- object - link->nextObject = pTarget; // pPrev <- object -> pTarget - pPrevLink->nextObject = object; // pPrev <-> object -> pTarget - - OBJ_TO_LINK(list, pTarget)->prevObject = object; // pPrev <-> object <-> pTarget + link->prevObject = pPrev; // pPrev <- object + link->nextObject = pTarget; // pPrev <- object -> pTarget + pPrevLink->nextObject = object; // pPrev <-> object -> pTarget + + OBJ_TO_LINK(list, pTarget)->prevObject = object; // pPrev <-> object <-> pTarget list->numObjects++; } @@ -87,16 +83,14 @@ namespace nw4r { // Fix previous node relationship if (link->prevObject == NULL) { list->headObject = OBJ_TO_LINK(list, object)->nextObject; - } - else { + } else { OBJ_TO_LINK(list, link->prevObject)->nextObject = link->nextObject; } // Fix next node relationship if (link->nextObject == NULL) { list->tailObject = link->prevObject; - } - else { + } else { OBJ_TO_LINK(list, link->nextObject)->prevObject = link->prevObject; } @@ -109,8 +103,7 @@ namespace nw4r { void* List_GetNext(const List* list, const void* object) { if (object == NULL) { return list->headObject; - } - else { + } else { return OBJ_TO_LINK(list, object)->nextObject; } } @@ -118,8 +111,7 @@ namespace nw4r { void* List_GetPrev(const List* list, const void* object) { if (object == NULL) { return list->tailObject; - } - else { + } else { return OBJ_TO_LINK(list, object)->prevObject; } } @@ -136,7 +128,5 @@ namespace nw4r { return NULL; } - } -} - - + } // namespace ut +} // namespace nw4r diff --git a/libs/RVLFaceLib/include/RFL_Controller.h b/libs/RVLFaceLib/include/RFL_Controller.h index 8bf313bb..df0e1083 100644 --- a/libs/RVLFaceLib/include/RFL_Controller.h +++ b/libs/RVLFaceLib/include/RFL_Controller.h @@ -8,15 +8,15 @@ extern "C" { #endif -RFLErrcode RFLLoadControllerAsync(s32 chan); -RFLErrcode RFLUnloadController(s32 chan); +RFLErrcode RFLLoadControllerAsync(s32 chan); +RFLErrcode RFLUnloadController(s32 chan); -BOOL RFLIsAvailableControllerData(s32 chan, u8 index); +BOOL RFLIsAvailableControllerData(s32 chan, u8 index); -u8 RFLGetAvailableControllerDataNum(s32 chan); +u8 RFLGetAvailableControllerDataNum(s32 chan); #ifdef __cplusplus } #endif -#endif // RFL_CONTROLLER_H +#endif // RFL_CONTROLLER_H diff --git a/libs/RVLFaceLib/include/RFL_DataUtility.h b/libs/RVLFaceLib/include/RFL_DataUtility.h index b7963e2f..bbcdb24f 100644 --- a/libs/RVLFaceLib/include/RFL_DataUtility.h +++ b/libs/RVLFaceLib/include/RFL_DataUtility.h @@ -16,12 +16,12 @@ typedef enum { RFLCheckError_ErrorRight, } RFLCheckError; -RFLCheckError RFLIsSameFace(RFLDataSource lhvs, RFLMiddleDatabase* lhvd, u16 lhvi, RFLDataSource rhvs, RFLMiddleDatabase* rhvd, u16 rhvi); +RFLCheckError RFLIsSameFace(RFLDataSource lhvs, RFLMiddleDatabase* lhvd, u16 lhvi, RFLDataSource rhvs, RFLMiddleDatabase* rhvd, u16 rhvi); -RFLErrcode RFLGetAdditionalInfo(RFLAdditionalInfo* info, RFLDataSource source, RFLMiddleDatabase* db, u16 index); +RFLErrcode RFLGetAdditionalInfo(RFLAdditionalInfo* info, RFLDataSource source, RFLMiddleDatabase* db, u16 index); #ifdef __cplusplus } #endif -#endif // RFL_DATA_UTILITY_H +#endif // RFL_DATA_UTILITY_H diff --git a/libs/RVLFaceLib/include/RFL_Database.h b/libs/RVLFaceLib/include/RFL_Database.h index fc5fad65..828c9368 100644 --- a/libs/RVLFaceLib/include/RFL_Database.h +++ b/libs/RVLFaceLib/include/RFL_Database.h @@ -8,16 +8,16 @@ extern "C" { #endif -#define RFL_MAX_DATABASE (100) +#define RFL_MAX_DATABASE (100) -BOOL RFLIsAvailableOfficialData(u16 index); -u16 RFLGetAvailableOfficialDataNum(); -BOOL RFLSearchOfficialData(const RFLCreateID* id, u16* index); +BOOL RFLIsAvailableOfficialData(u16 index); +u16 RFLGetAvailableOfficialDataNum(); +BOOL RFLSearchOfficialData(const RFLCreateID* id, u16* index); -RFLErrcode RFLGetStoreData(RFLStoreData* data, RFLDataSource source, u16 index); +RFLErrcode RFLGetStoreData(RFLStoreData* data, RFLDataSource source, u16 index); #ifdef __cplusplus } #endif -#endif // RFL_DATABASE_H +#endif // RFL_DATABASE_H diff --git a/libs/RVLFaceLib/include/RFL_DefaultDatabase.h b/libs/RVLFaceLib/include/RFL_DefaultDatabase.h index 8c6e8aff..fd87e2b1 100644 --- a/libs/RVLFaceLib/include/RFL_DefaultDatabase.h +++ b/libs/RVLFaceLib/include/RFL_DefaultDatabase.h @@ -7,10 +7,10 @@ extern "C" { #endif -BOOL RFLSearchDefaultData(const RFLCreateID* id, u16* index); +BOOL RFLSearchDefaultData(const RFLCreateID* id, u16* index); #ifdef __cplusplus } #endif -#endif // RFL_DEFAULT_DATABASE_H +#endif // RFL_DEFAULT_DATABASE_H diff --git a/libs/RVLFaceLib/include/RFL_Icon.h b/libs/RVLFaceLib/include/RFL_Icon.h index cac33b61..5836fac4 100644 --- a/libs/RVLFaceLib/include/RFL_Icon.h +++ b/libs/RVLFaceLib/include/RFL_Icon.h @@ -16,23 +16,24 @@ typedef enum { } RFLIconBG; typedef struct { - u16 width; // 0x00 - u16 height; // 0x02 + u16 width; // 0x00 + u16 height; // 0x02 - RFLIconBG bgType; // 0x04 - GXColor bgColor; // 0x08 + RFLIconBG bgType; // 0x04 + GXColor bgColor; // 0x08 - BOOL drawXluOnly; // 0x0C + BOOL drawXluOnly; // 0x0C } RFLIconSetting; -RFLErrcode RFLMakeIcon(void* buf, RFLDataSource source, RFLMiddleDatabase* middleDB, u16 index, RFLExpression expression, const RFLIconSetting* setting); +RFLErrcode RFLMakeIcon(void* buf, RFLDataSource source, RFLMiddleDatabase* middleDB, u16 index, RFLExpression expression, + const RFLIconSetting* setting); #if RFL_BUILD >= 20080306 -void RFLSetIconDrawDoneCallback(RFLSimpleCB cb); -#endif // RFL_BUILD +void RFLSetIconDrawDoneCallback(RFLSimpleCB cb); +#endif // RFL_BUILD #ifdef __cplusplus } #endif -#endif // RFL_ICON_H +#endif // RFL_ICON_H diff --git a/libs/RVLFaceLib/include/RFL_MiddleDatabase.h b/libs/RVLFaceLib/include/RFL_MiddleDatabase.h index fa0619a1..445b5cce 100644 --- a/libs/RVLFaceLib/include/RFL_MiddleDatabase.h +++ b/libs/RVLFaceLib/include/RFL_MiddleDatabase.h @@ -17,25 +17,25 @@ typedef enum { } RFLMiddleDBType; typedef struct { - u8 data[24]; + u8 data[24]; } RFLMiddleDatabase; -u32 RFLGetMiddleDBBufferSize(u16 size); +u32 RFLGetMiddleDBBufferSize(u16 size); -void RFLInitMiddleDB(RFLMiddleDatabase* db, RFLMiddleDBType type, void* buffer, u16 size); -RFLErrcode RFLUpdateMiddleDBAsync(RFLMiddleDatabase* db); +void RFLInitMiddleDB(RFLMiddleDatabase* db, RFLMiddleDBType type, void* buffer, u16 size); +RFLErrcode RFLUpdateMiddleDBAsync(RFLMiddleDatabase* db); RFLMiddleDBType RFLGetMiddleDBType(const RFLMiddleDatabase* db); -u16 RFLGetMiddleDBSize(const RFLMiddleDatabase* db); -u16 RFLGetMiddleDBStoredSize(const RFLMiddleDatabase* db); +u16 RFLGetMiddleDBSize(const RFLMiddleDatabase* db); +u16 RFLGetMiddleDBStoredSize(const RFLMiddleDatabase* db); -void RFLSetMiddleDBRandomMask(RFLMiddleDatabase* db, RFLSex sex, RFLAge age, RFLRace race); -void RFLSetMiddleDBHiddenMask(RFLMiddleDatabase* db, RFLSex sex); +void RFLSetMiddleDBRandomMask(RFLMiddleDatabase* db, RFLSex sex, RFLAge age, RFLRace race); +void RFLSetMiddleDBHiddenMask(RFLMiddleDatabase* db, RFLSex sex); -RFLErrcode RFLAddMiddleDBStoreData(RFLMiddleDatabase* db, const RFLStoreData* data); +RFLErrcode RFLAddMiddleDBStoreData(RFLMiddleDatabase* db, const RFLStoreData* data); #ifdef __cplusplus } #endif -#endif // RFL_MIDDLE_DATABASE_H +#endif // RFL_MIDDLE_DATABASE_H diff --git a/libs/RVLFaceLib/include/RFL_Model.h b/libs/RVLFaceLib/include/RFL_Model.h index ad6abfdc..ca010647 100644 --- a/libs/RVLFaceLib/include/RFL_Model.h +++ b/libs/RVLFaceLib/include/RFL_Model.h @@ -1,11 +1,13 @@ #ifndef RFL_MODEL_H #define RFL_MODEL_H -#include #include +#include + -#include #include +#include + #ifdef __cplusplus extern "C" { @@ -25,67 +27,68 @@ typedef struct { } RFLCharModel; typedef struct { - u8 lightEnable; // 0x00 - u32 lightMask; // 0x04 + u8 lightEnable; // 0x00 + u32 lightMask; // 0x04 - GXDiffuseFn diffFn; // 0x08 - GXAttnFn attnFn; // 0x0C + GXDiffuseFn diffFn; // 0x08 + GXAttnFn attnFn; // 0x0C - GXColor ambientColor; // 0x10 + GXColor ambientColor; // 0x10 - GXBool zCompLoc; // 0x14 + GXBool zCompLoc; // 0x14 } RFLDrawSetting; typedef struct { - u8 txcGenNum; // 0x00 - GXTexCoordID txcID; // 0x04 + u8 txcGenNum; // 0x00 + GXTexCoordID txcID; // 0x04 - GXTexMapID texMapID; // 0x08 + GXTexMapID texMapID; // 0x08 - u8 tevStageNum; // 0x0C - GXTevSwapSel tevSwapTable; // 0x10 - GXTevKColorID tevKColorID; // 0x14 - GXTevRegID tevOutRegID; // 0x18 + u8 tevStageNum; // 0x0C + GXTevSwapSel tevSwapTable; // 0x10 + GXTevKColorID tevKColorID; // 0x14 + GXTevRegID tevOutRegID; // 0x18 - GXPosNrmMtx posNrmMtxID; // 0x1C + GXPosNrmMtx posNrmMtxID; // 0x1C - GXBool reverseCulling; // 0x20 + GXBool reverseCulling; // 0x20 } RFLDrawCoreSetting; -void RFLSetCoordinate(RFLCoordinate up, RFLCoordinate front); +void RFLSetCoordinate(RFLCoordinate up, RFLCoordinate front); -u32 RFLGetModelBufferSize(RFLResolution resolution, u32 expressionFlag); +u32 RFLGetModelBufferSize(RFLResolution resolution, u32 expressionFlag); -RFLErrcode RFLInitCharModel(RFLCharModel* charModel, RFLDataSource source, RFLMiddleDatabase* middleDB, u16 index, void* bufferPtr, RFLResolution resolution, u32 expressionFlag); +RFLErrcode RFLInitCharModel(RFLCharModel* charModel, RFLDataSource source, RFLMiddleDatabase* middleDB, u16 index, void* bufferPtr, + RFLResolution resolution, u32 expressionFlag); -void RFLSetMtx(RFLCharModel* charModel, const MtxPtr mvMtx); -void RFLSetMtxPosNrm(RFLCharModel* charModel, const MtxPtr posMtx, const MtxPtr nrmMtx); +void RFLSetMtx(RFLCharModel* charModel, const MtxPtr mvMtx); +void RFLSetMtxPosNrm(RFLCharModel* charModel, const MtxPtr posMtx, const MtxPtr nrmMtx); -void RFLSetExpression(RFLCharModel* charModel, RFLExpression expression); -RFLExpression RFLGetExpression(const RFLCharModel* charModel); -BOOL RFLIsAvailableExpression(const RFLCharModel* charModel, RFLExpression expression); +void RFLSetExpression(RFLCharModel* charModel, RFLExpression expression); +RFLExpression RFLGetExpression(const RFLCharModel* charModel); +BOOL RFLIsAvailableExpression(const RFLCharModel* charModel, RFLExpression expression); -GXColor RFLGetFavoriteColor(RFLFavoriteColor favoriteColor); +GXColor RFLGetFavoriteColor(RFLFavoriteColor favoriteColor); -void RFLDrawOpa(const RFLCharModel* charModel); -void RFLDrawXlu(const RFLCharModel* charModel); +void RFLDrawOpa(const RFLCharModel* charModel); +void RFLDrawXlu(const RFLCharModel* charModel); -void RFLLoadDrawSetting(const RFLDrawSetting* setting); -void RFLLoadVertexSetting(const RFLDrawCoreSetting* setting); -void RFLLoadMaterialSetting(const RFLDrawCoreSetting* setting); +void RFLLoadDrawSetting(const RFLDrawSetting* setting); +void RFLLoadVertexSetting(const RFLDrawCoreSetting* setting); +void RFLLoadMaterialSetting(const RFLDrawCoreSetting* setting); -void RFLDrawOpaCore(const RFLCharModel* charModel, const RFLDrawCoreSetting* setting); -void RFLDrawXluCore(const RFLCharModel* charModel, const RFLDrawCoreSetting* setting); +void RFLDrawOpaCore(const RFLCharModel* charModel, const RFLDrawCoreSetting* setting); +void RFLDrawXluCore(const RFLCharModel* charModel, const RFLDrawCoreSetting* setting); -void RFLDrawShape(const RFLCharModel* charModel); -void RFLCopyCharModel(RFLCharModel* dstCharModel, void* dstBufferPtr, const RFLCharModel* srcCharModel); +void RFLDrawShape(const RFLCharModel* charModel); +void RFLCopyCharModel(RFLCharModel* dstCharModel, void* dstBufferPtr, const RFLCharModel* srcCharModel); #if RFL_BUILD >= 20080306 -void RFLSetModelDrawDoneCallback(RFLSimpleCB cb); +void RFLSetModelDrawDoneCallback(RFLSimpleCB cb); #endif #ifdef __cplusplus } #endif -#endif // RFL_MODEL_H +#endif // RFL_MODEL_H diff --git a/libs/RVLFaceLib/include/RFL_NANDLoader.h b/libs/RVLFaceLib/include/RFL_NANDLoader.h index de8c28f2..b59314fe 100644 --- a/libs/RVLFaceLib/include/RFL_NANDLoader.h +++ b/libs/RVLFaceLib/include/RFL_NANDLoader.h @@ -7,14 +7,14 @@ extern "C" { #endif -RFLErrcode RFLCacheResource(void* resBuffer, u32 resSize); -RFLErrcode RFLFreeCachedResource(); -BOOL RFLIsResourceCached(); +RFLErrcode RFLCacheResource(void* resBuffer, u32 resSize); +RFLErrcode RFLFreeCachedResource(); +BOOL RFLIsResourceCached(); -u16 RFLGetResourceVersion(); +u16 RFLGetResourceVersion(); #ifdef __cplusplus } #endif -#endif // RFL_NAND_LOADER_H +#endif // RFL_NAND_LOADER_H diff --git a/libs/RVLFaceLib/include/RFL_NWC24.h b/libs/RVLFaceLib/include/RFL_NWC24.h index 6be28da2..2f5c07f0 100644 --- a/libs/RVLFaceLib/include/RFL_NWC24.h +++ b/libs/RVLFaceLib/include/RFL_NWC24.h @@ -3,8 +3,9 @@ #include -#include #include +#include + #include @@ -12,13 +13,13 @@ extern "C" { #endif -RFLErrcode RFLCommitNWC24Msg(NWC24MsgObj* obj, u16 index); +RFLErrcode RFLCommitNWC24Msg(NWC24MsgObj* obj, u16 index); -RFLErrcode RFLNWC24Msg2Model(RFLCharModel* charModel, const NWC24MsgObj* data, void* bufferPtr, RFLResolution resolution, u32 expressionFlag); -RFLErrcode RFLNWC24Msg2Icon(void* buf, const NWC24MsgObj* data, RFLExpression expression, const RFLIconSetting* setting); +RFLErrcode RFLNWC24Msg2Model(RFLCharModel* charModel, const NWC24MsgObj* data, void* bufferPtr, RFLResolution resolution, u32 expressionFlag); +RFLErrcode RFLNWC24Msg2Icon(void* buf, const NWC24MsgObj* data, RFLExpression expression, const RFLIconSetting* setting); #ifdef __cplusplus } #endif -#endif // RFL_NWC24_H +#endif // RFL_NWC24_H diff --git a/libs/RVLFaceLib/include/RFL_System.h b/libs/RVLFaceLib/include/RFL_System.h index 5b155011..1ab3525a 100644 --- a/libs/RVLFaceLib/include/RFL_System.h +++ b/libs/RVLFaceLib/include/RFL_System.h @@ -7,24 +7,24 @@ extern "C" { #endif -u32 RFLGetWorkSize(BOOL useDeluxTex); +u32 RFLGetWorkSize(BOOL useDeluxTex); -RFLErrcode RFLInitResAsync(void* workBuffer, void* resBuffer, u32 resSize, BOOL useDeluxTex); -RFLErrcode RFLInitRes(void* workBuffer, void* resBuffer, u32 resSize, BOOL useDeluxTex); +RFLErrcode RFLInitResAsync(void* workBuffer, void* resBuffer, u32 resSize, BOOL useDeluxTex); +RFLErrcode RFLInitRes(void* workBuffer, void* resBuffer, u32 resSize, BOOL useDeluxTex); -void RFLExit(); +void RFLExit(); -BOOL RFLAvailable(); +BOOL RFLAvailable(); -RFLErrcode RFLGetAsyncStatus(); -s32 RFLGetLastReason(); +RFLErrcode RFLGetAsyncStatus(); +s32 RFLGetLastReason(); -RFLErrcode RFLWaitAsync(); +RFLErrcode RFLWaitAsync(); -char* RFLGetArcFilePath(); +char* RFLGetArcFilePath(); #ifdef __cplusplus } #endif -#endif // RFL_SYSTEM_H +#endif // RFL_SYSTEM_H diff --git a/libs/RVLFaceLib/include/RFL_Types.h b/libs/RVLFaceLib/include/RFL_Types.h index f98ea2d7..0f8b0592 100644 --- a/libs/RVLFaceLib/include/RFL_Types.h +++ b/libs/RVLFaceLib/include/RFL_Types.h @@ -9,8 +9,8 @@ extern "C" { #endif -#define RFL_NAME_LENGTH 10 -#define RFL_CREATE_ID_LENGTH 8 +#define RFL_NAME_LENGTH 10 +#define RFL_CREATE_ID_LENGTH 8 typedef void (*RFLSimpleCB)(); typedef void (*RFLSimpleCBArg)(u32); @@ -40,10 +40,10 @@ typedef enum { } RFLErrcode; typedef enum { - RFLResolution_64 = 64, - RFLResolution_128 = 128, - RFLResolution_256 = 256, - RFLResolution_64M = 64 | 32, + RFLResolution_64 = 64, + RFLResolution_128 = 128, + RFLResolution_256 = 256, + RFLResolution_64M = 64 | 32, RFLResolution_128M = 128 | 64 | 32, RFLResolution_256M = 256 | 128 | 64 | 32, } RFLResolution; @@ -123,41 +123,41 @@ typedef enum { } RFLRace; typedef struct { - u8 data[RFL_CREATE_ID_LENGTH]; + u8 data[RFL_CREATE_ID_LENGTH]; } RFLCreateID; typedef struct { - u8 data[74]; + u8 data[74]; } RFLCharData; typedef struct { - u8 data[76]; + u8 data[76]; } RFLStoreData; typedef struct { - u16 name[RFL_NAME_LENGTH+1]; // 0x00 - u16 creator[RFL_NAME_LENGTH+1]; // 0x16 + u16 name[RFL_NAME_LENGTH + 1]; // 0x00 + u16 creator[RFL_NAME_LENGTH + 1]; // 0x16 - RFLCreateID createID; // 0x2C + RFLCreateID createID; // 0x2C - u32 gender : 1; // 0x34 + u32 gender : 1; // 0x34 - u32 birth_month : 4; // 0x34 - u32 birth_day : 5; // 0x34 + u32 birth_month : 4; // 0x34 + u32 birth_day : 5; // 0x34 - u32 favoriteColor : 4; // 0x34 - u32 favorite : 1; // 0x34 + u32 favoriteColor : 4; // 0x34 + u32 favorite : 1; // 0x34 - u32 height : 7; // 0x34 - u32 build : 7; // 0x34 + u32 height : 7; // 0x34 + u32 build : 7; // 0x34 - u32 reserved : 3; // 0x34 + u32 reserved : 3; // 0x34 - GXColor skinColor; // 0x38 + GXColor skinColor; // 0x38 } RFLAdditionalInfo; #ifdef __cplusplus } #endif -#endif // RFL_TYPES_H +#endif // RFL_TYPES_H diff --git a/libs/RVLFaceLib/include/RVLFaceLib.h b/libs/RVLFaceLib/include/RVLFaceLib.h index 636e091e..a7f81029 100644 --- a/libs/RVLFaceLib/include/RVLFaceLib.h +++ b/libs/RVLFaceLib/include/RVLFaceLib.h @@ -1,20 +1,20 @@ #ifndef REVOLUTION_FACE_LIBRARY_H #define REVOLUTION_FACE_LIBRARY_H -#include #include +#include +#include #include #include -#include #include -#include #include +#include #include #include -#endif // REVOLUTION_FACE_LIBRARY_H +#endif // REVOLUTION_FACE_LIBRARY_H diff --git a/libs/RVLFaceLib/include/RVLFaceLibInternal.h b/libs/RVLFaceLib/include/RVLFaceLibInternal.h index da9ab7d8..7331c669 100644 --- a/libs/RVLFaceLib/include/RVLFaceLibInternal.h +++ b/libs/RVLFaceLib/include/RVLFaceLibInternal.h @@ -1,29 +1,29 @@ #ifndef REVOLUTION_FACE_LIBRARY_INTERNAL_H #define REVOLUTION_FACE_LIBRARY_INTERNAL_H -#include #include +#include -#include -#include -#include #include +#include +#include +#include #include #include -#include #include +#include -#include #include +#include #include -#include #include +#include #include -#endif // REVOLUTION_FACE_LIBRARY_INTERNAL_H +#endif // REVOLUTION_FACE_LIBRARY_INTERNAL_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_Controller.h b/libs/RVLFaceLib/include/internal/RFLi_Controller.h index 297265cf..e602cec3 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_Controller.h +++ b/libs/RVLFaceLib/include/internal/RFLi_Controller.h @@ -7,8 +7,8 @@ #include #include -#include #include +#include #include @@ -16,8 +16,8 @@ extern "C" { #endif -#define RFL_MAX_CTRL_BUFFER 10 -#define RFL_MAX_REPLACE_BUFFER 2 +#define RFL_MAX_CTRL_BUFFER 10 +#define RFL_MAX_REPLACE_BUFFER 2 typedef enum { RFLiCtrlCheckType_Both = 0, @@ -26,66 +26,66 @@ typedef enum { } RFLiCtrlCheckType; typedef struct { - u32 mIdentifier; // 0x00 - u16 mSecretFlag; // 0x04 + u32 mIdentifier; // 0x00 + u16 mSecretFlag; // 0x04 - u16 padding1; // 0x06 - RFLiCharData mData[RFL_MAX_CTRL_BUFFER]; // 0x08 - u16 mDeleted; // 0x2EC - u16 mCheckSum; // 0x2EE + u16 padding1; // 0x06 + RFLiCharData mData[RFL_MAX_CTRL_BUFFER]; // 0x08 + u16 mDeleted; // 0x2EC + u16 mCheckSum; // 0x2EE } RFLiCtrlBuffer; typedef struct { - u8 isDelete[RFL_MAX_DATABASE]; + u8 isDelete[RFL_MAX_DATABASE]; } RFLiCtrlWriteDeleteList; typedef struct { - RFLiCtrlBuffer* mBuffer[WPAD_MAX_CONTROLLERS]; // 0x00 - BOOL mIsLoaded[WPAD_MAX_CONTROLLERS]; // 0x10 - RFLiCtrlBuffer* mReplaceBuf[RFL_MAX_REPLACE_BUFFER]; // 0x20 + RFLiCtrlBuffer* mBuffer[WPAD_MAX_CONTROLLERS]; // 0x00 + BOOL mIsLoaded[WPAD_MAX_CONTROLLERS]; // 0x10 + RFLiCtrlBuffer* mReplaceBuf[RFL_MAX_REPLACE_BUFFER]; // 0x20 - BOOL mIsRead; // 0x28 - CARDFileInfo mFile; // 0x2C + BOOL mIsRead; // 0x28 + CARDFileInfo mFile; // 0x2C - void* mTmpReadBuffer; // 0x40 - void* mReadBuffer; // 0x44 + void* mTmpReadBuffer; // 0x40 + void* mReadBuffer; // 0x44 - void* mWriteBuffer; // 0x48 - u16 mWriteSize; // 0x4C - u16 mWriteOffset; // 0x4E + void* mWriteBuffer; // 0x48 + u16 mWriteSize; // 0x4C + u16 mWriteOffset; // 0x4E - u16 mDeleted; // 0x50 - s32 mWriteChannel; // 0x54 - const RFLiCtrlWriteDeleteList* mWriteDeleteList; // 0x58 + u16 mDeleted; // 0x50 + s32 mWriteChannel; // 0x54 + const RFLiCtrlWriteDeleteList* mWriteDeleteList; // 0x58 - u16 mReadSize; // 0x5C - u16 mCurrentPos; // 0x5E - BOOL mReadIsChMode; // 0x60 - u8 mWriteCount; // 0x64 - u16 mRWLen; // 0x66 - u8 mRetry; // 0x68 - u8* mVerifyBuffer; // 0x6C - RFLMiddleDatabase mHiddenMDB; // 0x70 + u16 mReadSize; // 0x5C + u16 mCurrentPos; // 0x5E + BOOL mReadIsChMode; // 0x60 + u8 mWriteCount; // 0x64 + u16 mRWLen; // 0x66 + u8 mRetry; // 0x68 + u8* mVerifyBuffer; // 0x6C + RFLMiddleDatabase mHiddenMDB; // 0x70 } RFLiCtrlManager; -void RFLiInitCtrlBuf(MEMiHeapHead* sysHeap); -BOOL RFLiCheckCtrlBufferCore(const RFLiCtrlBuffer* buffer, u8 index, RFLiCtrlCheckType type); +void RFLiInitCtrlBuf(MEMiHeapHead* sysHeap); +BOOL RFLiCheckCtrlBufferCore(const RFLiCtrlBuffer* buffer, u8 index, RFLiCtrlCheckType type); -RFLErrcode RFLiLoadControllerAsync(s32 chan, BOOL isChannel); -RFLErrcode RFLiSaveControllerAsync(s32 chan, u16 deleted); +RFLErrcode RFLiLoadControllerAsync(s32 chan, BOOL isChannel); +RFLErrcode RFLiSaveControllerAsync(s32 chan, u16 deleted); -BOOL RFLiFormatControllerData(s32 chan); +BOOL RFLiFormatControllerData(s32 chan); -BOOL RFLiSetControllerDataIdx(u16 srcIndex, s32 chan, u8 ctrlIndex); -BOOL RFLiSetControllerData(const RFLiCharInfo* src, s32 chan, u8 index); -BOOL RFLiGetControllerData(RFLiCharInfo* dst, s32 chan, u8 index, BOOL hiddenAvailable); +BOOL RFLiSetControllerDataIdx(u16 srcIndex, s32 chan, u8 ctrlIndex); +BOOL RFLiSetControllerData(const RFLiCharInfo* src, s32 chan, u8 index); +BOOL RFLiGetControllerData(RFLiCharInfo* dst, s32 chan, u8 index, BOOL hiddenAvailable); -BOOL RFLiIsAvailableControllerData(s32 chan, u8 index, RFLiCtrlCheckType type); +BOOL RFLiIsAvailableControllerData(s32 chan, u8 index, RFLiCtrlCheckType type); -void RFLiClearConrtollerDataIdx(s32 chan, u8 index); +void RFLiClearConrtollerDataIdx(s32 chan, u8 index); #ifdef __cplusplus } #endif -#endif // RFLi_CONTROLLER_H +#endif // RFLi_CONTROLLER_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_DataUtility.h b/libs/RVLFaceLib/include/internal/RFLi_DataUtility.h index 55209e1a..15bda8ab 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_DataUtility.h +++ b/libs/RVLFaceLib/include/internal/RFLi_DataUtility.h @@ -12,17 +12,17 @@ extern "C" { #endif -BOOL RFLiCheckValidInfo(const RFLiCharInfo* info); -BOOL RFLiCheckValidInfoNoName(const RFLiCharInfo* info); -BOOL RFLiIsValidOnNAND(const RFLiCharInfo* info); -BOOL RFLiIsSameFaceCore(const RFLiCharInfo* lhv, const RFLiCharInfo* rhv); +BOOL RFLiCheckValidInfo(const RFLiCharInfo* info); +BOOL RFLiCheckValidInfoNoName(const RFLiCharInfo* info); +BOOL RFLiIsValidOnNAND(const RFLiCharInfo* info); +BOOL RFLiIsSameFaceCore(const RFLiCharInfo* lhv, const RFLiCharInfo* rhv); -RFLErrcode RFLiPickupCharInfo(RFLiCharInfo* info, RFLDataSource source, const RFLMiddleDatabase* middleDB, u16 index); +RFLErrcode RFLiPickupCharInfo(RFLiCharInfo* info, RFLDataSource source, const RFLMiddleDatabase* middleDB, u16 index); -BOOL RFLiCheckBirthday(u8 month, u8 day); +BOOL RFLiCheckBirthday(u8 month, u8 day); #ifdef __cplusplus } #endif -#endif // RFLi_DATA_UTILITY_H +#endif // RFLi_DATA_UTILITY_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_Database.h b/libs/RVLFaceLib/include/internal/RFLi_Database.h index 33536b92..09666899 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_Database.h +++ b/libs/RVLFaceLib/include/internal/RFLi_Database.h @@ -8,108 +8,109 @@ #include -#include #include +#include + #ifdef __cplusplus extern "C" { #endif typedef struct { - void* head; // 0x00 - u32 size; // 0x04 - u8* current; // 0x08 - u32 count; // 0x0C - u16 crc; // 0x10 + void* head; // 0x00 + u32 size; // 0x04 + u8* current; // 0x08 + u32 count; // 0x0C + u16 crc; // 0x10 - OSAlarm alarm; // 0x18 - RFLSimpleCBArg callback; // 0x48 + OSAlarm alarm; // 0x18 + RFLSimpleCBArg callback; // 0x48 } RFLiDatabaseCRCInfo; typedef struct { - u32 identifier; // 0x00 - RFLiCharData rawdata[RFL_MAX_DATABASE]; // 0x04 - u32 isolation : 1; // 0x1CEC - u32 padding1 : 31; // 0x1CEC + u32 identifier; // 0x00 + RFLiCharData rawdata[RFL_MAX_DATABASE]; // 0x04 + u32 isolation : 1; // 0x1CEC + u32 padding1 : 31; // 0x1CEC - u8 specialInvite[13]; // 0x1CF0 - u8 month_nwc24; // 0x1CFD - u8 day_nwc24; // 0x1CFE - u8 padding2; // 0x1CFF + u8 specialInvite[13]; // 0x1CF0 + u8 month_nwc24; // 0x1CFD + u8 day_nwc24; // 0x1CFE + u8 padding2; // 0x1CFF - RFLiHiddenDatabase hidden; // 0x1D00 + RFLiHiddenDatabase hidden; // 0x1D00 } RFLiDatabase; typedef struct { - RFLiDatabase* mDatabase; // 0x00 - RFLSimpleCB saveCallback; // 0x04 - RFLSimpleCB formatCallback; // 0x08 - RFLSimpleCB bootloadCallback; // 0x0C - RFLiOpenType saveType; // 0x10 + RFLiDatabase* mDatabase; // 0x00 + RFLSimpleCB saveCallback; // 0x04 + RFLSimpleCB formatCallback; // 0x08 + RFLSimpleCB bootloadCallback; // 0x0C + RFLiOpenType saveType; // 0x10 union { - RFLiCharData mDeleteTrg; // 0x14 - RFLiCharData mSetTrg; // 0x14 + RFLiCharData mDeleteTrg; // 0x14 + RFLiCharData mSetTrg; // 0x14 }; - RFLiDatabaseCRCInfo crcInfo; // 0x60 + RFLiDatabaseCRCInfo crcInfo; // 0x60 } RFLiDatabaseManager; -void RFLiInitDatabase(MEMiHeapHead* sysHeap); +void RFLiInitDatabase(MEMiHeapHead* sysHeap); -RFLErrcode RFLiBootLoadDatabaseAsync(RFLSimpleCB cb); -RFLErrcode RFLiSaveDatabaseAsync(RFLSimpleCB cb); -RFLErrcode RFLiSaveOpenedDatabaseAsync(RFLSimpleCB cb); -RFLErrcode RFLiSaveDatabase(); +RFLErrcode RFLiBootLoadDatabaseAsync(RFLSimpleCB cb); +RFLErrcode RFLiSaveDatabaseAsync(RFLSimpleCB cb); +RFLErrcode RFLiSaveOpenedDatabaseAsync(RFLSimpleCB cb); +RFLErrcode RFLiSaveDatabase(); -RFLiCharData* RFLiGetCharData(u16 index); -BOOL RFLiClrCharInfo(u16 index, RFLiCharData* deleted); +RFLiCharData* RFLiGetCharData(u16 index); +BOOL RFLiClrCharInfo(u16 index, RFLiCharData* deleted); -void RFLiConvertRaw2Info(const RFLiCharData* data, RFLiCharInfo* info); -void RFLiConvertHRaw2Info(const RFLiHiddenCharData* data, RFLiCharInfo* info); -void RFLiConvertInfo2Raw(const RFLiCharInfo* info, RFLiCharData* data); -void RFLiConvertInfo2HRaw(const RFLiCharInfo* info, RFLiHiddenCharData* data); -void RFLiConvertHRaw2Raw(const RFLiHiddenCharData* hdata, RFLiCharData* data); -void RFLiConvertRaw2HRaw(const RFLiCharData* data, RFLiHiddenCharData* hdata); -RFLErrcode RFLiGetCharRawData(RFLiCharData* data, u16 index); +void RFLiConvertRaw2Info(const RFLiCharData* data, RFLiCharInfo* info); +void RFLiConvertHRaw2Info(const RFLiHiddenCharData* data, RFLiCharInfo* info); +void RFLiConvertInfo2Raw(const RFLiCharInfo* info, RFLiCharData* data); +void RFLiConvertInfo2HRaw(const RFLiCharInfo* info, RFLiHiddenCharData* data); +void RFLiConvertHRaw2Raw(const RFLiHiddenCharData* hdata, RFLiCharData* data); +void RFLiConvertRaw2HRaw(const RFLiCharData* data, RFLiHiddenCharData* hdata); +RFLErrcode RFLiGetCharRawData(RFLiCharData* data, u16 index); -RFLErrcode RFLiGetCharInfo(RFLiCharInfo* info, u16 index); -BOOL RFLiSetCharInfo(const RFLiCharInfo* info, u16 index); +RFLErrcode RFLiGetCharInfo(RFLiCharInfo* info, u16 index); +BOOL RFLiSetCharInfo(const RFLiCharInfo* info, u16 index); -BOOL RFLiSetAndSaveCharInfoAsync(const RFLiCharInfo* info, u16 index); -BOOL RFLiDeleteCharForCtrlMode(u16 index); -BOOL RFLiDeleteAndSaveCharInfoAsync(u16 index); +BOOL RFLiSetAndSaveCharInfoAsync(const RFLiCharInfo* info, u16 index); +BOOL RFLiDeleteCharForCtrlMode(u16 index); +BOOL RFLiDeleteAndSaveCharInfoAsync(u16 index); -s32 RFLiGetMinimumBlankIndex(); +s32 RFLiGetMinimumBlankIndex(); -void RFLiSetCreateID(RFLiCharInfo* info, BOOL isSpecialData); -void RFLiSetTemporaryID(RFLiCharInfo* info); +void RFLiSetCreateID(RFLiCharInfo* info, BOOL isSpecialData); +void RFLiSetTemporaryID(RFLiCharInfo* info); -BOOL RFLiIsSameID(const RFLCreateID* lhv, const RFLCreateID* rhv); -BOOL RFLiIsMyHomeID(const RFLCreateID* id); -BOOL RFLiIsValidID(const RFLCreateID* id); -BOOL RFLiIsSpecialID(const RFLCreateID* id); -BOOL RFLiIsDSID(const RFLCreateID* id); -BOOL RFLiIsTemporaryID(const RFLCreateID* id); +BOOL RFLiIsSameID(const RFLCreateID* lhv, const RFLCreateID* rhv); +BOOL RFLiIsMyHomeID(const RFLCreateID* id); +BOOL RFLiIsValidID(const RFLCreateID* id); +BOOL RFLiIsSpecialID(const RFLCreateID* id); +BOOL RFLiIsDSID(const RFLCreateID* id); +BOOL RFLiIsTemporaryID(const RFLCreateID* id); -BOOL RFLiIsValidName(const RFLiCharData* data); -BOOL RFLiIsValidName2(const RFLiCharInfo* data); +BOOL RFLiIsValidName(const RFLiCharData* data); +BOOL RFLiIsValidName2(const RFLiCharInfo* data); -BOOL RFLiGetIsolation(); -void RFLiSetIsolation(BOOL isolation); +BOOL RFLiGetIsolation(); +void RFLiSetIsolation(BOOL isolation); RFLiHiddenDatabase* RFLiGetHiddenHeader(); -BOOL RFLiDBIsLoaded(); +BOOL RFLiDBIsLoaded(); -u16 RFLiCalculateCRC(void* head, u32 size); +u16 RFLiCalculateCRC(void* head, u32 size); -void RFLiCreateHeaderCRC(); -void RFLiCreateHeaderCRCAsync(RFLSimpleCBArg cb); +void RFLiCreateHeaderCRC(); +void RFLiCreateHeaderCRCAsync(RFLSimpleCBArg cb); -BOOL RFLiCheckHeaderCRC(); -void RFLiCheckHeaderCRCAsync(RFLSimpleCBArg cb); +BOOL RFLiCheckHeaderCRC(); +void RFLiCheckHeaderCRCAsync(RFLSimpleCBArg cb); #ifdef __cplusplus } #endif -#endif // RFLi_DATABASE_H +#endif // RFLi_DATABASE_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_Debug.h b/libs/RVLFaceLib/include/internal/RFLi_Debug.h index e6bb25fd..83c1d2d2 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_Debug.h +++ b/libs/RVLFaceLib/include/internal/RFLi_Debug.h @@ -10,6 +10,7 @@ extern "C" { #endif +// clang-format off #ifdef RFL_DEBUG #define RFLi_REPORT(...) OSReport(__VA_ARGS__) @@ -31,9 +32,10 @@ extern "C" { #define RFLi_ASSERTLINE_RANGE(i, min, max, line) ((void)0) #endif +// clang-format on #ifdef __cplusplus } #endif -#endif // RFLi_DEBUG_H +#endif // RFLi_DEBUG_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_DefaultDatabase.h b/libs/RVLFaceLib/include/internal/RFLi_DefaultDatabase.h index 4b7ac829..a6b7657c 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_DefaultDatabase.h +++ b/libs/RVLFaceLib/include/internal/RFLi_DefaultDatabase.h @@ -8,13 +8,13 @@ extern "C" { #endif -#define RFL_DEFAULT_DATA_MAX 6 +#define RFL_DEFAULT_DATA_MAX 6 -RFLiCharData* RFLiGetDefaultDataPtr(u16 index); -void RFLiGetDefaultData(RFLiCharInfo* info, u16 index); +RFLiCharData* RFLiGetDefaultDataPtr(u16 index); +void RFLiGetDefaultData(RFLiCharInfo* info, u16 index); #ifdef __cplusplus } #endif -#endif // RFLi_DEFAULT_DATABASE_H +#endif // RFLi_DEFAULT_DATABASE_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_FaceConfig.h b/libs/RVLFaceLib/include/internal/RFLi_FaceConfig.h index 4cbd634b..f9825927 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_FaceConfig.h +++ b/libs/RVLFaceLib/include/internal/RFLi_FaceConfig.h @@ -9,76 +9,76 @@ extern "C" { /* FACELINE */ -#define RFLi_FACELINE_TYPE_MAX 7 +#define RFLi_FACELINE_TYPE_MAX 7 #define RFLi_FACELINE_COLOR_MAX 5 -#define RFLi_FACELINE_TEX_MAX 11 +#define RFLi_FACELINE_TEX_MAX 11 /* HAIR */ -#define RFLi_HAIR_TYPE_MAX 71 -#define RFLi_HAIR_COLOR_MAX 7 -#define RFLi_HAIR_FLIP_MAX 1 +#define RFLi_HAIR_TYPE_MAX 71 +#define RFLi_HAIR_COLOR_MAX 7 +#define RFLi_HAIR_FLIP_MAX 1 /* EYE */ -#define RFLi_EYE_TYPE_MAX 47 -#define RFLi_EYE_COLOR_MAX 5 -#define RFLi_EYE_SCALE_MAX 7 -#define RFLi_EYE_ROT_MAX 7 -#define RFLi_EYE_X_MAX 12 -#define RFLi_EYE_Y_MAX 18 +#define RFLi_EYE_TYPE_MAX 47 +#define RFLi_EYE_COLOR_MAX 5 +#define RFLi_EYE_SCALE_MAX 7 +#define RFLi_EYE_ROT_MAX 7 +#define RFLi_EYE_X_MAX 12 +#define RFLi_EYE_Y_MAX 18 /* EYEBROW */ -#define RFLi_EYEBROW_TYPE_MAX 23 -#define RFLi_EYEBROW_COLOR_MAX 7 -#define RFLi_EYEBROW_SCALE_MAX 8 -#define RFLi_EYEBROW_ROT_MAX 11 -#define RFLi_EYEBROW_X_MAX 12 -#define RFLi_EYEBROW_Y_MIN 3 -#define RFLi_EYEBROW_Y_MAX 18 +#define RFLi_EYEBROW_TYPE_MAX 23 +#define RFLi_EYEBROW_COLOR_MAX 7 +#define RFLi_EYEBROW_SCALE_MAX 8 +#define RFLi_EYEBROW_ROT_MAX 11 +#define RFLi_EYEBROW_X_MAX 12 +#define RFLi_EYEBROW_Y_MIN 3 +#define RFLi_EYEBROW_Y_MAX 18 /* NOSE */ -#define RFLi_NOSE_TYPE_MAX 11 -#define RFLi_NOSE_SCALE_MAX 8 -#define RFLi_NOSE_Y_MAX 18 +#define RFLi_NOSE_TYPE_MAX 11 +#define RFLi_NOSE_SCALE_MAX 8 +#define RFLi_NOSE_Y_MAX 18 /* MOUTH */ -#define RFLi_MOUTH_TYPE_MAX 23 -#define RFLi_MOUTH_COLOR_MAX 2 -#define RFLi_MOUTH_SCALE_MAX 8 -#define RFLi_MOUTH_Y_MAX 18 +#define RFLi_MOUTH_TYPE_MAX 23 +#define RFLi_MOUTH_COLOR_MAX 2 +#define RFLi_MOUTH_SCALE_MAX 8 +#define RFLi_MOUTH_Y_MAX 18 /* BEARD */ #define RFLi_BEARD_MUSTACHE_MAX 3 -#define RFLi_BEARD_TYPE_MAX 3 -#define RFLi_BEARD_COLOR_MAX 7 -#define RFLi_BEARD_SCALE_MAX 8 -#define RFLi_BEARD_Y_MAX 16 +#define RFLi_BEARD_TYPE_MAX 3 +#define RFLi_BEARD_COLOR_MAX 7 +#define RFLi_BEARD_SCALE_MAX 8 +#define RFLi_BEARD_Y_MAX 16 /* MUSTACHE */ /* GLASS */ -#define RFLi_GLASS_TYPE_MAX 8 -#define RFLi_GLASS_COLOR_MAX 5 -#define RFLi_GLASS_SCALE_MAX 7 -#define RFLi_GLASS_Y_MAX 20 +#define RFLi_GLASS_TYPE_MAX 8 +#define RFLi_GLASS_COLOR_MAX 5 +#define RFLi_GLASS_SCALE_MAX 7 +#define RFLi_GLASS_Y_MAX 20 /* MOLE */ -#define RFLi_MOLE_TYPE_MAX 1 -#define RFLi_MOLE_SCALE_MAX 8 -#define RFLi_MOLE_X_MAX 16 -#define RFLi_MOLE_Y_MAX 30 +#define RFLi_MOLE_TYPE_MAX 1 +#define RFLi_MOLE_SCALE_MAX 8 +#define RFLi_MOLE_X_MAX 16 +#define RFLi_MOLE_Y_MAX 30 /* HEIGHT & BUILD */ -#define RFLi_HEIGHT_MAX 128 -#define RFLi_BUILD_MAX 128 +#define RFLi_HEIGHT_MAX 128 +#define RFLi_BUILD_MAX 128 /* TEXTURE STUFF */ @@ -86,4 +86,4 @@ extern "C" { } #endif -#endif // RFLi_FACE_CONFIGURATION_H +#endif // RFLi_FACE_CONFIGURATION_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_FaceConfig/colors.h b/libs/RVLFaceLib/include/internal/RFLi_FaceConfig/colors.h index e9d19f07..5e0d868c 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_FaceConfig/colors.h +++ b/libs/RVLFaceLib/include/internal/RFLi_FaceConfig/colors.h @@ -8,6 +8,7 @@ extern "C" { #endif +// clang-format off static const GXColor RFLi_MOLE_COLOR0 = { 18, 15, 15, 255 }; static const GXColor RFLi_EYE_COLOR1[RFLi_EYE_COLOR_MAX+1] = { @@ -52,6 +53,7 @@ static const GXColor RFLi_BEARD_COLOR0[RFLi_BEARD_COLOR_MAX+1] = { { 122, 89, 40, 255 }, { 193, 159, 100, 255 } }; +// clang-format on #ifdef __cplusplus } diff --git a/libs/RVLFaceLib/include/internal/RFLi_FaceConfig/offsets.h b/libs/RVLFaceLib/include/internal/RFLi_FaceConfig/offsets.h index 0fa86b81..3d51a2ac 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_FaceConfig/offsets.h +++ b/libs/RVLFaceLib/include/internal/RFLi_FaceConfig/offsets.h @@ -8,6 +8,7 @@ extern "C" { #endif +// clang-format off static const u8 RFLi_EYE_ROT_OFFSET[] = { 29, 28, 28, 28, 29, 28, 28, 28, 29, 28, 28, 28, 28, 29, 29, 28, @@ -23,9 +24,10 @@ static const u8 RFLi_EYEBROW_ROT_OFFSET[] = { 28, 25, 26, 24, 27, 27, 26, 26, 25, 25, 26, 26, 27, 26, 25, 27 }; +// clang-format on #ifdef __cplusplus } #endif -#endif // RFLi_FACE_CONFIGURATION_OFFSETS_H +#endif // RFLi_FACE_CONFIGURATION_OFFSETS_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_Format.h b/libs/RVLFaceLib/include/internal/RFLi_Format.h index aa19d92d..5132d1b0 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_Format.h +++ b/libs/RVLFaceLib/include/internal/RFLi_Format.h @@ -8,21 +8,21 @@ extern "C" { #endif typedef struct { - RFLCreateID createID; // 0x00 - u16 sex : 1; // 0x08 + RFLCreateID createID; // 0x00 + u16 sex : 1; // 0x08 - s16 next : 15; // 0x08 - s16 padding2 : 1; // 0x0A - s16 prev : 15; // 0x0A + s16 next : 15; // 0x08 + s16 padding2 : 1; // 0x0A + s16 prev : 15; // 0x0A } RFLiFormatTable; -void RFLiClearTableData(RFLiFormatTable* data); -void RFLiClearDBBuffer(); +void RFLiClearTableData(RFLiFormatTable* data); +void RFLiClearDBBuffer(); -RFLErrcode RFLiFormatAsync(RFLSimpleCB cb); +RFLErrcode RFLiFormatAsync(RFLSimpleCB cb); #ifdef __cplusplus } #endif -#endif // RFLi_FORMAT_H +#endif // RFLi_FORMAT_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_HiddenDatabase.h b/libs/RVLFaceLib/include/internal/RFLi_HiddenDatabase.h index 9da21c4d..6f1ff0e4 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_HiddenDatabase.h +++ b/libs/RVLFaceLib/include/internal/RFLi_HiddenDatabase.h @@ -6,8 +6,9 @@ #include #include -#include #include +#include + #include @@ -15,20 +16,20 @@ extern "C" { #endif -#define RFLi_HIDDEN_DB_IDENTIFIER 0x524E4844 /*'RNHD'*/ +#define RFLi_HIDDEN_DB_IDENTIFIER 0x524E4844 /*'RNHD'*/ -#define RFL_MAX_HIDDEN_DB (10000) +#define RFL_MAX_HIDDEN_DB (10000) typedef struct { - u32 identifier; // 0x00 + u32 identifier; // 0x00 - s16 head; // 0x04 - s16 tail; // 0x06 + s16 head; // 0x04 + s16 tail; // 0x06 - RFLiFormatTable data[RFL_MAX_HIDDEN_DB]; // 0x08 - u8 padding[22]; // 0x1D4C8 + RFLiFormatTable data[RFL_MAX_HIDDEN_DB]; // 0x08 + u8 padding[22]; // 0x1D4C8 - u16 crc; // 0x1D4DE + u16 crc; // 0x1D4DE } RFLiHiddenDatabase; typedef struct { @@ -38,66 +39,66 @@ typedef struct { } RFLiHiddenDBList; typedef struct { - BOOL loaded; // 0x00 - BOOL readError; // 0x04 + BOOL loaded; // 0x00 + BOOL readError; // 0x04 - void* writeTmp; // 0x08 - s16 writeIndex; // 0x0C - RFLSimpleCB writeCallback; // 0x10 + void* writeTmp; // 0x08 + s16 writeIndex; // 0x0C + RFLSimpleCB writeCallback; // 0x10 - void* formatTmp; // 0x14 - RFLSimpleCB formatCallback; // 0x18 - s16 formatIndex; // 0x1C + void* formatTmp; // 0x14 + RFLSimpleCB formatCallback; // 0x18 + s16 formatIndex; // 0x1C - RFLiHiddenCharData* loadDst; // 0x20 - void* loadTmp; // 0x24 - u32 loadArg; // 0x28 - RFLSimpleCBArg loadCallback; // 0x2C - u16 loadIndex; // 0x30 + RFLiHiddenCharData* loadDst; // 0x20 + void* loadTmp; // 0x24 + u32 loadArg; // 0x28 + RFLSimpleCBArg loadCallback; // 0x2C + u16 loadIndex; // 0x30 - RFLiHiddenCharData* cachedDB; // 0x34 - BOOL cached; // 0x38 + RFLiHiddenCharData* cachedDB; // 0x34 + BOOL cached; // 0x38 - RFLiHiddenDBList list; // 0x3C + RFLiHiddenDBList list; // 0x3C } RFLiHiddenDBManager; -void RFLiInitHiddenDatabase(); +void RFLiInitHiddenDatabase(); -RFLErrcode RFLiLoadHiddenDataAsync(RFLiHiddenCharData* data, u16 index, RFLSimpleCBArg cb, u32 arg); -RFLErrcode RFLiLoadCachedHiddenData(RFLiHiddenCharData* data, u16 index); +RFLErrcode RFLiLoadHiddenDataAsync(RFLiHiddenCharData* data, u16 index, RFLSimpleCBArg cb, u32 arg); +RFLErrcode RFLiLoadCachedHiddenData(RFLiHiddenCharData* data, u16 index); -RFLErrcode RFLiSaveHiddenHeaderAsync(RFLSimpleCB cb); +RFLErrcode RFLiSaveHiddenHeaderAsync(RFLSimpleCB cb); -RFLErrcode RFLiDeleteHiddenData(u16 index); -RFLErrcode RFLiDeleteHiddenDataID(const RFLCreateID* id); -RFLErrcode RFLiDeleteHiddenDataAsync(u16 index); -RFLErrcode RFLiDeleteHiddenDataIDAsync(const RFLCreateID* id); +RFLErrcode RFLiDeleteHiddenData(u16 index); +RFLErrcode RFLiDeleteHiddenDataID(const RFLCreateID* id); +RFLErrcode RFLiDeleteHiddenDataAsync(u16 index); +RFLErrcode RFLiDeleteHiddenDataIDAsync(const RFLCreateID* id); -BOOL RFLiUpdateOfficial2DeleteHidden(const RFLCreateID* id); +BOOL RFLiUpdateOfficial2DeleteHidden(const RFLCreateID* id); -RFLErrcode RFLiWriteCtrlToHiddenDB(const RFLiCtrlBuffer* buffer, BOOL isChMode); +RFLErrcode RFLiWriteCtrlToHiddenDB(const RFLiCtrlBuffer* buffer, BOOL isChMode); -RFLErrcode RFLiOneDataToHiddenDB(const RFLiHiddenCharData* data); +RFLErrcode RFLiOneDataToHiddenDB(const RFLiHiddenCharData* data); -RFLErrcode RFLiDeleteSaveHiddenDataAsync(const RFLiCharData* data); +RFLErrcode RFLiDeleteSaveHiddenDataAsync(const RFLiCharData* data); -s16 RFLiSearchHiddenData(const RFLCreateID* id); -u16 RFLiCountupHiddenDataNum(RFLSex sex); +s16 RFLiSearchHiddenData(const RFLCreateID* id); +u16 RFLiCountupHiddenDataNum(RFLSex sex); -s16 RFLiGetHiddenNext(u16 index); -s16 RFLiGetHiddenPrev(u16 index); +s16 RFLiGetHiddenNext(u16 index); +s16 RFLiGetHiddenPrev(u16 index); -BOOL RFLiIsValidHiddenData(u16 index, RFLSex sex); +BOOL RFLiIsValidHiddenData(u16 index, RFLSex sex); -u32 RFLiGetCacheHDBBufferSize(); -void RFLiClearCacheHDB(void* cache); -RFLErrcode RFLiCacheHDBAsync(void* buffer); -RFLErrcode RFLiCacheHDB(void* buffer); -RFLErrcode RFLiFreeCacheHDB(); -BOOL RFLiIsCachedHDB(); +u32 RFLiGetCacheHDBBufferSize(); +void RFLiClearCacheHDB(void* cache); +RFLErrcode RFLiCacheHDBAsync(void* buffer); +RFLErrcode RFLiCacheHDB(void* buffer); +RFLErrcode RFLiFreeCacheHDB(); +BOOL RFLiIsCachedHDB(); #ifdef __cplusplus } #endif -#endif // RFLi_HIDDEN_DATABASE_H +#endif // RFLi_HIDDEN_DATABASE_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_Icon.h b/libs/RVLFaceLib/include/internal/RFLi_Icon.h index 38268274..12dfb230 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_Icon.h +++ b/libs/RVLFaceLib/include/internal/RFLi_Icon.h @@ -10,11 +10,11 @@ extern "C" { #endif -void RFLiMakeIconFromData(void* buf, const RFLiCharData* data, RFLExpression expression, const RFLIconSetting* setting); -void RFLiMakeIcon(void* buf, const RFLiCharInfo* info, RFLExpression expression, const RFLIconSetting* setting); +void RFLiMakeIconFromData(void* buf, const RFLiCharData* data, RFLExpression expression, const RFLIconSetting* setting); +void RFLiMakeIcon(void* buf, const RFLiCharInfo* info, RFLExpression expression, const RFLIconSetting* setting); #ifdef __cplusplus } #endif -#endif // RFLi_ICON_H +#endif // RFLi_ICON_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_LibConfig.h b/libs/RVLFaceLib/include/internal/RFLi_LibConfig.h index 1883212f..c11a119f 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_LibConfig.h +++ b/libs/RVLFaceLib/include/internal/RFLi_LibConfig.h @@ -10,6 +10,8 @@ extern "C" { #endif +// clang-format off + /* Available builds: 20080218 (used) 20080306 @@ -31,8 +33,10 @@ extern "C" { #define RFL_ALIGN 8 #define RFL_BUFFER_ALIGN DEFAULT_ALIGN /* 32 */ +// clang-format on + #ifdef __cplusplus } #endif -#endif // RFLi_CONFIGURATION_H +#endif // RFLi_CONFIGURATION_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_MakeRandomFace.h b/libs/RVLFaceLib/include/internal/RFLi_MakeRandomFace.h index 395858d2..43fd79cd 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_MakeRandomFace.h +++ b/libs/RVLFaceLib/include/internal/RFLi_MakeRandomFace.h @@ -8,24 +8,24 @@ extern "C" { #endif -void RFLi_MakeRandomFace(RFLiCharInfo* pCharInfo, RFLSex argSex, RFLAge argAge, RFLRace argRace); +void RFLi_MakeRandomFace(RFLiCharInfo* pCharInfo, RFLSex argSex, RFLAge argAge, RFLRace argRace); -u32 RFLi_GetRandU32(u32 max); +u32 RFLi_GetRandU32(u32 max); -u8 RFLi_GetFacelineType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race); -u8 RFLi_GetHairType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race); -u8 RFLi_GetEyeType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race); -u8 RFLi_GetEyebrowType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race); -u8 RFLi_GetNoseType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race); -u8 RFLi_GetMouthType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race); -u8 RFLi_GetFaceTexType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race); -u8 RFLi_GetGlassType(RFLi_AGE age); -u8 RFLi_GetFaceColor(RFLi_SEX sex, RFLi_RACE race); -u8 RFLi_GetHairColor(RFLi_AGE age, RFLi_RACE race); -u8 RFLi_GetEyeColor(RFLi_RACE race); +u8 RFLi_GetFacelineType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race); +u8 RFLi_GetHairType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race); +u8 RFLi_GetEyeType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race); +u8 RFLi_GetEyebrowType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race); +u8 RFLi_GetNoseType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race); +u8 RFLi_GetMouthType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race); +u8 RFLi_GetFaceTexType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race); +u8 RFLi_GetGlassType(RFLi_AGE age); +u8 RFLi_GetFaceColor(RFLi_SEX sex, RFLi_RACE race); +u8 RFLi_GetHairColor(RFLi_AGE age, RFLi_RACE race); +u8 RFLi_GetEyeColor(RFLi_RACE race); #ifdef __cplusplus } #endif -#endif // RFLi_MAKE_RANDOM_FACE_H +#endif // RFLi_MAKE_RANDOM_FACE_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_MakeTex.h b/libs/RVLFaceLib/include/internal/RFLi_MakeTex.h index 717037b4..19008017 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_MakeTex.h +++ b/libs/RVLFaceLib/include/internal/RFLi_MakeTex.h @@ -4,8 +4,9 @@ #include #include -#include #include +#include + #include @@ -14,60 +15,60 @@ extern "C" { #endif typedef struct { - f32 x; // 0x00 - f32 y; // 0x04 + f32 x; // 0x00 + f32 y; // 0x04 - f32 width; // 0x08 - f32 height; // 0x0C + f32 width; // 0x08 + f32 height; // 0x0C - f32 angle; // 0x10 - RFLi_ORIGIN origin; // 0x14 - RFLTexObj ngtobj; // 0x18 + f32 angle; // 0x10 + RFLi_ORIGIN origin; // 0x14 + RFLTexObj ngtobj; // 0x18 } RFLiFacePart; typedef struct { - RFLiFacePart eyeR; // 0x00 - RFLiFacePart eyeL; // 0x40 + RFLiFacePart eyeR; // 0x00 + RFLiFacePart eyeL; // 0x40 - RFLiFacePart eyebrowR; // 0x80 - RFLiFacePart eyebrowL; // 0xC0 + RFLiFacePart eyebrowR; // 0x80 + RFLiFacePart eyebrowL; // 0xC0 - RFLiFacePart mouth; // 0x100 + RFLiFacePart mouth; // 0x100 - RFLiFacePart mustacheR; // 0x140 - RFLiFacePart mustacheL; // 0x180 - RFLiFacePart mole; // 0x1C0 + RFLiFacePart mustacheR; // 0x140 + RFLiFacePart mustacheL; // 0x180 + RFLiFacePart mole; // 0x1C0 } RFLiFaceData; // HMMMMM... -void RFLiSetupCopyTex(GXTexFmt texFmt, u16 width, u16 height, void* buf, GXColor clearColor); +void RFLiSetupCopyTex(GXTexFmt texFmt, u16 width, u16 height, void* buf, GXColor clearColor); -void RFLiMakeTexture(const RFLiCharInfo* pCharInfo, u8** texBuffer, RFLResolution resolution); +void RFLiMakeTexture(const RFLiCharInfo* pCharInfo, u8** texBuffer, RFLResolution resolution); -void RFLiInitFaceParts(const RFLiCharInfo* pCharInfo, RFLiFaceData* pFace); -void RFLiInitRFLTexture(RFLTexObj* pRFLTexObj); +void RFLiInitFaceParts(const RFLiCharInfo* pCharInfo, RFLiFaceData* pFace); +void RFLiInitRFLTexture(RFLTexObj* pRFLTexObj); -void RFLiSetup2DCameraAndParam(); +void RFLiSetup2DCameraAndParam(); -void RFLiSetTev4Mole(); -void RFLiSetTev4Mouth(u32 mouthColor); -void RFLiSetTev4Eye(u32 eyeColor, u32 eyeType); -void RFLiSetTev4Eyebrow(u32 eyebrowColor); -void RFLiSetTev4Mustache(u32 mustacheColor); +void RFLiSetTev4Mole(); +void RFLiSetTev4Mouth(u32 mouthColor); +void RFLiSetTev4Eye(u32 eyeColor, u32 eyeType); +void RFLiSetTev4Eyebrow(u32 eyebrowColor); +void RFLiSetTev4Mustache(u32 mustacheColor); -void RFLiSetFaceParts(const RFLiCharInfo* pCharInfo, RFLiFaceData* pFace, RFLi_MASKRSL resolution); -void RFLiCapture(u8* texBuffer, const RFLiCharInfo* pCharInfo, RFLiFaceData* pFace, RFLi_MASKRSL resolution); -void RFLiDrawFaceParts(RFLiFacePart* pParts); +void RFLiSetFaceParts(const RFLiCharInfo* pCharInfo, RFLiFaceData* pFace, RFLi_MASKRSL resolution); +void RFLiCapture(u8* texBuffer, const RFLiCharInfo* pCharInfo, RFLiFaceData* pFace, RFLi_MASKRSL resolution); +void RFLiDrawFaceParts(RFLiFacePart* pParts); -void RFLiDrawQuad(f32 x, f32 y, f32 width, f32 height, f32 rotZ, RFLi_ORIGIN origin); +void RFLiDrawQuad(f32 x, f32 y, f32 width, f32 height, f32 rotZ, RFLi_ORIGIN origin); -RFLi_MASKRSL RFLiGetMaxMaskRsl(RFLResolution resolution); -u32 RFLiGetMaskSize(RFLi_MASKRSL maskResolution); -u32 RFLiGetMaskBufSize(RFLResolution resolution); +RFLi_MASKRSL RFLiGetMaxMaskRsl(RFLResolution resolution); +u32 RFLiGetMaskSize(RFLi_MASKRSL maskResolution); +u32 RFLiGetMaskBufSize(RFLResolution resolution); #ifdef __cplusplus } #endif -#endif // RFLi_MAKE_TEXTURE_H +#endif // RFLi_MAKE_TEXTURE_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_MiddleDatabase.h b/libs/RVLFaceLib/include/internal/RFLi_MiddleDatabase.h index 309de029..fcc9745f 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_MiddleDatabase.h +++ b/libs/RVLFaceLib/include/internal/RFLi_MiddleDatabase.h @@ -1,8 +1,9 @@ #ifndef RFLi_MIDDLE_DATABASE_H #define RFLi_MIDDLE_DATABASE_H -#include #include +#include + #include @@ -11,29 +12,29 @@ extern "C" { #endif typedef struct { - RFLMiddleDBType type; // 0x00 - RFLSimpleCB callback; // 0x04 + RFLMiddleDBType type; // 0x00 + RFLSimpleCB callback; // 0x04 - RFLiHiddenCharData* data; // 0x08 - u16 size; // 0x0C - u16 storedSize; // 0x0E + RFLiHiddenCharData* data; // 0x08 + u16 size; // 0x0C + u16 storedSize; // 0x0E - u32 userdata1; // 0x10 - u32 userdata2; // 0x14 + u32 userdata1; // 0x10 + u32 userdata2; // 0x14 } RFLiMiddleDatabase; -RFLErrcode RFLiUpdateMiddleDB(RFLMiddleDatabase* db); -RFLErrcode RFLiUpdateMiddleDBAsync(RFLMiddleDatabase* db, RFLSimpleCB cb, BOOL use_cache); +RFLErrcode RFLiUpdateMiddleDB(RFLMiddleDatabase* db); +RFLErrcode RFLiUpdateMiddleDBAsync(RFLMiddleDatabase* db, RFLSimpleCB cb, BOOL use_cache); -BOOL RFLiGetCharInfoMiddleDB(RFLiCharInfo* info, const RFLMiddleDatabase* db, u16 index); +BOOL RFLiGetCharInfoMiddleDB(RFLiCharInfo* info, const RFLMiddleDatabase* db, u16 index); -void RFLiDeleteMiddleDB(RFLMiddleDatabase* db, u16 index); -BOOL RFLiPassMiddleDB(RFLMiddleDatabase* db, u16 passNum); +void RFLiDeleteMiddleDB(RFLMiddleDatabase* db, u16 index); +BOOL RFLiPassMiddleDB(RFLMiddleDatabase* db, u16 passNum); -RFLErrcode RFLiAddMiddleDBUserData(RFLMiddleDatabase* db, const RFLCharData* data); +RFLErrcode RFLiAddMiddleDBUserData(RFLMiddleDatabase* db, const RFLCharData* data); #ifdef __cplusplus } #endif -#endif // RFLi_MIDDLE_DATABASE_H +#endif // RFLi_MIDDLE_DATABASE_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_Model.h b/libs/RVLFaceLib/include/internal/RFLi_Model.h index 0c06ba23..a98159a1 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_Model.h +++ b/libs/RVLFaceLib/include/internal/RFLi_Model.h @@ -2,8 +2,9 @@ #define RFLi_MODEL_H #include -#include #include +#include + #include @@ -14,12 +15,12 @@ extern "C" { #endif typedef struct { - u8 uOff; // 0x00 - u8 fOff; // 0x01 - u8 rOff; // 0x02 - int uRev; // 0x04 - int fRev; // 0x08 - int rRev; // 0x0C + u8 uOff; // 0x00 + u8 fOff; // 0x01 + u8 rOff; // 0x02 + int uRev; // 0x04 + int fRev; // 0x08 + int rRev; // 0x0C } RFLiCoordinateData; typedef struct { @@ -29,127 +30,127 @@ typedef struct { } RFLiPositionData; typedef struct { - Mtx posMtx; // 0x00 - Mtx nrmMtx; // 0x30 + Mtx posMtx; // 0x00 + Mtx nrmMtx; // 0x30 - RFLExpression expressionIdx; // 0x60 - RFLResolution resolution; // 0x64 + RFLExpression expressionIdx; // 0x60 + RFLResolution resolution; // 0x64 - void* resource; // 0x68 + void* resource; // 0x68 - GXTexObj* maskTexObj[RFLExp_Max]; // 0x6C + GXTexObj* maskTexObj[RFLExp_Max]; // 0x6C } RFLiCharModel; typedef struct { - u8 dlNose[192]; // 0x00 - u8 dlCap[1376]; // 0xC0 - u8 dlFaceline[736]; // 0x620 - u8 dlBeard[352]; // 0x900 - u8 dlNoseline[96]; // 0xA60 - u8 dlMask[896]; // 0xAC0 - u8 dlGlass[64]; // 0xE40 + u8 dlNose[192]; // 0x00 + u8 dlCap[1376]; // 0xC0 + u8 dlFaceline[736]; // 0x620 + u8 dlBeard[352]; // 0x900 + u8 dlNoseline[96]; // 0xA60 + u8 dlMask[896]; // 0xAC0 + u8 dlGlass[64]; // 0xE40 - u8 texFaceline[16384]; // 0xE80 - u8 texCap[1024]; // 0x4E80 - u8 texNoseline[1024]; // 0x5280 - u8 texGlass[4096]; // 0x5680 + u8 texFaceline[16384]; // 0xE80 + u8 texCap[1024]; // 0x4E80 + u8 texNoseline[1024]; // 0x5280 + u8 texGlass[4096]; // 0x5680 - s16 vtxPosNose[69]; // 0x6680 - s16 vtxNrmNose[69]; // 0x670A - s16 vtxPosCap[519]; // 0x6794 - s16 vtxNrmCap[738]; // 0x6BA2 - s16 vtxTxcCap[190]; // 0x7166 - s16 vtxPosFaceline[198]; // 0x72E2 - s16 vtxNrmFaceline[198]; // 0x746E - s16 vtxTxcFaceline[230]; // 0x75FA - s16 vtxPosBeard[120]; // 0x77C6 - s16 vtxNrmBeard[204]; // 0x78B6 - s16 vtxPosNoseline[18]; // 0x7A4E - s16 vtxNrmNoseline[6]; // 0x7A72 - s16 vtxTxcNoseline[14]; // 0x7A7E - s16 vtxPosMask[264]; // 0x7A9A - s16 vtxNrmMask[258]; // 0x7CAA - s16 vtxTxcMask[352]; // 0x7EAE - s16 vtxPosGlass[12]; // 0x816E - s16 vtxNrmGlass[3]; // 0x8186 - s16 vtxTxcGlass[8]; // 0x818C + s16 vtxPosNose[69]; // 0x6680 + s16 vtxNrmNose[69]; // 0x670A + s16 vtxPosCap[519]; // 0x6794 + s16 vtxNrmCap[738]; // 0x6BA2 + s16 vtxTxcCap[190]; // 0x7166 + s16 vtxPosFaceline[198]; // 0x72E2 + s16 vtxNrmFaceline[198]; // 0x746E + s16 vtxTxcFaceline[230]; // 0x75FA + s16 vtxPosBeard[120]; // 0x77C6 + s16 vtxNrmBeard[204]; // 0x78B6 + s16 vtxPosNoseline[18]; // 0x7A4E + s16 vtxNrmNoseline[6]; // 0x7A72 + s16 vtxTxcNoseline[14]; // 0x7A7E + s16 vtxPosMask[264]; // 0x7A9A + s16 vtxNrmMask[258]; // 0x7CAA + s16 vtxTxcMask[352]; // 0x7EAE + s16 vtxPosGlass[12]; // 0x816E + s16 vtxNrmGlass[3]; // 0x8186 + s16 vtxTxcGlass[8]; // 0x818C - GXTexObj texObjFaceline; // 0x819C - GXTexObj texObjCap; // 0x81BC - GXTexObj texObjNoseline; // 0x81DC - GXTexObj texObjGlass; // 0x81FC + GXTexObj texObjFaceline; // 0x819C + GXTexObj texObjCap; // 0x81BC + GXTexObj texObjNoseline; // 0x81DC + GXTexObj texObjGlass; // 0x81FC - s16* vtxPosHair; // 0x821C - s16* vtxNrmHair; // 0x8220 - u8* dlHair; // 0x8224 + s16* vtxPosHair; // 0x821C + s16* vtxNrmHair; // 0x8220 + u8* dlHair; // 0x8224 - s16* vtxPosForehead; // 0x8228 - s16* vtxNrmForehead; // 0x822C - u8* dlForehead; // 0x8230 + s16* vtxPosForehead; // 0x8228 + s16* vtxNrmForehead; // 0x822C + u8* dlForehead; // 0x8230 - u16 dlSizeNose; // 0x8234 - u16 dlSizeFaceline; // 0x8236 - u16 dlSizeHair; // 0x8238 - u16 dlSizeCap; // 0x823A - u16 dlSizeForehead; // 0x823C - u16 dlSizeBeard; // 0x823E - u16 dlSizeNoseline; // 0x8240 - u16 dlSizeMask; // 0x8242 - u16 dlSizeGlass; // 0x8244 + u16 dlSizeNose; // 0x8234 + u16 dlSizeFaceline; // 0x8236 + u16 dlSizeHair; // 0x8238 + u16 dlSizeCap; // 0x823A + u16 dlSizeForehead; // 0x823C + u16 dlSizeBeard; // 0x823E + u16 dlSizeNoseline; // 0x8240 + u16 dlSizeMask; // 0x8242 + u16 dlSizeGlass; // 0x8244 - u8 colorIdxFaceline; // 0x8246 - u8 colorIdxHair; // 0x8247 - u8 colorIdxBeard; // 0x8248 - u8 colorIdxGlass; // 0x8249 - u8 colorIdxFavorite; // 0x824A + u8 colorIdxFaceline; // 0x8246 + u8 colorIdxHair; // 0x8247 + u8 colorIdxBeard; // 0x8248 + u8 colorIdxGlass; // 0x8249 + u8 colorIdxFavorite; // 0x824A - BOOL flipHair; // 0x824C + BOOL flipHair; // 0x824C } RFLiCharModelRes; typedef struct { - RFLiPartsShp parts; // 0x00 - u16 index; // 0x04 + RFLiPartsShp parts; // 0x00 + u16 index; // 0x04 - BOOL transform; // 0x08 - BOOL flipX; // 0x0C + BOOL transform; // 0x08 + BOOL flipX; // 0x0C - s16* vtxPosBuf; // 0x10 - s16* vtxNrmBuf; // 0x14 - s16* vtxTxcBuf; // 0x18 - u8* dlBuf; // 0x1C + s16* vtxPosBuf; // 0x10 + s16* vtxNrmBuf; // 0x14 + s16* vtxTxcBuf; // 0x18 + u8* dlBuf; // 0x1C - u16 vtxPosBufSize; // 0x20 - u16 vtxNrmBufSize; // 0x22 - u16 vtxTxcBufSize; // 0x24 - u16 dlBufSize; // 0x26 + u16 vtxPosBufSize; // 0x20 + u16 vtxNrmBufSize; // 0x22 + u16 vtxTxcBufSize; // 0x24 + u16 dlBufSize; // 0x26 - u16 vtxPosSize; // 0x28 - u16 vtxNrmSize; // 0x2A - u16 vtxTxcSize; // 0x2C - u16 dlSize; // 0x2E + u16 vtxPosSize; // 0x28 + u16 vtxNrmSize; // 0x2A + u16 vtxTxcSize; // 0x2C + u16 dlSize; // 0x2E - f32 posScale; // 0x30 - RFLiPositionData* posTrans; // 0x34 + f32 posScale; // 0x30 + RFLiPositionData* posTrans; // 0x34 - RFLiPositionData* noseTrans; // 0x38 - RFLiPositionData* beardTrans; // 0x3C - RFLiPositionData* hairTrans; // 0x40 + RFLiPositionData* noseTrans; // 0x38 + RFLiPositionData* beardTrans; // 0x3C + RFLiPositionData* hairTrans; // 0x40 } RFLiCharShapeRes; extern RFLiCoordinateData coordinateData; -u32 RFLiGetExpressionNum(u32 expressionFlag); +u32 RFLiGetExpressionNum(u32 expressionFlag); -void RFLiInitCharModel(RFLCharModel* charModel, const RFLiCharInfo* info, void* bufferPtr, RFLResolution resolution, u32 expressionFlag); +void RFLiInitCharModel(RFLCharModel* charModel, const RFLiCharInfo* info, void* bufferPtr, RFLResolution resolution, u32 expressionFlag); GXColor RFLiGetFavoriteColor(const RFLiCharInfo* info); GXColor RFLiGetFacelineColor(const RFLiCharInfo* info); -void RFLiInitCharModelRes(RFLiCharModelRes* charModelRes, const RFLiCharInfo* info); -void RFLiInitShapeRes(RFLiCharShapeRes* arg); -void RFLiInitTexRes(GXTexObj* texObj, RFLiPartsShpTex parts, u16 index, void* buf); +void RFLiInitCharModelRes(RFLiCharModelRes* charModelRes, const RFLiCharInfo* info); +void RFLiInitShapeRes(RFLiCharShapeRes* arg); +void RFLiInitTexRes(GXTexObj* texObj, RFLiPartsShpTex parts, u16 index, void* buf); -void RFLiTransformCoordinate(s16* to, const s16* from); +void RFLiTransformCoordinate(s16* to, const s16* from); inline void RFLiSetCoordinateData(const RFLiCoordinateData* data) { RFLi_ASSERTLINE_NULL(data, 281); @@ -164,4 +165,4 @@ static inline RFLiCoordinateData* RFLiGetCoordinateData() { } #endif -#endif // RFLi_MODEL_H +#endif // RFLi_MODEL_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_NANDAccess.h b/libs/RVLFaceLib/include/internal/RFLi_NANDAccess.h index 0cf1dc2b..add612ba 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_NANDAccess.h +++ b/libs/RVLFaceLib/include/internal/RFLi_NANDAccess.h @@ -51,71 +51,71 @@ typedef struct { } RFLiCallbackTag; typedef struct { - RFLSimpleCB callback; // 0x00 + RFLSimpleCB callback; // 0x00 union { struct { - char filename[NAND_MAX_PATH+1]; // 0x00 - u8 openmode; // 0x41 - u8 permission; // 0x42 - u8 attribute; // 0x43 - } openinfo; // 0x04 + char filename[NAND_MAX_PATH + 1]; // 0x00 + u8 openmode; // 0x41 + u8 permission; // 0x42 + u8 attribute; // 0x43 + } openinfo; // 0x04 struct { - void* dst; // 0x00 - u32 size; // 0x04 - s32 offset; // 0x08 - } readinfo; // 0x04 + void* dst; // 0x00 + u32 size; // 0x04 + s32 offset; // 0x08 + } readinfo; // 0x04 struct { - void* src; // 0x00 - u32 size; // 0x04 - s32 offset; // 0x08 - } writeinfo; // 0x04 + void* src; // 0x00 + u32 size; // 0x04 + s32 offset; // 0x08 + } writeinfo; // 0x04 struct { - u8 count; // 0x00 - } closeinfo; // 0x04 + u8 count; // 0x00 + } closeinfo; // 0x04 struct { - u32* dst; // 0x00 - } getlengthinfo; // 0x04 + u32* dst; // 0x00 + } getlengthinfo; // 0x04 }; - NANDFileInfo workingFile; // 0x48 - NANDCommandBlock commandBlock; // 0xD4 - RFLiCallbackTag callbackTag; // 0x190 + NANDFileInfo workingFile; // 0x48 + NANDCommandBlock commandBlock; // 0xD4 + RFLiCallbackTag callbackTag; // 0x190 - OSAlarm alarm; // 0x198 - RFLiFileType alarmdata; // 0x1C8 + OSAlarm alarm; // 0x198 + RFLiFileType alarmdata; // 0x1C8 - RFLSimpleCBArg retryCallback; // 0x1CC - u8 retryCount; // 0x1D0 + RFLSimpleCBArg retryCallback; // 0x1CC + u8 retryCount; // 0x1D0 - void* safeBuffer; // 0x1D4 - u8 opened; // 0x1D8 + void* safeBuffer; // 0x1D4 + u8 opened; // 0x1D8 } RFLiNANDAccessInfo; -void RFLiInitAccessInfo(MEMiHeapHead* heap); -void RFLiExitAccessInfo(); +void RFLiInitAccessInfo(MEMiHeapHead* heap); +void RFLiExitAccessInfo(); -BOOL RFLiIsWorking(); -void RFLiStartWorking(); +BOOL RFLiIsWorking(); +void RFLiStartWorking(); -void RFLiEndWorkingReason(RFLErrcode errcode, s32 reason); -void RFLiEndWorking(RFLErrcode errcode); +void RFLiEndWorkingReason(RFLErrcode errcode, s32 reason); +void RFLiEndWorking(RFLErrcode errcode); -NANDCommandBlock* RFLiSetCommandBlock(RFLiFileType type, RFLiAsyncTag tag); +NANDCommandBlock* RFLiSetCommandBlock(RFLiFileType type, RFLiAsyncTag tag); -RFLiAsyncTag RFLiGetTag(NANDCommandBlock* block); -RFLiFileType RFLiGetType(NANDCommandBlock* block); +RFLiAsyncTag RFLiGetTag(NANDCommandBlock* block); +RFLiFileType RFLiGetType(NANDCommandBlock* block); -NANDFileInfo* RFLiGetWorkingFile(RFLiFileType type); +NANDFileInfo* RFLiGetWorkingFile(RFLiFileType type); -RFLErrcode RFLiOpenAsync(RFLiFileType type, u8 openmode, RFLSimpleCB cb); -RFLErrcode RFLiReadAsync(RFLiFileType type, void* dst, u32 size, RFLSimpleCB cb, s32 seek_ofs); -RFLErrcode RFLiWriteAsync(RFLiFileType type, void* src, u32 size, RFLSimpleCB cb, s32 seek_ofs); -RFLErrcode RFLiCloseAsync(RFLiFileType type, RFLSimpleCB cb); -RFLErrcode RFLiGetLengthAsync(RFLiFileType type, u32* dst, RFLSimpleCB cb); -RFLErrcode RFLiDeleteAsync(RFLiFileType type, RFLSimpleCB cb); -RFLErrcode RFLiCreateSaveDirAsync(RFLSimpleCB cb); +RFLErrcode RFLiOpenAsync(RFLiFileType type, u8 openmode, RFLSimpleCB cb); +RFLErrcode RFLiReadAsync(RFLiFileType type, void* dst, u32 size, RFLSimpleCB cb, s32 seek_ofs); +RFLErrcode RFLiWriteAsync(RFLiFileType type, void* src, u32 size, RFLSimpleCB cb, s32 seek_ofs); +RFLErrcode RFLiCloseAsync(RFLiFileType type, RFLSimpleCB cb); +RFLErrcode RFLiGetLengthAsync(RFLiFileType type, u32* dst, RFLSimpleCB cb); +RFLErrcode RFLiDeleteAsync(RFLiFileType type, RFLSimpleCB cb); +RFLErrcode RFLiCreateSaveDirAsync(RFLSimpleCB cb); #ifdef __cplusplus } #endif -#endif // RFLi_NAND_ACCESS_H +#endif // RFLi_NAND_ACCESS_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_NANDLoader.h b/libs/RVLFaceLib/include/internal/RFLi_NANDLoader.h index af108005..75de3a1b 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_NANDLoader.h +++ b/libs/RVLFaceLib/include/internal/RFLi_NANDLoader.h @@ -2,8 +2,9 @@ #define RFLi_NAND_LOADER_H #include -#include #include +#include + #ifdef __cplusplus extern "C" { @@ -32,41 +33,41 @@ typedef enum { } RFLiArcID; typedef struct { - u16 num; // 0x00 - u16 maxsize; // 0x02 - u32 offset; // 0x04 + u16 num; // 0x00 + u16 maxsize; // 0x02 + u32 offset; // 0x04 } RFLiNANDArchive; typedef struct { - RFLiNANDArchive archive[RFLiArcID_Max]; // 0x00 + RFLiNANDArchive archive[RFLiArcID_Max]; // 0x00 - u32 mCacheSize; // 0x90 - void* mCacheBuffer; // 0x94 - BOOL mCached; // 0x98 + u32 mCacheSize; // 0x90 + void* mCacheBuffer; // 0x94 + BOOL mCached; // 0x98 - u16 mVersion; // 0x9C + u16 mVersion; // 0x9C - u8* mHeaderBuf1; // 0xA0 - u8* mHeaderBuf2; // 0xA4 + u8* mHeaderBuf1; // 0xA0 + u8* mHeaderBuf2; // 0xA4 - u8 mReadCount; // 0xA8 + u8 mReadCount; // 0xA8 } RFLiNANDLoader; -void RFLiInitLoader(); +void RFLiInitLoader(); -RFLErrcode RFLiLoadResourceHeaderAsync(); +RFLErrcode RFLiLoadResourceHeaderAsync(); -u32 RFLiGetTexSize(RFLiPartsTex parts, u16 index); +u32 RFLiGetTexSize(RFLiPartsTex parts, u16 index); RFLTexture* RFLiLoadTexture(RFLiPartsTex parts, u16 index, void* texBuffer); -u32 RFLiGetShpTexSize(RFLiPartsShpTex parts, u16 index); +u32 RFLiGetShpTexSize(RFLiPartsShpTex parts, u16 index); RFLTexture* RFLiLoadShpTexture(RFLiPartsShpTex parts, u16 index, void* texBuffer); -u32 RFLiGetShapeSize(RFLiPartsShp parts, u16 index); -void* RFLiLoadShape(RFLiPartsShp parts, u16 index, void* shpBuffer); +u32 RFLiGetShapeSize(RFLiPartsShp parts, u16 index); +void* RFLiLoadShape(RFLiPartsShp parts, u16 index, void* shpBuffer); #ifdef __cplusplus } #endif -#endif // RFLi_NAND_LOADER_H +#endif // RFLi_NAND_LOADER_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_NWC24.h b/libs/RVLFaceLib/include/internal/RFLi_NWC24.h index 41ece012..68e779bd 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_NWC24.h +++ b/libs/RVLFaceLib/include/internal/RFLi_NWC24.h @@ -1,8 +1,9 @@ #ifndef RFLi_NWC24_H #define RFLi_NWC24_H -#include #include +#include + #include @@ -10,19 +11,19 @@ extern "C" { #endif -BOOL RFLiNWC24Msg2CharData(RFLiCharData* rawdata, const NWC24MsgObj* obj); +BOOL RFLiNWC24Msg2CharData(RFLiCharData* rawdata, const NWC24MsgObj* obj); -RFLErrcode RFLiNWC24Msg2HiddenAsync(const NWC24MsgObj* obj); +RFLErrcode RFLiNWC24Msg2HiddenAsync(const NWC24MsgObj* obj); #if RFL_BUILD < 20080306 -RFLErrcode RFLiSetOfficial2NWC24Msg(NWC24MsgObj* obj, RFLCharData* charData, u16 index); -#endif // RFL_BUILD < 20080306 +RFLErrcode RFLiSetOfficial2NWC24Msg(NWC24MsgObj* obj, RFLCharData* charData, u16 index); +#endif // RFL_BUILD < 20080306 -RFLErrcode RFLiMakeNWC24MsgforExchange(NWC24MsgObj* obj, RFLCharData* work); -RFLErrcode RFLiMakeNWC24MsgforExchange_Debug(NWC24MsgObj* obj, RFLCharData* work); +RFLErrcode RFLiMakeNWC24MsgforExchange(NWC24MsgObj* obj, RFLCharData* work); +RFLErrcode RFLiMakeNWC24MsgforExchange_Debug(NWC24MsgObj* obj, RFLCharData* work); #ifdef __cplusplus } #endif -#endif // RFLi_NWC24_H +#endif // RFLi_NWC24_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_System.h b/libs/RVLFaceLib/include/internal/RFLi_System.h index b5b9aec7..ae5333e2 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_System.h +++ b/libs/RVLFaceLib/include/internal/RFLi_System.h @@ -7,8 +7,9 @@ #include #include -#include #include +#include + #include @@ -21,72 +22,72 @@ extern "C" { #define RFL_MAC_ADDR_LENGTH 6 typedef struct { - void* mWorkBuffer; // 0x00 + void* mWorkBuffer; // 0x00 - MEMiHeapHead* mRootHeap; // 0x04 - MEMiHeapHead* mSystemHeap; // 0x08 - MEMiHeapHead* mTmpHeap; // 0x0C + MEMiHeapHead* mRootHeap; // 0x04 + MEMiHeapHead* mSystemHeap; // 0x08 + MEMiHeapHead* mTmpHeap; // 0x0C - RFLiDatabaseManager mDBMan; // 0x10 - RFLiNANDLoader mLoader; // 0xC0 - RFLiHiddenDBManager mHDBMan; // 0x16C - RFLiCtrlManager mCtrlMan; // 0x1AAC + RFLiDatabaseManager mDBMan; // 0x10 + RFLiNANDLoader mLoader; // 0xC0 + RFLiHiddenDBManager mHDBMan; // 0x16C + RFLiCtrlManager mCtrlMan; // 0x1AAC - BOOL mIsWorking; // 0x1B34 - BOOL mUseDeluxTex; // 0x1B38 + BOOL mIsWorking; // 0x1B34 + BOOL mUseDeluxTex; // 0x1B38 - u8 mBrokenTypeList; // 0x1B3C - RFLErrcode mLastErrcode; // 0x1B40 - RFLErrcode mBeforeCloseErr; // 0x1B44 - s32 mLastReason; // 0x1B48 - s32 mBeforeCloseReason; // 0x1B4C + u8 mBrokenTypeList; // 0x1B3C + RFLErrcode mLastErrcode; // 0x1B40 + RFLErrcode mBeforeCloseErr; // 0x1B44 + s32 mLastReason; // 0x1B48 + s32 mBeforeCloseReason; // 0x1B4C - RFLiNANDAccessInfo mAccInfo[RFLiFileType_Max]; // 0x1B50 + RFLiNANDAccessInfo mAccInfo[RFLiFileType_Max]; // 0x1B50 - RFLSimpleCB mSysCB; // 0x1F10 + RFLSimpleCB mSysCB; // 0x1F10 #if RFL_BUILD >= 20080306 - RFLSimpleCB mDrawIconCB; // 0x1F14 - RFLSimpleCB mCreateModelCB; // 0x1F18 -#endif // RFL_BUILD + RFLSimpleCB mDrawIconCB; // 0x1F14 + RFLSimpleCB mCreateModelCB; // 0x1F18 +#endif // RFL_BUILD - u8 macaddr[RFL_MAC_ADDR_LENGTH]; // 0x1F1C + u8 macaddr[RFL_MAC_ADDR_LENGTH]; // 0x1F1C } RFLiSysManager; -RFLErrcode RFLiBootLoad(); -RFLErrcode RFLiBootLoadAsync(); +RFLErrcode RFLiBootLoad(); +RFLErrcode RFLiBootLoadAsync(); -void* RFLiAlloc(u32 size); -void* RFLiAlloc32(u32 size); -void RFLiFree(void* block); +void* RFLiAlloc(u32 size); +void* RFLiAlloc32(u32 size); +void RFLiFree(void* block); -u32 RFLiGetUsedWorkSize(); +u32 RFLiGetUsedWorkSize(); -RFLiDatabaseManager* RFLiGetDBManager(); -RFLiHiddenDBManager* RFLiGetHDBManager(); -RFLiNANDLoader* RFLiGetLoader(); +RFLiDatabaseManager* RFLiGetDBManager(); +RFLiHiddenDBManager* RFLiGetHDBManager(); +RFLiNANDLoader* RFLiGetLoader(); -BOOL RFLiGetWorking(); -void RFLiSetWorking(BOOL b); +BOOL RFLiGetWorking(); +void RFLiSetWorking(BOOL b); -RFLiSysManager* RFLiGetManager(); +RFLiSysManager* RFLiGetManager(); -RFLiNANDAccessInfo* RFLiGetAccInfo(RFLiFileType type); -RFLiCtrlManager* RFLiGetCtrlBufManager(); +RFLiNANDAccessInfo* RFLiGetAccInfo(RFLiFileType type); +RFLiCtrlManager* RFLiGetCtrlBufManager(); -BOOL RFLiGetUseDeluxTex(); -s32 RFLiGetLastReason(); +BOOL RFLiGetUseDeluxTex(); +s32 RFLiGetLastReason(); -BOOL RFLiSetMacAddr(const u8* addr); -u8* RFLiGetMacAddr(); +BOOL RFLiSetMacAddr(const u8* addr); +u8* RFLiGetMacAddr(); -void RFLiSetFileBroken(RFLiFileBrokenType type); +void RFLiSetFileBroken(RFLiFileBrokenType type); -BOOL RFLiNotFoundError(); -BOOL RFLiNeedRepairError(); -BOOL RFLiCriticalError(); +BOOL RFLiNotFoundError(); +BOOL RFLiNeedRepairError(); +BOOL RFLiCriticalError(); #ifdef __cplusplus } #endif -#endif // RFLi_SYSTEM_H +#endif // RFLi_SYSTEM_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_Texture.h b/libs/RVLFaceLib/include/internal/RFLi_Texture.h index 4b58bafb..8afc5333 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_Texture.h +++ b/libs/RVLFaceLib/include/internal/RFLi_Texture.h @@ -11,43 +11,43 @@ extern "C" { #endif typedef struct { - u8 format; // 0x00 - u8 transparency; // 0x01 + u8 format; // 0x00 + u8 transparency; // 0x01 - u16 width; // 0x02 - u16 height; // 0x04 + u16 width; // 0x02 + u16 height; // 0x04 - u8 wrapS; // 0x06 - u8 wrapT; // 0x07 + u8 wrapS; // 0x06 + u8 wrapT; // 0x07 - u8 indexTexture; // 0x08 - u8 colorFormat; // 0x09 + u8 indexTexture; // 0x08 + u8 colorFormat; // 0x09 - u16 numColors; // 0x0A - u32 paletteOffset; // 0x0C + u16 numColors; // 0x0A + u32 paletteOffset; // 0x0C - u8 enableLOD; // 0x10 - u8 enableEdgeLOD; // 0x11 - u8 enableBiasClamp; // 0x12 - u8 enableMaxAniso; // 0x13 + u8 enableLOD; // 0x10 + u8 enableEdgeLOD; // 0x11 + u8 enableBiasClamp; // 0x12 + u8 enableMaxAniso; // 0x13 - u8 minFilter; // 0x14 - u8 magFilter; // 0x15 + u8 minFilter; // 0x14 + u8 magFilter; // 0x15 - s8 minLOD; // 0x16 - s8 maxLOD; // 0x17 + s8 minLOD; // 0x16 + s8 maxLOD; // 0x17 - u8 mipmapLevel; // 0x18 - s8 reserved; // 0x19 - s16 LODBias; // 0x1A + u8 mipmapLevel; // 0x18 + s8 reserved; // 0x19 + s16 LODBias; // 0x1A - u32 imageOffset; // 0x1C + u32 imageOffset; // 0x1C } RFLTexture; typedef struct { - RFLTexture* texture; // 0x00 - u8* imageData; // 0x04 - GXTexObj tobj; // 0x08 + RFLTexture* texture; // 0x00 + u8* imageData; // 0x04 + GXTexObj tobj; // 0x08 } RFLTexObj; static inline void* RFLiGetTexImage(const RFLTexture* tex) { @@ -58,4 +58,4 @@ static inline void* RFLiGetTexImage(const RFLTexture* tex) { } #endif -#endif // RFLi_TEXTURE_H +#endif // RFLi_TEXTURE_H diff --git a/libs/RVLFaceLib/include/internal/RFLi_Types.h b/libs/RVLFaceLib/include/internal/RFLi_Types.h index 7152b8a0..d912ada2 100644 --- a/libs/RVLFaceLib/include/internal/RFLi_Types.h +++ b/libs/RVLFaceLib/include/internal/RFLi_Types.h @@ -68,7 +68,7 @@ typedef enum { typedef enum { RFLiPartsShpTex_Face = 0, - RFLiPartsShpTex_Cap , + RFLiPartsShpTex_Cap, RFLiPartsShpTex_Noseline, RFLiPartsShpTex_Glass, @@ -92,272 +92,272 @@ typedef enum { typedef struct { union { struct { - u16 type : 3; // 0x00 - u16 color : 3; // 0x00 - u16 texture : 4; // 0x00 - u16 padding : 6; // 0x00 + u16 type : 3; // 0x00 + u16 color : 3; // 0x00 + u16 texture : 4; // 0x00 + u16 padding : 6; // 0x00 }; - u16 rawdata; // 0x00 - } faceline; // 0x00 + u16 rawdata; // 0x00 + } faceline; // 0x00 union { struct { - u16 type : 7; // 0x00 - u16 color : 3; // 0x00 - u16 flip : 1; // 0x00 - u16 padding : 5; // 0x00 + u16 type : 7; // 0x00 + u16 color : 3; // 0x00 + u16 flip : 1; // 0x00 + u16 padding : 5; // 0x00 }; - u16 rawdata; // 0x00 - } hair; // 0x02 + u16 rawdata; // 0x00 + } hair; // 0x02 union { struct { - u32 type : 6; // 0x00 - u32 color : 3; // 0x00 - u32 scale : 4; // 0x00 - u32 rotate : 5; // 0x00 - u32 x : 4; // 0x00 - u32 y : 5; // 0x00 - u32 padding : 5; // 0x00 + u32 type : 6; // 0x00 + u32 color : 3; // 0x00 + u32 scale : 4; // 0x00 + u32 rotate : 5; // 0x00 + u32 x : 4; // 0x00 + u32 y : 5; // 0x00 + u32 padding : 5; // 0x00 }; - u32 rawdata; // 0x00 - } eye; // 0x04 + u32 rawdata; // 0x00 + } eye; // 0x04 union { struct { - u32 type : 5; // 0x00 - u32 color : 3; // 0x00 - u32 scale : 4; // 0x00 - u32 rotate : 5; // 0x00 - u32 x : 4; // 0x00 - u32 y : 5; // 0x00 - u32 padding : 6; // 0x00 + u32 type : 5; // 0x00 + u32 color : 3; // 0x00 + u32 scale : 4; // 0x00 + u32 rotate : 5; // 0x00 + u32 x : 4; // 0x00 + u32 y : 5; // 0x00 + u32 padding : 6; // 0x00 }; - u32 rawdata; // 0x00 - } eyebrow; // 0x08 + u32 rawdata; // 0x00 + } eyebrow; // 0x08 union { struct { - u16 type : 4; // 0x00 - u16 scale : 4; // 0x00 - u16 y : 5; // 0x00 - u16 padding : 3; // 0x00 + u16 type : 4; // 0x00 + u16 scale : 4; // 0x00 + u16 y : 5; // 0x00 + u16 padding : 3; // 0x00 }; - u16 rawdata; // 0x00 - } nose; // 0x0C + u16 rawdata; // 0x00 + } nose; // 0x0C union { struct { - u16 type : 5; // 0x00 - u16 color : 2; // 0x00 - u16 scale : 4; // 0x00 - u16 y : 5; // 0x00 + u16 type : 5; // 0x00 + u16 color : 2; // 0x00 + u16 scale : 4; // 0x00 + u16 y : 5; // 0x00 }; - u16 rawdata; // 0x00 - } mouth; // 0x0E + u16 rawdata; // 0x00 + } mouth; // 0x0E union { struct { - u16 mustache : 2; // 0x00 - u16 type : 2; // 0x00 - u16 color : 3; // 0x00 - u16 scale : 4; // 0x00 - u16 y : 5; // 0x00 + u16 mustache : 2; // 0x00 + u16 type : 2; // 0x00 + u16 color : 3; // 0x00 + u16 scale : 4; // 0x00 + u16 y : 5; // 0x00 }; - u16 rawdata; // 0x00 - } beard; // 0x10 + u16 rawdata; // 0x00 + } beard; // 0x10 union { struct { - u16 type : 4; // 0x00 - u16 color : 3; // 0x00 - u16 scale : 4; // 0x00 - u16 y : 5; // 0x00 + u16 type : 4; // 0x00 + u16 color : 3; // 0x00 + u16 scale : 4; // 0x00 + u16 y : 5; // 0x00 }; - u16 rawdata; // 0x00 - } glass; // 0x12 + u16 rawdata; // 0x00 + } glass; // 0x12 union { struct { - u16 type : 1; // 0x00 - u16 scale : 4; // 0x00 - u16 x : 5; // 0x00 - u16 y : 5; // 0x00 - u16 padding : 1; // 0x00 + u16 type : 1; // 0x00 + u16 scale : 4; // 0x00 + u16 x : 5; // 0x00 + u16 y : 5; // 0x00 + u16 padding : 1; // 0x00 }; - u16 rawdata; // 0x00 - } mole; // 0x14 + u16 rawdata; // 0x00 + } mole; // 0x14 struct { - u8 height; // 0x00 - u8 build; // 0x01 - } body; // 0x16 + u8 height; // 0x00 + u8 build; // 0x01 + } body; // 0x16 struct { - u16 name[RFL_NAME_LENGTH+1]; // 0x00 - u16 creator[RFL_NAME_LENGTH+1]; // 0x16 - u16 sex : 1; // 0x2C - u16 birth_month : 4; // 0x2C - u16 birth_day : 5; // 0x2C - u16 favoriteColor : 4; // 0x2C - u16 favorite : 1; // 0x2C - u16 localonly : 1; // 0x2C - } personal; // 0x18 - RFLCreateID createID; // 0x46 + u16 name[RFL_NAME_LENGTH + 1]; // 0x00 + u16 creator[RFL_NAME_LENGTH + 1]; // 0x16 + u16 sex : 1; // 0x2C + u16 birth_month : 4; // 0x2C + u16 birth_day : 5; // 0x2C + u16 favoriteColor : 4; // 0x2C + u16 favorite : 1; // 0x2C + u16 localonly : 1; // 0x2C + } personal; // 0x18 + RFLCreateID createID; // 0x46 } RFLiCharInfo; typedef struct { - u16 padding0 : 1; // 0x00 - u16 sex : 1; // 0x00 + u16 padding0 : 1; // 0x00 + u16 sex : 1; // 0x00 - u16 birth_month : 4; // 0x00 - u16 birth_day : 5; // 0x00 + u16 birth_month : 4; // 0x00 + u16 birth_day : 5; // 0x00 - u16 favoriteColor : 4; // 0x00 - u16 favorite : 1; // 0x00 + u16 favoriteColor : 4; // 0x00 + u16 favorite : 1; // 0x00 - u16 name[RFL_NAME_LENGTH]; // 0x02 + u16 name[RFL_NAME_LENGTH]; // 0x02 - u8 height; // 0x16 - u8 build; // 0x17 + u8 height; // 0x16 + u8 build; // 0x17 - u8 createID[RFL_CREATE_ID_LENGTH]; // 0x18 + u8 createID[RFL_CREATE_ID_LENGTH]; // 0x18 - u16 faceType : 3; // 0x20 - u16 faceColor : 3; // 0x20 - u16 faceTex : 4; // 0x20 - u16 padding2 : 3; // 0x20 + u16 faceType : 3; // 0x20 + u16 faceColor : 3; // 0x20 + u16 faceTex : 4; // 0x20 + u16 padding2 : 3; // 0x20 - u16 localonly : 1; // 0x20 - u16 type : 2; // 0x20 + u16 localonly : 1; // 0x20 + u16 type : 2; // 0x20 - u16 hairType : 7; // 0x22 - u16 hairColor : 3; // 0x22 - u16 hairFlip : 1; // 0x22 - u16 padding3 : 5; // 0x22 + u16 hairType : 7; // 0x22 + u16 hairColor : 3; // 0x22 + u16 hairFlip : 1; // 0x22 + u16 padding3 : 5; // 0x22 - u16 eyebrowType : 5; // 0x24 - u16 eyebrowRotate : 5; // 0x24 - u16 padding4 : 6; // 0x24 + u16 eyebrowType : 5; // 0x24 + u16 eyebrowRotate : 5; // 0x24 + u16 padding4 : 6; // 0x24 - u16 eyebrowColor : 3; // 0x26 - u16 eyebrowScale : 4; // 0x26 - u16 eyebrowY : 5; // 0x26 - u16 eyebrowX : 4; // 0x26 - u16 eyeType : 6; // 0x28 - u16 eyeRotate : 5; // 0x28 - u16 eyeY : 5; // 0x28 - u16 eyeColor : 3; // 0x2A - u16 eyeScale : 4; // 0x2A - u16 eyeX : 4; // 0x2A - u16 padding5 : 5; // 0x2A + u16 eyebrowColor : 3; // 0x26 + u16 eyebrowScale : 4; // 0x26 + u16 eyebrowY : 5; // 0x26 + u16 eyebrowX : 4; // 0x26 + u16 eyeType : 6; // 0x28 + u16 eyeRotate : 5; // 0x28 + u16 eyeY : 5; // 0x28 + u16 eyeColor : 3; // 0x2A + u16 eyeScale : 4; // 0x2A + u16 eyeX : 4; // 0x2A + u16 padding5 : 5; // 0x2A - u16 noseType : 4; // 0x2C - u16 noseScale : 4; // 0x2C - u16 noseY : 5; // 0x2C - u16 padding6 : 3; // 0x2C + u16 noseType : 4; // 0x2C + u16 noseScale : 4; // 0x2C + u16 noseY : 5; // 0x2C + u16 padding6 : 3; // 0x2C - u16 mouthType : 5; // 0x2E - u16 mouthColor : 2; // 0x2E - u16 mouthScale : 4; // 0x2E - u16 mouthY : 5; // 0x2E + u16 mouthType : 5; // 0x2E + u16 mouthColor : 2; // 0x2E + u16 mouthScale : 4; // 0x2E + u16 mouthY : 5; // 0x2E - u16 glassType : 4; // 0x30 - u16 glassColor : 3; // 0x30 - u16 glassScale : 4; // 0x30 - u16 glassY : 5; // 0x30 + u16 glassType : 4; // 0x30 + u16 glassColor : 3; // 0x30 + u16 glassScale : 4; // 0x30 + u16 glassY : 5; // 0x30 - u16 mustacheType : 2; // 0x32 + u16 mustacheType : 2; // 0x32 - u16 beardType : 2; // 0x32 - u16 beardColor : 3; // 0x32 - u16 beardScale : 4; // 0x32 - u16 beardY : 5; // 0x32 + u16 beardType : 2; // 0x32 + u16 beardColor : 3; // 0x32 + u16 beardScale : 4; // 0x32 + u16 beardY : 5; // 0x32 - u16 moleType : 1; // 0x34 - u16 moleScale : 4; // 0x34 - u16 moleY : 5; // 0x34 - u16 moleX : 5; // 0x34 - u16 padding8 : 1; // 0x34 + u16 moleType : 1; // 0x34 + u16 moleScale : 4; // 0x34 + u16 moleY : 5; // 0x34 + u16 moleX : 5; // 0x34 + u16 padding8 : 1; // 0x34 - u16 creatorName[RFL_NAME_LENGTH]; // 0x36 + u16 creatorName[RFL_NAME_LENGTH]; // 0x36 } RFLiCharData; typedef struct { - RFLiCharData rawdata; // 0x00 - u16 crc; // 0x4A + RFLiCharData rawdata; // 0x00 + u16 crc; // 0x4A } RFLiStoreData; typedef struct { - u16 padding0 : 1; // 0x00 - u16 sex : 1; // 0x00 + u16 padding0 : 1; // 0x00 + u16 sex : 1; // 0x00 - u16 birth_padding : 9; // 0x00 + u16 birth_padding : 9; // 0x00 - u16 favoriteColor : 4; // 0x00 - u16 favorite : 1; // 0x00 + u16 favoriteColor : 4; // 0x00 + u16 favorite : 1; // 0x00 - u16 name[RFL_NAME_LENGTH]; // 0x02 + u16 name[RFL_NAME_LENGTH]; // 0x02 - u8 height; // 0x16 - u8 build; // 0x17 + u8 height; // 0x16 + u8 build; // 0x17 - u8 createID[RFL_CREATE_ID_LENGTH]; // 0x18 + u8 createID[RFL_CREATE_ID_LENGTH]; // 0x18 - u16 faceType : 3; // 0x20 - u16 faceColor : 3; // 0x20 - u16 faceTex : 4; // 0x20 - u16 padding2 : 3; // 0x20 + u16 faceType : 3; // 0x20 + u16 faceColor : 3; // 0x20 + u16 faceTex : 4; // 0x20 + u16 padding2 : 3; // 0x20 - u16 localonly : 1; // 0x20 - u16 type : 2; // 0x20 + u16 localonly : 1; // 0x20 + u16 type : 2; // 0x20 - u16 hairType : 7; // 0x22 - u16 hairColor : 3; // 0x22 - u16 hairFlip : 1; // 0x22 - u16 padding3 : 5; // 0x22 + u16 hairType : 7; // 0x22 + u16 hairColor : 3; // 0x22 + u16 hairFlip : 1; // 0x22 + u16 padding3 : 5; // 0x22 - u16 eyebrowType : 5; // 0x24 - u16 eyebrowRotate : 5; // 0x24 - u16 padding4 : 6; // 0x24 - u16 eyebrowColor : 3; // 0x26 - u16 eyebrowScale : 4; // 0x26 - u16 eyebrowY : 5; // 0x26 - u16 eyebrowX : 4; // 0x26 + u16 eyebrowType : 5; // 0x24 + u16 eyebrowRotate : 5; // 0x24 + u16 padding4 : 6; // 0x24 + u16 eyebrowColor : 3; // 0x26 + u16 eyebrowScale : 4; // 0x26 + u16 eyebrowY : 5; // 0x26 + u16 eyebrowX : 4; // 0x26 - u16 eyeType : 6; // 0x28 - u16 eyeRotate : 5; // 0x28 - u16 eyeY : 5; // 0x28 - u16 eyeColor : 3; // 0x2A - u16 eyeScale : 4; // 0x2A - u16 eyeX : 4; // 0x2A - u16 padding5 : 5; // 0x2A + u16 eyeType : 6; // 0x28 + u16 eyeRotate : 5; // 0x28 + u16 eyeY : 5; // 0x28 + u16 eyeColor : 3; // 0x2A + u16 eyeScale : 4; // 0x2A + u16 eyeX : 4; // 0x2A + u16 padding5 : 5; // 0x2A - u16 noseType : 4; // 0x2C - u16 noseScale : 4; // 0x2C - u16 noseY : 5; // 0x2C - u16 padding6 : 3; // 0x2C + u16 noseType : 4; // 0x2C + u16 noseScale : 4; // 0x2C + u16 noseY : 5; // 0x2C + u16 padding6 : 3; // 0x2C - u16 mouthType : 5; // 0x2E - u16 mouthColor : 2; // 0x2E - u16 mouthScale : 4; // 0x2E - u16 mouthY : 5; // 0x2E + u16 mouthType : 5; // 0x2E + u16 mouthColor : 2; // 0x2E + u16 mouthScale : 4; // 0x2E + u16 mouthY : 5; // 0x2E - u16 glassType : 3; // 0x30 - u16 glassColor : 3; // 0x30 - u16 glassScale : 4; // 0x30 - u16 glassY : 5; // 0x30 - u16 padding7 : 1; // 0x30 + u16 glassType : 3; // 0x30 + u16 glassColor : 3; // 0x30 + u16 glassScale : 4; // 0x30 + u16 glassY : 5; // 0x30 + u16 padding7 : 1; // 0x30 - u16 mustacheType : 2; // 0x32 + u16 mustacheType : 2; // 0x32 - u16 beardType : 2; // 0x32 - u16 beardColor : 3; // 0x32 - u16 beardScale : 4; // 0x32 - u16 beardY : 5; // 0x32 + u16 beardType : 2; // 0x32 + u16 beardColor : 3; // 0x32 + u16 beardScale : 4; // 0x32 + u16 beardY : 5; // 0x32 - u16 moleType : 1; // 0x34 - u16 moleScale : 4; // 0x34 + u16 moleType : 1; // 0x34 + u16 moleScale : 4; // 0x34 - u16 moleY : 5; // 0x34 - u16 moleX : 5; // 0x34 - u16 padding8 : 1; // 0x34 + u16 moleY : 5; // 0x34 + u16 moleX : 5; // 0x34 + u16 padding8 : 1; // 0x34 - u8 padding9[10]; // 0x36 + u8 padding9[10]; // 0x36 } RFLiHiddenCharData; #ifdef __cplusplus } #endif -#endif // RFLi_TYPES_H +#endif // RFLi_TYPES_H diff --git a/libs/RVLFaceLib/src/RFL_Controller.c b/libs/RVLFaceLib/src/RFL_Controller.c index fd81172e..5d9026b6 100644 --- a/libs/RVLFaceLib/src/RFL_Controller.c +++ b/libs/RVLFaceLib/src/RFL_Controller.c @@ -9,11 +9,11 @@ #include -#define RFL_CTRL_IDENTIFIER 'RNCD' +#define RFL_CTRL_IDENTIFIER 'RNCD' -#define MAX_RETRIES 3 +#define MAX_RETRIES 3 -#define WPAD_FACE_ADDR 0x0000 +#define WPAD_FACE_ADDR 0x0000 static void clearDatabase_(RFLiCtrlBuffer* buffer) { int i; @@ -64,8 +64,7 @@ BOOL RFLiCheckCtrlBufferCore(const RFLiCtrlBuffer* buffer, u8 index, RFLiCtrlChe if ((buffer->mSecretFlag & flag) != 0) { return FALSE; } - } - else if (type == RFLiCtrlCheckType_HiddenOnly) { + } else if (type == RFLiCtrlCheckType_HiddenOnly) { if ((buffer->mSecretFlag & flag) == 0) { return FALSE; } @@ -104,8 +103,7 @@ static BOOL checkCRC_(RFLiCtrlBuffer* buffer) { static BOOL checkValidate_(RFLiCtrlBuffer* buffer) { if (buffer->mIdentifier == RFL_CTRL_IDENTIFIER) { return checkCRC_(buffer); - } - else { + } else { return FALSE; } } @@ -134,8 +132,7 @@ static void validBufferFound_(RFLiCtrlBuffer* buffer, s32 chan) { if (RFLiGetIsolation()) { RFLiEndWorking(RFLErrcode_Success); - } - else { + } else { RFLiWriteCtrlToHiddenDB(manager->mBuffer[chan], RFLiGetCtrlBufManager()->mReadIsChMode); } } @@ -199,8 +196,7 @@ static void readcallback_(s32 chan, s32 result) { if (validbuf != NULL) { validBufferFound_(validbuf, chan); - } - else if (!errorAndReRead_(chan)) { + } else if (!errorAndReRead_(chan)) { RFLiFree(manager->mTmpReadBuffer); manager->mTmpReadBuffer = NULL; @@ -247,7 +243,9 @@ static void readbuffer_(s32 chan, void* buffer, BOOL isChannel) { return; } + // clang-format off RFLi_ASSERTLINE(manager->mTmpReadBuffer == ((void *)0) /* NULL */, 456); + // clang-format on manager->mTmpReadBuffer = RFLiAlloc32(size); manager->mReadBuffer = buffer; @@ -316,8 +314,7 @@ static void saveOfficialToCtrl_() { if (probe != WPAD_ERR_OK) { RFLiEndWorkingReason(RFLErrcode_Controllerfail, probe); - } - else { + } else { RFLiStartWorking(); writebuffer_(chan, buffer, 0); } @@ -330,8 +327,7 @@ static void closeOfficialOnly_() { static void saveOfficialOnlyOpened_() { if (RFLGetAsyncStatus() == RFLErrcode_Success) { RFLiSaveOpenedDatabaseAsync(closeOfficialOnly_); - } - else { + } else { saveOfficialToCtrl_(); } } @@ -350,7 +346,8 @@ static BOOL verify_(void* buf1, void* buf2, u16 size) { if (*ptr1 != *ptr2) { return FALSE; } - ptr1++; ptr2++; + ptr1++; + ptr2++; } return TRUE; @@ -365,7 +362,8 @@ static BOOL errorAndReWrite_(s32 chan) { manager->mRetry++; if (manager->mRetry < MAX_RETRIES) { - s32 write = WPADWriteFaceData(chan, manager->mWriteBuffer, sizeof(RFLiCtrlBuffer), WPAD_FACE_ADDR + (manager->mWriteCount * sizeof(RFLiCtrlBuffer)), writecallback_); + s32 write = WPADWriteFaceData(chan, manager->mWriteBuffer, sizeof(RFLiCtrlBuffer), + WPAD_FACE_ADDR + (manager->mWriteCount * sizeof(RFLiCtrlBuffer)), writecallback_); if (write != WPAD_ERR_OK) { RFLiEndWorkingReason(RFLErrcode_Controllerfail, write); } @@ -383,12 +381,10 @@ static void verifycallback_(s32 chan, s32 result) { if (verify_(manager->mWriteBuffer, manager->mVerifyBuffer, sizeof(RFLiCtrlBuffer))) { if (manager->mWriteCount == 0) { writebuffer_(chan, manager->mBuffer[chan], 1); - } - else { + } else { RFLiEndWorking(RFLErrcode_Success); } - } - else if (!errorAndReWrite_(chan)) { + } else if (!errorAndReWrite_(chan)) { RFLiEndWorking(RFLErrcode_Savefail); } break; @@ -415,20 +411,22 @@ static void writecallback_(s32 chan, s32 result) { if (result == WPAD_ERR_OK) { s32 read; + // clang-format off RFLi_ASSERTLINE(manager->mVerifyBuffer == ((void *)0) /* NULL */, 786); + // clang-format on manager->mVerifyBuffer = RFLiAlloc32(sizeof(RFLiCtrlBuffer)); memset(manager->mVerifyBuffer, 0, sizeof(RFLiCtrlBuffer)); - read = WPADReadFaceData(chan, manager->mVerifyBuffer, sizeof(RFLiCtrlBuffer), WPAD_FACE_ADDR + (manager->mWriteCount * sizeof(RFLiCtrlBuffer)), verifycallback_); + read = WPADReadFaceData(chan, manager->mVerifyBuffer, sizeof(RFLiCtrlBuffer), + WPAD_FACE_ADDR + (manager->mWriteCount * sizeof(RFLiCtrlBuffer)), verifycallback_); if (read != WPAD_ERR_OK) { RFLiFree(manager->mVerifyBuffer); manager->mVerifyBuffer = NULL; RFLiEndWorkingReason(RFLErrcode_Controllerfail, read); } - } - else { + } else { if (!errorAndReWrite_(chan)) { RFLiEndWorkingReason(RFLErrcode_Controllerfail, result); } @@ -481,12 +479,10 @@ static void replaceverifycallback_(s32 chan, s32 result) { if (verify_(manager->mVerifyBuffer, ((u8*)(manager->mReplaceBuf[manager->mWriteCount]) + OFFSET), 4)) { if (manager->mWriteCount == 0) { replacebuffer_(chan, manager->mWriteBuffer, 1); - } - else { + } else { saveOfficialOnly_(); } - } - else if (!errorAndReplace_(chan)) { + } else if (!errorAndReplace_(chan)) { RFLiEndWorking(RFLErrcode_Savefail); } break; @@ -513,8 +509,10 @@ static void replacecallback_(s32 chan, s32 result) { if (result == WPAD_ERR_OK) { s32 read; u16 offset; - + + // clang-format off RFLi_ASSERTLINE(manager->mVerifyBuffer == ((void *)0), 972); + // clang-format on manager->mVerifyBuffer = RFLiAlloc32(4); memset(manager->mVerifyBuffer, 0, 4); @@ -528,8 +526,7 @@ static void replacecallback_(s32 chan, s32 result) { RFLiEndWorkingReason(RFLErrcode_Controllerfail, read); } - } - else { + } else { if (!errorAndReWrite_(chan)) { RFLiEndWorkingReason(RFLErrcode_Controllerfail, result); } @@ -552,7 +549,7 @@ static void replacebuffer_(s32 chan, RFLiCtrlBuffer* buffer, u8 count) { createCRC_(replaced); offset = (count * sizeof(RFLiCtrlBuffer)) + OFFSET; - + write = WPADWriteFaceData(chan, ((u8*)walker + OFFSET), 4, WPAD_FACE_ADDR + offset, replacecallback_); if (write != WPAD_ERR_OK) { RFLiEndWorkingReason(RFLErrcode_Controllerfail, write); @@ -582,11 +579,10 @@ static BOOL setDataCoreBuffer_(const RFLiCharInfo* src, RFLiCtrlBuffer* buffer, if (isSecret) { buffer->mSecretFlag |= flag; - } - else { + } else { buffer->mSecretFlag &= ~flag; } - + return TRUE; } @@ -645,8 +641,7 @@ static void fillToWriteCtrl_() { probe = WPADProbe(chan, &type); if (probe != WPAD_ERR_OK) { RFLiEndWorkingReason(RFLErrcode_Controllerfail, probe); - } - else { + } else { replacebuffer_(chan, buffer, 0); } } @@ -688,8 +683,7 @@ RFLErrcode RFLiSaveControllerAsync(s32 chan, u16 deleted) { RFLiUpdateMiddleDB(&manager->mHiddenMDB); fillToWriteCtrl_(); return RFLGetAsyncStatus(); - } - else { + } else { return RFLiUpdateMiddleDBAsync(&manager->mHiddenMDB, fillToWriteCtrl_, FALSE); } } @@ -700,9 +694,9 @@ BOOL RFLiFormatControllerData(s32 chan) { RFLi_ASSERTLINE_RANGE(chan, 0, WPAD_MAX_CONTROLLERS, 1304); if (chan < 0 || chan >= WPAD_MAX_CONTROLLERS) { - return RFLErrcode_WrongParam; // @BUG Should be FALSE + return RFLErrcode_WrongParam; // @BUG Should be FALSE } - + manager = RFLiGetCtrlBufManager(); if (manager == NULL) { return FALSE; @@ -844,11 +838,11 @@ BOOL RFLiIsAvailableControllerData(s32 chan, u8 index, RFLiCtrlCheckType type) { RFLi_ASSERTLINE_RANGE(index, 0, RFL_MAX_CTRL_BUFFER, 1504); if (chan < 0 || chan >= WPAD_MAX_CONTROLLERS) { - return RFLErrcode_WrongParam; // @BUG: Should be FALSE + return RFLErrcode_WrongParam; // @BUG: Should be FALSE } if (index >= RFL_MAX_CTRL_BUFFER) { - return RFLErrcode_WrongParam; // @BUG: Should be FALSE + return RFLErrcode_WrongParam; // @BUG: Should be FALSE } if (!RFLAvailable()) { diff --git a/libs/RVLFaceLib/src/RFL_DataUtility.c b/libs/RVLFaceLib/src/RFL_DataUtility.c index b92c5751..69d82f66 100644 --- a/libs/RVLFaceLib/src/RFL_DataUtility.c +++ b/libs/RVLFaceLib/src/RFL_DataUtility.c @@ -10,127 +10,134 @@ #include #include -#define CHECK_BOOL(name, var) if (!(var)) { RFLi_REPORT("Invalid "name" data."); return FALSE; } +#define CHECK_BOOL(name, var) \ + if (!(var)) { \ + RFLi_REPORT("Invalid " name " data."); \ + return FALSE; \ + } BOOL RFLiCheckValidInfo(const RFLiCharInfo* info) { - CHECK_BOOL("FACELINE", info->faceline.type <= RFLi_FACELINE_TYPE_MAX); - CHECK_BOOL("FACELINE", info->faceline.color <= RFLi_FACELINE_COLOR_MAX); - CHECK_BOOL("FACELINE", info->faceline.texture <= RFLi_FACELINE_TEX_MAX); + CHECK_BOOL("FACELINE", info->faceline.type <= RFLi_FACELINE_TYPE_MAX); + CHECK_BOOL("FACELINE", info->faceline.color <= RFLi_FACELINE_COLOR_MAX); + CHECK_BOOL("FACELINE", info->faceline.texture <= RFLi_FACELINE_TEX_MAX); - CHECK_BOOL("HAIR", info->hair.type <= RFLi_HAIR_TYPE_MAX); - CHECK_BOOL("HAIR", info->hair.color <= RFLi_HAIR_COLOR_MAX); - CHECK_BOOL("HAIR", info->hair.flip <= RFLi_HAIR_FLIP_MAX); + CHECK_BOOL("HAIR", info->hair.type <= RFLi_HAIR_TYPE_MAX); + CHECK_BOOL("HAIR", info->hair.color <= RFLi_HAIR_COLOR_MAX); + CHECK_BOOL("HAIR", info->hair.flip <= RFLi_HAIR_FLIP_MAX); - CHECK_BOOL("EYE", info->eye.type <= RFLi_EYE_TYPE_MAX); - CHECK_BOOL("EYE", info->eye.color <= RFLi_EYE_COLOR_MAX); - CHECK_BOOL("EYE", info->eye.scale <= RFLi_EYE_SCALE_MAX); - CHECK_BOOL("EYE", info->eye.rotate <= RFLi_EYE_ROT_MAX); - CHECK_BOOL("EYE", info->eye.x <= RFLi_EYE_X_MAX); - CHECK_BOOL("EYE", info->eye.y <= RFLi_EYE_Y_MAX); + CHECK_BOOL("EYE", info->eye.type <= RFLi_EYE_TYPE_MAX); + CHECK_BOOL("EYE", info->eye.color <= RFLi_EYE_COLOR_MAX); + CHECK_BOOL("EYE", info->eye.scale <= RFLi_EYE_SCALE_MAX); + CHECK_BOOL("EYE", info->eye.rotate <= RFLi_EYE_ROT_MAX); + CHECK_BOOL("EYE", info->eye.x <= RFLi_EYE_X_MAX); + CHECK_BOOL("EYE", info->eye.y <= RFLi_EYE_Y_MAX); - CHECK_BOOL("EYEBROW", info->eyebrow.type <= RFLi_EYEBROW_TYPE_MAX); - CHECK_BOOL("EYEBROW", info->eyebrow.color <= RFLi_EYEBROW_COLOR_MAX); - CHECK_BOOL("EYEBROW", info->eyebrow.scale <= RFLi_EYEBROW_SCALE_MAX); - CHECK_BOOL("EYEBROW", info->eyebrow.rotate <= RFLi_EYEBROW_ROT_MAX); - CHECK_BOOL("EYEBROW", info->eyebrow.x <= RFLi_EYEBROW_X_MAX); - CHECK_BOOL("EYEBROW", info->eyebrow.y >= RFLi_EYEBROW_Y_MIN); - CHECK_BOOL("EYEBROW", info->eyebrow.y <= RFLi_EYEBROW_Y_MAX); + CHECK_BOOL("EYEBROW", info->eyebrow.type <= RFLi_EYEBROW_TYPE_MAX); + CHECK_BOOL("EYEBROW", info->eyebrow.color <= RFLi_EYEBROW_COLOR_MAX); + CHECK_BOOL("EYEBROW", info->eyebrow.scale <= RFLi_EYEBROW_SCALE_MAX); + CHECK_BOOL("EYEBROW", info->eyebrow.rotate <= RFLi_EYEBROW_ROT_MAX); + CHECK_BOOL("EYEBROW", info->eyebrow.x <= RFLi_EYEBROW_X_MAX); + CHECK_BOOL("EYEBROW", info->eyebrow.y >= RFLi_EYEBROW_Y_MIN); + CHECK_BOOL("EYEBROW", info->eyebrow.y <= RFLi_EYEBROW_Y_MAX); - CHECK_BOOL("NOSE", info->nose.type <= RFLi_NOSE_TYPE_MAX); - CHECK_BOOL("NOSE", info->nose.scale <= RFLi_NOSE_SCALE_MAX); - CHECK_BOOL("NOSE", info->nose.y <= RFLi_NOSE_Y_MAX); + CHECK_BOOL("NOSE", info->nose.type <= RFLi_NOSE_TYPE_MAX); + CHECK_BOOL("NOSE", info->nose.scale <= RFLi_NOSE_SCALE_MAX); + CHECK_BOOL("NOSE", info->nose.y <= RFLi_NOSE_Y_MAX); - CHECK_BOOL("MOUTH", info->mouth.type <= RFLi_MOUTH_TYPE_MAX); - CHECK_BOOL("MOUTH", info->mouth.color <= RFLi_MOUTH_COLOR_MAX); - CHECK_BOOL("MOUTH", info->mouth.scale <= RFLi_MOUTH_SCALE_MAX); - CHECK_BOOL("MOUTH", info->mouth.y <= RFLi_MOUTH_Y_MAX); + CHECK_BOOL("MOUTH", info->mouth.type <= RFLi_MOUTH_TYPE_MAX); + CHECK_BOOL("MOUTH", info->mouth.color <= RFLi_MOUTH_COLOR_MAX); + CHECK_BOOL("MOUTH", info->mouth.scale <= RFLi_MOUTH_SCALE_MAX); + CHECK_BOOL("MOUTH", info->mouth.y <= RFLi_MOUTH_Y_MAX); - CHECK_BOOL("BEARD", info->beard.mustache <= RFLi_BEARD_MUSTACHE_MAX); - CHECK_BOOL("BEARD", info->beard.type <= RFLi_BEARD_TYPE_MAX); - CHECK_BOOL("BEARD", info->beard.color <= RFLi_BEARD_COLOR_MAX); - CHECK_BOOL("BEARD", info->beard.scale <= RFLi_BEARD_SCALE_MAX); - CHECK_BOOL("BEARD", info->beard.y <= RFLi_BEARD_Y_MAX); + CHECK_BOOL("BEARD", info->beard.mustache <= RFLi_BEARD_MUSTACHE_MAX); + CHECK_BOOL("BEARD", info->beard.type <= RFLi_BEARD_TYPE_MAX); + CHECK_BOOL("BEARD", info->beard.color <= RFLi_BEARD_COLOR_MAX); + CHECK_BOOL("BEARD", info->beard.scale <= RFLi_BEARD_SCALE_MAX); + CHECK_BOOL("BEARD", info->beard.y <= RFLi_BEARD_Y_MAX); - CHECK_BOOL("GLASS", info->glass.type <= RFLi_GLASS_TYPE_MAX); - CHECK_BOOL("GLASS", info->glass.color <= RFLi_GLASS_COLOR_MAX); - CHECK_BOOL("GLASS", info->glass.scale <= RFLi_GLASS_SCALE_MAX); - CHECK_BOOL("GLASS", info->glass.y <= RFLi_GLASS_Y_MAX); + CHECK_BOOL("GLASS", info->glass.type <= RFLi_GLASS_TYPE_MAX); + CHECK_BOOL("GLASS", info->glass.color <= RFLi_GLASS_COLOR_MAX); + CHECK_BOOL("GLASS", info->glass.scale <= RFLi_GLASS_SCALE_MAX); + CHECK_BOOL("GLASS", info->glass.y <= RFLi_GLASS_Y_MAX); - CHECK_BOOL("MOLE", info->mole.type <= RFLi_MOLE_TYPE_MAX); - CHECK_BOOL("MOLE", info->mole.scale <= RFLi_MOLE_SCALE_MAX); - CHECK_BOOL("MOLE", info->mole.x <= RFLi_MOLE_X_MAX); - CHECK_BOOL("MOLE", info->mole.y <= RFLi_MOLE_Y_MAX); + CHECK_BOOL("MOLE", info->mole.type <= RFLi_MOLE_TYPE_MAX); + CHECK_BOOL("MOLE", info->mole.scale <= RFLi_MOLE_SCALE_MAX); + CHECK_BOOL("MOLE", info->mole.x <= RFLi_MOLE_X_MAX); + CHECK_BOOL("MOLE", info->mole.y <= RFLi_MOLE_Y_MAX); - CHECK_BOOL("NAME", RFLiIsValidName2(info)); + CHECK_BOOL("NAME", RFLiIsValidName2(info)); - CHECK_BOOL("HEIGHT", info->body.height <= RFLi_HEIGHT_MAX); - CHECK_BOOL("BUILD", info->body.build <= RFLi_BUILD_MAX); + CHECK_BOOL("HEIGHT", info->body.height <= RFLi_HEIGHT_MAX); + CHECK_BOOL("BUILD", info->body.build <= RFLi_BUILD_MAX); - CHECK_BOOL("SEX", info->personal.sex <= RFLSex_All-1); - CHECK_BOOL("BIRTHDAY", RFLiCheckBirthday(info->personal.birth_month, info->personal.birth_day)); + CHECK_BOOL("SEX", info->personal.sex <= RFLSex_All - 1); + CHECK_BOOL("BIRTHDAY", RFLiCheckBirthday(info->personal.birth_month, info->personal.birth_day)); CHECK_BOOL("FAVORITECOLOR", info->personal.favoriteColor < RFLFavoriteColor_Max); - CHECK_BOOL("CREATEID", !RFLiIsSpecialID(&info->createID) || info->personal.localonly != 0); + CHECK_BOOL("CREATEID", !RFLiIsSpecialID(&info->createID) || info->personal.localonly != 0); return TRUE; } #undef CHECK_BOOL -#define CHECK_BOOL(name, var) if (!(var)) { return FALSE; } +#define CHECK_BOOL(name, var) \ + if (!(var)) { \ + return FALSE; \ + } BOOL RFLiCheckValidInfoNoName(const RFLiCharInfo* info) { - CHECK_BOOL("FACELINE", info->faceline.type <= RFLi_FACELINE_TYPE_MAX); - CHECK_BOOL("FACELINE", info->faceline.color <= RFLi_FACELINE_COLOR_MAX); - CHECK_BOOL("FACELINE", info->faceline.texture <= RFLi_FACELINE_TEX_MAX); + CHECK_BOOL("FACELINE", info->faceline.type <= RFLi_FACELINE_TYPE_MAX); + CHECK_BOOL("FACELINE", info->faceline.color <= RFLi_FACELINE_COLOR_MAX); + CHECK_BOOL("FACELINE", info->faceline.texture <= RFLi_FACELINE_TEX_MAX); - CHECK_BOOL("HAIR", info->hair.type <= RFLi_HAIR_TYPE_MAX); - CHECK_BOOL("HAIR", info->hair.color <= RFLi_HAIR_COLOR_MAX); - CHECK_BOOL("HAIR", info->hair.flip <= RFLi_HAIR_FLIP_MAX); + CHECK_BOOL("HAIR", info->hair.type <= RFLi_HAIR_TYPE_MAX); + CHECK_BOOL("HAIR", info->hair.color <= RFLi_HAIR_COLOR_MAX); + CHECK_BOOL("HAIR", info->hair.flip <= RFLi_HAIR_FLIP_MAX); - CHECK_BOOL("EYE", info->eye.type <= RFLi_EYE_TYPE_MAX); - CHECK_BOOL("EYE", info->eye.color <= RFLi_EYE_COLOR_MAX); - CHECK_BOOL("EYE", info->eye.scale <= RFLi_EYE_SCALE_MAX); - CHECK_BOOL("EYE", info->eye.rotate <= RFLi_EYE_ROT_MAX); - CHECK_BOOL("EYE", info->eye.x <= RFLi_EYE_X_MAX); - CHECK_BOOL("EYE", info->eye.y <= RFLi_EYE_Y_MAX); + CHECK_BOOL("EYE", info->eye.type <= RFLi_EYE_TYPE_MAX); + CHECK_BOOL("EYE", info->eye.color <= RFLi_EYE_COLOR_MAX); + CHECK_BOOL("EYE", info->eye.scale <= RFLi_EYE_SCALE_MAX); + CHECK_BOOL("EYE", info->eye.rotate <= RFLi_EYE_ROT_MAX); + CHECK_BOOL("EYE", info->eye.x <= RFLi_EYE_X_MAX); + CHECK_BOOL("EYE", info->eye.y <= RFLi_EYE_Y_MAX); - CHECK_BOOL("EYEBROW", info->eyebrow.type <= RFLi_EYEBROW_TYPE_MAX); - CHECK_BOOL("EYEBROW", info->eyebrow.color <= RFLi_EYEBROW_COLOR_MAX); - CHECK_BOOL("EYEBROW", info->eyebrow.scale <= RFLi_EYEBROW_SCALE_MAX); - CHECK_BOOL("EYEBROW", info->eyebrow.rotate <= RFLi_EYEBROW_ROT_MAX); - CHECK_BOOL("EYEBROW", info->eyebrow.x <= RFLi_EYEBROW_X_MAX); - CHECK_BOOL("EYEBROW", info->eyebrow.y >= RFLi_EYEBROW_Y_MIN); - CHECK_BOOL("EYEBROW", info->eyebrow.y <= RFLi_EYEBROW_Y_MAX); + CHECK_BOOL("EYEBROW", info->eyebrow.type <= RFLi_EYEBROW_TYPE_MAX); + CHECK_BOOL("EYEBROW", info->eyebrow.color <= RFLi_EYEBROW_COLOR_MAX); + CHECK_BOOL("EYEBROW", info->eyebrow.scale <= RFLi_EYEBROW_SCALE_MAX); + CHECK_BOOL("EYEBROW", info->eyebrow.rotate <= RFLi_EYEBROW_ROT_MAX); + CHECK_BOOL("EYEBROW", info->eyebrow.x <= RFLi_EYEBROW_X_MAX); + CHECK_BOOL("EYEBROW", info->eyebrow.y >= RFLi_EYEBROW_Y_MIN); + CHECK_BOOL("EYEBROW", info->eyebrow.y <= RFLi_EYEBROW_Y_MAX); - CHECK_BOOL("NOSE", info->nose.type <= RFLi_NOSE_TYPE_MAX); - CHECK_BOOL("NOSE", info->nose.scale <= RFLi_NOSE_SCALE_MAX); - CHECK_BOOL("NOSE", info->nose.y <= RFLi_NOSE_Y_MAX); + CHECK_BOOL("NOSE", info->nose.type <= RFLi_NOSE_TYPE_MAX); + CHECK_BOOL("NOSE", info->nose.scale <= RFLi_NOSE_SCALE_MAX); + CHECK_BOOL("NOSE", info->nose.y <= RFLi_NOSE_Y_MAX); - CHECK_BOOL("MOUTH", info->mouth.type <= RFLi_MOUTH_TYPE_MAX); - CHECK_BOOL("MOUTH", info->mouth.color <= RFLi_MOUTH_COLOR_MAX); - CHECK_BOOL("MOUTH", info->mouth.scale <= RFLi_MOUTH_SCALE_MAX); - CHECK_BOOL("MOUTH", info->mouth.y <= RFLi_MOUTH_Y_MAX); + CHECK_BOOL("MOUTH", info->mouth.type <= RFLi_MOUTH_TYPE_MAX); + CHECK_BOOL("MOUTH", info->mouth.color <= RFLi_MOUTH_COLOR_MAX); + CHECK_BOOL("MOUTH", info->mouth.scale <= RFLi_MOUTH_SCALE_MAX); + CHECK_BOOL("MOUTH", info->mouth.y <= RFLi_MOUTH_Y_MAX); - CHECK_BOOL("BEARD", info->beard.mustache <= RFLi_BEARD_MUSTACHE_MAX); - CHECK_BOOL("BEARD", info->beard.type <= RFLi_BEARD_TYPE_MAX); - CHECK_BOOL("BEARD", info->beard.color <= RFLi_BEARD_COLOR_MAX); - CHECK_BOOL("BEARD", info->beard.scale <= RFLi_BEARD_SCALE_MAX); - CHECK_BOOL("BEARD", info->beard.y <= RFLi_BEARD_Y_MAX); + CHECK_BOOL("BEARD", info->beard.mustache <= RFLi_BEARD_MUSTACHE_MAX); + CHECK_BOOL("BEARD", info->beard.type <= RFLi_BEARD_TYPE_MAX); + CHECK_BOOL("BEARD", info->beard.color <= RFLi_BEARD_COLOR_MAX); + CHECK_BOOL("BEARD", info->beard.scale <= RFLi_BEARD_SCALE_MAX); + CHECK_BOOL("BEARD", info->beard.y <= RFLi_BEARD_Y_MAX); - CHECK_BOOL("GLASS", info->glass.type <= RFLi_GLASS_TYPE_MAX); - CHECK_BOOL("GLASS", info->glass.color <= RFLi_GLASS_COLOR_MAX); - CHECK_BOOL("GLASS", info->glass.scale <= RFLi_GLASS_SCALE_MAX); - CHECK_BOOL("GLASS", info->glass.y <= RFLi_GLASS_Y_MAX); + CHECK_BOOL("GLASS", info->glass.type <= RFLi_GLASS_TYPE_MAX); + CHECK_BOOL("GLASS", info->glass.color <= RFLi_GLASS_COLOR_MAX); + CHECK_BOOL("GLASS", info->glass.scale <= RFLi_GLASS_SCALE_MAX); + CHECK_BOOL("GLASS", info->glass.y <= RFLi_GLASS_Y_MAX); - CHECK_BOOL("MOLE", info->mole.type <= RFLi_MOLE_TYPE_MAX); - CHECK_BOOL("MOLE", info->mole.scale <= RFLi_MOLE_SCALE_MAX); - CHECK_BOOL("MOLE", info->mole.x <= RFLi_MOLE_X_MAX); - CHECK_BOOL("MOLE", info->mole.y <= RFLi_MOLE_Y_MAX); + CHECK_BOOL("MOLE", info->mole.type <= RFLi_MOLE_TYPE_MAX); + CHECK_BOOL("MOLE", info->mole.scale <= RFLi_MOLE_SCALE_MAX); + CHECK_BOOL("MOLE", info->mole.x <= RFLi_MOLE_X_MAX); + CHECK_BOOL("MOLE", info->mole.y <= RFLi_MOLE_Y_MAX); - CHECK_BOOL("HEIGHT", info->body.height <= RFLi_HEIGHT_MAX); - CHECK_BOOL("BUILD", info->body.build <= RFLi_BUILD_MAX); + CHECK_BOOL("HEIGHT", info->body.height <= RFLi_HEIGHT_MAX); + CHECK_BOOL("BUILD", info->body.build <= RFLi_BUILD_MAX); - CHECK_BOOL("SEX", info->personal.sex <= RFLSex_All-1); - CHECK_BOOL("BIRTHDAY", RFLiCheckBirthday(info->personal.birth_month, info->personal.birth_day)); + CHECK_BOOL("SEX", info->personal.sex <= RFLSex_All - 1); + CHECK_BOOL("BIRTHDAY", RFLiCheckBirthday(info->personal.birth_month, info->personal.birth_day)); CHECK_BOOL("FAVORITECOLOR", info->personal.favoriteColor < RFLFavoriteColor_Max); - CHECK_BOOL("CREATEID", !RFLiIsSpecialID(&info->createID) || info->personal.localonly != 0); + CHECK_BOOL("CREATEID", !RFLiIsSpecialID(&info->createID) || info->personal.localonly != 0); return TRUE; } @@ -145,19 +152,21 @@ BOOL RFLiIsValidOnNAND(const RFLiCharInfo* info) { return TRUE; } - BOOL RFLiIsSameFaceCore(const RFLiCharInfo* lhv, const RFLiCharInfo* rhv) { RFLi_ASSERTLINE_NULL(lhv, 211); RFLi_ASSERTLINE_NULL(rhv, 212); - #define PAD_MASK(t, size) ((t)(~((1 << size) - 1))) - #define CHECK_PADMASK(p, ms, mt) if ((lhv->p.rawdata & PAD_MASK(mt, ms)) != (rhv->p.rawdata & PAD_MASK(mt, ms))) { return FALSE; } +#define PAD_MASK(t, size) ((t)(~((1 << size) - 1))) +#define CHECK_PADMASK(p, ms, mt) \ + if ((lhv->p.rawdata & PAD_MASK(mt, ms)) != (rhv->p.rawdata & PAD_MASK(mt, ms))) { \ + return FALSE; \ + } CHECK_PADMASK(eye, 5, u32); CHECK_PADMASK(eyebrow, 6, u32); CHECK_PADMASK(mouth, 0, u16); CHECK_PADMASK(beard, 0, u16); - CHECK_PADMASK(glass, 1, u16); // @BUG There is no padding for glass (old version left over?) + CHECK_PADMASK(glass, 1, u16); // @BUG There is no padding for glass (old version left over?) CHECK_PADMASK(mole, 1, u16); CHECK_PADMASK(nose, 3, u16); CHECK_PADMASK(hair, 5, u16); @@ -165,8 +174,8 @@ BOOL RFLiIsSameFaceCore(const RFLiCharInfo* lhv, const RFLiCharInfo* rhv) { return TRUE; - #undef CHECK_PADMASK - #undef PAD_MASK +#undef CHECK_PADMASK +#undef PAD_MASK } RFLCheckError RFLIsSameFace(RFLDataSource lhvs, RFLMiddleDatabase* lhvd, u16 lhvi, RFLDataSource rhvs, RFLMiddleDatabase* rhvd, u16 rhvi) { @@ -183,8 +192,7 @@ RFLCheckError RFLIsSameFace(RFLDataSource lhvs, RFLMiddleDatabase* lhvd, u16 lhv if (RFLiIsSameFaceCore(&linfo, &rinfo)) { return RFLCheckError_Same; - } - else { + } else { return RFLCheckError_Difference; } } @@ -204,7 +212,7 @@ RFLErrcode RFLiPickupCharInfo(RFLiCharInfo* info, RFLDataSource source, const RF break; } case RFLDataSource_Hidden: { - RFLi_ASSERTLINE_MSG(FALSE, 304, "裏データベースを直接参照することは出来ません"); // "The specified source cannot reference the database." + RFLi_ASSERTLINE_MSG(FALSE, 304, "裏データベースを直接参照することは出来ません"); // "The specified source cannot reference the database." break; } case RFLDataSource_Controller1: @@ -218,8 +226,7 @@ RFLErrcode RFLiPickupCharInfo(RFLiCharInfo* info, RFLDataSource source, const RF r = RFLiGetControllerData(info, chan, (u8)index, FALSE); if (r) { err = RFLErrcode_Success; - } - else { + } else { err = RFLErrcode_Broken; } } @@ -233,8 +240,7 @@ RFLErrcode RFLiPickupCharInfo(RFLiCharInfo* info, RFLDataSource source, const RF r = RFLiGetCharInfoMiddleDB(info, middleDB, index); if (r) { err = RFLErrcode_Success; - } - else { + } else { err = RFLErrcode_Broken; } } @@ -246,7 +252,7 @@ RFLErrcode RFLiPickupCharInfo(RFLiCharInfo* info, RFLDataSource source, const RF break; } default: { - RFLi_ASSERTLINE_MSG(FALSE, 340, "指定されたデータソースが不正です"); // "The specified data source is invalid." + RFLi_ASSERTLINE_MSG(FALSE, 340, "指定されたデータソースが不正です"); // "The specified data source is invalid." break; } } @@ -254,8 +260,7 @@ RFLErrcode RFLiPickupCharInfo(RFLiCharInfo* info, RFLDataSource source, const RF if (err == RFLErrcode_Success) { if (!RFLiIsValidID(&info->createID)) { err = RFLErrcode_Broken; - } - else if (!RFLiCheckValidInfo(info)) { + } else if (!RFLiCheckValidInfo(info)) { err = RFLErrcode_Broken; } } @@ -271,15 +276,14 @@ static void copyChar2Additional_(RFLAdditionalInfo* dst, const RFLiCharInfo* src dst->name[RFL_NAME_LENGTH] = 0; memcpy(dst->creator, src->personal.creator, RFL_NAME_LENGTH * sizeof(u16)); - dst->name[RFL_NAME_LENGTH] = 0; // @BUG Copy and paste error - + dst->name[RFL_NAME_LENGTH] = 0; // @BUG Copy and paste error + dst->gender = src->personal.sex; if (RFLiCheckBirthday(src->personal.birth_month, src->personal.birth_day)) { dst->birth_month = src->personal.birth_month; dst->birth_day = src->personal.birth_day; - } - else { + } else { dst->birth_month = 0; dst->birth_day = 0; } @@ -291,11 +295,11 @@ static void copyChar2Additional_(RFLAdditionalInfo* dst, const RFLiCharInfo* src build = src->body.build; // @BUG The max is not 127 - if (height > RFLi_HEIGHT_MAX-1) { - height = RFLi_HEIGHT_MAX-1; + if (height > RFLi_HEIGHT_MAX - 1) { + height = RFLi_HEIGHT_MAX - 1; } - if (build > RFLi_BUILD_MAX-1) { - build = RFLi_BUILD_MAX-1; + if (build > RFLi_BUILD_MAX - 1) { + build = RFLi_BUILD_MAX - 1; } dst->height = height; @@ -322,8 +326,7 @@ RFLErrcode RFLGetAdditionalInfo(RFLAdditionalInfo* info, RFLDataSource source, R } BOOL RFLiCheckBirthday(u8 month, u8 day) { - static const u8 scDayMax[12+1] = {0, 31, 29, 31, 30, 31, 30, - 31, 31, 30, 31, 30, 31}; + static const u8 scDayMax[12 + 1] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; if (month == 0 && day != 0) { return FALSE; } @@ -346,4 +349,4 @@ void RFLiCreateStoreData(RFLiStoreData* store, const RFLiCharInfo* info) { store->crc = 0; store->crc = RFLiCalculateCRC(store, sizeof(RFLiStoreData)); } -#endif // RFL_DEBUG +#endif // RFL_DEBUG diff --git a/libs/RVLFaceLib/src/RFL_Database.c b/libs/RVLFaceLib/src/RFL_Database.c index 7e448429..fc99d681 100644 --- a/libs/RVLFaceLib/src/RFL_Database.c +++ b/libs/RVLFaceLib/src/RFL_Database.c @@ -11,12 +11,12 @@ #include /* for Create ID */ -#define LOWADDR 0 -#define HIGHADDR 1 +#define LOWADDR 0 +#define HIGHADDR 1 #define FLAG_NORMAL 31 -#define FLAG_DSID 30 -#define FLAG_TEMP 29 +#define FLAG_DSID 30 +#define FLAG_TEMP 29 void RFLiInitDatabase(MEMiHeapHead* sysHeap) { RFLiDatabaseManager* manager = RFLiGetDBManager(); @@ -45,8 +45,7 @@ static void bootloadCheckCRCCb_(u32 crc) { if (crc != 0) { RFLiGetManager()->mLastErrcode = RFLErrcode_Loadfail; RFLiSetFileBroken(RFLiFileBrokenType_DBBroken); - } - else { + } else { RFLiGetManager()->mLastErrcode = RFLErrcode_Success; } @@ -324,8 +323,8 @@ RFLiCharData* RFLiGetCharData(u16 index) { if (!RFLiIsValidOnNAND(&info)) { return NULL; + } } -} return data; } @@ -581,7 +580,7 @@ void RFLiConvertInfo2HRaw(const RFLiCharInfo* info, RFLiHiddenCharData* data) { void RFLiConvertHRaw2Raw(const RFLiHiddenCharData* hdata, RFLiCharData* data) { memset(data, 0, sizeof(RFLiCharData)); - memcpy(data, hdata, sizeof(RFLiHiddenCharData)-10); + memcpy(data, hdata, sizeof(RFLiHiddenCharData) - 10); /* NO BIRTHDAY */ data->birth_day = 0; @@ -590,7 +589,7 @@ void RFLiConvertHRaw2Raw(const RFLiHiddenCharData* hdata, RFLiCharData* data) { void RFLiConvertRaw2HRaw(const RFLiCharData* data, RFLiHiddenCharData* hdata) { memset(hdata, 0, sizeof(RFLiHiddenCharData)); - memcpy(hdata, data, sizeof(RFLiHiddenCharData)-10); + memcpy(hdata, data, sizeof(RFLiHiddenCharData) - 10); /* NO BIRTHDAY */ hdata->birth_padding = 0; @@ -616,7 +615,7 @@ RFLErrcode RFLiGetCharRawData(RFLiCharData* data, u16 index) { } memcpy(data, idata, sizeof(RFLiCharData)); - + return RFLErrcode_Success; } @@ -663,8 +662,7 @@ BOOL RFLiSetCharInfo(const RFLiCharInfo* info, u16 index) { if (setCharInfo_(index, info)) { RFLiDeleteHiddenDataID((RFLCreateID*)&info->createID); return TRUE; - } - else { + } else { return FALSE; } } @@ -753,8 +751,7 @@ BOOL RFLIsAvailableOfficialData(u16 index) { data = RFLiGetCharData(index); if (data == NULL) { return FALSE; - } - else { + } else { return TRUE; } } @@ -798,8 +795,8 @@ static BOOL createLowAddr_(u32* dst) { BOOL isFirst = TRUE; // Nintendo's MAC Address identifier - static const u8 scFirstMakerCode[RFL_MAC_ADDR_LENGTH/2] = { 0x00, 0x17, 0xAB }; - #define FIRST_MAKER_CODE_LEN (int)(sizeof(scFirstMakerCode)/sizeof(scFirstMakerCode[0])) + static const u8 scFirstMakerCode[RFL_MAC_ADDR_LENGTH / 2] = {0x00, 0x17, 0xAB}; +#define FIRST_MAKER_CODE_LEN (int)(sizeof(scFirstMakerCode) / sizeof(scFirstMakerCode[0])) RFLi_ASSERTLINE_NULL(addr, 1162); @@ -925,7 +922,7 @@ BOOL RFLiIsMyHomeID(const RFLCreateID* id) { if (*ptarg_low != addr) { return FALSE; } - + return TRUE; } @@ -960,8 +957,7 @@ BOOL RFLiIsSpecialID(const RFLCreateID* id) { if ((ptarg[LOWADDR] & (1 << FLAG_NORMAL)) == 0) { return TRUE; - } - else { + } else { return FALSE; } } @@ -985,8 +981,7 @@ BOOL RFLiIsDSID(const RFLCreateID* id) { if ((ptarg[LOWADDR] & (1 << FLAG_DSID))) { return TRUE; - } - else { + } else { return FALSE; } } @@ -1006,8 +1001,7 @@ BOOL RFLiIsTemporaryID(const RFLCreateID* id) { if ((ptarg[LOWADDR] & (1 << FLAG_TEMP))) { return TRUE; - } - else { + } else { return FALSE; } } @@ -1133,8 +1127,7 @@ u16 RFLiCalculateCRC(void* head, u32 size) { if ((crc & 0x8000)) { crc = crc << 1; crc ^= scGeneration; - } - else { + } else { crc <<= 1; } @@ -1172,7 +1165,7 @@ void alarmCreateCb_(OSAlarm* alarm, OSContext* context) { while (count < size) { u8 data = *current; int i; - + if (curCount >= scOneCheckCount) { manager->crcInfo.current = current; manager->crcInfo.count = count; @@ -1189,8 +1182,7 @@ void alarmCreateCb_(OSAlarm* alarm, OSContext* context) { if ((crc & 0x8000)) { crc = crc << 1; crc ^= scGeneration; - } - else { + } else { crc <<= 1; } @@ -1254,7 +1246,7 @@ static void alarmCheckCb_(OSAlarm* alarm, OSContext* context) { while (count < size) { u8 data = *current; int i; - + if (curCount >= scOneCheckCount) { manager->crcInfo.current = current; manager->crcInfo.count = count; @@ -1271,8 +1263,7 @@ static void alarmCheckCb_(OSAlarm* alarm, OSContext* context) { if ((crc & 0x8000)) { crc = crc << 1; crc ^= scGeneration; - } - else { + } else { crc <<= 1; } @@ -1352,7 +1343,7 @@ RFLErrcode RFLGetStoreData(RFLStoreData* data, RFLDataSource source, u16 index) } if (rawdata == NULL) { - return RFLErrcode_DBNodata; + return RFLErrcode_DBNodata; } memcpy(&storedata, rawdata, sizeof(RFLiCharData)); diff --git a/libs/RVLFaceLib/src/RFL_DefaultDatabase.c b/libs/RVLFaceLib/src/RFL_DefaultDatabase.c index 9a181bc7..e951de94 100644 --- a/libs/RVLFaceLib/src/RFL_DefaultDatabase.c +++ b/libs/RVLFaceLib/src/RFL_DefaultDatabase.c @@ -7,6 +7,7 @@ #include +// clang-format off static const u8 scDefaultData[RFL_DEFAULT_DATA_MAX][sizeof(RFLiCharData)] = { /* GUEST A */ { @@ -69,13 +70,13 @@ static const u8 scDefaultData[RFL_DEFAULT_DATA_MAX][sizeof(RFLiCharData)] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; +// clang-format on RFLiCharData* RFLiGetDefaultDataPtr(u16 index) { RFLi_ASSERTLINE_RANGE(index, 0, RFL_DEFAULT_DATA_MAX, 152); if (index >= RFL_DEFAULT_DATA_MAX) { return NULL; - } - else { + } else { return (RFLiCharData*)scDefaultData[index]; } } @@ -95,7 +96,7 @@ BOOL RFLSearchDefaultData(const RFLCreateID* id, u16* index) { if (id == NULL) { return FALSE; } - + for (i = 0; i < RFL_DEFAULT_DATA_MAX; i++) { if (RFLiIsSameID((RFLCreateID*)&((RFLiCharData*)scDefaultData[i])->createID, id)) { ret = TRUE; diff --git a/libs/RVLFaceLib/src/RFL_Format.c b/libs/RVLFaceLib/src/RFL_Format.c index 10796363..88468bc5 100644 --- a/libs/RVLFaceLib/src/RFL_Format.c +++ b/libs/RVLFaceLib/src/RFL_Format.c @@ -9,9 +9,9 @@ const u32 gcRFLDataBaseIdentifier = 0x524E4F44 /*'RNOD'*/; -#define RFLi_TEMP_BUFFER_SIZE 0x16960 +#define RFLi_TEMP_BUFFER_SIZE 0x16960 -#define TABLE_STEP 1250 +#define TABLE_STEP 1250 void RFLiClearTableData(RFLiFormatTable* data) { memset(data, 0, sizeof(RFLiFormatTable)); @@ -27,7 +27,7 @@ void RFLiClearDBBuffer() { RFLi_ASSERTLINE_NULL(database, 53); header = &database->hidden; - memset(&database->rawdata, 0, sizeof(RFLiDatabase)); // @BUG: 4 byte buffer overrun + memset(&database->rawdata, 0, sizeof(RFLiDatabase)); // @BUG: 4 byte buffer overrun database->identifier = gcRFLDataBaseIdentifier; database->isolation = TRUE; @@ -61,8 +61,7 @@ static void formatWriteCallback_() { if (manager->formatIndex == -1) { manager->formatIndex = 0; - } - else { + } else { manager->formatIndex += TABLE_STEP; } @@ -71,10 +70,11 @@ static void formatWriteCallback_() { s32 i; for (i = 0; i < TABLE_STEP; i++) { - memset((RFLiHiddenCharData*)manager->formatTmp+i, 0, sizeof(RFLiHiddenCharData)); + memset((RFLiHiddenCharData*)manager->formatTmp + i, 0, sizeof(RFLiHiddenCharData)); } - switch (RFLiWriteAsync(RFLiFileType_Database, manager->formatTmp, RFLi_TEMP_BUFFER_SIZE, formatWriteCallback_, offset + sizeof(RFLiDatabase))) { + switch (RFLiWriteAsync(RFLiFileType_Database, manager->formatTmp, RFLi_TEMP_BUFFER_SIZE, formatWriteCallback_, + offset + sizeof(RFLiDatabase))) { case RFLErrcode_Success: case RFLErrcode_Busy: continuous = TRUE; @@ -83,16 +83,13 @@ static void formatWriteCallback_() { break; } } - } - else if (RFLiIsCachedHDB()) { + } else if (RFLiIsCachedHDB()) { RFLiClearCacheHDB(manager->cachedDB); } - } - else if (err == RFLErrcode_NANDCommandfail) { + } else if (err == RFLErrcode_NANDCommandfail) { if (RFLiGetLastReason() == NAND_RESULT_MAXBLOCKS) { RFLiCloseAsync(RFLiFileType_Database, maxblockCloseCallback_); - } - else { + } else { RFLiCloseAsync(RFLiFileType_Database, NULL); } } @@ -114,18 +111,16 @@ static void formatOpenCallback_() { RFLiHiddenDBManager* manager = RFLiGetHDBManager(); manager->formatIndex = -1; RFLi_ASSERTLINE(manager->formatTmp == 0L /* NULL */, 197); - + manager->formatTmp = RFLiAlloc32(RFLi_TEMP_BUFFER_SIZE); RFLiCreateHeaderCRCAsync(formatCalcCRCCb_); return; - } - else if (err == RFLErrcode_NANDCommandfail) { + } else if (err == RFLErrcode_NANDCommandfail) { if (RFLiGetLastReason() == NAND_RESULT_MAXFILES) { RFLiGetManager()->mLastErrcode = RFLErrcode_MaxFiles; } - } - else { + } else { RFLiCloseAsync(RFLiFileType_Database, formatCloseCallback_); } } @@ -141,8 +136,7 @@ static void formatCreateDirCallback_() { if (err == RFLErrcode_Success) { RFLiDeleteAsync(RFLiFileType_Database, formatDeleteCallback_); - } - else if (err == RFLErrcode_NANDCommandfail) { + } else if (err == RFLErrcode_NANDCommandfail) { if (RFLiGetLastReason() == NAND_RESULT_MAXFILES) { RFLiGetManager()->mLastErrcode = RFLErrcode_MaxFiles; } diff --git a/libs/RVLFaceLib/src/RFL_HiddenDatabase.c b/libs/RVLFaceLib/src/RFL_HiddenDatabase.c index 7f746b18..64abfc9f 100644 --- a/libs/RVLFaceLib/src/RFL_HiddenDatabase.c +++ b/libs/RVLFaceLib/src/RFL_HiddenDatabase.c @@ -55,8 +55,7 @@ void loadcallback_() { if (RFLiCheckValidInfo(&info) && RFLiIsValidOnNAND(&info)) { memcpy(manager->loadDst, data, sizeof(RFLiHiddenCharData)); - } - else { + } else { RFLiGetManager()->mLastErrcode = RFLErrcode_Broken; } } @@ -70,7 +69,7 @@ void loadcallback_() { void loadopencallback_() { RFLiHiddenDBManager* manager = RFLiGetHDBManager(); - + if (RFLGetAsyncStatus() == RFLErrcode_Success) { s32 offset = manager->loadIndex * sizeof(RFLiHiddenCharData); u32 size = sizeof(RFLiHiddenCharData); @@ -91,8 +90,7 @@ void loadopencallback_() { RFLiCloseAsync(RFLiFileType_Database, NULL); } } - } - else { + } else { manager->loadDst = NULL; manager->loadTmp = NULL; manager->loadIndex = 0; @@ -165,19 +163,16 @@ RFLErrcode RFLiLoadCachedHiddenData(RFLiHiddenCharData* data, u16 index) { if (RFLiCheckValidInfo(&info)) { memcpy(data, &manager->cachedDB[index], sizeof(RFLiHiddenCharData)); err = RFLErrcode_Success; - } - else { + } else { err = RFLErrcode_Broken; } - } - else { + } else { err = RFLErrcode_Broken; } - } - else { + } else { err = RFLErrcode_NotAvailable; } - + return err; } @@ -364,7 +359,7 @@ static BOOL checkCtrlWritableData_(const RFLiCtrlBuffer* buffer, u8 index, BOOL static BOOL checkOneWritableData_(const RFLiHiddenCharData* data) { if (RFLiIsValidID((RFLCreateID*)&data->createID) && !data->localonly && !RFLSearchOfficialData((RFLCreateID*)&data->createID, NULL) #if RFL_BUILD < 20080306 - && (RFLiSearchHiddenData((RFLCreateID*)&data->createID) == -1 || !RFLiIsMyHomeID((RFLCreateID*)&data->createID)) + && (RFLiSearchHiddenData((RFLCreateID*)&data->createID) == -1 || !RFLiIsMyHomeID((RFLCreateID*)&data->createID)) #endif ) { return TRUE; @@ -440,7 +435,7 @@ static s16 getFirstBlank_() { s16 i; RFLiHiddenDatabase* table = RFLiGetHiddenHeader(); - for (i = 0; i < RFL_MAX_HIDDEN_DB; i++ ){ + for (i = 0; i < RFL_MAX_HIDDEN_DB; i++) { if (!RFLiIsValidID(&table->data[i].createID)) { return i; } @@ -506,11 +501,10 @@ static void create_(const RFLiHiddenCharData* data, s16 target) { curNode->prev = table->tail; table->tail = index; curNode->next = -1; - } - else { + } else { table->tail = index; table->head = index; - curNode->prev = -1; + curNode->prev = -1; curNode->next = -1; } @@ -530,7 +524,7 @@ static void writeData_(const RFLiHiddenCharData* data); static void writeCallback_() { BOOL doClose = TRUE; RFLiHiddenDBManager* manager = RFLiGetHDBManager(); - + if (RFLGetAsyncStatus() == RFLErrcode_Success) { RFLiHiddenDBList* list = &RFLiGetHDBManager()->list; @@ -543,15 +537,13 @@ static void writeCallback_() { if (list->current < list->num) { doClose = FALSE; writeData_(&list->data[list->current]); - } - else { + } else { RFLiFree(manager->writeTmp); manager->writeTmp = NULL; writeHeader_(); } - } - else { + } else { RFLiFree(manager->writeTmp); manager->writeTmp = NULL; @@ -565,17 +557,15 @@ static void writeData_(const RFLiHiddenCharData* data) { s16 onhdb = -1; s16 target = getFirstBlank_(); - offset; // *sob* (for debug match) + offset; // *sob* (for debug match) onhdb = RFLiSearchHiddenData((RFLCreateID*)&data->createID); if (onhdb != -1) { target = onhdb; - } - else if (target < 0) { + } else if (target < 0) { target = overwrite_(data); - } - else { + } else { create_(data, target); } @@ -629,8 +619,7 @@ static void initAnyBufferToHiddenDB_(RFLSimpleCB cb, RFLSimpleCB nextScene) { if (!RFLiDBIsLoaded()) { RFLiFormatAsync(nextScene); - } - else { + } else { nextScene(); } } @@ -640,8 +629,7 @@ RFLErrcode RFLiWriteCtrlToHiddenDB(const RFLiCtrlBuffer* buffer, BOOL isChMode) if (getCtrlWritableCount_(buffer, isChMode)) { initAnyBufferToHiddenDB_(writeCtrl2HDBCallback_, writeDataStart_); - } - else { + } else { initAnyBufferToHiddenDB_(writeCtrl2HDBCallback_, writeHeaderStart_); } @@ -818,8 +806,7 @@ BOOL RFLiIsValidHiddenData(u16 index, RFLSex sex) { case RFLSex_Male: { if (sex == RFLSex_Male) { return TRUE; - } - else { + } else { return FALSE; } break; @@ -827,8 +814,7 @@ BOOL RFLiIsValidHiddenData(u16 index, RFLSex sex) { case RFLSex_Female: { if (sex == RFLSex_Female) { return TRUE; - } - else { + } else { return FALSE; } break; @@ -846,7 +832,7 @@ u32 RFLiGetCacheHDBBufferSize() { static void readCacheCallback_() { RFLiHiddenDBManager* manager = RFLiGetHDBManager(); s32 reason; - + switch (RFLGetAsyncStatus()) { case RFLErrcode_Success: { break; @@ -960,7 +946,7 @@ RFLErrcode RFLiCacheHDBAsync(void* buffer) { manager->cachedDB = buffer; manager->cached = FALSE; RFLiClearCacheHDB(manager->cachedDB); - + return RFLiOpenAsync(RFLiFileType_Database, NAND_ACCESS_READ, openCacheCallback_); } diff --git a/libs/RVLFaceLib/src/RFL_Icon.c b/libs/RVLFaceLib/src/RFL_Icon.c index 5ec120f7..938c50f1 100644 --- a/libs/RVLFaceLib/src/RFL_Icon.c +++ b/libs/RVLFaceLib/src/RFL_Icon.c @@ -6,15 +6,18 @@ #include #include +// clang-format off #include #include +// clang-format on #include #include #include -RFLErrcode RFLMakeIcon(void* buf, RFLDataSource source, RFLMiddleDatabase* middleDB, u16 index, RFLExpression expression, const RFLIconSetting* setting) { +RFLErrcode RFLMakeIcon(void* buf, RFLDataSource source, RFLMiddleDatabase* middleDB, u16 index, RFLExpression expression, + const RFLIconSetting* setting) { RFLiCharInfo info; RFLErrcode err = RFLiPickupCharInfo(&info, source, middleDB, index); @@ -55,7 +58,7 @@ void RFLiMakeIcon(void* buf, const RFLiCharInfo* info, RFLExpression expression, RFLi_ASSERTLINE(setting->height >= 16 && setting->height <= 512, 101); { - RFLiCoordinateData iconCoordData = { 1, 2, 0, 0, 0, 0 }; + RFLiCoordinateData iconCoordData = {1, 2, 0, 0, 0, 0}; byteSize = (setting->width * setting->height) * 2; @@ -70,11 +73,9 @@ void RFLiMakeIcon(void* buf, const RFLiCharInfo* info, RFLExpression expression, if ((setting->width > 128 || setting->height > 128) && RFLiGetUseDeluxTex()) { resolution = RFLResolution_256; - } - else if (setting->width > 64 || setting->height > 64) { + } else if (setting->width > 64 || setting->height > 64) { resolution = RFLResolution_128; - } - else { + } else { resolution = RFLResolution_64; } @@ -93,12 +94,11 @@ void RFLiMakeIcon(void* buf, const RFLiCharInfo* info, RFLExpression expression, GXColor backColor; if (setting->bgType == RFLIconBG_Direct) { backColor = setting->bgColor; - } - else { + } else { backColor = RFLGetFavoriteColor(info->personal.favoriteColor); } backColor.a = 0; - + GXGetScissor(&scissorOffsetX, &scissorOffsetY, &scissorWidth, &scissorHeight); GXSetScissor(0, 0, setting->width, setting->height); @@ -118,8 +118,7 @@ void RFLiMakeIcon(void* buf, const RFLiCharInfo* info, RFLExpression expression, // TODO: Get the division to match. if (setting->width < setting->height) { fovy = 2 * (/*(180.0f / (f32)M_PI)*/ 57.2957801818848f * atan2f(43.2f / aspect, 500.0f)); - } - else { + } else { fovy = 2 * (/*(180.0f / (f32)M_PI)*/ 57.2957801818848f * atan2f(43.2f, 500.0f)); } @@ -128,11 +127,10 @@ void RFLiMakeIcon(void* buf, const RFLiCharInfo* info, RFLExpression expression, } { - RFLiPositionData cameraPos = (RFLiPositionData){0.0f, 34.5f, 600.0f}; RFLiPositionData target = (RFLiPositionData){0.0f, 34.5f, 0.0f}; RFLiPositionData cameraUp = (RFLiPositionData){0.0f, 1.0f, 0.0f}; - + MTXLookAt(viewMtx, (Vec*)&cameraPos, (Vec*)&cameraUp, (Vec*)&target); } @@ -190,14 +188,13 @@ void RFLiMakeIcon(void* buf, const RFLiCharInfo* info, RFLExpression expression, GXPixModeSync(); if (RFLiGetManager()->mDrawIconCB == NULL) { GXDrawDone(); - } - else { + } else { RFLiGetManager()->mDrawIconCB(); } #else GXDrawDone(); GXPixModeSync(); -#endif // RFL_BUILD +#endif // RFL_BUILD RFLiFree(modelBuf); @@ -211,4 +208,4 @@ void RFLiMakeIcon(void* buf, const RFLiCharInfo* info, RFLExpression expression, void RFLSetIconDrawDoneCallback(RFLSimpleCB cb) { RFLiGetManager()->mDrawIconCB = cb; } -#endif // RFL_BUILD +#endif // RFL_BUILD diff --git a/libs/RVLFaceLib/src/RFL_MakeRandomFace.c b/libs/RVLFaceLib/src/RFL_MakeRandomFace.c index e1bb2a19..e69f6aa8 100644 --- a/libs/RVLFaceLib/src/RFL_MakeRandomFace.c +++ b/libs/RVLFaceLib/src/RFL_MakeRandomFace.c @@ -12,7 +12,7 @@ #include -#define DEFAULT_NAME L"no name" +#define DEFAULT_NAME L"no name" #define GET_ARRAY_LENGTH(x) (sizeof((x)) / sizeof((x)[0])) @@ -28,12 +28,10 @@ void RFLi_MakeRandomFace(RFLiCharInfo* pCharInfo, RFLSex argSex, RFLAge argAge, if (argSex == RFLSex_All) { if (RFLi_GetRandU32(RFLSex_All) == RFLSex_Male) { sex = RFLi_SEX_MALE; - } - else { + } else { sex = RFLi_SEX_FEMALE; } - } - else { + } else { sex = (RFLi_SEX)argSex; } @@ -42,15 +40,12 @@ void RFLi_MakeRandomFace(RFLiCharInfo* pCharInfo, RFLSex argSex, RFLAge argAge, rand = RFLi_GetRandU32(10); if (rand < 4) { age = RFLi_AGE_CHILD; - } - else if (rand < 8) { + } else if (rand < 8) { age = RFLi_AGE_ADULT; - } - else { + } else { age = RFLi_AGE_ELDER; } - } - else { + } else { age = (RFLi_AGE)argAge; } @@ -72,11 +67,9 @@ void RFLi_MakeRandomFace(RFLiCharInfo* pCharInfo, RFLSex argSex, RFLAge argAge, rand = RFLi_GetRandU32(10); if (rand < 4) { race = RFLi_RACE_ASIAN; - } - else if (rand < 8) { + } else if (rand < 8) { race = RFLi_RACE_WHITE; - } - else { + } else { race = RFLi_RACE_BLACK; } break; @@ -119,8 +112,7 @@ void RFLi_MakeRandomFace_Core(RFLiCharInfo* pCharInfo, RFLi_SEX argSex, RFLi_AGE if (sex == RFLi_SEX_MALE) { pCharInfo->eye.rotate = 4; pCharInfo->eye.rotate += (RFLi_EYE_ROT_OFFSET[2] - RFLi_EYE_ROT_OFFSET[pCharInfo->eye.type]); - } - else { + } else { pCharInfo->eye.rotate = 3; pCharInfo->eye.rotate += (RFLi_EYE_ROT_OFFSET[4] - RFLi_EYE_ROT_OFFSET[pCharInfo->eye.type]); } @@ -135,8 +127,7 @@ void RFLi_MakeRandomFace_Core(RFLiCharInfo* pCharInfo, RFLi_SEX argSex, RFLi_AGE if (race == RFLi_RACE_ASIAN) { pCharInfo->eyebrow.y = yOffset + 9; pCharInfo->eyebrow.rotate += (RFLi_EYEBROW_ROT_OFFSET[6] - RFLi_EYEBROW_ROT_OFFSET[pCharInfo->eyebrow.type]); - } - else { + } else { pCharInfo->eyebrow.y = yOffset + 10; pCharInfo->eyebrow.rotate += (RFLi_EYEBROW_ROT_OFFSET[0] - RFLi_EYEBROW_ROT_OFFSET[pCharInfo->eyebrow.type]); } @@ -144,8 +135,7 @@ void RFLi_MakeRandomFace_Core(RFLiCharInfo* pCharInfo, RFLi_SEX argSex, RFLi_AGE pCharInfo->nose.type = RFLi_GetNoseType(sex, age, race); if (sex == RFLi_SEX_MALE) { pCharInfo->nose.scale = 4; - } - else { + } else { pCharInfo->nose.scale = 3; } pCharInfo->nose.y = yOffset + 9; @@ -153,8 +143,7 @@ void RFLi_MakeRandomFace_Core(RFLiCharInfo* pCharInfo, RFLi_SEX argSex, RFLi_AGE pCharInfo->mouth.type = RFLi_GetMouthType(sex, age, race); if (sex == RFLi_SEX_MALE) { pCharInfo->mouth.color = 0; - } - else { + } else { pCharInfo->mouth.color = RFLi_GetRandU32(RFLi_MOUTH_COLOR_MAX + 1); } pCharInfo->mouth.scale = 4; @@ -166,12 +155,10 @@ void RFLi_MakeRandomFace_Core(RFLiCharInfo* pCharInfo, RFLi_SEX argSex, RFLi_AGE if (r == 0) { pCharInfo->beard.mustache = 0; pCharInfo->beard.type = RFLi_GetRandU32(RFLi_BEARD_TYPE_MAX) + 1; - } - else if (r == 1) { + } else if (r == 1) { pCharInfo->beard.mustache = RFLi_GetRandU32(RFLi_BEARD_MUSTACHE_MAX) + 1; pCharInfo->beard.type = 0; - } - else if (r == 2) { + } else if (r == 2) { pCharInfo->beard.mustache = RFLi_GetRandU32(RFLi_BEARD_MUSTACHE_MAX) + 1; pCharInfo->beard.type = RFLi_GetRandU32(RFLi_BEARD_TYPE_MAX) + 1; } @@ -179,8 +166,7 @@ void RFLi_MakeRandomFace_Core(RFLiCharInfo* pCharInfo, RFLi_SEX argSex, RFLi_AGE pCharInfo->beard.color = pCharInfo->hair.color; pCharInfo->beard.scale = 4; pCharInfo->beard.y = 10; - } - else { + } else { pCharInfo->beard.mustache = 0; pCharInfo->beard.type = 0; pCharInfo->beard.color = 0; @@ -204,7 +190,7 @@ void RFLi_MakeRandomFace_Core(RFLiCharInfo* pCharInfo, RFLi_SEX argSex, RFLi_AGE for (i = 0; i < RFL_NAME_LENGTH + 1; i++) { pCharInfo->personal.name[i] = 0; } - wcsncpy((wchar_t*)pCharInfo->personal.name, (wchar_t*)DEFAULT_NAME, GET_ARRAY_LENGTH(DEFAULT_NAME)-1); + wcsncpy((wchar_t*)pCharInfo->personal.name, (wchar_t*)DEFAULT_NAME, GET_ARRAY_LENGTH(DEFAULT_NAME) - 1); for (i = 0; i < RFL_NAME_LENGTH + 1; i++) { pCharInfo->personal.creator[i] = 0; @@ -218,7 +204,8 @@ void RFLi_MakeRandomFace_Core(RFLiCharInfo* pCharInfo, RFLi_SEX argSex, RFLi_AGE pCharInfo->personal.localonly = FALSE; } -u8 RFLi_GetFacelineType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { +u8 RFLi_GetFacelineType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { + // clang-format off static const u8 facelineTypeTable[RFLSex_All * RFLAge_All * RFLRace_All][10] = { /* Male, Child, Black */ {0, 0, 0, 1, 1, 1, 2, 3, 4, 5}, /* Male, Child, White */ {0, 0, 0, 1, 1, 1, 2, 3, 4, 5}, @@ -240,15 +227,18 @@ u8 RFLi_GetFacelineType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { /* Female, Elder, White */ {0, 0, 0, 1, 1, 2, 2, 3, 4, 5}, /* Female, Elder, Asian */ {0, 0, 0, 1, 1, 2, 2, 3, 4, 5} }; + // clang-format on RFLi_ASSERTLINE_RANGE(sex, RFLSex_Male, RFLSex_All, 302); RFLi_ASSERTLINE_RANGE(age, RFLAge_Child, RFLAge_All, 303); RFLi_ASSERTLINE_RANGE(race, RFLRace_Black, RFLAge_All, 304); - return facelineTypeTable[(sex * (RFLAge_All * RFLRace_All)) + (age * RFLRace_All) + race] [RFLi_GetRandU32(GET_ARRAY_LENGTH(facelineTypeTable[0]))]; + return facelineTypeTable[(sex * (RFLAge_All * RFLRace_All)) + (age * RFLRace_All) + race] + [RFLi_GetRandU32(GET_ARRAY_LENGTH(facelineTypeTable[0]))]; } u8 RFLi_GetHairType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { + // clang-format off u8 hair_parts[RFLSex_All * RFLAge_All * RFLRace_All][72] = { /* Male, Child, Black */ {13, 23, 30, 31, 32, 33, 34, 35, 36, 37, 38, 40, 43, 44, 45, 47, 48, 49, 50, 51, 52, 54, 56, 57, 64, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Male, Child, White */ {13, 23, 30, 31, 32, 33, 34, 35, 36, 37, 38, 40, 43, 44, 45, 47, 48, 49, 50, 51, 52, 54, 56, 57, 64, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, @@ -270,8 +260,9 @@ u8 RFLi_GetHairType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { /* Female, Elder, White */ { 0, 1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 16, 17, 18, 20, 21, 24, 25, 58, 62, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Female, Elder, Asian */ { 0, 1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 16, 17, 18, 20, 21, 24, 25, 58, 62, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; + // clang-format on - u8 hair_parts_num[RFLSex_All * RFLAge_All * RFLRace_All] = { 26, 26, 26, 34, 34, 34, 16, 17, 17, 33, 33, 33, 37, 36, 36, 22, 22, 22 }; + u8 hair_parts_num[RFLSex_All * RFLAge_All * RFLRace_All] = {26, 26, 26, 34, 34, 34, 16, 17, 17, 33, 33, 33, 37, 36, 36, 22, 22, 22}; u8 index = (sex * (RFLAge_All * RFLRace_All)) + (age * RFLRace_All) + race; RFLi_ASSERTLINE_RANGE(sex, RFLSex_Male, RFLSex_All, 337); @@ -282,6 +273,7 @@ u8 RFLi_GetHairType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { } u8 RFLi_GetEyeType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { + // clang-format off u8 eye_parts[RFLSex_All * RFLAge_All * RFLRace_All][48] = { /* Male, Child, Black */ { 2, 3, 5, 7, 8, 9, 11, 12, 13, 15, 16, 18, 27, 29, 32, 34, 36, 38, 39, 41, 43, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Male, Child, White */ { 2, 3, 5, 7, 8, 9, 11, 12, 13, 15, 16, 18, 27, 29, 32, 34, 36, 38, 39, 41, 43, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, @@ -303,8 +295,9 @@ u8 RFLi_GetEyeType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { /* Female, Elder, White */ { 1, 2, 5, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 21, 32, 34, 37, 39, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Female, Elder, Asian */ { 1, 2, 5, 7, 8, 9, 11, 12, 13, 14, 15, 16, 18, 21, 26, 32, 34, 37, 39, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; + // clang-format on - u8 eye_parts_num[RFLSex_All * RFLAge_All * RFLRace_All] = { 22, 22, 23, 29, 29, 29, 24, 24, 24, 34, 34, 35, 40, 40, 40, 20, 20, 20 }; + u8 eye_parts_num[RFLSex_All * RFLAge_All * RFLRace_All] = {22, 22, 23, 29, 29, 29, 24, 24, 24, 34, 34, 35, 40, 40, 40, 20, 20, 20}; u8 index = (sex * (RFLAge_All * RFLRace_All)) + (age * RFLRace_All) + race; RFLi_ASSERTLINE_RANGE(sex, RFLSex_Male, RFLSex_All, 372); @@ -315,6 +308,7 @@ u8 RFLi_GetEyeType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { } u8 RFLi_GetEyebrowType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { + // clang-format off static const u8 eyebrow_parts[RFLSex_All * RFLAge_All * RFLRace_All][24] = { /* Male, Child, Black */ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 18, 20, 0, 0, 0, 0, 0, 0}, /* Male, Child, White */ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 18, 20, 0, 0, 0, 0, 0, 0}, @@ -336,9 +330,10 @@ u8 RFLi_GetEyebrowType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { /* Female, Elder, White */ { 0, 3, 7, 8, 9, 10, 11, 13, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Female, Elder, Asian */ { 0, 3, 7, 8, 9, 10, 11, 13, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, }; + // clang-format on - u8 eyebrow_parts_num[RFLSex_All * RFLAge_All * RFLRace_All] = { 18, 18, 18, 23, 23, 23, 21, 21, 21, 9, 9, 9, 11, 11, 11, 9, 9, 9 }; - u8 index =(sex * (RFLAge_All * RFLRace_All)) + (age * RFLRace_All) + race; + u8 eyebrow_parts_num[RFLSex_All * RFLAge_All * RFLRace_All] = {18, 18, 18, 23, 23, 23, 21, 21, 21, 9, 9, 9, 11, 11, 11, 9, 9, 9}; + u8 index = (sex * (RFLAge_All * RFLRace_All)) + (age * RFLRace_All) + race; RFLi_ASSERTLINE_RANGE(sex, RFLSex_Male, RFLSex_All, 407); RFLi_ASSERTLINE_RANGE(age, RFLAge_Child, RFLAge_All, 408); @@ -348,6 +343,7 @@ u8 RFLi_GetEyebrowType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { } u8 RFLi_GetNoseType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { + // clang-format off u8 nose_parts[RFLSex_All * RFLAge_All * RFLRace_All][12] = { /* Male, Child, Black */ { 0, 1, 2, 3, 4, 5, 7, 8, 10, 0, 0, 0}, /* Male, Child, White */ { 0, 1, 2, 3, 4, 5, 7, 8, 10, 0, 0, 0}, @@ -369,8 +365,9 @@ u8 RFLi_GetNoseType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { /* Female, Elder, White */ { 0, 1, 3, 4, 6, 8, 9, 10, 11, 0, 0, 0}, /* Female, Elder, Asian */ { 0, 1, 3, 4, 6, 8, 10, 11, 0, 0, 0, 0} }; + // clang-format on - u8 nose_parts_num[RFLSex_All * RFLAge_All * RFLRace_All] = { 9, 9, 9, 12, 12, 11, 12, 12, 11, 6, 6, 6, 9, 9, 8, 9, 9, 8 }; + u8 nose_parts_num[RFLSex_All * RFLAge_All * RFLRace_All] = {9, 9, 9, 12, 12, 11, 12, 12, 11, 6, 6, 6, 9, 9, 8, 9, 9, 8}; u8 index = (sex * (RFLAge_All * RFLRace_All)) + (age * RFLRace_All) + race; RFLi_ASSERTLINE_RANGE(sex, RFLSex_Male, RFLSex_All, 442); @@ -381,6 +378,7 @@ u8 RFLi_GetNoseType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { } u8 RFLi_GetMouthType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { + // clang-format off u8 mouth_parts[RFLSex_All * RFLAge_All * RFLRace_All][24] = { /* Male, Child, Black */ { 0, 2, 3, 6, 7, 8, 9, 10, 12, 14, 15, 17, 18, 19, 21, 22, 23, 0, 0, 0, 0, 0, 0, 0}, /* Male, Child, White */ { 0, 2, 3, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 21, 22, 23, 0, 0, 0, 0, 0}, @@ -402,8 +400,9 @@ u8 RFLi_GetMouthType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { /* Female, Elder, White */ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 0, 0, 0}, /* Female, Elder, Asian */ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 0, 0, 0} }; + // clang-format on - u8 mouth_parts_num[RFLSex_All * RFLAge_All * RFLRace_All] = { 17, 19, 19, 19, 21, 21, 19, 21, 21, 19, 20, 20, 19, 20, 20, 20, 21, 21 }; + u8 mouth_parts_num[RFLSex_All * RFLAge_All * RFLRace_All] = {17, 19, 19, 19, 21, 21, 19, 21, 21, 19, 20, 20, 19, 20, 20, 20, 21, 21}; u8 index = (sex * (RFLAge_All * RFLRace_All)) + (age * RFLRace_All) + race; RFLi_ASSERTLINE_RANGE(sex, RFLSex_Male, RFLSex_All, 477); @@ -414,6 +413,7 @@ u8 RFLi_GetMouthType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { } u8 RFLi_GetFaceTexType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { + // clang-format off static const u8 faceTexTypeTable[RFLSex_All * RFLAge_All * RFLRace_All][20] = { /* Male, Child, Black */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3}, /* Male, Child, White */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 8, 8}, @@ -435,12 +435,13 @@ u8 RFLi_GetFaceTexType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) { /* Female, Elder, White */ {10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11}, /* Female, Elder, Asian */ {10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11} }; + // clang-format on RFLi_ASSERTLINE_RANGE(sex, RFLSex_Male, RFLSex_All, 508); RFLi_ASSERTLINE_RANGE(age, RFLAge_Child, RFLAge_All, 509); RFLi_ASSERTLINE_RANGE(race, RFLRace_Black, RFLAge_All, 510); - return faceTexTypeTable[(sex * (RFLAge_All * RFLRace_All)) + (age * RFLRace_All) + race] [RFLi_GetRandU32(GET_ARRAY_LENGTH(faceTexTypeTable[0]))]; + return faceTexTypeTable[(sex * (RFLAge_All * RFLRace_All)) + (age * RFLRace_All) + race][RFLi_GetRandU32(GET_ARRAY_LENGTH(faceTexTypeTable[0]))]; } u8 RFLi_GetGlassType(RFLi_AGE age) { @@ -507,6 +508,7 @@ u8 RFLi_GetGlassType(RFLi_AGE age) { } u8 RFLi_GetFaceColor(RFLi_SEX sex, RFLi_RACE race) { + // clang-format off static const u8 faceColorTable[RFLSex_All * RFLRace_All][10] = { /* Male, Black */ { 2, 2, 4, 4, 4, 4, 5, 5, 5, 5 }, /* Male, White */ { 0, 0, 0, 0, 1, 1, 2, 3, 3, 3 }, @@ -516,14 +518,16 @@ u8 RFLi_GetFaceColor(RFLi_SEX sex, RFLi_RACE race) { /* Female, White */ { 0, 0, 0, 0, 0, 0, 0, 0, 1, 3 }, /* Female, Asian */ { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 } }; + // clang-format on RFLi_ASSERTLINE_RANGE(sex, RFLSex_Male, RFLSex_All, 563); RFLi_ASSERTLINE_RANGE(race, RFLRace_Black, RFLAge_All, 564); - return faceColorTable[(sex * RFLRace_All) + race] [RFLi_GetRandU32(GET_ARRAY_LENGTH(faceColorTable[0]))]; + return faceColorTable[(sex * RFLRace_All) + race][RFLi_GetRandU32(GET_ARRAY_LENGTH(faceColorTable[0]))]; } u8 RFLi_GetHairColor(RFLi_AGE age, RFLi_RACE race) { + // clang-format off static const u8 hairColorTable[RFLAge_All * RFLRace_All][20] = { /* Black, Child */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /* Black, Adult */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, @@ -535,19 +539,22 @@ u8 RFLi_GetHairColor(RFLi_AGE age, RFLi_RACE race) { /* Asian, Adult */ {0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3}, /* Asian, Elder */ {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4} }; + // clang-format on RFLi_ASSERTLINE_RANGE(age, RFLAge_Child, RFLAge_All, 584); RFLi_ASSERTLINE_RANGE(race, RFLRace_Black, RFLAge_All, 585); - return hairColorTable[(race * 4 - race) + age] [RFLi_GetRandU32(GET_ARRAY_LENGTH(hairColorTable[0]))]; + return hairColorTable[(race * 4 - race) + age][RFLi_GetRandU32(GET_ARRAY_LENGTH(hairColorTable[0]))]; } u8 RFLi_GetEyeColor(RFLi_RACE race) { + // clang-format off static const u8 eyeColorTable[RFLRace_All][10] = { /* Black */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, /* White */ {0, 1, 1, 2, 3, 3, 4, 4, 4, 5}, /* Asian */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 1} }; + // clang-format on RFLi_ASSERTLINE_RANGE(race, RFLRace_Black, RFLAge_All, 599); diff --git a/libs/RVLFaceLib/src/RFL_MakeTex.c b/libs/RVLFaceLib/src/RFL_MakeTex.c index 01e72264..7589af90 100644 --- a/libs/RVLFaceLib/src/RFL_MakeTex.c +++ b/libs/RVLFaceLib/src/RFL_MakeTex.c @@ -8,17 +8,19 @@ #include #include +// clang-format off #include #include +// clang-format on -#include -#include #include +#include +#include #include -#define TRANS_X_BASE 0.88961464f -#define TRANS_Y_BASE 0.9276675f +#define TRANS_X_BASE 0.88961464f +#define TRANS_Y_BASE 0.9276675f void RFLiSetupCopyTex(GXTexFmt texFmt, u16 width, u16 height, void* buf, GXColor clearColor) { RFLi_ASSERTLINE_NULL(buf, 36); @@ -38,7 +40,7 @@ void RFLiSetupCopyTex(GXTexFmt texFmt, u16 width, u16 height, void* buf, GXColor GXSetTexCopySrc(0, 0, width, height); GXSetTexCopyDst(width, height, texFmt, GX_FALSE); - GXSetCopyClear(clearColor, 0x1000000-1); + GXSetCopyClear(clearColor, 0x1000000 - 1); DCInvalidateRange(buf, 2 * width * height); GXCopyTex(buf, GX_TRUE); @@ -48,51 +50,51 @@ void RFLiSetupCopyTex(GXTexFmt texFmt, u16 width, u16 height, void* buf, GXColor // DEBUG NON MATCH (https://decomp.me/scratch/RSlZC) void RFLiMakeTexture(const RFLiCharInfo* pCharInfo /* r28 */, u8** texBuffer /* r29 */, RFLResolution resolution /* r27 */) { - int i; // r30 + int i; // r30 - RFLiCharInfo info[RFLExp_Max]; // r31+0xF78 - RFLiFaceData face[RFLExp_Max]; // r31+0x178 + RFLiCharInfo info[RFLExp_Max]; // r31+0xF78 + RFLiFaceData face[RFLExp_Max]; // r31+0x178 - u32 texSizeEye = RFLiGetTexSize(RFLiPartsTex_Eye, 0); // r31+0x100 - u32 texSizeEyebrow = RFLiGetTexSize(RFLiPartsTex_Eyebrow, 0); // r31+0xFC - u32 texSizeMouth = RFLiGetTexSize(RFLiPartsTex_Mouth, 0); // r31+0xF8 - u32 texSizeMustache = RFLiGetTexSize(RFLiPartsTex_Mustache, 0); // r31+0xF4 - u32 texSizeMole = RFLiGetTexSize(RFLiPartsTex_Mole, 0); // r31+0xF0 + u32 texSizeEye = RFLiGetTexSize(RFLiPartsTex_Eye, 0); // r31+0x100 + u32 texSizeEyebrow = RFLiGetTexSize(RFLiPartsTex_Eyebrow, 0); // r31+0xFC + u32 texSizeMouth = RFLiGetTexSize(RFLiPartsTex_Mouth, 0); // r31+0xF8 + u32 texSizeMustache = RFLiGetTexSize(RFLiPartsTex_Mustache, 0); // r31+0xF4 + u32 texSizeMole = RFLiGetTexSize(RFLiPartsTex_Mole, 0); // r31+0xF0 - u8* bufEyeNormal; // r31+0xEC - u8* bufEyeBNormal; // r31+0xE8 - u8* bufMouthNormal; // r31+0xE4 - u8* bufMustacheNormal; // r31+0xE0 - u8* bufMoleNormal; // r31+0xDC - u8* bufEyeSmile; // r31+0xD8 - u8* bufMouthAnger; // r31+0xD4 - u8* bufEyeSorrow; // r31+0xD0 - u8* bufMouthSorrow; // r31+0xCC - u8* bufEyeSurprise; // r31+0xC8 - u8* bufEyeBlink; // r31+0xC4 - u8* bufOpenMouth; // r31+0xC0 - u8** bufEye[RFLExp_Max]; // r31+0x158 - u8** bufMouth[RFLExp_Max]; // r31+0x13C + u8* bufEyeNormal; // r31+0xEC + u8* bufEyeBNormal; // r31+0xE8 + u8* bufMouthNormal; // r31+0xE4 + u8* bufMustacheNormal; // r31+0xE0 + u8* bufMoleNormal; // r31+0xDC + u8* bufEyeSmile; // r31+0xD8 + u8* bufMouthAnger; // r31+0xD4 + u8* bufEyeSorrow; // r31+0xD0 + u8* bufMouthSorrow; // r31+0xCC + u8* bufEyeSurprise; // r31+0xC8 + u8* bufEyeBlink; // r31+0xC4 + u8* bufOpenMouth; // r31+0xC0 + u8** bufEye[RFLExp_Max]; // r31+0x158 + u8** bufMouth[RFLExp_Max]; // r31+0x13C - RFLTexture* texEyeNormal; // r31+0xBC - RFLTexture* texEyeBNormal; // r31+0xB8 - RFLTexture* texMouthNormal; // r31+0xB4 - RFLTexture* texMustacheNormal; // r31+0xB0 - RFLTexture* texMoleNormal; // r31+0xAC - RFLTexture* texEyeSmile; // r31+0xA8 - RFLTexture* texMouthAnger; // r31+0xA4 - RFLTexture* texEyeSad; // r31+0xA0 - RFLTexture* texMouthSad; // r31+0x9C - RFLTexture* texEyeSurprise; // r31+0x98 - RFLTexture* texEyeBlink; // r31+0x94 - RFLTexture* texOpenMouth; // r31+0x90 - RFLTexture** texEye[RFLExp_Max]; // r31+0x120 - RFLTexture** texMouth[RFLExp_Max]; // r31+0x104 + RFLTexture* texEyeNormal; // r31+0xBC + RFLTexture* texEyeBNormal; // r31+0xB8 + RFLTexture* texMouthNormal; // r31+0xB4 + RFLTexture* texMustacheNormal; // r31+0xB0 + RFLTexture* texMoleNormal; // r31+0xAC + RFLTexture* texEyeSmile; // r31+0xA8 + RFLTexture* texMouthAnger; // r31+0xA4 + RFLTexture* texEyeSad; // r31+0xA0 + RFLTexture* texMouthSad; // r31+0x9C + RFLTexture* texEyeSurprise; // r31+0x98 + RFLTexture* texEyeBlink; // r31+0x94 + RFLTexture* texOpenMouth; // r31+0x90 + RFLTexture** texEye[RFLExp_Max]; // r31+0x120 + RFLTexture** texMouth[RFLExp_Max]; // r31+0x104 - u32 scissorOffsetX; // r31+0x8C - u32 scissorOffsetY; // r31+0x88 - u32 scissorWidth; // r31+0x84 - u32 scissorHeight; // r31+0x80 + u32 scissorOffsetX; // r31+0x8C + u32 scissorOffsetY; // r31+0x88 + u32 scissorWidth; // r31+0x84 + u32 scissorHeight; // r31+0x80 bufEyeNormal = NULL; bufEyeBNormal = NULL; @@ -106,7 +108,7 @@ void RFLiMakeTexture(const RFLiCharInfo* pCharInfo /* r28 */, u8** texBuffer /* bufEyeSurprise = NULL; bufEyeBlink = NULL; bufOpenMouth = NULL; - + bufEye[RFLExp_Normal] = &bufEyeNormal; bufEye[RFLExp_Smile] = &bufEyeSmile; bufEye[RFLExp_Anger] = &bufEyeNormal; @@ -135,7 +137,7 @@ void RFLiMakeTexture(const RFLiCharInfo* pCharInfo /* r28 */, u8** texBuffer /* texEyeSurprise = NULL; texEyeBlink = NULL; texOpenMouth = NULL; - + texEye[RFLExp_Normal] = &texEyeNormal; texEye[RFLExp_Smile] = &texEyeSmile; texEye[RFLExp_Anger] = &texEyeNormal; @@ -157,8 +159,8 @@ void RFLiMakeTexture(const RFLiCharInfo* pCharInfo /* r28 */, u8** texBuffer /* } if (texBuffer[RFLExp_Smile] != NULL) { - int changeEyeRot = 0; // r31+0x7C - RFLExpression exp = RFLExp_Smile; // r31+0x78 + int changeEyeRot = 0; // r31+0x7C + RFLExpression exp = RFLExp_Smile; // r31+0x78 info[exp] = *pCharInfo; info[exp].eye.type = 48; @@ -166,41 +168,35 @@ void RFLiMakeTexture(const RFLiCharInfo* pCharInfo /* r28 */, u8** texBuffer /* changeEyeRot = RFLi_EYE_ROT_OFFSET[pCharInfo->eye.type] - RFLi_EYE_ROT_OFFSET[info[exp].eye.type]; if (changeEyeRot + (int)info[exp].eye.rotate < 0) { info[exp].eye.rotate = 0; - } - else if (changeEyeRot + (int)info[exp].eye.rotate > RFLi_EYE_ROT_MAX) { + } else if (changeEyeRot + (int)info[exp].eye.rotate > RFLi_EYE_ROT_MAX) { info[exp].eye.rotate = RFLi_EYE_ROT_MAX; - } - else { + } else { info[exp].eye.rotate += changeEyeRot; } } if (texBuffer[RFLExp_Anger] != NULL) { - int changeEyebrowRot = 0; // r31+0x74 - int changeEyeRot = 0; // r31+0x70 - RFLExpression exp = RFLExp_Anger; // r31+0x6C + int changeEyebrowRot = 0; // r31+0x74 + int changeEyeRot = 0; // r31+0x70 + RFLExpression exp = RFLExp_Anger; // r31+0x6C info[exp] = *pCharInfo; changeEyebrowRot = 2; if (changeEyebrowRot + (int)info[exp].eyebrow.rotate < 0) { info[exp].eyebrow.rotate = 0; - } - else if (changeEyebrowRot + (int)info[exp].eyebrow.rotate > RFLi_EYEBROW_ROT_MAX) { + } else if (changeEyebrowRot + (int)info[exp].eyebrow.rotate > RFLi_EYEBROW_ROT_MAX) { info[exp].eyebrow.rotate = RFLi_EYEBROW_ROT_MAX; - } - else { + } else { info[exp].eyebrow.rotate += changeEyebrowRot; } changeEyeRot = 2; if (changeEyeRot + (int)info[exp].eye.rotate < 0) { info[exp].eye.rotate = 0; - } - else if (changeEyeRot + (int)info[exp].eye.rotate > RFLi_EYE_ROT_MAX) { + } else if (changeEyeRot + (int)info[exp].eye.rotate > RFLi_EYE_ROT_MAX) { info[exp].eye.rotate = RFLi_EYE_ROT_MAX; - } - else { + } else { info[exp].eye.rotate += changeEyeRot; } @@ -208,31 +204,27 @@ void RFLiMakeTexture(const RFLiCharInfo* pCharInfo /* r28 */, u8** texBuffer /* } if (texBuffer[RFLExp_Sorrow] != NULL) { - int changeEyebrowRot = 0; // r31+0x68 - int changeEyeRot = 0; // r31+0x64 - RFLExpression exp = RFLExp_Sorrow; // r31+0x60 + int changeEyebrowRot = 0; // r31+0x68 + int changeEyeRot = 0; // r31+0x64 + RFLExpression exp = RFLExp_Sorrow; // r31+0x60 info[exp] = *pCharInfo; changeEyebrowRot = -2; if (changeEyebrowRot + (int)info[exp].eyebrow.rotate < 0) { info[exp].eyebrow.rotate = 0; - } - else if (changeEyebrowRot + (int)info[exp].eyebrow.rotate > RFLi_EYEBROW_ROT_MAX) { + } else if (changeEyebrowRot + (int)info[exp].eyebrow.rotate > RFLi_EYEBROW_ROT_MAX) { info[exp].eyebrow.rotate = RFLi_EYEBROW_ROT_MAX; - } - else { + } else { info[exp].eyebrow.rotate += changeEyebrowRot; } changeEyeRot = -2; if (changeEyeRot + (int)info[exp].eye.rotate < 0) { info[exp].eye.rotate = 0; - } - else if (changeEyeRot + (int)info[exp].eye.rotate > RFLi_EYE_ROT_MAX) { + } else if (changeEyeRot + (int)info[exp].eye.rotate > RFLi_EYE_ROT_MAX) { info[exp].eye.rotate = RFLi_EYE_ROT_MAX; - } - else { + } else { info[exp].eye.rotate += changeEyeRot; } @@ -240,8 +232,8 @@ void RFLiMakeTexture(const RFLiCharInfo* pCharInfo /* r28 */, u8** texBuffer /* } if (texBuffer[RFLExp_Surprise] != NULL) { - int changeEyeRot = 0; // r31+0x5C - RFLExpression exp = RFLExp_Surprise; // r31+0x58 + int changeEyeRot = 0; // r31+0x5C + RFLExpression exp = RFLExp_Surprise; // r31+0x58 info[exp] = *pCharInfo; info[exp].eyebrow.y -= 2; @@ -250,8 +242,7 @@ void RFLiMakeTexture(const RFLiCharInfo* pCharInfo /* r28 */, u8** texBuffer /* changeEyeRot = RFLi_EYE_ROT_OFFSET[pCharInfo->eye.type] - RFLi_EYE_ROT_OFFSET[info[exp].eye.type]; if (changeEyeRot + (int)info[exp].eye.rotate < 0) { info[exp].eye.rotate = 0; - } - else if (changeEyeRot + (int)info[exp].eye.rotate > RFLi_EYE_ROT_MAX) { + } else if (changeEyeRot + (int)info[exp].eye.rotate > RFLi_EYE_ROT_MAX) { info[exp].eye.rotate = RFLi_EYE_ROT_MAX; } else { info[exp].eye.rotate += changeEyeRot; @@ -259,8 +250,8 @@ void RFLiMakeTexture(const RFLiCharInfo* pCharInfo /* r28 */, u8** texBuffer /* } if (texBuffer[RFLExp_Blink] != NULL) { - int changeEyeRot = 0; // r31+0x54 - RFLExpression exp = RFLExp_Blink; // r31+0x50 + int changeEyeRot = 0; // r31+0x54 + RFLExpression exp = RFLExp_Blink; // r31+0x50 info[exp] = *pCharInfo; info[exp].eye.type = 26; @@ -268,17 +259,15 @@ void RFLiMakeTexture(const RFLiCharInfo* pCharInfo /* r28 */, u8** texBuffer /* changeEyeRot = RFLi_EYE_ROT_OFFSET[pCharInfo->eye.type] - RFLi_EYE_ROT_OFFSET[info[exp].eye.type]; if (changeEyeRot + (int)info[exp].eye.rotate < 0) { info[exp].eye.rotate = 0; - } - else if (changeEyeRot + (int)info[exp].eye.rotate > RFLi_EYE_ROT_MAX) { + } else if (changeEyeRot + (int)info[exp].eye.rotate > RFLi_EYE_ROT_MAX) { info[exp].eye.rotate = RFLi_EYE_ROT_MAX; - } - else { + } else { info[exp].eye.rotate += changeEyeRot; } } if (texBuffer[RFLExp_OpenMouth] != NULL) { - RFLExpression exp = RFLExp_OpenMouth; // r31+0x4C + RFLExpression exp = RFLExp_OpenMouth; // r31+0x4C info[exp] = *pCharInfo; info[exp].mouth.type = 24; @@ -360,7 +349,7 @@ void RFLiMakeTexture(const RFLiCharInfo* pCharInfo /* r28 */, u8** texBuffer /* } { - RFLi_MASKRSL maxResolution = RFLiGetMaxMaskRsl(resolution); // r31+0x48 + RFLi_MASKRSL maxResolution = RFLiGetMaxMaskRsl(resolution); // r31+0x48 for (i = 0; i < RFLExp_Max; i++) { if (texBuffer[i] != NULL) { @@ -372,7 +361,7 @@ void RFLiMakeTexture(const RFLiCharInfo* pCharInfo /* r28 */, u8** texBuffer /* } { - u32 size = RFLiGetMaskBufSize(resolution); // r31+0x44 + u32 size = RFLiGetMaskBufSize(resolution); // r31+0x44 for (i = 0; i < RFLExp_Max; i++) { if (texBuffer[i] != NULL) { @@ -507,7 +496,8 @@ void RFLiInitRFLTexture(RFLTexObj* pRFLTexObj) { RFLTexture* pTexture = pRFLTexObj->texture; GXInitTexObj(&pRFLTexObj->tobj, RFLiGetTexImage(pTexture), pTexture->width, pTexture->height, pTexture->format, GX_CLAMP, GX_CLAMP, GX_FALSE); - GXInitTexObjLOD(&pRFLTexObj->tobj, pTexture->minFilter, pTexture->magFilter, pTexture->minLOD, pTexture->maxLOD, pTexture->LODBias, (GXBool)pTexture->enableBiasClamp, (GXBool)pTexture->enableEdgeLOD, pTexture->enableMaxAniso); + GXInitTexObjLOD(&pRFLTexObj->tobj, pTexture->minFilter, pTexture->magFilter, pTexture->minLOD, pTexture->maxLOD, pTexture->LODBias, + (GXBool)pTexture->enableBiasClamp, (GXBool)pTexture->enableEdgeLOD, pTexture->enableMaxAniso); } void RFLiSetup2DCameraAndParam() { @@ -615,15 +605,18 @@ void RFLiSetTev4Eye(u32 eyeColor, u32 eyeType) { GXSetTevAlphaOp(GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); switch (eyeType) { - case 9: + case 9: { color0 = (GXColor){255, 130, 0, 255}; break; - case 20: + } + case 20: { color0 = (GXColor){0, 255, 255, 255}; break; - default: + } + default: { color0 = (GXColor){0, 0, 0, 255}; break; + } } color1 = RFLi_EYE_COLOR1[eyeColor]; @@ -665,9 +658,9 @@ void RFLiSetTev4Mustache(u32 color) { } void RFLiSetFaceParts(const RFLiCharInfo* pCharInfo, RFLiFaceData* pFace, RFLi_MASKRSL resolution) { - #define SCALE2DIM(scale) (1.0 + UNIT_SCALE * (scale)) - #define ROT2ANG(rotate) (UNIT_ANGLE * ((rotate) % 32)) - #define UNIT(x) ((x) / 64.0f) +#define SCALE2DIM(scale) (1.0 + UNIT_SCALE * (scale)) +#define ROT2ANG(rotate) (UNIT_ANGLE * ((rotate) % 32)) +#define UNIT(x) ((x) / 64.0f) // UNUSED. not sure which function these are in static const f32 RATIO_X = 1.12408220767975f; @@ -789,10 +782,10 @@ void RFLiSetFaceParts(const RFLiCharInfo* pCharInfo, RFLiFaceData* pFace, RFLi_M pFace->mole.height = moleH * resolution_; pFace->mole.angle = 0.0f; pFace->mole.origin = RFL_ORIGIN_CENTER; - - #undef SCALE2DIM - #undef ROT2ANG - #undef UNIT + +#undef SCALE2DIM +#undef ROT2ANG +#undef UNIT } void RFLiCapture(u8* texBuffer, const RFLiCharInfo* pCharInfo, RFLiFaceData* pFace, RFLi_MASKRSL resolution) { @@ -854,8 +847,7 @@ void RFLiCapture(u8* texBuffer, const RFLiCharInfo* pCharInfo, RFLiFaceData* pFa #if RFL_BUILD >= 20080306 if (RFLiGetManager()->mCreateModelCB == NULL) { GXDrawDone(); - } - else { + } else { RFLiGetManager()->mCreateModelCB(); } #else @@ -917,7 +909,8 @@ void RFLiDrawQuad(f32 x, f32 y, f32 width, f32 height, f32 rotZ, RFLi_ORIGIN ori } } - GXBegin(GX_QUADS, GX_VTXFMT0, 4); { + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + { GXPosition2f32(1.0 + xOrigin, -0.5f); GXColor1u32(0x000000FF); GXTexCoord2s16(s0, 0); @@ -962,7 +955,6 @@ u32 RFLiGetMaskSize(RFLi_MASKRSL maskResolution) { return 2 * (maskResolution * maskResolution); } - u32 RFLiGetMaskBufSize(RFLResolution resolution) { u32 size = 0; diff --git a/libs/RVLFaceLib/src/RFL_MiddleDatabase.c b/libs/RVLFaceLib/src/RFL_MiddleDatabase.c index ecf6df51..90f6307a 100644 --- a/libs/RVLFaceLib/src/RFL_MiddleDatabase.c +++ b/libs/RVLFaceLib/src/RFL_MiddleDatabase.c @@ -14,28 +14,28 @@ u32 RFLGetMiddleDBBufferSize(u16 size) { } typedef struct { - u8 sex; // 0x00 - u8 age; // 0x01 - u8 race; // 0x02 - u8 padding; // 0x03 + u8 sex; // 0x00 + u8 age; // 0x01 + u8 race; // 0x02 + u8 padding; // 0x03 } RFL_RANDOM_PARAM; typedef struct { - s32 sex : 2; // 0x00 - s32 srcIdx : 15; // 0x00 - s32 dstIdx : 15; // 0x00 + s32 sex : 2; // 0x00 + s32 srcIdx : 15; // 0x00 + s32 dstIdx : 15; // 0x00 } RFL_NEW_OLD_PARAM; typedef struct { - u16 dstIdx; // 0x00 - u8 sex; // 0x02 - u8 padding; // 0x03 + u16 dstIdx; // 0x00 + u8 sex; // 0x02 + u8 padding; // 0x03 } RFL_HIDDEN_RANDOM_PARAM; typedef struct { - s16 lastSrcIdx; // 0x00 - u16 padding; // 0x02 -} RFL_DEST_PARAM; // I guess + s16 lastSrcIdx; // 0x00 + u16 padding; // 0x02 +} RFL_DEST_PARAM; // I guess void RFLInitMiddleDB(RFLMiddleDatabase* db, RFLMiddleDBType type, void* buffer, u16 size) { RFLiMiddleDatabase* idb = (RFLiMiddleDatabase*)db; @@ -113,7 +113,7 @@ static BOOL checkHiddenData_(RFLiHiddenCharData* data) { static void updateHDBcallback_(u32 arg) { RFLiMiddleDatabase* db = (RFLiMiddleDatabase*)arg; RFL_NEW_OLD_PARAM* param = (RFL_NEW_OLD_PARAM*)&db->userdata1; - + if (RFLGetAsyncStatus() == RFLErrcode_Success || RFLGetAsyncStatus() == RFLErrcode_Broken) { s16 src = -1; @@ -125,8 +125,7 @@ static void updateHDBcallback_(u32 arg) { #endif if (db->type == RFLMiddleDBType_HiddenOlder) { src = RFLiGetHiddenNext(param->srcIdx); - } - else { + } else { src = RFLiGetHiddenPrev(param->srcIdx); } #if RFL_BUILD >= 20080306 @@ -150,8 +149,7 @@ static void updateHDBcallback_(u32 arg) { if (err != RFLErrcode_Busy) { RFLiEndWorking(err); } - } - else { + } else { RFLiGetManager()->mLastErrcode = db->storedSize < db->size ? RFLErrcode_DBNodata : RFLErrcode_Success; } } @@ -177,16 +175,13 @@ static s16 stepOne_(s16 srcIdx, BOOL oldIsHead) { if (oldIsHead) { if (srcIdx < 0) { ret = RFLiGetHiddenHeader()->head; - } - else { + } else { ret = RFLiGetHiddenNext(srcIdx); } - } - else { + } else { if (srcIdx < 0) { ret = RFLiGetHiddenHeader()->tail; - } - else { + } else { ret = RFLiGetHiddenPrev(srcIdx); } } @@ -203,8 +198,7 @@ static void loadHiddenDataSync_(RFLiMiddleDatabase* db) { RFLiLoadCachedHiddenData(&db->data[db->storedSize], param->srcIdx); if (db->type == RFLMiddleDBType_HiddenOlder) { src = RFLiGetHiddenNext(param->srcIdx); - } - else { + } else { src = RFLiGetHiddenPrev(param->srcIdx); } @@ -216,8 +210,7 @@ static void loadHiddenDataSync_(RFLiMiddleDatabase* db) { if (src >= 0 && param->dstIdx < db->size) { param->srcIdx = (u16)src; - } - else { + } else { running = FALSE; } } @@ -261,9 +254,8 @@ static void updateHiddenOld_(RFLiMiddleDatabase* db, BOOL oldIsHead, BOOL use_ca if (use_cache) { loadHiddenDataSync_(db); return; - } - else { - RFLErrcode err = RFLiLoadHiddenDataAsync(&db->data[param->dstIdx], param->srcIdx, updateHDBcallback_, (u32)db); // r25 + } else { + RFLErrcode err = RFLiLoadHiddenDataAsync(&db->data[param->dstIdx], param->srcIdx, updateHDBcallback_, (u32)db); // r25 if (err != RFLErrcode_Busy) { RFLiEndWorking(err); } @@ -282,7 +274,7 @@ static void loadHiddenRandomSync_(RFLiMiddleDatabase* db) { while (running) { u32 src = *(u32*)&db->data[param->dstIdx]; if (src != 0) { - u16 srcIdx = src-1; + u16 srcIdx = src - 1; RFLiLoadCachedHiddenData(&db->data[db->storedSize], srcIdx); if (checkHiddenData_((RFLiHiddenCharData*)&db->data[db->storedSize])) { @@ -296,12 +288,10 @@ static void loadHiddenRandomSync_(RFLiMiddleDatabase* db) { if (src >= RFL_MAX_HIDDEN_DB) { running = FALSE; } - } - else { + } else { running = FALSE; } - } - else { + } else { running = FALSE; } } @@ -327,20 +317,18 @@ static void updateHDBRandcallback_(u32 arg) { RFLErrcode err; RFLi_ASSERTLINE_RANGE(*src, 0, RFL_MAX_HIDDEN_DB, 443); - + if (*src < RFL_MAX_HIDDEN_DB) { - u16 srcIdx = *src-1; + u16 srcIdx = *src - 1; err = RFLiLoadHiddenDataAsync(&db->data[db->storedSize], srcIdx, updateHDBRandcallback_, (u32)db); if (err != RFLErrcode_Busy) { RFLiEndWorking(err); } - } - else { + } else { RFLiGetManager()->mLastErrcode = RFLErrcode_Broken; } - } - else { + } else { RFLiGetManager()->mLastErrcode = db->storedSize < db->size ? RFLErrcode_DBNodata : RFLErrcode_Success; } } @@ -398,11 +386,11 @@ static void updateHiddenRandom_(RFLiMiddleDatabase* db, BOOL use_cache) { RFLi_ASSERTLINE(aidx == count, 514); - for (i = 0; i < (count-1); i++) { + for (i = 0; i < (count - 1); i++) { u16 tmp; u16 target; - target = (((rand >> 0x10) + rand) & 0xFFFF) % (count-1); + target = (((rand >> 0x10) + rand) & 0xFFFF) % (count - 1); if (target >= i) { target++; } @@ -432,13 +420,13 @@ static void updateHiddenRandom_(RFLiMiddleDatabase* db, BOOL use_cache) { return; } - srcIdx = *src-1; + srcIdx = *src - 1; if (use_cache) { loadHiddenRandomSync_(db); return; } - err = RFLiLoadHiddenDataAsync(&db->data[param->dstIdx], srcIdx, updateHDBRandcallback_, (u32)db); + err = RFLiLoadHiddenDataAsync(&db->data[param->dstIdx], srcIdx, updateHDBRandcallback_, (u32)db); if (err != RFLErrcode_Busy) { RFLiEndWorking(err); } @@ -477,7 +465,6 @@ static void updateRandom_(RFLiMiddleDatabase* db) { RFLiEndWorking(RFLErrcode_Success); } - static void startUpdateDB_(RFLiMiddleDatabase* db) { db->storedSize = 0; memset(db->data, 0, db->size * sizeof(RFLiHiddenCharData)); diff --git a/libs/RVLFaceLib/src/RFL_Model.c b/libs/RVLFaceLib/src/RFL_Model.c index 935a44bf..f06aa70d 100644 --- a/libs/RVLFaceLib/src/RFL_Model.c +++ b/libs/RVLFaceLib/src/RFL_Model.c @@ -6,35 +6,38 @@ #include #include +// clang-format off #include #include +// clang-format on -#include #include #include +#include #include #include #define GET_ARRAY_LENGTH(x) (sizeof((x)) / sizeof((x)[0])) -#define VTX_COORDS_IN_POS 3 -#define VTX_COORDS_IN_NRM 3 -#define VTX_COORDS_IN_TXC 2 +#define VTX_COORDS_IN_POS 3 +#define VTX_COORDS_IN_NRM 3 +#define VTX_COORDS_IN_TXC 2 -#define VTX_COORD_SIZE sizeof(s16) +#define VTX_COORD_SIZE sizeof(s16) -#define NUM_VTX_POS(size) ((size) / (VTX_COORD_SIZE * VTX_COORDS_IN_POS)) +#define NUM_VTX_POS(size) ((size) / (VTX_COORD_SIZE * VTX_COORDS_IN_POS)) #define SIZE_VTX_POS(count) (((count) * VTX_COORD_SIZE) * VTX_COORDS_IN_POS) -#define NUM_VTX_NRM(size) ((size) / (VTX_COORD_SIZE * VTX_COORDS_IN_NRM)) +#define NUM_VTX_NRM(size) ((size) / (VTX_COORD_SIZE * VTX_COORDS_IN_NRM)) #define SIZE_VTX_NRM(count) (((count) * VTX_COORD_SIZE) * VTX_COORDS_IN_NRM) -#define NUM_VTX_TXC(size) ((size) / (VTX_COORD_SIZE * VTX_COORDS_IN_TXC)) +#define NUM_VTX_TXC(size) ((size) / (VTX_COORD_SIZE * VTX_COORDS_IN_TXC)) #define SIZE_VTX_TXC(count) (((count) * VTX_COORD_SIZE) * VTX_COORDS_IN_TXC) RFLiCoordinateData coordinateData = {1, 2, 0, FALSE, FALSE, FALSE}; +// clang-format off const RFLDrawCoreSetting cDefaultDrawCoreSetting2Tev = { 1, GX_TEXCOORD0, GX_TEXMAP0, 2, GX_TEV_SWAP0, GX_KCOLOR0, GX_TEVPREV, GX_PNMTX0, GX_FALSE @@ -100,6 +103,8 @@ static const GXColor cFavoriteColor[RFLFavoriteColor_Max] = { {24, 24, 20, 255}, // RFLFavoriteColor_Black }; +// clang-format on + static const GXColor cWhite = {255, 255, 255, 255}; typedef union { @@ -110,13 +115,13 @@ typedef union { }; } RFL_COORDINATE; -#define RFL_COORD_TYPE_X 0x01000000 -#define RFL_COORD_TYPE_Y 0x00010000 -#define RFL_COORD_TYPE_Z 0x00000100 +#define RFL_COORD_TYPE_X 0x01000000 +#define RFL_COORD_TYPE_Y 0x00010000 +#define RFL_COORD_TYPE_Z 0x00000100 -#define RFL_COORD_TYPE_RX 0x11000000 -#define RFL_COORD_TYPE_RY 0x00110000 -#define RFL_COORD_TYPE_RZ 0x00001100 +#define RFL_COORD_TYPE_RX 0x11000000 +#define RFL_COORD_TYPE_RY 0x00110000 +#define RFL_COORD_TYPE_RZ 0x00001100 #define RFL_COORD_TYPE_RMSK 0x10101000 @@ -127,7 +132,7 @@ void RFLSetCoordinate(RFLCoordinate up, RFLCoordinate front) { RFL_COORDINATE f; RFL_COORDINATE r; - RFLi_ASSERTLINE_MSG((up & front) == 0, 148, "upとfrontが直交していません。"); // "Up and front are not perpendicular." + RFLi_ASSERTLINE_MSG((up & front) == 0, 148, "upとfrontが直交していません。"); // "Up and front are not perpendicular." u.coord = up; f.coord = front; @@ -141,33 +146,27 @@ void RFLSetCoordinate(RFLCoordinate up, RFLCoordinate front) { // Up if (up & RFL_COORD_TYPE_X) { coordinateData.uOff = 0; - } - else if (up & RFL_COORD_TYPE_Y) { + } else if (up & RFL_COORD_TYPE_Y) { coordinateData.uOff = 1; - } - else { + } else { coordinateData.uOff = 2; } // Front if (front & RFL_COORD_TYPE_X) { coordinateData.fOff = 0; - } - else if (front & RFL_COORD_TYPE_Y) { + } else if (front & RFL_COORD_TYPE_Y) { coordinateData.fOff = 1; - } - else { + } else { coordinateData.fOff = 2; } // Right if (right & RFL_COORD_TYPE_X) { coordinateData.rOff = 0; - } - else if (right & RFL_COORD_TYPE_Y) { + } else if (right & RFL_COORD_TYPE_Y) { coordinateData.rOff = 1; - } - else { + } else { coordinateData.rOff = 2; } @@ -199,12 +198,11 @@ u32 RFLGetModelBufferSize(RFLResolution resolution, u32 expressionFlag) { maskTexSize = RFLiGetMaskBufSize(resolution); - return OSRoundUp32B(expressionNum * sizeof(GXTexObj)) + - OSRoundUp32B(sizeof(RFLiCharModelRes)) + - OSRoundUp32B(maskTexSize * expressionNum); + return OSRoundUp32B(expressionNum * sizeof(GXTexObj)) + OSRoundUp32B(sizeof(RFLiCharModelRes)) + OSRoundUp32B(maskTexSize * expressionNum); } -RFLErrcode RFLInitCharModel(RFLCharModel* charModel, RFLDataSource source, RFLMiddleDatabase* middleDB, u16 index, void* bufferPtr, RFLResolution resolution, u32 expressionFlag) { +RFLErrcode RFLInitCharModel(RFLCharModel* charModel, RFLDataSource source, RFLMiddleDatabase* middleDB, u16 index, void* bufferPtr, + RFLResolution resolution, u32 expressionFlag) { RFLiCharInfo info; RFLErrcode err = RFLiPickupCharInfo(&info, source, middleDB, index); if (err == RFLErrcode_Success) { @@ -214,7 +212,7 @@ RFLErrcode RFLInitCharModel(RFLCharModel* charModel, RFLDataSource source, RFLMi return err; } -void RFLiInitCharModel(RFLCharModel* charModel, const RFLiCharInfo* info, void* bufferPtr, RFLResolution resolution, u32 expressionFlag) { +void RFLiInitCharModel(RFLCharModel* charModel, const RFLiCharInfo* info, void* bufferPtr, RFLResolution resolution, u32 expressionFlag) { RFLi_MASKRSL maxResolution; u32 maskTexSize; u8* maskTexBuffer[RFLExp_Max]; @@ -244,8 +242,7 @@ void RFLiInitCharModel(RFLCharModel* charModel, const RFLiCharInfo* info, void* if (expressionFlag & (1 << i)) { charModel_->maskTexObj[i] = (GXTexObj*)ptr8; ptr8 += 32; - } - else { + } else { charModel_->maskTexObj[i] = NULL; } } @@ -259,8 +256,7 @@ void RFLiInitCharModel(RFLCharModel* charModel, const RFLiCharInfo* info, void* if (expressionFlag & (1 << i)) { maskTexBuffer[i] = ptr8; ptr8 += maskTexSize; - } - else { + } else { maskTexBuffer[i] = NULL; } } @@ -301,8 +297,7 @@ void RFLiInitCharModel(RFLCharModel* charModel, const RFLiCharInfo* info, void* GXInitTexObj(charModel_->maskTexObj[i], maskTexBuffer[i], maxResolution, maxResolution, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, mipmap); if (mipmap) { GXInitTexObjLOD(charModel_->maskTexObj[i], GX_LIN_MIP_LIN, GX_LINEAR, 0.0f, max_lod, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1); - } - else { + } else { GXInitTexObjLOD(charModel_->maskTexObj[i], GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1); } @@ -414,8 +409,7 @@ void RFLLoadDrawSetting(const RFLDrawSetting* setting) { GXSetChanCtrl(GX_ALPHA0, GX_FALSE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); GXSetChanAmbColor(GX_COLOR0, setting->ambientColor); GXSetChanMatColor(GX_COLOR0, cWhite); - } - else { + } else { RFLLoadMaterialSetting(&cDefaultDrawCoreSetting1Tev); RFLLoadVertexSetting(&cDefaultDrawCoreSetting1Tev); GXSetNumChans(0); @@ -670,8 +664,10 @@ void RFLiInitCharModelRes(RFLiCharModelRes* charModelRes, const RFLiCharInfo* in arg.vtxPosBuf = charModelRes->vtxPosHair; arg.vtxNrmBuf = charModelRes->vtxNrmHair; arg.dlBuf = charModelRes->dlHair; - arg.vtxPosBufSize = NUM_VTX_POS(sizeof(charModelRes->vtxPosCap)) - (((u32)charModelRes->vtxPosHair - (u32)charModelRes->vtxPosCap) / VTX_COORD_SIZE) / VTX_COORDS_IN_POS; - arg.vtxNrmBufSize = NUM_VTX_POS(sizeof(charModelRes->vtxNrmCap)) - (((u32)charModelRes->vtxNrmHair - (u32)charModelRes->vtxNrmCap) / VTX_COORD_SIZE) / VTX_COORDS_IN_NRM; + arg.vtxPosBufSize = NUM_VTX_POS(sizeof(charModelRes->vtxPosCap)) - + (((u32)charModelRes->vtxPosHair - (u32)charModelRes->vtxPosCap) / VTX_COORD_SIZE) / VTX_COORDS_IN_POS; + arg.vtxNrmBufSize = NUM_VTX_POS(sizeof(charModelRes->vtxNrmCap)) - + (((u32)charModelRes->vtxNrmHair - (u32)charModelRes->vtxNrmCap) / VTX_COORD_SIZE) / VTX_COORDS_IN_NRM; arg.dlBufSize = sizeof(charModelRes->dlCap) - ((u32)charModelRes->dlHair - (u32)charModelRes->dlCap); arg.flipX = info->hair.flip; arg.transform = TRUE; @@ -695,8 +691,10 @@ void RFLiInitCharModelRes(RFLiCharModelRes* charModelRes, const RFLiCharInfo* in arg.vtxPosBuf = charModelRes->vtxPosForehead; arg.vtxNrmBuf = charModelRes->vtxNrmForehead; arg.dlBuf = charModelRes->dlForehead; - arg.vtxPosBufSize = NUM_VTX_POS(sizeof(charModelRes->vtxPosCap)) - (((u32)charModelRes->vtxPosForehead - (u32)charModelRes->vtxPosCap) / VTX_COORD_SIZE) / VTX_COORDS_IN_POS; - arg.vtxNrmBufSize = NUM_VTX_POS(sizeof(charModelRes->vtxNrmCap)) - (((u32)charModelRes->vtxNrmForehead - (u32)charModelRes->vtxNrmCap) / VTX_COORD_SIZE) / VTX_COORDS_IN_NRM; + arg.vtxPosBufSize = NUM_VTX_POS(sizeof(charModelRes->vtxPosCap)) - + (((u32)charModelRes->vtxPosForehead - (u32)charModelRes->vtxPosCap) / VTX_COORD_SIZE) / VTX_COORDS_IN_POS; + arg.vtxNrmBufSize = NUM_VTX_POS(sizeof(charModelRes->vtxNrmCap)) - + (((u32)charModelRes->vtxNrmForehead - (u32)charModelRes->vtxNrmCap) / VTX_COORD_SIZE) / VTX_COORDS_IN_NRM; arg.dlBufSize = sizeof(charModelRes->dlCap) - ((u32)charModelRes->dlForehead - (u32)charModelRes->dlCap); arg.flipX = info->hair.flip; arg.transform = TRUE; @@ -854,16 +852,16 @@ void RFLiInitCharModelRes(RFLiCharModelRes* charModelRes, const RFLiCharInfo* in charModelRes->colorIdxGlass = info->glass.color; charModelRes->colorIdxFavorite = info->personal.favoriteColor; - DCFlushRange(charModelRes, sizeof(RFLiCharModelRes)+0x10 /*?*/); + DCFlushRange(charModelRes, sizeof(RFLiCharModelRes) + 0x10 /*?*/); } // DEBUG NON MATCH (https://decomp.me/scratch/mQdEd) void RFLiInitShapeRes(RFLiCharShapeRes* arg /* r30 */) { - void* res; // r31+0xE8 - u8* ptr8; // r29 - BOOL skipTxc; // r31+0xE4 + void* res; // r31+0xE8 + u8* ptr8; // r29 + BOOL skipTxc; // r31+0xE4 - static const u32 csHeader[RFLiPartsShp_Max] = { 'nose', 'frhd', 'face', 'hair', 'cap_', 'berd', 'nsln', 'mask', 'glas' }; + static const u32 csHeader[RFLiPartsShp_Max] = {'nose', 'frhd', 'face', 'hair', 'cap_', 'berd', 'nsln', 'mask', 'glas'}; RFLi_ASSERTLINE_NULL(arg, 1261); RFLi_ASSERTLINE_NULL(arg->vtxPosBuf, 1262); @@ -871,9 +869,8 @@ void RFLiInitShapeRes(RFLiCharShapeRes* arg /* r30 */) { RFLi_ASSERTLINE_NULL(arg->dlBuf, 1264); RFLi_ASSERTLINE_ALIGN(arg->dlBuf, 32, 1265); - skipTxc = arg->parts == RFLiPartsShp_Nose || arg->parts == RFLiPartsShp_Forehead || - arg->parts == RFLiPartsShp_Hair || - arg->parts == RFLiPartsShp_Beard; + skipTxc = + arg->parts == RFLiPartsShp_Nose || arg->parts == RFLiPartsShp_Forehead || arg->parts == RFLiPartsShp_Hair || arg->parts == RFLiPartsShp_Beard; if (!skipTxc) { RFLi_ASSERTLINE_NULL(arg->vtxTxcBuf, 1273); @@ -884,22 +881,22 @@ void RFLiInitShapeRes(RFLiCharShapeRes* arg /* r30 */) { } { - u32 fileSize = RFLiGetShapeSize(arg->parts, arg->index); // r31+0xE0 + u32 fileSize = RFLiGetShapeSize(arg->parts, arg->index); // r31+0xE0 res = RFLiAlloc32(fileSize); RFLi_ASSERTLINE_NULL(res, 1287); } { - void* result = RFLiLoadShape(arg->parts, arg->index, res); // r31+0xDC - RFLi_ASSERTLINE_MSG(result, 1290, "ファイルの読み込みに失敗しました。"); // "Failed to read file." + void* result = RFLiLoadShape(arg->parts, arg->index, res); // r31+0xDC + RFLi_ASSERTLINE_MSG(result, 1290, "ファイルの読み込みに失敗しました。"); // "Failed to read file." } { u32 header; ptr8 = res; - header = *(u32*)ptr8; // r31+0xD8 - RFLi_ASSERTLINE_MSG(header == csHeader[arg->parts], 1304, "ヘッダとpartsが一致しません"); // "Header and "parts" do not match" + header = *(u32*)ptr8; // r31+0xD8 + RFLi_ASSERTLINE_MSG(header == csHeader[arg->parts], 1304, "ヘッダとpartsが一致しません"); // "Header and "parts" do not match" ptr8 += sizeof(header); } @@ -909,13 +906,16 @@ void RFLiInitShapeRes(RFLiCharShapeRes* arg /* r30 */) { RFLi_ASSERTLINE_NULL(arg->beardTrans, 1311); // Missing assert for arg->hairTrans? - memcpy(arg->noseTrans, ptr8, sizeof(RFLiPositionData)); ptr8 += sizeof(RFLiPositionData); - memcpy(arg->beardTrans, ptr8, sizeof(RFLiPositionData)); ptr8 += sizeof(RFLiPositionData); - memcpy(arg->hairTrans, ptr8, sizeof(RFLiPositionData)); ptr8 += sizeof(RFLiPositionData); + memcpy(arg->noseTrans, ptr8, sizeof(RFLiPositionData)); + ptr8 += sizeof(RFLiPositionData); + memcpy(arg->beardTrans, ptr8, sizeof(RFLiPositionData)); + ptr8 += sizeof(RFLiPositionData); + memcpy(arg->hairTrans, ptr8, sizeof(RFLiPositionData)); + ptr8 += sizeof(RFLiPositionData); } { - u16 size = *(u16*)ptr8; // r31+0xA + u16 size = *(u16*)ptr8; // r31+0xA if (size == 0) { arg->vtxPosSize = 0; arg->vtxNrmSize = 0; @@ -929,30 +929,30 @@ void RFLiInitShapeRes(RFLiCharShapeRes* arg /* r30 */) { } arg->vtxPosSize = *(u16*)ptr8; - RFLi_ASSERTLINE_MSG(arg->vtxPosSize <= arg->vtxPosBufSize, 1351, "vtxPosSize(%d) > vtxPosBufSize(%d) parts:%d index:%d", arg->vtxPosSize, arg->vtxPosBufSize, arg->parts, arg->index); + RFLi_ASSERTLINE_MSG(arg->vtxPosSize <= arg->vtxPosBufSize, 1351, "vtxPosSize(%d) > vtxPosBufSize(%d) parts:%d index:%d", arg->vtxPosSize, + arg->vtxPosBufSize, arg->parts, arg->index); ptr8 += sizeof(arg->vtxPosSize); { - u32 byteSize; // r31+0xD4 - s16* ptr16; // r31+0xD0 + u32 byteSize; // r31+0xD4 + s16* ptr16; // r31+0xD0 ptr16 = (s16*)ptr8; byteSize = SIZE_VTX_POS(arg->vtxPosSize); if (arg->transform) { - int i; // r31+0xCC - s32 s = 256.0f * arg->posScale; // r31+0xC8 - s32 tx = 256.0f * arg->posTrans->x; // r31+0xC4 - s32 ty = 256.0f * arg->posTrans->y; // r31+0xC0 - s32 tz = 256.0f * arg->posTrans->z; // r31+0xBC + int i; // r31+0xCC + s32 s = 256.0f * arg->posScale; // r31+0xC8 + s32 tx = 256.0f * arg->posTrans->x; // r31+0xC4 + s32 ty = 256.0f * arg->posTrans->y; // r31+0xC0 + s32 tz = 256.0f * arg->posTrans->z; // r31+0xBC for (i = 0; i < arg->vtxPosSize; i++) { - s16 temp[3]; // r31+0xFC + s16 temp[3]; // r31+0xFC if (arg->flipX) { temp[0] = tx + ((-ptr16[0] * s) >> 8); - } - else { + } else { temp[0] = tx + ((ptr16[0] * s) >> 8); } @@ -962,24 +962,22 @@ void RFLiInitShapeRes(RFLiCharShapeRes* arg /* r30 */) { RFLiTransformCoordinate(&arg->vtxPosBuf[i * VTX_COORDS_IN_POS], temp); ptr16 += VTX_COORDS_IN_POS; } - } - else if (arg->flipX) { - int i; // r31+0xB8 + } else if (arg->flipX) { + int i; // r31+0xB8 for (i = 0; i < arg->vtxPosSize; i++) { - s16 temp[3]; // r31+0xF4 - + s16 temp[3]; // r31+0xF4 + temp[0] = -ptr16[0]; - temp[1] = ptr16[1]; - temp[2] = ptr16[2]; + temp[1] = ptr16[1]; + temp[2] = ptr16[2]; RFLiTransformCoordinate(&arg->vtxPosBuf[i * VTX_COORDS_IN_POS], temp); ptr16 += VTX_COORDS_IN_POS; } - } - else { - int i; // r31+0xB4 - + } else { + int i; // r31+0xB4 + for (i = 0; i < arg->vtxPosSize; i++) { RFLiTransformCoordinate(&arg->vtxPosBuf[i * VTX_COORDS_IN_POS], ptr16); ptr16 += VTX_COORDS_IN_POS; @@ -990,32 +988,32 @@ void RFLiInitShapeRes(RFLiCharShapeRes* arg /* r30 */) { } arg->vtxNrmSize = *(u16*)ptr8; - RFLi_ASSERTLINE_MSG(arg->vtxNrmSize <= arg->vtxNrmBufSize, 1415, "vtxNrmSize(%d) > vtxNrmBufSize(%d) parts:%d index:%d", arg->vtxNrmSize, arg->vtxNrmBufSize, arg->parts, arg->index); + RFLi_ASSERTLINE_MSG(arg->vtxNrmSize <= arg->vtxNrmBufSize, 1415, "vtxNrmSize(%d) > vtxNrmBufSize(%d) parts:%d index:%d", arg->vtxNrmSize, + arg->vtxNrmBufSize, arg->parts, arg->index); ptr8 += sizeof(u16); { - u32 byteSize; // r31+0xB0 - s16* ptr16; // r31+0xAC + u32 byteSize; // r31+0xB0 + s16* ptr16; // r31+0xAC ptr16 = (s16*)ptr8; byteSize = SIZE_VTX_NRM(arg->vtxNrmSize); - + if (arg->flipX) { - int i; // r31+0xA8 + int i; // r31+0xA8 for (i = 0; i < arg->vtxNrmSize; i++) { - s16 temp[3]; // r31+0xEC + s16 temp[3]; // r31+0xEC temp[0] = -ptr16[0]; - temp[1] = ptr16[1]; - temp[2] = ptr16[2]; + temp[1] = ptr16[1]; + temp[2] = ptr16[2]; RFLiTransformCoordinate(&arg->vtxNrmBuf[i * VTX_COORDS_IN_NRM], temp); ptr16 += VTX_COORDS_IN_NRM; } - } - else { - int i; // r31+0xA4 + } else { + int i; // r31+0xA4 for (i = 0; i < arg->vtxNrmSize; i++) { RFLiTransformCoordinate(&arg->vtxNrmBuf[i * VTX_COORDS_IN_NRM], ptr16); ptr16 += VTX_COORDS_IN_NRM; @@ -1026,14 +1024,14 @@ void RFLiInitShapeRes(RFLiCharShapeRes* arg /* r30 */) { } { - u32 byteSize; // r31+0xA0 + u32 byteSize; // r31+0xA0 if (skipTxc) { arg->vtxTxcSize = 0; - } - else { + } else { arg->vtxTxcSize = *(u16*)ptr8; - RFLi_ASSERTLINE_MSG(arg->vtxTxcSize <= arg->vtxTxcBufSize, 1460, "vtxTxcSize(%d) > vtxTxcBufSize(%d) parts:%d index:%d", arg->vtxTxcSize, arg->vtxTxcBufSize, arg->parts, arg->index); + RFLi_ASSERTLINE_MSG(arg->vtxTxcSize <= arg->vtxTxcBufSize, 1460, "vtxTxcSize(%d) > vtxTxcBufSize(%d) parts:%d index:%d", arg->vtxTxcSize, + arg->vtxTxcBufSize, arg->parts, arg->index); ptr8 += sizeof(u16); byteSize = SIZE_VTX_TXC(arg->vtxTxcSize); @@ -1043,17 +1041,18 @@ void RFLiInitShapeRes(RFLiCharShapeRes* arg /* r30 */) { } { - int primitiveNum = *ptr8++; // r31+0x9C - int i, j; // r31+0x94 + int primitiveNum = *ptr8++; // r31+0x9C + int i, j; // r31+0x94 DCInvalidateRange(arg->dlBuf, arg->dlBufSize); GXBeginDisplayList(arg->dlBuf, arg->dlBufSize); for (i = 0; i < primitiveNum; i++) { - u16 vtxNum = *ptr8++; // r31+0x8 - GXPrimitive prim = *ptr8++; // r31+0x90 + u16 vtxNum = *ptr8++; // r31+0x8 + GXPrimitive prim = *ptr8++; // r31+0x90 - GXBegin(prim, GX_VTXFMT0, vtxNum); { + GXBegin(prim, GX_VTXFMT0, vtxNum); + { for (j = 0; j < vtxNum; j++) { GXPosition1x8(*ptr8++); GXNormal1x8(*ptr8++); @@ -1087,7 +1086,7 @@ void RFLiInitTexRes(GXTexObj* texObj, RFLiPartsShpTex parts, u16 index, void* bu { void* result = RFLiLoadShpTexture(parts, index, res); - RFLi_ASSERTLINE_MSG(result, 1537, "ファイルの読み込みに失敗しました。"); // "Failed to read file." + RFLi_ASSERTLINE_MSG(result, 1537, "ファイルの読み込みに失敗しました。"); // "Failed to read file." } switch (parts) { @@ -1108,7 +1107,7 @@ void RFLiInitTexRes(GXTexObj* texObj, RFLiPartsShpTex parts, u16 index, void* bu break; } default: { - RFLi_ASSERTLINE_MSG(FALSE, 1558, "無効なパーツの種類です。"); // "Invalid part type." + RFLi_ASSERTLINE_MSG(FALSE, 1558, "無効なパーツの種類です。"); // "Invalid part type." break; } } @@ -1239,21 +1238,19 @@ void RFLCopyCharModel(RFLCharModel* dstCharModel, void* dstBufferPtr, const RFLC memcpy(dstModel->resource, srcModel->resource, OSRoundUp32B(sizeof(RFLiCharModelRes))); - #define COPY_TEX(texObj, tex) \ - { \ - const GXTexObj* srcTex = &srcRes->texObj; \ - GXInitTexObj(&dstRes->texObj, dstRes->tex, GXGetTexObjWidth(srcTex), \ - GXGetTexObjHeight(srcTex), \ - GXGetTexObjFmt(srcTex), \ - GXGetTexObjWrapS(srcTex), \ - GXGetTexObjWrapT(srcTex), \ - GX_FALSE); \ - GXInitTexObjLOD(&dstRes->texObj, GX_LINEAR, GX_LINEAR, 0, 0, 0, GX_FALSE, GX_FALSE, GX_ANISO_1); \ +#define COPY_TEX(texObj, tex) \ + { \ + const GXTexObj* srcTex = &srcRes->texObj; \ + GXInitTexObj(&dstRes->texObj, dstRes->tex, GXGetTexObjWidth(srcTex), GXGetTexObjHeight(srcTex), GXGetTexObjFmt(srcTex), \ + GXGetTexObjWrapS(srcTex), GXGetTexObjWrapT(srcTex), GX_FALSE); \ + GXInitTexObjLOD(&dstRes->texObj, GX_LINEAR, GX_LINEAR, 0, 0, 0, GX_FALSE, GX_FALSE, GX_ANISO_1); \ } COPY_TEX(texObjFaceline, texFaceline); - if (dstRes->dlSizeCap != 0) COPY_TEX(texObjCap, texCap); - if (dstRes->dlSizeNoseline != 0) COPY_TEX(texObjNoseline, texNoseline); + if (dstRes->dlSizeCap != 0) + COPY_TEX(texObjCap, texCap); + if (dstRes->dlSizeNoseline != 0) + COPY_TEX(texObjNoseline, texNoseline); COPY_TEX(texObjGlass, texGlass); dstRes->vtxPosHair = (s16*)((u32)dstRes + ((u32)srcRes->vtxPosHair - (u32)srcRes)); @@ -1263,7 +1260,7 @@ void RFLCopyCharModel(RFLCharModel* dstCharModel, void* dstBufferPtr, const RFLC dstRes->vtxPosForehead = (s16*)((u32)dstRes + ((u32)srcRes->vtxPosForehead - (u32)srcRes)); dstRes->vtxNrmForehead = (s16*)((u32)dstRes + ((u32)srcRes->vtxNrmForehead - (u32)srcRes)); dstRes->dlForehead = (u8*)((u32)dstRes + ((u32)srcRes->dlForehead - (u32)srcRes)); - + DCFlushRangeNoSync(dstRes, OSRoundUp32B(sizeof(*dstRes))); { @@ -1309,15 +1306,13 @@ void RFLCopyCharModel(RFLCharModel* dstCharModel, void* dstBufferPtr, const RFLC DCFlushRangeNoSync(dstTexImg, maskTexSize); GXInitTexObj(dstModel->maskTexObj[i], dstTexImg, maxResolution, maxResolution, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, mipmap); - + if (mipmap) { GXInitTexObjLOD(dstModel->maskTexObj[i], GX_LIN_MIP_LIN, GX_LINEAR, 0, max_lod, 0, GX_FALSE, GX_FALSE, GX_ANISO_1); - } - else { + } else { GXInitTexObjLOD(dstModel->maskTexObj[i], GX_LINEAR, GX_LINEAR, 0, 0, 0, GX_FALSE, GX_FALSE, GX_ANISO_1); } - } - else { + } else { dstModel->maskTexObj[i] = NULL; } } diff --git a/libs/RVLFaceLib/src/RFL_NANDAccess.c b/libs/RVLFaceLib/src/RFL_NANDAccess.c index 2f6d5818..74c8809e 100644 --- a/libs/RVLFaceLib/src/RFL_NANDAccess.c +++ b/libs/RVLFaceLib/src/RFL_NANDAccess.c @@ -5,25 +5,25 @@ #include -#include -#include #include +#include +#include #include -#define RFLi_SAFE_BUFFER_SIZE 0x2000 +#define RFLi_SAFE_BUFFER_SIZE 0x2000 static const char* scFileNames[RFLiFileType_Max] = { - "/shared2/menu/FaceLib/RFL_DB.dat", // DATABASE - "/shared2/menu/FaceLib/RFL_Res.dat" // RESOURCE + "/shared2/menu/FaceLib/RFL_DB.dat", // DATABASE + "/shared2/menu/FaceLib/RFL_Res.dat" // RESOURCE }; static const u8 scFilePermissions[RFLiFileType_Max] = { - NAND_PERM_ALL_RW, // DATABASE - NAND_PERM_ALL_READ // RESOURCE + NAND_PERM_ALL_RW, // DATABASE + NAND_PERM_ALL_READ // RESOURCE }; static const u8 scFileAttributes[RFLiFileType_Max] = { - 0, // DATABASE - 0 // RESOURCE + 0, // DATABASE + 0 // RESOURCE }; static const char* scFirstDirectory = "/shared2/menu"; @@ -61,7 +61,7 @@ BOOL RFLiIsWorking() { void RFLiStartWorking() { BOOL b; RFLi_ASSERTLINE(RFLAvailable(), 170); - + b = OSDisableInterrupts(); RFLiSetWorking(TRUE); @@ -93,9 +93,8 @@ static void endWorkingCloseReason_(RFLErrcode errcode, s32 reason) { RFLiSetWorking(FALSE); if (errcode == RFLErrcode_Success) { RFLiGetManager()->mLastErrcode = RFLiGetManager()->mBeforeCloseErr; - RFLiGetManager()->mLastReason = RFLiGetManager()->mBeforeCloseErr; // @BUG Should be mBeforeCloseReason - } - else { + RFLiGetManager()->mLastReason = RFLiGetManager()->mBeforeCloseErr; // @BUG Should be mBeforeCloseReason + } else { RFLiGetManager()->mLastErrcode = errcode; RFLiGetManager()->mLastReason = reason; } @@ -113,7 +112,7 @@ void RFLiEndWorkingReason(RFLErrcode errcode, s32 reason) { switch (RFLiGetManager()->mLastErrcode) { default: { - (void)0; // match hack + (void)0; // match hack break; } case RFLErrcode_Busy: @@ -200,8 +199,7 @@ static void retry_(RFLiFileType type, RFLSimpleCBArg cb, u8 count) { OSCancelAlarm(&info->alarm); OSSetAlarmUserData(&info->alarm, &info->alarmdata); OSSetAlarm(&info->alarm, OSMillisecondsToTicks(50), (OSAlarmHandler)alarmCallback_); - } - else { + } else { RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, NAND_RESULT_BUSY); } } @@ -235,10 +233,10 @@ static void opencallback_(s32 result, NANDCommandBlock* block) { info->opened = FALSE; if (info->openinfo.openmode == NAND_ACCESS_READ) { RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, result); - } - else { + } else { NANDCommandBlock* block = RFLiSetCommandBlock(type, RFLiAsyncTag_CreateAsync); - s32 create = NANDPrivateCreateAsync(info->openinfo.filename, info->openinfo.permission, info->openinfo.attribute, createcallback_, block); + s32 create = + NANDPrivateCreateAsync(info->openinfo.filename, info->openinfo.permission, info->openinfo.attribute, createcallback_, block); switch (create) { case NAND_RESULT_OK: { callCB = FALSE; @@ -282,7 +280,8 @@ static void createcallback_(s32 result, NANDCommandBlock* block) { block2 = RFLiSetCommandBlock(type, RFLiAsyncTag_OpenAsync); memset(info->safeBuffer, 0, RFLi_SAFE_BUFFER_SIZE); - open = NANDPrivateSafeOpenAsync(info->openinfo.filename, RFLiGetWorkingFile(type), info->openinfo.openmode, info->safeBuffer, RFLi_SAFE_BUFFER_SIZE, opencallback_, block2); + open = NANDPrivateSafeOpenAsync(info->openinfo.filename, RFLiGetWorkingFile(type), info->openinfo.openmode, info->safeBuffer, + RFLi_SAFE_BUFFER_SIZE, opencallback_, block2); switch (open) { case NAND_RESULT_OK: { callCB = FALSE; @@ -304,7 +303,7 @@ static void createcallback_(s32 result, NANDCommandBlock* block) { break; } } - (void)0; // Matching hack + (void)0; // Matching hack break; } case NAND_RESULT_MAXFILES: @@ -342,7 +341,8 @@ static void close2opencallback_(s32 result, NANDCommandBlock* block) { block2 = RFLiSetCommandBlock(type, RFLiAsyncTag_OpenAsync); memset(info->safeBuffer, 0, RFLi_SAFE_BUFFER_SIZE); - open = NANDPrivateSafeOpenAsync(info->openinfo.filename, RFLiGetWorkingFile(type), info->openinfo.openmode, info->safeBuffer, RFLi_SAFE_BUFFER_SIZE, opencallback_, block2); + open = NANDPrivateSafeOpenAsync(info->openinfo.filename, RFLiGetWorkingFile(type), info->openinfo.openmode, info->safeBuffer, + RFLi_SAFE_BUFFER_SIZE, opencallback_, block2); switch (open) { case NAND_RESULT_OK: { callCB = FALSE; @@ -364,7 +364,7 @@ static void close2opencallback_(s32 result, NANDCommandBlock* block) { break; } } - (void)0; // Hack match + (void)0; // Hack match break; } case NAND_RESULT_MAXFILES: @@ -394,7 +394,7 @@ RFLErrcode RFLiOpenAsync(RFLiFileType type, u8 openmode, RFLSimpleCB cb) { RFLiNANDAccessInfo* info; const char* filename; NANDCommandBlock* block; - + RFLi_ASSERTLINE_RANGE(type, RFLiFileType_Database, RFLiFileType_Max, 706); fileinfo = RFLiGetWorkingFile(type); @@ -430,8 +430,7 @@ RFLErrcode RFLiOpenAsync(RFLiFileType type, u8 openmode, RFLSimpleCB cb) { break; } } - } - else { + } else { s32 open; memset(info->safeBuffer, 0, RFLi_SAFE_BUFFER_SIZE); @@ -443,8 +442,7 @@ RFLErrcode RFLiOpenAsync(RFLiFileType type, u8 openmode, RFLSimpleCB cb) { case NAND_RESULT_NOEXISTS: { if (openmode == NAND_ACCESS_READ) { RFLiEndWorkingReason(RFLErrcode_NANDCommandfail, open); - } - else { + } else { NANDCommandBlock* block; s32 create; @@ -493,16 +491,13 @@ static void readcallback_(s32 result, NANDCommandBlock* block) { clear = TRUE; RFLiEndWorking(RFLErrcode_Loadfail); - } - else if (result == info->readinfo.size) { + } else if (result == info->readinfo.size) { RFLiEndWorking(RFLErrcode_Success); - } - else { + } else { clear = TRUE; RFLiEndWorking(RFLErrcode_Loadfail); } - } - else { + } else { clear = TRUE; switch (result) { case NAND_RESULT_ACCESS: @@ -540,7 +535,7 @@ static void readseekcallback_(s32 result, NANDCommandBlock* block) { BOOL callCB = TRUE; if (result == info->readinfo.offset) { - NANDCommandBlock * block; + NANDCommandBlock* block; s32 read; block = RFLiSetCommandBlock(type, RFLiAsyncTag_ReadAsync); @@ -567,11 +562,9 @@ static void readseekcallback_(s32 result, NANDCommandBlock* block) { break; } } - } - else if (result >= NAND_RESULT_OK) { + } else if (result >= NAND_RESULT_OK) { RFLiEndWorking(RFLErrcode_Loadfail); - } - else { + } else { switch (result) { case NAND_RESULT_BUSY: case NAND_RESULT_ALLOC_FAILED: @@ -677,11 +670,9 @@ static void writecallback_(s32 result, NANDCommandBlock* block) { if (result == info->writeinfo.size) { RFLiEndWorking(RFLErrcode_Success); - } - else if (result >= NAND_RESULT_OK) { + } else if (result >= NAND_RESULT_OK) { RFLiEndWorking(RFLErrcode_Savefail); - } - else { + } else { switch (result) { case NAND_RESULT_MAXBLOCKS: case NAND_RESULT_CORRUPT: @@ -785,11 +776,9 @@ static void writeseekcallback_(s32 result, NANDCommandBlock* block) { if (RFLiIsWorking()) { callCB = FALSE; } - } - else if (result >= NAND_RESULT_OK) { + } else if (result >= NAND_RESULT_OK) { RFLiEndWorking(RFLErrcode_Savefail); - } - else { + } else { switch (result) { case NAND_RESULT_BUSY: case NAND_RESULT_ALLOC_FAILED: { @@ -815,7 +804,6 @@ static void writeseekcallback_(s32 result, NANDCommandBlock* block) { } } - RFLErrcode RFLiWriteAsync(RFLiFileType type, void* src, u32 size, RFLSimpleCB cb, s32 seek_ofs) { NANDFileInfo* fileinfo; RFLiNANDAccessInfo* info; @@ -837,7 +825,7 @@ RFLErrcode RFLiWriteAsync(RFLiFileType type, void* src, u32 size, RFLSimpleCB cb { NANDCommandBlock* block = RFLiSetCommandBlock(type, RFLiAsyncTag_SeekAsync); s32 seek = NANDSeekAsync(fileinfo, seek_ofs, NAND_SEEK_BEG, writeseekcallback_, block); - + switch (seek) { case NAND_RESULT_OK: { break; @@ -934,7 +922,7 @@ RFLErrcode RFLiCloseAsync(RFLiFileType type, RFLSimpleCB cb) { } } } - + return RFLGetAsyncStatus(); } @@ -969,7 +957,7 @@ static void getlengthcallback_(s32 result, NANDCommandBlock* block) { RFLErrcode RFLiGetLengthAsync(RFLiFileType type, u32* dst, RFLSimpleCB cb) { RFLiNANDAccessInfo* info; - + RFLi_ASSERTLINE_RANGE(type, RFLiFileType_Database, RFLiFileType_Max, 1576); info = RFLiGetAccInfo(type); @@ -979,7 +967,7 @@ RFLErrcode RFLiGetLengthAsync(RFLiFileType type, u32* dst, RFLSimpleCB cb) { { NANDCommandBlock* block = RFLiSetCommandBlock(type, RFLiAsyncTag_GetlengthAsync); s32 getlength = NANDGetLengthAsync(RFLiGetWorkingFile(type), dst, getlengthcallback_, block); - + switch (getlength) { case NAND_RESULT_OK: { break; @@ -1042,7 +1030,7 @@ RFLErrcode RFLiDeleteAsync(RFLiFileType type, RFLSimpleCB cb) { info = RFLiGetAccInfo(type); RFLiStartWorking(); - + info->callback = cb; { diff --git a/libs/RVLFaceLib/src/RFL_NANDLoader.c b/libs/RVLFaceLib/src/RFL_NANDLoader.c index a47069b1..f9d81928 100644 --- a/libs/RVLFaceLib/src/RFL_NANDLoader.c +++ b/libs/RVLFaceLib/src/RFL_NANDLoader.c @@ -5,9 +5,9 @@ #include -#include #include #include +#include #include @@ -58,7 +58,7 @@ static void parseOnmemoryRes_() { u16* head; offset2 = loader->mCacheBuffer; - offset2 += i+1; + offset2 += i + 1; head = (u16*)((u8*)loader->mCacheBuffer + *offset2); loader->archive[i].num = head[0]; @@ -80,7 +80,7 @@ static void loadResRead2ndcallback_() { if (count < RFLiArcID_Max) { u16* head = (u16*)loader->mHeaderBuf2; - offset += count+1; + offset += count + 1; loader->archive[count].num = head[0]; loader->archive[count].maxsize = head[1]; @@ -99,13 +99,11 @@ static void loadResRead2ndcallback_() { break; } } - } - else { + } else { doClose = TRUE; cb = NULL; } - } - else { + } else { doClose = TRUE; RFLiSetFileBroken(RFLiFileBrokenType_ResBroken); } @@ -157,8 +155,7 @@ static void loadResRead1stcallback_() { break; } } - } - else { + } else { doClose = TRUE; RFLiSetFileBroken(RFLiFileBrokenType_ResBroken); } @@ -210,7 +207,7 @@ static void loadResOpencallback_() { u32* store = &RFLiGetLoader()->mCacheSize; *store = 0; - switch (RFLiGetLengthAsync(RFLiFileType_Resource, store,loadResGetlengthcallback_)) { + switch (RFLiGetLengthAsync(RFLiFileType_Resource, store, loadResGetlengthcallback_)) { case RFLErrcode_Busy: case RFLErrcode_Success: { break; @@ -252,8 +249,7 @@ static u32 getSafetyLength_(NANDFileInfo* info) { if (NANDRead(info, buffer, sizeof(buffer)) == (s32)sizeof(buffer)) { return *(u16*)&buffer[0]; - } - else { + } else { return 0; } } @@ -267,7 +263,7 @@ static u32 getCachedLength_(RFLiNANDLoader* loader, RFLiArcID arcID, u16 index) arc = &loader->archive[arcID]; pos = (u32*)(head + arc->offset); - return pos[index+1] - pos[index]; + return pos[index + 1] - pos[index]; } static u32 getNANDLength_(RFLiNANDLoader* loader, RFLiArcID arcID, u16 index) { @@ -282,14 +278,14 @@ static u32 getNANDLength_(RFLiNANDLoader* loader, RFLiArcID arcID, u16 index) { arc = &loader->archive[arcID]; if (NANDPrivateOpen(scResFileFullPathName, &file, NAND_ACCESS_READ) == NAND_RESULT_OK) { - u32 readSize = OSRoundUp32B(arc->num * 4+4); + u32 readSize = OSRoundUp32B(arc->num * 4 + 4); RFLi_ASSERTLINE(readSize <= scTmpSize, 413); NANDSeek(&file, arc->offset, NAND_SEEK_BEG); if (NANDRead(&file, buffer, readSize) == readSize) { u32* pos = buffer; - ret = pos[index+1] - pos[index]; + ret = pos[index + 1] - pos[index]; } NANDClose(&file); @@ -334,7 +330,7 @@ static void* getCachedFile_(void* dst, RFLiNANDLoader* loader, RFLiArcID arcID, pos = (u32*)(head + arc->offset); glbOffset = (arc->offset + (arc->num * 4)) + 4 + pos[index]; - fileSize = pos[index+1] - pos[index]; + fileSize = pos[index + 1] - pos[index]; memcpy(dst, head + glbOffset, fileSize); ret = dst; @@ -361,20 +357,19 @@ static void* getNANDFile_(void* dst, RFLiNANDLoader* loader, RFLiArcID arcID, u1 u32 fileSize, fileOffset; u32* pos; - readSize = OSRoundUp32B(arc->num * 4+4); + readSize = OSRoundUp32B(arc->num * 4 + 4); fileSize = 0; fileOffset = 0; RFLi_ASSERTLINE(readSize <= scTmpSize1, 523); NANDSeek(&file, arc->offset, NAND_SEEK_BEG); - + if (NANDRead(&file, buffer1, readSize) == readSize) { pos = (u32*)buffer1; - fileSize = pos[index+1] - pos[index]; + fileSize = pos[index + 1] - pos[index]; fileOffset = pos[index]; - } - else { + } else { RFLiSetFileBroken(RFLiFileBrokenType_ResBroken); RFLiFree(buffer1); return NULL; @@ -387,8 +382,7 @@ static void* getNANDFile_(void* dst, RFLiNANDLoader* loader, RFLiArcID arcID, u1 if (NANDRead(&file, buffer2, offsetSize) == offsetSize) { memcpy(dst, buffer2, fileSize); ret = dst; - } - else { + } else { RFLiSetFileBroken(RFLiFileBrokenType_ResBroken); RFLiFree(buffer1); RFLiFree(buffer2); @@ -397,8 +391,7 @@ static void* getNANDFile_(void* dst, RFLiNANDLoader* loader, RFLiArcID arcID, u1 RFLiFree(buffer2); NANDClose(&file); - } - else { + } else { RFLiSetFileBroken(RFLiFileBrokenType_ResBroken); } @@ -433,32 +426,34 @@ static void* getFile_(void* dst, RFLiArcID arcID, u16 index) { } u32 RFLiGetTexSize(RFLiPartsTex parts, u16 index) { - static const RFLiArcID scParts2Arc[] = { RFLiArcID_Eye, RFLiArcID_Eyebrow, RFLiArcID_Mouth, RFLiArcID_Mustache, RFLiArcID_Mole }; - return getLength_(scParts2Arc[parts], index); + static const RFLiArcID scParts2Arc[] = {RFLiArcID_Eye, RFLiArcID_Eyebrow, RFLiArcID_Mouth, RFLiArcID_Mustache, RFLiArcID_Mole}; + return getLength_(scParts2Arc[parts], index); } RFLTexture* RFLiLoadTexture(RFLiPartsTex parts, u16 index, void* texBuffer) { - static const RFLiArcID scParts2Arc[] = { RFLiArcID_Eye, RFLiArcID_Eyebrow, RFLiArcID_Mouth, RFLiArcID_Mustache, RFLiArcID_Mole }; + static const RFLiArcID scParts2Arc[] = {RFLiArcID_Eye, RFLiArcID_Eyebrow, RFLiArcID_Mouth, RFLiArcID_Mustache, RFLiArcID_Mole}; return getFile_(texBuffer, scParts2Arc[parts], index); } u32 RFLiGetShpTexSize(RFLiPartsShpTex parts, u16 index) { - static const RFLiArcID scParts2Arc[] = { RFLiArcID_FaceTex, RFLiArcID_CapTex, RFLiArcID_NlineTex, RFLiArcID_GlassTex }; + static const RFLiArcID scParts2Arc[] = {RFLiArcID_FaceTex, RFLiArcID_CapTex, RFLiArcID_NlineTex, RFLiArcID_GlassTex}; return getLength_(scParts2Arc[parts], index); } RFLTexture* RFLiLoadShpTexture(RFLiPartsShpTex parts, u16 index, void* texBuffer) { - static const RFLiArcID scParts2Arc[] = { RFLiArcID_FaceTex, RFLiArcID_CapTex, RFLiArcID_NlineTex, RFLiArcID_GlassTex }; + static const RFLiArcID scParts2Arc[] = {RFLiArcID_FaceTex, RFLiArcID_CapTex, RFLiArcID_NlineTex, RFLiArcID_GlassTex}; return getFile_(texBuffer, scParts2Arc[parts], index); } u32 RFLiGetShapeSize(RFLiPartsShp parts, u16 index) { - static const RFLiArcID scParts2Arc[] = { RFLiArcID_Nose, RFLiArcID_ForeHead, RFLiArcID_Faceline, RFLiArcID_Hair, RFLiArcID_Cap, RFLiArcID_Beard, RFLiArcID_Nline, RFLiArcID_Mask, RFLiArcID_Glass }; + static const RFLiArcID scParts2Arc[] = {RFLiArcID_Nose, RFLiArcID_ForeHead, RFLiArcID_Faceline, RFLiArcID_Hair, RFLiArcID_Cap, + RFLiArcID_Beard, RFLiArcID_Nline, RFLiArcID_Mask, RFLiArcID_Glass}; return getLength_(scParts2Arc[parts], index); } void* RFLiLoadShape(RFLiPartsShp parts, u16 index, void* shpBuffer) { - static const RFLiArcID scParts2Arc[] = { RFLiArcID_Nose, RFLiArcID_ForeHead, RFLiArcID_Faceline, RFLiArcID_Hair, RFLiArcID_Cap, RFLiArcID_Beard, RFLiArcID_Nline, RFLiArcID_Mask, RFLiArcID_Glass }; + static const RFLiArcID scParts2Arc[] = {RFLiArcID_Nose, RFLiArcID_ForeHead, RFLiArcID_Faceline, RFLiArcID_Hair, RFLiArcID_Cap, + RFLiArcID_Beard, RFLiArcID_Nline, RFLiArcID_Mask, RFLiArcID_Glass}; return getFile_(shpBuffer, scParts2Arc[parts], index); } diff --git a/libs/RVLFaceLib/src/RFL_NWC24.c b/libs/RVLFaceLib/src/RFL_NWC24.c index 03c1e85c..bbfc35b2 100644 --- a/libs/RVLFaceLib/src/RFL_NWC24.c +++ b/libs/RVLFaceLib/src/RFL_NWC24.c @@ -5,22 +5,22 @@ #include #include -#include #include +#include #include -#define GET_ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0])) +#define GET_ARRAY_LENGTH(x) (sizeof(x) / sizeof(x[0])) -#define SEARCH_COUNT 20 -#define FRIEND_RECEIVE_COUNT 8 +#define SEARCH_COUNT 20 +#define FRIEND_RECEIVE_COUNT 8 BOOL RFLiNWC24Msg2CharData(RFLiCharData* rawdata, const NWC24MsgObj* obj) { NWC24Err err; u8 data[sizeof(RFLiCharData)]; err = NWC24ReadMsgFaceData(obj, data); - OSReport("[RFL]NWC24ReadMsgFaceData: errcode=%d\n", err); // ok I guess we ain't using RFLi_REPORT anymore... + OSReport("[RFL]NWC24ReadMsgFaceData: errcode=%d\n", err); // ok I guess we ain't using RFLi_REPORT anymore... if (err != NWC24_OK) { return FALSE; @@ -67,7 +67,7 @@ RFLErrcode RFLiSetOfficial2NWC24Msg(NWC24MsgObj* obj, RFLCharData* charData, u16 return RFLErrcode_Success; } -#endif // RFL_BUILD +#endif // RFL_BUILD RFLErrcode RFLCommitNWC24Msg(NWC24MsgObj* obj, u16 index) { RFLiCharData data; @@ -262,8 +262,7 @@ RFLErrcode makeNWC24MsgforExchange_(NWC24MsgObj* obj, RFLCharData* sendTarget, B if (cal.mday == RFLiGetDBManager()->mDatabase->day_nwc24 && cal.mon == RFLiGetDBManager()->mDatabase->month_nwc24) { if (check_date) { return RFLErrcode_Exist; - } - else { + } else { OSReport("[RFL] Last Send Date: %d/%d but send.\n", cal.mon, cal.mday); } } @@ -303,7 +302,7 @@ RFLErrcode makeNWC24MsgforExchange_(NWC24MsgObj* obj, RFLCharData* sendTarget, B sendData[sendNum] = RFLiAlloc32(sizeof(RFLCharData)); RFLiConvertHRaw2Raw(idb->data, (RFLiCharData*)sendData[sendNum]); sendNum++; -#endif // RFL_BUILD +#endif // RFL_BUILD } } @@ -349,11 +348,11 @@ RFLErrcode makeNWC24MsgforExchange_(NWC24MsgObj* obj, RFLCharData* sendTarget, B RFLi_ASSERTLINE(aidx <= count, 407); - for (i = 0; i < aidx-1; i++) { + for (i = 0; i < aidx - 1; i++) { u16 tmp; u16 target; - target = (((rand >> 0x10) + rand) & 0xFFFF) % (aidx-1); + target = (((rand >> 0x10) + rand) & 0xFFFF) % (aidx - 1); if (target >= i) { target++; } @@ -382,7 +381,7 @@ RFLErrcode makeNWC24MsgforExchange_(NWC24MsgObj* obj, RFLCharData* sendTarget, B RFLiFree(array); } - + OSReport("[RFL]SendNum: %d Miis\n", sendNum); if (sendNum == 0) { @@ -406,7 +405,8 @@ RFLErrcode makeNWC24MsgforExchange_(NWC24MsgObj* obj, RFLCharData* sendTarget, B } } - RFLiStartWorking(); { + RFLiStartWorking(); + { NWC24FriendInfo* lists[NWC24_FRIEND_INFO_MAX]; for (index = 0; index < NWC24_FRIEND_INFO_MAX; index++) { @@ -422,8 +422,7 @@ RFLErrcode makeNWC24MsgforExchange_(NWC24MsgObj* obj, RFLCharData* sendTarget, B if (info.attr.status == NWC24_FRIENDSTATUS_CONFIRMED && info.attr.type == NWC24_FRIENDTYPE_WII) { isEstablished = TRUE; } - } - else if (errcode != NWC24_ERR_NULL) { + } else if (errcode != NWC24_ERR_NULL) { nwcerr = errcode; isSuccess = FALSE; break; @@ -443,8 +442,7 @@ RFLErrcode makeNWC24MsgforExchange_(NWC24MsgObj* obj, RFLCharData* sendTarget, B OSReport("[RFL]Send To:%d=%lld\n", i, receiver[i].addr.wiiId); } receiverNum = friendsNum; - } - else { + } else { int i; int k; @@ -510,8 +508,7 @@ RFLErrcode makeNWC24MsgforExchange_(NWC24MsgObj* obj, RFLCharData* sendTarget, B OSReport("[RFL] nwc24 fail errcode=%d\n", nwcerr); RFLiEndWorkingReason(RFLErrcode_NWC24Fail, nwcerr); lastErr = RFLErrcode_NWC24Fail; - } - else { + } else { RFLiGetDBManager()->mDatabase->month_nwc24 = cal.mon; RFLiGetDBManager()->mDatabase->day_nwc24 = cal.mday; OSReport("[RFL] nwc24 success.\n"); diff --git a/libs/RVLFaceLib/src/RFL_System.c b/libs/RVLFaceLib/src/RFL_System.c index 921e16e9..15c025b8 100644 --- a/libs/RVLFaceLib/src/RFL_System.c +++ b/libs/RVLFaceLib/src/RFL_System.c @@ -5,8 +5,8 @@ #include -#include #include +#include #include #include @@ -17,24 +17,23 @@ SDKDefineVersionDebug(RFL, "Mar 6 2008", "17:40:04", "17:39:52"); SDKDefineVersion(RFL, "Feb 18 2008", "09:37:42"); #else #error "Unsupported version! Check RFLi_LibConfig.h" -#endif // RFL_BUILD +#endif // RFL_BUILD -#define RFLi_WORK_SIZE 0x4B000 +#define RFLi_WORK_SIZE 0x4B000 #define RFLi_DELUX_WORK_SIZE 0x64000 -static RFLiSysManager* sRFLManager = NULL; +static RFLiSysManager* sRFLManager = NULL; -static RFLErrcode sRFLLastErrCode = RFLErrcode_NotAvailable; -static s32 sRFLLastReason = 0; -static u8 sRFLBrokenType = 0; +static RFLErrcode sRFLLastErrCode = RFLErrcode_NotAvailable; +static s32 sRFLLastReason = 0; +static u8 sRFLBrokenType = 0; static const RFLiCoordinateData scCoordinate = {1, 2, 0, 0, 0, 0}; u32 RFLGetWorkSize(BOOL useDeluxTex) { if (useDeluxTex) { return RFLi_DELUX_WORK_SIZE + sizeof(RFLiSysManager); - } - else { + } else { return RFLi_WORK_SIZE + sizeof(RFLiSysManager); } } @@ -52,8 +51,7 @@ RFLErrcode RFLInitResAsync(void* workBuffer, void* resBuffer, u32 resSize, BOOL // Must need the RFL resource data if (resBuffer == NULL) { return RFLErrcode_Fatal; - } - else { + } else { RFLi_REPORT("---------- RVLFaceLib::RFLInit() --------------\n"); if (RFLiGetManager() == NULL) { @@ -73,7 +71,8 @@ RFLErrcode RFLInitResAsync(void* workBuffer, void* resBuffer, u32 resSize, BOOL sRFLLastReason = 0; sRFLBrokenType = 0; - RFLi_REPORT(" manager : 0x%08x - 0x%08x (%6dByte)\n", (u8*)sRFLManager, ((u8*)sRFLManager + sizeof(RFLiSysManager)), sizeof(RFLiSysManager)); + RFLi_REPORT(" manager : 0x%08x - 0x%08x (%6dByte)\n", (u8*)sRFLManager, ((u8*)sRFLManager + sizeof(RFLiSysManager)), + sizeof(RFLiSysManager)); RFLiGetManager()->mWorkBuffer = ((u8*)workBuffer + sizeof(RFLiSysManager)); } @@ -82,12 +81,12 @@ RFLErrcode RFLInitResAsync(void* workBuffer, void* resBuffer, u32 resSize, BOOL u32 size; if (useDeluxTex) { size = (RFLi_DELUX_WORK_SIZE - sizeof(RFLiSysManager)); - } - else { + } else { size = (RFLi_WORK_SIZE - sizeof(RFLiSysManager)); } RFLiGetManager()->mRootHeap = MEMCreateExpHeapEx(RFLiGetManager()->mWorkBuffer, size, 1); - RFLi_REPORT(" rootHeap : 0x%08x - 0x%08x (%6dByte)\n", (u8*)RFLiGetManager()->mWorkBuffer, (size + (u32)RFLiGetManager()->mWorkBuffer), size); + RFLi_REPORT(" rootHeap : 0x%08x - 0x%08x (%6dByte)\n", (u8*)RFLiGetManager()->mWorkBuffer, + (size + (u32)RFLiGetManager()->mWorkBuffer), size); } // Initialize system heap @@ -118,7 +117,7 @@ RFLErrcode RFLInitResAsync(void* workBuffer, void* resBuffer, u32 resSize, BOOL // Prepare for icon and model callback RFLSetIconDrawDoneCallback(FALSE); RFLSetModelDrawDoneCallback(FALSE); -#endif // RFL_BUILD +#endif // RFL_BUILD RFLiSetWorking(FALSE); @@ -132,10 +131,11 @@ RFLErrcode RFLInitResAsync(void* workBuffer, void* resBuffer, u32 resSize, BOOL #if RFL_BUILD >= 20080306 // Prepare coordinates RFLiSetCoordinateData(&scCoordinate); -#endif // RFL_BUILD +#endif // RFL_BUILD // Completed!! - RFLi_REPORT(" remain : sys=%8dByte, tmp=%8dByte\n", MEMGetTotalFreeSizeForExpHeap(RFLiGetManager()->mSystemHeap), MEMGetTotalFreeSizeForExpHeap(RFLiGetManager()->mTmpHeap)); + RFLi_REPORT(" remain : sys=%8dByte, tmp=%8dByte\n", MEMGetTotalFreeSizeForExpHeap(RFLiGetManager()->mSystemHeap), + MEMGetTotalFreeSizeForExpHeap(RFLiGetManager()->mTmpHeap)); RFLi_REPORT(" initialize finished.\n"); // Setup cache. @@ -152,9 +152,8 @@ RFLErrcode RFLInitResAsync(void* workBuffer, void* resBuffer, u32 resSize, BOOL RFLExit(); } - (void)0; // for debug match - } - else { + (void)0; // for debug match + } else { // We already done that!! RFLi_REPORT(" already initialized.\n"); errcode = RFLErrcode_Success; @@ -240,7 +239,7 @@ void* RFLiAlloc32(u32 size) { return allocal_(size, RFL_BUFFER_ALIGN); } -void RFLiFree(void *block) { +void RFLiFree(void* block) { MEMFreeToExpHeap(RFLiGetManager()->mTmpHeap, block); } @@ -248,8 +247,7 @@ u32 RFLiGetUsedWorkSize() { if (RFLAvailable()) { MEMiHeapHead* heap = RFLiGetManager()->mTmpHeap; return MEMGetAllocatableSizeForExpHeap(heap) - MEMGetTotalFreeSizeForExpHeap(heap); - } - else { + } else { return 0; } } @@ -395,7 +393,7 @@ BOOL RFLiNeedRepairError() { BOOL RFLiCriticalError() { u8* list = &sRFLBrokenType; - BOOL ret = FALSE; // Unused + BOOL ret = FALSE; // Unused if (RFLAvailable()) { list = &RFLiGetManager()->mBrokenTypeList; diff --git a/libs/RVLMiddleware/eZiText/include/eztx.h b/libs/RVLMiddleware/eZiText/include/eztx.h index 5861bbfd..4840a6b6 100644 --- a/libs/RVLMiddleware/eZiText/include/eztx.h +++ b/libs/RVLMiddleware/eZiText/include/eztx.h @@ -21,132 +21,132 @@ enum { #ifndef ZI8_LANGS_DEFINED #define ZI8_LANGS_DEFINED -#define ZI8_LANG_NONE 0 -#define ZI8_LANG_ZH 1 -#define ZI8_LANG_PY 2 -#define ZI8_LANG_DE 5 -#define ZI8_LANG_SV 9 -#define ZI8_LANG_FI 10 -#define ZI8_LANG_NO 11 -#define ZI8_LANG_DA 12 -#define ZI8_LANG_NL 13 -#define ZI8_LANG_EL 14 -#define ZI8_LANG_TR 15 -#define ZI8_LANG_JP 16 -#define ZI8_LANG_KO 18 -#define ZI8_LANG_AR 19 -#define ZI8_LANG_IN 20 -#define ZI8_LANG_MS 21 -#define ZI8_LANG_PL 22 -#define ZI8_LANG_CS 23 -#define ZI8_LANG_IW 24 -#define ZI8_LANG_VI 25 -#define ZI8_LANG_SK 26 -#define ZI8_LANG_EU 27 -#define ZI8_LANG_BN 28 -#define ZI8_LANG_HR 29 -#define ZI8_LANG_CH 30 -#define ZI8_LANG_ET 31 -#define ZI8_LANG_HI 32 -#define ZI8_LANG_HU 33 -#define ZI8_LANG_LV 34 -#define ZI8_LANG_LT 35 -#define ZI8_LANG_FA 36 -#define ZI8_LANG_PA 37 -#define ZI8_LANG_RO 38 -#define ZI8_LANG_RU 39 -#define ZI8_LANG_SL 41 -#define ZI8_LANG_TH 42 -#define ZI8_LANG_UR 43 -#define ZI8_LANG_UK 44 -#define ZI8_LANG_TL 45 -#define ZI8_LANG_IT 47 -#define ZI8_LANG_IS 48 -#define ZI8_LANG_BG 49 -#define ZI8_LANG_MR 53 -#define ZI8_LANG_SW 54 -#define ZI8_LANG_GU 55 -#define ZI8_LANG_KN 56 -#define ZI8_LANG_TA 57 -#define ZI8_LANG_ENUK 58 -#define ZI8_LANG_ENAM 59 -#define ZI8_LANG_ENPRC 60 -#define ZI8_LANG_ENTW 61 -#define ZI8_LANG_ENHK 62 -#define ZI8_LANG_FREU 63 -#define ZI8_LANG_FRCA 64 -#define ZI8_LANG_ESSA 65 -#define ZI8_LANG_ESEU 66 -#define ZI8_LANG_PTEU 67 -#define ZI8_LANG_PTBZ 68 -#define ZI8_LANG_SRLA 69 -#define ZI8_LANG_SRCY 70 -#define ZI8_LANG_KM 71 -#define ZI8_LANG_TE 72 -#define ZI8_LANG_ML 73 -#define ZI8_LANG_SI 74 -#define ZI8_LANG_AF 75 -#define ZI8_LANG_ST 76 -#define ZI8_LANG_XH 77 -#define ZI8_LANG_ZU 78 -#define ZI8_LANG_SQ 79 -#define ZI8_LANG_MK 80 -#define ZI8_LANG_AZ 81 -#define ZI8_LANG_KK 82 -#define ZI8_LANG_UZ 83 -#define ZI8_LANG_HA 84 -#define ZI8_LANG_IG 85 -#define ZI8_LANG_YO 86 -#define ZI8_LANG_PYP 119 -#define ZI8_LANG_PYS 120 -#define ZI8_LANG_ZYP 121 -#define ZI8_LANG_ZYS 122 -#define ZI8_LANG_SP2 123 -#define ZI8_LANG_PY2 124 -#define ZI8_LANG_ZY2 125 -#define ZI8_LANG_ZHP 126 -#define ZI8_LANG_ARB 127 -#define ZI8_LANG_MAX 128 -#endif // ZI8_LANGS_DEFINED +#define ZI8_LANG_NONE 0 +#define ZI8_LANG_ZH 1 +#define ZI8_LANG_PY 2 +#define ZI8_LANG_DE 5 +#define ZI8_LANG_SV 9 +#define ZI8_LANG_FI 10 +#define ZI8_LANG_NO 11 +#define ZI8_LANG_DA 12 +#define ZI8_LANG_NL 13 +#define ZI8_LANG_EL 14 +#define ZI8_LANG_TR 15 +#define ZI8_LANG_JP 16 +#define ZI8_LANG_KO 18 +#define ZI8_LANG_AR 19 +#define ZI8_LANG_IN 20 +#define ZI8_LANG_MS 21 +#define ZI8_LANG_PL 22 +#define ZI8_LANG_CS 23 +#define ZI8_LANG_IW 24 +#define ZI8_LANG_VI 25 +#define ZI8_LANG_SK 26 +#define ZI8_LANG_EU 27 +#define ZI8_LANG_BN 28 +#define ZI8_LANG_HR 29 +#define ZI8_LANG_CH 30 +#define ZI8_LANG_ET 31 +#define ZI8_LANG_HI 32 +#define ZI8_LANG_HU 33 +#define ZI8_LANG_LV 34 +#define ZI8_LANG_LT 35 +#define ZI8_LANG_FA 36 +#define ZI8_LANG_PA 37 +#define ZI8_LANG_RO 38 +#define ZI8_LANG_RU 39 +#define ZI8_LANG_SL 41 +#define ZI8_LANG_TH 42 +#define ZI8_LANG_UR 43 +#define ZI8_LANG_UK 44 +#define ZI8_LANG_TL 45 +#define ZI8_LANG_IT 47 +#define ZI8_LANG_IS 48 +#define ZI8_LANG_BG 49 +#define ZI8_LANG_MR 53 +#define ZI8_LANG_SW 54 +#define ZI8_LANG_GU 55 +#define ZI8_LANG_KN 56 +#define ZI8_LANG_TA 57 +#define ZI8_LANG_ENUK 58 +#define ZI8_LANG_ENAM 59 +#define ZI8_LANG_ENPRC 60 +#define ZI8_LANG_ENTW 61 +#define ZI8_LANG_ENHK 62 +#define ZI8_LANG_FREU 63 +#define ZI8_LANG_FRCA 64 +#define ZI8_LANG_ESSA 65 +#define ZI8_LANG_ESEU 66 +#define ZI8_LANG_PTEU 67 +#define ZI8_LANG_PTBZ 68 +#define ZI8_LANG_SRLA 69 +#define ZI8_LANG_SRCY 70 +#define ZI8_LANG_KM 71 +#define ZI8_LANG_TE 72 +#define ZI8_LANG_ML 73 +#define ZI8_LANG_SI 74 +#define ZI8_LANG_AF 75 +#define ZI8_LANG_ST 76 +#define ZI8_LANG_XH 77 +#define ZI8_LANG_ZU 78 +#define ZI8_LANG_SQ 79 +#define ZI8_LANG_MK 80 +#define ZI8_LANG_AZ 81 +#define ZI8_LANG_KK 82 +#define ZI8_LANG_UZ 83 +#define ZI8_LANG_HA 84 +#define ZI8_LANG_IG 85 +#define ZI8_LANG_YO 86 +#define ZI8_LANG_PYP 119 +#define ZI8_LANG_PYS 120 +#define ZI8_LANG_ZYP 121 +#define ZI8_LANG_ZYS 122 +#define ZI8_LANG_SP2 123 +#define ZI8_LANG_PY2 124 +#define ZI8_LANG_ZY2 125 +#define ZI8_LANG_ZHP 126 +#define ZI8_LANG_ARB 127 +#define ZI8_LANG_MAX 128 +#endif // ZI8_LANGS_DEFINED typedef struct EZTXLanguageEntry { - u8 language; // 0x00 - u8* table; // 0x04 + u8 language; // 0x00 + u8* table; // 0x04 } EZTXLanguageEntry; typedef struct EZTXGetParam { - u8 language; // 0x00 - u8 getMode; // 0x01 - u8 subLanguage; // 0x02 - u8 context; // 0x03 - u8 getOptions; // 0x04 + u8 language; // 0x00 + u8 getMode; // 0x01 + u8 subLanguage; // 0x02 + u8 context; // 0x03 + u8 getOptions; // 0x04 - wchar_t* elements; // 0x08 - u8 elementCount; // 0x0C + wchar_t* elements; // 0x08 + u8 elementCount; // 0x0C - wchar_t* currentWord; // 0x10 - u8 wordCharCount; // 0x14 + wchar_t* currentWord; // 0x10 + u8 wordCharCount; // 0x14 - wchar_t* candidates; // 0x18 - u8 maxCandidates; // 0x1C - wchar_t firstCandidate; // 0x1E - u8 wordCandidates; // 0x1F + wchar_t* candidates; // 0x18 + u8 maxCandidates; // 0x1C + wchar_t firstCandidate; // 0x1E + u8 wordCandidates; // 0x1F - u8 count; // 0x20 - u8 letters; // 0x21 - u8* scratch; // 0x22 + u8 count; // 0x20 + u8 letters; // 0x21 + u8* scratch; // 0x22 } EZTXGetParam; -u16 EZTXGetGlobalDataSize(); +u16 EZTXGetGlobalDataSize(); -BOOL EZTXInitialize(void* data, void* workData); +BOOL EZTXInitialize(void* data, void* workData); -BOOL EZTXSetLatinSearchOrder(u8* searchArray, u8 searchSize, void* workData); +BOOL EZTXSetLatinSearchOrder(u8* searchArray, u8 searchSize, void* workData); -u8 EZTXGetCandidates(EZTXGetParam* cands, void* workData); -u8 EZTXCopy(wchar_t* dest, EZTXGetParam* getParams, u8 index, void* workData); +u8 EZTXGetCandidates(EZTXGetParam* cands, void* workData); +u8 EZTXCopy(wchar_t* dest, EZTXGetParam* getParams, u8 index, void* workData); -u8 EZTXAttachOEMDict(u8* oemData, u16 oemSize, void* other, void* workData); -int EZTXDetachOEMDict(u8 oemId, void* workData); +u8 EZTXAttachOEMDict(u8* oemData, u16 oemSize, void* other, void* workData); +int EZTXDetachOEMDict(u8 oemId, void* workData); -#endif // EZI_TEXT_H +#endif // EZI_TEXT_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/zconvert.h b/libs/RVLMiddleware/eZiText/include/zi8clib/zconvert.h index 32b37a40..555a96b9 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/zconvert.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/zconvert.h @@ -4,9 +4,9 @@ #include ziWChar Zi8ConvertUC2WC(ziChar ch, ziU8 language ZI_NEED_WORK); -ziChar Zi8ConvertWC2UC(ziWChar ch, ziU8 language ZI_NEED_WORK); +ziChar Zi8ConvertWC2UC(ziWChar ch, ziU8 language ZI_NEED_WORK); ziWChar Zi8ConvertUC2Key(ziChar ch, ziU8 language ZI_NEED_WORK); ziWChar Zi8ConvertWC2Key(ziWChar ch, ziU8 language ZI_NEED_WORK); -#endif // ZI8_CLIB_CONVERT_H +#endif // ZI8_CLIB_CONVERT_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8alpha.h b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8alpha.h index ea494f7f..ceb57fd4 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8alpha.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8alpha.h @@ -3,8 +3,8 @@ #include -ziBool Zi8SetParentalControls(ziU8 level ZI_NEED_WORK); +ziBool Zi8SetParentalControls(ziU8 level ZI_NEED_WORK); -ziBool Zi8SetHighlightedWordW(ziWChar* word, ziU8 language, ziU8 subLanguage ZI_NEED_WORK); +ziBool Zi8SetHighlightedWordW(ziWChar* word, ziU8 language, ziU8 subLanguage ZI_NEED_WORK); -#endif // ZI8_CLIB_ALPHA_H +#endif // ZI8_CLIB_ALPHA_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8cgetc.h b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8cgetc.h index a9a1e423..c31fe443 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8cgetc.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8cgetc.h @@ -3,6 +3,6 @@ #include -ziU8 Zi8GetElementCount(ziWChar* pElements, ziU8 elementCount, ziU8 charCount ZI_NEED_WORK); +ziU8 Zi8GetElementCount(ziWChar* pElements, ziU8 elementCount, ziU8 charCount ZI_NEED_WORK); -#endif // ZI8_CLIB_CHINESE_GET_CANDIDATES_H +#endif // ZI8_CLIB_CHINESE_GET_CANDIDATES_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8cinfo.h b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8cinfo.h index 267376a7..6330673d 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8cinfo.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8cinfo.h @@ -3,6 +3,6 @@ #include -ziU8 Zi8GetCharInfo2(ziWChar ch, ziWChar* charInfoBuffer, ziU8 maxInfoBufSize, ziU8 hetMode, ziWChar* elements, ziU8 elementCount ZI_NEED_WORK); +ziU8 Zi8GetCharInfo2(ziWChar ch, ziWChar* charInfoBuffer, ziU8 maxInfoBufSize, ziU8 hetMode, ziWChar* elements, ziU8 elementCount ZI_NEED_WORK); -#endif // ZI8_CLIB_CANDIDATES_INFO_H +#endif // ZI8_CLIB_CANDIDATES_INFO_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8copy.h b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8copy.h index 0fc49ed2..1e2551c6 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8copy.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8copy.h @@ -3,7 +3,7 @@ #include -ziU8 Zi8CopyWordListW(ziWChar* destination, ziU8 maxCharacters, ziWChar* wordList, ziU8 index ZI_NEED_WORK); -ziU8 Zi8CopyW(ziWChar* dest, ziGetParam* getParams, ziU8 index ZI_NEED_WORK); +ziU8 Zi8CopyWordListW(ziWChar* destination, ziU8 maxCharacters, ziWChar* wordList, ziU8 index ZI_NEED_WORK); +ziU8 Zi8CopyW(ziWChar* dest, ziGetParam* getParams, ziU8 index ZI_NEED_WORK); -#endif // ZI8_CLIB_COPY_WORD_H +#endif // ZI8_CLIB_COPY_WORD_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8getc.h b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8getc.h index 8e5881e4..ccea5633 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8getc.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8getc.h @@ -3,6 +3,6 @@ #include -ziU8 Zi8GetCandidates(ziGetParam* getParam ZI_NEED_WORK); +ziU8 Zi8GetCandidates(ziGetParam* getParam ZI_NEED_WORK); -#endif // ZI8_CLIB_GET_CANDIDATE_H +#endif // ZI8_CLIB_GET_CANDIDATE_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8getc2.h b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8getc2.h index 2a019d81..2a760ea3 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8getc2.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8getc2.h @@ -3,13 +3,13 @@ #include -ziU16 Zi8GetGlobalDataSize(); +ziU16 Zi8GetGlobalDataSize(); -ziBool Zi8SetLatinSearchOrder(ziU8* searchArray, ziU8 searchSize ZI_NEED_WORK); +ziBool Zi8SetLatinSearchOrder(ziU8* searchArray, ziU8 searchSize ZI_NEED_WORK); -ziBool Zi8ZHsetPYfuzzyPairs(ziFuzzyPYPairs pairsList ZI_NEED_WORK); -ziBool Zi8ZHsetZYfuzzyPairs(ziFuzzyZYPairs pairsList ZI_NEED_WORK); +ziBool Zi8ZHsetPYfuzzyPairs(ziFuzzyPYPairs pairsList ZI_NEED_WORK); +ziBool Zi8ZHsetZYfuzzyPairs(ziFuzzyZYPairs pairsList ZI_NEED_WORK); -ziBool Zi8SetMaxWordLength(ziU8 length ZI_NEED_WORK); +ziBool Zi8SetMaxWordLength(ziU8 length ZI_NEED_WORK); -#endif // ZI8_CLIB_GET_CANDIDATE_2_H +#endif // ZI8_CLIB_GET_CANDIDATE_2_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8initd.h b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8initd.h index e8752789..1b56e5eb 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8initd.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8initd.h @@ -3,6 +3,6 @@ #include -ziBool Zi8InitializeDynamic(ziPtr data ZI_NEED_WORK); +ziBool Zi8InitializeDynamic(ziPtr data ZI_NEED_WORK); -#endif // ZI8_CLIB_INIT_DYNAMIC_H +#endif // ZI8_CLIB_INIT_DYNAMIC_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8is.h b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8is.h index dc97f8f1..d4124a98 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8is.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8is.h @@ -3,9 +3,9 @@ #include -ziU8 Zi8GetZHCharSet(ziPtr workData); +ziU8 Zi8GetZHCharSet(ziPtr workData); -ziBool Zi8IsComponent(ziWChar ch ZI_NEED_WORK); -ziBool Zi8IsCharacter(ziWChar ch ZI_NEED_WORK); +ziBool Zi8IsComponent(ziWChar ch ZI_NEED_WORK); +ziBool Zi8IsCharacter(ziWChar ch ZI_NEED_WORK); -#endif // ZI8_CLIB_IS_H +#endif // ZI8_CLIB_IS_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8space.h b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8space.h index 07861943..02cbd8e5 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/zi8space.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/zi8space.h @@ -3,6 +3,6 @@ #include -ziBool Zi8ZHaddSpace(ziWChar* elements, ziU8 elementCount, ziWChar* candidates, ziWChar maxCandSize ZI_NEED_WORK); +ziBool Zi8ZHaddSpace(ziWChar* elements, ziU8 elementCount, ziWChar* candidates, ziWChar maxCandSize ZI_NEED_WORK); -#endif // ZI8_CLIB_SPACE_H +#endif // ZI8_CLIB_SPACE_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/zierror.h b/libs/RVLMiddleware/eZiText/include/zi8clib/zierror.h index 95eeb30d..94acb919 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/zierror.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/zierror.h @@ -3,7 +3,7 @@ #include -void Zi8LogError(ziU16 code ZI_NEED_WORK); -void Zi8ReplaceLastError(ziU16 code ZI_NEED_WORK); +void Zi8LogError(ziU16 code ZI_NEED_WORK); +void Zi8ReplaceLastError(ziU16 code ZI_NEED_WORK); -#endif // ZI8_CLIB_ERROR_H +#endif // ZI8_CLIB_ERROR_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/ziswordw.h b/libs/RVLMiddleware/eZiText/include/zi8clib/ziswordw.h index 79a914ea..c9a3a20a 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/ziswordw.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/ziswordw.h @@ -3,7 +3,6 @@ #include -ziBool Zi8IsWordW(ziWChar* word, ziU8 language ZI_NEED_WORK); +ziBool Zi8IsWordW(ziWChar* word, ziU8 language ZI_NEED_WORK); - -#endif // ZI8_CLIB_IS_WORD_WIDE_H +#endif // ZI8_CLIB_IS_WORD_WIDE_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/zitypes.h b/libs/RVLMiddleware/eZiText/include/zi8clib/zitypes.h index abee907f..c1271a39 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/zitypes.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/zitypes.h @@ -1,192 +1,192 @@ #ifndef ZI8_CLIB_TYPES_H #define ZI8_CLIB_TYPES_H -typedef unsigned char ziU8; -typedef unsigned short ziU16; -typedef unsigned long ziU32; +typedef unsigned char ziU8; +typedef unsigned short ziU16; +typedef unsigned long ziU32; -typedef signed char ziS8; -typedef signed short ziS16; -typedef signed long ziS32; +typedef signed char ziS8; +typedef signed short ziS16; +typedef signed long ziS32; -typedef unsigned char ziChar; -typedef unsigned short ziWChar; -typedef unsigned char ziBool; -typedef void* ziPtr; +typedef unsigned char ziChar; +typedef unsigned short ziWChar; +typedef unsigned char ziBool; +typedef void* ziPtr; -#define ZI8_FALSE 0 -#define ZI8_TRUE 1 +#define ZI8_FALSE 0 +#define ZI8_TRUE 1 -#define ZI8_NULL 0 +#define ZI8_NULL 0 #ifndef ZI8_LANGS_DEFINED #define ZI8_LANGS_DEFINED -#define ZI8_LANG_NONE 0 -#define ZI8_LANG_ZH 1 -#define ZI8_LANG_PY 2 -#define ZI8_LANG_DE 5 -#define ZI8_LANG_SV 9 -#define ZI8_LANG_FI 10 -#define ZI8_LANG_NO 11 -#define ZI8_LANG_DA 12 -#define ZI8_LANG_NL 13 -#define ZI8_LANG_EL 14 -#define ZI8_LANG_TR 15 -#define ZI8_LANG_JP 16 -#define ZI8_LANG_KO 18 -#define ZI8_LANG_AR 19 -#define ZI8_LANG_IN 20 -#define ZI8_LANG_MS 21 -#define ZI8_LANG_PL 22 -#define ZI8_LANG_CS 23 -#define ZI8_LANG_IW 24 -#define ZI8_LANG_VI 25 -#define ZI8_LANG_SK 26 -#define ZI8_LANG_EU 27 -#define ZI8_LANG_BN 28 -#define ZI8_LANG_HR 29 -#define ZI8_LANG_CH 30 -#define ZI8_LANG_ET 31 -#define ZI8_LANG_HI 32 -#define ZI8_LANG_HU 33 -#define ZI8_LANG_LV 34 -#define ZI8_LANG_LT 35 -#define ZI8_LANG_FA 36 -#define ZI8_LANG_PA 37 -#define ZI8_LANG_RO 38 -#define ZI8_LANG_RU 39 -#define ZI8_LANG_SL 41 -#define ZI8_LANG_TH 42 -#define ZI8_LANG_UR 43 -#define ZI8_LANG_UK 44 -#define ZI8_LANG_TL 45 -#define ZI8_LANG_IT 47 -#define ZI8_LANG_IS 48 -#define ZI8_LANG_BG 49 -#define ZI8_LANG_MR 53 -#define ZI8_LANG_SW 54 -#define ZI8_LANG_GU 55 -#define ZI8_LANG_KN 56 -#define ZI8_LANG_TA 57 -#define ZI8_LANG_ENUK 58 -#define ZI8_LANG_ENAM 59 -#define ZI8_LANG_ENPRC 60 -#define ZI8_LANG_ENTW 61 -#define ZI8_LANG_ENHK 62 -#define ZI8_LANG_FREU 63 -#define ZI8_LANG_FRCA 64 -#define ZI8_LANG_ESSA 65 -#define ZI8_LANG_ESEU 66 -#define ZI8_LANG_PTEU 67 -#define ZI8_LANG_PTBZ 68 -#define ZI8_LANG_SRLA 69 -#define ZI8_LANG_SRCY 70 -#define ZI8_LANG_KM 71 -#define ZI8_LANG_TE 72 -#define ZI8_LANG_ML 73 -#define ZI8_LANG_SI 74 -#define ZI8_LANG_AF 75 -#define ZI8_LANG_ST 76 -#define ZI8_LANG_XH 77 -#define ZI8_LANG_ZU 78 -#define ZI8_LANG_SQ 79 -#define ZI8_LANG_MK 80 -#define ZI8_LANG_AZ 81 -#define ZI8_LANG_KK 82 -#define ZI8_LANG_UZ 83 -#define ZI8_LANG_HA 84 -#define ZI8_LANG_IG 85 -#define ZI8_LANG_YO 86 -#define ZI8_LANG_PYP 119 -#define ZI8_LANG_PYS 120 -#define ZI8_LANG_ZYP 121 -#define ZI8_LANG_ZYS 122 -#define ZI8_LANG_SP2 123 -#define ZI8_LANG_PY2 124 -#define ZI8_LANG_ZY2 125 -#define ZI8_LANG_ZHP 126 -#define ZI8_LANG_ARB 127 -#define ZI8_LANG_MAX 128 -#endif // ZI8_LANGS_DEFINED +#define ZI8_LANG_NONE 0 +#define ZI8_LANG_ZH 1 +#define ZI8_LANG_PY 2 +#define ZI8_LANG_DE 5 +#define ZI8_LANG_SV 9 +#define ZI8_LANG_FI 10 +#define ZI8_LANG_NO 11 +#define ZI8_LANG_DA 12 +#define ZI8_LANG_NL 13 +#define ZI8_LANG_EL 14 +#define ZI8_LANG_TR 15 +#define ZI8_LANG_JP 16 +#define ZI8_LANG_KO 18 +#define ZI8_LANG_AR 19 +#define ZI8_LANG_IN 20 +#define ZI8_LANG_MS 21 +#define ZI8_LANG_PL 22 +#define ZI8_LANG_CS 23 +#define ZI8_LANG_IW 24 +#define ZI8_LANG_VI 25 +#define ZI8_LANG_SK 26 +#define ZI8_LANG_EU 27 +#define ZI8_LANG_BN 28 +#define ZI8_LANG_HR 29 +#define ZI8_LANG_CH 30 +#define ZI8_LANG_ET 31 +#define ZI8_LANG_HI 32 +#define ZI8_LANG_HU 33 +#define ZI8_LANG_LV 34 +#define ZI8_LANG_LT 35 +#define ZI8_LANG_FA 36 +#define ZI8_LANG_PA 37 +#define ZI8_LANG_RO 38 +#define ZI8_LANG_RU 39 +#define ZI8_LANG_SL 41 +#define ZI8_LANG_TH 42 +#define ZI8_LANG_UR 43 +#define ZI8_LANG_UK 44 +#define ZI8_LANG_TL 45 +#define ZI8_LANG_IT 47 +#define ZI8_LANG_IS 48 +#define ZI8_LANG_BG 49 +#define ZI8_LANG_MR 53 +#define ZI8_LANG_SW 54 +#define ZI8_LANG_GU 55 +#define ZI8_LANG_KN 56 +#define ZI8_LANG_TA 57 +#define ZI8_LANG_ENUK 58 +#define ZI8_LANG_ENAM 59 +#define ZI8_LANG_ENPRC 60 +#define ZI8_LANG_ENTW 61 +#define ZI8_LANG_ENHK 62 +#define ZI8_LANG_FREU 63 +#define ZI8_LANG_FRCA 64 +#define ZI8_LANG_ESSA 65 +#define ZI8_LANG_ESEU 66 +#define ZI8_LANG_PTEU 67 +#define ZI8_LANG_PTBZ 68 +#define ZI8_LANG_SRLA 69 +#define ZI8_LANG_SRCY 70 +#define ZI8_LANG_KM 71 +#define ZI8_LANG_TE 72 +#define ZI8_LANG_ML 73 +#define ZI8_LANG_SI 74 +#define ZI8_LANG_AF 75 +#define ZI8_LANG_ST 76 +#define ZI8_LANG_XH 77 +#define ZI8_LANG_ZU 78 +#define ZI8_LANG_SQ 79 +#define ZI8_LANG_MK 80 +#define ZI8_LANG_AZ 81 +#define ZI8_LANG_KK 82 +#define ZI8_LANG_UZ 83 +#define ZI8_LANG_HA 84 +#define ZI8_LANG_IG 85 +#define ZI8_LANG_YO 86 +#define ZI8_LANG_PYP 119 +#define ZI8_LANG_PYS 120 +#define ZI8_LANG_ZYP 121 +#define ZI8_LANG_ZYS 122 +#define ZI8_LANG_SP2 123 +#define ZI8_LANG_PY2 124 +#define ZI8_LANG_ZY2 125 +#define ZI8_LANG_ZHP 126 +#define ZI8_LANG_ARB 127 +#define ZI8_LANG_MAX 128 +#endif // ZI8_LANGS_DEFINED typedef struct ziFuzzyPYPairs { - int ziDefault : 1; + int ziDefault : 1; - int cANDch : 1; - int sANDsh : 1; - int zANDzh : 1; + int cANDch : 1; + int sANDsh : 1; + int zANDzh : 1; - int anANDang : 1; - int enANDeng : 1; - int inANDing : 1; + int anANDang : 1; + int enANDeng : 1; + int inANDing : 1; - int nANDl : 1; - int lANDr : 1; - int fANDh : 1; + int nANDl : 1; + int lANDr : 1; + int fANDh : 1; } ziFuzzyPYPairs; typedef struct ziFuzzyZYPairs { - int ziDefault : 1; + int ziDefault : 1; - int cANDch : 1; - int sANDsh : 1; - int zANDzh : 1; + int cANDch : 1; + int sANDsh : 1; + int zANDzh : 1; - int anANDang : 1; - int enANDeng : 1; + int anANDang : 1; + int enANDeng : 1; - int nANDl : 1; - int lANDr : 1; - int fANDh : 1; + int nANDl : 1; + int lANDr : 1; + int fANDh : 1; - int rANDn : 1; - int bANDp : 1; - int gANDk : 1; + int rANDn : 1; + int bANDp : 1; + int gANDk : 1; } ziFuzzyZYPairs; typedef struct _ziGetParam { - ziU8 language; // 0x00 - ziU8 getMode; // 0x01 - ziU8 subLanguage; // 0x02 - ziU8 context; // 0x03 - ziU8 getOptions; // 0x04 + ziU8 language; // 0x00 + ziU8 getMode; // 0x01 + ziU8 subLanguage; // 0x02 + ziU8 context; // 0x03 + ziU8 getOptions; // 0x04 - ziWChar* elements; // 0x08 - ziU8 elementCount; // 0x0C + ziWChar* elements; // 0x08 + ziU8 elementCount; // 0x0C - ziWChar* currentWord; // 0x10 - ziU8 wordCharCount; // 0x14 + ziWChar* currentWord; // 0x10 + ziU8 wordCharCount; // 0x14 - ziWChar* candidates; // 0x18 - ziU8 maxCandidates; // 0x1C - ziWChar firstCandidate; // 0x1E - ziU8 wordCandidates; // 0x1F + ziWChar* candidates; // 0x18 + ziU8 maxCandidates; // 0x1C + ziWChar firstCandidate; // 0x1E + ziU8 wordCandidates; // 0x1F - ziU8 count; // 0x20 - ziU8 letters; // 0x21 - ziU8* scratch; // 0x22 + ziU8 count; // 0x20 + ziU8 letters; // 0x21 + ziU8* scratch; // 0x22 } ziGetParam; typedef struct _ziLanguageEntry { - ziU8 language; // 0x00 - ziU8* tableData; // 0x04 + ziU8 language; // 0x00 + ziU8* tableData; // 0x04 } ziLanguageEntry; struct __zi8_work_data_s { - ziU8 unk_0x00; - ziLanguageEntry* langEntries; // 0x04 - ziU32 unk_0x08; - ziU32 unk_0x0C; - ziU32 unk_0x10; - ziU32 unk_0x14; - ziU8 unk_0x18; - ziU8 unk_0x1C[0x108]; - ziU16** unk_0x124; - ziU8* unk_0x128; - ziU8 unk_0x12C; + ziU8 unk_0x00; + ziLanguageEntry* langEntries; // 0x04 + ziU32 unk_0x08; + ziU32 unk_0x0C; + ziU32 unk_0x10; + ziU32 unk_0x14; + ziU8 unk_0x18; + ziU8 unk_0x1C[0x108]; + ziU16** unk_0x124; + ziU8* unk_0x128; + ziU8 unk_0x12C; }; -#define ZI_WORK ((struct __zi8_work_data_s*)__zi8_work_data) -#define ZI_NEED_WORK , ziPtr __zi8_work_data +#define ZI_WORK ((struct __zi8_work_data_s*)__zi8_work_data) +#define ZI_NEED_WORK , ziPtr __zi8_work_data -#endif // ZI8_CLIB_TYPES_H +#endif // ZI8_CLIB_TYPES_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/zmtkey.h b/libs/RVLMiddleware/eZiText/include/zi8clib/zmtkey.h index 10d9bdd4..a0f079d2 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/zmtkey.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/zmtkey.h @@ -3,6 +3,6 @@ #include -ziBool Zi8ChangeCharCase(ziBool upper, ziWChar* ch, ziU8 language ZI_NEED_WORK); +ziBool Zi8ChangeCharCase(ziBool upper, ziWChar* ch, ziU8 language ZI_NEED_WORK); -#endif // ZI8_CLIB_ZMT_KEY_H +#endif // ZI8_CLIB_ZMT_KEY_H diff --git a/libs/RVLMiddleware/eZiText/include/zi8clib/zoemdata.h b/libs/RVLMiddleware/eZiText/include/zi8clib/zoemdata.h index 25ddc3a3..41be3cb4 100644 --- a/libs/RVLMiddleware/eZiText/include/zi8clib/zoemdata.h +++ b/libs/RVLMiddleware/eZiText/include/zi8clib/zoemdata.h @@ -6,4 +6,4 @@ ziU8 Zi8AttachOEMdata(ziU8* oemData, ziU16 oemSize, ziPtr other ZI_NEED_WORK); ziU8 Zi8DetachOEMdata(ziU8 oemId ZI_NEED_WORK); -#endif // ZI8_OEM_DATA_H +#endif // ZI8_OEM_DATA_H diff --git a/libs/RVLMiddleware/eZiText/src/clib/zaddress.c b/libs/RVLMiddleware/eZiText/src/clib/zaddress.c index 1e439eef..97c9ed9f 100644 --- a/libs/RVLMiddleware/eZiText/src/clib/zaddress.c +++ b/libs/RVLMiddleware/eZiText/src/clib/zaddress.c @@ -1,5 +1,5 @@ -#include #include +#include ziU8 Zi8LangSupported(ziU8 lang ZI_NEED_WORK) { ziU8 i; @@ -26,8 +26,7 @@ ziU8 Zi8LangSupported(ziU8 lang ZI_NEED_WORK) { if (ZI_WORK->langEntries[i].language != 0) { return i + 1; - } - else { + } else { Zi8ReplaceLastError(0x582, ZI_WORK); return 0; } @@ -41,7 +40,7 @@ enum { ziTableFormatVersion, }; -#define ZI8_TABLE_SIZE 6 +#define ZI8_TABLE_SIZE 6 ziU32 Zi8GetTableData(ziU8 lang, ziU8 tableIdx, ziU8 memberId ZI_NEED_WORK) { ziU8 langIdx; @@ -54,7 +53,8 @@ ziU32 Zi8GetTableData(ziU8 lang, ziU8 tableIdx, ziU8 memberId ZI_NEED_WORK) { if (langIdx-- != 0) { tableData = ZI_WORK->langEntries[langIdx].tableData; - if ((lang == ZI8_LANG_ZH) && (tableData[3] >= 4) && ((ZI_WORK->unk_0x18 == 1) || (ZI_WORK->unk_0x18 == 0x80) || (ZI_WORK->unk_0x18 == 0x40))) { + if ((lang == ZI8_LANG_ZH) && (tableData[3] >= 4) && + ((ZI_WORK->unk_0x18 == 1) || (ZI_WORK->unk_0x18 == 0x80) || (ZI_WORK->unk_0x18 == 0x40))) { offset = ((tableData[0x8B] << 0x10) + (tableData[0x8C] << 8) + tableData[0x8D]); if (offset != 0) { tableData += offset; @@ -62,14 +62,15 @@ ziU32 Zi8GetTableData(ziU8 lang, ziU8 tableIdx, ziU8 memberId ZI_NEED_WORK) { } switch (memberId) { case ziTableAddress: { - return ((ziU32)tableData + (tableData[(tableIdx * ZI8_TABLE_SIZE) + 7] << 0x10) + (tableData[(tableIdx * ZI8_TABLE_SIZE) + 8] << 8) + (tableData[(tableIdx * ZI8_TABLE_SIZE) + 9])); + return ((ziU32)tableData + (tableData[(tableIdx * ZI8_TABLE_SIZE) + 7] << 0x10) + (tableData[(tableIdx * ZI8_TABLE_SIZE) + 8] << 8) + + (tableData[(tableIdx * ZI8_TABLE_SIZE) + 9])); } case ziTableSize: { tableData = tableData + ((tableIdx * ZI8_TABLE_SIZE) + 4); return (ziU32)(tableData[2] | ((tableData[0] << 0x10) | (tableData[1] << 8))); } case ziTableUnk3: { - return tableData[1]; // always 0x80? + return tableData[1]; // always 0x80? } case ziTableFormatVersion: { return tableData[3]; @@ -79,8 +80,7 @@ ziU32 Zi8GetTableData(ziU8 lang, ziU8 tableIdx, ziU8 memberId ZI_NEED_WORK) { return 0; } } - } - else { + } else { Zi8ReplaceLastError(0x258, ZI_WORK); return 0; } @@ -105,7 +105,7 @@ ziU8 Zi8GetFormatVersion(ziU8 lang ZI_NEED_WORK) { ziU32 Zi8WCharCount(ziWChar* str ZI_NEED_WORK) { ziU32 count = 0; - str; // *sob* + str; // *sob* Zi8LogError(0x64, ZI_WORK); @@ -118,7 +118,9 @@ ziU32 Zi8WCharCount(ziWChar* str ZI_NEED_WORK) { return 0; } - while (*str++ != 0) { count++; } + while (*str++ != 0) { + count++; + } return count; } diff --git a/libs/RVLMiddleware/eZiText/src/clib/zi8ZHuwd.c b/libs/RVLMiddleware/eZiText/src/clib/zi8ZHuwd.c index 7c9c198a..c1661711 100644 --- a/libs/RVLMiddleware/eZiText/src/clib/zi8ZHuwd.c +++ b/libs/RVLMiddleware/eZiText/src/clib/zi8ZHuwd.c @@ -1,5 +1,5 @@ -#include #include +#include ziU32 Zi8GetZHuwdPtr(ziU32* arg0, ziU16* arg1 ZI_NEED_WORK) { if (ZI_WORK->unk_0x12C == 0) { @@ -7,10 +7,9 @@ ziU32 Zi8GetZHuwdPtr(ziU32* arg0, ziU16* arg1 ZI_NEED_WORK) { *arg1 = 0; Zi8LogError(0x1A5, ZI_WORK); return 0; - } - else { - *arg1 = ZI_WORK->unk_0x124[ZI_WORK->unk_0x12C-1][1] / 3; - *arg0 = ZI_WORK->unk_0x124[ZI_WORK->unk_0x12C-1][0]; + } else { + *arg1 = ZI_WORK->unk_0x124[ZI_WORK->unk_0x12C - 1][1] / 3; + *arg0 = ZI_WORK->unk_0x124[ZI_WORK->unk_0x12C - 1][0]; *arg0 += 8; Zi8LogError(0x64, ZI_WORK); return 1; diff --git a/libs/RVLMiddleware/eZiText/src/clib/zi8copy.c b/libs/RVLMiddleware/eZiText/src/clib/zi8copy.c index a1f4fab1..8db8277c 100644 --- a/libs/RVLMiddleware/eZiText/src/clib/zi8copy.c +++ b/libs/RVLMiddleware/eZiText/src/clib/zi8copy.c @@ -30,7 +30,8 @@ ziU8 Zi8CopyWordListW(ziWChar* destination, ziU8 maxCharacters, ziWChar* wordLis return 0; } - while (*wordList++ != 0) {} + while (*wordList++ != 0) { + } if (index-- == 0) { Zi8LogError(0x132, ZI_WORK); diff --git a/libs/RVLMiddleware/eZiText/src/clib/zierror.c b/libs/RVLMiddleware/eZiText/src/clib/zierror.c index d752292e..ed774309 100644 --- a/libs/RVLMiddleware/eZiText/src/clib/zierror.c +++ b/libs/RVLMiddleware/eZiText/src/clib/zierror.c @@ -3,9 +3,7 @@ /* Functions appear to be stubbed out on release. */ void Zi8LogError(ziU16 code ZI_NEED_WORK) { - } void Zi8ReplaceLastError(ziU16 code ZI_NEED_WORK) { - } diff --git a/libs/RVLMiddleware/eZiText/src/rvl/eztx.c b/libs/RVLMiddleware/eZiText/src/rvl/eztx.c index 851b70de..a1b89b03 100644 --- a/libs/RVLMiddleware/eZiText/src/rvl/eztx.c +++ b/libs/RVLMiddleware/eZiText/src/rvl/eztx.c @@ -1,10 +1,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include diff --git a/libs/RVL_SDK/include/private/SjisUcs.h b/libs/RVL_SDK/include/private/SjisUcs.h index b2f672cc..efd54138 100644 --- a/libs/RVL_SDK/include/private/SjisUcs.h +++ b/libs/RVL_SDK/include/private/SjisUcs.h @@ -4,3293 +4,1671 @@ #include static u16 Ucs00[] = { - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, - 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, - 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, - 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, - 0x58, 0x59, 0x5A, 0x5B, 0x815F, 0x5D, 0x5E, 0x5F, - 0x60, 0x61, 0x62, 0x63, 0x64, 0x65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, 0x844A, 0x844B, 0x844C, 0x844D, 0x844E, 0x844F, 0x8450, - 0x8451, 0x8452, 0x8453, 0x8454, 0x8455, 0x8456, 0x8457, 0x8458, - 0x8459, 0x845A, 0x845B, 0x845C, 0x845D, 0x845E, 0x845F, 0x8460, - 0x8470, 0x8471, 0x8472, 0x8473, 0x8474, 0x8475, 0x8477, 0x8478, - 0x8479, 0x847A, 0x847B, 0x847C, 0x847D, 0x847E, 0x8480, 0x8481, - 0x8482, 0x8483, 0x8484, 0x8485, 0x8486, 0x8487, 0x8488, 0x8489, - 0x848A, 0x848B, 0x848C, 0x848D, 0x848E, 0x848F, 0x8490, 0x8491, - 0x0, 0x8476, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x8446, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8440, 0x8441, + 0x8442, 0x8443, 0x8444, 0x8445, 0x8447, 0x8448, 0x8449, 0x844A, 0x844B, 0x844C, 0x844D, 0x844E, 0x844F, 0x8450, 0x8451, 0x8452, 0x8453, 0x8454, + 0x8455, 0x8456, 0x8457, 0x8458, 0x8459, 0x845A, 0x845B, 0x845C, 0x845D, 0x845E, 0x845F, 0x8460, 0x8470, 0x8471, 0x8472, 0x8473, 0x8474, 0x8475, + 0x8477, 0x8478, 0x8479, 0x847A, 0x847B, 0x847C, 0x847D, 0x847E, 0x8480, 0x8481, 0x8482, 0x8483, 0x8484, 0x8485, 0x8486, 0x8487, 0x8488, 0x8489, + 0x848A, 0x848B, 0x848C, 0x848D, 0x848E, 0x848F, 0x8490, 0x8491, 0x0, 0x8476, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x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0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }; static u16 Ucs30[] = { - 0x8140, 0x8141, 0x8142, 0x8156, 0x0, 0x8158, 0x8159, 0x815A, - 0x8171, 0x8172, 0x8173, 0x8174, 0x8175, 0x8176, 0x8177, 0x8178, - 0x8179, 0x817A, 0x81A7, 0x81AC, 0x816B, 0x816C, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x8160, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x829F, 0x82A0, 0x82A1, 0x82A2, 0x82A3, 0x82A4, 0x82A5, - 0x82A6, 0x82A7, 0x82A8, 0x82A9, 0x82AA, 0x82AB, 0x82AC, 0x82AD, - 0x82AE, 0x82AF, 0x82B0, 0x82B1, 0x82B2, 0x82B3, 0x82B4, 0x82B5, - 0x82B6, 0x82B7, 0x82B8, 0x82B9, 0x82BA, 0x82BB, 0x82BC, 0x82BD, - 0x82BE, 0x82BF, 0x82C0, 0x82C1, 0x82C2, 0x82C3, 0x82C4, 0x82C5, - 0x82C6, 0x82C7, 0x82C8, 0x82C9, 0x82CA, 0x82CB, 0x82CC, 0x82CD, - 0x82CE, 0x82CF, 0x82D0, 0x82D1, 0x82D2, 0x82D3, 0x82D4, 0x82D5, - 0x82D6, 0x82D7, 0x82D8, 0x82D9, 0x82DA, 0x82DB, 0x82DC, 0x82DD, - 0x82DE, 0x82DF, 0x82E0, 0x82E1, 0x82E2, 0x82E3, 0x82E4, 0x82E5, - 0x82E6, 0x82E7, 0x82E8, 0x82E9, 0x82EA, 0x82EB, 0x82EC, 0x82ED, - 0x82EE, 0x82EF, 0x82F0, 0x82F1, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x814A, 0x814B, 0x8154, 0x8155, 0x0, - 0x0, 0x8340, 0x8341, 0x8342, 0x8343, 0x8344, 0x8345, 0x8346, - 0x8347, 0x8348, 0x8349, 0x834A, 0x834B, 0x834C, 0x834D, 0x834E, - 0x834F, 0x8350, 0x8351, 0x8352, 0x8353, 0x8354, 0x8355, 0x8356, - 0x8357, 0x8358, 0x8359, 0x835A, 0x835B, 0x835C, 0x835D, 0x835E, - 0x835F, 0x8360, 0x8361, 0x8362, 0x8363, 0x8364, 0x8365, 0x8366, - 0x8367, 0x8368, 0x8369, 0x836A, 0x836B, 0x836C, 0x836D, 0x836E, - 0x836F, 0x8370, 0x8371, 0x8372, 0x8373, 0x8374, 0x8375, 0x8376, - 0x8377, 0x8378, 0x8379, 0x837A, 0x837B, 0x837C, 0x837D, 0x837E, - 0x8380, 0x8381, 0x8382, 0x8383, 0x8384, 0x8385, 0x8386, 0x8387, - 0x8388, 0x8389, 0x838A, 0x838B, 0x838C, 0x838D, 0x838E, 0x838F, - 0x8390, 0x8391, 0x8392, 0x8393, 0x8394, 0x8395, 0x8396, 0x0, - 0x0, 0x0, 0x0, 0x8145, 0x815B, 0x8152, 0x8153, 0x0, + 0x8140, 0x8141, 0x8142, 0x8156, 0x0, 0x8158, 0x8159, 0x815A, 0x8171, 0x8172, 0x8173, 0x8174, 0x8175, 0x8176, 0x8177, 0x8178, 0x8179, 0x817A, + 0x81A7, 0x81AC, 0x816B, 0x816C, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8160, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x829F, 0x82A0, 0x82A1, 0x82A2, 0x82A3, 0x82A4, 0x82A5, + 0x82A6, 0x82A7, 0x82A8, 0x82A9, 0x82AA, 0x82AB, 0x82AC, 0x82AD, 0x82AE, 0x82AF, 0x82B0, 0x82B1, 0x82B2, 0x82B3, 0x82B4, 0x82B5, 0x82B6, 0x82B7, + 0x82B8, 0x82B9, 0x82BA, 0x82BB, 0x82BC, 0x82BD, 0x82BE, 0x82BF, 0x82C0, 0x82C1, 0x82C2, 0x82C3, 0x82C4, 0x82C5, 0x82C6, 0x82C7, 0x82C8, 0x82C9, + 0x82CA, 0x82CB, 0x82CC, 0x82CD, 0x82CE, 0x82CF, 0x82D0, 0x82D1, 0x82D2, 0x82D3, 0x82D4, 0x82D5, 0x82D6, 0x82D7, 0x82D8, 0x82D9, 0x82DA, 0x82DB, + 0x82DC, 0x82DD, 0x82DE, 0x82DF, 0x82E0, 0x82E1, 0x82E2, 0x82E3, 0x82E4, 0x82E5, 0x82E6, 0x82E7, 0x82E8, 0x82E9, 0x82EA, 0x82EB, 0x82EC, 0x82ED, + 0x82EE, 0x82EF, 0x82F0, 0x82F1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x814A, 0x814B, 0x8154, 0x8155, 0x0, 0x0, 0x8340, + 0x8341, 0x8342, 0x8343, 0x8344, 0x8345, 0x8346, 0x8347, 0x8348, 0x8349, 0x834A, 0x834B, 0x834C, 0x834D, 0x834E, 0x834F, 0x8350, 0x8351, 0x8352, + 0x8353, 0x8354, 0x8355, 0x8356, 0x8357, 0x8358, 0x8359, 0x835A, 0x835B, 0x835C, 0x835D, 0x835E, 0x835F, 0x8360, 0x8361, 0x8362, 0x8363, 0x8364, + 0x8365, 0x8366, 0x8367, 0x8368, 0x8369, 0x836A, 0x836B, 0x836C, 0x836D, 0x836E, 0x836F, 0x8370, 0x8371, 0x8372, 0x8373, 0x8374, 0x8375, 0x8376, + 0x8377, 0x8378, 0x8379, 0x837A, 0x837B, 0x837C, 0x837D, 0x837E, 0x8380, 0x8381, 0x8382, 0x8383, 0x8384, 0x8385, 0x8386, 0x8387, 0x8388, 0x8389, + 0x838A, 0x838B, 0x838C, 0x838D, 0x838E, 0x838F, 0x8390, 0x8391, 0x8392, 0x8393, 0x8394, 0x8395, 0x8396, 0x0, 0x0, 0x0, 0x0, 0x8145, + 0x815B, 0x8152, 0x8153, 0x0, }; static u16 Ucs4E[] = { - 0x88EA, 0x929A, 0x0, 0x8EB5, 0x0, 0x0, 0x0, 0x969C, - 0x8FE4, 0x8E4F, 0x8FE3, 0x89BA, 0x0, 0x9573, 0x975E, 0x0, - 0x98A0, 0x894E, 0x0, 0x0, 0x8A8E, 0x98A1, 0x90A2, 0x99C0, - 0x8B75, 0x95B8, 0x0, 0x0, 0x0, 0x0, 0x8FE5, 0x0, - 0x0, 0x97BC, 0x0, 0x0, 0x0, 0x0, 0x95C0, 0x0, - 0x0, 0x0, 0x98A2, 0x0, 0x0, 0x9286, 0x0, 0x0, - 0x0, 0x98A3, 0x8BF8, 0x0, 0x0, 0x0, 0x98A4, 0x0, - 0x8ADB, 0x924F, 0x0, 0x8EE5, 0x98A5, 0x0, 0x0, 0x98A6, - 0x0, 0x0, 0x98A7, 0x9454, 0x0, 0x8B76, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x9456, 0x0, 0x93E1, 0x8CC1, 0x9652, - 0x0, 0x0, 0x0, 0x0, 0x0, 0xE568, 0x98A8, 0x8FE6, - 0x98A9, 0x89B3, 0x0, 0x0, 0x0, 0x8BE3, 0x8CEE, 0x96E7, - 0x0, 0x0, 0x9BA4, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x9790, 0x0, 0x93FB, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8AA3, 0x0, - 0x8B54, 0x0, 0x98AA, 0x0, 0x0, 0x98AB, 0x97B9, 0x0, - 0x975C, 0x9188, 0x98AD, 0x8E96, 0x93F1, 0x0, 0x98B0, 0x0, - 0x0, 0x895D, 0x8CDD, 0x0, 0x8CDC, 0x88E4, 0x0, 0x0, - 0x986A, 0x9869, 0x0, 0x8DB1, 0x889F, 0x0, 0x98B1, 0x98B2, - 0x98B3, 0x9653, 0x98B4, 0x0, 0x8CF0, 0x88E5, 0x9692, 0x0, - 0x8B9C, 0x0, 0x0, 0x8B9D, 0x8B9E, 0x92E0, 0x97BA, 0x0, - 0x98B5, 0x0, 0x0, 0x98B6, 0x0, 0x0, 0x98B7, 0x0, - 0x0, 0x0, 0x906C, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x8F59, 0x906D, 0x98BC, 0x0, 0x98BA, 0x0, 0x98BB, 0x8B77, - 0x0, 0x0, 0x8DA1, 0x89EE, 0x0, 0x98B9, 0x98B8, 0x95A7, - 0x0, 0x0, 0x0, 0x0, 0x8E65, 0x8E64, 0x91BC, 0x98BD, - 0x9574, 0x90E5, 0x0, 0x0, 0x0, 0x8157, 0x98BE, 0x98C0, - 0x0, 0x0, 0x0, 0x91E3, 0x97DF, 0x88C8, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x98BF, 0x89BC, 0x0, - 0x8BC2, 0x0, 0x9287, 0x0, 0x0, 0x0, 0x8C8F, 0x98C1, - 0x0, 0x0, 0x0, 0x9443, 0x0, 0x0, 0x0, 0x0, + 0x88EA, 0x929A, 0x0, 0x8EB5, 0x0, 0x0, 0x0, 0x969C, 0x8FE4, 0x8E4F, 0x8FE3, 0x89BA, 0x0, 0x9573, 0x975E, 0x0, 0x98A0, 0x894E, + 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x0, 0x916D, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x9947, 0x9949, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x994B, 0x0, 0x0, 0x0, 0x994A, 0x0, 0x95C6, + 0x0, 0x0, 0x0, 0x0, }; static u16 Ucs51[] = { - 0x8B56, 0x994D, 0x994E, 0x0, 0x89AD, 0x0, 0x0, 0x0, - 0x0, 0x994C, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x8EF2, 0x0, 0x9951, 0x9950, 0x994F, 0x0, - 0x98D4, 0x0, 0x9952, 0x0, 0x0, 0x0, 0x0, 0x8F9E, - 0x0, 0x9953, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x9744, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x96D7, 0x0, 0x0, 0x0, 0x0, 0x9955, - 0x0, 0x0, 0x9954, 0x9957, 0x9956, 0x0, 0x0, 0x9958, - 0x9959, 0x88F2, 0x0, 0x8CB3, 0x8C5A, 0x8F5B, 0x929B, 0x8BA2, - 0x90E6, 0x8CF5, 0x0, 0x8D8E, 0x995B, 0x96C6, 0x9365, 0x0, - 0x8E99, 0x0, 0x995A, 0x0, 0x995C, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x937D, 0x0, 0x8A95, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x995D, 0x0, 0x0, 0x93FC, 0x0, 0x0, - 0x9153, 0x995F, 0x9960, 0x94AA, 0x8CF6, 0x985A, 0x9961, 0x0, - 0x0, 0x8BA4, 0x0, 0x0, 0x0, 0x95BA, 0x91B4, 0x8BEF, - 0x9354, 0x0, 0x0, 0x0, 0x8C93, 0x0, 0x0, 0x0, - 0x9962, 0x0, 0x9963, 0x0, 0x0, 0x93E0, 0x897E, 0x0, - 0x0, 0x9966, 0x8DFB, 0x0, 0x9965, 0x8DC4, 0x0, 0x9967, - 0xE3EC, 0x9968, 0x9660, 0x9969, 0x0, 0x996A, 0x996B, 0x8FE7, - 0x0, 0x8ECA, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x8AA5, 0x0, 0x996E, 0x0, 0x996C, 0x96BB, 0x996D, 0x0, - 0x9579, 0x996F, 0x9970, 0x9971, 0x937E, 0x0, 0x0, 0x0, - 0x9975, 0x9973, 0x9974, 0x9972, 0x8DE1, 0x9976, 0x96E8, 0x97E2, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x9977, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x90A6, 0x9978, 0x8F79, 0x0, - 0x0, 0x9979, 0x0, 0x929C, 0x97BD, 0x9380, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x99C3, 0x0, - 0x0, 0x0, 0x0, 0x997A, 0xEAA3, 0x8BC3, 0x0, 0x0, - 0x997B, 0x967D, 0x0, 0x0, 0x0, 0x0, 0x8F88, 0x91FA, - 0x0, 0x997D, 0x93E2, 0x0, 0x0, 0x997E, 0x0, 0x0, - 0x9980, 0x8A4D, 0x0, 0x0, 0x0, 0x9981, 0x8BA5, 0x0, - 0x93CA, 0x899A, 0x8F6F, 0x0, 0x0, 0x949F, 0x9982, 0x0, + 0x8B56, 0x994D, 0x994E, 0x0, 0x89AD, 0x0, 0x0, 0x0, 0x0, 0x994C, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x8EF2, 0x0, 0x9951, 0x9950, 0x994F, 0x0, 0x98D4, 0x0, 0x9952, 0x0, 0x0, 0x0, 0x0, 0x8F9E, 0x0, 0x9953, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9744, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x96D7, 0x0, 0x0, 0x0, + 0x0, 0x9955, 0x0, 0x0, 0x9954, 0x9957, 0x9956, 0x0, 0x0, 0x9958, 0x9959, 0x88F2, 0x0, 0x8CB3, 0x8C5A, 0x8F5B, 0x929B, 0x8BA2, + 0x90E6, 0x8CF5, 0x0, 0x8D8E, 0x995B, 0x96C6, 0x9365, 0x0, 0x8E99, 0x0, 0x995A, 0x0, 0x995C, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x937D, 0x0, 0x8A95, 0x0, 0x0, 0x0, 0x0, 0x0, 0x995D, 0x0, 0x0, 0x93FC, 0x0, 0x0, 0x9153, 0x995F, 0x9960, 0x94AA, + 0x8CF6, 0x985A, 0x9961, 0x0, 0x0, 0x8BA4, 0x0, 0x0, 0x0, 0x95BA, 0x91B4, 0x8BEF, 0x9354, 0x0, 0x0, 0x0, 0x8C93, 0x0, + 0x0, 0x0, 0x9962, 0x0, 0x9963, 0x0, 0x0, 0x93E0, 0x897E, 0x0, 0x0, 0x9966, 0x8DFB, 0x0, 0x9965, 0x8DC4, 0x0, 0x9967, + 0xE3EC, 0x9968, 0x9660, 0x9969, 0x0, 0x996A, 0x996B, 0x8FE7, 0x0, 0x8ECA, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8AA5, 0x0, + 0x996E, 0x0, 0x996C, 0x96BB, 0x996D, 0x0, 0x9579, 0x996F, 0x9970, 0x9971, 0x937E, 0x0, 0x0, 0x0, 0x9975, 0x9973, 0x9974, 0x9972, + 0x8DE1, 0x9976, 0x96E8, 0x97E2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9977, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x90A6, 0x9978, + 0x8F79, 0x0, 0x0, 0x9979, 0x0, 0x929C, 0x97BD, 0x9380, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x99C3, 0x0, + 0x0, 0x0, 0x0, 0x997A, 0xEAA3, 0x8BC3, 0x0, 0x0, 0x997B, 0x967D, 0x0, 0x0, 0x0, 0x0, 0x8F88, 0x91FA, 0x0, 0x997D, + 0x93E2, 0x0, 0x0, 0x997E, 0x0, 0x0, 0x9980, 0x8A4D, 0x0, 0x0, 0x0, 0x9981, 0x8BA5, 0x0, 0x93CA, 0x899A, 0x8F6F, 0x0, + 0x0, 0x949F, 0x9982, 0x0, }; static u16 Ucs52[] = { - 0x9381, 0x0, 0x0, 0x906E, 0x9983, 0x0, 0x95AA, 0x90D8, - 0x8AA0, 0x0, 0x8AA7, 0x9984, 0x0, 0x0, 0x9986, 0x0, - 0x0, 0x8C59, 0x0, 0x0, 0x9985, 0x0, 0x0, 0x97F1, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x8F89, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x94BB, 0x95CA, 0x0, 0x9987, - 0x0, 0x9798, 0x9988, 0x0, 0x0, 0x0, 0x9989, 0x0, - 0x939E, 0x0, 0x0, 0x998A, 0x0, 0x0, 0x90A7, 0x8DFC, - 0x8C94, 0x998B, 0x8E68, 0x8D8F, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x92E4, 0x998D, 0x0, 0x0, 0x91A5, - 0x0, 0x0, 0x8DED, 0x998E, 0x998F, 0x914F, 0x0, 0x998C, - 0x0, 0x0, 0x0, 0x0, 0x9991, 0x0, 0x9655, 0x0, - 0x0, 0x0, 0x0, 0x8D84, 0x0, 0x0, 0x9990, 0x0, - 0x0, 0x0, 0x0, 0x8C95, 0x8DDC, 0x948D, 0x0, 0x0, - 0x0, 0x9994, 0x9992, 0x0, 0x0, 0x0, 0x0, 0x959B, - 0x8FE8, 0x999B, 0x8A84, 0x9995, 0x9993, 0x916E, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x9997, 0x0, 0x9996, - 0x0, 0x0, 0x0, 0x8A63, 0x0, 0x0, 0x0, 0x8C80, - 0x999C, 0x97AB, 0x0, 0x0, 0x0, 0x9998, 0x0, 0x0, - 0x0, 0x999D, 0x999A, 0x0, 0x9999, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x97CD, 0x0, 0x0, 0x0, 0x8CF7, - 0x89C1, 0x0, 0x0, 0x97F2, 0x0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, 0x0, 0x8EA3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0xE0F9, 0x0, 0x0, 0x0, 0x0, 0xE0FA, 0x0, 0x0, 0x0, 0x0, 0xE0FB, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x895A, 0x0, 0x0, 0x0, 0xE140, 0x0, 0x955A, 0xE141, 0x0, 0x0, 0x8AA2, 0xE142, 0x0, 0xE143, + 0x0, 0x0, 0x0, 0x0, 0xE144, 0x0, 0xE146, 0xE147, 0xE145, 0x0, 0x0, 0x0, 0x9572, 0xE149, 0xE148, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, }; static u16 Ucs75[] = { - 0x0, 0x0, 0x0, 0xE14B, 0xE14A, 0xE14C, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0xE14D, 0xE14F, 0xE14E, 0x0, - 0x0, 0x8D99, 0x0, 0xE151, 0x0, 0xE150, 0x0, 0x0, - 0x8AC3, 0x0, 0x9072, 0x0, 0x935B, 0x0, 0xE152, 0x90B6, - 0x0, 0x0, 0x0, 0x8E59, 0x0, 0x8999, 0xE153, 0x0, - 0x9770, 0x0, 0x0, 0x95E1, 0xE154, 0x0, 0x0, 0x0, - 0x9363, 0x9752, 0x8D62, 0x905C, 0x0, 0x0, 0x0, 0x926A, - 0x99B2, 0x0, 0x92AC, 0x89E6, 0xE155, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0xE156, 0x0, 0xE15B, 0x0, - 0x0, 0xE159, 0xE158, 0x9DC0, 0x8A45, 0xE157, 0x0, 0x88D8, - 0x0, 0x94A8, 0x0, 0x0, 0x94C8, 0x0, 0x0, 0x0, - 0x0, 0x97AF, 0xE15C, 0xE15A, 0x927B, 0x90A4, 0x0, 0x0, - 0x94A9, 0x0, 0x954C, 0x0, 0xE15E, 0x97AA, 0x8C6C, 0xE15F, - 0x0, 0xE15D, 0x94D4, 0xE160, 0x0, 0xE161, 0x0, 0x0, - 0x88D9, 0x0, 0x0, 0x8FF4, 0xE166, 0x0, 0xE163, 0x93EB, - 0xE162, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8B45, - 0x0, 0x0, 0xE169, 0x0, 0x0, 0x0, 0xE164, 0xE165, - 0x0, 0xE168, 0xE167, 0x9544, 0x0, 0x0, 0x9161, 0x9160, - 0x0, 0x8B5E, 0x0, 0x0, 0xE16A, 0x0, 0x0, 0x0, - 0x0, 0x0, 0xE16B, 0x0, 0x0, 0xE16C, 0x0, 0x0, - 0x0, 0x0, 0x0, 0xE16E, 0x0, 0xE16D, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x8975, 0x0, 0x0, 0x0, 0x0, - 0x0, 0xE176, 0x94E6, 0xE170, 0x0, 0xE172, 0x0, 0x0, - 0xE174, 0x905D, 0x0, 0x0, 0xE175, 0xE173, 0x8EBE, 0x0, - 0x0, 0x0, 0xE16F, 0xE171, 0x0, 0x9561, 0x0, 0x8FC7, - 0x0, 0x0, 0xE178, 0x0, 0x0, 0xE177, 0x0, 0x0, - 0x0, 0x0, 0xE179, 0x0, 0x8EA4, 0x8DAD, 0x0, 0x0, - 0x9397, 0xE17A, 0x0, 0x92C9, 0x0, 0x0, 0xE17C, 0x0, - 0x0, 0x0, 0x979F, 0xE17B, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x9189, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0xE182, 0x0, 0xE184, 0xE185, 0x9273, 0x0, 0x0, 0x0, - 0x0, 0x0, 0xE183, 0x0, 0xE180, 0x0, 0xE17D, 0xE17E, + 0x0, 0x0, 0x0, 0xE14B, 0xE14A, 0xE14C, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE14D, 0xE14F, 0xE14E, 0x0, 0x0, 0x8D99, + 0x0, 0xE151, 0x0, 0xE150, 0x0, 0x0, 0x8AC3, 0x0, 0x9072, 0x0, 0x935B, 0x0, 0xE152, 0x90B6, 0x0, 0x0, 0x0, 0x8E59, + 0x0, 0x8999, 0xE153, 0x0, 0x9770, 0x0, 0x0, 0x95E1, 0xE154, 0x0, 0x0, 0x0, 0x9363, 0x9752, 0x8D62, 0x905C, 0x0, 0x0, + 0x0, 0x926A, 0x99B2, 0x0, 0x92AC, 0x89E6, 0xE155, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE156, 0x0, 0xE15B, 0x0, + 0x0, 0xE159, 0xE158, 0x9DC0, 0x8A45, 0xE157, 0x0, 0x88D8, 0x0, 0x94A8, 0x0, 0x0, 0x94C8, 0x0, 0x0, 0x0, 0x0, 0x97AF, + 0xE15C, 0xE15A, 0x927B, 0x90A4, 0x0, 0x0, 0x94A9, 0x0, 0x954C, 0x0, 0xE15E, 0x97AA, 0x8C6C, 0xE15F, 0x0, 0xE15D, 0x94D4, 0xE160, + 0x0, 0xE161, 0x0, 0x0, 0x88D9, 0x0, 0x0, 0x8FF4, 0xE166, 0x0, 0xE163, 0x93EB, 0xE162, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x8B45, 0x0, 0x0, 0xE169, 0x0, 0x0, 0x0, 0xE164, 0xE165, 0x0, 0xE168, 0xE167, 0x9544, 0x0, 0x0, 0x9161, 0x9160, + 0x0, 0x8B5E, 0x0, 0x0, 0xE16A, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE16B, 0x0, 0x0, 0xE16C, 0x0, 0x0, 0x0, 0x0, + 0x0, 0xE16E, 0x0, 0xE16D, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8975, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE176, 0x94E6, 0xE170, + 0x0, 0xE172, 0x0, 0x0, 0xE174, 0x905D, 0x0, 0x0, 0xE175, 0xE173, 0x8EBE, 0x0, 0x0, 0x0, 0xE16F, 0xE171, 0x0, 0x9561, + 0x0, 0x8FC7, 0x0, 0x0, 0xE178, 0x0, 0x0, 0xE177, 0x0, 0x0, 0x0, 0x0, 0xE179, 0x0, 0x8EA4, 0x8DAD, 0x0, 0x0, + 0x9397, 0xE17A, 0x0, 0x92C9, 0x0, 0x0, 0xE17C, 0x0, 0x0, 0x0, 0x979F, 0xE17B, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9189, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE182, 0x0, 0xE184, 0xE185, 0x9273, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE183, 0x0, + 0xE180, 0x0, 0xE17D, 0xE17E, }; static u16 Ucs76[] = { - 0x0, 0xE181, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0xE188, 0x0, 0xE186, 0x0, 0xE187, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE189, - 0xE18B, 0xE18C, 0xE18D, 0x0, 0xE18E, 0x0, 0x0, 0xE18A, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0xE190, 0x0, 0x0, 0x0, 0xE18F, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0xE191, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x97C3, 0x0, 0x0, 0x0, 0xE194, 0xE192, - 0xE193, 0x0, 0x0, 0x0, 0x8AE0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x96FC, 0x0, 0x0, 0x0, 0x95C8, 0x0, - 0xE196, 0x0, 0x0, 0x0, 0xE195, 0x0, 0x0, 0x0, - 0x0, 0xE197, 0xE198, 0x0, 0x0, 0x0, 0x0, 0xE19C, - 0xE199, 0xE19A, 0xE19B, 0x0, 0xE19D, 0x0, 0x0, 0x0, - 0xE19E, 0x0, 0xE19F, 0x0, 0x0, 0x0, 0xE1A0, 0x0, - 0xE1A1, 0x0, 0x94AD, 0x936F, 0xE1A2, 0x9492, 0x9553, 0x0, - 0xE1A3, 0x0, 0x0, 0xE1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x0, 0x0, 0x0, 0xE26A, 0x89D2, 0x8C6D, 0xE26B, 0x8D65, - 0x8D92, 0x0, 0x95E4, 0xE26D, 0x0, 0x0, 0x9673, 0x0, - 0x0, 0xE26F, 0x0, 0x0, 0x0, 0x90CF, 0x896E, 0x89B8, - 0x88AA, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE26E, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0xE270, 0xE271, 0x8FF5, 0x0, 0x0, 0x0, 0x0, - 0x0, 0xE272, 0x0, 0x8A6E, 0x0, 0x0, 0x0, 0x0, - 0xE274, 0x0, 0x0, 0x0, 0x8C8A, 0x0, 0x8B86, 0x0, - 0x0, 0xE275, 0x8BF3, 0x0, 0x0, 0xE276, 0x0, 0x90FA, - 0x0, 0x93CB, 0x0, 0x90DE, 0x8DF3, 0x0, 0x0, 0x0, - 0xE277, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x9282, 0x918B, 0x0, 0xE279, 0xE27B, 0xE278, - 0xE27A, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8C41, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0xE27C, 0x8C45, 0x0, 0x0, 0x0, 0x8B87, 0x9771, - 0xE27E, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE280, 0x0, - 0x0, 0x0, 0x894D, 0x0, 0x0, 0x0, 0x0, 0xE283, - 0x0, 0x0, 0x0, 0x8A96, 0xE282, 0xE281, 0x0, 0xE285, - 0xE27D, 0x0, 0xE286, 0x97A7, 0x0, 0xE287, 0x0, 0xE288, - 0x0, 0x0, 0x9AF2, 0xE28A, 0x0, 0xE289, 0x0, 0x0, - 0x0, 0xE28B, 0xE28C, 0x0, 0x97B3, 0xE28D, 0x0, 0xE8ED, - 0x8FCD, 0xE28E, 0xE28F, 0x8F76, 0x0, 0x93B6, 0xE290, 0x0, - 0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0, 0x0, 0x8C41, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE27C, 0x8C45, 0x0, 0x0, 0x0, 0x8B87, 0x9771, 0xE27E, 0x0, 0x0, 0x0, + 0x0, 0x0, 0xE280, 0x0, 0x0, 0x0, 0x894D, 0x0, 0x0, 0x0, 0x0, 0xE283, 0x0, 0x0, 0x0, 0x8A96, 0xE282, 0xE281, + 0x0, 0xE285, 0xE27D, 0x0, 0xE286, 0x97A7, 0x0, 0xE287, 0x0, 0xE288, 0x0, 0x0, 0x9AF2, 0xE28A, 0x0, 0xE289, 0x0, 0x0, + 0x0, 0xE28B, 0xE28C, 0x0, 0x97B3, 0xE28D, 0x0, 0xE8ED, 0x8FCD, 0xE28E, 0xE28F, 0x8F76, 0x0, 0x93B6, 0xE290, 0x0, 0x0, 0x0, + 0x9247, 0x0, 0x0, 0xE291, 0x0, 0x925B, 0xE292, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8BA3, 0x0, 0x995E, 0x927C, 0x8EB1, 0x0, + 0x0, 0x0, 0x0, 0x8AC6, }; static u16 Ucs7B[] = { - 0x0, 0x0, 0xE293, 0x0, 0xE2A0, 0x0, 0xE296, 0x0, - 0x8B88, 0x0, 0xE295, 0xE2A2, 0x0, 0x0, 0x0, 0xE294, - 0x0, 0x8FCE, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0xE298, 0xE299, 0x0, 0x934A, 0x0, 0x0, 0xE29A, 0x0, - 0x8A7D, 0x0, 0x0, 0x0, 0x0, 0x9079, 0x9584, 0x0, - 0xE29C, 0x0, 0x0, 0x0, 0x91E6, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0xE297, 0x0, 0xE29B, 0xE29D, 0x0, - 0x0, 0x8DF9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0xE2A4, 0x954D, 0x0, - 0x94A4, 0x9399, 0x0, 0x8BD8, 0x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0x0, 0x0, 0x0, 0x0, 0xE34C, 0x0, - 0x0, 0x0, 0x0, 0xE355, 0x0, 0x0, 0x8D69, 0x0, - 0x0, 0x978D, 0x88BA, 0xE352, 0x0, 0x0, 0x8B8B, 0x0, - 0xE34F, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE350, 0x0, - 0x0, 0x939D, 0xE34E, 0xE34B, 0x0, 0x8A47, 0x90E2, 0x0, - 0x0, 0x8CA6, 0x0, 0x0, 0x0, 0xE357, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0xE354, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE356, - 0x0, 0x0, 0x0, 0xE353, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x8C70, 0x91B1, 0xE358, 0x918E, 0x0, 0x0, 0xE365, - 0x0, 0x0, 0xE361, 0xE35B, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0xE35F, 0x8EF8, 0x88DB, 0xE35A, 0xE362, - 0xE366, 0x8D6A, 0x96D4, 0x0, 0x92D4, 0xE35C, 0x0, 0x0, - 0xE364, 0x0, 0xE359, 0x925D, 0x0, 0xE35E, 0x88BB, 0x96C8, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE35D, - 0x0, 0x0, 0x8BD9, 0x94EA, 0x0, 0x0, 0x0, 0x918D, - 0x0, 0x97CE, 0x8F8F, 0x0, 0x0, 0xE38E, 0x0, 0x0, - 0xE367, 0x0, 0x90FC, 0x0, 0xE363, 0xE368, 0xE36A, 0x0, - 0x92F7, 0xE36D, 0x0, 0x0, 0xE369, 0x0, 0x0, 0x0, - 0x95D2, 0x8AC9, 0x0, 0x0, 0x96C9, 0x0, 0x0, 0x88DC, - 0x0, 0x0, 0xE36C, 0x0, 0x97FB, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0xE36B, 0x0, 0x0, 0x0, 0x0, + 0x8B49, 0x0, 0xE340, 0x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D4, 0xE35C, 0x0, 0x0, 0xE364, 0x0, 0xE359, 0x925D, 0x0, 0xE35E, 0x88BB, 0x96C8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0xE35D, 0x0, 0x0, 0x8BD9, 0x94EA, 0x0, 0x0, 0x0, 0x918D, 0x0, 0x97CE, 0x8F8F, 0x0, 0x0, 0xE38E, 0x0, 0x0, + 0xE367, 0x0, 0x90FC, 0x0, 0xE363, 0xE368, 0xE36A, 0x0, 0x92F7, 0xE36D, 0x0, 0x0, 0xE369, 0x0, 0x0, 0x0, 0x95D2, 0x8AC9, + 0x0, 0x0, 0x96C9, 0x0, 0x0, 0x88DC, 0x0, 0x0, 0xE36C, 0x0, 0x97FB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE36B, + 0x0, 0x0, 0x0, 0x0, }; static u16 Ucs7E[] = { - 0x0, 0x898F, 0x0, 0x0, 0x93EA, 0xE36E, 0x0, 0x0, - 0x0, 0xE375, 0xE36F, 0xE376, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0xE372, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x949B, 0x0, 0x0, 0x8EC8, 0xE374, - 0x0, 0xE371, 0xE377, 0xE370, 0x0, 0x0, 0x8F63, 0x0, - 0x0, 0x0, 0x0, 0x9644, 0x0, 0x0, 0x8F6B, 0x0, - 0x0, 0xE373, 0xE380, 0x0, 0x0, 0xE37B, 0x0, 0xE37E, - 0x0, 0xE37C, 0xE381, 0xE37A, 0x0, 0xE360, 0x90D1, 0x0, - 0x0, 0x94C9, 0x0, 0xE37D, 0x0, 0x0, 0xE378, 0x0, - 0x0, 0x0, 0x9140, 0x8C71, 0x0, 0x8F4A, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x9044, 0x9155, 0xE384, 0x0, - 0x0, 0xE386, 0xE387, 0x0, 0x0, 0xE383, 0xE385, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0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x0, 0x0, 0x0, 0x8BB9, 0x0, 0x0, 0x0, + 0xE445, 0x945C, 0x0, 0x0, }; static u16 Ucs81[] = { - 0x0, 0x0, 0x8E89, 0x0, 0x0, 0x8BBA, 0x90C6, 0x9865, - 0x96AC, 0xE3F5, 0x90D2, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x8B72, 0xE3F8, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0xE3FA, 0x0, 0x0, 0x0, 0x0, - 0x0, 0xE3F9, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE3FB, - 0x0, 0x9245, 0x0, 0x945D, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x92AF, 0x0, 0x0, 0x0, 0x0, 0xE442, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE441, 0x0, - 0x0, 0x0, 0x0, 0xE3FC, 0x0, 0x0, 0x9074, 0x0, - 0x9585, 0xE444, 0x0, 0xE443, 0x8D6F, 0x9872, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE454, - 0x0, 0x0, 0x0, 0x0, 0x0, 0xE448, 0xE449, 0x0, - 0x0, 0x0, 0x0, 0x8EEE, 0x0, 0x0, 0xE447, 0x0, - 0x8D98, 0xE446, 0x0, 0x0, 0xE44A, 0x0, 0x0, 0x0, - 0x92B0, 0x95A0, 0x9142, 0x0, 0x0, 0x0, 0x0, 0x91DA, - 0xE44E, 0x0, 0xE44F, 0xE44B, 0x0, 0x0, 0x0, 0x0, - 0xE44C, 0x0, 0xE44D, 0x0, 0x0, 0x0, 0x0, 0x8D70, - 0x0, 0x0, 0x0, 0xE455, 0x0, 0xE451, 0x0, 0x0, - 0x0, 0x0, 0x9586, 0x0, 0x968C, 0x9547, 0x0, 0x0, - 0xE450, 0x0, 0x0, 0xE453, 0xE452, 0x0, 0x0, 0x0, - 0x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0, 0xE454, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE448, 0xE449, 0x0, 0x0, 0x0, 0x0, 0x8EEE, + 0x0, 0x0, 0xE447, 0x0, 0x8D98, 0xE446, 0x0, 0x0, 0xE44A, 0x0, 0x0, 0x0, 0x92B0, 0x95A0, 0x9142, 0x0, 0x0, 0x0, + 0x0, 0x91DA, 0xE44E, 0x0, 0xE44F, 0xE44B, 0x0, 0x0, 0x0, 0x0, 0xE44C, 0x0, 0xE44D, 0x0, 0x0, 0x0, 0x0, 0x8D70, + 0x0, 0x0, 0x0, 0xE455, 0x0, 0xE451, 0x0, 0x0, 0x0, 0x0, 0x9586, 0x0, 0x968C, 0x9547, 0x0, 0x0, 0xE450, 0x0, + 0x0, 0xE453, 0xE452, 0x0, 0x0, 0x0, 0x9663, 0xE456, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE457, 0x0, 0x0, 0x9156, + 0x0, 0xE458, 0x0, 0x0, 0xE45A, 0x0, 0xE45E, 0x0, 0x0, 0xE45B, 0xE459, 0x945E, 0xE45C, 0x0, 0xE45D, 0x0, 0x0, 0x0, + 0x89B0, 0x0, 0xE464, 0xE45F, 0x0, 0x0, 0x0, 0xE460, 0x0, 0x0, 0x0, 0xE461, 0x0, 0x919F, 0x0, 0x0, 0x0, 0x0, + 0xE463, 0xE462, 0xE465, 0x0, 0x0, 0x0, 0x0, 0xE466, 0xE467, 0x0, 0x0, 0x9062, 0x0, 0x89E7, 0x0, 0xE468, 0x97D5, 0x0, + 0x8EA9, 0x0, 0x0, 0x8F4C, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8E8A, 0x9276, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE469, 0xE46A, + 0x8950, 0x0, 0xE46B, 0x0, }; static u16 Ucs82[] = { - 0x0, 0xE46C, 0xE46D, 0x0, 0x0, 0xE46E, 0x0, 0xE46F, - 0x8BBB, 0x9DA8, 0xE470, 0x0, 0x90E3, 0xE471, 0x8EC9, 0x0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x0, 0x8AA1, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x8991, 0xE492, 0x97E8, 0x91DB, 0x0, 0x0, 0x9563, - 0x0, 0xE49E, 0x0, 0x89D5, 0xE49C, 0x0, 0xE49A, 0xE491, - 0x0, 0xE48F, 0x0, 0xE490, 0x0, 0x8EE1, 0x8BEA, 0x9297, - 0x0, 0x0, 0x0, 0x93CF, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x8970, 0x0, 0xE494, 0xE493, 0x0, 0x0, 0x0, - 0x0, 0xE499, 0xE495, 0xE498, 0x0, 0x0, 0x0, 0x0, + 0x0, 0xE46C, 0xE46D, 0x0, 0x0, 0xE46E, 0x0, 0xE46F, 0x8BBB, 0x9DA8, 0xE470, 0x0, 0x90E3, 0xE471, 0x8EC9, 0x0, 0xE472, 0x0, + 0x98AE, 0x0, 0x0, 0x0, 0xE473, 0x95DC, 0x8ADA, 0x0, 0x0, 0x9143, 0x8F77, 0x0, 0x9591, 0x8F4D, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0xE474, 0x8D71, 0xE475, 0x94CA, 0x0, 0xE484, 0x0, 0x0, 0x0, 0x0, 0xE477, 0x0, 0x91C7, + 0x9495, 0x8CBD, 0xE476, 0x9144, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE478, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x92F8, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE47A, 0xE479, + 0xE47C, 0x0, 0x0, 0xE47B, 0x0, 0xE47D, 0x0, 0x0, 0xE480, 0x0, 0xE47E, 0x0, 0x8ACD, 0x0, 0xE481, 0x0, 0xE482, 0xE483, + 0x0, 0x0, 0x8DAF, 0x97C7, 0x0, 0xE485, 0x9046, 0x0, 0x0, 0x0, 0x8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 0x94B8, 0x0, 0x0, 0x0, 0x0, 0xE57D, + 0x0, 0x0, 0xE57E, 0x9567, 0x94D8, 0xE582, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x91FB, 0xE58C, 0x0, 0xE588, + 0x0, 0x0, 0x89E9, 0x0, }; static u16 Ucs87[] = { - 0xE586, 0x0, 0x9649, 0xE587, 0x0, 0x0, 0xE584, 0x0, - 0xE585, 0xE58A, 0xE58D, 0x0, 0x0, 0xE58B, 0x0, 0x0, - 0x0, 0xE589, 0xE583, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x9277, 0x0, 0xE594, 0x0, 0x96A8, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0xE592, 0x0, 0x0, - 0x0, 0xE593, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0xE58E, 0x0, 0x0, 0xE590, - 0x0, 0x0, 0x0, 0xE591, 0x0, 0x0, 0x0, 0xE58F, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x90E4, 0x0, 0x9858, 0xE598, 0x0, 0xE599, 0x0, - 0x0, 0x0, 0x0, 0xE59F, 0x0, 0x9049, 0x0, 0xE59B, - 0x0, 0xE59E, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE596, - 0xE595, 0x0, 0x0, 0xE5A0, 0x0, 0x0, 0x89DA, 0x0, - 0xE59C, 0x0, 0xE5A1, 0x0, 0x0, 0x0, 0xE59D, 0x0, - 0x0, 0x0, 0x0, 0x0, 0xE59A, 0x0, 0x92B1, 0x0, - 0xE597, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9488, - 0x0, 0x0, 0xE5A5, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x975A, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0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x8C8D, 0x0, 0xE663, 0x0, 0x0, - 0x0, 0x0, 0x964B, 0x0, 0x0, 0x90DD, 0x0, 0x0, - 0x0, 0x8B96, 0x0, 0x96F3, 0x9169, 0x0, 0xE664, 0x0, - 0x0, 0x0, 0x9066, 0x9290, 0x8FD8, 0x0, 0x0, 0x0, - 0x0, 0xE665, 0x0, 0x0, 0x0, 0x0, 0xE668, 0x0, - 0xE669, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x8DBC, 0x91C0, 0xE667, 0x0, 0x8FD9, 0x955D, 0x0, 0x0, - 0x0, 0x0, 0x0, 0xE666, 0x0, 0x0, 0x8E8C, 0x0, - 0x8972, 0x0, 0xE66D, 0x8C77, 0x0, 0x0, 0x8E8E, 0x0, - 0x0, 0x8E8D, 0x0, 0x986C, 0xE66C, 0xE66B, 0x9146, 0x0, - 0x8B6C, 0x9862, 0x8A59, 0x8FDA, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0xE66A, 0x0, 0x0, 0x0, - 0x0, 0x0, 0xE66F, 0x0, 0xE670, 0xE66E, 0x0, 0x8CD6, - 0x0, 0x975F, 0x0, 0x0, 0x8E8F, 0x9446, 0x0, 0x0, - 0x0, 0xE673, 0x0, 0x90BE, 0x0, 0x9261, 0x0, 0x0, - 0x9755, 0x0, 0xE676, 0x0, 0x0, 0x0, 0x8CEA, 0x0, - 0x90BD, 0xE672, 0x0, 0xE677, 0x8CEB, 0xE674, 0xE675, 0x0, - 0xE671, 0x0, 0x0, 0x0, 0x90E0, 0x93C7, 0x0, 0x0, - 0x924E, 0x0, 0x89DB, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x94EE, 0x0, 0x0, 0x8B62, 0x0, 0x0, 0x92B2, - 0x0, 0x0, 0xE67A, 0x0, 0xE678, 0x0, 0x0, 0x926B, - 0x0, 0x0, 0x0, 0x90BF, 0x8AD0, 0xE679, 0x0, 0x907A, - 0x0, 0x0, 0x97C8, 0x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E670, 0xE66E, 0x0, 0x8CD6, 0x0, 0x975F, 0x0, 0x0, 0x8E8F, 0x9446, 0x0, 0x0, + 0x0, 0xE673, 0x0, 0x90BE, 0x0, 0x9261, 0x0, 0x0, 0x9755, 0x0, 0xE676, 0x0, 0x0, 0x0, 0x8CEA, 0x0, 0x90BD, 0xE672, + 0x0, 0xE677, 0x8CEB, 0xE674, 0xE675, 0x0, 0xE671, 0x0, 0x0, 0x0, 0x90E0, 0x93C7, 0x0, 0x0, 0x924E, 0x0, 0x89DB, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x94EE, 0x0, 0x0, 0x8B62, 0x0, 0x0, 0x92B2, 0x0, 0x0, 0xE67A, 0x0, 0xE678, 0x0, + 0x0, 0x926B, 0x0, 0x0, 0x0, 0x90BF, 0x8AD0, 0xE679, 0x0, 0x907A, 0x0, 0x0, 0x97C8, 0x0, 0x0, 0x0, 0x985F, 0x0, + 0x0, 0x0, 0xE67B, 0xE687, 0x92B3, 0x0, 0xE686, 0x0, 0xE683, 0xE68B, 0xE684, 0x0, 0xE680, 0x0, 0x92FA, 0xE67E, 0x0, 0x0, + 0x0, 0xE67C, 0x0, 0x9740, 0x8E90, 0x0, 0x0, 0xE681, 0x0, 0xE67D, 0x0, 0x0, 0x0, 0xE685, 0x8F94, 0x0, 0x8CBF, 0x0, + 0x0, 0x0, 0x91F8, 0x0, }; static u16 Ucs8B[] = { - 0x9664, 0x8979, 0x88E0, 0x0, 0x93A3, 0x0, 0x0, 0xE689, - 0x0, 0x0, 0x0, 0x0, 0xE688, 0x0, 0x93E4, 0x0, - 0xE68D, 0x0, 0x0, 0x0, 0xE682, 0x0, 0xE68C, 0xE68E, - 0x0, 0x8CAA, 0xE68A, 0x8D75, 0x0, 0x8ED3, 0x0, 0x0, - 0xE68F, 0x9777, 0x0, 0x0, 0x0, 0x0, 0xE692, 0x0, - 0xE695, 0x0, 0x0, 0xE693, 0x9554, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0,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x0, 0xE765, + 0xE764, 0x8C79, 0xE767, 0x0, }; static u16 Ucs8F[] = { - 0x0, 0x0, 0x0, 0x8A72, 0x0, 0xE769, 0x0, 0x0, - 0x0, 0x8DDA, 0xE768, 0x0, 0xE771, 0x0, 0x0, 0x0, - 0x0, 0x0, 0xE76B, 0xE76D, 0x95E3, 0xE76A, 0x0, 0x0, - 0x0, 0xE76C, 0x0, 0xE770, 0xE76E, 0x8B50, 0x0, 0xE76F, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE772, 0x0, - 0x0, 0x9479, 0x97D6, 0x0, 0x0, 0x0, 0x0, 0x8F53, - 0x0, 0x0, 0x0, 0xE773, 0x0, 0x0, 0x0, 0x0, - 0x9741, 0xE775, 0x0, 0xE774, 0x0, 0x0, 0xE778, 0x9760, - 0x0, 0x0, 0xE777, 0x0, 0x8A8D, 0xE776, 0xE77B, 0x0, - 0x0, 0xE77A, 0x0, 0x0, 0xE779, 0x9351, 0xE77C, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE77D, - 0x0, 0x0, 0x0, 0x0, 0xE77E, 0x0, 0x0, 0x8D8C, - 0x0, 0x8C44, 0xE780, 0xE781, 0xE782, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x9068, 0xE783, 0x0, 0x8EAB, 0xE784, - 0x0, 0x0, 0x0, 0xE785, 0x0, 0x0, 0x0, 0x999F, - 0x999E, 0x0, 0x0, 0x0, 0x0, 0xE786, 0xE390, 0xE787, - 0x9243, 0x904A, 0x945F, 0x0, 0x0, 0x0, 0x0, 0xE788, - 0x0, 0x0, 0x95D3, 0x92D2, 0x8D9E, 0x0, 0x0, 0x9248, - 0x0, 0x0, 0x8949, 0x0, 0x9698, 0x9076, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8C7D, 0x0, - 0x0, 0x8BDF, 0x0, 0x0, 0x95D4, 0x0, 0x0, 0x0, - 0x0, 0x0, 0xE789, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0xE78B, 0x0, 0x0, 0xE78A, 0x89DE, 0x0, - 0x0, 0x93F4, 0xE78C, 0x9497, 0x0, 0x9352, 0x0, 0xE78D, - 0x8F71, 0x0, 0x0, 0x0, 0xE78F, 0x0, 0x0, 0x96C0, - 0xE79E, 0xE791, 0xE792, 0x0, 0x0, 0x92C7, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x8A72, 0x0, 0xE769, 0x0, 0x0, 0x0, 0x8DDA, 0xE768, 0x0, 0xE771, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xE76B, 0xE76D, 0x95E3, 0xE76A, 0x0, 0x0, 0x0, 0xE76C, 0x0, 0xE770, 0xE76E, 0x8B50, 0x0, 0xE76F, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0xE772, 0x0, 0x0, 0x9479, 0x97D6, 0x0, 0x0, 0x0, 0x0, 0x8F53, 0x0, 0x0, 0x0, 0xE773, 0x0, 0x0, + 0x0, 0x0, 0x9741, 0xE775, 0x0, 0xE774, 0x0, 0x0, 0xE778, 0x9760, 0x0, 0x0, 0xE777, 0x0, 0x8A8D, 0xE776, 0xE77B, 0x0, + 0x0, 0xE77A, 0x0, 0x0, 0xE779, 0x9351, 0xE77C, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE77D, 0x0, 0x0, + 0x0, 0x0, 0xE77E, 0x0, 0x0, 0x8D8C, 0x0, 0x8C44, 0xE780, 0xE781, 0xE782, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x9068, 0xE783, 0x0, 0x8EAB, 0xE784, 0x0, 0x0, + 0x0, 0xE785, 0x0, 0x0, 0x0, 0x999F, 0x999E, 0x0, 0x0, 0x0, 0x0, 0xE786, 0xE390, 0xE787, 0x9243, 0x904A, 0x945F, 0x0, + 0x0, 0x0, 0x0, 0xE788, 0x0, 0x0, 0x95D3, 0x92D2, 0x8D9E, 0x0, 0x0, 0x9248, 0x0, 0x0, 0x8949, 0x0, 0x9698, 0x9076, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8C7D, 0x0, 0x0, 0x8BDF, 0x0, 0x0, 0x95D4, 0x0, 0x0, 0x0, + 0x0, 0x0, 0xE789, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xE78B, 0x0, 0x0, 0xE78A, 0x89DE, 0x0, 0x0, 0x93F4, + 0xE78C, 0x9497, 0x0, 0x9352, 0x0, 0xE78D, 0x8F71, 0x0, 0x0, 0x0, 0xE78F, 0x0, 0x0, 0x96C0, 0xE79E, 0xE791, 0xE792, 0x0, + 0x0, 0x92C7, 0x0, 0x0, }; static u16 Ucs90[] = { - 0x91DE, 0x9197, 0x0, 0x93A6, 0x0, 0xE790, 0x8B74, 0x0, - 0x0, 0x0, 0x0, 0xE799, 0x0, 0xE796, 0xE7A3, 0x93A7, - 0x9280, 0xE793, 0x0, 0x92FC, 0x9372, 0xE794, 0xE798, 0x9080, - 0x0,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x8196, 0x817B, 0x8143, 0x0, 0x8144, 0x815E, - 0x824F, 0x8250, 0x8251, 0x8252, 0x8253, 0x8254, 0x8255, 0x8256, - 0x8257, 0x8258, 0x8146, 0x8147, 0x8183, 0x8181, 0x8184, 0x8148, - 0x8197, 0x8260, 0x8261, 0x8262, 0x8263, 0x8264, 0x8265, 0x8266, - 0x8267, 0x8268, 0x8269, 0x826A, 0x826B, 0x826C, 0x826D, 0x826E, - 0x826F, 0x8270, 0x8271, 0x8272, 0x8273, 0x8274, 0x8275, 0x8276, - 0x8277, 0x8278, 0x8279, 0x816D, 0x0, 0x816E, 0x814F, 0x8151, - 0x814D, 0x8281, 0x8282, 0x8283, 0x8284, 0x8285, 0x8286, 0x8287, - 0x8288, 0x8289, 0x828A, 0x828B, 0x828C, 0x828D, 0x828E, 0x828F, - 0x8290, 0x8291, 0x8292, 0x8293, 0x8294, 0x8295, 0x8296, 0x8297, - 0x8298, 0x8299, 0x829A, 0x816F, 0x8162, 0x8170, 0x0, 0x0, - 0x0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, - 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, - 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, - 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, - 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, - 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, - 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, - 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x8150, 0x0, 0x818F, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x8149, 0x0, 0x8194, 0x8190, 0x8193, 0x8195, 0x0, 0x8169, 0x816A, 0x8196, 0x817B, 0x8143, 0x0, 0x8144, 0x815E, 0x824F, 0x8250, + 0x8251, 0x8252, 0x8253, 0x8254, 0x8255, 0x8256, 0x8257, 0x8258, 0x8146, 0x8147, 0x8183, 0x8181, 0x8184, 0x8148, 0x8197, 0x8260, 0x8261, 0x8262, + 0x8263, 0x8264, 0x8265, 0x8266, 0x8267, 0x8268, 0x8269, 0x826A, 0x826B, 0x826C, 0x826D, 0x826E, 0x826F, 0x8270, 0x8271, 0x8272, 0x8273, 0x8274, + 0x8275, 0x8276, 0x8277, 0x8278, 0x8279, 0x816D, 0x0, 0x816E, 0x814F, 0x8151, 0x814D, 0x8281, 0x8282, 0x8283, 0x8284, 0x8285, 0x8286, 0x8287, + 0x8288, 0x8289, 0x828A, 0x828B, 0x828C, 0x828D, 0x828E, 0x828F, 0x8290, 0x8291, 0x8292, 0x8293, 0x8294, 0x8295, 0x8296, 0x8297, 0x8298, 0x8299, + 0x829A, 0x816F, 0x8162, 0x8170, 0x0, 0x0, 0x0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, + 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, + 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8150, 0x0, 0x818F, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, }; static u16* UcsSjisTable[] = { - Ucs00, NULL, NULL, Ucs03, Ucs04, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - Ucs20, Ucs21, Ucs22, Ucs23, NULL, Ucs25, Ucs26, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - Ucs30, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, Ucs4E, Ucs4F, - Ucs50, Ucs51, Ucs52, Ucs53, Ucs54, Ucs55, Ucs56, Ucs57, - Ucs58, Ucs59, Ucs5A, Ucs5B, Ucs5C, Ucs5D, Ucs5E, Ucs5F, - Ucs60, Ucs61, Ucs62, Ucs63, Ucs64, Ucs65, Ucs66, Ucs67, - Ucs68, Ucs69, Ucs6A, Ucs6B, Ucs6C, Ucs6D, Ucs6E, Ucs6F, - Ucs70, Ucs71, Ucs72, Ucs73, Ucs74, Ucs75, Ucs76, Ucs77, - Ucs78, Ucs79, Ucs7A, Ucs7B, Ucs7C, Ucs7D, Ucs7E, Ucs7F, - Ucs80, Ucs81, Ucs82, Ucs83, Ucs84, Ucs85, Ucs86, Ucs87, - Ucs88, Ucs89, Ucs8A, Ucs8B, Ucs8C, Ucs8D, Ucs8E, Ucs8F, - Ucs90, Ucs91, Ucs92, Ucs93, Ucs94, Ucs95, Ucs96, Ucs97, - Ucs98, Ucs99, Ucs9A, Ucs9B, Ucs9C, Ucs9D, Ucs9E, Ucs9F, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, UcsFF -}; + Ucs00, NULL, NULL, Ucs03, Ucs04, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, Ucs20, Ucs21, Ucs22, Ucs23, NULL, Ucs25, Ucs26, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, Ucs30, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, Ucs4E, Ucs4F, + Ucs50, Ucs51, Ucs52, Ucs53, Ucs54, Ucs55, Ucs56, Ucs57, Ucs58, Ucs59, Ucs5A, Ucs5B, Ucs5C, Ucs5D, Ucs5E, Ucs5F, Ucs60, Ucs61, Ucs62, Ucs63, + Ucs64, Ucs65, Ucs66, Ucs67, Ucs68, Ucs69, Ucs6A, Ucs6B, Ucs6C, Ucs6D, Ucs6E, Ucs6F, Ucs70, Ucs71, Ucs72, Ucs73, Ucs74, Ucs75, Ucs76, Ucs77, + Ucs78, Ucs79, Ucs7A, Ucs7B, Ucs7C, Ucs7D, Ucs7E, Ucs7F, Ucs80, Ucs81, Ucs82, Ucs83, Ucs84, Ucs85, Ucs86, Ucs87, Ucs88, Ucs89, Ucs8A, Ucs8B, + Ucs8C, Ucs8D, Ucs8E, Ucs8F, Ucs90, Ucs91, Ucs92, Ucs93, Ucs94, Ucs95, Ucs96, Ucs97, Ucs98, Ucs99, Ucs9A, Ucs9B, Ucs9C, Ucs9D, Ucs9E, Ucs9F, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, UcsFF}; -#endif // OS_SJIS_UCS_H +#endif // OS_SJIS_UCS_H diff --git a/libs/RVL_SDK/include/private/ai.h b/libs/RVL_SDK/include/private/ai.h index 4fc42bd5..61f44952 100644 --- a/libs/RVL_SDK/include/private/ai.h +++ b/libs/RVL_SDK/include/private/ai.h @@ -1,18 +1,18 @@ #ifndef PRIVATE_AI_H #define PRIVATE_AI_H -#include -#include #include +#include +#include #ifdef __cplusplus extern "C" { #endif -void __AIDHandler(__OSInterrupt interrupt, OSContext* context) ; +void __AIDHandler(__OSInterrupt interrupt, OSContext* context); #ifdef __cplusplus } #endif -#endif // PRIVATE_AI_H +#endif // PRIVATE_AI_H diff --git a/libs/RVL_SDK/include/private/ax.h b/libs/RVL_SDK/include/private/ax.h index 5e09a19c..dca40250 100644 --- a/libs/RVL_SDK/include/private/ax.h +++ b/libs/RVL_SDK/include/private/ax.h @@ -9,9 +9,9 @@ #include #include -#include #include +#include #include -#endif // PRIVATE_AX_H +#endif // PRIVATE_AX_H diff --git a/libs/RVL_SDK/include/private/ax/AXAlloc.h b/libs/RVL_SDK/include/private/ax/AXAlloc.h index b30d71c3..1e5e7ba0 100644 --- a/libs/RVL_SDK/include/private/ax/AXAlloc.h +++ b/libs/RVL_SDK/include/private/ax/AXAlloc.h @@ -7,20 +7,20 @@ extern "C" { #endif -AXVPB* __AXGetStackHead(u32 priority); -void __AXServiceCallbackStack(); -void __AXInitVoiceStacks(); -void __AXAllocInit(); -void __AXPushFreeStack(AXVPB* vpb); -AXVPB* __AXPopFreeStack(); -void __AXPushCallbackStack(AXVPB* vpb); -AXVPB* __AXPopCallbackStack(); -void __AXRemoveFromStack(AXVPB* vpb); -void __AXPushStackHead(AXVPB* vpb, u32 priority); -AXVPB* __AXPopStackFromBottom(u32 priority); +AXVPB* __AXGetStackHead(u32 priority); +void __AXServiceCallbackStack(); +void __AXInitVoiceStacks(); +void __AXAllocInit(); +void __AXPushFreeStack(AXVPB* vpb); +AXVPB* __AXPopFreeStack(); +void __AXPushCallbackStack(AXVPB* vpb); +AXVPB* __AXPopCallbackStack(); +void __AXRemoveFromStack(AXVPB* vpb); +void __AXPushStackHead(AXVPB* vpb, u32 priority); +AXVPB* __AXPopStackFromBottom(u32 priority); #ifdef __cplusplus } #endif -#endif // PRIVATE_AX_ALLOC_H +#endif // PRIVATE_AX_ALLOC_H diff --git a/libs/RVL_SDK/include/private/ax/AXAux.h b/libs/RVL_SDK/include/private/ax/AXAux.h index 913c42fd..4f34bc74 100644 --- a/libs/RVL_SDK/include/private/ax/AXAux.h +++ b/libs/RVL_SDK/include/private/ax/AXAux.h @@ -7,29 +7,29 @@ extern "C" { #endif -void __AXAuxInit(); +void __AXAuxInit(); -void __AXGetAuxAInput(void** out); -void __AXGetAuxAOutput(void** out); -void __AXGetAuxAInputDpl2(void** out); -void __AXGetAuxAOutputDpl2R(void** out); -void __AXGetAuxAOutputDpl2Ls(void** out); -void __AXGetAuxAOutputDpl2Rs(void** out); +void __AXGetAuxAInput(void** out); +void __AXGetAuxAOutput(void** out); +void __AXGetAuxAInputDpl2(void** out); +void __AXGetAuxAOutputDpl2R(void** out); +void __AXGetAuxAOutputDpl2Ls(void** out); +void __AXGetAuxAOutputDpl2Rs(void** out); -void __AXGetAuxBInput(void** out); -void __AXGetAuxBOutput(void** out); -void __AXGetAuxBInputDpl2(void** out); -void __AXGetAuxBOutputDpl2R(void** out); -void __AXGetAuxBOutputDpl2Ls(void** out); -void __AXGetAuxBOutputDpl2Rs(void** out); +void __AXGetAuxBInput(void** out); +void __AXGetAuxBOutput(void** out); +void __AXGetAuxBInputDpl2(void** out); +void __AXGetAuxBOutputDpl2R(void** out); +void __AXGetAuxBOutputDpl2Ls(void** out); +void __AXGetAuxBOutputDpl2Rs(void** out); -void __AXGetAuxCInput(void** out); -void __AXGetAuxCOutput(void** out); +void __AXGetAuxCInput(void** out); +void __AXGetAuxCOutput(void** out); -void __AXProcessAux(); +void __AXProcessAux(); #ifdef __cplusplus } #endif -#endif // PRIVATE_AX_AUX_H +#endif // PRIVATE_AX_AUX_H diff --git a/libs/RVL_SDK/include/private/ax/AXCL.h b/libs/RVL_SDK/include/private/ax/AXCL.h index c7baf43d..f3b4a33e 100644 --- a/libs/RVL_SDK/include/private/ax/AXCL.h +++ b/libs/RVL_SDK/include/private/ax/AXCL.h @@ -12,19 +12,19 @@ extern "C" { // Each command takes up two bytes #define AX_CL_SIZE (AX_CL_MAX_CMD * sizeof(u16)) -extern u32 __AXClMode; +extern u32 __AXClMode; -void __AXClInit(); +void __AXClInit(); -u32 __AXGetCommandListCycles(); -void* __AXGetCommandListAddress(); +u32 __AXGetCommandListCycles(); +void* __AXGetCommandListAddress(); -void __AXWriteToCommandList(u16 cmd); +void __AXWriteToCommandList(u16 cmd); -void __AXNextFrame(void* surround, void* lr, void* rmt); +void __AXNextFrame(void* surround, void* lr, void* rmt); #ifdef __cplusplus } #endif -#endif // PRIVATE_AX_CL_H +#endif // PRIVATE_AX_CL_H diff --git a/libs/RVL_SDK/include/private/ax/AXComp.h b/libs/RVL_SDK/include/private/ax/AXComp.h index 55b95ac6..9f12b34f 100644 --- a/libs/RVL_SDK/include/private/ax/AXComp.h +++ b/libs/RVL_SDK/include/private/ax/AXComp.h @@ -13,4 +13,4 @@ extern u16 __AXCompressorTable[]; } #endif -#endif // PRIVATE_AX_COMP_H +#endif // PRIVATE_AX_COMP_H diff --git a/libs/RVL_SDK/include/private/ax/AXOut.h b/libs/RVL_SDK/include/private/ax/AXOut.h index 2272c424..cc39479e 100644 --- a/libs/RVL_SDK/include/private/ax/AXOut.h +++ b/libs/RVL_SDK/include/private/ax/AXOut.h @@ -7,14 +7,14 @@ extern "C" { #endif -u32 __AXOutNewFrame(); -void __AXOutAiCallback(); -void __AXOutInitDSP(); +u32 __AXOutNewFrame(); +void __AXOutAiCallback(); +void __AXOutInitDSP(); -void __AXOutInit(u32 mode); +void __AXOutInit(u32 mode); #ifdef __cplusplus } #endif -#endif // PRIVATE_AX_OUT_H +#endif // PRIVATE_AX_OUT_H diff --git a/libs/RVL_SDK/include/private/ax/AXProf.h b/libs/RVL_SDK/include/private/ax/AXProf.h index 79f86382..09f2ab94 100644 --- a/libs/RVL_SDK/include/private/ax/AXProf.h +++ b/libs/RVL_SDK/include/private/ax/AXProf.h @@ -8,25 +8,25 @@ extern "C" { #endif typedef struct _AXPROFILE { - s64 timeBegin; // 0x00 - - s64 timeProcessAuxBegin; // 0x08 - s64 timeProcessAuxEnd; // 0x10 - + s64 timeBegin; // 0x00 + + s64 timeProcessAuxBegin; // 0x08 + s64 timeProcessAuxEnd; // 0x10 + s64 timeUserFrameBegin; // 0x18 s64 timeUserFrameEnd; // 0x20 - - s64 timeEnd; // 0x28 - - s32 numVoices; // 0x30 - + + s64 timeEnd; // 0x28 + + s32 numVoices; // 0x30 + int padding; } AXPROFILE; -AXPROFILE* __AXGetCurrentProfile(); +AXPROFILE* __AXGetCurrentProfile(); #ifdef __cplusplus } #endif -#endif // PRIVATE_AX_PROFILE_H +#endif // PRIVATE_AX_PROFILE_H diff --git a/libs/RVL_SDK/include/private/ax/AXSPB.h b/libs/RVL_SDK/include/private/ax/AXSPB.h index 6c8bbf31..a0fe67a5 100644 --- a/libs/RVL_SDK/include/private/ax/AXSPB.h +++ b/libs/RVL_SDK/include/private/ax/AXSPB.h @@ -8,101 +8,100 @@ extern "C" { #endif typedef struct _AXSPB { - u16 dpopLHi; // 0x00 - u16 dpopLLo; // 0x02 - s16 dpopLDelta; // 0x04 + u16 dpopLHi; // 0x00 + u16 dpopLLo; // 0x02 + s16 dpopLDelta; // 0x04 - u16 dpopRHi; // 0x06 - u16 dpopRLo; // 0x08 - s16 dpopRDelta; // 0x0A + u16 dpopRHi; // 0x06 + u16 dpopRLo; // 0x08 + s16 dpopRDelta; // 0x0A - u16 dpopSHi; // 0x0C - u16 dpopSLo; // 0x0E - s16 dpopSDelta; // 0x10 - - u16 dpopALHi; // 0x12 - u16 dpopALLo; // 0x14 - s16 dpopALDelta; // 0x16 + u16 dpopSHi; // 0x0C + u16 dpopSLo; // 0x0E + s16 dpopSDelta; // 0x10 - u16 dpopARHi; // 0x18 - u16 dpopARLo; // 0x1A - s16 dpopARDelta; // 0x1C + u16 dpopALHi; // 0x12 + u16 dpopALLo; // 0x14 + s16 dpopALDelta; // 0x16 - u16 dpopASHi; // 0x1E - u16 dpopASLo; // 0x20 - s16 dpopASDelta; // 0x22 - - u16 dpopBLHi; // 0x24 - u16 dpopBLLo; // 0x26 - s16 dpopBLDelta; // 0x28 + u16 dpopARHi; // 0x18 + u16 dpopARLo; // 0x1A + s16 dpopARDelta; // 0x1C - u16 dpopBRHi; // 0x2A - u16 dpopBRLo; // 0x2C - s16 dpopBRDelta; // 0x2E + u16 dpopASHi; // 0x1E + u16 dpopASLo; // 0x20 + s16 dpopASDelta; // 0x22 - u16 dpopBSHi; // 0x30 - u16 dpopBSLo; // 0x32 - s16 dpopBSDelta; // 0x34 - - u16 dpopCLHi; // 0x36 - u16 dpopCLLo; // 0x38 - s16 dpopCLDelta; // 0x3A + u16 dpopBLHi; // 0x24 + u16 dpopBLLo; // 0x26 + s16 dpopBLDelta; // 0x28 - u16 dpopCRHi; // 0x3C - u16 dpopCRLo; // 0x3E - s16 dpopCRDelta; // 0x40 + u16 dpopBRHi; // 0x2A + u16 dpopBRLo; // 0x2C + s16 dpopBRDelta; // 0x2E - u16 dpopCSHi; // 0x42 - u16 dpopCSLo; // 0x44 - s16 dpopCSDelta; // 0x46 - - u16 dpopMain0Hi; // 0x48 - u16 dpopMain0Lo; // 0x4A - s16 dpopMain0Delta; // 0x4C + u16 dpopBSHi; // 0x30 + u16 dpopBSLo; // 0x32 + s16 dpopBSDelta; // 0x34 + + u16 dpopCLHi; // 0x36 + u16 dpopCLLo; // 0x38 + s16 dpopCLDelta; // 0x3A + + u16 dpopCRHi; // 0x3C + u16 dpopCRLo; // 0x3E + s16 dpopCRDelta; // 0x40 + + u16 dpopCSHi; // 0x42 + u16 dpopCSLo; // 0x44 + s16 dpopCSDelta; // 0x46 + + u16 dpopMain0Hi; // 0x48 + u16 dpopMain0Lo; // 0x4A + s16 dpopMain0Delta; // 0x4C u16 dpopAux0Hi; // 0x4E u16 dpopAux0Lo; // 0x50 s16 dpopAux0Delta; // 0x52 - - u16 dpopMain1Hi; // 0x54 - u16 dpopMain1Lo; // 0x56 - s16 dpopMain1Delta; // 0x58 + + u16 dpopMain1Hi; // 0x54 + u16 dpopMain1Lo; // 0x56 + s16 dpopMain1Delta; // 0x58 u16 dpopAux1Hi; // 0x5A u16 dpopAux1Lo; // 0x5C s16 dpopAux1Delta; // 0x5E - - u16 dpopMain2Hi; // 0x60 - u16 dpopMain2Lo; // 0x62 - s16 dpopMain2Delta; // 0x64 + + u16 dpopMain2Hi; // 0x60 + u16 dpopMain2Lo; // 0x62 + s16 dpopMain2Delta; // 0x64 u16 dpopAux2Hi; // 0x66 u16 dpopAux2Lo; // 0x68 s16 dpopAux2Delta; // 0x6A - u16 dpopMain3Hi; // 0x6C - u16 dpopMain3Lo; // 0x6E - s16 dpopMain3Delta; // 0x70 + u16 dpopMain3Hi; // 0x6C + u16 dpopMain3Lo; // 0x6E + s16 dpopMain3Delta; // 0x70 u16 dpopAux3Hi; // 0x72 u16 dpopAux3Lo; // 0x74 s16 dpopAux3Delta; // 0x76 } AXSPB; +void __AXSPBInit(); -void __AXSPBInit(); +AXSPB* __AXGetStudio(); -AXSPB* __AXGetStudio(); +void __AXDepopFadeMain(s32* all, s32* value, s16* depop) NO_INLINE; +void __AXDepopFadeRmt(s32* all, s32* value, s16* depop) NO_INLINE; -void __AXDepopFadeMain(s32* all, s32* value, s16* depop) NO_INLINE; -void __AXDepopFadeRmt(s32* all, s32* value, s16* depop) NO_INLINE; +void __AXPrintStudio(); -void __AXPrintStudio(); - -void __AXDepopVoice(AXPB* pb); +void __AXDepopVoice(AXPB* pb); #ifdef __cplusplus } #endif -#endif // PRIVATE_AX_STUDIO_H +#endif // PRIVATE_AX_STUDIO_H diff --git a/libs/RVL_SDK/include/private/ax/AXVPB.h b/libs/RVL_SDK/include/private/ax/AXVPB.h index 4f000fff..d186ca35 100644 --- a/libs/RVL_SDK/include/private/ax/AXVPB.h +++ b/libs/RVL_SDK/include/private/ax/AXVPB.h @@ -7,16 +7,16 @@ extern "C" { #endif -s32 __AXGetNumVoices(); -void __AXServiceVPB(AXVPB* vpb); -void __AXDumpVPB(AXVPB* vpb); -void __AXSyncPBs(u32 baseCycles); -AXPB* __AXGetPBs(); -void __AXSetPBDefault(AXVPB* vpb); -void __AXVPBInit(); +s32 __AXGetNumVoices(); +void __AXServiceVPB(AXVPB* vpb); +void __AXDumpVPB(AXVPB* vpb); +void __AXSyncPBs(u32 baseCycles); +AXPB* __AXGetPBs(); +void __AXSetPBDefault(AXVPB* vpb); +void __AXVPBInit(); #ifdef __cplusplus } #endif -#endif // PRIVATE_AX_VPB_H +#endif // PRIVATE_AX_VPB_H diff --git a/libs/RVL_SDK/include/private/axfx.h b/libs/RVL_SDK/include/private/axfx.h index f9dde385..f4e0853b 100644 --- a/libs/RVL_SDK/include/private/axfx.h +++ b/libs/RVL_SDK/include/private/axfx.h @@ -3,10 +3,10 @@ #include -extern AXFXAllocHook __AXFXAlloc; -extern AXFXFreeHook __AXFXFree; +extern AXFXAllocHook __AXFXAlloc; +extern AXFXFreeHook __AXFXFree; -f32* __AXFXGetSrcCoef(u32 i); -s32* __AXFXGetLfoSinTable(); +f32* __AXFXGetSrcCoef(u32 i); +s32* __AXFXGetLfoSinTable(); -#endif // PRIVATE_AXFX_H +#endif // PRIVATE_AXFX_H diff --git a/libs/RVL_SDK/include/private/bus.h b/libs/RVL_SDK/include/private/bus.h index ed62ffc1..9c2030f0 100644 --- a/libs/RVL_SDK/include/private/bus.h +++ b/libs/RVL_SDK/include/private/bus.h @@ -3,19 +3,19 @@ #include -#define BUSRead32(a) (*(vu32*)(a)) -#define BUSWrite32(a, v) (*(vu32*)(a)) = ((u32)(v)) +#define BUSRead32(a) (*(vu32*)(a)) +#define BUSWrite32(a, v) (*(vu32*)(a)) = ((u32)(v)) -#define BUSRead16(a) (*(vu16*)(a)) -#define BUSWrite16(a, v) (*(vu16*)(a)) = ((u16)(v)) +#define BUSRead16(a) (*(vu16*)(a)) +#define BUSWrite16(a, v) (*(vu16*)(a)) = ((u16)(v)) -#define BUSRead8(a) (*(vu8*)(a)) -#define BUSWrite8(a, v) (*(vu8*)(a)) = ((u8)(v)) +#define BUSRead8(a) (*(vu8*)(a)) +#define BUSWrite8(a, v) (*(vu8*)(a)) = ((u8)(v)) -#define RAMReadPtr(a) ((void*)((*(u32*)(a)))) +#define RAMReadPtr(a) ((void*)((*(u32*)(a)))) -#define SET_FLAG(x, b) (x) |= (b) -#define CLEAR_FLAG(x, b) (x) &= (~(b)) -#define HAS_FLAG(x, b) ((x) & b) +#define SET_FLAG(x, b) (x) |= (b) +#define CLEAR_FLAG(x, b) (x) &= (~(b)) +#define HAS_FLAG(x, b) ((x) & b) -#endif // PRIVATE_BUS_H +#endif // PRIVATE_BUS_H diff --git a/libs/RVL_SDK/include/private/card.h b/libs/RVL_SDK/include/private/card.h index 14dc14ac..0b9e5dff 100644 --- a/libs/RVL_SDK/include/private/card.h +++ b/libs/RVL_SDK/include/private/card.h @@ -13,8 +13,8 @@ extern "C" { /* NET */ -extern u16 __CARDVendorID; -extern u8 __CARDPermMask; +extern u16 __CARDVendorID; +extern u8 __CARDPermMask; /* UNLOCK */ s32 __CARDUnlock(s32 chan, u8 flashID[12]); @@ -32,62 +32,62 @@ s32 __CARDRead(s32 chan, u32 addr, s32 length, void* dst, CARDCallback callback) s32 __CARDWrite(s32 chan, u32 addr, s32 length, void* dst, CARDCallback callback); /* OPEN */ -BOOL __CARDCompareFileName(CARDDir* ent, const char* fileName); -s32 __CARDGetFileNo(CARDControl* card, const char* fileName, s32* pfileNo); -BOOL __CARDIsOpened(CARDControl* card, s32 fileNo); -s32 __CARDIsReadable(CARDControl* card, CARDDir* ent); -s32 __CARDIsWritable(CARDControl* card, CARDDir* ent); +BOOL __CARDCompareFileName(CARDDir* ent, const char* fileName); +s32 __CARDGetFileNo(CARDControl* card, const char* fileName, s32* pfileNo); +BOOL __CARDIsOpened(CARDControl* card, s32 fileNo); +s32 __CARDIsReadable(CARDControl* card, CARDDir* ent); +s32 __CARDIsWritable(CARDControl* card, CARDDir* ent); /* MOUNT */ -void __CARDMountCallback(s32 chan, s32 result); +void __CARDMountCallback(s32 chan, s32 result); /* DIR */ -s32 __CARDUpdateDir(s32 chan, CARDCallback callback); -CARDDir* __CARDGetDirBlock(CARDControl* card); +s32 __CARDUpdateDir(s32 chan, CARDCallback callback); +CARDDir* __CARDGetDirBlock(CARDControl* card); /* CHECK */ -void __CARDCheckSum(void* ptr, int length, u16* checksum, u16* checksumInv); -s32 __CARDVerify(CARDControl* card); +void __CARDCheckSum(void* ptr, int length, u16* checksum, u16* checksumInv); +s32 __CARDVerify(CARDControl* card); /* BLOCK */ -void* __CARDGetFatBlock(CARDControl* card); -s32 __CARDAllocBlock(s32 chan, u32 cBlock, CARDCallback callback); -s32 __CARDFreeBlock(s32 chan, u16 nBlock, CARDCallback callback); -s32 __CARDUpdateFatBlock(s32 chan, u16* fat, CARDCallback callback); +void* __CARDGetFatBlock(CARDControl* card); +s32 __CARDAllocBlock(s32 chan, u32 cBlock, CARDCallback callback); +s32 __CARDFreeBlock(s32 chan, u16 nBlock, CARDCallback callback); +s32 __CARDUpdateFatBlock(s32 chan, u16* fat, CARDCallback callback); /* BIOS */ -extern CARDControl __CARDBlock[2]; +extern CARDControl __CARDBlock[2]; -extern DVDDiskID* __CARDDiskID; -extern DVDDiskID __CARDDiskNone; +extern DVDDiskID* __CARDDiskID; +extern DVDDiskID __CARDDiskNone; -void __CARDDefaultApiCallback(s32 chan, s32 result); -void __CARDSyncCallback(s32 chan, s32 result); -void __CARDExtHandler(s32 chan, OSContext* context); -void __CARDExiHandler(s32 chan, OSContext* context); -void __CARDTxHandler(s32 chan, OSContext* context); -void __CARDUnlockedHandler(s32 chan, OSContext* context); -s32 __CARDEnableInterrupt(s32 chan, BOOL enable); -s32 __CARDReadStatus(s32 chan, u8* status); -int __CARDReadVendorID(s32 chan, u16* id); -s32 __CARDClearStatus(s32 chan); +void __CARDDefaultApiCallback(s32 chan, s32 result); +void __CARDSyncCallback(s32 chan, s32 result); +void __CARDExtHandler(s32 chan, OSContext* context); +void __CARDExiHandler(s32 chan, OSContext* context); +void __CARDTxHandler(s32 chan, OSContext* context); +void __CARDUnlockedHandler(s32 chan, OSContext* context); +s32 __CARDEnableInterrupt(s32 chan, BOOL enable); +s32 __CARDReadStatus(s32 chan, u8* status); +int __CARDReadVendorID(s32 chan, u16* id); +s32 __CARDClearStatus(s32 chan); -s32 __CARDReadSegment(s32 chan, CARDCallback callback); -s32 __CARDWritePage(s32 chan, CARDCallback callback); +s32 __CARDReadSegment(s32 chan, CARDCallback callback); +s32 __CARDWritePage(s32 chan, CARDCallback callback); -s32 __CARDEraseSector(s32 chan, u32 addr, CARDCallback callback); +s32 __CARDEraseSector(s32 chan, u32 addr, CARDCallback callback); -u16 __CARDGetFontEncode(); +u16 __CARDGetFontEncode(); -void __CARDSetDiskID(const DVDDiskID* id); +void __CARDSetDiskID(const DVDDiskID* id); -s32 __CARDGetControlBlock(s32 chan, CARDControl** pcard); -s32 __CARDPutControlBlock(CARDControl* card, s32 result); +s32 __CARDGetControlBlock(s32 chan, CARDControl** pcard); +s32 __CARDPutControlBlock(CARDControl* card, s32 result); -s32 __CARDSync(s32 chan); +s32 __CARDSync(s32 chan); #ifdef __cplusplus } #endif -#endif // PRIVATE_CARD_H +#endif // PRIVATE_CARD_H diff --git a/libs/RVL_SDK/include/private/cx.h b/libs/RVL_SDK/include/private/cx.h index 13133f6d..8649e634 100644 --- a/libs/RVL_SDK/include/private/cx.h +++ b/libs/RVL_SDK/include/private/cx.h @@ -3,18 +3,18 @@ #include -#define IN_BUFFER_AT(type_, buf_, offset_) (*((__typeof__(type_)*)((u32)(buf_) + (u32)(offset_)))) +#define IN_BUFFER_AT(type_, buf_, offset_) (*((__typeof__(type_)*)((u32)(buf_) + (u32)(offset_)))) -#define CXiConvertEndian32_ CXiConvertEndian_ +#define CXiConvertEndian32_ CXiConvertEndian_ static inline u32 CXiConvertEndian_(u32 x) { - return ((x & 0xFF000000) >> 24) | ((x & 0x00FF0000) >> 8) | ((x & 0x0000FF00) << 8) | ((x & 0x000000FF) << 24); + return ((x & 0xFF000000) >> 24) | ((x & 0x00FF0000) >> 8) | ((x & 0x0000FF00) << 8) | ((x & 0x000000FF) << 24); } static inline u16 CXiConvertEndian16_(u16 x) { return ((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8); } -BOOL CXiVerifyHuffmanTable_(void const *, u8); +BOOL CXiVerifyHuffmanTable_(void const*, u8); #endif // PRIVATE_CX_H diff --git a/libs/RVL_SDK/include/private/db.h b/libs/RVL_SDK/include/private/db.h index c263b0fa..df795b93 100644 --- a/libs/RVL_SDK/include/private/db.h +++ b/libs/RVL_SDK/include/private/db.h @@ -1,34 +1,34 @@ #ifndef REVOLUTION_DB_H #define REVOLUTION_DB_H -#include #include +#include #ifdef __cplusplus extern "C" { #endif typedef struct DBInterface { - u32 bPresent; // 0x00 - u32 exceptionMask; // 0x04 - void (*ExceptionDestination)(); // 0x08 - void* exceptionReturn; // 0x0C + u32 bPresent; // 0x00 + u32 exceptionMask; // 0x04 + void (*ExceptionDestination)(); // 0x08 + void* exceptionReturn; // 0x0C } DBInterface; extern DBInterface* __DBInterface; -void __DBExceptionDestination(); -BOOL __DBIsExceptionMarked(__OSException exception); +void __DBExceptionDestination(); +BOOL __DBIsExceptionMarked(__OSException exception); -void DBPrintf(const char* format, ...); +void DBPrintf(const char* format, ...); -#define DB_EXCEPTIONOFFSET_USEDEBUGGER 0x00 -#define DB_EXCEPTIONOFFSET_MASK 0x04 -#define DB_EXCEPTIONOFFSET_HOOK 0x08 -#define DB_EXCEPTIONOFFSET_HOOKLR 0x0C +#define DB_EXCEPTIONOFFSET_USEDEBUGGER 0x00 +#define DB_EXCEPTIONOFFSET_MASK 0x04 +#define DB_EXCEPTIONOFFSET_HOOK 0x08 +#define DB_EXCEPTIONOFFSET_HOOKLR 0x0C #ifdef __cplusplus } #endif -#endif // REVOLUTION_DB_H +#endif // REVOLUTION_DB_H diff --git a/libs/RVL_SDK/include/private/dsp.h b/libs/RVL_SDK/include/private/dsp.h index 386f8a61..d2799c00 100644 --- a/libs/RVL_SDK/include/private/dsp.h +++ b/libs/RVL_SDK/include/private/dsp.h @@ -1,15 +1,15 @@ #ifndef PRIVATE_DSP_H #define PRIVATE_DSP_H -#include #include +#include #ifdef __cplusplus extern "C" { #endif extern DSPTaskInfo* __DSP_rude_task; -extern BOOL __DSP_rude_task_pending; +extern BOOL __DSP_rude_task_pending; extern DSPTaskInfo* __DSP_first_task; extern DSPTaskInfo* __DSP_last_task; @@ -29,4 +29,4 @@ void __DSP_remove_task(DSPTaskInfo* task); } #endif -#endif // PRIVATE_DSP_H +#endif // PRIVATE_DSP_H diff --git a/libs/RVL_SDK/include/private/dvd.h b/libs/RVL_SDK/include/private/dvd.h index ff11527a..10b83b40 100644 --- a/libs/RVL_SDK/include/private/dvd.h +++ b/libs/RVL_SDK/include/private/dvd.h @@ -15,7 +15,7 @@ extern "C" { #define DVD_DEVICE_CODE (1 << 15) -#define DVD_PRIVATE_PAD32(size) u8 CONCAT(padding, __LINE__)[OSRoundUp32B((size))-(size)] +#define DVD_PRIVATE_PAD32(size) u8 CONCAT(padding, __LINE__)[OSRoundUp32B((size)) - (size)] enum { DVD_INTTYPE_TC = (1 << 0), @@ -25,7 +25,7 @@ enum { DVD_INTTYPE_TIME = (1 << 4), DVD_INTTYPE_SERR = (1 << 5), DVD_INTTYPE_VERR = (1 << 6), - DVD_INTTYPE_ARGS = (1 << 7), + DVD_INTTYPE_ARGS = (1 << 7), }; enum { @@ -43,107 +43,109 @@ typedef struct DVDVideoReportKey { } DVDVideoReportKey; typedef struct DVDGamePartition { - ESTicket ticket; // 0x00 + ESTicket ticket; // 0x00 - u32 tmdSize; // 0x2A4 - ESTitleMeta* tmd; // 0x2A8 + u32 tmdSize; // 0x2A4 + ESTitleMeta* tmd; // 0x2A8 - u32 certSize; // 0x2AC - void* cert; // 0x2B0 + u32 certSize; // 0x2AC + void* cert; // 0x2B0 - u8* h3Hash; // 0x2B4 - u8* encryptedArea; // 0x2B8 + u8* h3Hash; // 0x2B4 + u8* encryptedArea; // 0x2B8 } DVDGamePartition; typedef struct DVDPartitionInfo { - DVDGamePartition* partition; // 0x00 - u32 partitionType; // 0x04 + DVDGamePartition* partition; // 0x00 + u32 partitionType; // 0x04 } DVDPartitionInfo; typedef struct DVDGameTOC { - u32 partitionCount; // 0x00 - DVDPartitionInfo* partitionInfo; // 0x04 + u32 partitionCount; // 0x00 + DVDPartitionInfo* partitionInfo; // 0x04 } DVDGameTOC; typedef struct DVDPartitionParams { - ESTicket ticket; - DVD_PRIVATE_PAD32(sizeof(ESTicket)); - ESTicketView ticketView; - DVD_PRIVATE_PAD32(sizeof(ESTicketView)); + ESTicket ticket; + DVD_PRIVATE_PAD32(sizeof(ESTicket)); + ESTicketView ticketView; + DVD_PRIVATE_PAD32(sizeof(ESTicketView)); - u32 numTmdBytes; - DVD_PRIVATE_PAD32(sizeof(u32)); - ESTitleMeta tmd; - DVD_PRIVATE_PAD32(sizeof(ESTitleMeta)); + u32 numTmdBytes; + DVD_PRIVATE_PAD32(sizeof(u32)); + ESTitleMeta tmd; + DVD_PRIVATE_PAD32(sizeof(ESTitleMeta)); - u32 numCertBytes; - DVD_PRIVATE_PAD32(sizeof(u32)); - u8 certificates[0x1000]; + u32 numCertBytes; + DVD_PRIVATE_PAD32(sizeof(u32)); + u8 certificates[0x1000]; - u32 dataWordOffset; - DVD_PRIVATE_PAD32(sizeof(u32)); - u8 h3Hash[0x18000]; + u32 dataWordOffset; + DVD_PRIVATE_PAD32(sizeof(u32)); + u8 h3Hash[0x18000]; } DVDPartitionParams; typedef struct DVDBB2 { - u32 bootFilePosition; // 0x00 - - u32 FSTPosition; // 0x04 - u32 FSTLength; // 0x08 - u32 FSTMaxLength; // 0x0C - void* FSTAddress; // 0x10 + u32 bootFilePosition; // 0x00 - u32 userPosition; // 0x14 - u32 userLength; // 0x18 + u32 FSTPosition; // 0x04 + u32 FSTLength; // 0x08 + u32 FSTMaxLength; // 0x0C + void* FSTAddress; // 0x10 - u32 pad_0x1C; + u32 userPosition; // 0x14 + u32 userLength; // 0x18 + + u32 pad_0x1C; } DVDBB2; /* Low level broadway stuff */ -bool DVDLowFinalize(); -bool DVDLowInit(); +bool DVDLowFinalize(); +bool DVDLowInit(); -bool DVDLowReadDiskID(DVDDiskID* diskID, DVDLowCallback callback); +bool DVDLowReadDiskID(DVDDiskID* diskID, DVDLowCallback callback); -bool DVDLowOpenPartition(u32 partitionWordOffset, ESTicket* eTicket, u32 numCertBytes, u8* certificates, ESTitleMeta* tmd, DVDLowCallback callback); -bool DVDLowOpenPartitionWithTmdAndTicketView(u32 partitionWordOffset, ESTicketView* eTicketView, u32 numTmdBytes, ESTitleMeta* tmd, u32 numCertBytes, u8* certificates, DVDLowCallback callback); +bool DVDLowOpenPartition(u32 partitionWordOffset, ESTicket* eTicket, u32 numCertBytes, u8* certificates, ESTitleMeta* tmd, DVDLowCallback callback); +bool DVDLowOpenPartitionWithTmdAndTicketView(u32 partitionWordOffset, ESTicketView* eTicketView, u32 numTmdBytes, ESTitleMeta* tmd, u32 numCertBytes, + u8* certificates, DVDLowCallback callback); -bool DVDLowGetNoDiscBufferSizes(const u32 partitionWordOffset, u32* numTmdBytes, u32* numCertBytes, DVDLowCallback callback); -bool DVDLowGetNoDiscOpenPartitionParams(const u32 partitionWordOffset, ESTicket* eTicket, u32* numTmdBytes, ESTitleMeta* tmd, u32* numCertBytes, u8* certificates, u32* dataWordOffset, u8* h3HashPtr, DVDLowCallback callback); +bool DVDLowGetNoDiscBufferSizes(const u32 partitionWordOffset, u32* numTmdBytes, u32* numCertBytes, DVDLowCallback callback); +bool DVDLowGetNoDiscOpenPartitionParams(const u32 partitionWordOffset, ESTicket* eTicket, u32* numTmdBytes, ESTitleMeta* tmd, u32* numCertBytes, + u8* certificates, u32* dataWordOffset, u8* h3HashPtr, DVDLowCallback callback); -bool DVDLowClosePartition(DVDLowCallback callback); -bool DVDLowUnencryptedRead(void* destAddr, u32 length, u32 wordOffset, DVDLowCallback callback); +bool DVDLowClosePartition(DVDLowCallback callback); +bool DVDLowUnencryptedRead(void* destAddr, u32 length, u32 wordOffset, DVDLowCallback callback); -bool DVDLowStopMotor(bool eject, bool saving, DVDLowCallback callback); -bool DVDLowInquiry(DVDDriveInfo* info, DVDLowCallback callback); +bool DVDLowStopMotor(bool eject, bool saving, DVDLowCallback callback); +bool DVDLowInquiry(DVDDriveInfo* info, DVDLowCallback callback); -bool DVDLowRequestError(DVDLowCallback callback); +bool DVDLowRequestError(DVDLowCallback callback); -bool DVDLowSetSpinupFlag(u32 spinUp); +bool DVDLowSetSpinupFlag(u32 spinUp); -bool DVDLowReset(DVDLowCallback callback); +bool DVDLowReset(DVDLowCallback callback); -bool DVDLowAudioBufferConfig(BOOL enable, u32 size, DVDLowCallback callback); -bool DVDLowSetMaximumRotation(u32 subcmd, DVDLowCallback callback); +bool DVDLowAudioBufferConfig(BOOL enable, u32 size, DVDLowCallback callback); +bool DVDLowSetMaximumRotation(u32 subcmd, DVDLowCallback callback); -bool DVDLowRead(void* destAddr, u32 length, u32 wordOffset, DVDLowCallback callback); -bool DVDLowSeek(u32 wordOffset, DVDLowCallback callback); +bool DVDLowRead(void* destAddr, u32 length, u32 wordOffset, DVDLowCallback callback); +bool DVDLowSeek(u32 wordOffset, DVDLowCallback callback); -u32 DVDLowGetCoverRegister(); -u32 DVDLowGetStatusRegister(); -bool DVDLowPrepareCoverRegister(DVDLowCallback callback); -bool DVDLowPrepareStatusRegister(DVDLowCallback callback); +u32 DVDLowGetCoverRegister(); +u32 DVDLowGetStatusRegister(); +bool DVDLowPrepareCoverRegister(DVDLowCallback callback); +bool DVDLowPrepareStatusRegister(DVDLowCallback callback); -u32 DVDLowGetImmBufferReg(); +u32 DVDLowGetImmBufferReg(); -bool DVDLowUnmaskStatusInterrupts(); -bool DVDLowMaskCoverInterrupt(); -bool DVDLowClearCoverInterrupt(DVDLowCallback callback); +bool DVDLowUnmaskStatusInterrupts(); +bool DVDLowMaskCoverInterrupt(); +bool DVDLowClearCoverInterrupt(DVDLowCallback callback); -s32 DVDLowGetLastEticketError(); +s32 DVDLowGetLastEticketError(); -BOOL __DVDLowTestAlarm(OSAlarm* alarm); +BOOL __DVDLowTestAlarm(OSAlarm* alarm); /* Main stuff */ @@ -186,18 +188,18 @@ BOOL __DVDGetAutoFatalMessaging(); /* Queue stuff */ -void __DVDClearWaitingQueue(); +void __DVDClearWaitingQueue(); -DVDCommandBlock* __DVDPopWaitingQueue(); -BOOL __DVDPushWaitingQueue(s32 prio, DVDCommandBlock* block); -BOOL __DVDDequeueWaitingQueue(DVDCommandBlock* block); +DVDCommandBlock* __DVDPopWaitingQueue(); +BOOL __DVDPushWaitingQueue(s32 prio, DVDCommandBlock* block); +BOOL __DVDDequeueWaitingQueue(DVDCommandBlock* block); -BOOL __DVDCheckWaitingQueue(); +BOOL __DVDCheckWaitingQueue(); -DVDCommandBlock* __DVDGetNextWaitingQueue(); +DVDCommandBlock* __DVDGetNextWaitingQueue(); #ifdef __cplusplus } #endif -#endif // PRIVATE_DVD_H +#endif // PRIVATE_DVD_H diff --git a/libs/RVL_SDK/include/private/dvd/dvd_broadway.h b/libs/RVL_SDK/include/private/dvd/dvd_broadway.h index f45dfde0..c9cc89ce 100644 --- a/libs/RVL_SDK/include/private/dvd/dvd_broadway.h +++ b/libs/RVL_SDK/include/private/dvd/dvd_broadway.h @@ -1,8 +1,8 @@ #ifndef PRIVATE_DVD_BROADWAY_H #define PRIVATE_DVD_BROADWAY_H -#include #include +#include #include @@ -10,10 +10,8 @@ extern "C" { #endif - - #ifdef __cplusplus } #endif -#endif // PRIVATE_DVD_BROADWAY_H +#endif // PRIVATE_DVD_BROADWAY_H diff --git a/libs/RVL_SDK/include/private/enc.h b/libs/RVL_SDK/include/private/enc.h index bd76e6d9..b0a03ff2 100644 --- a/libs/RVL_SDK/include/private/enc.h +++ b/libs/RVL_SDK/include/private/enc.h @@ -3,11 +3,11 @@ #include -#include +#include #include #include -#include #include +#include #include @@ -19,4 +19,4 @@ extern "C" { } #endif -#endif // PRIVATE_ENC_H +#endif // PRIVATE_ENC_H diff --git a/libs/RVL_SDK/include/private/enc/encchinese.h b/libs/RVL_SDK/include/private/enc/encchinese.h index b93f5009..854c4cc0 100644 --- a/libs/RVL_SDK/include/private/enc/encchinese.h +++ b/libs/RVL_SDK/include/private/enc/encchinese.h @@ -3,19 +3,19 @@ #include -#include #include +#include #ifdef __cplusplus extern "C" { #endif -extern const u16 enc_tbl_cn_mbtowc[]; -extern const u8 enc_tbl_cn_wctomb[]; -extern const u16 enc_offset_cn[]; -extern const u16 enc_tbl_cnex_mbtowc[]; +extern const u16 enc_tbl_cn_mbtowc[]; +extern const u8 enc_tbl_cn_wctomb[]; +extern const u16 enc_offset_cn[]; +extern const u16 enc_tbl_cnex_mbtowc[]; -extern BOOL enc_tbl_cn_loaded; +extern BOOL enc_tbl_cn_loaded; DECLARE_PRIVATE_ENC_FUNCTION_TO_UTF16(Gb2312) DECLARE_PRIVATE_ENC_FUNCTION_FROM_UTF16(Gb2312) @@ -24,4 +24,4 @@ DECLARE_PRIVATE_ENC_FUNCTION_FROM_UTF16(Gb2312) } #endif -#endif // PRIVATE_ENC_CHINESE_H +#endif // PRIVATE_ENC_CHINESE_H diff --git a/libs/RVL_SDK/include/private/enc/encconvert.h b/libs/RVL_SDK/include/private/enc/encconvert.h index f5049935..9b3f9283 100644 --- a/libs/RVL_SDK/include/private/enc/encconvert.h +++ b/libs/RVL_SDK/include/private/enc/encconvert.h @@ -3,26 +3,26 @@ #include -#include #include +#include #ifdef __cplusplus extern "C" { #endif -#define ENCODING_NAME_LENGTH 16 -#define ENCODING_HASH_TABLE_ENTRY_NAME_LENGTH 24 +#define ENCODING_NAME_LENGTH 16 +#define ENCODING_HASH_TABLE_ENTRY_NAME_LENGTH 24 struct encoding { - u32 width; // 0x00 - BOOL is7bit; // 0x04 - const char name[ENCODING_NAME_LENGTH]; // 0x08 + u32 width; // 0x00 + BOOL is7bit; // 0x04 + const char name[ENCODING_NAME_LENGTH]; // 0x08 }; struct encoding_hash_table_entry { - const char name[ENCODING_HASH_TABLE_ENTRY_NAME_LENGTH]; // 0x00 - ENCEncoding encoding; // 0x18 - int nextIndex; // 0x1C + const char name[ENCODING_HASH_TABLE_ENTRY_NAME_LENGTH]; // 0x00 + ENCEncoding encoding; // 0x18 + int nextIndex; // 0x1C }; extern const struct encoding encoding_array[]; @@ -37,4 +37,4 @@ extern BOOL enc_tbl_cn_loaded; } #endif -#endif // PRIVATE_ENC_CONVERT_H +#endif // PRIVATE_ENC_CONVERT_H diff --git a/libs/RVL_SDK/include/private/enc/encjapanese.h b/libs/RVL_SDK/include/private/enc/encjapanese.h index a5d1409c..8725b685 100644 --- a/libs/RVL_SDK/include/private/enc/encjapanese.h +++ b/libs/RVL_SDK/include/private/enc/encjapanese.h @@ -3,8 +3,8 @@ #include -#include #include +#include #ifdef __cplusplus extern "C" { @@ -12,7 +12,7 @@ extern "C" { typedef ENCMBState ENCJISState; enum { - ENC_JIS_STATE_INVALID, // Malformed escape sequence + ENC_JIS_STATE_INVALID, // Malformed escape sequence /* Different character sets are switched between using ISO/IEC 2022 escape * sequences. There is a list of character sets that have been registered @@ -26,14 +26,14 @@ enum { */ // GZD4 [ESC 02/08 F] - ENC_JIS_STATE_US_ASCII, // [ESC 02/08 04/02] (Initial state) - ENC_JIS_STATE_JIS_C6220_1969_RO, // [ESC 02/08 04/10] - ENC_JIS_STATE_JIS_C6220_1969_JP, // [ESC 02/08 04/09] + ENC_JIS_STATE_US_ASCII, // [ESC 02/08 04/02] (Initial state) + ENC_JIS_STATE_JIS_C6220_1969_RO, // [ESC 02/08 04/10] + ENC_JIS_STATE_JIS_C6220_1969_JP, // [ESC 02/08 04/09] // GZDM4 [ESC 02/04 02/08 F] (See note) - ENC_JIS_STATE_JIS_X_0208_1978, // [ESC 02/04 04/00] - ENC_JIS_STATE_JIS_X_0208_1983, // [ESC 02/04 04/02] - ENC_JIS_STATE_JIS_X_0212_1990, // [ESC 02/04 04/04] (See note) + ENC_JIS_STATE_JIS_X_0208_1978, // [ESC 02/04 04/00] + ENC_JIS_STATE_JIS_X_0208_1983, // [ESC 02/04 04/02] + ENC_JIS_STATE_JIS_X_0212_1990, // [ESC 02/04 04/04] (See note) /* NOTE: For GZDM4, the normal escape sequence is [ESC 02/04 02/08 F]. * However, for backwards compatibility with earlier standards that already @@ -69,4 +69,4 @@ DECLARE_PRIVATE_ENC_FUNCTION_FROM_UTF16_WITH_MB_STATE(Jis) } #endif -#endif // PRIVATE_ENC_JAPANESE_H +#endif // PRIVATE_ENC_JAPANESE_H diff --git a/libs/RVL_SDK/include/private/enc/enckorean.h b/libs/RVL_SDK/include/private/enc/enckorean.h index 12d5c8d7..8b11638f 100644 --- a/libs/RVL_SDK/include/private/enc/enckorean.h +++ b/libs/RVL_SDK/include/private/enc/enckorean.h @@ -3,8 +3,8 @@ #include -#include #include +#include #ifdef __cplusplus extern "C" { @@ -29,4 +29,4 @@ DECLARE_PRIVATE_ENC_FUNCTION_FROM_UTF16(Uhc) } #endif -#endif // PRIVATE_ENC_KOREAN_H +#endif // PRIVATE_ENC_KOREAN_H diff --git a/libs/RVL_SDK/include/private/enc/enclatin.h b/libs/RVL_SDK/include/private/enc/enclatin.h index 3d5753b5..b1783641 100644 --- a/libs/RVL_SDK/include/private/enc/enclatin.h +++ b/libs/RVL_SDK/include/private/enc/enclatin.h @@ -3,17 +3,17 @@ #include -#include #include +#include #ifdef __cplusplus extern "C" { #endif struct latin_hash_table_entry { - u16 c16; // 0x00 - u8 cc; // 0x02 - u8 next; // 0x03 + u16 c16; // 0x00 + u8 cc; // 0x02 + u8 next; // 0x03 }; extern const u16 latin1_unicode_array[]; @@ -46,7 +46,8 @@ extern const struct latin_hash_table_entry unicode_ibm850_array[]; extern const struct latin_hash_table_entry unicode_ibm852_array[]; ENCResult ENCiConvertStringLatinToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize, ENCBreakType breakType, const u16* table); -ENCResult ENCiConvertStringUnicodeToLatin( u8* dst, s32* dstSize, const u16* src, s32* srcSize, ENCBreakType breakType, const struct latin_hash_table_entry* table); +ENCResult ENCiConvertStringUnicodeToLatin(u8* dst, s32* dstSize, const u16* src, s32* srcSize, ENCBreakType breakType, + const struct latin_hash_table_entry* table); DECLARE_PRIVATE_ENC_FUNCTION_TO_UTF16(Latin1) DECLARE_PRIVATE_ENC_FUNCTION_FROM_UTF16(Latin1) @@ -76,4 +77,4 @@ DECLARE_PRIVATE_ENC_FUNCTION_TO_UTF16(Ibm852) } #endif -#endif // PRIVATE_ENC_LATIN_H +#endif // PRIVATE_ENC_LATIN_H diff --git a/libs/RVL_SDK/include/private/enc/encunicode.h b/libs/RVL_SDK/include/private/enc/encunicode.h index d8ca3626..636aa761 100644 --- a/libs/RVL_SDK/include/private/enc/encunicode.h +++ b/libs/RVL_SDK/include/private/enc/encunicode.h @@ -3,15 +3,15 @@ #include -#include #include +#include #ifdef __cplusplus extern "C" { #endif typedef ENCMBState ENCUTF7State; -#define ENC_UTF7_STATE_INITIAL ENC_STATE_INITIAL +#define ENC_UTF7_STATE_INITIAL ENC_STATE_INITIAL /* 0xfffc0000 - Pending bits (holds up to 14, most needed for an incomplete unit) * 0x0003fff0 - unused @@ -19,10 +19,10 @@ typedef ENCMBState ENCUTF7State; * 0x00000007 - Current bit offset of pending bits (starts at msb and goes right) */ -#define ENC_UTF7_STATE_BASE64_MODE (1 << 3) +#define ENC_UTF7_STATE_BASE64_MODE (1 << 3) -#define ENC_UTF7_STATE_IS_BASE64_MODE(mbState_) ((mbState_) & ENC_UTF7_STATE_BASE64_MODE) -#define ENC_UTF7_STATE_GET_PARTIAL_BITS(mbState_) ((mbState_) & 0xfffc0000) +#define ENC_UTF7_STATE_IS_BASE64_MODE(mbState_) ((mbState_) & ENC_UTF7_STATE_BASE64_MODE) +#define ENC_UTF7_STATE_GET_PARTIAL_BITS(mbState_) ((mbState_) & 0xfffc0000) /* Shift left 1 since offset is always a multiple of 2, but I'm not sure why * they didn't then just store it in 0x0e and have the shift state be in bit 0 @@ -33,13 +33,11 @@ typedef ENCMBState ENCUTF7State; /* if we are collecting state then we are implicitly in base64 mode, so no need * to specify that explicitly */ -#define ENC_UTF7_STATE_COLLECT(partialBits_, partialOffset_) (ENC_UTF7_STATE_BASE64_MODE | ((partialBits_) & 0xfffc0000) | ((partialOffset_) >> 1 & 0x00000007l)) // ? +#define ENC_UTF7_STATE_COLLECT(partialBits_, partialOffset_) \ + (ENC_UTF7_STATE_BASE64_MODE | ((partialBits_) & 0xfffc0000) | ((partialOffset_) >> 1 & 0x00000007l)) // ? typedef ENCMBState ENCUTF16State; -enum { - ENC_UTF16_STATE_BIG_ENDIAN, - ENC_UTF16_STATE_LITTLE_ENDIAN -}; +enum { ENC_UTF16_STATE_BIG_ENDIAN, ENC_UTF16_STATE_LITTLE_ENDIAN }; DECLARE_PRIVATE_ENC_FUNCTION_FROM_UTF16(Ascii) DECLARE_PRIVATE_ENC_FUNCTION_TO_UTF16(Ascii) @@ -56,4 +54,4 @@ DECLARE_PRIVATE_ENC_FUNCTION_WITH_MB_STATE(Utf16, u16, Utf16, u16) } #endif -#endif // PRIVATE_ENC_UNICODE_H +#endif // PRIVATE_ENC_UNICODE_H diff --git a/libs/RVL_SDK/include/private/enc/encutility.h b/libs/RVL_SDK/include/private/enc/encutility.h index 399a44d8..d340bced 100644 --- a/libs/RVL_SDK/include/private/enc/encutility.h +++ b/libs/RVL_SDK/include/private/enc/encutility.h @@ -9,108 +9,66 @@ extern "C" { #endif - // Internal declarations // NOLINTBEGIN(bugprone-macro-parentheses) (Type specifiers cannot be parenthesized.) -#define DECLARE_PRIVATE_ENC_FUNCTION(srcEnc_, srcChar_, dstEnc_, dstChar_) \ - ENCResult ENCiConvertString ## srcEnc_ ## To ## dstEnc_( \ - dstChar_* dst, s32* dstSize, srcChar_ const* src, s32* srcSize, \ - ENCBreakType breakType); +#define DECLARE_PRIVATE_ENC_FUNCTION(srcEnc_, srcChar_, dstEnc_, dstChar_) \ + ENCResult ENCiConvertString##srcEnc_##To##dstEnc_(dstChar_* dst, s32* dstSize, srcChar_ const* src, s32* srcSize, ENCBreakType breakType); -#define DECLARE_PRIVATE_ENC_FUNCTION_WITH_MB_STATE(srcEnc_, srcChar_, dstEnc_, \ - dstChar_) \ - ENCResult ENCiConvertString ## srcEnc_ ## To ## dstEnc_( \ - dstChar_* dst, s32* dstSize, srcChar_ const* src, s32* srcSize, \ - ENCBreakType breakType, ENCMBState* mbState); +#define DECLARE_PRIVATE_ENC_FUNCTION_WITH_MB_STATE(srcEnc_, srcChar_, dstEnc_, dstChar_) \ + ENCResult ENCiConvertString##srcEnc_##To##dstEnc_(dstChar_* dst, s32* dstSize, srcChar_ const* src, s32* srcSize, ENCBreakType breakType, \ + ENCMBState* mbState); -#define DECLARE_PRIVATE_ENC_FUNCTION_TO_UTF16(srcEnc_) \ - DECLARE_PRIVATE_ENC_FUNCTION(srcEnc_, u8, Unicode, u16) -#define DECLARE_PRIVATE_ENC_FUNCTION_FROM_UTF16(dstEnc_) \ - DECLARE_PRIVATE_ENC_FUNCTION(Unicode, u16, dstEnc_, u8) +#define DECLARE_PRIVATE_ENC_FUNCTION_TO_UTF16(srcEnc_) DECLARE_PRIVATE_ENC_FUNCTION(srcEnc_, u8, Unicode, u16) +#define DECLARE_PRIVATE_ENC_FUNCTION_FROM_UTF16(dstEnc_) DECLARE_PRIVATE_ENC_FUNCTION(Unicode, u16, dstEnc_, u8) -#define DECLARE_PRIVATE_ENC_FUNCTION_TO_UTF16_WITH_MB_STATE(srcEnc_) \ - DECLARE_PRIVATE_ENC_FUNCTION_WITH_MB_STATE(srcEnc_, u8, Unicode, \ - u16) -#define DECLARE_PRIVATE_ENC_FUNCTION_FROM_UTF16_WITH_MB_STATE(dstEnc_) \ - DECLARE_PRIVATE_ENC_FUNCTION_WITH_MB_STATE(Unicode, u16, dstEnc_, \ - u8) +#define DECLARE_PRIVATE_ENC_FUNCTION_TO_UTF16_WITH_MB_STATE(srcEnc_) DECLARE_PRIVATE_ENC_FUNCTION_WITH_MB_STATE(srcEnc_, u8, Unicode, u16) +#define DECLARE_PRIVATE_ENC_FUNCTION_FROM_UTF16_WITH_MB_STATE(dstEnc_) DECLARE_PRIVATE_ENC_FUNCTION_WITH_MB_STATE(Unicode, u16, dstEnc_, u8) // Trampolines // NOLINTBEGIN(bugprone-macro-parentheses) -#define DEFINE_PUBLIC_ENC_TRAMPOLINE_VIA(srcEnc_, srcChar_, srcVia_, dstEnc_, \ - dstChar_, dstVia_) \ - ENCResult ENCConvertString ## srcEnc_ ## To ## dstEnc_( \ - dstChar_* dst, s32* dstSize, srcChar_ const* src, s32* srcSize) \ - { \ - return ENCiConvertString ## srcVia_ ## To ## dstVia_( \ - dst, dstSize, src, srcSize, ENC_BR_KEEP); \ +#define DEFINE_PUBLIC_ENC_TRAMPOLINE_VIA(srcEnc_, srcChar_, srcVia_, dstEnc_, dstChar_, dstVia_) \ + ENCResult ENCConvertString##srcEnc_##To##dstEnc_(dstChar_* dst, s32* dstSize, srcChar_ const* src, s32* srcSize) { \ + return ENCiConvertString##srcVia_##To##dstVia_(dst, dstSize, src, srcSize, ENC_BR_KEEP); \ } -#define DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_VIA( \ - srcEnc_, srcChar_, srcVia_, dstEnc_, dstChar_, dstVia_) \ - ENCResult ENCConvertString ## srcEnc_ ## To ## dstEnc_( \ - dstChar_* dst, s32* dstSize, srcChar_ const* src, s32* srcSize) \ - { \ - return ENCiConvertString ## srcVia_ ## To ## dstVia_( \ - dst, dstSize, src, srcSize, ENC_BR_KEEP, NULL); \ +#define DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_VIA(srcEnc_, srcChar_, srcVia_, dstEnc_, dstChar_, dstVia_) \ + ENCResult ENCConvertString##srcEnc_##To##dstEnc_(dstChar_* dst, s32* dstSize, srcChar_ const* src, s32* srcSize) { \ + return ENCiConvertString##srcVia_##To##dstVia_(dst, dstSize, src, srcSize, ENC_BR_KEEP, NULL); \ } -#define DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_GIVEN_MB_STATE_VIA( \ - srcEnc_, srcChar_, srcVia_, dstEnc_, dstChar_, dstVia_, mbState_) \ - ENCResult ENCConvertString ## srcEnc_ ## To ## dstEnc_( \ - dstChar_* dst, s32* dstSize, srcChar_ const* src, s32* srcSize) \ - { \ - ENCMBState mbState = (mbState_); \ - \ - return ENCiConvertString ## srcVia_ ## To ## dstVia_( \ - dst, dstSize, src, srcSize, ENC_BR_KEEP, &mbState); \ +#define DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_GIVEN_MB_STATE_VIA(srcEnc_, srcChar_, srcVia_, dstEnc_, dstChar_, dstVia_, mbState_) \ + ENCResult ENCConvertString##srcEnc_##To##dstEnc_(dstChar_* dst, s32* dstSize, srcChar_ const* src, s32* srcSize) { \ + ENCMBState mbState = (mbState_); \ + \ + return ENCiConvertString##srcVia_##To##dstVia_(dst, dstSize, src, srcSize, ENC_BR_KEEP, &mbState); \ } // NOLINTEND(bugprone-macro-parentheses) -#define DEFINE_PUBLIC_ENC_TRAMPOLINE(srcEnc_, srcChar_, dstEnc_, dstChar_) \ - DEFINE_PUBLIC_ENC_TRAMPOLINE_VIA(srcEnc_, srcChar_, srcEnc_, dstEnc_, \ - dstChar_, dstEnc_) +#define DEFINE_PUBLIC_ENC_TRAMPOLINE(srcEnc_, srcChar_, dstEnc_, dstChar_) \ + DEFINE_PUBLIC_ENC_TRAMPOLINE_VIA(srcEnc_, srcChar_, srcEnc_, dstEnc_, dstChar_, dstEnc_) -#define DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE(srcEnc_, srcChar_, \ - dstEnc_, dstChar_) \ - DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_VIA(srcEnc_, srcChar_, \ - srcEnc_, dstEnc_, \ - dstChar_, dstEnc_) +#define DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE(srcEnc_, srcChar_, dstEnc_, dstChar_) \ + DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_VIA(srcEnc_, srcChar_, srcEnc_, dstEnc_, dstChar_, dstEnc_) -#define DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_GIVEN_MB_STATE(srcEnc_, srcChar_, \ - dstEnc_, dstChar_, \ - mbState_) \ - DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_GIVEN_MB_STATE_VIA(srcEnc_, srcChar_, \ - srcEnc_, dstEnc_, \ - dstChar_, dstEnc_, \ - mbState_) +#define DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_GIVEN_MB_STATE(srcEnc_, srcChar_, dstEnc_, dstChar_, mbState_) \ + DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_GIVEN_MB_STATE_VIA(srcEnc_, srcChar_, srcEnc_, dstEnc_, dstChar_, dstEnc_, mbState_) -#define DEFINE_PUBLIC_ENC_TRAMPOLINE_FROM_UTF16(dstEnc_) \ - DEFINE_PUBLIC_ENC_TRAMPOLINE_VIA(Unicode, u16, Unicode, dstEnc_, \ - u8, dstEnc_) +#define DEFINE_PUBLIC_ENC_TRAMPOLINE_FROM_UTF16(dstEnc_) DEFINE_PUBLIC_ENC_TRAMPOLINE_VIA(Unicode, u16, Unicode, dstEnc_, u8, dstEnc_) -#define DEFINE_PUBLIC_ENC_TRAMPOLINE_TO_UTF16_VIA(srcEnc_, srcVia_) \ - DEFINE_PUBLIC_ENC_TRAMPOLINE_VIA(srcEnc_, u8, srcVia_, Unicode, \ - u16, Unicode) +#define DEFINE_PUBLIC_ENC_TRAMPOLINE_TO_UTF16_VIA(srcEnc_, srcVia_) DEFINE_PUBLIC_ENC_TRAMPOLINE_VIA(srcEnc_, u8, srcVia_, Unicode, u16, Unicode) -#define DEFINE_PUBLIC_ENC_TRAMPOLINE_TO_UTF16(srcEnc_) \ - DEFINE_PUBLIC_ENC_TRAMPOLINE_VIA(srcEnc_, u8, srcEnc_, Unicode, \ - u16, Unicode) +#define DEFINE_PUBLIC_ENC_TRAMPOLINE_TO_UTF16(srcEnc_) DEFINE_PUBLIC_ENC_TRAMPOLINE_VIA(srcEnc_, u8, srcEnc_, Unicode, u16, Unicode) -#define DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_FROM_UTF16(dstEnc_) \ - DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_VIA(Unicode, u16, Unicode, \ - dstEnc_, u8, dstEnc_) +#define DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_FROM_UTF16(dstEnc_) \ + DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_VIA(Unicode, u16, Unicode, dstEnc_, u8, dstEnc_) -#define DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_TO_UTF16_VIA(srcEnc_, \ - srcVia_) \ - DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_VIA(srcEnc_, u8, srcVia_, \ - Unicode, u16, Unicode) +#define DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_TO_UTF16_VIA(srcEnc_, srcVia_) \ + DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_VIA(srcEnc_, u8, srcVia_, Unicode, u16, Unicode) -#define DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_TO_UTF16(srcEnc_) \ - DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_VIA(srcEnc_, u8, srcEnc_, \ - Unicode, u16, Unicode) +#define DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_TO_UTF16(srcEnc_) \ + DEFINE_PUBLIC_ENC_TRAMPOLINE_WITH_MB_STATE_VIA(srcEnc_, u8, srcEnc_, Unicode, u16, Unicode) // General @@ -119,211 +77,172 @@ extern "C" { * of a conversion function to declare some variables */ // NOTE: Not to be confused with multibyte state, which is different. -#define CREATE_STATE_VARIABLES(dstCnt_, dstLimit_, dstValid_, srcCnt_, \ - srcLimit_, srcLimited_) \ - s32 (srcCnt_) = 0; \ - s32 (dstCnt_) = 0; \ - \ - s32 (srcLimit_) = ENC_SRC_UNLIMITED; \ - s32 (dstLimit_) = ENC_DST_INVALID; \ - \ - BOOL (dstValid_) = TRUE; \ - BOOL (srcLimited_) = TRUE; \ +#define CREATE_STATE_VARIABLES(dstCnt_, dstLimit_, dstValid_, srcCnt_, srcLimit_, srcLimited_) \ + s32(srcCnt_) = 0; \ + s32(dstCnt_) = 0; \ + \ + s32(srcLimit_) = ENC_SRC_UNLIMITED; \ + s32(dstLimit_) = ENC_DST_INVALID; \ + \ + BOOL(dstValid_) = TRUE; \ + BOOL(srcLimited_) = TRUE; -#define CHECK_PARAMETERS(ret_, dstStream_, dstSize_, dstLimit_, dstValid_, \ - srcStream_, srcSize_, srcLimit_, srcLimited_) \ - do \ - { \ - *(ret_) = ENCiCheckParameters( \ - (dstStream_) != NULL, dstSize_, dstLimit_, dstValid_, \ - (srcStream_) != NULL, srcSize_, srcLimit_, srcLimited_); \ - \ - if (*(ret_) != ENC_OK) \ - return *(ret_); \ +#define CHECK_PARAMETERS(ret_, dstStream_, dstSize_, dstLimit_, dstValid_, srcStream_, srcSize_, srcLimit_, srcLimited_) \ + do { \ + *(ret_) = ENCiCheckParameters((dstStream_) != NULL, dstSize_, dstLimit_, dstValid_, (srcStream_) != NULL, srcSize_, srcLimit_, srcLimited_); \ + \ + if (*(ret_) != ENC_OK) \ + return *(ret_); \ } while (0) // TODO: better name? // WARNING: Unsafe for use within nested loop constructs, single-statement clauses -#define UNSAFE_THROW_AND_QUIT(ret_, err_) \ - { \ - *(ret_) = (err_); \ - break; \ - } \ - \ +#define UNSAFE_THROW_AND_QUIT(ret_, err_) \ + { \ + *(ret_) = (err_); \ + break; \ + } // WARNING: Unsafe for use within nested loop constructs, single-statement clauses -#define UNSAFE_CHECK_DST_SPACE(cnt_, limit_, valid_, ret_) \ - if ((cnt_) >= (limit_) && (valid_)) \ - { \ - UNSAFE_THROW_AND_QUIT(ret_, ENC_ERR_NO_BUF_LEFT); \ - } \ - \ +#define UNSAFE_CHECK_DST_SPACE(cnt_, limit_, valid_, ret_) \ + if ((cnt_) >= (limit_) && (valid_)) { \ + UNSAFE_THROW_AND_QUIT(ret_, ENC_ERR_NO_BUF_LEFT); \ + } // WARNING: Unsafe for use within nested loop constructs, single-statement clauses -#define UNSAFE_CHECK_BREAK_TYPE(dstStream_, dstCnt_, dstLimit_, dstValid_, \ - srcStream_, srcCnt_, srcLimit_, srcLimited_, \ - breakType_, ret_) \ - if ((breakType_) > ENC_BR_KEEP) \ - { \ - int srcBrkLen = ENCiCheckBreakType( \ - (*(srcStream_))[0], (srcLimit_) - *(srcCnt_) > 1 || !(srcLimited_) \ - ? (*(srcStream_))[1] \ - : 0x00); \ - \ - if (srcBrkLen > 0) \ - { \ - UNSAFE_CHECK_DST_BREAK_TYPE(dstStream_, dstCnt_, dstLimit_, \ - dstValid_, srcStream_, srcCnt_, \ - breakType_, ret_); \ - } \ - } \ - \ +#define UNSAFE_CHECK_BREAK_TYPE(dstStream_, dstCnt_, dstLimit_, dstValid_, srcStream_, srcCnt_, srcLimit_, srcLimited_, breakType_, ret_) \ + if ((breakType_) > ENC_BR_KEEP) { \ + int srcBrkLen = ENCiCheckBreakType((*(srcStream_))[0], (srcLimit_) - *(srcCnt_) > 1 || !(srcLimited_) ? (*(srcStream_))[1] : 0x00); \ + \ + if (srcBrkLen > 0) { \ + UNSAFE_CHECK_DST_BREAK_TYPE(dstStream_, dstCnt_, dstLimit_, dstValid_, srcStream_, srcCnt_, breakType_, ret_); \ + } \ + } // WARNING: Unsafe for use within nested loop constructs, single-statement clauses -#define UNSAFE_CHECK_DST_BREAK_TYPE(dstStream_, dstCnt_, dstLimit_, dstValid_, srcStream_, srcCnt_, breakType_, ret_) \ - { /* limit scope of dstBrkLen */ \ - int dstBrkLen = ENCiWriteBreakType( \ - *(dstStream_), sizeof(**(dstStream_)), breakType_, dstValid_); \ - \ - if ((dstLimit_) - *(dstCnt_) < dstBrkLen && (dstValid_)) \ - { \ - UNSAFE_THROW_AND_QUIT(ret_, ENC_ERR_NO_BUF_LEFT); \ - } \ - \ - *(srcStream_) += srcBrkLen; \ - *(srcCnt_) += srcBrkLen; \ - *(dstCnt_) += dstBrkLen; \ - \ - if (dstValid_) \ - *(dstStream_) += dstBrkLen; \ - \ - continue; \ - } \ - \ +#define UNSAFE_CHECK_DST_BREAK_TYPE(dstStream_, dstCnt_, dstLimit_, dstValid_, srcStream_, srcCnt_, breakType_, ret_) \ + { /* limit scope of dstBrkLen */ \ + int dstBrkLen = ENCiWriteBreakType(*(dstStream_), sizeof(**(dstStream_)), breakType_, dstValid_); \ + \ + if ((dstLimit_) - *(dstCnt_) < dstBrkLen && (dstValid_)) { \ + UNSAFE_THROW_AND_QUIT(ret_, ENC_ERR_NO_BUF_LEFT); \ + } \ + \ + *(srcStream_) += srcBrkLen; \ + *(srcCnt_) += srcBrkLen; \ + *(dstCnt_) += dstBrkLen; \ + \ + if (dstValid_) \ + *(dstStream_) += dstBrkLen; \ + \ + continue; \ + } -#define WRITE_CHAR(char_, dstStream_, dstCnt_, dstValid_, srcStream_, srcCnt_) \ - do \ - { \ - if (dstValid_) \ - { \ - **(dstStream_) = (char_); \ - ++*(dstStream_); \ - } \ - \ - ++*(dstCnt_); \ - ++*(srcStream_); \ - ++*(srcCnt_); \ +#define WRITE_CHAR(char_, dstStream_, dstCnt_, dstValid_, srcStream_, srcCnt_) \ + do { \ + if (dstValid_) { \ + **(dstStream_) = (char_); \ + ++*(dstStream_); \ + } \ + \ + ++*(dstCnt_); \ + ++*(srcStream_); \ + ++*(srcCnt_); \ } while (0) -#define INCREMENT_STREAMS(dstStream_, dstCnt_, dstValid_, srcStream_, srcCnt_) \ - do \ - { \ - if (dstValid_) \ - { \ - /* *(dstStream_) = (char_); */ /* Doesn't happen here */ \ - ++*(dstStream_); \ - } \ - \ - ++*(dstCnt_); \ - ++*(srcStream_); \ - ++*(srcCnt_); \ +#define INCREMENT_STREAMS(dstStream_, dstCnt_, dstValid_, srcStream_, srcCnt_) \ + do { \ + if (dstValid_) { \ + /* *(dstStream_) = (char_); */ /* Doesn't happen here */ \ + ++*(dstStream_); \ + } \ + \ + ++*(dstCnt_); \ + ++*(srcStream_); \ + ++*(srcCnt_); \ } while (0) -#define WRITE_BACK_SIZES(srcSize_, srcCnt_, dstSize_, dstCnt_) \ - do \ - { \ - if (srcSize_) \ - *(srcSize_) = (srcCnt_); \ - \ - if (dstSize_) \ - *(dstSize_) = (dstCnt_); \ +#define WRITE_BACK_SIZES(srcSize_, srcCnt_, dstSize_, dstCnt_) \ + do { \ + if (srcSize_) \ + *(srcSize_) = (srcCnt_); \ + \ + if (dstSize_) \ + *(dstSize_) = (dstCnt_); \ } while (0) // WARNING: Unsafe for use within nested loop constructs, single-statement clauses -#define UNSAFE_WRITE_MULTI_BYTE_CHAR(mb_, dstStream_, dstCnt_, dstLimit_, \ - dstValid_, srcStream_, srcCnt_, ret_) \ - { /* limit scope of b1 and b2 */ \ - u8 b1 = (mb_)[0]; \ - u8 b2 = (mb_)[1]; \ - \ - if (!b1) \ - { \ - UNSAFE_THROW_AND_QUIT(ret_, ENC_ERR_NO_MAP_RULE); \ - } \ - \ - if (!b2) \ - { \ - if (dstValid_) \ - { \ - /* NOTE: Doubled expressions */ \ - **(dstStream_) = b1; ++*(dstStream_); \ - } \ - } \ - else \ - { \ - if (dstValid_) \ - { \ - if ((dstLimit_) - *(dstCnt_) < 2) \ - { \ - UNSAFE_THROW_AND_QUIT(ret_, ENC_ERR_NO_BUF_LEFT); \ - } \ - \ - /* NOTE: Doubled expressions */ \ - **(dstStream_) = b1; ++*(dstStream_); \ - **(dstStream_) = b2; ++*(dstStream_); \ - \ - ++*(dstCnt_); \ - } \ - else \ - { \ - ++*(dstCnt_); \ - } \ - } \ - \ - ++*(dstCnt_); \ - ++*(srcStream_); \ - ++*(srcCnt_); \ - } \ - \ +#define UNSAFE_WRITE_MULTI_BYTE_CHAR(mb_, dstStream_, dstCnt_, dstLimit_, dstValid_, srcStream_, srcCnt_, ret_) \ + { /* limit scope of b1 and b2 */ \ + u8 b1 = (mb_)[0]; \ + u8 b2 = (mb_)[1]; \ + \ + if (!b1) { \ + UNSAFE_THROW_AND_QUIT(ret_, ENC_ERR_NO_MAP_RULE); \ + } \ + \ + if (!b2) { \ + if (dstValid_) { \ + /* NOTE: Doubled expressions */ \ + **(dstStream_) = b1; \ + ++*(dstStream_); \ + } \ + } else { \ + if (dstValid_) { \ + if ((dstLimit_) - *(dstCnt_) < 2) { \ + UNSAFE_THROW_AND_QUIT(ret_, ENC_ERR_NO_BUF_LEFT); \ + } \ + \ + /* NOTE: Doubled expressions */ \ + **(dstStream_) = b1; \ + ++*(dstStream_); \ + **(dstStream_) = b2; \ + ++*(dstStream_); \ + \ + ++*(dstCnt_); \ + } else { \ + ++*(dstCnt_); \ + } \ + } \ + \ + ++*(dstCnt_); \ + ++*(srcStream_); \ + ++*(srcCnt_); \ + } // ASCII -#define IS_ASCII(x) ((x) < 0x80) +#define IS_ASCII(x) ((x) < 0x80) // UTF-16 -#define UTF16_BE_BOM 0xFEFF -#define UTF16_LE_BOM 0xFFFE +#define UTF16_BE_BOM 0xFEFF +#define UTF16_LE_BOM 0xFFFE -#define UTF16_CHECK_BOM(stream_, srcSize_, limit_, limited_, cnt_, dstSize_) \ - do \ - { \ - if ((limit_) > 0 || !(limited_)) \ - { \ - if (**(stream_) == UTF16_BE_BOM) \ - { \ - ++*(cnt_); \ - ++*(stream_); \ - } \ - else if (**(stream_) == UTF16_LE_BOM) \ - { \ - if (dstSize_) \ - *(dstSize_) = 0; \ - \ - *(srcSize_) = 0; \ - return ENC_ERR_INVALID_FORMAT; \ - } \ - } \ +#define UTF16_CHECK_BOM(stream_, srcSize_, limit_, limited_, cnt_, dstSize_) \ + do { \ + if ((limit_) > 0 || !(limited_)) { \ + if (**(stream_) == UTF16_BE_BOM) { \ + ++*(cnt_); \ + ++*(stream_); \ + } else if (**(stream_) == UTF16_LE_BOM) { \ + if (dstSize_) \ + *(dstSize_) = 0; \ + \ + *(srcSize_) = 0; \ + return ENC_ERR_INVALID_FORMAT; \ + } \ + } \ } while (0) - -void ENCiRegisterVersion(void); -ENCResult ENCiCheckParameters(BOOL dstValid, s32* dstSizeIn, s32* dstSizeOut, BOOL* dstValidOut, BOOL srcValid, s32* srcSizeIn, s32* srcSizeOut, BOOL* srcLimitedOut); -int ENCiCheckBreakType(unsigned a, unsigned b); -int ENCiWriteBreakType(void* stream, int width, ENCBreakType breakType, BOOL valid); +void ENCiRegisterVersion(void); +ENCResult ENCiCheckParameters(BOOL dstValid, s32* dstSizeIn, s32* dstSizeOut, BOOL* dstValidOut, BOOL srcValid, s32* srcSizeIn, s32* srcSizeOut, + BOOL* srcLimitedOut); +int ENCiCheckBreakType(unsigned a, unsigned b); +int ENCiWriteBreakType(void* stream, int width, ENCBreakType breakType, BOOL valid); #ifdef __cplusplus } #endif -#endif // RVL_SDK_ENC_UTILITY_H +#endif // RVL_SDK_ENC_UTILITY_H diff --git a/libs/RVL_SDK/include/private/es.h b/libs/RVL_SDK/include/private/es.h index b7787d5d..51da855c 100644 --- a/libs/RVL_SDK/include/private/es.h +++ b/libs/RVL_SDK/include/private/es.h @@ -1,8 +1,8 @@ #ifndef PRIVATE_ES_H #define PRIVATE_ES_H -#include #include +#include #ifdef __cplusplus extern "C" { @@ -12,7 +12,8 @@ ESError ES_InitLib(); ESError ES_ImportTicket(ESTicket* ticket, void* certs, u32 certSize, void* crls, u32 crlSize, int unknown); -ESError ES_ImportBoot(ESTicket* ticket, void* certs, u32 certSize, void* tmd, u32 tmdSize, void* tmdCerts, u32 tmdCertSize, void* crls, u32 crlSize, void* app, u32 appSize); +ESError ES_ImportBoot(ESTicket* ticket, void* certs, u32 certSize, void* tmd, u32 tmdSize, void* tmdCerts, u32 tmdCertSize, void* crls, u32 crlSize, + void* app, u32 appSize); ESError ES_GetTmdSize(ESTitleMeta* tmd, u32* tmdSize); ESError ES_GetTmdSizeFromView(ESTmdView* tmd, u32* tmdSize); @@ -20,7 +21,7 @@ ESError ES_GetTmdSizeFromView(ESTmdView* tmd, u32* tmdSize); ESError ES_GetDeviceId(ESDeviceId* deviceId); ESError ES_ImportTitleInit(void* tmd, u32 tmdSize, void* certs, u32 certSize, void* crls, u32 crlSize, int unknown0, int unknown1); -ESFd ES_ImportContentBegin(ESTitleId titleId, ESContentId contentId); +ESFd ES_ImportContentBegin(ESTitleId titleId, ESContentId contentId); ESError ES_ImportContentData(ESFd fd, void* data, u32 dataSize); ESError ES_ImportContentEnd(ESFd fd); ESError ES_ImportTitleDone(); @@ -28,8 +29,8 @@ ESError ES_ImportTitleCancel(); ESError ES_LaunchTitle(ESTitleId titleId, ESTicketView* ticket); -ESFd ES_OpenContentFile(ESContentId contentId); -ESFd ES_OpenTitleContentFile(ESTitleId titleId, ESTicketView* ticketView, ESContentId contentIndex); +ESFd ES_OpenContentFile(ESContentId contentId); +ESFd ES_OpenTitleContentFile(ESTitleId titleId, ESTicketView* ticketView, ESContentId contentIndex); ESError ES_ReadContentFile(ESFd fd, void* buffer, u32 size); ESError ES_SeekContentFile(ESFd fd, s32 offset, u32 whence); ESError ES_CloseContentFile(ESFd fd); @@ -40,7 +41,7 @@ ESError ES_ListTitleContentsOnCard(ESTitleId titleId, ESContentId* contentIds, u ESError ES_ListTmdContentsOnCard(ESTitleMeta* tmd, u32 tmdSize, ESContentId* contentIds, u32* numContents); ESError ES_ListSharedContents(u32* numContents, ESHash* hashes); -ESError ES_GetTicketViews(ESTitleId titleId, ESTicketView* ticketViewList, u32* numTicketViews); +ESError ES_GetTicketViews(ESTitleId titleId, ESTicketView* ticketViewList, u32* numTicketViews); ESError ES_GetTmd(ESTitleId titleId, ESTitleMeta* tmd, u32* tmdSize); ESError ES_GetTmdView(ESTitleId titleId, ESTmdView* tmdView, u32* tmdSize); @@ -58,7 +59,8 @@ ESError ES_GetDeviceCert(void* deviceCert); ESError ES_DiGetTmdView(ESTitleMeta* tmd, u32 tmdSize, ESTmdView* tmdView, u32* tmdViewSize); -ESError ES_ExportTitleInit(ESTitleId titleId, ESDeviceId deviceId, ESTicketId ticketId, void* certs, u32 certSize, void* crls, u32 crlSize, int unknown, void* ticket, void* tmd, u32 tmdSize); +ESError ES_ExportTitleInit(ESTitleId titleId, ESDeviceId deviceId, ESTicketId ticketId, void* certs, u32 certSize, void* crls, u32 crlSize, + int unknown, void* ticket, void* tmd, u32 tmdSize); ESError ES_ExportContentBegin(ESTitleId titleId, ESContentId contentId); ESError ES_ExportContentData(ESFd fd, void* data, u32 dataSize); ESError ES_ExportContentEnd(ESFd fd); @@ -76,4 +78,4 @@ ESError ES_VerifySign(void* data, u32 length, ESSignature signature, void* certs } #endif -#endif // PRIVATE_ES_H +#endif // PRIVATE_ES_H diff --git a/libs/RVL_SDK/include/private/es/types.h b/libs/RVL_SDK/include/private/es/types.h index 104fea02..95f71fed 100644 --- a/libs/RVL_SDK/include/private/es/types.h +++ b/libs/RVL_SDK/include/private/es/types.h @@ -17,80 +17,70 @@ extern "C" { * https://github.com/devkitPro/libogc/blob/master/gc/ogc/es.h */ -typedef s32 ESError; -typedef s32 ESFd; +typedef s32 ESError; +typedef s32 ESFd; -typedef u32 ESDeviceId; -typedef u32 ESContentId; +typedef u32 ESDeviceId; +typedef u32 ESContentId; -typedef u32 ESTitleId32; -typedef u64 ESTitleId; +typedef u32 ESTitleId32; +typedef u64 ESTitleId; -typedef u64 ESTicketId; +typedef u64 ESTicketId; -typedef u8 ESVersion; +typedef u8 ESVersion; -typedef u8 ESContentMask[64]; -typedef u8 ESSignature[60]; +typedef u8 ESContentMask[64]; +typedef u8 ESSignature[60]; -typedef u8 ESHash[20]; +typedef u8 ESHash[20]; -#define ES_TITLE_TYPE(t64) ((((ESTitleId)t64 & 0xFFFFFFFF00000000) >> 32)) -#define ES_TITLE_CODE(t64) (((ESTitleId)t64 & 0x00000000FFFFFFFF)) +#define ES_TITLE_TYPE(t64) ((((ESTitleId)t64 & 0xFFFFFFFF00000000) >> 32)) +#define ES_TITLE_CODE(t64) (((ESTitleId)t64 & 0x00000000FFFFFFFF)) -#define ES_TITLE_TYPE_NOMASK(t64) ((((ESTitleId)t64) >> 32)) -#define ES_TITLE_CODE_NOMASK(t64) (((ESTitleId)t64)) +#define ES_TITLE_TYPE_NOMASK(t64) ((((ESTitleId)t64) >> 32)) +#define ES_TITLE_CODE_NOMASK(t64) (((ESTitleId)t64)) -#define ES_TITLE_ID(type, code) ((ESTitleId)((ESTitleId)type << 32 | code)) +#define ES_TITLE_ID(type, code) ((ESTitleId)((ESTitleId)type << 32 | code)) -#define ES_MAX_CONTENT 512 +#define ES_MAX_CONTENT 512 -#define ES_LIMIT_MAX 8 +#define ES_LIMIT_MAX 8 + +enum { ES_REGION_JPN = 0, ES_REGION_USA, ES_REGION_PAL, ES_REGION_ALL, ES_REGION_KOR }; enum { - ES_REGION_JPN = 0, - ES_REGION_USA, - ES_REGION_PAL, - ES_REGION_ALL, - ES_REGION_KOR + ES_CK_NORMAL = 0, // Normal common key + ES_CK_KOREAN, // Korean common key + ES_CK_CAFEWII // Wii U's Wii Mode common key }; enum { - ES_CK_NORMAL = 0, // Normal common key - ES_CK_KOREAN, // Korean common key - ES_CK_CAFEWII // Wii U's Wii Mode common key + ES_DEV_RETAIL = 0, // Normal unit + ES_DEV_1, // Korean/Dev unit?? + ES_DEV_CAFE // Wii U' }; -enum { - ES_DEV_RETAIL = 0, // Normal unit - ES_DEV_1, // Korean/Dev unit?? - ES_DEV_CAFE // Wii U' -}; - -enum { - ES_SEEK_BEG = 0, - ES_SEEK_CUR, - ES_SEEK_END -}; +enum { ES_SEEK_BEG = 0, ES_SEEK_CUR, ES_SEEK_END }; // No alignment!! #pragma pack(push, 1) typedef struct ESTicketReserved { - u8 ckType; // 0x00 - u8 empty_0x00[47]; + u8 ckType; // 0x00 + u8 empty_0x00[47]; } ESTicketReserved; typedef struct ESTmdReserved { - u32 region; // 0x00 - u8 ratings[16]; // 0x04 - u8 empty_0x14[4]; + u32 region; // 0x00 + u8 ratings[16]; // 0x04 + u8 empty_0x14[4]; - u8 driveSpin; // 0x18 - u8 empty_0x19[7]; + u8 driveSpin; // 0x18 + u8 empty_0x19[7]; - u8 ipcMask[12]; // 0x20 - u8 empty_0x2C[18]; // 0x2C + u8 ipcMask[12]; // 0x20 + u8 empty_0x2C[18]; // 0x2C } ESTmdReserved; // Hello alignment! @@ -103,10 +93,10 @@ typedef enum ESCertSigType { } ESCertSigType; typedef struct ESCertSignature { - ESCertSigType sigType; // 0x00 - u8 sig[256]; // 0x04 - u8 reserved[60]; // 0x104 - u8 issuer[64]; // 0x140 + ESCertSigType sigType; // 0x00 + u8 sig[256]; // 0x04 + u8 reserved[60]; // 0x104 + u8 issuer[64]; // 0x140 } ESCertSignature; #pragma pack(push, 4) @@ -119,161 +109,161 @@ typedef struct ESLpEntry { } ESLpEntry; typedef struct ESTicketView { - ESVersion version; // 0x00 + ESVersion version; // 0x00 - ESTicketId ticketId; // 0x04 - ESDeviceId deviceId; // 0x0C - ESTitleId titleId; // 0x10 + ESTicketId ticketId; // 0x04 + ESDeviceId deviceId; // 0x0C + ESTitleId titleId; // 0x10 - u8 accessMask[2]; // 0x18 + u8 accessMask[2]; // 0x18 - u16 ticketVersion; // 0x1A + u16 ticketVersion; // 0x1A - u32 accessTitleID; // 0x1C - u32 accessTitleMask; // 0x20 + u32 accessTitleID; // 0x1C + u32 accessTitleMask; // 0x20 - u8 license; // 0x24 - ESTicketReserved reserved; // 0x25 + u8 license; // 0x24 + ESTicketReserved reserved; // 0x25 - u8 unk_0x55; - ESContentMask cidxMask; // 0x56 - ESLpEntry limits[ES_LIMIT_MAX]; // 0x98 + u8 unk_0x55; + ESContentMask cidxMask; // 0x56 + ESLpEntry limits[ES_LIMIT_MAX]; // 0x98 } ESTicketView; typedef struct ESTicket { - ESCertSignature sig; // 0x00 + ESCertSignature sig; // 0x00 - u8 publicKey[60]; // 0x180 + u8 publicKey[60]; // 0x180 - ESVersion version; // 0x1BC - ESVersion caCrlVersion; // 0x1BD - ESVersion signerCrlVersion; // 0x1BE + ESVersion version; // 0x1BC + ESVersion caCrlVersion; // 0x1BD + ESVersion signerCrlVersion; // 0x1BE - u8 titleKey[16]; // 0x1BF + u8 titleKey[16]; // 0x1BF - ESTicketId ticketId; // 0x1D0 - ESDeviceId deviceId; // 0x1D8 - ESTitleId titleId; // 0x1DC + ESTicketId ticketId; // 0x1D0 + ESDeviceId deviceId; // 0x1D8 + ESTitleId titleId; // 0x1DC - u8 accessMask[2]; // 0x1E4 + u8 accessMask[2]; // 0x1E4 - u16 ticketVersion; // 0x1E6 + u16 ticketVersion; // 0x1E6 - u32 accessTitleId; // 0x1E8 - u32 accessTitleMask; // 0x1EC + u32 accessTitleId; // 0x1E8 + u32 accessTitleMask; // 0x1EC - u8 licenseType; // 0x1F0 + u8 licenseType; // 0x1F0 - ESTicketReserved reserved; // 0x1F1 + ESTicketReserved reserved; // 0x1F1 - u8 unk_0x221; // 0x221 - ESContentMask cidxMask; // 0x222 - ESLpEntry limits[ES_LIMIT_MAX]; // 0x264 + u8 unk_0x221; // 0x221 + ESContentMask cidxMask; // 0x222 + ESLpEntry limits[ES_LIMIT_MAX]; // 0x264 } ESTicket; /* TMD */ typedef struct ESTmdViewHeader { - ESVersion version; // 0x00 - ESTitleId sysVersion; // 0x04 + ESVersion version; // 0x00 + ESTitleId sysVersion; // 0x04 - ESTitleId titleId; // 0x0C - u32 titleType; // 0x14 + ESTitleId titleId; // 0x0C + u32 titleType; // 0x14 - u16 groupId; // 0x18 + u16 groupId; // 0x18 - ESTmdReserved reserved; // 0x1A + ESTmdReserved reserved; // 0x1A - u16 titleVersion; // 0x58 + u16 titleVersion; // 0x58 - u16 numContents; // 0x5A + u16 numContents; // 0x5A } ESTmdViewHeader; typedef struct ESCmdView { - ESContentId cid; // 0x00 + ESContentId cid; // 0x00 - u16 index; // 0x04 - u16 type; // 0x06 - u64 size; // 0x08 + u16 index; // 0x04 + u16 type; // 0x06 + u64 size; // 0x08 } ESCmdView; typedef struct ESTmdView { - ESTmdViewHeader head; // 0x00 - ESCmdView contents[ES_MAX_CONTENT]; // 0x5C + ESTmdViewHeader head; // 0x00 + ESCmdView contents[ES_MAX_CONTENT]; // 0x5C } ESTmdView; typedef struct ESContentMeta { - ESContentId cid; // 0x00 + ESContentId cid; // 0x00 - u16 index; // 0x04 - u16 type; // 0x06 + u16 index; // 0x04 + u16 type; // 0x06 - u64 size; // 0x08 + u64 size; // 0x08 - ESHash hash; // 0x10 + ESHash hash; // 0x10 } ESContentMeta; typedef struct ESTitleMetaHeader { - ESVersion version; // 0x00 - ESVersion caCrlVersion; // 0x01 - ESVersion signerCrlVersion; // 0x02 - ESTitleId sysVersion; // 0x04 + ESVersion version; // 0x00 + ESVersion caCrlVersion; // 0x01 + ESVersion signerCrlVersion; // 0x02 + ESTitleId sysVersion; // 0x04 - ESTitleId titleId; // 0x0C - u32 type; // 0x14 - u16 groupId; // 0x18 + ESTitleId titleId; // 0x0C + u32 type; // 0x14 + u16 groupId; // 0x18 - ESTmdReserved reserved; // 0x1A + ESTmdReserved reserved; // 0x1A - u32 accessRights; // 0x58 + u32 accessRights; // 0x58 - u16 titleVersion; // 0x5C + u16 titleVersion; // 0x5C - u16 numContents; // 0x5E + u16 numContents; // 0x5E - u16 bootIndex; // 0x60 + u16 bootIndex; // 0x60 } ESTitleMetaHeader; typedef struct ESTitleMeta { - ESCertSignature sig; // 0x00 - ESTitleMetaHeader head; // 0x180 - ESContentMeta contents[512]; // 0x1E8 + ESCertSignature sig; // 0x00 + ESTitleMetaHeader head; // 0x180 + ESContentMeta contents[512]; // 0x1E8 } ESTitleMeta; #pragma pack(pop) enum { - ES_ERR_OK = 0, + ES_ERR_OK = 0, - ES_ERR_DONT_EXISTS = -106, + ES_ERR_DONT_EXISTS = -106, ES_ERR_INVALID_PUB_KEY_TYPE = -1005, - ES_ERR_FILE_READ_FAILED = -1009, - ES_ERR_FILE_WRITE_FAILED = -1010, - ES_ERR_INVALID_SIGNATURE = -1012, - ES_ERR_TMD_MAXFD = -1016, - ES_ERR_INVALID = -1017, - ES_ERR_INVALID_UNKNOWN = -1019, - ES_ERR_INVALID_DEVICE_ID = -1020, + ES_ERR_FILE_READ_FAILED = -1009, + ES_ERR_FILE_WRITE_FAILED = -1010, + ES_ERR_INVALID_SIGNATURE = -1012, + ES_ERR_TMD_MAXFD = -1016, + ES_ERR_INVALID = -1017, + ES_ERR_INVALID_UNKNOWN = -1019, + ES_ERR_INVALID_DEVICE_ID = -1020, ES_ERR_INVALID_CONTENT_HASH = -1022, - ES_ERR_MEMORY_ERROR = -1024, - ES_ERR_NO_TMD_FILE_FOUND = -1025, - ES_ERR_TMD_INVALID_RIGHT = -1026, - ES_ERR_ISSUER_NOT_FOUND = -1027, - ES_ERR_TICKET_NOT_FOUND = -1028, - ES_ERR_INVALID_TICKET = -1029, - ES_ERR_INVALID_BOOT2 = -1031, - ES_ERR_UNKNOWN_FATAL = -1032, - ES_ERR_TICKET_EXPIRED = -1033, - ES_ERR_INVALID_TITLE_VER = -1035, - ES_ERR_BAD_SYSMENU_TICKET = -1036, + ES_ERR_MEMORY_ERROR = -1024, + ES_ERR_NO_TMD_FILE_FOUND = -1025, + ES_ERR_TMD_INVALID_RIGHT = -1026, + ES_ERR_ISSUER_NOT_FOUND = -1027, + ES_ERR_TICKET_NOT_FOUND = -1028, + ES_ERR_INVALID_TICKET = -1029, + ES_ERR_INVALID_BOOT2 = -1031, + ES_ERR_UNKNOWN_FATAL = -1032, + ES_ERR_TICKET_EXPIRED = -1033, + ES_ERR_INVALID_TITLE_VER = -1035, + ES_ERR_BAD_SYSMENU_TICKET = -1036, ES_ERR_BAD_SYSMENU_CONTENTS = -1037, - ES_ERR_NO_DISC_NAND_TMD = -1039, + ES_ERR_NO_DISC_NAND_TMD = -1039, }; #ifdef __cplusplus } #endif -#endif // PRIVATE_ES_TYPES_H +#endif // PRIVATE_ES_TYPES_H diff --git a/libs/RVL_SDK/include/private/euart.h b/libs/RVL_SDK/include/private/euart.h index aa793f8e..4a7360c5 100644 --- a/libs/RVL_SDK/include/private/euart.h +++ b/libs/RVL_SDK/include/private/euart.h @@ -18,13 +18,13 @@ enum { EUART_ERROR_EXI, }; -BOOL EUARTInit(); +BOOL EUARTInit(); -EUARTError InitializeUART(int unused); -EUARTError WriteUARTN(const char* msg, u32 n); +EUARTError InitializeUART(int unused); +EUARTError WriteUARTN(const char* msg, u32 n); #ifdef __cplusplus } #endif -#endif // PRIVATE_EUART_H +#endif // PRIVATE_EUART_H diff --git a/libs/RVL_SDK/include/private/exi.h b/libs/RVL_SDK/include/private/exi.h index 221bb212..e822e1bf 100644 --- a/libs/RVL_SDK/include/private/exi.h +++ b/libs/RVL_SDK/include/private/exi.h @@ -1,10 +1,10 @@ #ifndef PRIVATE_EXI_H #define PRIVATE_EXI_H -#include #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -12,11 +12,11 @@ extern "C" { #ifndef DEFINED_EXI_CHANS #define DEFINED_EXI_CHANS -#define EXI_CHAN_0 0 -#define EXI_CHAN_1 1 -#define EXI_CHAN_2 2 -#define EXI_CHAN_MAX 3 -#endif // DEFINED_EXI_CHANS +#define EXI_CHAN_0 0 +#define EXI_CHAN_1 1 +#define EXI_CHAN_2 2 +#define EXI_CHAN_MAX 3 +#endif // DEFINED_EXI_CHANS enum { EXI_FREQ_1MHZ = 0, @@ -41,85 +41,85 @@ enum { }; enum { - EXI_STATE_IDLE = 0, - EXI_STATE_DMA = 1, - EXI_STATE_IMM = 2, - EXI_STATE_BUSY = 3, + EXI_STATE_IDLE = 0, + EXI_STATE_DMA = 1, + EXI_STATE_IMM = 2, + EXI_STATE_BUSY = 3, EXI_STATE_SELECTED = 4, EXI_STATE_ATTACHED = 8, - EXI_STATE_LOCKED = 16, + EXI_STATE_LOCKED = 16, }; -s32 __EXIProbeStartTime[2] ADDRESS(OS_BASE_CACHED | OS_ADDR_EXI_LAST_PROBES); +s32 __EXIProbeStartTime[2] ADDRESS(OS_BASE_CACHED | OS_ADDR_EXI_LAST_PROBES); extern const u32 __EXIFreq; typedef void (*EXICallback)(s32 chan, OSContext* context); -void EXIInit(); +void EXIInit(); -BOOL EXIImm(s32 chan, void* buffer, s32 length, u32 type, EXICallback callback); -BOOL EXIImmEx(s32 chan, u8* buffer, s32 length, u32 mode); +BOOL EXIImm(s32 chan, void* buffer, s32 length, u32 type, EXICallback callback); +BOOL EXIImmEx(s32 chan, u8* buffer, s32 length, u32 mode); -BOOL EXIDma(s32 chan, void* buffer, s32 length, u32 type, EXICallback callback); +BOOL EXIDma(s32 chan, void* buffer, s32 length, u32 type, EXICallback callback); -BOOL EXISync(s32 chan); +BOOL EXISync(s32 chan); -u32 EXIClearInterrupts(s32 chan, BOOL clearExi, BOOL clearTc, BOOL clearExt); +u32 EXIClearInterrupts(s32 chan, BOOL clearExi, BOOL clearTc, BOOL clearExt); EXICallback EXISetExiCallback(s32 chan, EXICallback exiCallback); -void EXIProbeReset(); +void EXIProbeReset(); -BOOL EXIProbe(s32 chan); -s32 EXIProbeEx(s32 chan); +BOOL EXIProbe(s32 chan); +s32 EXIProbeEx(s32 chan); -BOOL EXIAttach(s32 chan, EXICallback extCallback); -BOOL EXIDetach(s32 chan); +BOOL EXIAttach(s32 chan, EXICallback extCallback); +BOOL EXIDetach(s32 chan); -BOOL EXISelectSD(s32 chan, u32 dev, u32 freq); -BOOL EXISelect(s32 chan, u32 dev, u32 freq); -BOOL EXISelectEx(s32 chan, u32 dev, u32 freq); -BOOL EXIDeselect(s32 chan); -BOOL EXIDeselectEx(s32 chan); +BOOL EXISelectSD(s32 chan, u32 dev, u32 freq); +BOOL EXISelect(s32 chan, u32 dev, u32 freq); +BOOL EXISelectEx(s32 chan, u32 dev, u32 freq); +BOOL EXIDeselect(s32 chan); +BOOL EXIDeselectEx(s32 chan); -BOOL EXILock(s32 chan, u32 dev, EXICallback unlockedCallback); -BOOL EXIUnlock(s32 chan); +BOOL EXILock(s32 chan, u32 dev, EXICallback unlockedCallback); +BOOL EXIUnlock(s32 chan); -u32 EXIGetState(s32 chan); +u32 EXIGetState(s32 chan); -BOOL EXIGetID(s32 chan, u32 dev, u32* id); -BOOL EXIGetIDEx(s32 chan, u32 dev, u32* id); +BOOL EXIGetID(s32 chan, u32 dev, u32* id); +BOOL EXIGetIDEx(s32 chan, u32 dev, u32* id); -BOOL EXIWriteReg(s32 chan, u32 dev, u32 exiCmd, void* reg, s32 size); +BOOL EXIWriteReg(s32 chan, u32 dev, u32 exiCmd, void* reg, s32 size); -void __OSEnableBarnacle(s32 chan, u32 dev); +void __OSEnableBarnacle(s32 chan, u32 dev); typedef struct EXIQueue { - u32 device; // 0x00 - EXICallback cb; // 0x04 + u32 device; // 0x00 + EXICallback cb; // 0x04 } EXIQueue; typedef struct EXIControl { - EXICallback exiCallback; // 0x00 - EXICallback tcCallback; // 0x04 - EXICallback extCallback; // 0x08 + EXICallback exiCallback; // 0x00 + EXICallback tcCallback; // 0x04 + EXICallback extCallback; // 0x08 - vu32 state; // 0x0C + vu32 state; // 0x0C - int immLen; // 0x10 - u8* immBuf; // 0x14 + int immLen; // 0x10 + u8* immBuf; // 0x14 - u32 dev; // 0x18 - u32 id; // 0x1C - s32 idTime; // 0x20 - int items; // 0x24 + u32 dev; // 0x18 + u32 id; // 0x1C + s32 idTime; // 0x20 + int items; // 0x24 - EXIQueue queue[3]; // 0x28 + EXIQueue queue[3]; // 0x28 } EXIControl; #ifdef __cplusplus } #endif -#endif // PRIVATE_EXI_H +#endif // PRIVATE_EXI_H diff --git a/libs/RVL_SDK/include/private/fs.h b/libs/RVL_SDK/include/private/fs.h index 46c14bb4..5e7e5df6 100644 --- a/libs/RVL_SDK/include/private/fs.h +++ b/libs/RVL_SDK/include/private/fs.h @@ -9,34 +9,34 @@ extern "C" { #endif -#define FS_MAX_PATH 64 +#define FS_MAX_PATH 64 #define FS_MAX_DIR_PATH 12 typedef s32 ISFSError; -typedef void (*ISFSCallback) (ISFSError, void*); +typedef void (*ISFSCallback)(ISFSError, void*); enum { - ISFS_ERROR_OK = 0, + ISFS_ERROR_OK = 0, - ISFS_ERROR_INVALID = -101, - ISFS_ERROR_ACCESS = -102, - ISFS_ERROR_CORRUPT = -103, - ISFS_ERROR_NOTREADY = -104, - ISFS_ERROR_EXISTS = -105, - ISFS_ERROR_NOEXISTS = -106, - ISFS_ERROR_MAXFILES = -107, - ISFS_ERROR_MAXBLOCKS = -108, - ISFS_ERROR_MAXFD = -109, - ISFS_ERROR_MAXDEPTH = -110, - ISFS_ERROR_OPENFD = -111, - ISFS_ERROR_BADBLOCK = -112, - ISFS_ERROR_ECC = -113, - ISFS_ERROR_ECC_CRIT = -114, - ISFS_ERROR_NOTEMPTY = -115, - ISFS_ERROR_AUTHENTICATION = -116, - ISFS_ERROR_UNKNOWN = -117, - ISFS_ERROR_BUSY = -118, - ISFS_ERROR_SHUTDOWN = -119 + ISFS_ERROR_INVALID = -101, + ISFS_ERROR_ACCESS = -102, + ISFS_ERROR_CORRUPT = -103, + ISFS_ERROR_NOTREADY = -104, + ISFS_ERROR_EXISTS = -105, + ISFS_ERROR_NOEXISTS = -106, + ISFS_ERROR_MAXFILES = -107, + ISFS_ERROR_MAXBLOCKS = -108, + ISFS_ERROR_MAXFD = -109, + ISFS_ERROR_MAXDEPTH = -110, + ISFS_ERROR_OPENFD = -111, + ISFS_ERROR_BADBLOCK = -112, + ISFS_ERROR_ECC = -113, + ISFS_ERROR_ECC_CRIT = -114, + ISFS_ERROR_NOTEMPTY = -115, + ISFS_ERROR_AUTHENTICATION = -116, + ISFS_ERROR_UNKNOWN = -117, + ISFS_ERROR_BUSY = -118, + ISFS_ERROR_SHUTDOWN = -119 }; enum { @@ -53,34 +53,34 @@ enum { }; typedef struct ISFSStats { - u32 blockSize; // 0x00 + u32 blockSize; // 0x00 - u32 freeBlocks; // 0x04 - u32 usedBlocks; // 0x08 + u32 freeBlocks; // 0x04 + u32 usedBlocks; // 0x08 - u32 badBlocks; // 0x0C - u32 reservedBlocks; // 0x10 + u32 badBlocks; // 0x0C + u32 reservedBlocks; // 0x10 - u32 freeInodes; // 0x14 - u32 usedInodes; // 0x18 + u32 freeInodes; // 0x14 + u32 usedInodes; // 0x18 } ISFSStats; typedef struct ISFSFileStats { - u32 size; // 0x00 - u32 offset; // 0x04 + u32 size; // 0x00 + u32 offset; // 0x04 } ISFSFileStats; typedef struct ISFSPathAttrArgs { - u32 ownerId; // 0x00 - u16 groupId; // 0x04 + u32 ownerId; // 0x00 + u16 groupId; // 0x04 - u8 path[FS_MAX_PATH]; // 0x06 + u8 path[FS_MAX_PATH]; // 0x06 - u8 ownerAccess; // 0x46 - u8 groupAccess; // 0x47 - u8 othersAccess; // 0x48 + u8 ownerAccess; // 0x46 + u8 groupAccess; // 0x47 + u8 othersAccess; // 0x48 - u8 attr; // 0x49 + u8 attr; // 0x49 } ISFSPathAttrArgs; typedef struct ISFSPathsArgs { @@ -88,58 +88,61 @@ typedef struct ISFSPathsArgs { u8 path2[FS_MAX_PATH]; // 0x40 } ISFSPathsArgs; -ISFSError ISFS_OpenLib(); -ISFSError ISFS_OpenLibEx(); +ISFSError ISFS_OpenLib(); +ISFSError ISFS_OpenLibEx(); -ISFSError ISFS_CloseLib(); +ISFSError ISFS_CloseLib(); -ISFSError ISFS_GetStats(ISFSStats* stats); +ISFSError ISFS_GetStats(ISFSStats* stats); -ISFSError ISFS_CreateDir(const char* dirName, u32 dirAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc); -ISFSError ISFS_CreateDirAsync(const char* dirName, u32 dirAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc, ISFSCallback callback, void* callbackArg); +ISFSError ISFS_CreateDir(const char* dirName, u32 dirAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc); +ISFSError ISFS_CreateDirAsync(const char* dirName, u32 dirAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc, ISFSCallback callback, void* callbackArg); -ISFSError ISFS_ReadDir(const char* dirName, char* nameList, u32* num); -ISFSError ISFS_ReadDirAsync(const char* dirName, char* nameList, u32* num, ISFSCallback callback, void* callbackArg); +ISFSError ISFS_ReadDir(const char* dirName, char* nameList, u32* num); +ISFSError ISFS_ReadDirAsync(const char* dirName, char* nameList, u32* num, ISFSCallback callback, void* callbackArg); -ISFSError ISFS_SetAttr(const char* fileName, u32 ownerId, u16 groupId, u32 attr, u32 ownerAcc, u32 groupAcc, u32 othersAcc); -ISFSError ISFS_SetAttrAsync(const char* fileName, u32 ownerId, u16 groupId, u32 attr, u32 ownerAcc, u32 groupAcc, u32 othersAcc, ISFSCallback callback, void* callbackArg); +ISFSError ISFS_SetAttr(const char* fileName, u32 ownerId, u16 groupId, u32 attr, u32 ownerAcc, u32 groupAcc, u32 othersAcc); +ISFSError ISFS_SetAttrAsync(const char* fileName, u32 ownerId, u16 groupId, u32 attr, u32 ownerAcc, u32 groupAcc, u32 othersAcc, + ISFSCallback callback, void* callbackArg); -ISFSError ISFS_GetAttr(const char* fileName, u32* ownerId, u16* groupId, u32* attr, u32* ownerAcc, u32* groupAcc, u32* othersAcc); -ISFSError ISFS_GetAttrAsync(const char* fileName, u32* ownerId, u16* groupId, u32* attr, u32* ownerAcc, u32* groupAcc, u32* othersAcc, ISFSCallback callback, void* callbackArg); +ISFSError ISFS_GetAttr(const char* fileName, u32* ownerId, u16* groupId, u32* attr, u32* ownerAcc, u32* groupAcc, u32* othersAcc); +ISFSError ISFS_GetAttrAsync(const char* fileName, u32* ownerId, u16* groupId, u32* attr, u32* ownerAcc, u32* groupAcc, u32* othersAcc, + ISFSCallback callback, void* callbackArg); -ISFSError ISFS_Delete(const char* fileName); -ISFSError ISFS_DeleteAsync(const char* fileName, ISFSCallback callback, void* callbackArg); +ISFSError ISFS_Delete(const char* fileName); +ISFSError ISFS_DeleteAsync(const char* fileName, ISFSCallback callback, void* callbackArg); -ISFSError ISFS_Rename(const char* oldName, const char* newName); -ISFSError ISFS_RenameAsync(const char* oldName, const char* newName, ISFSCallback callback, void* callbackArg); +ISFSError ISFS_Rename(const char* oldName, const char* newName); +ISFSError ISFS_RenameAsync(const char* oldName, const char* newName, ISFSCallback callback, void* callbackArg); -ISFSError ISFS_GetUsage(const char* dirName, u32* blocks, u32* iNodes); +ISFSError ISFS_GetUsage(const char* dirName, u32* blocks, u32* iNodes); -ISFSError ISFS_CreateFile(const char* fileName, u32 fileAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc); -ISFSError ISFS_CreateFileAsync(const char* fileName, u32 fileAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc, ISFSCallback callback, void* callbackArg); +ISFSError ISFS_CreateFile(const char* fileName, u32 fileAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc); +ISFSError ISFS_CreateFileAsync(const char* fileName, u32 fileAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc, ISFSCallback callback, + void* callbackArg); -IOSFd ISFS_Open(const char* fileName, u32 access); -IOSFd ISFS_OpenAsync(const char* fileName, u32 access, ISFSCallback callback, void* callbackArg); +IOSFd ISFS_Open(const char* fileName, u32 access); +IOSFd ISFS_OpenAsync(const char* fileName, u32 access, ISFSCallback callback, void* callbackArg); -ISFSError ISFS_GetFileStats(IOSFd fd, ISFSFileStats* stats); -ISFSError ISFS_GetFileStatsAsync(IOSFd fd, ISFSFileStats* stats, ISFSCallback callback, void* callbackArg); +ISFSError ISFS_GetFileStats(IOSFd fd, ISFSFileStats* stats); +ISFSError ISFS_GetFileStatsAsync(IOSFd fd, ISFSFileStats* stats, ISFSCallback callback, void* callbackArg); -ISFSError ISFS_Seek(IOSFd fd, s32 offset, u32 whence); -ISFSError ISFS_SeekAsync(IOSFd fd, s32 offset, u32 whence, ISFSCallback callback, void* callbackArg); +ISFSError ISFS_Seek(IOSFd fd, s32 offset, u32 whence); +ISFSError ISFS_SeekAsync(IOSFd fd, s32 offset, u32 whence, ISFSCallback callback, void* callbackArg); -ISFSError ISFS_Read(s32 fd, u8* buffer, u32 bufferLen); -ISFSError ISFS_ReadAsync(IOSFd fd, u8* buffer, u32 size, ISFSCallback callback, void* callbackArg); +ISFSError ISFS_Read(s32 fd, u8* buffer, u32 bufferLen); +ISFSError ISFS_ReadAsync(IOSFd fd, u8* buffer, u32 size, ISFSCallback callback, void* callbackArg); -ISFSError ISFS_Write(IOSFd fd, const char* buffer, u32 size); -ISFSError ISFS_WriteAsync(IOSFd fd, const char* buffer, u32 size, ISFSCallback callback, void* callbackArg); +ISFSError ISFS_Write(IOSFd fd, const char* buffer, u32 size); +ISFSError ISFS_WriteAsync(IOSFd fd, const char* buffer, u32 size, ISFSCallback callback, void* callbackArg); -ISFSError ISFS_Close(IOSFd fd); -ISFSError ISFS_CloseAsync(IOSFd fd, ISFSCallback callback, void* callbackArg); +ISFSError ISFS_Close(IOSFd fd); +ISFSError ISFS_CloseAsync(IOSFd fd, ISFSCallback callback, void* callbackArg); -ISFSError ISFS_ShutdownAsync(ISFSCallback callback, void* callbackArg); +ISFSError ISFS_ShutdownAsync(ISFSCallback callback, void* callbackArg); #ifdef __cplusplus } #endif -#endif // PRIVATE_FS_H +#endif // PRIVATE_FS_H diff --git a/libs/RVL_SDK/include/private/gx.h b/libs/RVL_SDK/include/private/gx.h index a05db845..412ffc57 100644 --- a/libs/RVL_SDK/include/private/gx.h +++ b/libs/RVL_SDK/include/private/gx.h @@ -3,8 +3,8 @@ #include -#include #include +#include #include #ifdef __cplusplus @@ -12,117 +12,117 @@ extern "C" { #endif typedef struct __GXData_struct { - u16 vNumNot; - u16 bpSentNot; + u16 vNumNot; + u16 bpSentNot; - u16 vNum; - u16 vLim; + u16 vNum; + u16 vLim; - u32 cpEnable; - u32 cpStatus; - u32 cpClr; + u32 cpEnable; + u32 cpStatus; + u32 cpClr; - u32 vcdLo; - u32 vcdHi; + u32 vcdLo; + u32 vcdHi; - u32 vatA[8]; - u32 vatB[8]; - u32 vatC[8]; + u32 vatA[8]; + u32 vatB[8]; + u32 vatC[8]; - u32 lpSize; + u32 lpSize; - u32 matIdxA; - u32 matIdxB; + u32 matIdxA; + u32 matIdxB; - u32 indexBase[4]; - u32 indexStride[4]; + u32 indexBase[4]; + u32 indexStride[4]; - u32 ambColor[2]; - u32 matColor[2]; + u32 ambColor[2]; + u32 matColor[2]; - u32 chanCtrl[4]; - u32 texGenCtrl[8]; - u32 texGenCtrl2[8]; + u32 chanCtrl[4]; + u32 texGenCtrl[8]; + u32 texGenCtrl2[8]; - u32 suTs0[8]; - u32 suTs1[8]; - u32 suScis0; - u32 suScis1; + u32 suTs0[8]; + u32 suTs1[8]; + u32 suScis0; + u32 suScis1; - u32 tref[8]; - u32 iref; + u32 tref[8]; + u32 iref; - u32 bpMask; + u32 bpMask; - u32 IndTexScale0; - u32 IndTexScale1; + u32 IndTexScale0; + u32 IndTexScale1; - u32 tevc[16]; - u32 teva[16]; - u32 tevKsel[8]; + u32 tevc[16]; + u32 teva[16]; + u32 tevKsel[8]; - u32 cmode0; - u32 cmode1; + u32 cmode0; + u32 cmode1; - u32 zmode; + u32 zmode; - u32 peCtrl; + u32 peCtrl; - u32 cpDispSrc; - u32 cpDispSize; - u32 cpDispStride; - u32 cpDisp; - u32 cpTexSrc; - u32 cpTexSize; - u32 cpTexStride; - u32 cpTex; - GXBool cpTexZ; + u32 cpDispSrc; + u32 cpDispSize; + u32 cpDispStride; + u32 cpDisp; + u32 cpTexSrc; + u32 cpTexSize; + u32 cpTexStride; + u32 cpTex; + GXBool cpTexZ; - u32 genMode; + u32 genMode; - GXTexRegion TexRegions0[8]; - GXTexRegion TexRegions1[8]; - GXTexRegion TexRegions2[8]; + GXTexRegion TexRegions0[8]; + GXTexRegion TexRegions1[8]; + GXTexRegion TexRegions2[8]; - GXTlutRegion TlutRegions[20]; + GXTlutRegion TlutRegions[20]; - GXTexRegion* (*texRegionCallback)(const GXTexObj*, GXTexMapID); - GXTlutRegion* (*tlutRegionCallback)(u32); + GXTexRegion* (*texRegionCallback)(const GXTexObj*, GXTexMapID); + GXTlutRegion* (*tlutRegionCallback)(u32); - GXAttrType nrmType; - GXBool hasNrms; - GXBool hasBiNrms; + GXAttrType nrmType; + GXBool hasNrms; + GXBool hasBiNrms; - u32 projType; - f32 projMtx[6]; + u32 projType; + f32 projMtx[6]; - f32 vpLeft; - f32 vpTop; - f32 vpWd; - f32 vpHt; - f32 vpNearz; - f32 vpFarz; + f32 vpLeft; + f32 vpTop; + f32 vpWd; + f32 vpHt; + f32 vpNearz; + f32 vpFarz; - f32 zOffset; - f32 zScale; + f32 zOffset; + f32 zScale; - u32 tImage0[8]; - u32 tMode0[8]; - u32 texmapId[16]; + u32 tImage0[8]; + u32 tMode0[8]; + u32 texmapId[16]; - u32 tcsManEnab; - u32 tevTcEnab; + u32 tcsManEnab; + u32 tevTcEnab; - GXPerf0 perf0; - GXPerf1 perf1; - u32 perfSel; + GXPerf0 perf0; + GXPerf1 perf1; + u32 perfSel; - GXBool inDispList; - GXBool dlSaveContext; - GXBool abtWaitPECopy; + GXBool inDispList; + GXBool dlSaveContext; + GXBool abtWaitPECopy; - u8 dirtyVAT; - u32 dirtyState; + u8 dirtyVAT; + u32 dirtyState; } GXData; extern GXData* const __GXData; @@ -149,55 +149,55 @@ typedef struct __GXFifoObj { } __GXFifoObj; typedef struct __GXLightObjInt_struct { - u32 reserved[3]; // 0x00 - u32 Color; // 0x0C - f32 a[3]; // 0x10 - f32 k[3]; // 0x1C - f32 lpos[3]; // 0x28 - f32 ldir[3]; // 0x34 + u32 reserved[3]; // 0x00 + u32 Color; // 0x0C + f32 a[3]; // 0x10 + f32 k[3]; // 0x1C + f32 lpos[3]; // 0x28 + f32 ldir[3]; // 0x34 } __GXLightObjInt; typedef struct TEVCOpTable { - u32 rid : 8; - u32 dest : 2; - u32 shift : 2; - u32 clamp : 1; - u32 sub : 1; - u32 bias : 2; - u32 sela : 4; - u32 selb : 4; - u32 selc : 4; - u32 seld : 4; + u32 rid : 8; + u32 dest : 2; + u32 shift : 2; + u32 clamp : 1; + u32 sub : 1; + u32 bias : 2; + u32 sela : 4; + u32 selb : 4; + u32 selc : 4; + u32 seld : 4; } TEVCOpTable; typedef struct TEVAOpTable { - u32 rid : 8; - u32 dest : 2; - u32 shift : 2; - u32 clamp : 1; - u32 sub : 1; - u32 bias : 2; - u32 sela : 3; - u32 selb : 3; - u32 selc : 3; - u32 seld : 3; - u32 swap : 2; - u32 mode : 2; + u32 rid : 8; + u32 dest : 2; + u32 shift : 2; + u32 clamp : 1; + u32 sub : 1; + u32 bias : 2; + u32 sela : 3; + u32 selb : 3; + u32 selc : 3; + u32 seld : 3; + u32 swap : 2; + u32 mode : 2; } TEVAOpTable; typedef struct __GXTexObjInt_struct { - u32 mode0, mode1; - u32 image0, image3; + u32 mode0, mode1; + u32 image0, image3; - void* userData; + void* userData; - GXTexFmt fmt; - u32 tlutName; + GXTexFmt fmt; + u32 tlutName; - u16 loadCnt; - u8 loadFmt; + u16 loadCnt; + u8 loadFmt; - u8 flags; + u8 flags; } __GXTexObjInt; typedef struct __GXTexRegionInt_struct { @@ -206,8 +206,8 @@ typedef struct __GXTexRegionInt_struct { u16 sizeEven; u16 sizeOdd; - u8 is32bMipmap; - u8 isCached; + u8 is32bMipmap; + u8 isCached; } __GXTexRegionInt; typedef struct __GXTlutObjInt_struct { @@ -217,8 +217,8 @@ typedef struct __GXTlutObjInt_struct { } __GXTlutObjInt; typedef struct __GXTlutRegionInt_struct { - u32 loadTlut1; - __GXTlutObjInt tlutObj; + u32 loadTlut1; + __GXTlutObjInt tlutObj; } __GXTlutRegionInt; // Private functions @@ -238,9 +238,9 @@ void __GXSetIndirectMask(u32 mask); void __GXFlushTextureState(); // Fifo -GXBool __GXIsGPFifoReady(); -void __GXFifoInit(); -void __GXCleanGPFifo(); +GXBool __GXIsGPFifoReady(); +void __GXFifoInit(); +void __GXCleanGPFifo(); // Geometry void __GXSetDirtyState(); @@ -263,69 +263,70 @@ void __GetImageTileCount(GXTexFmt fmt, u16 wd, u16 ht, u32* rowTiles, u32* colTi // Private Macros -#define GX_WRITE_U8(ub) GXWGFifo.u8 = (u8)(ub) -#define GX_WRITE_U16(us) GXWGFifo.u16 = (u16)(us) -#define GX_WRITE_U32(ui) GXWGFifo.u32 = (u32)(ui) -#define GX_WRITE_F32(f) GXWGFifo.f32 = (f32)(f) +#define GX_WRITE_U8(ub) GXWGFifo.u8 = (u8)(ub) +#define GX_WRITE_U16(us) GXWGFifo.u16 = (u16)(us) +#define GX_WRITE_U32(ui) GXWGFifo.u32 = (u32)(ui) +#define GX_WRITE_F32(f) GXWGFifo.f32 = (f32)(f) -#define GX_WRITE_XF_REG(addr, value) { \ - GX_WRITE_U8(0x10); \ - GX_WRITE_U32(addr); \ - GX_WRITE_U32(value); \ -} +#define GX_WRITE_XF_REG(addr, value) \ + { \ + GX_WRITE_U8(0x10); \ + GX_WRITE_U32(addr); \ + GX_WRITE_U32(value); \ + } -#define GX_WRITE_XF_REG_2(addr, value) { \ - GX_WRITE_U32(value); \ -} +#define GX_WRITE_XF_REG_2(addr, value) \ + { GX_WRITE_U32(value); } -#define GX_WRITE_XF_REG_F(addr, value) { \ - GX_WRITE_F32(value); \ -} +#define GX_WRITE_XF_REG_F(addr, value) \ + { GX_WRITE_F32(value); } -#define GX_WRITE_RAS_REG(value) { \ - GX_WRITE_U8(0x61); \ - GX_WRITE_U32(value); \ -} +#define GX_WRITE_RAS_REG(value) \ + { \ + GX_WRITE_U8(0x61); \ + GX_WRITE_U32(value); \ + } -#define GX_WRITE_SOME_REG2(a, b, c, addr) { \ - GX_WRITE_U8(a); \ - GX_WRITE_U8(b); \ - GX_WRITE_U32(c); \ -} +#define GX_WRITE_SOME_REG2(a, b, c, addr) \ + { \ + GX_WRITE_U8(a); \ + GX_WRITE_U8(b); \ + GX_WRITE_U32(c); \ + } -#define GX_WRITE_SOME_REG3(a, b, c, addr) { \ - GX_WRITE_U8(a); \ - GX_WRITE_U8(b); \ - GX_WRITE_U32(c); \ -} +#define GX_WRITE_SOME_REG3(a, b, c, addr) \ + { \ + GX_WRITE_U8(a); \ + GX_WRITE_U8(b); \ + GX_WRITE_U32(c); \ + } -#define GX_WRITE_SOME_REG4(a, b, c, addr) { \ - s32 regAddr; \ - GX_WRITE_U8(a); \ - GX_WRITE_U8(b); \ - GX_WRITE_U32(c); \ - regAddr = addr; \ -} +#define GX_WRITE_SOME_REG4(a, b, c, addr) \ + { \ + s32 regAddr; \ + GX_WRITE_U8(a); \ + GX_WRITE_U8(b); \ + GX_WRITE_U32(c); \ + regAddr = addr; \ + } #define GET_REG_FIELD(reg, size, shift) ((int)((reg) >> (shift)) & ((1 << (size)) - 1)) -#define OLD_SET_REG_FIELD(reg, size, shift, val) { \ - (reg) = ((u32)(reg) & ~(((1 << (size)) - 1) << (shift))) | ((u32)(val) << (shift)); \ -} +#define OLD_SET_REG_FIELD(reg, size, shift, val) \ + { (reg) = ((u32)(reg) & ~(((1 << (size)) - 1) << (shift))) | ((u32)(val) << (shift)); } -#define SET_REG_FIELD(reg, size, shift, val) { \ - (reg) = ((u32)__rlwimi((u32)(reg), (val), (shift), 32 - (shift) - (size), 31 - (shift))); \ -} +#define SET_REG_FIELD(reg, size, shift, val) \ + { (reg) = ((u32)__rlwimi((u32)(reg), (val), (shift), 32 - (shift) - (size), 31 - (shift))); } #define GX_GET_MEM_REG(offset) (*(vu16*)((vu16*)(__memReg) + (offset))) -#define GX_GET_CP_REG(offset) (*(vu16*)((vu16*)(__cpReg) + (offset))) -#define GX_GET_PE_REG(offset) (*(vu16*)((vu16*)(__peReg) + (offset))) -#define GX_GET_PI_REG(offset) (*(vu32*)((vu32*)(__piReg) + (offset))) +#define GX_GET_CP_REG(offset) (*(vu16*)((vu16*)(__cpReg) + (offset))) +#define GX_GET_PE_REG(offset) (*(vu16*)((vu16*)(__peReg) + (offset))) +#define GX_GET_PI_REG(offset) (*(vu32*)((vu32*)(__piReg) + (offset))) -#define GX_SET_MEM_REG(offset, val) (*(vu16*)((vu16*)(__memReg) + (offset)) = val) -#define GX_SET_CP_REG(offset, val) (*(vu16*)((vu16*)(__cpReg) + (offset)) = val) -#define GX_SET_PE_REG(offset, val) (*(vu16*)((vu16*)(__peReg) + (offset)) = val) -#define GX_SET_PI_REG(offset, val) (*(vu32*)((vu32*)(__piReg) + (offset)) = val) +#define GX_SET_MEM_REG(offset, val) (*(vu16*)((vu16*)(__memReg) + (offset)) = val) +#define GX_SET_CP_REG(offset, val) (*(vu16*)((vu16*)(__cpReg) + (offset)) = val) +#define GX_SET_PE_REG(offset, val) (*(vu16*)((vu16*)(__peReg) + (offset)) = val) +#define GX_SET_PI_REG(offset, val) (*(vu32*)((vu32*)(__piReg) + (offset)) = val) static inline u32 __GXReadCPCounterU32(u32 regAddrL, u32 regAddrH) { u32 ctrH0; @@ -379,4 +380,4 @@ static inline u32 __GXReadPECounterU32(u32 regAddrL, u32 regAddrH) { } #endif -#endif // PRIVATE_GX_H +#endif // PRIVATE_GX_H diff --git a/libs/RVL_SDK/include/private/hollywood.h b/libs/RVL_SDK/include/private/hollywood.h index f38bbf49..a103bec1 100644 --- a/libs/RVL_SDK/include/private/hollywood.h +++ b/libs/RVL_SDK/include/private/hollywood.h @@ -4,10 +4,10 @@ #include #include -#define HOLLYWOOD_ES_1_0 0x00000000 -#define HOLLYWOOD_ES_1_1 0x00000001 -#define HOLLYWOOD_ES_1_2 0x00000002 -#define HOLLYWOOD_ES_2_0 0x00000010 -#define HOLLYWOOD_ES_2_1 0x00000011 +#define HOLLYWOOD_ES_1_0 0x00000000 +#define HOLLYWOOD_ES_1_1 0x00000001 +#define HOLLYWOOD_ES_1_2 0x00000002 +#define HOLLYWOOD_ES_2_0 0x00000010 +#define HOLLYWOOD_ES_2_1 0x00000011 -#endif // PRIVATE_HOLLYWOOD_H +#endif // PRIVATE_HOLLYWOOD_H diff --git a/libs/RVL_SDK/include/private/hollywood/flipper.h b/libs/RVL_SDK/include/private/hollywood/flipper.h index 76dcdadf..3c8caf50 100644 --- a/libs/RVL_SDK/include/private/hollywood/flipper.h +++ b/libs/RVL_SDK/include/private/hollywood/flipper.h @@ -5,126 +5,126 @@ #include -#define __flipper_set_bit(x, b) SET_FLAG(x, b) -#define __flipper_clear_bit(x, b) CLEAR_FLAG(x, b) -#define __flipper_has_bit(x, b) HAS_FLAG(x, b) +#define __flipper_set_bit(x, b) SET_FLAG(x, b) +#define __flipper_clear_bit(x, b) CLEAR_FLAG(x, b) +#define __flipper_has_bit(x, b) HAS_FLAG(x, b) /* Video Interface */ -#define VI_REG_ADDRESS 0x0C002000 -vu16 __VIRegs[64] ADDRESS(OS_BASE_UNCACHED + VI_REG_ADDRESS); +#define VI_REG_ADDRESS 0x0C002000 +vu16 __VIRegs[64] ADDRESS(OS_BASE_UNCACHED + VI_REG_ADDRESS); -#define VI_WRITE_REG(x, v) __VIRegs[(x) >> 1] = ((u16)v) -#define VI_READ_REG(x) __VIRegs[(x) >> 1] +#define VI_WRITE_REG(x, v) __VIRegs[(x) >> 1] = ((u16)v) +#define VI_READ_REG(x) __VIRegs[(x) >> 1] -#define VI_WRITE_REG32(x, v) *(u32*)&__VIRegs[(x) >> 1] = ((u32)v) -#define VI_READ_REG32(x) *(u32*)&__VIRegs[(x) >> 1] +#define VI_WRITE_REG32(x, v) *(u32*)&__VIRegs[(x) >> 1] = ((u32)v) +#define VI_READ_REG32(x) *(u32*)&__VIRegs[(x) >> 1] -#define VI_SET_REG_F(x, v) __flipper_set_bit (__VIRegs[(x) >> 1], v) -#define VI_DEL_REG_F(x, v) __flipper_clear_bit(__VIRegs[(x) >> 1], v) -#define VI_HAS_REG_F(x, v) __flipper_has_bit (__VIRegs[(x) >> 1], v) +#define VI_SET_REG_F(x, v) __flipper_set_bit(__VIRegs[(x) >> 1], v) +#define VI_DEL_REG_F(x, v) __flipper_clear_bit(__VIRegs[(x) >> 1], v) +#define VI_HAS_REG_F(x, v) __flipper_has_bit(__VIRegs[(x) >> 1], v) #include /* Processor Interface */ -#define PI_REG_ADDRESS 0x0C003000 -vu32 __PIRegs[64] ADDRESS(OS_BASE_UNCACHED + PI_REG_ADDRESS); +#define PI_REG_ADDRESS 0x0C003000 +vu32 __PIRegs[64] ADDRESS(OS_BASE_UNCACHED + PI_REG_ADDRESS); -#define PI_WRITE_REG(x, v) __PIRegs[(x) >> 2] = ((u32)v) -#define PI_READ_REG(x) __PIRegs[(x) >> 2] +#define PI_WRITE_REG(x, v) __PIRegs[(x) >> 2] = ((u32)v) +#define PI_READ_REG(x) __PIRegs[(x) >> 2] -#define PI_SET_REG_F(x, v) __flipper_set_bit (__PIRegs[(x) >> 2], v) -#define PI_DEL_REG_F(x, v) __flipper_clear_bit(__PIRegs[(x) >> 2], v) -#define PI_HAS_REG_F(x, v) __flipper_has_bit (__PIRegs[(x) >> 2], v) +#define PI_SET_REG_F(x, v) __flipper_set_bit(__PIRegs[(x) >> 2], v) +#define PI_DEL_REG_F(x, v) __flipper_clear_bit(__PIRegs[(x) >> 2], v) +#define PI_HAS_REG_F(x, v) __flipper_has_bit(__PIRegs[(x) >> 2], v) #include /* Audio DSP */ -#define DSP_REG_ADDRESS 0x0C005000 -vu16 __DSPRegs[128] ADDRESS(OS_BASE_UNCACHED + DSP_REG_ADDRESS); +#define DSP_REG_ADDRESS 0x0C005000 +vu16 __DSPRegs[128] ADDRESS(OS_BASE_UNCACHED + DSP_REG_ADDRESS); -#define DSP_WRITE_REG(x, v) __DSPRegs[(x) >> 1] = (v) -#define DSP_READ_REG(x) __DSPRegs[(x) >> 1] +#define DSP_WRITE_REG(x, v) __DSPRegs[(x) >> 1] = (v) +#define DSP_READ_REG(x) __DSPRegs[(x) >> 1] -#define DSP_WRITE_REG32(x, v) *(u32*)&__DSPRegs[(x) >> 1] = (v) -#define DSP_READ_REG32(x) *(u32*)&__DSPRegs[(x) >> 1] +#define DSP_WRITE_REG32(x, v) *(u32*)&__DSPRegs[(x) >> 1] = (v) +#define DSP_READ_REG32(x) *(u32*)&__DSPRegs[(x) >> 1] -#define DSP_SET_REG_F(x, v) __flipper_set_bit (__DSPRegs[(x) >> 1], v) -#define DSP_DEL_REG_F(x, v) __flipper_clear_bit(__DSPRegs[(x) >> 1], v) -#define DSP_HAS_REG_F(x, v) __flipper_has_bit (__DSPRegs[(x) >> 1], v) +#define DSP_SET_REG_F(x, v) __flipper_set_bit(__DSPRegs[(x) >> 1], v) +#define DSP_DEL_REG_F(x, v) __flipper_clear_bit(__DSPRegs[(x) >> 1], v) +#define DSP_HAS_REG_F(x, v) __flipper_has_bit(__DSPRegs[(x) >> 1], v) #include /* Audio Inerface */ -#define AI_REG_ADDRESS 0x0D006C00 -vu32 __AIRegs[8] ADDRESS(OS_BASE_UNCACHED + AI_REG_ADDRESS); +#define AI_REG_ADDRESS 0x0D006C00 +vu32 __AIRegs[8] ADDRESS(OS_BASE_UNCACHED + AI_REG_ADDRESS); -#define AI_WRITE_REG(x, v) __AIRegs[(x) >> 2] = ((u32)v) -#define AI_READ_REG(x) __AIRegs[(x) >> 2] +#define AI_WRITE_REG(x, v) __AIRegs[(x) >> 2] = ((u32)v) +#define AI_READ_REG(x) __AIRegs[(x) >> 2] -#define AI_SET_REG_F(x, v) __flipper_set_bit (__AIRegs[(x) >> 2], v) -#define AI_DEL_REG_F(x, v) __flipper_clear_bit(__AIRegs[(x) >> 2], v) -#define AI_HAS_REG_F(x, v) __flipper_has_bit (__AIRegs[(x) >> 2], v) +#define AI_SET_REG_F(x, v) __flipper_set_bit(__AIRegs[(x) >> 2], v) +#define AI_DEL_REG_F(x, v) __flipper_clear_bit(__AIRegs[(x) >> 2], v) +#define AI_HAS_REG_F(x, v) __flipper_has_bit(__AIRegs[(x) >> 2], v) #include /* External Inerface */ -#define EXI_REG_ADDRESS 0x0D006800 -vu32 __EXIRegs[30] ADDRESS(OS_BASE_UNCACHED + EXI_REG_ADDRESS); +#define EXI_REG_ADDRESS 0x0D006800 +vu32 __EXIRegs[30] ADDRESS(OS_BASE_UNCACHED + EXI_REG_ADDRESS); -#define EXI_WRITE_REG(x, v) __EXIRegs[(x) >> 2] = ((u32)v) -#define EXI_READ_REG(x) __EXIRegs[(x) >> 2] +#define EXI_WRITE_REG(x, v) __EXIRegs[(x) >> 2] = ((u32)v) +#define EXI_READ_REG(x) __EXIRegs[(x) >> 2] -#define EXI_SET_REG_F(x, v) __flipper_set_bit (__EXIRegs[(x) >> 2], v) -#define EXI_DEL_REG_F(x, v) __flipper_clear_bit(__EXIRegs[(x) >> 2], v) -#define EXI_HAS_REG_F(x, v) __flipper_has_bit (__EXIRegs[(x) >> 2], v) +#define EXI_SET_REG_F(x, v) __flipper_set_bit(__EXIRegs[(x) >> 2], v) +#define EXI_DEL_REG_F(x, v) __flipper_clear_bit(__EXIRegs[(x) >> 2], v) +#define EXI_HAS_REG_F(x, v) __flipper_has_bit(__EXIRegs[(x) >> 2], v) #include /* Memory Interface */ -#define MEM_REG_ADDRESS 0x0C004000 -vu16 __MEMRegs[52] ADDRESS(OS_BASE_UNCACHED + MEM_REG_ADDRESS); +#define MEM_REG_ADDRESS 0x0C004000 +vu16 __MEMRegs[52] ADDRESS(OS_BASE_UNCACHED + MEM_REG_ADDRESS); -#define MEM_WRITE_REG(x, v) __MEMRegs[(x) >> 1] = ((u16)v) -#define MEM_READ_REG(x) __MEMRegs[(x) >> 1] +#define MEM_WRITE_REG(x, v) __MEMRegs[(x) >> 1] = ((u16)v) +#define MEM_READ_REG(x) __MEMRegs[(x) >> 1] -#define MEM_SET_REG_F(x, v) __flipper_set_bit (__MEMRegs[(x) >> 2], v) -#define MEM_DEL_REG_F(x, v) __flipper_clear_bit(__MEMRegs[(x) >> 2], v) -#define MEM_HAS_REG_F(x, v) __flipper_has_bit (__MEMRegs[(x) >> 2], v) +#define MEM_SET_REG_F(x, v) __flipper_set_bit(__MEMRegs[(x) >> 2], v) +#define MEM_DEL_REG_F(x, v) __flipper_clear_bit(__MEMRegs[(x) >> 2], v) +#define MEM_HAS_REG_F(x, v) __flipper_has_bit(__MEMRegs[(x) >> 2], v) #include /* Drive Interface */ -#define DI_REG_ADDRESS 0x0D006000 -vu32 __DIRegs[16] ADDRESS(OS_BASE_UNCACHED + DI_REG_ADDRESS); +#define DI_REG_ADDRESS 0x0D006000 +vu32 __DIRegs[16] ADDRESS(OS_BASE_UNCACHED + DI_REG_ADDRESS); -#define DI_WRITE_REG(x, v) __DIRegs[(x) >> 2] = ((u32)v) -#define DI_READ_REG(x) __DIRegs[(x) >> 2] +#define DI_WRITE_REG(x, v) __DIRegs[(x) >> 2] = ((u32)v) +#define DI_READ_REG(x) __DIRegs[(x) >> 2] -#define DI_SET_REG_F(x, v) __flipper_set_bit (__DIRegs[(x) >> 2], v) -#define DI_DEL_REG_F(x, v) __flipper_clear_bit(__DIRegs[(x) >> 2], v) -#define DI_HAS_REG_F(x, v) __flipper_has_bit (__DIRegs[(x) >> 2], v) +#define DI_SET_REG_F(x, v) __flipper_set_bit(__DIRegs[(x) >> 2], v) +#define DI_DEL_REG_F(x, v) __flipper_clear_bit(__DIRegs[(x) >> 2], v) +#define DI_HAS_REG_F(x, v) __flipper_has_bit(__DIRegs[(x) >> 2], v) #include /* Serial Interface */ -#define SI_REG_ADDRESS 0x0D006400 -vu32 __SIRegs[64] ADDRESS(OS_BASE_UNCACHED + SI_REG_ADDRESS); +#define SI_REG_ADDRESS 0x0D006400 +vu32 __SIRegs[64] ADDRESS(OS_BASE_UNCACHED + SI_REG_ADDRESS); -#define SI_WRITE_REG(x, v) __SIRegs[(x) >> 2] = ((u32)v) -#define SI_READ_REG(x) __SIRegs[(x) >> 2] +#define SI_WRITE_REG(x, v) __SIRegs[(x) >> 2] = ((u32)v) +#define SI_READ_REG(x) __SIRegs[(x) >> 2] -#define SI_SET_REG_F(x, v) __flipper_set_bit (__SIRegs[(x) >> 2], v) -#define SI_DEL_REG_F(x, v) __flipper_clear_bit(__SIRegs[(x) >> 2], v) -#define SI_HAS_REG_F(x, v) __flipper_has_bit (__SIRegs[(x) >> 2], v) +#define SI_SET_REG_F(x, v) __flipper_set_bit(__SIRegs[(x) >> 2], v) +#define SI_DEL_REG_F(x, v) __flipper_clear_bit(__SIRegs[(x) >> 2], v) +#define SI_HAS_REG_F(x, v) __flipper_has_bit(__SIRegs[(x) >> 2], v) #include -#endif // PRIVATE_FLIPPER_H +#endif // PRIVATE_FLIPPER_H diff --git a/libs/RVL_SDK/include/private/hollywood/flipper/ai_reg.h b/libs/RVL_SDK/include/private/hollywood/flipper/ai_reg.h index 0010dbce..fb23892f 100644 --- a/libs/RVL_SDK/include/private/hollywood/flipper/ai_reg.h +++ b/libs/RVL_SDK/include/private/hollywood/flipper/ai_reg.h @@ -1,17 +1,17 @@ #ifndef PRIVATE_HOLLYWOOD_FLIPPER_AI_REGS_H #define PRIVATE_HOLLYWOOD_FLIPPER_AI_REGS_H -#define AI_CONTROL 0x0000 -#define AI_CONTROL_PSTAT 0 -#define AI_CONTROL_AFR 1 -#define AI_CONTROL_AIINTMSK 2 -#define AI_CONTROL_AIINT 3 -#define AI_CONTROL_AIINTVLD 4 -#define AI_CONTROL_SCRESET 5 -#define AI_CONTROL_SAMPLERATE 6 +#define AI_CONTROL 0x0000 +#define AI_CONTROL_PSTAT 0 +#define AI_CONTROL_AFR 1 +#define AI_CONTROL_AIINTMSK 2 +#define AI_CONTROL_AIINT 3 +#define AI_CONTROL_AIINTVLD 4 +#define AI_CONTROL_SCRESET 5 +#define AI_CONTROL_SAMPLERATE 6 -#define AI_VOLUME 0x0004 -#define AI_AISCNT 0x0008 -#define AI_AIIT 0x000C +#define AI_VOLUME 0x0004 +#define AI_AISCNT 0x0008 +#define AI_AIIT 0x000C -#endif // PRIVATE_HOLLYWOOD_FLIPPER_AI_REGS_H +#endif // PRIVATE_HOLLYWOOD_FLIPPER_AI_REGS_H diff --git a/libs/RVL_SDK/include/private/hollywood/flipper/di_reg.h b/libs/RVL_SDK/include/private/hollywood/flipper/di_reg.h index b0a90f8d..ccfdd86f 100644 --- a/libs/RVL_SDK/include/private/hollywood/flipper/di_reg.h +++ b/libs/RVL_SDK/include/private/hollywood/flipper/di_reg.h @@ -1,19 +1,19 @@ #ifndef PRIVATE_HOLLYWOOD_FLIPPER_DI_REGS_H #define PRIVATE_HOLLYWOOD_FLIPPER_DI_REGS_H -#define DI_STATUS 0x0000 -#define DI_COVER 0x0004 +#define DI_STATUS 0x0000 +#define DI_COVER 0x0004 -#define DI_CMD_BUFFER_0 0x0008 -#define DI_CMD_BUFFER_1 0x000C -#define DI_CMD_BUFFER_2 0x0010 +#define DI_CMD_BUFFER_0 0x0008 +#define DI_CMD_BUFFER_1 0x000C +#define DI_CMD_BUFFER_2 0x0010 -#define DI_DMA_MEM_ADDRESS 0x0014 -#define DI_DMA_TRANSFER_LENGTH 0x0018 +#define DI_DMA_MEM_ADDRESS 0x0014 +#define DI_DMA_TRANSFER_LENGTH 0x0018 -#define DI_CONTROL 0x001C +#define DI_CONTROL 0x001C -#define DI_IMMEDIATE_DATA_BUF 0x0020 -#define DI_CONFIG 0x0024 +#define DI_IMMEDIATE_DATA_BUF 0x0020 +#define DI_CONFIG 0x0024 -#endif // PRIVATE_HOLLYWOOD_FLIPPER_DI_REGS_H +#endif // PRIVATE_HOLLYWOOD_FLIPPER_DI_REGS_H diff --git a/libs/RVL_SDK/include/private/hollywood/flipper/dsp_reg.h b/libs/RVL_SDK/include/private/hollywood/flipper/dsp_reg.h index 957d6c24..e30e4b7e 100644 --- a/libs/RVL_SDK/include/private/hollywood/flipper/dsp_reg.h +++ b/libs/RVL_SDK/include/private/hollywood/flipper/dsp_reg.h @@ -1,49 +1,49 @@ #ifndef PRIVATE_HOLLYWOOD_FLIPPER_DSP_REGS_H #define PRIVATE_HOLLYWOOD_FLIPPER_DSP_REGS_H -#define DSP_MAILBOX 0x0000 -#define DSP_MAILBOX_SET 15 -#define DSP_MAILBOX_H 0x0000 -#define DSP_MAILBOX_L 0x0002 +#define DSP_MAILBOX 0x0000 +#define DSP_MAILBOX_SET 15 +#define DSP_MAILBOX_H 0x0000 +#define DSP_MAILBOX_L 0x0002 -#define DSP_CPUMAILBOX 0x0004 -#define DSP_CPUMAILBOX_SET 15 -#define DSP_CPUMAILBOX_H 0x0004 -#define DSP_CPUMAILBOX_L 0x0006 +#define DSP_CPUMAILBOX 0x0004 +#define DSP_CPUMAILBOX_SET 15 +#define DSP_CPUMAILBOX_H 0x0004 +#define DSP_CPUMAILBOX_L 0x0006 -#define DSP_CONTROL_STATUS 0x000A -#define DSP_CONTROL_STATUS_RESET 11 /* Apparently this also could be "BOOTMODE" */ -#define DSP_CONTROL_STATUS_DMASTAT 10 -#define DSP_CONTROL_STATUS_ARDMASTAT 9 -#define DSP_CONTROL_STATUS_DMAINTMSK 8 -#define DSP_CONTROL_STATUS_DSPINT 7 -#define DSP_CONTROL_STATUS_ARINTMSK 6 -#define DSP_CONTROL_STATUS_ARINT 5 -#define DSP_CONTROL_STATUS_AIDINTMSK 4 -#define DSP_CONTROL_STATUS_AIDINT 3 -#define DSP_CONTROL_STATUS_HALT 2 -#define DSP_CONTROL_STATUS_PIINT 1 -#define DSP_CONTROL_STATUS_RES 0 +#define DSP_CONTROL_STATUS 0x000A +#define DSP_CONTROL_STATUS_RESET 11 /* Apparently this also could be "BOOTMODE" */ +#define DSP_CONTROL_STATUS_DMASTAT 10 +#define DSP_CONTROL_STATUS_ARDMASTAT 9 +#define DSP_CONTROL_STATUS_DMAINTMSK 8 +#define DSP_CONTROL_STATUS_DSPINT 7 +#define DSP_CONTROL_STATUS_ARINTMSK 6 +#define DSP_CONTROL_STATUS_ARINT 5 +#define DSP_CONTROL_STATUS_AIDINTMSK 4 +#define DSP_CONTROL_STATUS_AIDINT 3 +#define DSP_CONTROL_STATUS_HALT 2 +#define DSP_CONTROL_STATUS_PIINT 1 +#define DSP_CONTROL_STATUS_RES 0 -#define DSP_AR_SIZE 0x0012 -#define DSP_AR_MODE 0x0016 -#define DSP_AR_REFRESH 0x0018 -#define DSP_AR_DMA_MMADDR 0x0020 -#define DSP_AR_DMA_MMADDR_H 0x0020 -#define DSP_AR_DMA_MMADDR_L 0x0022 -#define DSP_AR_DMA_ARADDR 0x0024 -#define DSP_AR_DMA_ARADDR_H 0x0024 -#define DSP_AR_DMA_ARADDR_L 0x0026 -#define DSP_AR_DMA_SIZE 0x0028 -#define DSP_AR_DMA_SIZE_H 0x0028 -#define DSP_AR_DMA_SIZE_L 0x002A +#define DSP_AR_SIZE 0x0012 +#define DSP_AR_MODE 0x0016 +#define DSP_AR_REFRESH 0x0018 +#define DSP_AR_DMA_MMADDR 0x0020 +#define DSP_AR_DMA_MMADDR_H 0x0020 +#define DSP_AR_DMA_MMADDR_L 0x0022 +#define DSP_AR_DMA_ARADDR 0x0024 +#define DSP_AR_DMA_ARADDR_H 0x0024 +#define DSP_AR_DMA_ARADDR_L 0x0026 +#define DSP_AR_DMA_SIZE 0x0028 +#define DSP_AR_DMA_SIZE_H 0x0028 +#define DSP_AR_DMA_SIZE_L 0x002A -#define DSP_DMA_START_ADDR_H 0x0030 -#define DSP_DMA_START_ADDR_L 0x0032 +#define DSP_DMA_START_ADDR_H 0x0030 +#define DSP_DMA_START_ADDR_L 0x0032 -#define DSP_DMA_CONTROL_LENGTH 0x0036 +#define DSP_DMA_CONTROL_LENGTH 0x0036 #define DSP_DMA_CONTROL_LENGTH_CTRL 15 -#define DSP_DMA_BYTES_LEFT 0x003A +#define DSP_DMA_BYTES_LEFT 0x003A -#endif // PRIVATE_HOLLYWOOD_FLIPPER_DSP_REGS_H +#endif // PRIVATE_HOLLYWOOD_FLIPPER_DSP_REGS_H diff --git a/libs/RVL_SDK/include/private/hollywood/flipper/exi_reg.h b/libs/RVL_SDK/include/private/hollywood/flipper/exi_reg.h index 123b87a8..475249e5 100644 --- a/libs/RVL_SDK/include/private/hollywood/flipper/exi_reg.h +++ b/libs/RVL_SDK/include/private/hollywood/flipper/exi_reg.h @@ -3,52 +3,52 @@ #ifndef DEFINED_EXI_CHANS #define DEFINED_EXI_CHANS -#define EXI_CHAN_0 0 -#define EXI_CHAN_1 1 -#define EXI_CHAN_2 2 -#define EXI_CHAN_MAX 3 -#endif // DEFINED_EXI_CHANS +#define EXI_CHAN_0 0 +#define EXI_CHAN_1 1 +#define EXI_CHAN_2 2 +#define EXI_CHAN_MAX 3 +#endif // DEFINED_EXI_CHANS -#define EXI_CHAN_PARAM 0x0000 -#define EXI_MEM_ADDRESS 0x0004 -#define EXI_LENGTH 0x0008 -#define EXI_CONTROL 0x000C -#define EXI_DATA 0x0010 +#define EXI_CHAN_PARAM 0x0000 +#define EXI_MEM_ADDRESS 0x0004 +#define EXI_LENGTH 0x0008 +#define EXI_CONTROL 0x000C +#define EXI_DATA 0x0010 -#define EXI_REG_SIZE 0x0014 +#define EXI_REG_SIZE 0x0014 -#define EXI_0_CHAN_PARAM 0x0000 -#define EXI_0_MEM_ADDRESS 0x0004 -#define EXI_0_LENGTH 0x0008 -#define EXI_0_CONTROL 0x000C -#define EXI_0_DATA 0x0010 +#define EXI_0_CHAN_PARAM 0x0000 +#define EXI_0_MEM_ADDRESS 0x0004 +#define EXI_0_LENGTH 0x0008 +#define EXI_0_CONTROL 0x000C +#define EXI_0_DATA 0x0010 -#define EXI_1_CHAN_PARAM 0x0014 -#define EXI_1_MEM_ADDRESS 0x0018 -#define EXI_1_LENGTH 0x001C -#define EXI_1_CONTROL 0x0020 -#define EXI_1_DATA 0x0024 +#define EXI_1_CHAN_PARAM 0x0014 +#define EXI_1_MEM_ADDRESS 0x0018 +#define EXI_1_LENGTH 0x001C +#define EXI_1_CONTROL 0x0020 +#define EXI_1_DATA 0x0024 -#define EXI_2_CHAN_PARAM 0x0028 -#define EXI_2_MEM_ADDRESS 0x002C -#define EXI_2_LENGTH 0x0030 -#define EXI_2_CONTROL 0x0034 -#define EXI_2_DATA 0x0038 +#define EXI_2_CHAN_PARAM 0x0028 +#define EXI_2_MEM_ADDRESS 0x002C +#define EXI_2_LENGTH 0x0030 +#define EXI_2_CONTROL 0x0034 +#define EXI_2_DATA 0x0038 -#define EXI_CHAN_PARAM_INTMASK 0 -#define EXI_CHAN_PARAM_INT 1 -#define EXI_CHAN_PARAM_TCINTMASK 2 -#define EXI_CHAN_PARAM_TCINT 3 -#define EXI_CHAN_PARAM_CLK 4 -#define EXI_CHAN_PARAM_CS 7 -#define EXI_CHAN_PARAM_EXTINTMASK 10 -#define EXI_CHAN_PARAM_EXTINT 11 -#define EXI_CHAN_PARAM_EXT 12 -#define EXI_CHAN_PARAM_ROMDIS 13 /* For Gekko, this was the GC's IPL. But for hollywood, this is unknown. */ +#define EXI_CHAN_PARAM_INTMASK 0 +#define EXI_CHAN_PARAM_INT 1 +#define EXI_CHAN_PARAM_TCINTMASK 2 +#define EXI_CHAN_PARAM_TCINT 3 +#define EXI_CHAN_PARAM_CLK 4 +#define EXI_CHAN_PARAM_CS 7 +#define EXI_CHAN_PARAM_EXTINTMASK 10 +#define EXI_CHAN_PARAM_EXTINT 11 +#define EXI_CHAN_PARAM_EXT 12 +#define EXI_CHAN_PARAM_ROMDIS 13 /* For Gekko, this was the GC's IPL. But for hollywood, this is unknown. */ -#define EXI_CONTROL_TSTART 0 -#define EXI_CONTROL_DMA 1 -#define EXI_CONTROL_RW 2 -#define EXI_CONTROL_TLEN 4 +#define EXI_CONTROL_TSTART 0 +#define EXI_CONTROL_DMA 1 +#define EXI_CONTROL_RW 2 +#define EXI_CONTROL_TLEN 4 -#endif // PRIVATE_HOLLYWOOD_FLIPPER_EXI_REGS_H +#endif // PRIVATE_HOLLYWOOD_FLIPPER_EXI_REGS_H diff --git a/libs/RVL_SDK/include/private/hollywood/flipper/mem_reg.h b/libs/RVL_SDK/include/private/hollywood/flipper/mem_reg.h index fac1d766..4239a1c7 100644 --- a/libs/RVL_SDK/include/private/hollywood/flipper/mem_reg.h +++ b/libs/RVL_SDK/include/private/hollywood/flipper/mem_reg.h @@ -1,113 +1,113 @@ #ifndef PRIVATE_HOLLYWOOD_FLIPPER_MEM_REGS_H #define PRIVATE_HOLLYWOOD_FLIPPER_MEM_REGS_H -#define MEM_MARR0_START 0x0000 -#define MEM_MARR0_END 0x0002 -#define MEM_MARR1_START 0x0004 -#define MEM_MARR1_END 0x0006 -#define MEM_MARR2_START 0x0008 -#define MEM_MARR2_END 0x000A -#define MEM_MARR3_START 0x000C -#define MEM_MARR3_END 0x000E +#define MEM_MARR0_START 0x0000 +#define MEM_MARR0_END 0x0002 +#define MEM_MARR1_START 0x0004 +#define MEM_MARR1_END 0x0006 +#define MEM_MARR2_START 0x0008 +#define MEM_MARR2_END 0x000A +#define MEM_MARR3_START 0x000C +#define MEM_MARR3_END 0x000E -#define MEM_MARR_CONTROL 0x0010 +#define MEM_MARR_CONTROL 0x0010 -#define MEM_CP_BW_DIAL 0x0012 -#define MEM_TC_BW_DIAL 0x0014 -#define MEM_PE_BW_DIAL 0x0016 -#define MEM_CPUR_BW_DIAL 0x0018 -#define MEM_CPUW_BW_DIAL 0x001A +#define MEM_CP_BW_DIAL 0x0012 +#define MEM_TC_BW_DIAL 0x0014 +#define MEM_PE_BW_DIAL 0x0016 +#define MEM_CPUR_BW_DIAL 0x0018 +#define MEM_CPUW_BW_DIAL 0x001A -#define MEM_INT_ENBL 0x001C -#define MEM_INT_STAT 0x001E -#define MEM_INT_CLR 0x0020 -#define MEM_INT_ADDR 0x0022 -#define MEM_INT_ADDRL 0x0022 -#define MEM_INT_ADDRH 0x0024 +#define MEM_INT_ENBL 0x001C +#define MEM_INT_STAT 0x001E +#define MEM_INT_CLR 0x0020 +#define MEM_INT_ADDR 0x0022 +#define MEM_INT_ADDRL 0x0022 +#define MEM_INT_ADDRH 0x0024 -#define MEM_REFRESH 0x0026 +#define MEM_REFRESH 0x0026 -#define MEM_CONFIG 0x0028 +#define MEM_CONFIG 0x0028 -#define MEM_LATENCY 0x002A +#define MEM_LATENCY 0x002A -#define MEM_RDTORD 0x002E -#define MEM_WRTORD 0x0030 +#define MEM_RDTORD 0x002E +#define MEM_WRTORD 0x0030 -#define MEM_CP_REQCOUNT 0x0032 -#define MEM_CP_REQCOUNTH 0x0032 -#define MEM_CP_REQCOUNTL 0x0034 +#define MEM_CP_REQCOUNT 0x0032 +#define MEM_CP_REQCOUNTH 0x0032 +#define MEM_CP_REQCOUNTL 0x0034 -#define MEM_TC_REQCOUNT 0x0036 -#define MEM_TC_REQCOUNTH 0x0036 -#define MEM_TC_REQCOUNTL 0x0038 +#define MEM_TC_REQCOUNT 0x0036 +#define MEM_TC_REQCOUNTH 0x0036 +#define MEM_TC_REQCOUNTL 0x0038 -#define MEM_CPUR_REQCOUNT 0x003A -#define MEM_CPUR_REQCOUNTH 0x003A -#define MEM_CPUR_REQCOUNTL 0x003C +#define MEM_CPUR_REQCOUNT 0x003A +#define MEM_CPUR_REQCOUNTH 0x003A +#define MEM_CPUR_REQCOUNTL 0x003C -#define MEM_CPUW_REQCOUNT 0x003E -#define MEM_CPUW_REQCOUNTH 0x003E -#define MEM_CPUW_REQCOUNTL 0x0040 +#define MEM_CPUW_REQCOUNT 0x003E +#define MEM_CPUW_REQCOUNTH 0x003E +#define MEM_CPUW_REQCOUNTL 0x0040 -#define MEM_DSP_REQCOUNT 0x0042 -#define MEM_DSP_REQCOUNTH 0x0042 -#define MEM_DSP_REQCOUNTL 0x0044 +#define MEM_DSP_REQCOUNT 0x0042 +#define MEM_DSP_REQCOUNTH 0x0042 +#define MEM_DSP_REQCOUNTL 0x0044 -#define MEM_IO_REQCOUNT 0x0046 -#define MEM_IO_REQCOUNTH 0x0046 -#define MEM_IO_REQCOUNTL 0x0048 +#define MEM_IO_REQCOUNT 0x0046 +#define MEM_IO_REQCOUNTH 0x0046 +#define MEM_IO_REQCOUNTL 0x0048 -#define MEM_VI_REQCOUNT 0x004A -#define MEM_VI_REQCOUNTH 0x004A -#define MEM_VI_REQCOUNTL 0x004C +#define MEM_VI_REQCOUNT 0x004A +#define MEM_VI_REQCOUNTH 0x004A +#define MEM_VI_REQCOUNTL 0x004C -#define MEM_PE_REQCOUNT 0x004E -#define MEM_PE_REQCOUNTH 0x004E -#define MEM_PE_REQCOUNTL 0x0050 +#define MEM_PE_REQCOUNT 0x004E +#define MEM_PE_REQCOUNTH 0x004E +#define MEM_PE_REQCOUNTL 0x0050 -#define MEM_RF_REQCOUNT 0x0052 -#define MEM_RF_REQCOUNTH 0x0052 -#define MEM_RF_REQCOUNTL 0x0054 +#define MEM_RF_REQCOUNT 0x0052 +#define MEM_RF_REQCOUNTH 0x0052 +#define MEM_RF_REQCOUNTL 0x0054 -#define MEM_FI_REQCOUNT 0x0056 -#define MEM_FI_REQCOUNTH 0x0056 -#define MEM_FI_REQCOUNTL 0x0058 +#define MEM_FI_REQCOUNT 0x0056 +#define MEM_FI_REQCOUNTH 0x0056 +#define MEM_FI_REQCOUNTL 0x0058 -#define MEM_DRV_STRENGTH 0x005A +#define MEM_DRV_STRENGTH 0x005A -#define MEM_REFRSH_THHD 0x005C +#define MEM_REFRSH_THHD 0x005C -#define MEM_CPUAHMR_REQCOUNT 0x0060 -#define MEM_CPUAHMR_REQCOUNTH 0x0060 -#define MEM_CPUAHMR_REQCOUNTL 0x0062 +#define MEM_CPUAHMR_REQCOUNT 0x0060 +#define MEM_CPUAHMR_REQCOUNTH 0x0060 +#define MEM_CPUAHMR_REQCOUNTL 0x0062 -#define MEM_CPUAHMW_REQCOUNT 0x0064 -#define MEM_CPUAHMW_REQCOUNTH 0x0064 -#define MEM_CPUAHMW_REQCOUNTL 0x0066 +#define MEM_CPUAHMW_REQCOUNT 0x0064 +#define MEM_CPUAHMW_REQCOUNTH 0x0064 +#define MEM_CPUAHMW_REQCOUNTL 0x0066 -#define MEM_DMAAHMR_REQCOUNT 0x0068 -#define MEM_DMAAHMR_REQCOUNTH 0x0068 -#define MEM_DMAAHMR_REQCOUNTL 0x006A +#define MEM_DMAAHMR_REQCOUNT 0x0068 +#define MEM_DMAAHMR_REQCOUNTH 0x0068 +#define MEM_DMAAHMR_REQCOUNTL 0x006A -#define MEM_DMAAHMW_REQCOUNT 0x006C -#define MEM_DMAAHMW_REQCOUNTH 0x006C -#define MEM_DMAAHMW_REQCOUNTL 0x006E +#define MEM_DMAAHMW_REQCOUNT 0x006C +#define MEM_DMAAHMW_REQCOUNTH 0x006C +#define MEM_DMAAHMW_REQCOUNTL 0x006E -#define MEM_ACC_REQCOUNT 0x0070 -#define MEM_ACC_REQCOUNTH 0x0070 -#define MEM_ACC_REQCOUNTL 0x0072 +#define MEM_ACC_REQCOUNT 0x0070 +#define MEM_ACC_REQCOUNTH 0x0070 +#define MEM_ACC_REQCOUNTL 0x0072 -#define MEM_DDRREG_ADDR 0x0074 +#define MEM_DDRREG_ADDR 0x0074 -#define MEM_DDRREG_DATA 0x0076 +#define MEM_DDRREG_DATA 0x0076 -#define MEM_DRV_PSTRENGTH 0x0078 +#define MEM_DRV_PSTRENGTH 0x0078 -#define MEM_INT_MEM_0 0 -#define MEM_INT_MEM_1 1 -#define MEM_INT_MEM_2 2 -#define MEM_INT_MEM_3 3 -#define MEM_INT_MEM_ADDRESS 4 +#define MEM_INT_MEM_0 0 +#define MEM_INT_MEM_1 1 +#define MEM_INT_MEM_2 2 +#define MEM_INT_MEM_3 3 +#define MEM_INT_MEM_ADDRESS 4 -#endif // PRIVATE_HOLLYWOOD_FLIPPER_MEM_REGS_H +#endif // PRIVATE_HOLLYWOOD_FLIPPER_MEM_REGS_H diff --git a/libs/RVL_SDK/include/private/hollywood/flipper/pi_reg.h b/libs/RVL_SDK/include/private/hollywood/flipper/pi_reg.h index bdc3dc13..4927e7d7 100644 --- a/libs/RVL_SDK/include/private/hollywood/flipper/pi_reg.h +++ b/libs/RVL_SDK/include/private/hollywood/flipper/pi_reg.h @@ -1,29 +1,29 @@ #ifndef PRIVATE_HOLLYWOOD_FLIPPER_PI_REGS_H #define PRIVATE_HOLLYWOOD_FLIPPER_PI_REGS_H -#define PI_INTERRUPT_CAUSE 0x0000 -#define PI_INTERRUPT_ERROR 0 -#define PI_INTERRUPT_RSW 1 -#define PI_INTERRUPT_DI 2 -#define PI_INTERRUPT_SI 3 -#define PI_INTERRUPT_EXI 4 -#define PI_INTERRUPT_AI 5 -#define PI_INTERRUPT_DSP 6 -#define PI_INTERRUPT_MEM 7 -#define PI_INTERRUPT_VI 8 -#define PI_INTERRUPT_PE_TOKEN 9 -#define PI_INTERRUPT_PE_FINISH 10 -#define PI_INTERRUPT_CP 11 -#define PI_INTERRUPT_DEBUG 12 -#define PI_INTERRUPT_HSP 13 -#define PI_INTERRUPT_ACR 14 /* HOLLYWOOD EXCLUSIVE */ -#define PI_INTERRUPT_RSW_STATE 16 +#define PI_INTERRUPT_CAUSE 0x0000 +#define PI_INTERRUPT_ERROR 0 +#define PI_INTERRUPT_RSW 1 +#define PI_INTERRUPT_DI 2 +#define PI_INTERRUPT_SI 3 +#define PI_INTERRUPT_EXI 4 +#define PI_INTERRUPT_AI 5 +#define PI_INTERRUPT_DSP 6 +#define PI_INTERRUPT_MEM 7 +#define PI_INTERRUPT_VI 8 +#define PI_INTERRUPT_PE_TOKEN 9 +#define PI_INTERRUPT_PE_FINISH 10 +#define PI_INTERRUPT_CP 11 +#define PI_INTERRUPT_DEBUG 12 +#define PI_INTERRUPT_HSP 13 +#define PI_INTERRUPT_ACR 14 /* HOLLYWOOD EXCLUSIVE */ +#define PI_INTERRUPT_RSW_STATE 16 -#define PI_INTERRUPT_MASK 0x0004 +#define PI_INTERRUPT_MASK 0x0004 -#define PI_RESET_REQUEST 0x0024 -#define PI_UNIT_INFO 0x002C -#define PI_UNIT_INFO_TYPE 28 -#define PI_UNIT_INFO_TYPE_EB 31 +#define PI_RESET_REQUEST 0x0024 +#define PI_UNIT_INFO 0x002C +#define PI_UNIT_INFO_TYPE 28 +#define PI_UNIT_INFO_TYPE_EB 31 -#endif // PRIVATE_HOLLYWOOD_FLIPPER_PI_REGS_H +#endif // PRIVATE_HOLLYWOOD_FLIPPER_PI_REGS_H diff --git a/libs/RVL_SDK/include/private/hollywood/flipper/si_reg.h b/libs/RVL_SDK/include/private/hollywood/flipper/si_reg.h index e3b32440..63aa7be5 100644 --- a/libs/RVL_SDK/include/private/hollywood/flipper/si_reg.h +++ b/libs/RVL_SDK/include/private/hollywood/flipper/si_reg.h @@ -1,43 +1,43 @@ #ifndef PRIVATE_HOLLYWOOD_FLIPPER_SI_REGS_H #define PRIVATE_HOLLYWOOD_FLIPPER_SI_REGS_H -#define SI_OUT_BUFFER 0x0000 -#define SI_BUTTON_BUFFER 0x0004 -#define SI_BUTTON_2_BUFFER 0x0008 +#define SI_OUT_BUFFER 0x0000 +#define SI_BUTTON_BUFFER 0x0004 +#define SI_BUTTON_2_BUFFER 0x0008 -#define SI_BUFFER_SIZE 0x000C +#define SI_BUFFER_SIZE 0x000C -#define SI_0_OUT_BUFFER 0x0000 -#define SI_0_BUTTON_BUFFER 0x0004 -#define SI_0_BUTTON_2_BUFFER 0x0008 +#define SI_0_OUT_BUFFER 0x0000 +#define SI_0_BUTTON_BUFFER 0x0004 +#define SI_0_BUTTON_2_BUFFER 0x0008 -#define SI_1_OUT_BUFFER 0x000C -#define SI_1_BUTTON_BUFFER 0x0010 -#define SI_1_BUTTON_2_BUFFER 0x0014 +#define SI_1_OUT_BUFFER 0x000C +#define SI_1_BUTTON_BUFFER 0x0010 +#define SI_1_BUTTON_2_BUFFER 0x0014 -#define SI_2_OUT_BUFFER 0x0018 -#define SI_2_BUTTON_BUFFER 0x001C -#define SI_2_BUTTON_2_BUFFER 0x0020 +#define SI_2_OUT_BUFFER 0x0018 +#define SI_2_BUTTON_BUFFER 0x001C +#define SI_2_BUTTON_2_BUFFER 0x0020 -#define SI_3_OUT_BUFFER 0x0024 -#define SI_3_BUTTON_BUFFER 0x0028 -#define SI_3_BUTTON_2_BUFFER 0x002C +#define SI_3_OUT_BUFFER 0x0024 +#define SI_3_BUTTON_BUFFER 0x0028 +#define SI_3_BUTTON_2_BUFFER 0x002C -#define SI_JOY_POLL 0x0030 +#define SI_JOY_POLL 0x0030 -#define SI_CONTROL_STATUS 0x0034 -#define SI_CONTROL_STATUS_TCINT 31 -#define SI_CONTROL_STATUS_TCINTMSK 30 -#define SI_CONTROL_STATUS_COMERR 29 -#define SI_CONTROL_STATUS_RDSTINT 28 -#define SI_CONTROL_STATUS_RDSTINTMSK 27 +#define SI_CONTROL_STATUS 0x0034 +#define SI_CONTROL_STATUS_TCINT 31 +#define SI_CONTROL_STATUS_TCINTMSK 30 +#define SI_CONTROL_STATUS_COMERR 29 +#define SI_CONTROL_STATUS_RDSTINT 28 +#define SI_CONTROL_STATUS_RDSTINTMSK 27 -#define SI_CONTROL_STATUS_TSTART 0 +#define SI_CONTROL_STATUS_TSTART 0 -#define SI_STATUS 0x0038 +#define SI_STATUS 0x0038 -#define SI_EXI_CLOCK 0x003C +#define SI_EXI_CLOCK 0x003C -#define SI_IO_BUFFER 0x0080 +#define SI_IO_BUFFER 0x0080 -#endif // PRIVATE_HOLLYWOOD_FLIPPER_SI_REGS_H +#endif // PRIVATE_HOLLYWOOD_FLIPPER_SI_REGS_H diff --git a/libs/RVL_SDK/include/private/hollywood/flipper/vi_reg.h b/libs/RVL_SDK/include/private/hollywood/flipper/vi_reg.h index 3c57c9fa..19faa792 100644 --- a/libs/RVL_SDK/include/private/hollywood/flipper/vi_reg.h +++ b/libs/RVL_SDK/include/private/hollywood/flipper/vi_reg.h @@ -1,55 +1,55 @@ #ifndef PRIVATE_HOLLYWOOD_FLIPPER_VI_REGS_H #define PRIVATE_HOLLYWOOD_FLIPPER_VI_REGS_H -#define VI_VERTICAL_TIME 0x0000 +#define VI_VERTICAL_TIME 0x0000 -#define VI_DISPLAY_CONFIG 0x0002 +#define VI_DISPLAY_CONFIG 0x0002 -#define VI_HORIZONTAL_TIME0 0x0004 -#define VI_HORIZONTAL_TIME1 0x0008 +#define VI_HORIZONTAL_TIME0 0x0004 +#define VI_HORIZONTAL_TIME1 0x0008 -#define VI_VERTICAL_TIME_ODD_FIELD 0x000C +#define VI_VERTICAL_TIME_ODD_FIELD 0x000C #define VI_VERTICAL_TIME_EVEN_FIELD 0x0010 -#define VI_BURST_BLANK_ODD_FIELD 0x0014 -#define VI_BURST_BLANK_EVEN_FIELD 0x0018 +#define VI_BURST_BLANK_ODD_FIELD 0x0014 +#define VI_BURST_BLANK_EVEN_FIELD 0x0018 -#define VI_TOP_FIELD_BASE_L 0x001C -#define VI_TOP_FIELD_BASE_R 0x0020 +#define VI_TOP_FIELD_BASE_L 0x001C +#define VI_TOP_FIELD_BASE_R 0x0020 -#define VI_BOTTOM_FIELD_BASE_L 0x0024 -#define VI_BOTTOM_FIELD_BASE_R 0x0028 +#define VI_BOTTOM_FIELD_BASE_L 0x0024 +#define VI_BOTTOM_FIELD_BASE_R 0x0028 -#define VI_VERTICAL_POSITION 0x002C -#define VI_HORIZONTAL_POSITION 0x002E +#define VI_VERTICAL_POSITION 0x002C +#define VI_HORIZONTAL_POSITION 0x002E -#define VI_DISPLAY_INTERRUPT_0 0x0030 -#define VI_DISPLAY_INTERRUPT_1 0x0034 -#define VI_DISPLAY_INTERRUPT_2 0x0038 -#define VI_DISPLAY_INTERRUPT_3 0x003C +#define VI_DISPLAY_INTERRUPT_0 0x0030 +#define VI_DISPLAY_INTERRUPT_1 0x0034 +#define VI_DISPLAY_INTERRUPT_2 0x0038 +#define VI_DISPLAY_INTERRUPT_3 0x003C -#define VI_DISPLAY_L_INTERRUPT_0 0x0040 -#define VI_DISPLAY_L_INTERRUPT_1 0x0044 +#define VI_DISPLAY_L_INTERRUPT_0 0x0040 +#define VI_DISPLAY_L_INTERRUPT_1 0x0044 -#define VI_SCALE_WIDTH 0x0048 -#define VI_HORIZONTAL_SCALE 0x004A +#define VI_SCALE_WIDTH 0x0048 +#define VI_HORIZONTAL_SCALE 0x004A -#define VI_FILTER_TABLE_0 0x004C -#define VI_FILTER_TABLE_1 0x0050 -#define VI_FILTER_TABLE_2 0x0054 -#define VI_FILTER_TABLE_3 0x0058 -#define VI_FILTER_TABLE_4 0x005C -#define VI_FILTER_TABLE_5 0x0060 -#define VI_FILTER_TABLE_6 0x0064 +#define VI_FILTER_TABLE_0 0x004C +#define VI_FILTER_TABLE_1 0x0050 +#define VI_FILTER_TABLE_2 0x0054 +#define VI_FILTER_TABLE_3 0x0058 +#define VI_FILTER_TABLE_4 0x005C +#define VI_FILTER_TABLE_5 0x0060 +#define VI_FILTER_TABLE_6 0x0064 -#define VI_UNKNOWN_AA_STUFF 0x0068 +#define VI_UNKNOWN_AA_STUFF 0x0068 -#define VI_CLOCK_SELECT 0x006C -#define VI_DTV_STATUS 0x006E +#define VI_CLOCK_SELECT 0x006C +#define VI_DTV_STATUS 0x006E -#define VI_UNKNOWN_70 0x0070 +#define VI_UNKNOWN_70 0x0070 -#define VI_HBE_BORDER 0x0072 -#define VI_HBS_BORDER 0x0074 +#define VI_HBE_BORDER 0x0072 +#define VI_HBS_BORDER 0x0074 -#endif // PRIVATE_HOLLYWOOD_FLIPPER_VI_REGS_H +#endif // PRIVATE_HOLLYWOOD_FLIPPER_VI_REGS_H diff --git a/libs/RVL_SDK/include/private/hollywood/hw_reg.h b/libs/RVL_SDK/include/private/hollywood/hw_reg.h index 182ea740..0a965114 100644 --- a/libs/RVL_SDK/include/private/hollywood/hw_reg.h +++ b/libs/RVL_SDK/include/private/hollywood/hw_reg.h @@ -5,201 +5,201 @@ #include -#define __hw_set_bit(x, b) SET_FLAG(x, b) -#define __hw_clear_bit(x, b) CLEAR_FLAG(x, b) -#define __hw_has_bit(x, b) HAS_FLAG(x, b) +#define __hw_set_bit(x, b) SET_FLAG(x, b) +#define __hw_clear_bit(x, b) CLEAR_FLAG(x, b) +#define __hw_has_bit(x, b) HAS_FLAG(x, b) /* IPC */ -#define HW_IPC_PPCMSG 0x000 -#define HW_IPC_PPCCTRL 0x004 -#define HW_IPC_ARMMSG 0x008 -#define HW_IPC_ARMCTRL 0x00C +#define HW_IPC_PPCMSG 0x000 +#define HW_IPC_PPCCTRL 0x004 +#define HW_IPC_ARMMSG 0x008 +#define HW_IPC_ARMCTRL 0x00C /* IOP (Starlet) Timer */ -#define HW_TIMER 0x010 -#define HW_ALARM 0x014 +#define HW_TIMER 0x010 +#define HW_ALARM 0x014 /* Video related */ -#define HW_VI1CFG 0x018 -#define HW_VIDIM 0x01C -#define HW_VISOLID 0x024 +#define HW_VI1CFG 0x018 +#define HW_VIDIM 0x01C +#define HW_VISOLID 0x024 /* IRQ Controllers */ -#define HW_PPCIRQFLAG 0x030 -#define HW_PPCIRQMASK 0x034 -#define HW_ARMIRQFLAG 0x038 -#define HW_ARMIRQMASK 0x03C -#define HW_ARMFIQMASK 0x040 -#define HW_IOPINTPPC 0x044 -#define HW_WDGINTSTS 0x048 -#define HW_WDGCFG 0x04C -#define HW_DMAADRINTSTS 0x050 -#define HW_CPUADRINTSTS 0x054 -#define HW_DBGINTSTS 0x058 -#define HW_DBGINTEN 0x05C +#define HW_PPCIRQFLAG 0x030 +#define HW_PPCIRQMASK 0x034 +#define HW_ARMIRQFLAG 0x038 +#define HW_ARMIRQMASK 0x03C +#define HW_ARMFIQMASK 0x040 +#define HW_IOPINTPPC 0x044 +#define HW_WDGINTSTS 0x048 +#define HW_WDGCFG 0x04C +#define HW_DMAADRINTSTS 0x050 +#define HW_CPUADRINTSTS 0x054 +#define HW_DBGINTSTS 0x058 +#define HW_DBGINTEN 0x05C /* Bus controlling */ -#define HW_SRNPROT 0x060 -#define HW_AHBPROT 0x064 +#define HW_SRNPROT 0x060 +#define HW_AHBPROT 0x064 -#define HW_I2CIOPINTEN 0x068 -#define HW_I2CIOPINTSTS 0x06C +#define HW_I2CIOPINTEN 0x068 +#define HW_I2CIOPINTSTS 0x06C -#define HW_AIPPROT 0x070 -#define HW_AIPIOCTRL 0x074 +#define HW_AIPPROT 0x070 +#define HW_AIPIOCTRL 0x074 -#define HW_VIINTEN 0x078 -#define HW_VIINTSTS 0x07C +#define HW_VIINTEN 0x078 +#define HW_VIINTSTS 0x07C /* USB related */ -#define HW_USBDBG0 0x080 -#define HW_USBDBG1 0x084 -#define HW_USBFRCRST 0x088 -#define HW_USBIOTEST 0x08C +#define HW_USBDBG0 0x080 +#define HW_USBDBG1 0x084 +#define HW_USBFRCRST 0x088 +#define HW_USBIOTEST 0x08C /* "Embedded logic-analyzer" stuff */ -#define HW_ELA_REG_ADDR 0x090 -#define HW_ELA_REG_DATA 0x094 +#define HW_ELA_REG_ADDR 0x090 +#define HW_ELA_REG_DATA 0x094 -#define HW_MEMTSTN 0x098 -#define HW_MEMTSTP 0x09C +#define HW_MEMTSTN 0x098 +#define HW_MEMTSTP 0x09C /* Hollywood GPIOs */ -#define HW_GPIOB_OUT 0x0C0 +#define HW_GPIOB_OUT 0x0C0 #define HW_GPIOB_OUT_SENSOR_BAR 8 -#define HW_GPIOB_DIR 0x0C4 -#define HW_GPIOB_IN 0x0C8 -#define HW_GPIOB_INTLVL 0x0CC -#define HW_GPIOB_INTFLAG 0x0D0 -#define HW_GPIOB_INTMASK 0x0D4 -#define HW_GPIOB_STRAPS 0x0D8 -#define HW_GPIO_ENABLE 0x0DC -#define HW_GPIO_OUT 0x0E0 -#define HW_GPIO_DIR 0x0E4 -#define HW_GPIO_IN 0x0E8 -#define HW_GPIO_INTLVL 0x0EC -#define HW_GPIO_INTFLAG 0x0F0 -#define HW_GPIO_INTMASK 0x0F4 -#define HW_GPIO_STRAPS 0x0F8 -#define HW_GPIO_OWNER 0x0FC +#define HW_GPIOB_DIR 0x0C4 +#define HW_GPIOB_IN 0x0C8 +#define HW_GPIOB_INTLVL 0x0CC +#define HW_GPIOB_INTFLAG 0x0D0 +#define HW_GPIOB_INTMASK 0x0D4 +#define HW_GPIOB_STRAPS 0x0D8 +#define HW_GPIO_ENABLE 0x0DC +#define HW_GPIO_OUT 0x0E0 +#define HW_GPIO_DIR 0x0E4 +#define HW_GPIO_IN 0x0E8 +#define HW_GPIO_INTLVL 0x0EC +#define HW_GPIO_INTFLAG 0x0F0 +#define HW_GPIO_INTMASK 0x0F4 +#define HW_GPIO_STRAPS 0x0F8 +#define HW_GPIO_OWNER 0x0FC -#define HW_GPIOPIN_EJECT_DISC 9 +#define HW_GPIOPIN_EJECT_DISC 9 /* AHB related? */ -#define HW_ARB_CFG_M0 0x100 -#define HW_ARB_CFG_M1 0x104 -#define HW_ARB_CFG_M2 0x108 -#define HW_ARB_CFG_M3 0x10C -#define HW_ARB_CFG_M4 0x110 -#define HW_ARB_CFG_M5 0x114 -#define HW_ARB_CFG_M6 0x118 -#define HW_ARB_CFG_M7 0x11C -#define HW_ARB_CFG_M8 0x120 -#define HW_ARB_CFG_M9 0x124 -#define HW_ARB_CFG_MA 0x128 /* \ Not documented anywhere but assuming they exist */ -#define HW_ARB_CFG_MB 0x12C /* / */ -#define HW_ARB_CFG_MC 0x130 -#define HW_ARB_CFG_MD 0x134 -#define HW_ARB_CFG_ME 0x138 -#define HW_ARB_CFG_MF 0x13C -#define HW_ARB_CFG_CPU 0x140 -#define HW_ARB_CFG_DMA 0x144 -#define HW_ARB_PCNTCFG 0x148 -#define HW_ARB_PCNTSTS 0x14C +#define HW_ARB_CFG_M0 0x100 +#define HW_ARB_CFG_M1 0x104 +#define HW_ARB_CFG_M2 0x108 +#define HW_ARB_CFG_M3 0x10C +#define HW_ARB_CFG_M4 0x110 +#define HW_ARB_CFG_M5 0x114 +#define HW_ARB_CFG_M6 0x118 +#define HW_ARB_CFG_M7 0x11C +#define HW_ARB_CFG_M8 0x120 +#define HW_ARB_CFG_M9 0x124 +#define HW_ARB_CFG_MA 0x128 /* \ Not documented anywhere but assuming they exist */ +#define HW_ARB_CFG_MB 0x12C /* / */ +#define HW_ARB_CFG_MC 0x130 +#define HW_ARB_CFG_MD 0x134 +#define HW_ARB_CFG_ME 0x138 +#define HW_ARB_CFG_MF 0x13C +#define HW_ARB_CFG_CPU 0x140 +#define HW_ARB_CFG_DMA 0x144 +#define HW_ARB_PCNTCFG 0x148 +#define HW_ARB_PCNTSTS 0x14C -#define HW_I2CSCTRL 0x150 -#define HW_I2CSSTS 0x154 -#define HW_I2CSRDEN 0x158 -#define HW_I2CSTRAP 0x160 -#define HW_I2CSCTRL_MIRROR 0x164 /* Apparently */ -#define HW_I2CSVISETYUV 0x168 -#define HW_I2CSVISETFILT 0x16C +#define HW_I2CSCTRL 0x150 +#define HW_I2CSSTS 0x154 +#define HW_I2CSRDEN 0x158 +#define HW_I2CSTRAP 0x160 +#define HW_I2CSCTRL_MIRROR 0x164 /* Apparently */ +#define HW_I2CSVISETYUV 0x168 +#define HW_I2CSVISETFILT 0x16C -#define HW_SPARE2 0x170 -#define HW_SPARE3 0x174 +#define HW_SPARE2 0x170 +#define HW_SPARE3 0x174 /* Some system related stuff */ -#define HW_COMPAT 0x180 -#define HW_RESET_AHB 0x184 -#define HW_SPARE0 0x188 -#define HW_BOOT0 0x18C -#define HW_CLOCKS 0x190 -#define HW_RESETS 0x194 -#define HW_IFPOWER 0x198 +#define HW_COMPAT 0x180 +#define HW_RESET_AHB 0x184 +#define HW_SPARE0 0x188 +#define HW_BOOT0 0x18C +#define HW_CLOCKS 0x190 +#define HW_RESETS 0x194 +#define HW_IFPOWER 0x198 /* PLL/Clock related(?) */ -#define HW_PLLDR 0x19C -#define HW_PLLSYSEXT1 0x1A0 -#define HW_PLLSYSEXT2 0x1A4 -#define HW_PLLAIEXT1 0x1A8 -#define HW_PLLATEXT2 0x1AC -#define HW_PLLSYS 0x1B0 -#define HW_PLLSYSEXT 0x1B4 -#define HW_PLLDSK 0x1B8 -#define HW_PLLDDR 0x1BC -#define HW_PLLDDREXT 0x1C0 -#define HW_PLLVI 0x1C4 -#define HW_PLLVIEXT 0x1C8 -#define HW_PLLAI 0x1CC +#define HW_PLLDR 0x19C +#define HW_PLLSYSEXT1 0x1A0 +#define HW_PLLSYSEXT2 0x1A4 +#define HW_PLLAIEXT1 0x1A8 +#define HW_PLLATEXT2 0x1AC +#define HW_PLLSYS 0x1B0 +#define HW_PLLSYSEXT 0x1B4 +#define HW_PLLDSK 0x1B8 +#define HW_PLLDDR 0x1BC +#define HW_PLLDDREXT 0x1C0 +#define HW_PLLVI 0x1C4 +#define HW_PLLVIEXT 0x1C8 +#define HW_PLLAI 0x1CC -#define HW_PLLAIEXT 0x1D0 -#define HW_PLLAIEXT_PLL_A 30 -#define HW_PLLAIEXT_PLL_B 31 +#define HW_PLLAIEXT 0x1D0 +#define HW_PLLAIEXT_PLL_A 30 +#define HW_PLLAIEXT_PLL_B 31 -#define HW_PLLUSB 0x1D4 -#define HW_PLLUSBEXT 0x1D8 +#define HW_PLLUSB 0x1D4 +#define HW_PLLUSBEXT 0x1D8 -#define HW_IOPWRCTRL 0x1DC +#define HW_IOPWRCTRL 0x1DC /* More clock related? */ -#define HW_IOSTRCTRL0 0x1E0 -#define HW_IOSTRCTRL1 0x1E4 -#define HW_CLKSTRCTRL 0x1E8 +#define HW_IOSTRCTRL0 0x1E0 +#define HW_IOSTRCTRL1 0x1E4 +#define HW_CLKSTRCTRL 0x1E8 /* OTP related */ -#define HW_OTPCMD 0x1EC -#define HW_OTPDATA 0x1F0 +#define HW_OTPCMD 0x1EC +#define HW_OTPDATA 0x1F0 /* Debug related */ -#define HW_DBGCLK 0x1F4 -#define HW_OBSCLKOCTRL 0x1F8 -#define HW_OBSCLKICTRL 0x1FC -#define HW_DBGPORT 0x200 +#define HW_DBGCLK 0x1F4 +#define HW_OBSCLKOCTRL 0x1F8 +#define HW_OBSCLKICTRL 0x1FC +#define HW_DBGPORT 0x200 /* SI Related */ -#define HW_SICLKDIV 0x204 -#define HW_SICTRL 0x208 -#define HW_SIDATA 0x20C -#define HW_SIINT 0x210 +#define HW_SICLKDIV 0x204 +#define HW_SICTRL 0x208 +#define HW_SIDATA 0x20C +#define HW_SIINT 0x210 -#define HW_VERSION 0x214 +#define HW_VERSION 0x214 -#define HW_DBGBUSRD 0x218 +#define HW_DBGBUSRD 0x218 /* Hollywood Registers Maros */ -#define ACR_REG_ADDRESS 0x0D000000 -vu32 __ACRRegs[256] ADDRESS(OS_BASE_UNCACHED + ACR_REG_ADDRESS); +#define ACR_REG_ADDRESS 0x0D000000 +vu32 __ACRRegs[256] ADDRESS(OS_BASE_UNCACHED + ACR_REG_ADDRESS); -#define ACR_WRITE_REG32(x, v) __ACRRegs[x >> 2] = v -#define ACR_READ_REG32(x) __ACRRegs[x >> 2] +#define ACR_WRITE_REG32(x, v) __ACRRegs[x >> 2] = v +#define ACR_READ_REG32(x) __ACRRegs[x >> 2] -#define ACR_SET_REG_F(x, v) __hw_set_bit (__ACRRegs[x >> 2], v) -#define ACR_DEL_REG_F(x, v) __hw_clear_bit(__ACRRegs[x >> 2], v) -#define ACR_HAS_REG_F(x, v) __hw_has_bit (__ACRRegs[x >> 2], v) +#define ACR_SET_REG_F(x, v) __hw_set_bit(__ACRRegs[x >> 2], v) +#define ACR_DEL_REG_F(x, v) __hw_clear_bit(__ACRRegs[x >> 2], v) +#define ACR_HAS_REG_F(x, v) __hw_has_bit(__ACRRegs[x >> 2], v) // From the PPC, this would do nothing different and act the same as `__ACRRegs`. // But the SDK, which is from the PPC, still chooses to use this. -#define AHB_TRUSTED_OFFSET 0x00800000 -vu32 __ACRIOPRegs[256] ADDRESS(OS_BASE_UNCACHED + ACR_REG_ADDRESS + AHB_TRUSTED_OFFSET); +#define AHB_TRUSTED_OFFSET 0x00800000 +vu32 __ACRIOPRegs[256] ADDRESS(OS_BASE_UNCACHED + ACR_REG_ADDRESS + AHB_TRUSTED_OFFSET); -#define ACRIOP_WRITE_REG32(x, v) __ACRIOPRegs[x >> 2] = v -#define ACRIOP_READ_REG32(x) __ACRIOPRegs[x >> 2] +#define ACRIOP_WRITE_REG32(x, v) __ACRIOPRegs[x >> 2] = v +#define ACRIOP_READ_REG32(x) __ACRIOPRegs[x >> 2] -#define ACRIOP_SET_REG_F(x, v) __hw_set_bit (__ACRIOPRegs[x >> 2], v) -#define ACRIOP_DEL_REG_F(x, v) __hw_clear_bit(__ACRIOPRegs[x >> 2], v) -#define ACRIOP_HAS_REG_F(x, v) __hw_has_bit (__ACRIOPRegs[x >> 2], v) +#define ACRIOP_SET_REG_F(x, v) __hw_set_bit(__ACRIOPRegs[x >> 2], v) +#define ACRIOP_DEL_REG_F(x, v) __hw_clear_bit(__ACRIOPRegs[x >> 2], v) +#define ACRIOP_HAS_REG_F(x, v) __hw_has_bit(__ACRIOPRegs[x >> 2], v) // these are for WPAD only inline u32 ACRReadReg(u32 offset) { @@ -209,4 +209,4 @@ inline void ACRWriteReg(u32 offset, u32 val) { ACR_WRITE_REG32(offset, val); } -#endif // PRIVATE_HOLLYWOOD_REGISTERS_H +#endif // PRIVATE_HOLLYWOOD_REGISTERS_H diff --git a/libs/RVL_SDK/include/private/ios.h b/libs/RVL_SDK/include/private/ios.h index 6782eb5f..4da1ffd8 100644 --- a/libs/RVL_SDK/include/private/ios.h +++ b/libs/RVL_SDK/include/private/ios.h @@ -9,40 +9,40 @@ extern "C" { /* Clt */ -IOSError IOS_OpenAsync(const char* pPath, u32 flags, IOSIpcCb callback, void* callback_arg); -IOSError IOS_Open(const char* path, u32 flags); +IOSError IOS_OpenAsync(const char* pPath, u32 flags, IOSIpcCb callback, void* callback_arg); +IOSError IOS_Open(const char* path, u32 flags); -IOSError IOS_CloseAsync(IOSFd fd, IOSIpcCb callback, void* callbackArg); -IOSError IOS_Close(IOSFd fd); +IOSError IOS_CloseAsync(IOSFd fd, IOSIpcCb callback, void* callbackArg); +IOSError IOS_Close(IOSFd fd); -IOSError IOS_ReadAsync(IOSFd fd, void* buf, u32 len, IOSIpcCb callback, void* callbackArg); -IOSError IOS_Read(IOSFd fd, void* buf, u32 len); +IOSError IOS_ReadAsync(IOSFd fd, void* buf, u32 len, IOSIpcCb callback, void* callbackArg); +IOSError IOS_Read(IOSFd fd, void* buf, u32 len); -IOSError IOS_WriteAsync(IOSFd fd, void* buf, u32 len, IOSIpcCb callback, void* callbackArg); -IOSError IOS_Write(IOSFd fd, void* buf, u32 len); +IOSError IOS_WriteAsync(IOSFd fd, void* buf, u32 len, IOSIpcCb callback, void* callbackArg); +IOSError IOS_Write(IOSFd fd, void* buf, u32 len); -IOSError IOS_SeekAsync(IOSFd fd, s32 offset, u32 whence, IOSIpcCb callback, void* callbackArg); -IOSError IOS_Seek(IOSFd fd, s32 offset, u32 whence); +IOSError IOS_SeekAsync(IOSFd fd, s32 offset, u32 whence, IOSIpcCb callback, void* callbackArg); +IOSError IOS_Seek(IOSFd fd, s32 offset, u32 whence); -IOSError IOS_IoctlAsync(IOSFd fd, s32 cmd, void* input, u32 inputLen, void* output, u32 outputLen, IOSIpcCb callback, void* callbackArg); -IOSError IOS_Ioctl(IOSFd fd, s32 cmd, void* input, u32 inputLen, void* output, u32 outputLen); +IOSError IOS_IoctlAsync(IOSFd fd, s32 cmd, void* input, u32 inputLen, void* output, u32 outputLen, IOSIpcCb callback, void* callbackArg); +IOSError IOS_Ioctl(IOSFd fd, s32 cmd, void* input, u32 inputLen, void* output, u32 outputLen); -IOSError IOS_IoctlvAsync(IOSFd fd, s32 cmd, u32 readCount, u32 writeCount, IOSIoVector* vect, IOSIpcCb callback, void* callbackArg); -IOSError IOS_Ioctlv(IOSFd fd, s32 cmd, u32 readCount, u32 writeCount, IOSIoVector* vect); -IOSError IOS_IoctlvReboot(IOSFd fd, s32 cmd, u32 readCount, u32 writeCount, IOSIoVector* vect); +IOSError IOS_IoctlvAsync(IOSFd fd, s32 cmd, u32 readCount, u32 writeCount, IOSIoVector* vect, IOSIpcCb callback, void* callbackArg); +IOSError IOS_Ioctlv(IOSFd fd, s32 cmd, u32 readCount, u32 writeCount, IOSIoVector* vect); +IOSError IOS_IoctlvReboot(IOSFd fd, s32 cmd, u32 readCount, u32 writeCount, IOSIoVector* vect); /* Heap */ -IOSHeapId iosCreateHeap(void* ptr, u32 size); -IOSError iosDestroyHeap(IOSHeapId id); +IOSHeapId iosCreateHeap(void* ptr, u32 size); +IOSError iosDestroyHeap(IOSHeapId id); -void* iosAlloc(IOSHeapId id, u32 size); -void* iosAllocAligned(IOSHeapId id, u32 size, u32 alignment); +void* iosAlloc(IOSHeapId id, u32 size); +void* iosAllocAligned(IOSHeapId id, u32 size, u32 alignment); -IOSError iosFree(IOSHeapId id, void* ptr); +IOSError iosFree(IOSHeapId id, void* ptr); #ifdef __cplusplus } #endif -#endif // PRIVATE_IPC_PRIVATE_IOS_HH +#endif // PRIVATE_IPC_PRIVATE_IOS_HH diff --git a/libs/RVL_SDK/include/private/ios/types.h b/libs/RVL_SDK/include/private/ios/types.h index c878985d..00dd37e7 100644 --- a/libs/RVL_SDK/include/private/ios/types.h +++ b/libs/RVL_SDK/include/private/ios/types.h @@ -1,8 +1,8 @@ #ifndef PRIVATE_IOS_TYPES_H #define PRIVATE_IOS_TYPES_H -#include #include +#include typedef s32 IOSError; typedef s32 IOSFd; @@ -13,20 +13,20 @@ typedef s32 IOSHeapId; typedef IOSError (*IOSIpcCb)(IOSError, void*); typedef struct IOSIoVector { - u8 *base; // 0x00 - u32 length; // 0x04 + u8* base; // 0x00 + u32 length; // 0x04 } IOSIoVector; typedef struct IOSResourceOpen { - u8* path; // 0x00 - u32 flags; // 0x04 - u32 ownerId; // 0x08 - u16 groudId; // 0x0C + u8* path; // 0x00 + u32 flags; // 0x04 + u32 ownerId; // 0x08 + u16 groudId; // 0x0C } IOSResourceOpen; typedef struct IOSResourceRead { - u8* outPtr; // 0x00 - u32 outLen; // 0x04 + u8* outPtr; // 0x00 + u32 outLen; // 0x04 } IOSResourceRead; typedef struct IOSResourceWrite { @@ -35,29 +35,29 @@ typedef struct IOSResourceWrite { } IOSResourceWrite; typedef struct IOSResourceSeek { - s32 offset; // 0x00 - u32 whence; // 0x04 + s32 offset; // 0x00 + u32 whence; // 0x04 } IOSResourceSeek; typedef struct IOSResourceIoctl { - u32 cmd; // 0x00 - u8* inPtr; // 0x04 - u32 inLen; // 0x08 - u8* outPtr; // 0x0C - u32 outLen; // 0x10 + u32 cmd; // 0x00 + u8* inPtr; // 0x04 + u32 inLen; // 0x08 + u8* outPtr; // 0x0C + u32 outLen; // 0x10 } IOSResourceIoctl; typedef struct IOSResourceIoctlv { - u32 cmd; // 0x00 - u32 readCount; // 0x04 - u32 writeCount; // 0x08 - IOSIoVector* vector; // 0x0C + u32 cmd; // 0x00 + u32 readCount; // 0x04 + u32 writeCount; // 0x08 + IOSIoVector* vector; // 0x0C } IOSResourceIoctlv; typedef struct IOSResourceRequest { - u32 cmd; // 0x00 - s32 status; // 0x04 - u32 handle; // 0x08 + u32 cmd; // 0x00 + s32 status; // 0x04 + u32 handle; // 0x08 union { IOSResourceOpen open; IOSResourceRead read; @@ -65,27 +65,27 @@ typedef struct IOSResourceRequest { IOSResourceSeek seek; IOSResourceIoctl ioctl; IOSResourceIoctlv ioctlv; - } args; // 0x0C + } args; // 0x0C } IOSResourceRequest; typedef struct IOSRpcRequest { - IOSResourceRequest request; // 0x00 + IOSResourceRequest request; // 0x00 - IOSIpcCb callback ALIGN32; // 0x20 - void* callback_arg; // 0x24 + IOSIpcCb callback ALIGN32; // 0x20 + void* callback_arg; // 0x24 - u32 relaunch_flag; // 0x28 - OSThreadQueue thread_queue; // 0x2C + u32 relaunch_flag; // 0x28 + OSThreadQueue thread_queue; // 0x2C } IOSRpcRequest; typedef struct IOSResponseRequest { - u32 rcount; // 0x00 - u32 wcount; // 0x04 + u32 rcount; // 0x00 + u32 wcount; // 0x04 - u32 rptr; // 0x08 - u32 wptr; // 0x0C + u32 rptr; // 0x08 + u32 wptr; // 0x0C - IOSResourceRequest* buf[IOS_REQUEST_MAX]; // 0x10 + IOSResourceRequest* buf[IOS_REQUEST_MAX]; // 0x10 } IOSResponseRequest; -#endif // PRIVATE_IOS_TYPES_H +#endif // PRIVATE_IOS_TYPES_H diff --git a/libs/RVL_SDK/include/private/ipc.h b/libs/RVL_SDK/include/private/ipc.h index 9bdad69e..500a5683 100644 --- a/libs/RVL_SDK/include/private/ipc.h +++ b/libs/RVL_SDK/include/private/ipc.h @@ -11,36 +11,36 @@ extern "C" { /* Main */ -void IPCInit(); -void IPCReInit(); +void IPCInit(); +void IPCReInit(); -u32 IPCReadReg(u32 regIdx); -void IPCWriteReg(u32 regIdx, u32 data); +u32 IPCReadReg(u32 regIdx); +void IPCWriteReg(u32 regIdx, u32 data); -#define IPC_READ_REG(regIdx) IPCReadReg((regIdx>>2)) -#define IPC_WRITE_REG(regIdx, data) IPCWriteReg((regIdx>>2), data) +#define IPC_READ_REG(regIdx) IPCReadReg((regIdx >> 2)) +#define IPC_WRITE_REG(regIdx, data) IPCWriteReg((regIdx >> 2), data) -void* IPCGetBufferHi(); -void* IPCGetBufferLo(); -void IPCSetBufferLo(void* lo); +void* IPCGetBufferHi(); +void* IPCGetBufferLo(); +void IPCSetBufferLo(void* lo); /* Profile */ -void IPCiProfInit(); +void IPCiProfInit(); -void IPCiProfQueueReq(void* req, s32 fd); +void IPCiProfQueueReq(void* req, s32 fd); -void IPCiProfAck(); +void IPCiProfAck(); -void IPCiProfReply(void* req, s32 fd); +void IPCiProfReply(void* req, s32 fd); /* Clt */ -IOSError IPCCltInit(); -IOSError IPCCltReInit(); +IOSError IPCCltInit(); +IOSError IPCCltReInit(); #ifdef __cplusplus } #endif -#endif // PRIVATE_IPC_H +#endif // PRIVATE_IPC_H diff --git a/libs/RVL_SDK/include/private/ipc/types.h b/libs/RVL_SDK/include/private/ipc/types.h index 71f991cf..b3625b46 100644 --- a/libs/RVL_SDK/include/private/ipc/types.h +++ b/libs/RVL_SDK/include/private/ipc/types.h @@ -1,6 +1,8 @@ #ifndef PRIVATE_IPC_TYPES_H #define PRIVATE_IPC_TYPES_H +// clang-format off + enum { IPC_HEAP_CHUNK_FREE = 0xBABE0000, IPC_HEAP_CHUNK_USED = 0xBABE0001, @@ -59,4 +61,6 @@ enum { IPC_SEEK_END }; -#endif // PRIVATE_IPC_TYPES_H +// clang-format on + +#endif // PRIVATE_IPC_TYPES_H diff --git a/libs/RVL_SDK/include/private/mem.h b/libs/RVL_SDK/include/private/mem.h index 45a91785..87ba9435 100644 --- a/libs/RVL_SDK/include/private/mem.h +++ b/libs/RVL_SDK/include/private/mem.h @@ -12,11 +12,11 @@ extern "C" { #endif -#define MEM_ROUNDUP(x, align) (((x) + (align)-1) & (-(align))) -#define MEM_PTR_ROUNDUP(x, align) ((void*)((((u32)(x)) + (align)-1) & (~((align)-1)))) +#define MEM_ROUNDUP(x, align) (((x) + (align) - 1) & (-(align))) +#define MEM_PTR_ROUNDUP(x, align) ((void*)((((u32)(x)) + (align) - 1) & (~((align) - 1)))) -#define MEM_ROUNDDOWN(x, align) ((x) & (-(align))) -#define MEM_PTR_ROUNDDOWN(x, align) ((void*)(((u32)(x)) & (~((align)-1)))) +#define MEM_ROUNDDOWN(x, align) ((x) & (-(align))) +#define MEM_PTR_ROUNDDOWN(x, align) ((void*)(((u32)(x)) & (~((align) - 1)))) static u32 GetUIntPtr(const void* p) { return (u32)p; @@ -74,7 +74,7 @@ static void FillFreeMemory(MEMiHeapHead* heap, void* memBlock, u32 size) { } } -static inline s32 ComparePtr(void *p0, void *p1) { +static inline s32 ComparePtr(void* p0, void* p1) { return (u32)p0 - (u32)p1; } @@ -82,4 +82,4 @@ static inline s32 ComparePtr(void *p0, void *p1) { } #endif -#endif // PRIVATE_MEM_H +#endif // PRIVATE_MEM_H diff --git a/libs/RVL_SDK/include/private/nand.h b/libs/RVL_SDK/include/private/nand.h index 6aa467ba..48aa8620 100644 --- a/libs/RVL_SDK/include/private/nand.h +++ b/libs/RVL_SDK/include/private/nand.h @@ -5,34 +5,34 @@ #include +#include #include #include -#include #ifdef __cplusplus extern "C" { #endif -BOOL nandIsInitialized(); +BOOL nandIsInitialized(); -void nandCallback(ISFSError result, void* arg); +void nandCallback(ISFSError result, void* arg); -void nandRemoveTailToken(char* newPath, const char* oldPath); -void nandGetHeadToken(char* token, char* newPath, const char* oldPath); +void nandRemoveTailToken(char* newPath, const char* oldPath); +void nandGetHeadToken(char* token, char* newPath, const char* oldPath); -void nandGetRelativeName(char* name, const char* path); +void nandGetRelativeName(char* name, const char* path); -void nandConvertPath(char* absPath, const char* wd, const char* relPath); +void nandConvertPath(char* absPath, const char* wd, const char* relPath); -BOOL nandIsPrivatePath(const char* path); -BOOL nandIsUnderPrivatePath(const char* path); +BOOL nandIsPrivatePath(const char* path); +BOOL nandIsUnderPrivatePath(const char* path); -void nandReportErrorCode(ISFSError result) NO_INLINE; -s32 nandConvertErrorCode(ISFSError result); +void nandReportErrorCode(ISFSError result) NO_INLINE; +s32 nandConvertErrorCode(ISFSError result); -void nandGenerateAbsPath(char* absPath, const char* path); +void nandGenerateAbsPath(char* absPath, const char* path); -void nandGetParentDirectory(char* parentDir, const char* absPath); +void nandGetParentDirectory(char* parentDir, const char* absPath); const char* nandGetHomeDir(); @@ -40,4 +40,4 @@ const char* nandGetHomeDir(); } #endif -#endif // PRIVATE_NAND_H +#endif // PRIVATE_NAND_H diff --git a/libs/RVL_SDK/include/private/nand/NANDLog.h b/libs/RVL_SDK/include/private/nand/NANDLog.h index cd264847..30c88f66 100644 --- a/libs/RVL_SDK/include/private/nand/NANDLog.h +++ b/libs/RVL_SDK/include/private/nand/NANDLog.h @@ -9,11 +9,11 @@ extern "C" { typedef void (*NANDLoggingCallback)(BOOL); -BOOL NANDLoggingPrepareFile(u8* workBuf); -BOOL NANDLoggingAddMessageAsync(NANDLoggingCallback callback, const char* format, ...); +BOOL NANDLoggingPrepareFile(u8* workBuf); +BOOL NANDLoggingAddMessageAsync(NANDLoggingCallback callback, const char* format, ...); #ifdef __cplusplus } #endif -#endif // REVOLUTION_NAND_LOGGING_H +#endif // REVOLUTION_NAND_LOGGING_H diff --git a/libs/RVL_SDK/include/private/nand/nandprivate.h b/libs/RVL_SDK/include/private/nand/nandprivate.h index e3a3ffab..75a2ccbe 100644 --- a/libs/RVL_SDK/include/private/nand/nandprivate.h +++ b/libs/RVL_SDK/include/private/nand/nandprivate.h @@ -1,9 +1,9 @@ #ifndef PRIVATE_NAND_PRIVATE_H #define PRIVATE_NAND_PRIVATE_H -#include -#include #include +#include +#include #ifdef __cplusplus extern "C" { @@ -16,13 +16,14 @@ s32 NANDPrivateOpen(const char* path, NANDFileInfo* info, u8 accType); s32 NANDPrivateOpenAsync(const char* path, NANDFileInfo* info, u8 accType, NANDCallback callback, NANDCommandBlock* block); s32 NANDPrivateSafeOpen(const char* path, NANDFileInfo* info, u8 accType, void* buffer, u32 length); -s32 NANDPrivateSafeOpenAsync(const char* path, NANDFileInfo* info, u8 accType, void* buffer, u32 length, NANDCallback callback, NANDCommandBlock* block); +s32 NANDPrivateSafeOpenAsync(const char* path, NANDFileInfo* info, u8 accType, void* buffer, u32 length, NANDCallback callback, + NANDCommandBlock* block); s32 NANDPrivateGetTypeAsync(const char* path, u8* type, NANDCallback callback, NANDCommandBlock* block); s32 NANDPrivateMove(const char* path, const char* destDir); -s32 NANDPrivateGetStatus(const char* path, NANDStatus *status); +s32 NANDPrivateGetStatus(const char* path, NANDStatus* status); s32 NANDPrivateGetStatusAsync(const char* path, NANDStatus* status, NANDCallback callback, NANDCommandBlock* block); s32 NANDPrivateSetStatus(const char* path, NANDStatus* status); @@ -43,4 +44,4 @@ s32 NANDPrivateReadDir(const char* path, char* nameList, u32* num); } #endif -#endif // PRIVATE_NAND_PRIVATE_H +#endif // PRIVATE_NAND_PRIVATE_H diff --git a/libs/RVL_SDK/include/private/nand/nandsecret.h b/libs/RVL_SDK/include/private/nand/nandsecret.h index e70f6815..53513e1f 100644 --- a/libs/RVL_SDK/include/private/nand/nandsecret.h +++ b/libs/RVL_SDK/include/private/nand/nandsecret.h @@ -8,23 +8,24 @@ extern "C" { #endif typedef struct NANDFileSystemStatus { - u32 blockSize; // 0x00 + u32 blockSize; // 0x00 - u32 freeBlocks; // 0x04 - u32 usedBlocks; // 0x08 + u32 freeBlocks; // 0x04 + u32 usedBlocks; // 0x08 - u32 badBlocks; // 0x0C - u32 reservedBlocks; // 0x10 + u32 badBlocks; // 0x0C + u32 reservedBlocks; // 0x10 - u32 freeInodes; // 0x14 - u32 usedInodes; // 0x18 + u32 freeInodes; // 0x14 + u32 usedInodes; // 0x18 } NANDFileSystemStatus; s32 NANDSecretGetUsage(const char* path, u32* usedBlocks, u32* usedINodes); s32 NANDSecretGetFileSystemStatus(NANDFileSystemStatus* status); -s32 NANDSecretGetSystemAvailableArea(const NANDFileSystemStatus* status, u32 usedSystemBlocks, u32 usedSystemINodes, u32* freeSystemBlocks, u32* freeSystemINode); +s32 NANDSecretGetSystemAvailableArea(const NANDFileSystemStatus* status, u32 usedSystemBlocks, u32 usedSystemINodes, u32* freeSystemBlocks, + u32* freeSystemINode); s32 NANDSecretGetUserAvailableArea(u32* freeUserBlocks, u32* freeUserINodes); @@ -34,4 +35,4 @@ s32 NANDSecretGetUserUsage(u32* usedUserBlocks, u32* usedUserINodes); } #endif -#endif // PRIVATE_NAND_SECRET_H +#endif // PRIVATE_NAND_SECRET_H diff --git a/libs/RVL_SDK/include/private/os.h b/libs/RVL_SDK/include/private/os.h index 3332174c..7e8dcb2f 100644 --- a/libs/RVL_SDK/include/private/os.h +++ b/libs/RVL_SDK/include/private/os.h @@ -3,27 +3,27 @@ #include -#include #include +#include -#include #include +#include #include #include +#include #include -#include -#include -#include -#include -#include -#include #include -#include +#include #include #include -#include -#include +#include +#include +#include #include +#include +#include +#include +#include #ifdef __cplusplus extern "C" { @@ -31,80 +31,80 @@ extern "C" { /* Global declarations */ -extern BOOL __OSInIPL; -extern BOOL __OSInReboot; -extern BOOL __OSInNandBoot; -extern BOOL __OSIsGcam; +extern BOOL __OSInIPL; +extern BOOL __OSInReboot; +extern BOOL __OSInNandBoot; +extern BOOL __OSIsGcam; extern OSExecParams __OSRebootParams; /* Global declarations in ram */ -volatile OSContext* __OSCurrentContext ADDRESS(OS_BASE_CACHED | OS_ADDR_CURRENT_CONTEXT); -volatile OSContext* __OSFPUContext ADDRESS(OS_BASE_CACHED | OS_ADDR_CURRENT_FPU_CONTEXT); +volatile OSContext* __OSCurrentContext ADDRESS(OS_BASE_CACHED | OS_ADDR_CURRENT_CONTEXT); +volatile OSContext* __OSFPUContext ADDRESS(OS_BASE_CACHED | OS_ADDR_CURRENT_FPU_CONTEXT); -OSThreadQueue __OSActiveThreadQueue ADDRESS(OS_BASE_CACHED | OS_ADDR_ACTIVE_THREAD_QUEUE); -OSThread* __OSCurrentThread ADDRESS(OS_BASE_CACHED | OS_ADDR_CURRENT_THREAD); +OSThreadQueue __OSActiveThreadQueue ADDRESS(OS_BASE_CACHED | OS_ADDR_ACTIVE_THREAD_QUEUE); +OSThread* __OSCurrentThread ADDRESS(OS_BASE_CACHED | OS_ADDR_CURRENT_THREAD); -vu16 __OSDeviceCode ADDRESS(OS_BASE_CACHED | OS_ADDR_DEVICE_CODE); +vu16 __OSDeviceCode ADDRESS(OS_BASE_CACHED | OS_ADDR_DEVICE_CODE); -OSModuleQueue __OSModuleInfoList ADDRESS(OS_BASE_CACHED | OS_ADDR_LINK_MODULE_LIST); -const void* __OSStringTable ADDRESS(OS_BASE_CACHED | OS_ADDR_LINK_STRING_TABLE); +OSModuleQueue __OSModuleInfoList ADDRESS(OS_BASE_CACHED | OS_ADDR_LINK_MODULE_LIST); +const void* __OSStringTable ADDRESS(OS_BASE_CACHED | OS_ADDR_LINK_STRING_TABLE); -OSExecParams* __OSExecParamsAddr ADDRESS(OS_BASE_CACHED | OS_ADDR_LAUNCH_EXEC_PARAMS); +OSExecParams* __OSExecParamsAddr ADDRESS(OS_BASE_CACHED | OS_ADDR_LAUNCH_EXEC_PARAMS); -OSTime __OSSystemTime ADDRESS(OS_BASE_CACHED | OS_ADDR_SYSTEM_TIME); +OSTime __OSSystemTime ADDRESS(OS_BASE_CACHED | OS_ADDR_SYSTEM_TIME); -vu8 __OSLockedAppType ADDRESS(OS_BASE_CACHED | OS_ADDR_LOCKED_APP_TYPE); -vu32 __OSLaunchPartitionType ADDRESS(OS_BASE_CACHED | OS_ADDR_BOOT_PART_TYPE); +vu8 __OSLockedAppType ADDRESS(OS_BASE_CACHED | OS_ADDR_LOCKED_APP_TYPE); +vu32 __OSLaunchPartitionType ADDRESS(OS_BASE_CACHED | OS_ADDR_BOOT_PART_TYPE); -u16 __OSWirelessPadFixMode ADDRESS(OS_BASE_CACHED | OS_ADDR_PAD_WIRELESS_FIX_MODE); -u8 __OSPADButton ADDRESS(OS_BASE_CACHED | OS_ADDR_PAD_BUTTON); +u16 __OSWirelessPadFixMode ADDRESS(OS_BASE_CACHED | OS_ADDR_PAD_WIRELESS_FIX_MODE); +u8 __OSPADButton ADDRESS(OS_BASE_CACHED | OS_ADDR_PAD_BUTTON); /* Revision get */ -u32 __OSGetHollywoodRev(); +u32 __OSGetHollywoodRev(); typedef struct OSIOSRev { - u8 reserved; // 0x00 - u8 major; // 0x01 - u8 minor; // 0x02 - u8 micro; // 0x03 - u8 month; // 0x04 - u8 date; // 0x05 - u16 year; // 0x06 + u8 reserved; // 0x00 + u8 major; // 0x01 + u8 minor; // 0x02 + u8 micro; // 0x03 + u8 month; // 0x04 + u8 date; // 0x05 + u16 year; // 0x06 } OSIOSRev; -void __OSGetIOSRev(OSIOSRev* iosRev); +void __OSGetIOSRev(OSIOSRev* iosRev); /* Initialize subsystems */ -void OSExceptionInit(); +void OSExceptionInit(); -void __OSInitMemoryProtection(); +void __OSInitMemoryProtection(); -void __OSInitAlarm(); -void __OSCacheInit(); -void __OSContextInit(); -void __OSInterruptInit(); -void __OSInitIPCBuffer(); -void __OSModuleInit(); -void __OSThreadInit(); -void __OSInitNet(); -void __OSInitPlayTime(); +void __OSInitAlarm(); +void __OSCacheInit(); +void __OSContextInit(); +void __OSInterruptInit(); +void __OSInitIPCBuffer(); +void __OSModuleInit(); +void __OSThreadInit(); +void __OSInitNet(); +void __OSInitPlayTime(); -u32 __OSGetDIConfig(); +u32 __OSGetDIConfig(); /* Misc */ -BOOL __OSSetVIForceDimming(BOOL enable, u32 shiftY, u32 shiftX); +BOOL __OSSetVIForceDimming(BOOL enable, u32 shiftY, u32 shiftX); -void OSDefaultExceptionHandler(u8 type, register OSContext* context); +void OSDefaultExceptionHandler(u8 type, register OSContext* context); -s32 __OSSyncTimeWithNetRM(); +s32 __OSSyncTimeWithNetRM(); #ifdef __cplusplus } #endif -#endif // PRIVATE_OS_H +#endif // PRIVATE_OS_H diff --git a/libs/RVL_SDK/include/private/os/OSAudioSystem.h b/libs/RVL_SDK/include/private/os/OSAudioSystem.h index 61863686..641e3f77 100644 --- a/libs/RVL_SDK/include/private/os/OSAudioSystem.h +++ b/libs/RVL_SDK/include/private/os/OSAudioSystem.h @@ -7,11 +7,11 @@ extern "C" { #endif -void __OSInitAudioSystem(); -void __OSStopAudioSystem(); +void __OSInitAudioSystem(); +void __OSStopAudioSystem(); #ifdef __cplusplus } #endif -#endif // PRIVATE_OS_AUDIO_SYSTEM_H +#endif // PRIVATE_OS_AUDIO_SYSTEM_H diff --git a/libs/RVL_SDK/include/private/os/OSBootInfo2.h b/libs/RVL_SDK/include/private/os/OSBootInfo2.h index f6fd4273..c6eb65a2 100644 --- a/libs/RVL_SDK/include/private/os/OSBootInfo2.h +++ b/libs/RVL_SDK/include/private/os/OSBootInfo2.h @@ -1,8 +1,8 @@ #ifndef PRIVATE_OS_BOOT_INFO_2_H #define PRIVATE_OS_BOOT_INFO_2_H -#include #include +#include #ifdef __cplusplus extern "C" { @@ -21,29 +21,29 @@ typedef struct OSBootInfo2 { u32 padSpec; // 0x24 u32 codeLimit; // 0x28 u32 simulatedMem2Size; // 0x2C - u8 padding[0x2000 - 0x30]; + u8 padding[0x2000 - 0x30]; } OSBootInfo2; -#define BI2_SIZE 0x2000 +#define BI2_SIZE 0x2000 -#define BI2_ADDR OS_ADDR_BOOT_INFO_2 +#define BI2_ADDR OS_ADDR_BOOT_INFO_2 -#define BI2_OFFSET_DBMONITORSIZE 0x0000 -#define BI2_OFFSET_SIMULATEDMEM1SIZE 0x0004 -#define BI2_OFFSET_ARGOFFSET 0x0008 -#define BI2_OFFSET_DEBUGFLAG 0x000C -#define BI2_OFFSET_TRACKLOCATION 0x0010 -#define BI2_OFFSET_TRACKSIZE 0x0014 -#define BI2_OFFSET_COUNTRYCODE 0x0018 -#define BI2_OFFSET_PADSPEC 0x0024 -#define BI2_OFFSET_CODELIMIT 0x0028 -#define BI2_OFFSET_SIMULATEDMEM2SIZE 0x002C -#define BI2_OFFSET_NANDBOOT 0x0FE0 +#define BI2_OFFSET_DBMONITORSIZE 0x0000 +#define BI2_OFFSET_SIMULATEDMEM1SIZE 0x0004 +#define BI2_OFFSET_ARGOFFSET 0x0008 +#define BI2_OFFSET_DEBUGFLAG 0x000C +#define BI2_OFFSET_TRACKLOCATION 0x0010 +#define BI2_OFFSET_TRACKSIZE 0x0014 +#define BI2_OFFSET_COUNTRYCODE 0x0018 +#define BI2_OFFSET_PADSPEC 0x0024 +#define BI2_OFFSET_CODELIMIT 0x0028 +#define BI2_OFFSET_SIMULATEDMEM2SIZE 0x002C +#define BI2_OFFSET_NANDBOOT 0x0FE0 -#define BI2_OFFSET_ARGS BI2_SIZE +#define BI2_OFFSET_ARGS BI2_SIZE #ifdef __cplusplus } #endif -#endif // PRIVATE_OS_BOOT_INFO_2_H +#endif // PRIVATE_OS_BOOT_INFO_2_H diff --git a/libs/RVL_SDK/include/private/os/OSBootInfo3.h b/libs/RVL_SDK/include/private/os/OSBootInfo3.h index 8c63a461..47b9b114 100644 --- a/libs/RVL_SDK/include/private/os/OSBootInfo3.h +++ b/libs/RVL_SDK/include/private/os/OSBootInfo3.h @@ -8,21 +8,21 @@ extern "C" { #endif typedef struct OSBootInfo3 { - u32 countryCode; // 0x00 - u8 unk_0x04[0x0C]; - u8 parentalControlFlags[16]; // 0x10 - u8 unk_0x14[0x1FDC]; - u32 magic; // 0x1FFC + u32 countryCode; // 0x00 + u8 unk_0x04[0x0C]; + u8 parentalControlFlags[16]; // 0x10 + u8 unk_0x14[0x1FDC]; + u32 magic; // 0x1FFC } OSBootInfo3; -#define BI3_SIZE 0x2000 +#define BI3_SIZE 0x2000 -#define BI3_OFFSET_COUNTRYCODE 0x0000 -#define BI3_OFFSET_PARENTALCONTROL_FLAGS 0x0010 -#define BI3_OFFSET_MAGIC 0x1FFC +#define BI3_OFFSET_COUNTRYCODE 0x0000 +#define BI3_OFFSET_PARENTALCONTROL_FLAGS 0x0010 +#define BI3_OFFSET_MAGIC 0x1FFC #ifdef __cplusplus } #endif -#endif // PRIVATE_OS_BOOT_INFO_3_H +#endif // PRIVATE_OS_BOOT_INFO_3_H diff --git a/libs/RVL_SDK/include/private/os/OSError.h b/libs/RVL_SDK/include/private/os/OSError.h index 4dfe244f..e75e12b3 100644 --- a/libs/RVL_SDK/include/private/os/OSError.h +++ b/libs/RVL_SDK/include/private/os/OSError.h @@ -11,17 +11,17 @@ extern "C" { #endif -extern OSErrorHandler __OSErrorTable[OS_EXCEPTION_MAX]; -extern u32 __OSFpscrEnableBits; +extern OSErrorHandler __OSErrorTable[OS_EXCEPTION_MAX]; +extern u32 __OSFpscrEnableBits; #define FPSCR_ENABLE (FPSCR_VE | FPSCR_OE | FPSCR_UE | FPSCR_ZE | FPSCR_XE) #define OS_FPSCR_ENABLE (__OSFpscrEnableBits & FPSCR_ENABLE) -void __OSUnhandledException(__OSException exception, OSContext* context, u32 dsisr, u32 dar); +void __OSUnhandledException(__OSException exception, OSContext* context, u32 dsisr, u32 dar); #ifdef __cplusplus } #endif -#endif // PRIVATE_OS_ERROR_H +#endif // PRIVATE_OS_ERROR_H diff --git a/libs/RVL_SDK/include/private/os/OSExec.h b/libs/RVL_SDK/include/private/os/OSExec.h index 122ae509..f8235dd0 100644 --- a/libs/RVL_SDK/include/private/os/OSExec.h +++ b/libs/RVL_SDK/include/private/os/OSExec.h @@ -10,39 +10,39 @@ extern "C" { #endif typedef struct OSExecParams { - BOOL valid; // 0x00 + BOOL valid; // 0x00 - u32 restartCode; // 0x04 - u32 bootDol; // 0x08 + u32 restartCode; // 0x04 + u32 bootDol; // 0x08 - void* regionStart; // 0x0C - void* regionEnd; // 0x10 + void* regionStart; // 0x0C + void* regionEnd; // 0x10 - BOOL argsUseDefault; // 0x14 - void* argsAddr; // 0x18 + BOOL argsUseDefault; // 0x14 + void* argsAddr; // 0x18 } OSExecParams; -#define EXEC_WORK_ARENA_LO ((void*)0x81280000) -#define EXEC_WORK_ARENA_HI ((void*)0x812F0000) +#define EXEC_WORK_ARENA_LO ((void*)0x81280000) +#define EXEC_WORK_ARENA_HI ((void*)0x812F0000) #define EXEC_SYSTEM_MENU_ID 0x0000000100000002 -void __OSGetExecParams(OSExecParams *params); -BOOL __OSCheckCompanyCode(ESTitleId titleId, BOOL diskApp); -BOOL __OSCheckTmdCountryCode(ESTmdView* tmd); +void __OSGetExecParams(OSExecParams* params); +BOOL __OSCheckCompanyCode(ESTitleId titleId, BOOL diskApp); +BOOL __OSCheckTmdCountryCode(ESTmdView* tmd); -int __OSGetValidTicketIndex(ESTicketView* ticketViewList, u32 numTickets); +int __OSGetValidTicketIndex(ESTicketView* ticketViewList, u32 numTickets); -void __OSLaunchMenu(); -void __OSLaunchTitle(ESTitleId titleId); +void __OSLaunchMenu(); +void __OSLaunchTitle(ESTitleId titleId); -void __OSLaunchTitlevForSystem(ESTitleId titleId, u32 launchCode, const char** argv); -void __OSLaunchTitlelForSystem(ESTitleId titleId, u32 launchCode, const char* arg0, ...); +void __OSLaunchTitlevForSystem(ESTitleId titleId, u32 launchCode, const char** argv); +void __OSLaunchTitlelForSystem(ESTitleId titleId, u32 launchCode, const char* arg0, ...); -void __OSReturnToMenul(u32 launchArg, const char* arg0, ...); +void __OSReturnToMenul(u32 launchArg, const char* arg0, ...); #ifdef __cplusplus } #endif -#endif // PRIVATE_OS_EXEC_H +#endif // PRIVATE_OS_EXEC_H diff --git a/libs/RVL_SDK/include/private/os/OSInterrupt.h b/libs/RVL_SDK/include/private/os/OSInterrupt.h index 4324d9e3..c772532b 100644 --- a/libs/RVL_SDK/include/private/os/OSInterrupt.h +++ b/libs/RVL_SDK/include/private/os/OSInterrupt.h @@ -5,10 +5,10 @@ #include -#include #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -47,122 +47,96 @@ enum { __OS_INTERRUPT_MAX = 32 }; -#define OS_INTERRUPTMASK(intr) (1 << (31 - intr)) +#define OS_INTERRUPTMASK(intr) (1 << (31 - intr)) /* Memory Interface */ -#define OS_INTERRUPTMASK_MEM_0 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_0) -#define OS_INTERRUPTMASK_MEM_1 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_1) -#define OS_INTERRUPTMASK_MEM_2 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_2) -#define OS_INTERRUPTMASK_MEM_3 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_3) -#define OS_INTERRUPTMASK_MEM_ADDRESS OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_ADDRESS) +#define OS_INTERRUPTMASK_MEM_0 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_0) +#define OS_INTERRUPTMASK_MEM_1 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_1) +#define OS_INTERRUPTMASK_MEM_2 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_2) +#define OS_INTERRUPTMASK_MEM_3 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_3) +#define OS_INTERRUPTMASK_MEM_ADDRESS OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_ADDRESS) -#define OS_INTERRUPTMASK_MEM_RESET (OS_INTERRUPTMASK_MEM_0 | \ - OS_INTERRUPTMASK_MEM_1 | \ - OS_INTERRUPTMASK_MEM_2 | \ - OS_INTERRUPTMASK_MEM_3) -#define OS_INTERRUPTMASK_MEM (OS_INTERRUPTMASK_MEM_0 | \ - OS_INTERRUPTMASK_MEM_1 | \ - OS_INTERRUPTMASK_MEM_2 | \ - OS_INTERRUPTMASK_MEM_3 | \ - OS_INTERRUPTMASK_MEM_ADDRESS) +#define OS_INTERRUPTMASK_MEM_RESET (OS_INTERRUPTMASK_MEM_0 | OS_INTERRUPTMASK_MEM_1 | OS_INTERRUPTMASK_MEM_2 | OS_INTERRUPTMASK_MEM_3) +#define OS_INTERRUPTMASK_MEM \ + (OS_INTERRUPTMASK_MEM_0 | OS_INTERRUPTMASK_MEM_1 | OS_INTERRUPTMASK_MEM_2 | OS_INTERRUPTMASK_MEM_3 | OS_INTERRUPTMASK_MEM_ADDRESS) /* DSP */ -#define OS_INTERRUPTMASK_DSP_AI OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_AI) -#define OS_INTERRUPTMASK_DSP_ARAM OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_ARAM) -#define OS_INTERRUPTMASK_DSP_DSP OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_DSP) +#define OS_INTERRUPTMASK_DSP_AI OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_AI) +#define OS_INTERRUPTMASK_DSP_ARAM OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_ARAM) +#define OS_INTERRUPTMASK_DSP_DSP OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_DSP) -#define OS_INTERRUPTMASK_DSP (OS_INTERRUPTMASK_DSP_AI | \ - OS_INTERRUPTMASK_DSP_ARAM | \ - OS_INTERRUPTMASK_DSP_DSP) +#define OS_INTERRUPTMASK_DSP (OS_INTERRUPTMASK_DSP_AI | OS_INTERRUPTMASK_DSP_ARAM | OS_INTERRUPTMASK_DSP_DSP) /* Audio Interface */ -#define OS_INTERRUPTMASK_AI_AI OS_INTERRUPTMASK(__OS_INTERRUPT_AI_AI) +#define OS_INTERRUPTMASK_AI_AI OS_INTERRUPTMASK(__OS_INTERRUPT_AI_AI) -#define OS_INTERRUPTMASK_AI (OS_INTERRUPTMASK_AI_AI) +#define OS_INTERRUPTMASK_AI (OS_INTERRUPTMASK_AI_AI) /* External interface */ -#define OS_INTERRUPTMASK_EXI_0_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_EXI) -#define OS_INTERRUPTMASK_EXI_0_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_TC) -#define OS_INTERRUPTMASK_EXI_0_EXT OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_EXT) +#define OS_INTERRUPTMASK_EXI_0_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_EXI) +#define OS_INTERRUPTMASK_EXI_0_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_TC) +#define OS_INTERRUPTMASK_EXI_0_EXT OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_EXT) -#define OS_INTERRUPTMASK_EXI_0 (OS_INTERRUPTMASK_EXI_0_EXI | \ - OS_INTERRUPTMASK_EXI_0_TC | \ - OS_INTERRUPTMASK_EXI_0_EXT) +#define OS_INTERRUPTMASK_EXI_0 (OS_INTERRUPTMASK_EXI_0_EXI | OS_INTERRUPTMASK_EXI_0_TC | OS_INTERRUPTMASK_EXI_0_EXT) -#define OS_INTERRUPTMASK_EXI_1_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_EXI) -#define OS_INTERRUPTMASK_EXI_1_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_TC) -#define OS_INTERRUPTMASK_EXI_1_EXT OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_EXT) +#define OS_INTERRUPTMASK_EXI_1_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_EXI) +#define OS_INTERRUPTMASK_EXI_1_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_TC) +#define OS_INTERRUPTMASK_EXI_1_EXT OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_EXT) -#define OS_INTERRUPTMASK_EXI_1 (OS_INTERRUPTMASK_EXI_1_EXI | \ - OS_INTERRUPTMASK_EXI_1_TC | \ - OS_INTERRUPTMASK_EXI_1_EXT) +#define OS_INTERRUPTMASK_EXI_1 (OS_INTERRUPTMASK_EXI_1_EXI | OS_INTERRUPTMASK_EXI_1_TC | OS_INTERRUPTMASK_EXI_1_EXT) -#define OS_INTERRUPTMASK_EXI_2_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_2_EXI) -#define OS_INTERRUPTMASK_EXI_2_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_2_TC) -#define OS_INTERRUPTMASK_EXI_2 (OS_INTERRUPTMASK_EXI_2_EXI | \ - OS_INTERRUPTMASK_EXI_2_TC) +#define OS_INTERRUPTMASK_EXI_2_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_2_EXI) +#define OS_INTERRUPTMASK_EXI_2_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_2_TC) +#define OS_INTERRUPTMASK_EXI_2 (OS_INTERRUPTMASK_EXI_2_EXI | OS_INTERRUPTMASK_EXI_2_TC) -#define OS_INTERRUPTMASK_EXI (OS_INTERRUPTMASK_EXI_0_EXI | \ - OS_INTERRUPTMASK_EXI_0_TC | \ - OS_INTERRUPTMASK_EXI_0_EXT | \ - OS_INTERRUPTMASK_EXI_1_EXI | \ - OS_INTERRUPTMASK_EXI_1_TC | \ - OS_INTERRUPTMASK_EXI_1_EXT | \ - OS_INTERRUPTMASK_EXI_2_EXI | \ - OS_INTERRUPTMASK_EXI_2_TC) +#define OS_INTERRUPTMASK_EXI \ + (OS_INTERRUPTMASK_EXI_0_EXI | OS_INTERRUPTMASK_EXI_0_TC | OS_INTERRUPTMASK_EXI_0_EXT | OS_INTERRUPTMASK_EXI_1_EXI | OS_INTERRUPTMASK_EXI_1_TC | \ + OS_INTERRUPTMASK_EXI_1_EXT | OS_INTERRUPTMASK_EXI_2_EXI | OS_INTERRUPTMASK_EXI_2_TC) /* Processor interface */ -#define OS_INTERRUPTMASK_PI_PE_TOKEN OS_INTERRUPTMASK(__OS_INTERRUPT_PI_PE_TOKEN) -#define OS_INTERRUPTMASK_PI_PE_FINISH OS_INTERRUPTMASK(__OS_INTERRUPT_PI_PE_FINISH) +#define OS_INTERRUPTMASK_PI_PE_TOKEN OS_INTERRUPTMASK(__OS_INTERRUPT_PI_PE_TOKEN) +#define OS_INTERRUPTMASK_PI_PE_FINISH OS_INTERRUPTMASK(__OS_INTERRUPT_PI_PE_FINISH) -#define OS_INTERRUPTMASK_PI_PE (OS_INTERRUPTMASK_PI_PE_TOKEN | \ - OS_INTERRUPTMASK_PI_PE_FINISH) +#define OS_INTERRUPTMASK_PI_PE (OS_INTERRUPTMASK_PI_PE_TOKEN | OS_INTERRUPTMASK_PI_PE_FINISH) -#define OS_INTERRUPTMASK_PI_CP OS_INTERRUPTMASK(__OS_INTERRUPT_PI_CP) -#define OS_INTERRUPTMASK_PI_SI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_SI) -#define OS_INTERRUPTMASK_PI_DI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_DI) -#define OS_INTERRUPTMASK_PI_RSW OS_INTERRUPTMASK(__OS_INTERRUPT_PI_RSW) -#define OS_INTERRUPTMASK_PI_ERROR OS_INTERRUPTMASK(__OS_INTERRUPT_PI_ERROR) -#define OS_INTERRUPTMASK_PI_VI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_VI) -#define OS_INTERRUPTMASK_PI_DEBUG OS_INTERRUPTMASK(__OS_INTERRUPT_PI_DEBUG) -#define OS_INTERRUPTMASK_PI_HSP OS_INTERRUPTMASK(__OS_INTERRUPT_PI_HSP) -#define OS_INTERRUPTMASK_PI_ACR OS_INTERRUPTMASK(__OS_INTERRUPT_PI_ACR) +#define OS_INTERRUPTMASK_PI_CP OS_INTERRUPTMASK(__OS_INTERRUPT_PI_CP) +#define OS_INTERRUPTMASK_PI_SI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_SI) +#define OS_INTERRUPTMASK_PI_DI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_DI) +#define OS_INTERRUPTMASK_PI_RSW OS_INTERRUPTMASK(__OS_INTERRUPT_PI_RSW) +#define OS_INTERRUPTMASK_PI_ERROR OS_INTERRUPTMASK(__OS_INTERRUPT_PI_ERROR) +#define OS_INTERRUPTMASK_PI_VI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_VI) +#define OS_INTERRUPTMASK_PI_DEBUG OS_INTERRUPTMASK(__OS_INTERRUPT_PI_DEBUG) +#define OS_INTERRUPTMASK_PI_HSP OS_INTERRUPTMASK(__OS_INTERRUPT_PI_HSP) +#define OS_INTERRUPTMASK_PI_ACR OS_INTERRUPTMASK(__OS_INTERRUPT_PI_ACR) -#define OS_INTERRUPTMASK_PI (OS_INTERRUPTMASK_PI_CP | \ - OS_INTERRUPTMASK_PI_SI | \ - OS_INTERRUPTMASK_PI_DI | \ - OS_INTERRUPTMASK_PI_RSW | \ - OS_INTERRUPTMASK_PI_ERROR | \ - OS_INTERRUPTMASK_PI_VI | \ - OS_INTERRUPTMASK_PI_PE_TOKEN | \ - OS_INTERRUPTMASK_PI_PE_FINISH | \ - OS_INTERRUPTMASK_PI_DEBUG | \ - OS_INTERRUPTMASK_PI_HSP | \ - OS_INTERRUPTMASK_PI_ACR) -#define OS_INTERRUPTMASK_INVALID 0xFFFFFFFF +#define OS_INTERRUPTMASK_PI \ + (OS_INTERRUPTMASK_PI_CP | OS_INTERRUPTMASK_PI_SI | OS_INTERRUPTMASK_PI_DI | OS_INTERRUPTMASK_PI_RSW | OS_INTERRUPTMASK_PI_ERROR | \ + OS_INTERRUPTMASK_PI_VI | OS_INTERRUPTMASK_PI_PE_TOKEN | OS_INTERRUPTMASK_PI_PE_FINISH | OS_INTERRUPTMASK_PI_DEBUG | OS_INTERRUPTMASK_PI_HSP | \ + OS_INTERRUPTMASK_PI_ACR) +#define OS_INTERRUPTMASK_INVALID 0xFFFFFFFF -typedef u32 OSInterruptMask; +typedef u32 OSInterruptMask; typedef s16 __OSInterrupt; -extern volatile OSTime __OSLastInterruptTime; -extern volatile __OSInterrupt __OSLastInterrupt; +extern volatile OSTime __OSLastInterruptTime; +extern volatile __OSInterrupt __OSLastInterrupt; extern volatile OSInterruptMask __OSLastInterruptSrr0; typedef void (*__OSInterruptHandler)(__OSInterrupt interrupt, OSContext* context); -__OSInterruptHandler __OSSetInterruptHandler(__OSInterrupt interrupt, __OSInterruptHandler handler); +__OSInterruptHandler __OSSetInterruptHandler(__OSInterrupt interrupt, __OSInterruptHandler handler); -__OSInterruptHandler __OSGetInterruptHandler(__OSInterrupt interrupt); +__OSInterruptHandler __OSGetInterruptHandler(__OSInterrupt interrupt); -void __OSDispatchInterrupt(__OSException exception, OSContext* context); +void __OSDispatchInterrupt(__OSException exception, OSContext* context); -OSInterruptMask __OSMaskInterrupts(OSInterruptMask mask); -OSInterruptMask __OSUnmaskInterrupts(OSInterruptMask mask); +OSInterruptMask __OSMaskInterrupts(OSInterruptMask mask); +OSInterruptMask __OSUnmaskInterrupts(OSInterruptMask mask); extern void __RAS_OSDisableInterrupts_begin(); extern void __RAS_OSDisableInterrupts_end(); @@ -171,4 +145,4 @@ extern void __RAS_OSDisableInterrupts_end(); } #endif -#endif // PRIVATE_OS_INTERRUPT_H +#endif // PRIVATE_OS_INTERRUPT_H diff --git a/libs/RVL_SDK/include/private/os/OSIpc.h b/libs/RVL_SDK/include/private/os/OSIpc.h index 931b4bb2..156ef68e 100644 --- a/libs/RVL_SDK/include/private/os/OSIpc.h +++ b/libs/RVL_SDK/include/private/os/OSIpc.h @@ -7,8 +7,8 @@ extern "C" { #endif -void* __OSGetIPCBufferHi(); -void* __OSGetIPCBufferLo(); +void* __OSGetIPCBufferHi(); +void* __OSGetIPCBufferLo(); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/private/os/OSMutex.h b/libs/RVL_SDK/include/private/os/OSMutex.h index 7d704418..4b56145f 100644 --- a/libs/RVL_SDK/include/private/os/OSMutex.h +++ b/libs/RVL_SDK/include/private/os/OSMutex.h @@ -7,11 +7,11 @@ extern "C" { #endif -void __OSUnlockAllMutex(OSThread* thread); +void __OSUnlockAllMutex(OSThread* thread); -BOOL __OSCheckDeadLock(OSThread* thread); -BOOL __OSCheckMutex(OSMutex* mutex); -BOOL __OSCheckMutexes(OSThread* thread); +BOOL __OSCheckDeadLock(OSThread* thread); +BOOL __OSCheckMutex(OSMutex* mutex); +BOOL __OSCheckMutexes(OSThread* thread); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/private/os/OSNandbootInfo.h b/libs/RVL_SDK/include/private/os/OSNandbootInfo.h index 7658c7a4..2b4ddce8 100644 --- a/libs/RVL_SDK/include/private/os/OSNandbootInfo.h +++ b/libs/RVL_SDK/include/private/os/OSNandbootInfo.h @@ -8,21 +8,21 @@ extern "C" { #endif typedef struct OSNandbootInfo { - u32 checkSum; // 0x00 - u32 argsOff; // 0x04 + u32 checkSum; // 0x00 + u32 argsOff; // 0x04 - u8 padding_0x08[2]; + u8 padding_0x08[2]; - u8 prevAppType; // 0x0A - u8 returnValue; // 0x0B + u8 prevAppType; // 0x0A + u8 returnValue; // 0x0B - u32 argValue; // 0x0C + u32 argValue; // 0x0C - u8 padding_0x10[8]; + u8 padding_0x10[8]; - u64 prevTitleId; // 0x18 + u64 prevTitleId; // 0x18 - u8 args[0x1000]; // 0x20 + u8 args[0x1000]; // 0x20 } OSNandbootInfo; enum { @@ -31,11 +31,11 @@ enum { OS_NANDBOOT_8 = 8, }; -#define OS_NANDBOOT_CHECKSUM_SIZE (sizeof(OSNandbootInfo) - 4) +#define OS_NANDBOOT_CHECKSUM_SIZE (sizeof(OSNandbootInfo) - 4) -BOOL __OSCreateNandbootInfo(); -BOOL __OSWriteNandbootInfo(OSNandbootInfo* info); -BOOL __OSReadNandbootInfo(OSNandbootInfo *info); +BOOL __OSCreateNandbootInfo(); +BOOL __OSWriteNandbootInfo(OSNandbootInfo* info); +BOOL __OSReadNandbootInfo(OSNandbootInfo* info); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/private/os/OSPlayRecord.h b/libs/RVL_SDK/include/private/os/OSPlayRecord.h index 82f955ee..6d31a96a 100644 --- a/libs/RVL_SDK/include/private/os/OSPlayRecord.h +++ b/libs/RVL_SDK/include/private/os/OSPlayRecord.h @@ -1,8 +1,8 @@ #ifndef PRIVATE_OS_PLAY_RECORD_H #define PRIVATE_OS_PLAY_RECORD_H -#include #include +#include #include @@ -10,22 +10,22 @@ extern "C" { #endif -#define OS_RECORD_NAND_PATH "/title/00000001/00000002/data/play_rec.dat" +#define OS_RECORD_NAND_PATH "/title/00000001/00000002/data/play_rec.dat" -#define OS_RECORD_CHECKSUM_SIZE (sizeof(OSPlayRecord) - 4) +#define OS_RECORD_CHECKSUM_SIZE (sizeof(OSPlayRecord) - 4) -#define OS_RECORD_TITLE_LENGTH 21 +#define OS_RECORD_TITLE_LENGTH 21 typedef struct OSPlayRecord { - u32 checkSum; // 0x00 - wchar_t titleName[2][OS_RECORD_TITLE_LENGTH]; // 0x04 + u32 checkSum; // 0x00 + wchar_t titleName[2][OS_RECORD_TITLE_LENGTH]; // 0x04 - OSTime playStartTime; // 0x58 - OSTime playTime; // 0x60 + OSTime playStartTime; // 0x58 + OSTime playTime; // 0x60 - char gameCode[4]; // 0x68 - char makerCode[2]; // 0x6C - u8 padding[0x12]; // 0x6E + char gameCode[4]; // 0x68 + char makerCode[2]; // 0x6C + u8 padding[0x12]; // 0x6E } OSPlayRecord; enum { @@ -38,17 +38,17 @@ enum { OS_RECORD_STATE_CLOSE, OS_RECORD_STATE_CLOSED, OS_RECORD_STATE_TIMEOUT, - OS_RECORD_STATE_STOPPED + OS_RECORD_STATE_STOPPED }; -void __OSCreatePlayRecord(wchar_t* titleName, char* gameCode, char* makerCode); -BOOL __OSReadPlayRecord(OSPlayRecord *record); +void __OSCreatePlayRecord(wchar_t* titleName, char* gameCode, char* makerCode); +BOOL __OSReadPlayRecord(OSPlayRecord* record); -void __OSStartPlayRecord(); -void __OSStopPlayRecord(); +void __OSStartPlayRecord(); +void __OSStopPlayRecord(); #ifdef __cplusplus } #endif -#endif // PRIVATE_OS_PLAY_RECORD_H +#endif // PRIVATE_OS_PLAY_RECORD_H diff --git a/libs/RVL_SDK/include/private/os/OSPlayTime.h b/libs/RVL_SDK/include/private/os/OSPlayTime.h index c0e0e8de..c7b581e9 100644 --- a/libs/RVL_SDK/include/private/os/OSPlayTime.h +++ b/libs/RVL_SDK/include/private/os/OSPlayTime.h @@ -8,19 +8,19 @@ #include typedef enum OSPlayTimeType { - OS_PLAYTIME_PERMANENT = 0, - OS_PLAYTIME_TIME_LIMIT = 1, - OS_PLAYTIME_LAUNCH_LIMIT = 4, - OS_PLAYTIME_UNKNOWN = 9, + OS_PLAYTIME_PERMANENT = 0, + OS_PLAYTIME_TIME_LIMIT = 1, + OS_PLAYTIME_LAUNCH_LIMIT = 4, + OS_PLAYTIME_UNKNOWN = 9, } OSPlayTimeType; typedef void (*OSPlayTimeCallbackFunc)(); -BOOL __OSWriteExpiredFlag(); -BOOL __OSWriteExpiredFlagIfSet(); +BOOL __OSWriteExpiredFlag(); +BOOL __OSWriteExpiredFlagIfSet(); -s32 __OSPlayTimeGetConsumption(ESTicketView* ticket, ESLpEntry* lpEntry, u32* entries); +s32 __OSPlayTimeGetConsumption(ESTicketView* ticket, ESLpEntry* lpEntry, u32* entries); -s32 __OSGetPlayTime(ESTicketView* ticket, OSPlayTimeType* type, u32* arg); +s32 __OSGetPlayTime(ESTicketView* ticket, OSPlayTimeType* type, u32* arg); -#endif // PRIVATE_OS_PLAYTIME_H +#endif // PRIVATE_OS_PLAYTIME_H diff --git a/libs/RVL_SDK/include/private/os/OSReset.h b/libs/RVL_SDK/include/private/os/OSReset.h index c5f19495..3117947b 100644 --- a/libs/RVL_SDK/include/private/os/OSReset.h +++ b/libs/RVL_SDK/include/private/os/OSReset.h @@ -24,15 +24,15 @@ enum { OS_SETTING_UPDATE }; -void OSShutdownSystemForBS(); +void OSShutdownSystemForBS(); -BOOL __OSCallShutdownFunctions(BOOL final, u32 event); +BOOL __OSCallShutdownFunctions(BOOL final, u32 event); -void __OSShutdownDevices(u32 id); +void __OSShutdownDevices(u32 id); -void __OSReturnToMenuForError(); -void __OSHotResetForError(); +void __OSReturnToMenuForError(); +void __OSHotResetForError(); -u8 __OSGetDiscState(u8 prev); +u8 __OSGetDiscState(u8 prev); -#endif // PRIVATE_OS_RESET_H +#endif // PRIVATE_OS_RESET_H diff --git a/libs/RVL_SDK/include/private/os/OSRtc.h b/libs/RVL_SDK/include/private/os/OSRtc.h index 6b3c84ff..1f2c1d2d 100644 --- a/libs/RVL_SDK/include/private/os/OSRtc.h +++ b/libs/RVL_SDK/include/private/os/OSRtc.h @@ -7,12 +7,12 @@ extern "C" { #endif -BOOL __OSSetRTC(u32 rtc); -BOOL __OSGetRTC(u32* rtc); +BOOL __OSSetRTC(u32 rtc); +BOOL __OSGetRTC(u32* rtc); -BOOL __OSGetRTCFlags(u32* flags); +BOOL __OSGetRTCFlags(u32* flags); -BOOL __OSClearRTCFlags(); +BOOL __OSClearRTCFlags(); // From Dolphin Emulator. enum { @@ -24,4 +24,4 @@ enum { } #endif -#endif // PRIVATE_OS_RTC_H +#endif // PRIVATE_OS_RTC_H diff --git a/libs/RVL_SDK/include/private/os/OSSram.h b/libs/RVL_SDK/include/private/os/OSSram.h index 4391190a..b11c3da8 100644 --- a/libs/RVL_SDK/include/private/os/OSSram.h +++ b/libs/RVL_SDK/include/private/os/OSSram.h @@ -8,12 +8,12 @@ extern "C" { #endif typedef struct SramControl { - u8 sram[64]; - u32 offset; - BOOL enabled; - BOOL locked; - int sync; - void (*callback)(); + u8 sram[64]; + u32 offset; + BOOL enabled; + BOOL locked; + int sync; + void (*callback)(); } SramControl; typedef struct OSSram { @@ -22,39 +22,39 @@ typedef struct OSSram { u32 ead0; u32 ead1; u32 counterBias; - s8 displayOffsetH; - u8 ntd; - u8 language; - u8 flags; + s8 displayOffsetH; + u8 ntd; + u8 language; + u8 flags; } OSSram; typedef struct OSSramEx { - u8 flashID[2][12]; + u8 flashID[2][12]; u32 wirelessKeyboardID; u16 wirelessPadID[4]; - u8 dvdErrorCode; - u8 reserved; - u8 flashIDCheckSum[2]; + u8 dvdErrorCode; + u8 reserved; + u8 flashIDCheckSum[2]; u16 gbs; u8 _pad1[2]; } OSSramEx; -void __OSInitSram(); +void __OSInitSram(); -OSSram* __OSLockSram(); -OSSramEx* __OSLockSramEx(); +OSSram* __OSLockSram(); +OSSramEx* __OSLockSramEx(); -BOOL __OSUnlockSram(int commit); -BOOL __OSUnlockSramEx(int commit); +BOOL __OSUnlockSram(int commit); +BOOL __OSUnlockSramEx(int commit); -BOOL __OSSyncSram(); +BOOL __OSSyncSram(); -BOOL __OSCheckSram(); +BOOL __OSCheckSram(); -BOOL __OSReadROM(void* buffer, s32 length, s32 offset); +BOOL __OSReadROM(void* buffer, s32 length, s32 offset); #ifdef __cplusplus } #endif -#endif // PRIVATE_OS_SRAM_H +#endif // PRIVATE_OS_SRAM_H diff --git a/libs/RVL_SDK/include/private/os/OSStateFlags.h b/libs/RVL_SDK/include/private/os/OSStateFlags.h index 0bbf8bd1..ddb3cf6f 100644 --- a/libs/RVL_SDK/include/private/os/OSStateFlags.h +++ b/libs/RVL_SDK/include/private/os/OSStateFlags.h @@ -4,21 +4,22 @@ #include typedef struct OSStateFlags { - u32 checkSum; // 0x00 + u32 checkSum; // 0x00 - u8 lastAppType; // 0x04 - u8 shutdownType; // 0x05 - u8 discState; // 0x06 + u8 lastAppType; // 0x04 + u8 shutdownType; // 0x05 + u8 discState; // 0x06 - u8 menuMode; // 0x07 + u8 menuMode; // 0x07 - u8 padding_0x08[24]; + u8 padding_0x08[24]; } OSStateFlags; -#define OS_STATE_FLAGS_NAND_PATH "/title/00000001/00000002/data/state.dat" +#define OS_STATE_FLAGS_NAND_PATH "/title/00000001/00000002/data/state.dat" -#define OS_STATE_FLAGS_CHECKSUM_SIZE (sizeof(OSStateFlags) - 4) +#define OS_STATE_FLAGS_CHECKSUM_SIZE (sizeof(OSStateFlags) - 4) +// clang-format off enum { OS_STATE_FLAGS_SHUTDOWN_NONE = 0, OS_STATE_FLAGS_SHUTDOWN_POWER_OFF, @@ -41,9 +42,10 @@ enum { OS_STATE_FLAGS_DISC_CHANGED, OS_STATE_FLAGS_DISC_NONE }; +// clang-format on -BOOL __OSCreateStateFlags(); -BOOL __OSWriteStateFlags(OSStateFlags* flags); -BOOL __OSReadStateFlags(OSStateFlags* flags); +BOOL __OSCreateStateFlags(); +BOOL __OSWriteStateFlags(OSStateFlags* flags); +BOOL __OSReadStateFlags(OSStateFlags* flags); -#endif // PRIVATE_OS_STATE_FLAGS_H +#endif // PRIVATE_OS_STATE_FLAGS_H diff --git a/libs/RVL_SDK/include/private/os/OSStateTM.h b/libs/RVL_SDK/include/private/os/OSStateTM.h index a5f7117a..f32e279c 100644 --- a/libs/RVL_SDK/include/private/os/OSStateTM.h +++ b/libs/RVL_SDK/include/private/os/OSStateTM.h @@ -9,24 +9,24 @@ extern "C" { #endif -void __OSRegisterStateEvent(); -BOOL __OSGetResetButtonStateRaw(); -IOSError __OSUnRegisterStateEvent(); +void __OSRegisterStateEvent(); +BOOL __OSGetResetButtonStateRaw(); +IOSError __OSUnRegisterStateEvent(); -BOOL __OSInitSTM(); +BOOL __OSInitSTM(); -void __OSHotReset(); +void __OSHotReset(); -void __OSShutdownToSBY(); -void __OSShutdownToIDL(); -int __OSSetVIForceDimming(BOOL enable, u32 shiftY, u32 shiftX); +void __OSShutdownToSBY(); +void __OSShutdownToIDL(); +int __OSSetVIForceDimming(BOOL enable, u32 shiftY, u32 shiftX); -s32 __OSSetIdleLEDMode(u32 mode); +s32 __OSSetIdleLEDMode(u32 mode); -s32 __OSUnRegisterStateEvent(); +s32 __OSUnRegisterStateEvent(); #ifdef __cplusplus } #endif -#endif // PRIVATE_OS_STATE_TM_H +#endif // PRIVATE_OS_STATE_TM_H diff --git a/libs/RVL_SDK/include/private/os/OSSync.h b/libs/RVL_SDK/include/private/os/OSSync.h index 5a3eabf7..e5546224 100644 --- a/libs/RVL_SDK/include/private/os/OSSync.h +++ b/libs/RVL_SDK/include/private/os/OSSync.h @@ -7,4 +7,4 @@ extern void __OSSystemCallVectorStart(); extern void __OSSystemCallVectorEnd(); extern void __OSInitSystemCall(); -#endif // PRIVATE_OS_SYNC_H +#endif // PRIVATE_OS_SYNC_H diff --git a/libs/RVL_SDK/include/private/os/OSThread.h b/libs/RVL_SDK/include/private/os/OSThread.h index 63376c6b..a5a87e5e 100644 --- a/libs/RVL_SDK/include/private/os/OSThread.h +++ b/libs/RVL_SDK/include/private/os/OSThread.h @@ -3,13 +3,13 @@ #include -void __OSReschedule(); +void __OSReschedule(); -OSPriority __OSGetEffectivePriority(OSThread *thread); -void __OSPromoteThread(OSThread *thread, OSPriority priority); +OSPriority __OSGetEffectivePriority(OSThread* thread); +void __OSPromoteThread(OSThread* thread, OSPriority priority); -BOOL __OSIsThreadActive(OSThread* thread); +BOOL __OSIsThreadActive(OSThread* thread); -void __OSSwitchThread(OSThread* thread); +void __OSSwitchThread(OSThread* thread); -#endif // PRIVATE_OS_THREAD_H +#endif // PRIVATE_OS_THREAD_H diff --git a/libs/RVL_SDK/include/private/os/OSTime.h b/libs/RVL_SDK/include/private/os/OSTime.h index 8f3d2fa0..3a35fb8b 100644 --- a/libs/RVL_SDK/include/private/os/OSTime.h +++ b/libs/RVL_SDK/include/private/os/OSTime.h @@ -7,9 +7,9 @@ extern "C" { #endif -void __OSSetTime(OSTime time); -OSTime __OSGetSystemTime(); -OSTime __OSTimeToSystemTime(OSTime time); +void __OSSetTime(OSTime time); +OSTime __OSGetSystemTime(); +OSTime __OSTimeToSystemTime(OSTime time); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/private/pad.h b/libs/RVL_SDK/include/private/pad.h index ecdc9d74..4341c531 100644 --- a/libs/RVL_SDK/include/private/pad.h +++ b/libs/RVL_SDK/include/private/pad.h @@ -7,10 +7,10 @@ extern "C" { #endif -BOOL __PADDisableRecalibration(BOOL disable); +BOOL __PADDisableRecalibration(BOOL disable); #ifdef __cplusplus } #endif -#endif // PRIVATE_PAD_H +#endif // PRIVATE_PAD_H diff --git a/libs/RVL_SDK/include/private/sc.h b/libs/RVL_SDK/include/private/sc.h index 6893ab2f..19ac4d9e 100644 --- a/libs/RVL_SDK/include/private/sc.h +++ b/libs/RVL_SDK/include/private/sc.h @@ -5,8 +5,8 @@ #include -#include #include +#include #include "bt_types.h" @@ -15,7 +15,7 @@ extern "C" { #endif #define SC_CONFIG_FILE_PHYS_ADDRESS 0x3800 -#define SC_CONFIG_FILE_LENGTH 0x100 +#define SC_CONFIG_FILE_LENGTH 0x100 typedef enum SCItemID { SC_ITEM_ID_IPL_COUNTER_BIAS, @@ -61,8 +61,8 @@ typedef enum SCItemID { typedef void (*SCAsyncCallback)(s32 result); -#define SC_CONF_MIN_SIZE (sizeof(SCConfHeader) + sizeof(u32)) -#define SC_CONF_MAX_SIZE 0x4000 +#define SC_CONF_MIN_SIZE (sizeof(SCConfHeader) + sizeof(u32)) +#define SC_CONF_MAX_SIZE 0x4000 typedef struct SCConfHeader { u32 magic; // 0x00 @@ -71,55 +71,55 @@ typedef struct SCConfHeader { } SCConfHeader; typedef struct SCConfItem { - u8 desc; // 0x00 - char name[]; // 0x04 + u8 desc; // 0x00 + char name[]; // 0x04 } SCConfItem; typedef enum { - SC_CONF_FILE_SYSTEM, // SYSCONF - SC_CONF_FILE_PRODUCT, // setting.txt + SC_CONF_FILE_SYSTEM, // SYSCONF + SC_CONF_FILE_PRODUCT, // setting.txt SC_CONF_FILE_MAX } SCConfFile; typedef struct SCControl { - OSThreadQueue threadQueue; // 0x00 - NANDFileInfo fileInfo; // 0x08 - NANDCommandBlock commandBlock; // 0x94 + OSThreadQueue threadQueue; // 0x00 + NANDFileInfo fileInfo; // 0x08 + NANDCommandBlock commandBlock; // 0x94 union { - NANDStatus fileAttr; - u8 fileType; - }; // 0x14C + NANDStatus fileAttr; + u8 fileType; + }; // 0x14C - u8 nandCbState; // 0x154 - u8 isFileOpen; // 0x155 - u8 openFileType; // 0x156 + u8 nandCbState; // 0x154 + u8 isFileOpen; // 0x155 + u8 openFileType; // 0x156 - SCAsyncCallback asyncCallback; // 0x158 - s32 asyncResult; // 0x15C + SCAsyncCallback asyncCallback; // 0x158 + s32 asyncResult; // 0x15C - const char* filePaths[SC_CONF_FILE_MAX]; // 0x160 - u8* fileBuffers[SC_CONF_FILE_MAX]; // 0x168 - u32 bufferSizes[SC_CONF_FILE_MAX]; // 0x170 - u32 fileSizes[SC_CONF_FILE_MAX]; // 0x178 + const char* filePaths[SC_CONF_FILE_MAX]; // 0x160 + u8* fileBuffers[SC_CONF_FILE_MAX]; // 0x168 + u32 bufferSizes[SC_CONF_FILE_MAX]; // 0x170 + u32 fileSizes[SC_CONF_FILE_MAX]; // 0x178 - SCFlushCallback flushCallback; // 0x180 - SCStatus flushStatus; // 0x184 - u32 flushSize; // 0x188 + SCFlushCallback flushCallback; // 0x180 + SCStatus flushStatus; // 0x184 + u32 flushSize; // 0x188 } SCControl; typedef struct SCItem { - char unk_0x00[0x8]; + char unk_0x00[0x8]; - u8 primType; // 0x08 - u8 arrayType; // 0x09 + u8 primType; // 0x08 + u8 arrayType; // 0x09 - u32 nameLen; // 0x0C - u32 dataLen; // 0x10 - const char* name; // 0x14 - u8* data; // 0x18 + u32 nameLen; // 0x0C + u32 dataLen; // 0x10 + const char* name; // 0x14 + u8* data; // 0x18 - u32 itemLen; // 0x1C + u32 itemLen; // 0x1C } SCItem; BOOL SCFindByteArrayItem(void* dst, u32 len, SCItemID id); @@ -137,68 +137,67 @@ BOOL SCReplaceU32Item(u32 dst, SCItemID id); BOOL SCReplaceU64Item(u64 dst, SCItemID id); BOOL SCReplaceBoolItem(BOOL dst, SCItemID id); -BOOL __SCIsDirty(); -void __SCClearConfBuf(); -void __SCSetDirtyFlag(); -void __SCClearDirtyFlag(); -u8* __SCGetConfBuf(); -u32 __SCGetConfBufSize(); +BOOL __SCIsDirty(); +void __SCClearConfBuf(); +void __SCSetDirtyFlag(); +void __SCClearDirtyFlag(); +u8* __SCGetConfBuf(); +u32 __SCGetConfBufSize(); /* SYSCONF BTE */ -#define SC_MAX_DEV_ENTRY_FOR_STD 10 -#define SC_MAX_DEV_ENTRY_FOR_SMP 6 -#define SC_MAX_DEV_ENTRY (SC_MAX_DEV_ENTRY_FOR_STD + SC_MAX_DEV_ENTRY_FOR_SMP) +#define SC_MAX_DEV_ENTRY_FOR_STD 10 +#define SC_MAX_DEV_ENTRY_FOR_SMP 6 +#define SC_MAX_DEV_ENTRY (SC_MAX_DEV_ENTRY_FOR_STD + SC_MAX_DEV_ENTRY_FOR_SMP) typedef struct SC_BT_DEV_INFO { - u8 devName[20]; // 0x00 - u8 unk_0x14; - u8 unk_0x15[0xB]; - LINK_KEY linkKey; // 0x20 - u8 unk_0x30[0x10]; + u8 devName[20]; // 0x00 + u8 unk_0x14; + u8 unk_0x15[0xB]; + LINK_KEY linkKey; // 0x20 + u8 unk_0x30[0x10]; } SC_BT_DEV_INFO; typedef struct SCBtDeviceInfo { - BD_ADDR addr; // 0x00 - SC_BT_DEV_INFO info; // 0x06 + BD_ADDR addr; // 0x00 + SC_BT_DEV_INFO info; // 0x06 } SCBtDeviceInfo; typedef struct SCBtDeviceInfoArray { - u8 numRegist; // 0x00 - //SCBtDeviceInfo devices[SC_MAX_DEV_ENTRY]; // 0x01 + u8 numRegist; // 0x00 + // SCBtDeviceInfo devices[SC_MAX_DEV_ENTRY]; // 0x01 union { struct { - SCBtDeviceInfo regist[SC_MAX_DEV_ENTRY_FOR_STD]; // at 0x1 - SCBtDeviceInfo active[SC_MAX_DEV_ENTRY_FOR_SMP]; // at 0x2BD + SCBtDeviceInfo regist[SC_MAX_DEV_ENTRY_FOR_STD]; // at 0x1 + SCBtDeviceInfo active[SC_MAX_DEV_ENTRY_FOR_SMP]; // at 0x2BD }; SCBtDeviceInfo devices[SC_MAX_DEV_ENTRY]; }; } SCBtDeviceInfoArray; -BOOL SCGetBtDeviceInfoArray(SCBtDeviceInfoArray* devInfo); -BOOL SCSetBtDeviceInfoArray(SCBtDeviceInfoArray* devInfo); +BOOL SCGetBtDeviceInfoArray(SCBtDeviceInfoArray* devInfo); +BOOL SCSetBtDeviceInfoArray(SCBtDeviceInfoArray* devInfo); typedef struct SCBtCmpDevInfo { - BD_ADDR addr; // 0x00 - u8 name[64]; // 0x06 - LINK_KEY linkKey; // 0x30 + BD_ADDR addr; // 0x00 + u8 name[64]; // 0x06 + LINK_KEY linkKey; // 0x30 } SCBtCmpDevInfo; typedef struct SCBtCmpDevInfoArray { - u8 numRegist; // 0x00 - SCBtCmpDevInfo devices[SC_MAX_DEV_ENTRY_FOR_SMP]; // 0x01 + u8 numRegist; // 0x00 + SCBtCmpDevInfo devices[SC_MAX_DEV_ENTRY_FOR_SMP]; // 0x01 } SCBtCmpDevInfoArray; -BOOL SCGetBtCmpDevInfoArray(SCBtCmpDevInfoArray* devInfo); -BOOL SCSetBtCmpDevInfoArray(SCBtCmpDevInfoArray* devInfo); - -u32 SCGetBtDpdSensibility(); -BOOL SCSetBtDpdSensibility(u32 dpdSensibility); +BOOL SCGetBtCmpDevInfoArray(SCBtCmpDevInfoArray* devInfo); +BOOL SCSetBtCmpDevInfoArray(SCBtCmpDevInfoArray* devInfo); +u32 SCGetBtDpdSensibility(); +BOOL SCSetBtDpdSensibility(u32 dpdSensibility); #ifdef __cplusplus } #endif -#endif // PRIVATE_SC_H +#endif // PRIVATE_SC_H diff --git a/libs/RVL_SDK/include/private/si.h b/libs/RVL_SDK/include/private/si.h index 70eafba4..b6539e4b 100644 --- a/libs/RVL_SDK/include/private/si.h +++ b/libs/RVL_SDK/include/private/si.h @@ -1,9 +1,9 @@ #ifndef PRIVATE_SI_H #define PRIVATE_SI_H -#include -#include #include +#include +#include #include @@ -12,126 +12,126 @@ extern "C" { #endif #define SI_CHAN_BAD -1 -#define SI_CHAN_0 0 -#define SI_CHAN_1 1 -#define SI_CHAN_2 2 -#define SI_CHAN_3 3 +#define SI_CHAN_0 0 +#define SI_CHAN_1 1 +#define SI_CHAN_2 2 +#define SI_CHAN_3 3 #define SI_CHAN_MAX 4 -#define SI_TYPE_0 0 -#define SI_TYPE_1 1 -#define SI_TYPE_2 2 -#define SI_TYPE_3 3 +#define SI_TYPE_0 0 +#define SI_TYPE_1 1 +#define SI_TYPE_2 2 +#define SI_TYPE_3 3 #define SI_TYPE_MAX 4 enum { - SI_ERROR_UNDER_RUN = 1, - SI_ERROR_OVER_RUN = 2, - SI_ERROR_COLLISION = 4, - SI_ERROR_NO_RESPONSE = 8, - SI_ERROR_WRST = 16, - SI_ERROR_RDST = 32, - SI_ERROR_UNKNOWN = 64, - SI_ERROR_BUSY = 128 + SI_ERROR_UNDER_RUN = 1, + SI_ERROR_OVER_RUN = 2, + SI_ERROR_COLLISION = 4, + SI_ERROR_NO_RESPONSE = 8, + SI_ERROR_WRST = 16, + SI_ERROR_RDST = 32, + SI_ERROR_UNKNOWN = 64, + SI_ERROR_BUSY = 128 }; -#define SI_TYPE_MASK 0x18000000 -#define SI_TYPE_N64 0x00000000 +#define SI_TYPE_MASK 0x18000000 +#define SI_TYPE_N64 0x00000000 #define SI_TYPE_DOLPHIN 0x08000000 -#define SI_TYPE_GC 0x08000000 +#define SI_TYPE_GC 0x08000000 -#define SI_GC_WIRELESS 0x80000000 -#define SI_GC_NOMOTOR 0x20000000 -#define SI_GC_STANDARD 0x01000000 +#define SI_GC_WIRELESS 0x80000000 +#define SI_GC_NOMOTOR 0x20000000 +#define SI_GC_STANDARD 0x01000000 -#define SI_WIRELESS_RECEIVED 0x40000000 -#define SI_WIRELESS_IR 0x04000000 -#define SI_WIRELESS_STATE 0x02000000 -#define SI_WIRELESS_ORIGIN 0x00200000 -#define SI_WIRELESS_FIX_ID 0x00100000 -#define SI_WIRELESS_TYPE 0x000f0000 -#define SI_WIRELESS_LITE_MASK 0x000c0000 -#define SI_WIRELESS_LITE 0x00040000 -#define SI_WIRELESS_CONT_MASK 0x00080000 -#define SI_WIRELESS_CONT 0x00000000 -#define SI_WIRELESS_ID 0x00c0ff00 +#define SI_WIRELESS_RECEIVED 0x40000000 +#define SI_WIRELESS_IR 0x04000000 +#define SI_WIRELESS_STATE 0x02000000 +#define SI_WIRELESS_ORIGIN 0x00200000 +#define SI_WIRELESS_FIX_ID 0x00100000 +#define SI_WIRELESS_TYPE 0x000f0000 +#define SI_WIRELESS_LITE_MASK 0x000c0000 +#define SI_WIRELESS_LITE 0x00040000 +#define SI_WIRELESS_CONT_MASK 0x00080000 +#define SI_WIRELESS_CONT 0x00000000 +#define SI_WIRELESS_ID 0x00c0ff00 #define SI_WIRELESS_TYPE_ID (SI_WIRELESS_TYPE | SI_WIRELESS_ID) -#define SI_N64_CONTROLLER (SI_TYPE_N64 | 0x05000000) -#define SI_N64_MIC (SI_TYPE_N64 | 0x00010000) -#define SI_N64_KEYBOARD (SI_TYPE_N64 | 0x00020000) -#define SI_N64_MOUSE (SI_TYPE_N64 | 0x02000000) -#define SI_GBA (SI_TYPE_N64 | 0x00040000) -#define SI_GC_CONTROLLER (SI_TYPE_GC | SI_GC_STANDARD) -#define SI_GC_RECEIVER (SI_TYPE_GC | SI_GC_WIRELESS) -#define SI_GC_WAVEBIRD (SI_TYPE_GC | SI_GC_WIRELESS | SI_GC_STANDARD | SI_WIRELESS_STATE | SI_WIRELESS_FIX_ID) -#define SI_GC_KEYBOARD (SI_TYPE_GC | 0x00200000) -#define SI_GC_STEERING (SI_TYPE_GC | 0x00000000) +#define SI_N64_CONTROLLER (SI_TYPE_N64 | 0x05000000) +#define SI_N64_MIC (SI_TYPE_N64 | 0x00010000) +#define SI_N64_KEYBOARD (SI_TYPE_N64 | 0x00020000) +#define SI_N64_MOUSE (SI_TYPE_N64 | 0x02000000) +#define SI_GBA (SI_TYPE_N64 | 0x00040000) +#define SI_GC_CONTROLLER (SI_TYPE_GC | SI_GC_STANDARD) +#define SI_GC_RECEIVER (SI_TYPE_GC | SI_GC_WIRELESS) +#define SI_GC_WAVEBIRD (SI_TYPE_GC | SI_GC_WIRELESS | SI_GC_STANDARD | SI_WIRELESS_STATE | SI_WIRELESS_FIX_ID) +#define SI_GC_KEYBOARD (SI_TYPE_GC | 0x00200000) +#define SI_GC_STEERING (SI_TYPE_GC | 0x00000000) typedef void (*SICallback)(s32, u32, OSContext*); typedef void (*SITypeCallback)(s32, u32); typedef struct { - s32 chan; - u32 poll; + s32 chan; + u32 poll; - u32 inputBytes; - void* input; + u32 inputBytes; + void* input; - SICallback callback; + SICallback callback; } SIControl; typedef struct { - s32 chan; + s32 chan; - void* output; - u32 outputBytes; + void* output; + u32 outputBytes; - void* input; - u32 inputBytes; + void* input; + u32 inputBytes; - SICallback callback; - OSTime fire; + SICallback callback; + OSTime fire; } SIPacket; -BOOL SIBusy(); +BOOL SIBusy(); -BOOL SIIsChanBusy(s32 chan); +BOOL SIIsChanBusy(s32 chan); -BOOL SIRegisterPollingHandler(__OSInterruptHandler handler); -BOOL SIUnregisterPollingHandler(__OSInterruptHandler handler); +BOOL SIRegisterPollingHandler(__OSInterruptHandler handler); +BOOL SIUnregisterPollingHandler(__OSInterruptHandler handler); -void SIInit(); +void SIInit(); -u32 SISync(); +u32 SISync(); -u32 SIGetStatus(s32 chan); +u32 SIGetStatus(s32 chan); -void SISetCommand(s32 chan, u32 command); -u32 SIGetCommand(s32 chan); +void SISetCommand(s32 chan, u32 command); +u32 SIGetCommand(s32 chan); -void SITransferCommands(); +void SITransferCommands(); -u32 SISetXY(u32 x, u32 y); +u32 SISetXY(u32 x, u32 y); -u32 SIEnablePolling(u32 poll); -u32 SIDisablePolling(u32 poll); +u32 SIEnablePolling(u32 poll); +u32 SIDisablePolling(u32 poll); -BOOL SIGetResponse(s32 chan, void* data); -BOOL SITransfer(s32 chan, void* output, u32 outputBytes, void* input, u32 inputBytes, SICallback callback, OSTime delay); +BOOL SIGetResponse(s32 chan, void* data); +BOOL SITransfer(s32 chan, void* output, u32 outputBytes, void* input, u32 inputBytes, SICallback callback, OSTime delay); -u32 SIGetType(s32 chan); -u32 SIGetTypeAsync(s32 chan, SITypeCallback callback); +u32 SIGetType(s32 chan); +u32 SIGetTypeAsync(s32 chan, SITypeCallback callback); -u32 SIDecodeType(u32 type); -u32 SIProbe(s32 chan); -char* SIGetTypeString(u32 type); +u32 SIDecodeType(u32 type); +u32 SIProbe(s32 chan); +char* SIGetTypeString(u32 type); -void SISetSamplingRate(u32 msec); -void SIRefreshSamplingRate(); +void SISetSamplingRate(u32 msec); +void SIRefreshSamplingRate(); #ifdef __cplusplus } #endif -#endif // PRIVATE_SI_H +#endif // PRIVATE_SI_H diff --git a/libs/RVL_SDK/include/private/usb.h b/libs/RVL_SDK/include/private/usb.h index 9fd2bee6..1d6f0eb8 100644 --- a/libs/RVL_SDK/include/private/usb.h +++ b/libs/RVL_SDK/include/private/usb.h @@ -12,21 +12,22 @@ extern "C" { typedef void (*USBCallback)(IOSError result, void* arg); typedef void (*USBIsoCallback)(IOSError err, void* unkIsoArg, void* cbArg); -IOSError IUSB_OpenLib(); -IOSError IUSB_CloseLib(); +IOSError IUSB_OpenLib(); +IOSError IUSB_CloseLib(); -IOSError IUSB_OpenDeviceIds(const char* interface, u16 vid, u16 pid, IOSError* resultOut); +IOSError IUSB_OpenDeviceIds(const char* interface, u16 vid, u16 pid, IOSError* resultOut); -IOSError IUSB_CloseDeviceAsync(s32 fd, USBCallback callback, void* callbackArg); +IOSError IUSB_CloseDeviceAsync(s32 fd, USBCallback callback, void* callbackArg); -IOSError IUSB_ReadIntrMsgAsync(s32 fd, u32 endpoint, u32 length, void* buffer, USBCallback callback, void* callbackArg); -IOSError IUSB_ReadBlkMsgAsync(s32 fd, u32 endpoint, u32 length, void* buffer, USBCallback callback, void* callbackArg); +IOSError IUSB_ReadIntrMsgAsync(s32 fd, u32 endpoint, u32 length, void* buffer, USBCallback callback, void* callbackArg); +IOSError IUSB_ReadBlkMsgAsync(s32 fd, u32 endpoint, u32 length, void* buffer, USBCallback callback, void* callbackArg); -IOSError IUSB_WriteBlkMsgAsync(s32 fd, u32 endpoint, u32 length, const void* buffer, USBCallback callback, void* callbackArg); -IOSError IUSB_WriteCtrlMsgAsync(s32 fd, u8 requestType, u8 request, u16 value, u16 index, u16 length, void* buffer, USBCallback callback, void* callbackArg); +IOSError IUSB_WriteBlkMsgAsync(s32 fd, u32 endpoint, u32 length, const void* buffer, USBCallback callback, void* callbackArg); +IOSError IUSB_WriteCtrlMsgAsync(s32 fd, u8 requestType, u8 request, u16 value, u16 index, u16 length, void* buffer, USBCallback callback, + void* callbackArg); #ifdef __cplusplus } #endif -#endif // PRIVATE_USB_H +#endif // PRIVATE_USB_H diff --git a/libs/RVL_SDK/include/private/usbcmn/puh_ker_mem.h b/libs/RVL_SDK/include/private/usbcmn/puh_ker_mem.h index 1d51a500..371b1ccb 100644 --- a/libs/RVL_SDK/include/private/usbcmn/puh_ker_mem.h +++ b/libs/RVL_SDK/include/private/usbcmn/puh_ker_mem.h @@ -3,9 +3,9 @@ #include -void* uhf_ker_get_memory_block(void* heap, u32 size, int align); -s32 uhf_ker_release_memory_block(void* heap, void* block); +void* uhf_ker_get_memory_block(void* heap, u32 size, int align); +s32 uhf_ker_release_memory_block(void* heap, void* block); -BOOL uhf_ker_check_cacheable(); +BOOL uhf_ker_check_cacheable(); -#endif // PFILE_USB_HELPER_MEM_H +#endif // PFILE_USB_HELPER_MEM_H diff --git a/libs/RVL_SDK/include/private/usbcmn/puh_ker_msg.h b/libs/RVL_SDK/include/private/usbcmn/puh_ker_msg.h index d298cd55..18e8adda 100644 --- a/libs/RVL_SDK/include/private/usbcmn/puh_ker_msg.h +++ b/libs/RVL_SDK/include/private/usbcmn/puh_ker_msg.h @@ -5,4 +5,4 @@ s32 uhf_ker_send_message(int index, void* message); -#endif // PFILE_USB_HELPER_MSG_H +#endif // PFILE_USB_HELPER_MSG_H diff --git a/libs/RVL_SDK/include/private/usbcmn/puh_ker_sem.h b/libs/RVL_SDK/include/private/usbcmn/puh_ker_sem.h index f7a6592b..876c9728 100644 --- a/libs/RVL_SDK/include/private/usbcmn/puh_ker_sem.h +++ b/libs/RVL_SDK/include/private/usbcmn/puh_ker_sem.h @@ -8,4 +8,4 @@ s32 uhf_ker_delete_sem(int sem); s32 uhf_ker_get_sem(int sem); -#endif // PFILE_USB_HELPER_SEM_H +#endif // PFILE_USB_HELPER_SEM_H diff --git a/libs/RVL_SDK/include/private/usbcmn/puh_ker_tsk.h b/libs/RVL_SDK/include/private/usbcmn/puh_ker_tsk.h index 8fa606cf..ab4d7f5e 100644 --- a/libs/RVL_SDK/include/private/usbcmn/puh_ker_tsk.h +++ b/libs/RVL_SDK/include/private/usbcmn/puh_ker_tsk.h @@ -5,4 +5,4 @@ s32 uhf_ker_set_priority(int tsk, int priority); -#endif // USB_UTILITIES_TASK_H +#endif // USB_UTILITIES_TASK_H diff --git a/libs/RVL_SDK/include/private/usbcmn/puh_types.h b/libs/RVL_SDK/include/private/usbcmn/puh_types.h index c751075e..c8895e1f 100644 --- a/libs/RVL_SDK/include/private/usbcmn/puh_types.h +++ b/libs/RVL_SDK/include/private/usbcmn/puh_types.h @@ -3,4 +3,4 @@ #include -#endif // PFILE_USB_HELPER_TYPES_H +#endif // PFILE_USB_HELPER_TYPES_H diff --git a/libs/RVL_SDK/include/private/vi.h b/libs/RVL_SDK/include/private/vi.h index d314a2cc..ec60e5f2 100644 --- a/libs/RVL_SDK/include/private/vi.h +++ b/libs/RVL_SDK/include/private/vi.h @@ -7,17 +7,17 @@ extern "C" { #endif -void __VISetRGBModeImm(); -void __VIResetRFIdle(); -void __VIResetSIIdle(); +void __VISetRGBModeImm(); +void __VIResetRFIdle(); +void __VIResetSIIdle(); -void __VIGetCurrentPosition(s16* x, s16* y); +void __VIGetCurrentPosition(s16* x, s16* y); -void __VIInit(VITVMode mode); -void __VIInit3in1(VITVMode mode); +void __VIInit(VITVMode mode); +void __VIInit3in1(VITVMode mode); #ifdef __cplusplus } #endif -#endif // PRIVATE_VI_H +#endif // PRIVATE_VI_H diff --git a/libs/RVL_SDK/include/private/vistructs.h b/libs/RVL_SDK/include/private/vistructs.h index d0dc8b00..119762da 100644 --- a/libs/RVL_SDK/include/private/vistructs.h +++ b/libs/RVL_SDK/include/private/vistructs.h @@ -5,7 +5,7 @@ #include typedef struct { - u8 equ; + u8 equ; u16 acv; u16 prbOdd; @@ -14,10 +14,10 @@ typedef struct { u16 psbOdd; u16 psbEven; - u8 bs1; - u8 bs2; - u8 bs3; - u8 bs4; + u8 bs1; + u8 bs2; + u8 bs3; + u8 bs4; u16 be1; u16 be2; @@ -27,51 +27,51 @@ typedef struct { u16 nhlines; u16 hlw; - u8 hsy; - u8 hcs; - u8 hce; + u8 hsy; + u8 hcs; + u8 hce; - u8 hbe640; + u8 hbe640; u16 hbs640; - u8 hbeCCIR656; + u8 hbeCCIR656; u16 hbsCCIR656; } VITiming; typedef struct { - u16 DispPosX; - u16 DispPosY; - u16 DispSizeX; - u16 DispSizeY; + u16 DispPosX; + u16 DispPosY; + u16 DispSizeX; + u16 DispSizeY; - u16 AdjustedDispPosX; - u16 AdjustedDispPosY; - u16 AdjustedDispSizeY; - u16 AdjustedPanPosY; - u16 AdjustedPanSizeY; + u16 AdjustedDispPosX; + u16 AdjustedDispPosY; + u16 AdjustedDispSizeY; + u16 AdjustedPanPosY; + u16 AdjustedPanSizeY; - u16 FBSizeX; - u16 FBSizeY; + u16 FBSizeX; + u16 FBSizeY; - u16 PanPosX; - u16 PanPosY; - u16 PanSizeX; - u16 PanSizeY; + u16 PanPosX; + u16 PanPosY; + u16 PanSizeX; + u16 PanSizeY; - VIXFBMode FBMode; - u32 nonInter; - u32 tv; - u8 wordPerLine; - u8 std; - u8 wpl; - u32 bufAddr; - u32 tfbb, bfbb; - u8 xof; - BOOL black; - BOOL threeD; - u32 rbufAddr; - u32 rtfbb, rbfbb; - VITiming* timing; + VIXFBMode FBMode; + u32 nonInter; + u32 tv; + u8 wordPerLine; + u8 std; + u8 wpl; + u32 bufAddr; + u32 tfbb, bfbb; + u8 xof; + BOOL black; + BOOL threeD; + u32 rbufAddr; + u32 rtfbb, rbfbb; + VITiming* timing; } VIHorVer; -#endif // PRIVATE_VI_STRUCTURES_H +#endif // PRIVATE_VI_STRUCTURES_H diff --git a/libs/RVL_SDK/include/private/wpad.h b/libs/RVL_SDK/include/private/wpad.h index 3c0eb2d3..a6ffa02b 100644 --- a/libs/RVL_SDK/include/private/wpad.h +++ b/libs/RVL_SDK/include/private/wpad.h @@ -3,8 +3,8 @@ #include -#include #include +#include #include -#endif // PRIVATE_WPAD_H +#endif // PRIVATE_WPAD_H diff --git a/libs/RVL_SDK/include/private/wpad/WPADHIDParser.h b/libs/RVL_SDK/include/private/wpad/WPADHIDParser.h index 235bb5fd..b9a7d101 100644 --- a/libs/RVL_SDK/include/private/wpad/WPADHIDParser.h +++ b/libs/RVL_SDK/include/private/wpad/WPADHIDParser.h @@ -45,7 +45,7 @@ extern "C" { #define RPT10_RUMBLE 0 // Report 0x11: Set LED lights -#define RPTID_SET_PORT 0x11 // internally called SetPort +#define RPTID_SET_PORT 0x11 // internally called SetPort #define RPT11_SIZE 1 #define RPT11_LED 0 @@ -58,7 +58,7 @@ extern "C" { #define RPT12_DATA_REPORT_MODE 1 // Report 0x13: Enable IR camera -#define RPTID_ENABLE_DPD 0x13 // internally called the DPD +#define RPTID_ENABLE_DPD 0x13 // internally called the DPD #define RPT13_SIZE 1 #define RPT13_DPD_ENABLE 0 @@ -211,4 +211,4 @@ s32 WPADiHIDParser(u8 port, u8* p_rpt); } #endif -#endif // PRIVATE_WPAD_HID_PARSER_H +#endif // PRIVATE_WPAD_HID_PARSER_H diff --git a/libs/RVL_SDK/include/private/wpad/WPADInternal.h b/libs/RVL_SDK/include/private/wpad/WPADInternal.h index 6ab46ae1..8e2a5849 100644 --- a/libs/RVL_SDK/include/private/wpad/WPADInternal.h +++ b/libs/RVL_SDK/include/private/wpad/WPADInternal.h @@ -17,58 +17,58 @@ void DEBUGPrint(const char* format, ...); #define RX_BUFFER_SIZE OSRoundUp32B(sizeof(WPADStatusEx)) #define WPAD_CONFIG_BLOCK_CHECKSUM_BIAS 0x55 -#define WPAD_MAX_CONFIG_BLOCKS 2 +#define WPAD_MAX_CONFIG_BLOCKS 2 -#define WPAD_DPD_CONFIG_BLOCK_CHECKSUM 10 -#define WPAD_DPD_CONFIG_BLOCK_SIZE 11 +#define WPAD_DPD_CONFIG_BLOCK_CHECKSUM 10 +#define WPAD_DPD_CONFIG_BLOCK_SIZE 11 -#define WPAD_DEV_CONFIG_BLOCK_CHECKSUM 9 -#define WPAD_DEV_CONFIG_BLOCK_SIZE 10 +#define WPAD_DEV_CONFIG_BLOCK_CHECKSUM 9 +#define WPAD_DEV_CONFIG_BLOCK_SIZE 10 -#define DPD_CFG_OBJ_BL 0 -#define DPD_CFG_OBJ_BR 1 -#define DPD_CFG_OBJ_TR 2 -#define DPD_CFG_OBJ_TL 3 +#define DPD_CFG_OBJ_BL 0 +#define DPD_CFG_OBJ_BR 1 +#define DPD_CFG_OBJ_TR 2 +#define DPD_CFG_OBJ_TL 3 /* * Wiimote memory addresses */ -#define WM_ADDR_MEM_DEV_CONFIG_0 WM_MEM_ADDR(0x0000) -#define WM_ADDR_MEM_GAME_INFO_0 WM_MEM_ADDR(0x002A) -#define WM_ADDR_MEM_GAME_INFO_1 WM_MEM_ADDR(0x0062) -#define WM_ADDR_MEM_176C WM_MEM_ADDR(0x176C) -#define WM_ADDR_MEM_1770 WM_MEM_ADDR(0x1770) +#define WM_ADDR_MEM_DEV_CONFIG_0 WM_MEM_ADDR(0x0000) +#define WM_ADDR_MEM_GAME_INFO_0 WM_MEM_ADDR(0x002A) +#define WM_ADDR_MEM_GAME_INFO_1 WM_MEM_ADDR(0x0062) +#define WM_ADDR_MEM_176C WM_MEM_ADDR(0x176C) +#define WM_ADDR_MEM_1770 WM_MEM_ADDR(0x1770) /* * Wiimote extension register addresses */ // Speaker register addresses -#define WM_REG_SPEAKER_01 WM_EXT_REG_ADDR(SPEAKER, 0x01) -#define WM_REG_SPEAKER_08 WM_EXT_REG_ADDR(SPEAKER, 0x08) -#define WM_REG_SPEAKER_09 WM_EXT_REG_ADDR(SPEAKER, 0x09) +#define WM_REG_SPEAKER_01 WM_EXT_REG_ADDR(SPEAKER, 0x01) +#define WM_REG_SPEAKER_08 WM_EXT_REG_ADDR(SPEAKER, 0x08) +#define WM_REG_SPEAKER_09 WM_EXT_REG_ADDR(SPEAKER, 0x09) // Extension register addresses -#define WM_REG_EXTENSION_CONFIG WM_EXT_REG_ADDR(EXTENSION, 0x20) -#define WM_REG_EXTENSION_40 WM_EXT_REG_ADDR(EXTENSION, 0x40) -#define WM_REG_EXTENSION_CERT_PARAM WM_EXT_REG_ADDR(EXTENSION, 0x50) -#define WM_REG_EXTENSION_F0 WM_EXT_REG_ADDR(EXTENSION, 0xF0) +#define WM_REG_EXTENSION_CONFIG WM_EXT_REG_ADDR(EXTENSION, 0x20) +#define WM_REG_EXTENSION_40 WM_EXT_REG_ADDR(EXTENSION, 0x40) +#define WM_REG_EXTENSION_CERT_PARAM WM_EXT_REG_ADDR(EXTENSION, 0x50) +#define WM_REG_EXTENSION_F0 WM_EXT_REG_ADDR(EXTENSION, 0xF0) #define WM_REG_EXTENSION_CERT_CHALLENGE WM_EXT_REG_ADDR(EXTENSION, 0xF1) -#define WM_REG_EXTENSION_F2 WM_EXT_REG_ADDR(EXTENSION, 0xF2) -#define WM_REG_EXTENSION_F3 WM_EXT_REG_ADDR(EXTENSION, 0xF3) -#define WM_REG_EXTENSION_EXT_TYPE_2 WM_EXT_REG_ADDR(EXTENSION, 0xF6) -#define WM_REG_EXTENSION_CERT_PROBE WM_EXT_REG_ADDR(EXTENSION, 0xF7) -#define WM_REG_EXTENSION_FA WM_EXT_REG_ADDR(EXTENSION, 0xFA) -#define WM_REG_EXTENSION_FB WM_EXT_REG_ADDR(EXTENSION, 0xFB) -#define WM_REG_EXTENSION_DEV_MODE WM_EXT_REG_ADDR(EXTENSION, 0xFE) -#define WM_REG_EXTENSION_ID_BYTE WM_EXT_REG_ADDR(EXTENSION, 0xFF) +#define WM_REG_EXTENSION_F2 WM_EXT_REG_ADDR(EXTENSION, 0xF2) +#define WM_REG_EXTENSION_F3 WM_EXT_REG_ADDR(EXTENSION, 0xF3) +#define WM_REG_EXTENSION_EXT_TYPE_2 WM_EXT_REG_ADDR(EXTENSION, 0xF6) +#define WM_REG_EXTENSION_CERT_PROBE WM_EXT_REG_ADDR(EXTENSION, 0xF7) +#define WM_REG_EXTENSION_FA WM_EXT_REG_ADDR(EXTENSION, 0xFA) +#define WM_REG_EXTENSION_FB WM_EXT_REG_ADDR(EXTENSION, 0xFB) +#define WM_REG_EXTENSION_DEV_MODE WM_EXT_REG_ADDR(EXTENSION, 0xFE) +#define WM_REG_EXTENSION_ID_BYTE WM_EXT_REG_ADDR(EXTENSION, 0xFF) // IR camera register addresses -#define WM_REG_DPD_CONFIG_BLOCK_1 WM_EXT_REG_ADDR(DPD, 0x00) -#define WM_REG_DPD_CONFIG_BLOCK_2 WM_EXT_REG_ADDR(DPD, 0x1A) -#define WM_REG_DPD_30 WM_EXT_REG_ADDR(DPD, 0x30) -#define WM_REG_DPD_DATA_FORMAT WM_EXT_REG_ADDR(DPD, 0x33) +#define WM_REG_DPD_CONFIG_BLOCK_1 WM_EXT_REG_ADDR(DPD, 0x00) +#define WM_REG_DPD_CONFIG_BLOCK_2 WM_EXT_REG_ADDR(DPD, 0x1A) +#define WM_REG_DPD_30 WM_EXT_REG_ADDR(DPD, 0x30) +#define WM_REG_DPD_DATA_FORMAT WM_EXT_REG_ADDR(DPD, 0x33) -#define WM_EXTENSION_CONFIG_SIZE 0x20 // 0xA40020 - 0xA4003F +#define WM_EXTENSION_CONFIG_SIZE 0x20 // 0xA40020 - 0xA4003F typedef enum { WPAD_STATE_EXT_UNINITIALIZED, @@ -78,8 +78,8 @@ typedef enum { } WPADExtensionState; typedef enum { - WPAD_RADIO_QUALITY_GOOD, // 80+ - WPAD_RADIO_QUALITY_BAD // 80- + WPAD_RADIO_QUALITY_GOOD, // 80+ + WPAD_RADIO_QUALITY_BAD // 80- // if radioQuality calculation == 80, state stays the same } WPADRadioQuality; @@ -93,59 +93,59 @@ typedef enum { } WPADInterleaveBufferFlags; typedef struct WPADCommand { - u32 reportID; // 0x00 + u32 reportID; // 0x00 - u8 dataBuf[RPT_MAX_SIZE]; // 0x04 - u16 dataLength; // 0x1A + u8 dataBuf[RPT_MAX_SIZE]; // 0x04 + u16 dataLength; // 0x1A - void* dstBuf; // 0x1C + void* dstBuf; // 0x1C - u16 readLength; // 0x20 - u32 readAddress; // 0x24 + u16 readLength; // 0x20 + u32 readAddress; // 0x24 - WPADInfo* statusReportOut; // 0x28 - WPADCallback cmdCB; // 0x2C + WPADInfo* statusReportOut; // 0x28 + WPADCallback cmdCB; // 0x2C } WPADCommand; typedef struct WPADCommandQueue { - s8 front; // 0x00 - s8 back; // 0x01 - WPADCommand* buffer; // 0x04 - u32 capacity; // 0x08 + s8 front; // 0x00 + s8 back; // 0x01 + WPADCommand* buffer; // 0x04 + u32 capacity; // 0x08 } WPADCommandQueue; typedef struct WPADDevConfig { - DPDObject dpd[WPAD_MAX_DPD_OBJECTS]; // 0x00 + DPDObject dpd[WPAD_MAX_DPD_OBJECTS]; // 0x00 - s16 accX0g; // 0x20 - s16 accY0g; // 0x22 - s16 accZ0g; // 0x24 + s16 accX0g; // 0x20 + s16 accY0g; // 0x22 + s16 accZ0g; // 0x24 - s16 accX1g; // 0x26 - s16 accY1g; // 0x28 - s16 accZ1g; // 0x2A + s16 accX1g; // 0x26 + s16 accY1g; // 0x28 + s16 accZ1g; // 0x2A - u8 motor; // 0x2C - u8 volume; // 0x2D + u8 motor; // 0x2C + u8 volume; // 0x2D } WPADDevConfig; typedef struct WPADExtConfig { union { struct WPADFSConfig { - s16 stickXCenter; // 0x00 - s16 unk_0x02; // 0x02 - s16 unk_0x04; // 0x04 - s16 stickYCenter; // 0x06 - s16 unk_0x08; // 0x08 - s16 unk_0x0A; // 0x0A + s16 stickXCenter; // 0x00 + s16 unk_0x02; // 0x02 + s16 unk_0x04; // 0x04 + s16 stickYCenter; // 0x06 + s16 unk_0x08; // 0x08 + s16 unk_0x0A; // 0x0A - s16 accX0g; // 0x0C - s16 accY0g; // 0x0E - s16 accZ0g; // 0x10 + s16 accX0g; // 0x0C + s16 accY0g; // 0x0E + s16 accZ0g; // 0x10 - s16 accX1g; // 0x12 - s16 accY1g; // 0x14 - s16 accZ1g; // 0x16 + s16 accX1g; // 0x12 + s16 accY1g; // 0x14 + s16 accZ1g; // 0x16 } fs; struct WPADCLConfig { @@ -163,120 +163,120 @@ typedef struct WPADExtConfig { s16 unk_0x14; // 0x14 s16 unk_0x16; // 0x16 - u8 triggerLZero; // 0x18 - u8 triggerRZero; // 0x19 + u8 triggerLZero; // 0x18 + u8 triggerRZero; // 0x19 } cl; } u; } WPADExtConfig; typedef struct WPADCB { - WPADGameInfo gameInfo; // 0x00 - s32 unk_0x38[2]; - u8 rxBufMain[RX_BUFFER_SIZE]; // 0x40 - u8 rxBufs[2][RX_BUFFER_SIZE]; // 0xA0 - WPADCommandQueue stdCmdQueue; // 0x160 - WPADCommand stdCmdQueueList[24]; // 0x16C - WPADCommandQueue extCmdQueue; // 0x5EC - WPADCommand extCmdQueueList[12]; // 0x5F8 - WPADInfo wpInfo; // 0x838 - WPADInfo* wpInfoOut; // 0x850 - WPADDevConfig devConfig; // 0x854 - WPADExtConfig extConfig; // 0x882 - WPADCallback cmdBlkCB; // 0x89C - WPADExtensionCallback extensionCB; // 0x8A0 - WPADConnectCallback connectCB; // 0x8A4 - WPADSamplingCallback samplingCB; // 0x8A8 + WPADGameInfo gameInfo; // 0x00 + s32 unk_0x38[2]; + u8 rxBufMain[RX_BUFFER_SIZE]; // 0x40 + u8 rxBufs[2][RX_BUFFER_SIZE]; // 0xA0 + WPADCommandQueue stdCmdQueue; // 0x160 + WPADCommand stdCmdQueueList[24]; // 0x16C + WPADCommandQueue extCmdQueue; // 0x5EC + WPADCommand extCmdQueueList[12]; // 0x5F8 + WPADInfo wpInfo; // 0x838 + WPADInfo* wpInfoOut; // 0x850 + WPADDevConfig devConfig; // 0x854 + WPADExtConfig extConfig; // 0x882 + WPADCallback cmdBlkCB; // 0x89C + WPADExtensionCallback extensionCB; // 0x8A0 + WPADConnectCallback connectCB; // 0x8A4 + WPADSamplingCallback samplingCB; // 0x8A8 union { - WPADStatus* samplingBuf; - WPADStatusEx* samplingBufEx; - WPADFSStatus* samplingBufFS; - WPADCLStatus* samplingBufCL; - }; // 0x8AC - u32 samplingBufIndex; // 0x8B0 - u32 samplingBufSize; // 0x8B4 - u32 dataFormat; // 0x8B8 - s32 status; // 0x8BC - u8 statusReqBusy; // 0x8C0 - u8 devType; // 0x8C1 - u8 devMode; // 0x8C2 - s8 devHandle; // 0x8C3 - s32 unk_0x8C4; - u8 rxBufIndex; // 0x8C8 - s8 unk_0x8C9; - u8 defaultDpdSize; // 0x8CA - u8 currentDpdCommand; // 0x8CB - u8 pendingDpdCommand; // 0x8CC - u8 radioQuality; // 0x8CD - u8 radioQualityOkMs; // 0x8CE - u8 audioFrames; // 0x8CF - u32 motorBusy; // 0x8D0 - BOOL motorRunning; // 0x8D4 - BOOL used; // 0x8D8 - BOOL handshakeFinished; // 0x8DC - s32 configIndex; // 0x8E0 - OSThreadQueue threadQueue; // 0x8E4 - s64 lastControllerDataUpdate; // 0x8F0 - u16 filterDiffDpd; // 0x8F8 - u16 filterSameDpd; // 0x8FA - u16 filterDiffAcc; // 0x8FC - u16 filterSameAcc; // 0x8FE - u16 filterDiffExt; // 0x900 - u16 filterSameExt; // 0x902 - s64 lastReportSendTime; // 0x908 - u8 unk_0x910; - u8 calibrated; // 0x911 - u16 comboHeld; // 0x912 - u8 encryptionKey[16]; // 0x914 - u8 decryptAddTable[8]; // 0x924 - u8 decryptXorTable[8]; // 0x92C - u8 wmReadDataBuf[64]; // 0x934 - u8* wmReadDataPtr; // 0x974 - u32 wmReadAddress; // 0x978 - int wmReadHadError; // 0x97C - u16 wmReadLength; // 0x980 - s8 unk_0x982; - u8 radioSensitivity; // 0x983 - u16 copyOutCount; // 0x984 - u8 sleeping; // 0x986 - u8 lastReportID; // 0x987 - WPADCallback getInfoCB; // 0x988 - u8 getInfoBusy; // 0x98C + WPADStatus* samplingBuf; + WPADStatusEx* samplingBufEx; + WPADFSStatus* samplingBufFS; + WPADCLStatus* samplingBufCL; + }; // 0x8AC + u32 samplingBufIndex; // 0x8B0 + u32 samplingBufSize; // 0x8B4 + u32 dataFormat; // 0x8B8 + s32 status; // 0x8BC + u8 statusReqBusy; // 0x8C0 + u8 devType; // 0x8C1 + u8 devMode; // 0x8C2 + s8 devHandle; // 0x8C3 + s32 unk_0x8C4; + u8 rxBufIndex; // 0x8C8 + s8 unk_0x8C9; + u8 defaultDpdSize; // 0x8CA + u8 currentDpdCommand; // 0x8CB + u8 pendingDpdCommand; // 0x8CC + u8 radioQuality; // 0x8CD + u8 radioQualityOkMs; // 0x8CE + u8 audioFrames; // 0x8CF + u32 motorBusy; // 0x8D0 + BOOL motorRunning; // 0x8D4 + BOOL used; // 0x8D8 + BOOL handshakeFinished; // 0x8DC + s32 configIndex; // 0x8E0 + OSThreadQueue threadQueue; // 0x8E4 + s64 lastControllerDataUpdate; // 0x8F0 + u16 filterDiffDpd; // 0x8F8 + u16 filterSameDpd; // 0x8FA + u16 filterDiffAcc; // 0x8FC + u16 filterSameAcc; // 0x8FE + u16 filterDiffExt; // 0x900 + u16 filterSameExt; // 0x902 + s64 lastReportSendTime; // 0x908 + u8 unk_0x910; + u8 calibrated; // 0x911 + u16 comboHeld; // 0x912 + u8 encryptionKey[16]; // 0x914 + u8 decryptAddTable[8]; // 0x924 + u8 decryptXorTable[8]; // 0x92C + u8 wmReadDataBuf[64]; // 0x934 + u8* wmReadDataPtr; // 0x974 + u32 wmReadAddress; // 0x978 + int wmReadHadError; // 0x97C + u16 wmReadLength; // 0x980 + s8 unk_0x982; + u8 radioSensitivity; // 0x983 + u16 copyOutCount; // 0x984 + u8 sleeping; // 0x986 + u8 lastReportID; // 0x987 + WPADCallback getInfoCB; // 0x988 + u8 getInfoBusy; // 0x98C - u8 unk_0x98D; // 0x98D - u8 unk_0x98E; // 0x98E - u8 unk_0x98F[0x9A0 - 0x990]; + u8 unk_0x98D; // 0x98D + u8 unk_0x98E; // 0x98E + u8 unk_0x98F[0x9A0 - 0x990]; } WPADCB; -extern WPADCB _wpd[WPAD_MAX_CONTROLLERS]; -extern WPADCB* _wpdcb[WPAD_MAX_CONTROLLERS]; +extern WPADCB _wpd[WPAD_MAX_CONTROLLERS]; +extern WPADCB* _wpdcb[WPAD_MAX_CONTROLLERS]; -void WPADiInitSub(); +void WPADiInitSub(); -void WPADiExcludeButton(s32 chan); -void WPADiCopyOut(s32 chan); +void WPADiExcludeButton(s32 chan); +void WPADiCopyOut(s32 chan); -BOOL WPADiSendSetPort(WPADCommandQueue* pQueue, u8 port, WPADCallback pCallback); -BOOL WPADiSendSetReportType(WPADCommandQueue* pQueue, s32 format, BOOL unk, WPADCallback pCallback); -BOOL WPADiSendEnableDPD(WPADCommandQueue* pQueue, BOOL enable, WPADCallback pCallback); -BOOL WPADiSendEnableSpeaker(WPADCommandQueue* pQueue, BOOL enable, WPADCallback pCallback); -BOOL WPADiSendGetContStat(WPADCommandQueue* pQueue, WPADInfo* pInfo, WPADCallback pCallback); -BOOL WPADiSendWriteDataCmd(WPADCommandQueue* pQueue, u8 cmd, u32 addr, WPADCallback pCallback); -BOOL WPADiSendWriteData(WPADCommandQueue* pQueue, const void* pSrc, u16 len, u32 addr, WPADCallback pCallback); -BOOL WPADiSendReadData(WPADCommandQueue* pQueue, void* pDst, u16 len, u32 addr, WPADCallback pCallback); -BOOL WPADiSendStreamData(WPADCommandQueue* pQueue, const void* pData, u16 len); -BOOL WPADiSendMuteSpeaker(WPADCommandQueue* pQueue, BOOL mute, WPADCallback pCallback); -BOOL WPADiSendDPDCSB(WPADCommandQueue* pQueue, BOOL enable, WPADCallback pCallback); +BOOL WPADiSendSetPort(WPADCommandQueue* pQueue, u8 port, WPADCallback pCallback); +BOOL WPADiSendSetReportType(WPADCommandQueue* pQueue, s32 format, BOOL unk, WPADCallback pCallback); +BOOL WPADiSendEnableDPD(WPADCommandQueue* pQueue, BOOL enable, WPADCallback pCallback); +BOOL WPADiSendEnableSpeaker(WPADCommandQueue* pQueue, BOOL enable, WPADCallback pCallback); +BOOL WPADiSendGetContStat(WPADCommandQueue* pQueue, WPADInfo* pInfo, WPADCallback pCallback); +BOOL WPADiSendWriteDataCmd(WPADCommandQueue* pQueue, u8 cmd, u32 addr, WPADCallback pCallback); +BOOL WPADiSendWriteData(WPADCommandQueue* pQueue, const void* pSrc, u16 len, u32 addr, WPADCallback pCallback); +BOOL WPADiSendReadData(WPADCommandQueue* pQueue, void* pDst, u16 len, u32 addr, WPADCallback pCallback); +BOOL WPADiSendStreamData(WPADCommandQueue* pQueue, const void* pData, u16 len); +BOOL WPADiSendMuteSpeaker(WPADCommandQueue* pQueue, BOOL mute, WPADCallback pCallback); +BOOL WPADiSendDPDCSB(WPADCommandQueue* pQueue, BOOL enable, WPADCallback pCallback); -void WPADiClearQueue(WPADCommandQueue* pQueue); -BOOL WPADiPushCommand(WPADCommandQueue* pQueue, WPADCommand command); -BOOL WPADiGetCommand(const WPADCommandQueue* pQueue, WPADCommand* pCommand); -BOOL WPADiPopCommand(WPADCommandQueue* pQueue); +void WPADiClearQueue(WPADCommandQueue* pQueue); +BOOL WPADiPushCommand(WPADCommandQueue* pQueue, WPADCommand command); +BOOL WPADiGetCommand(const WPADCommandQueue* pQueue, WPADCommand* pCommand); +BOOL WPADiPopCommand(WPADCommandQueue* pQueue); -u16 _WPADGetStackBufferStatus(s32 chan); -u16 _WPADGetModuleBufferStatus(s32 chan); +u16 _WPADGetStackBufferStatus(s32 chan); +u16 _WPADGetModuleBufferStatus(s32 chan); inline void __WPADShutdown(); -void __WPADReconnect(BOOL recFlag); +void __WPADReconnect(BOOL recFlag); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/private/wpad/WPADMem.h b/libs/RVL_SDK/include/private/wpad/WPADMem.h index b6d12592..24328386 100644 --- a/libs/RVL_SDK/include/private/wpad/WPADMem.h +++ b/libs/RVL_SDK/include/private/wpad/WPADMem.h @@ -9,7 +9,7 @@ extern "C" { #endif -#define WM_MEM_ADDR(ADDR) ((ADDR) & 0xFFFF) +#define WM_MEM_ADDR(ADDR) ((ADDR) & 0xFFFF) #define WM_EXT_REG_ADDR(TYPE, ADDR) (((ADDR) & 0xFFFF) | ((WPAD_EXT_REG_##TYPE) << 16) | (1 << 26)) typedef enum { @@ -20,20 +20,20 @@ typedef enum { } WPADExtRegType; typedef struct WPADMemBlock { - int unk_0x00; // 0x00 - int unk_0x04; // 0x04 - s16 unk_0x08; // 0x08 - int unk_0x0c; // 0x0C - WPADCallback unk_0x10; // 0x10 + int unk_0x00; // 0x00 + int unk_0x04; // 0x04 + s16 unk_0x08; // 0x08 + int unk_0x0c; // 0x0C + WPADCallback unk_0x10; // 0x10 } WPADMemBlock; typedef struct WPADGameInfo { - s64 timestamp; // 0x00 - u16 gameName[16 + 1]; // 0x08 - char gameID[4]; // 0x2A - u8 gameType; // 0x2E - u8 checksum; // 0x2F - u8 UNK_0x30[8]; + s64 timestamp; // 0x00 + u16 gameName[16 + 1]; // 0x08 + char gameID[4]; // 0x2A + u8 gameType; // 0x2E + u8 checksum; // 0x2F + u8 UNK_0x30[8]; } WPADGameInfo; extern WPADMemBlock _wmb[WPAD_MAX_CONTROLLERS]; @@ -42,4 +42,4 @@ extern WPADMemBlock _wmb[WPAD_MAX_CONTROLLERS]; } #endif -#endif // PRIVATE_WPAD_MEMORY_H +#endif // PRIVATE_WPAD_MEMORY_H diff --git a/libs/RVL_SDK/include/private/wud.h b/libs/RVL_SDK/include/private/wud.h index e618c1b6..3fcff994 100644 --- a/libs/RVL_SDK/include/private/wud.h +++ b/libs/RVL_SDK/include/private/wud.h @@ -3,80 +3,80 @@ #include -#include #include +#include #ifdef __cplusplus extern "C" { #endif -BOOL WUDInit(); -BOOL WUDIsBusy(); -void WUDRegisterAllocator(WUDAllocFunc pAllocFunc, WUDFreeFunc pFreeFunc); -u32 WUDGetAllocatedMemSize(); -void WUDShutdown(BOOL saveSmp); +BOOL WUDInit(); +BOOL WUDIsBusy(); +void WUDRegisterAllocator(WUDAllocFunc pAllocFunc, WUDFreeFunc pFreeFunc); +u32 WUDGetAllocatedMemSize(); +void WUDShutdown(BOOL saveSmp); -WUDLibStatus WUDGetStatus(); -u8 WUDGetBufferStatus(); +WUDLibStatus WUDGetStatus(); +u8 WUDGetBufferStatus(); -void WUDSetSniffMode(BD_ADDR addr, s32 interval); +void WUDSetSniffMode(BD_ADDR addr, s32 interval); -WUDSyncDeviceCallback WUDSetSyncSimpleCallback(WUDSyncDeviceCallback pCallback); +WUDSyncDeviceCallback WUDSetSyncSimpleCallback(WUDSyncDeviceCallback pCallback); -WUDClearDeviceCallback WUDSetClearDeviceCallback(WUDClearDeviceCallback pCallback); +WUDClearDeviceCallback WUDSetClearDeviceCallback(WUDClearDeviceCallback pCallback); -BOOL WUDStartSyncDevice(); -BOOL WUDStartFastSyncSimple(); -BOOL WUDStartSyncSimple(); -BOOL WUDStopSyncSimple(); +BOOL WUDStartSyncDevice(); +BOOL WUDStartFastSyncSimple(); +BOOL WUDStartSyncSimple(); +BOOL WUDStopSyncSimple(); -BOOL WUDStartClearDevice(); -BOOL WUDSetDisableChannel(s8 afhChannel); +BOOL WUDStartClearDevice(); +BOOL WUDSetDisableChannel(s8 afhChannel); -WUDHidRecvCallback WUDSetHidRecvCallback(WUDHidRecvCallback pCallback); -WUDHidConnCallback WUDSetHidConnCallback(WUDHidConnCallback pCallback); +WUDHidRecvCallback WUDSetHidRecvCallback(WUDHidRecvCallback pCallback); +WUDHidConnCallback WUDSetHidConnCallback(WUDHidConnCallback pCallback); -void WUDSetVisibility(u8 disc, u8 conn); -u8 WUDGetConnectable(); +void WUDSetVisibility(u8 disc, u8 conn); +u8 WUDGetConnectable(); -void WUDiGetFirmwareVersion(); -void WUDiInitSub(); +void WUDiGetFirmwareVersion(); +void WUDiInitSub(); -void WUDiEnableStack(); -void WUDiAutoSync(); -void WUDiDeleteAllLinkKeys(); +void WUDiEnableStack(); +void WUDiAutoSync(); +void WUDiDeleteAllLinkKeys(); -void WUDiRegisterDevice(BD_ADDR addr); -void WUDiRemoveDevice(BD_ADDR addr); +void WUDiRegisterDevice(BD_ADDR addr); +void WUDiRemoveDevice(BD_ADDR addr); -WUDDevInfo* WUDiGetDevInfo(BD_ADDR addr); -WUDDevInfo* WUDiGetDevInfoIndex(int idx); -WUDDevInfo* WUDiGetNewDevInfo(); -void WUDiRemoveDevInfo(BD_ADDR addr); -void WUDiClearDevice(); +WUDDevInfo* WUDiGetDevInfo(BD_ADDR addr); +WUDDevInfo* WUDiGetDevInfoIndex(int idx); +WUDDevInfo* WUDiGetNewDevInfo(); +void WUDiRemoveDevInfo(BD_ADDR addr); +void WUDiClearDevice(); -u8 WUDiGetDevNumber(); -u8 WUDiGetDevSmpNumber(); -u8 WUDiGetConnNumber(); -u8 WUDiGetLinkNum(); +u8 WUDiGetDevNumber(); +u8 WUDiGetDevSmpNumber(); +u8 WUDiGetConnNumber(); +u8 WUDiGetLinkNum(); -void WUDiMoveTopSmpDevInfoPtr(WUDDevInfo* pInfo); -void WUDiMoveBottomSmpDevInfoPtr(WUDDevInfo* pInfo); -WUDDevInfo* WUDiGetRemoveSmpDevice(); -void WUDiMoveTopOfDisconnectedSmpDevice(WUDDevInfo* pInfo); +void WUDiMoveTopSmpDevInfoPtr(WUDDevInfo* pInfo); +void WUDiMoveBottomSmpDevInfoPtr(WUDDevInfo* pInfo); +WUDDevInfo* WUDiGetRemoveSmpDevice(); +void WUDiMoveTopOfDisconnectedSmpDevice(WUDDevInfo* pInfo); -void WUDiMoveTopStdDevInfoPtr(WUDDevInfo* pInfo); -void WUDiMoveBottomStdDevInfoPtr(WUDDevInfo* pInfo); -WUDDevInfo* WUDiGetRemoveStdDevice(); -void WUDiMoveTopOfDisconnectedStdDevice(WUDDevInfo* pInfo); +void WUDiMoveTopStdDevInfoPtr(WUDDevInfo* pInfo); +void WUDiMoveBottomStdDevInfoPtr(WUDDevInfo* pInfo); +WUDDevInfo* WUDiGetRemoveStdDevice(); +void WUDiMoveTopOfDisconnectedStdDevice(WUDDevInfo* pInfo); -BD_ADDR_PTR _WUDGetDevAddr(UINT8 handle); -u16 _WUDGetQueuedSize(s8 handle); -u16 _WUDGetNotAckedSize(s8 handle); -u8 _WUDGetLinkNumber(); +BD_ADDR_PTR _WUDGetDevAddr(UINT8 handle); +u16 _WUDGetQueuedSize(s8 handle); +u16 _WUDGetNotAckedSize(s8 handle); +u8 _WUDGetLinkNumber(); #ifdef __cplusplus } #endif -#endif // PRIVATE_WUD_H +#endif // PRIVATE_WUD_H diff --git a/libs/RVL_SDK/include/private/wud/WUDInternal.h b/libs/RVL_SDK/include/private/wud/WUDInternal.h index d2e1afa9..d32226a4 100644 --- a/libs/RVL_SDK/include/private/wud/WUDInternal.h +++ b/libs/RVL_SDK/include/private/wud/WUDInternal.h @@ -20,13 +20,13 @@ extern "C" { void WUD_DEBUGPrint(const char* format, ...); -#define WUD_BDCMP(LHS, RHS) memcmp(LHS, RHS, BD_ADDR_LEN) -#define WUD_BDCPY(DST, SRC) memcpy(DST, SRC, BD_ADDR_LEN) +#define WUD_BDCMP(LHS, RHS) memcmp(LHS, RHS, BD_ADDR_LEN) +#define WUD_BDCPY(DST, SRC) memcpy(DST, SRC, BD_ADDR_LEN) -#define WUD_DEV_NAME_IS(NAME, VALUE) (memcmp(NAME, VALUE, sizeof(VALUE) - 1) == 0) +#define WUD_DEV_NAME_IS(NAME, VALUE) (memcmp(NAME, VALUE, sizeof(VALUE) - 1) == 0) -#define WUD_DEV_NAME_IS_CNT(NAME) WUD_DEV_NAME_IS(NAME, "Nintendo RVL-CNT") -#define WUD_DEV_NAME_IS_CNT_01(NAME) WUD_DEV_NAME_IS(NAME, "Nintendo RVL-CNT-01") +#define WUD_DEV_NAME_IS_CNT(NAME) WUD_DEV_NAME_IS(NAME, "Nintendo RVL-CNT") +#define WUD_DEV_NAME_IS_CNT_01(NAME) WUD_DEV_NAME_IS(NAME, "Nintendo RVL-CNT-01") typedef enum { WUD_STATE_SYNC_START = 0, @@ -120,87 +120,87 @@ typedef enum { typedef struct WUDDevInfoList WUDDevInfoList; struct WUDDevInfoList { - WUDDevInfo* devInfo; // 0x00 - WUDDevInfoList* prev; // 0x04 - WUDDevInfoList* next; // 0x08 + WUDDevInfo* devInfo; // 0x00 + WUDDevInfoList* prev; // 0x04 + WUDDevInfoList* next; // 0x08 }; typedef struct WUDDiscResp { - BD_ADDR devAddr; // 0x00 - char devName[64]; // 0x06 - u8 UNK_0x46[0xBA]; - tBTA_SERVICE_MASK services; // 0x100 - u8 UNK_0x104[0x4]; + BD_ADDR devAddr; // 0x00 + char devName[64]; // 0x06 + u8 UNK_0x46[0xBA]; + tBTA_SERVICE_MASK services; // 0x100 + u8 UNK_0x104[0x4]; } WUDDiscResp; typedef struct WUDPatchCmd { - u8 data[13]; // 0x00 + u8 data[13]; // 0x00 } WUDPatchCmd; typedef struct WUDPatchList { - u8 num; // 0x00 - WUDPatchCmd cmds[]; // 0x01 + u8 num; // 0x00 + WUDPatchCmd cmds[]; // 0x01 } WUDPatchList; #define WUD_PATCH_BUFFER_SIZE 0xFF #define WUD_MAX_PATCHES (WUD_PATCH_BUFFER_SIZE / (s32)sizeof(WUDPatchCmd)) typedef struct WUDCB { - WUDSyncDeviceCallback syncStdCB; // 0x00 - WUDSyncDeviceCallback syncSmpCB; // 0x04 - WUDClearDeviceCallback clearDevCB; // 0x08 + WUDSyncDeviceCallback syncStdCB; // 0x00 + WUDSyncDeviceCallback syncSmpCB; // 0x04 + WUDClearDeviceCallback clearDevCB; // 0x08 - u8 syncState; // 0x0C - u8 deleteState; // 0x0D - u8 linkKeyState; // 0x0E - u8 stackState; // 0x0F - u8 initState; // 0x10 - u8 shutdownState; // 0x11 + u8 syncState; // 0x0C + u8 deleteState; // 0x0D + u8 linkKeyState; // 0x0E + u8 stackState; // 0x0F + u8 initState; // 0x10 + u8 shutdownState; // 0x11 - u8 devNums; // 0x12 - u8 devSmpNums; // 0x13 + u8 devNums; // 0x12 + u8 devSmpNums; // 0x13 - WUDDevInfoList* smpListHead; // 0x14 - WUDDevInfoList* smpListTail; // 0x18 - WUDDevInfoList smpList[WUD_MAX_DEV_ENTRY_FOR_SMP]; // 0x1C + WUDDevInfoList* smpListHead; // 0x14 + WUDDevInfoList* smpListTail; // 0x18 + WUDDevInfoList smpList[WUD_MAX_DEV_ENTRY_FOR_SMP]; // 0x1C - WUDDevInfoList* stdListHead; // 0x64 - WUDDevInfoList* stdListTail; // 0x68 - WUDDevInfoList stdList[WUD_MAX_DEV_ENTRY_FOR_STD]; // 0x6C + WUDDevInfoList* stdListHead; // 0x64 + WUDDevInfoList* stdListTail; // 0x68 + WUDDevInfoList stdList[WUD_MAX_DEV_ENTRY_FOR_STD]; // 0x6C - WUDDevInfo stdDevs[WUD_MAX_DEV_ENTRY_FOR_STD]; // 0xE4 - WUDDevInfo smpDevs[WUD_MAX_DEV_ENTRY_FOR_SMP]; // 0x4A4 + WUDDevInfo stdDevs[WUD_MAX_DEV_ENTRY_FOR_STD]; // 0xE4 + WUDDevInfo smpDevs[WUD_MAX_DEV_ENTRY_FOR_SMP]; // 0x4A4 - u8 connectedNum; // 0x6E4 - u8 linkedNum; // 0x6E5 - u8 syncedNum; // 0x6E6 + u8 connectedNum; // 0x6E4 + u8 linkedNum; // 0x6E5 + u8 syncedNum; // 0x6E6 - u8 syncSkipChecks; // 0x6E7 - s8 syncLoopNum; // 0x6E8 - u8 syncType; // 0x6E9 + u8 syncSkipChecks; // 0x6E7 + s8 syncLoopNum; // 0x6E8 + u8 syncType; // 0x6E9 - u8 connectable; // 0x6EA - u8 discoverable; // 0x6EB + u8 connectable; // 0x6EA + u8 discoverable; // 0x6EB - WUDHidRecvCallback hidRecvCB; // 0x6EC - WUDHidConnCallback hidConnCB; // 0x6F0 + WUDHidRecvCallback hidRecvCB; // 0x6EC + WUDHidConnCallback hidConnCB; // 0x6F0 - WUDAllocFunc allocFunc; // 0x6F4 - WUDFreeFunc freeFunc; // 0x6F8 + WUDAllocFunc allocFunc; // 0x6F4 + WUDFreeFunc freeFunc; // 0x6F8 - BD_ADDR pairAddr; // 0x6FC - BD_ADDR hostAddr; // 0x702 + BD_ADDR pairAddr; // 0x6FC + BD_ADDR hostAddr; // 0x702 - s8 libStatus; // 0x708 + s8 libStatus; // 0x708 - u8 serialPortStatus; // 0x709 - UINT8 pmID; // 0x70A - s8 syncRssi; // 0x70B - OSAlarm alarm; // 0x710 - u32 hhFlags; // 0x740 + u8 serialPortStatus; // 0x709 + UINT8 pmID; // 0x70A + s8 syncRssi; // 0x70B + OSAlarm alarm; // 0x710 + u32 hhFlags; // 0x740 - u16 bufferStatus0; // 0x744 - u16 bufferStatus1; // 0x746 - s16 waitStartSearchFrames; // 0x748 - s16 waitIncomingFrames; // 0x74A + u16 bufferStatus0; // 0x744 + u16 bufferStatus1; // 0x746 + s16 waitStartSearchFrames; // 0x748 + s16 waitIncomingFrames; // 0x74A } WUDCB; extern WUDCB _wcb; @@ -216,4 +216,4 @@ extern u16 _dev_handle_notack_num[WUD_MAX_DEV_ENTRY]; } #endif -#endif // PRIVATE_WUD_INTERNAL_H +#endif // PRIVATE_WUD_INTERNAL_H diff --git a/libs/RVL_SDK/include/private/wud/WUDTypes.h b/libs/RVL_SDK/include/private/wud/WUDTypes.h index 53a8be54..b5b65f0e 100644 --- a/libs/RVL_SDK/include/private/wud/WUDTypes.h +++ b/libs/RVL_SDK/include/private/wud/WUDTypes.h @@ -60,23 +60,23 @@ typedef void (*WUDHidConnCallback)(WUDDevInfo* devHandle, u8 open); typedef void (*WUDHidRecvCallback)(UINT8 devHandle, UINT8* pReport, UINT16 len); struct WUDDevInfo { - SC_BT_DEV_INFO conf; // 0x00 + SC_BT_DEV_INFO conf; // 0x00 - BD_ADDR devAddr; // 0x40 - LINK_KEY linkKey; // 0x46 - UINT8 devHandle; // 0x56 - UINT8 subclass; // 0x57 - UINT8 appID; // 0x58 - u8 status; // 0x59 + BD_ADDR devAddr; // 0x40 + LINK_KEY linkKey; // 0x46 + UINT8 devHandle; // 0x56 + UINT8 subclass; // 0x57 + UINT8 appID; // 0x58 + u8 status; // 0x59 - s8 UNK_0x5A; // 0x5A - u8 UNK_0x5B; // 0x5B - u8 UNK_0x5C; // 0x5C - tBTA_HH_ATTR_MASK hhAttrMask; // 0x5E + s8 UNK_0x5A; // 0x5A + u8 UNK_0x5B; // 0x5B + u8 UNK_0x5C; // 0x5C + tBTA_HH_ATTR_MASK hhAttrMask; // 0x5E }; #ifdef __cplusplus } #endif -#endif // PRIVATE_WUD_TYPES_H +#endif // PRIVATE_WUD_TYPES_H diff --git a/libs/RVL_SDK/include/revolution.h b/libs/RVL_SDK/include/revolution.h index fb947312..96726e28 100644 --- a/libs/RVL_SDK/include/revolution.h +++ b/libs/RVL_SDK/include/revolution.h @@ -4,10 +4,10 @@ #include #include -#include #include -#include #include +#include +#include #include -#endif // REVOLUTION_H +#endif // REVOLUTION_H diff --git a/libs/RVL_SDK/include/revolution/ai.h b/libs/RVL_SDK/include/revolution/ai.h index 8c1aac75..0281d11b 100644 --- a/libs/RVL_SDK/include/revolution/ai.h +++ b/libs/RVL_SDK/include/revolution/ai.h @@ -16,20 +16,20 @@ enum { AIDCallback AIRegisterDMACallback(AIDCallback callback); -void AIInitDMA(u32 startAddr, u32 length); -u32 AIGetDMALength(); -u32 AIGetDMAStartAddr(); +void AIInitDMA(u32 startAddr, u32 length); +u32 AIGetDMALength(); +u32 AIGetDMAStartAddr(); -void AIStartDMA(); -void AIStopDMA(); +void AIStartDMA(); +void AIStopDMA(); -void AISetDSPSampleRate(u32 rate); -u32 AIGetDSPSampleRate(); +void AISetDSPSampleRate(u32 rate); +u32 AIGetDSPSampleRate(); -u32 AIGetDMABytesLeft(); +u32 AIGetDMABytesLeft(); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AI_H +#endif // REVOLUTION_AI_H diff --git a/libs/RVL_SDK/include/revolution/arc.h b/libs/RVL_SDK/include/revolution/arc.h index b25e679f..2bd1cf59 100644 --- a/libs/RVL_SDK/include/revolution/arc.h +++ b/libs/RVL_SDK/include/revolution/arc.h @@ -8,70 +8,70 @@ extern "C" { #endif typedef struct ARCHeader { - u32 magic; // 0x00 + u32 magic; // 0x00 - int fstStart; // 0x04 - int fstSize; // 0x08 + int fstStart; // 0x04 + int fstSize; // 0x08 int fileStart; // 0x0C - int pad[4]; // 0x10 + int pad[4]; // 0x10 } ARCHeader; typedef struct ARCHandle { - void* archiveStartAddr; // 0x00 - void* FSTStart; // 0x04 - void* fileStart; // 0x08 - u32 entryNum; // 0x0C + void* archiveStartAddr; // 0x00 + void* FSTStart; // 0x04 + void* fileStart; // 0x08 + u32 entryNum; // 0x0C - char* FSTStringStart; // 0x10 - u32 FSTLength; // 0x14 + char* FSTStringStart; // 0x10 + u32 FSTLength; // 0x14 - u32 currDir; // 0x18 + u32 currDir; // 0x18 } ARCHandle; typedef struct ARCFileInfo { - ARCHandle* handle; // 0x00 - u32 startOffset; // 0x04 - u32 length; // 0x08 + ARCHandle* handle; // 0x00 + u32 startOffset; // 0x04 + u32 length; // 0x08 } ARCFileInfo; typedef struct ARCDir { - ARCHandle* handle; // 0x00 - u32 entryNum; // 0x04 - u32 location; // 0x08 - u32 next; // 0x0C + ARCHandle* handle; // 0x00 + u32 entryNum; // 0x04 + u32 location; // 0x08 + u32 next; // 0x0C } ARCDir; -typedef struct { - ARCHandle* handle; // 0x00 - u32 entryNum; // 0x04 - BOOL isDir; // 0x08 - char* name; // 0x0C +typedef struct { + ARCHandle* handle; // 0x00 + u32 entryNum; // 0x04 + BOOL isDir; // 0x08 + char* name; // 0x0C } ARCDirEntry; -#define ARC_MAGIC 0x55AA382D +#define ARC_MAGIC 0x55AA382D -BOOL ARCInitHandle(void* buffer, ARCHandle* pHandle); +BOOL ARCInitHandle(void* buffer, ARCHandle* pHandle); -BOOL ARCOpen(ARCHandle* handle, const char* path, ARCFileInfo* info); -BOOL ARCFastOpen(ARCHandle* handle, s32 entryNum, ARCFileInfo* info); +BOOL ARCOpen(ARCHandle* handle, const char* path, ARCFileInfo* info); +BOOL ARCFastOpen(ARCHandle* handle, s32 entryNum, ARCFileInfo* info); -s32 ARCConvertPathToEntrynum(ARCHandle* handle, const char* path); +s32 ARCConvertPathToEntrynum(ARCHandle* handle, const char* path); -void* ARCGetStartAddrInMem(ARCFileInfo* info); -u32 ARCGetStartOffset(ARCFileInfo* info); +void* ARCGetStartAddrInMem(ARCFileInfo* info); +u32 ARCGetStartOffset(ARCFileInfo* info); -u32 ARCGetLength(ARCFileInfo* info); -BOOL ARCClose(ARCFileInfo* info); +u32 ARCGetLength(ARCFileInfo* info); +BOOL ARCClose(ARCFileInfo* info); -BOOL ARCChangeDir(ARCHandle* info, const char* path); -BOOL ARCOpenDir(ARCHandle* info, const char* path, ARCDir* dir); -BOOL ARCReadDir(ARCDir* dir, ARCDirEntry* entry); -BOOL ARCCloseDir(ARCDir* dir); +BOOL ARCChangeDir(ARCHandle* info, const char* path); +BOOL ARCOpenDir(ARCHandle* info, const char* path, ARCDir* dir); +BOOL ARCReadDir(ARCDir* dir, ARCDirEntry* entry); +BOOL ARCCloseDir(ARCDir* dir); #ifdef __cplusplus } #endif -#endif // REVOLUTION_ARC_H +#endif // REVOLUTION_ARC_H diff --git a/libs/RVL_SDK/include/revolution/ax.h b/libs/RVL_SDK/include/revolution/ax.h index 7ef2af36..f9773703 100644 --- a/libs/RVL_SDK/include/revolution/ax.h +++ b/libs/RVL_SDK/include/revolution/ax.h @@ -11,7 +11,7 @@ #include #include -void AXInit(); -void AXInitEx(u32 outputBufferMode); +void AXInit(); +void AXInitEx(u32 outputBufferMode); -#endif // REVOLUTION_AX_H +#endif // REVOLUTION_AX_H diff --git a/libs/RVL_SDK/include/revolution/ax/AXAlloc.h b/libs/RVL_SDK/include/revolution/ax/AXAlloc.h index 2d975078..3a814ee6 100644 --- a/libs/RVL_SDK/include/revolution/ax/AXAlloc.h +++ b/libs/RVL_SDK/include/revolution/ax/AXAlloc.h @@ -11,12 +11,12 @@ extern "C" { #define AX_PRIORITY_MIN 1 #define AX_PRIORITY_MAX 31 -void AXFreeVoice(AXVPB* p); -AXVPB* AXAcquireVoice(u32 priority, AXVoiceCallback callback, u32 userContext); -void AXSetVoicePriority(AXVPB* p, u32 priority); +void AXFreeVoice(AXVPB* p); +AXVPB* AXAcquireVoice(u32 priority, AXVoiceCallback callback, u32 userContext); +void AXSetVoicePriority(AXVPB* p, u32 priority); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AX_ALLOC_H +#endif // REVOLUTION_AX_ALLOC_H diff --git a/libs/RVL_SDK/include/revolution/ax/AXAux.h b/libs/RVL_SDK/include/revolution/ax/AXAux.h index 0f3319fc..a4ceee66 100644 --- a/libs/RVL_SDK/include/revolution/ax/AXAux.h +++ b/libs/RVL_SDK/include/revolution/ax/AXAux.h @@ -35,16 +35,16 @@ typedef enum { typedef void (*AXAuxCallback)(void*, void*); -void AXRegisterAuxACallback(AXAuxCallback callback, void* context); -void AXRegisterAuxBCallback(AXAuxCallback callback, void* context); -void AXRegisterAuxCCallback(AXAuxCallback callback, void* context); +void AXRegisterAuxACallback(AXAuxCallback callback, void* context); +void AXRegisterAuxBCallback(AXAuxCallback callback, void* context); +void AXRegisterAuxCCallback(AXAuxCallback callback, void* context); -void AXGetAuxACallback(AXAuxCallback* callback, void** context); -void AXGetAuxBCallback(AXAuxCallback* callback, void** context); -void AXGetAuxCCallback(AXAuxCallback* callback, void** context); +void AXGetAuxACallback(AXAuxCallback* callback, void** context); +void AXGetAuxBCallback(AXAuxCallback* callback, void** context); +void AXGetAuxCCallback(AXAuxCallback* callback, void** context); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AX_AUX_H +#endif // REVOLUTION_AX_AUX_H diff --git a/libs/RVL_SDK/include/revolution/ax/AXCL.h b/libs/RVL_SDK/include/revolution/ax/AXCL.h index 424ac42e..817b2bc3 100644 --- a/libs/RVL_SDK/include/revolution/ax/AXCL.h +++ b/libs/RVL_SDK/include/revolution/ax/AXCL.h @@ -15,22 +15,21 @@ typedef enum { AX_OUTPUT_DPL2 } AXOutputMode; -void AXSetMode(u32 mode); -u32 AXGetMode(); +void AXSetMode(u32 mode); +u32 AXGetMode(); -u16 AXGetAuxAReturnVolume(); -u16 AXGetAuxBReturnVolume(); -u16 AXGetAuxCReturnVolume(); +u16 AXGetAuxAReturnVolume(); +u16 AXGetAuxBReturnVolume(); +u16 AXGetAuxCReturnVolume(); -void AXSetMasterVolume(u16 volume); - -void AXSetAuxAReturnVolume(u16 volume); -void AXSetAuxBReturnVolume(u16 volume); -void AXSetAuxCReturnVolume(u16 volume); +void AXSetMasterVolume(u16 volume); +void AXSetAuxAReturnVolume(u16 volume); +void AXSetAuxBReturnVolume(u16 volume); +void AXSetAuxCReturnVolume(u16 volume); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AX_CL_H +#endif // REVOLUTION_AX_CL_H diff --git a/libs/RVL_SDK/include/revolution/ax/AXOut.h b/libs/RVL_SDK/include/revolution/ax/AXOut.h index 02b9c101..ae507e82 100644 --- a/libs/RVL_SDK/include/revolution/ax/AXOut.h +++ b/libs/RVL_SDK/include/revolution/ax/AXOut.h @@ -13,14 +13,14 @@ extern "C" { typedef void (*AXOutCallback)(void); typedef void (*AXExceedCallback)(u32 cycles); -AXOutCallback AXRegisterCallback(AXOutCallback callback); +AXOutCallback AXRegisterCallback(AXOutCallback callback); -s32 AXRmtGetSamplesLeft(); -s32 AXRmtGetSamples(s32 chan, s16* out, s32 num); -s32 AXRmtAdvancePtr(s32 num); +s32 AXRmtGetSamplesLeft(); +s32 AXRmtGetSamples(s32 chan, s16* out, s32 num); +s32 AXRmtAdvancePtr(s32 num); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AX_OUT_H +#endif // REVOLUTION_AX_OUT_H diff --git a/libs/RVL_SDK/include/revolution/ax/AXPB.h b/libs/RVL_SDK/include/revolution/ax/AXPB.h index 47db8bd4..3450658a 100644 --- a/libs/RVL_SDK/include/revolution/ax/AXPB.h +++ b/libs/RVL_SDK/include/revolution/ax/AXPB.h @@ -19,8 +19,7 @@ extern "C" { #define AX_ADPCM_SAMPLES_PER_BYTE 2 // Amount of audio samples in a frame -#define AX_ADPCM_SAMPLES_PER_FRAME \ - (AX_ADPCM_SAMPLE_BYTES_PER_FRAME * AX_ADPCM_SAMPLES_PER_BYTE) +#define AX_ADPCM_SAMPLES_PER_FRAME (AX_ADPCM_SAMPLE_BYTES_PER_FRAME * AX_ADPCM_SAMPLES_PER_BYTE) // Amount of nibbles in a frame #define AX_ADPCM_NIBBLES_PER_FRAME (AX_ADPCM_FRAME_SIZE * 2) @@ -104,58 +103,58 @@ enum { }; typedef struct _AXPBMIX { - u16 vL; // 0x00 - u16 vDeltaL; // 0x02 - u16 vR; // 0x04 - u16 vDeltaR; // 0x06 - u16 vAuxAL; // 0x08 - u16 vDeltaAuxAL; // 0x0A - u16 vAuxAR; // 0x0C - u16 vDeltaAuxAR; // 0x0E - u16 vAuxBL; // 0x10 - u16 vDeltaAuxBL; // 0x12 - u16 vAuxBR; // 0x14 - u16 vDeltaAuxBR; // 0x16 - u16 vAuxCL; // 0x18 - u16 vDeltaAuxCL; // 0x1A - u16 vAuxCR; // 0x1C - u16 vDeltaAuxCR; // 0x1E - u16 vS; // 0x20 - u16 vDeltaS; // 0x22 - u16 vAuxAS; // 0x24 - u16 vDeltaAuxAS; // 0x26 - u16 vAuxBS; // 0x28 - u16 vDeltaAuxBS; // 0x2A - u16 vAuxCS; // 0x2C - u16 vDeltaAuxCS; // 0x2E + u16 vL; // 0x00 + u16 vDeltaL; // 0x02 + u16 vR; // 0x04 + u16 vDeltaR; // 0x06 + u16 vAuxAL; // 0x08 + u16 vDeltaAuxAL; // 0x0A + u16 vAuxAR; // 0x0C + u16 vDeltaAuxAR; // 0x0E + u16 vAuxBL; // 0x10 + u16 vDeltaAuxBL; // 0x12 + u16 vAuxBR; // 0x14 + u16 vDeltaAuxBR; // 0x16 + u16 vAuxCL; // 0x18 + u16 vDeltaAuxCL; // 0x1A + u16 vAuxCR; // 0x1C + u16 vDeltaAuxCR; // 0x1E + u16 vS; // 0x20 + u16 vDeltaS; // 0x22 + u16 vAuxAS; // 0x24 + u16 vDeltaAuxAS; // 0x26 + u16 vAuxBS; // 0x28 + u16 vDeltaAuxBS; // 0x2A + u16 vAuxCS; // 0x2C + u16 vDeltaAuxCS; // 0x2E } AXPBMIX; typedef struct _AXPBITD { - u16 flag; // 0x00 + u16 flag; // 0x00 - u16 bufferHi; // 0x02 - u16 bufferLo; // 0x04 + u16 bufferHi; // 0x02 + u16 bufferLo; // 0x04 - u16 shiftL; // 0x06 - u16 shiftR; // 0x08 + u16 shiftL; // 0x06 + u16 shiftR; // 0x08 - u16 targetShiftL; // 0x0A - u16 targetShiftR; // 0x0C + u16 targetShiftL; // 0x0A + u16 targetShiftR; // 0x0C } AXPBITD; typedef struct _AXPBDPOP { - s16 aL; // 0x00 - s16 aAuxAL; // 0x02 - s16 aAuxBL; // 0x04 - s16 aAuxCL; // 0x06 - s16 aR; // 0x08 - s16 aAuxAR; // 0x0A - s16 aAuxBR; // 0x0C - s16 aAuxCR; // 0x0E - s16 aS; // 0x10 - s16 aAuxAS; // 0x12 - s16 aAuxBS; // 0x14 - s16 aAuxCS; // 0x16 + s16 aL; // 0x00 + s16 aAuxAL; // 0x02 + s16 aAuxBL; // 0x04 + s16 aAuxCL; // 0x06 + s16 aR; // 0x08 + s16 aAuxAR; // 0x0A + s16 aAuxBR; // 0x0C + s16 aAuxCR; // 0x0E + s16 aS; // 0x10 + s16 aAuxAS; // 0x12 + s16 aAuxBS; // 0x14 + s16 aAuxCS; // 0x16 } AXPBDPOP; typedef struct _AXPBVE { @@ -164,95 +163,95 @@ typedef struct _AXPBVE { } AXPBVE; typedef struct _AXPBADDR { - u16 loopFlag; // 0x00 - u16 format; // 0x02 + u16 loopFlag; // 0x00 + u16 format; // 0x02 - u16 loopAddressHi; // 0x04 - u16 loopAddressLo; // 0x06 + u16 loopAddressHi; // 0x04 + u16 loopAddressLo; // 0x06 - u16 endAddressHi; // 0x08 - u16 endAddressLo; // 0x0A + u16 endAddressHi; // 0x08 + u16 endAddressLo; // 0x0A - u16 currentAddressHi; // 0x0C - u16 currentAddressLo; // 0x0E + u16 currentAddressHi; // 0x0C + u16 currentAddressLo; // 0x0E } AXPBADDR; typedef struct _AXPBADPCM { - u16 a[8][2]; // 0x00 - u16 gain; // 0x20 - u16 pred_scale; // 0x22 - u16 yn1; // 0x24 - u16 yn2; // 0x26 + u16 a[8][2]; // 0x00 + u16 gain; // 0x20 + u16 pred_scale; // 0x22 + u16 yn1; // 0x24 + u16 yn2; // 0x26 } AXPBADPCM; typedef struct _AXPBSRC { - u16 ratioHi; // 0x00 - u16 ratioLo; // 0x02 - u16 currentAddressFrac; // 0x04 - u16 last_samples[4]; // 0x06 + u16 ratioHi; // 0x00 + u16 ratioLo; // 0x02 + u16 currentAddressFrac; // 0x04 + u16 last_samples[4]; // 0x06 } AXPBSRC; typedef struct _AXPBADPCMLOOP { - u16 loop_pred_scale; // 0x00 - u16 loop_yn1; // 0x02 - u16 loop_yn2; // 0x04 + u16 loop_pred_scale; // 0x00 + u16 loop_yn1; // 0x02 + u16 loop_yn2; // 0x04 } AXPBADPCMLOOP; typedef struct _AXPBLPF { - u16 on; // 0x00 - u16 yn1; // 0x02 - u16 a0; // 0x04 - u16 b0; // 0x06 + u16 on; // 0x00 + u16 yn1; // 0x02 + u16 a0; // 0x04 + u16 b0; // 0x06 } AXPBLPF; typedef struct _AXPBBIQUAD { - u16 on; // 0x00 + u16 on; // 0x00 - u16 xn1; // 0x02 - u16 xn2; // 0x04 + u16 xn1; // 0x02 + u16 xn2; // 0x04 - u16 yn1; // 0x06 - u16 yn2; // 0x08 + u16 yn1; // 0x06 + u16 yn2; // 0x08 - u16 b0; // 0x0A - u16 b1; // 0x0C - u16 b2; // 0x0E + u16 b0; // 0x0A + u16 b1; // 0x0C + u16 b2; // 0x0E - u16 a1; // 0x10 - u16 a2; // 0x12 + u16 a1; // 0x10 + u16 a2; // 0x12 } AXPBBIQUAD; typedef struct _AXPBRMTMIX { - u16 vMain0; // 0x00 - u16 vDeltaMain0; // 0x02 - u16 vAux0; // 0x04 - u16 vDeltaAux0; // 0x06 + u16 vMain0; // 0x00 + u16 vDeltaMain0; // 0x02 + u16 vAux0; // 0x04 + u16 vDeltaAux0; // 0x06 - u16 vMain1; // 0x08 - u16 vDeltaMain1; // 0x0A - u16 vAux1; // 0x0C - u16 vDeltaAux1; // 0x0E + u16 vMain1; // 0x08 + u16 vDeltaMain1; // 0x0A + u16 vAux1; // 0x0C + u16 vDeltaAux1; // 0x0E - u16 vMain2; // 0x10 - u16 vDeltaMain2; // 0x12 - u16 vAux2; // 0x14 - u16 vDeltaAux2; // 0x16 + u16 vMain2; // 0x10 + u16 vDeltaMain2; // 0x12 + u16 vAux2; // 0x14 + u16 vDeltaAux2; // 0x16 - u16 vMain3; // 0x18 - u16 vDeltaMain3; // 0x1A - u16 vAux3; // 0x1C - u16 vDeltaAux3; // 0x1E + u16 vMain3; // 0x18 + u16 vDeltaMain3; // 0x1A + u16 vAux3; // 0x1C + u16 vDeltaAux3; // 0x1E } AXPBRMTMIX; typedef struct _AXPBITDBUFFER { - s16 buffer[32]; // 0x00 + s16 buffer[32]; // 0x00 } AXPBITDBUFFER; typedef struct _AXPBRMTDPOP { - s16 aMain0; // 0x00 - s16 aMain1; // 0x02 - s16 aMain2; // 0x04 - s16 aMain3; // 0x06 + s16 aMain0; // 0x00 + s16 aMain1; // 0x02 + s16 aMain2; // 0x04 + s16 aMain3; // 0x06 s16 aAux0; // 0x08 s16 aAux1; // 0x0A @@ -261,53 +260,53 @@ typedef struct _AXPBRMTDPOP { } AXPBRMTDPOP; typedef struct _AXPBRMTSRC { - u16 currentAddressFrac; // 0x00 - u16 last_samples[4]; // 0x02 + u16 currentAddressFrac; // 0x00 + u16 last_samples[4]; // 0x02 } AXPBRMTSRC; typedef union __AXPBRMTIIR { - AXPBLPF lpf; - AXPBBIQUAD biquad; + AXPBLPF lpf; + AXPBBIQUAD biquad; } AXPBRMTIIR; typedef struct _AXPB { - u16 nextHi; // 0x00 - u16 nextLo; // 0x02 - u16 currHi; // 0x04 - u16 currLo; // 0x06 + u16 nextHi; // 0x00 + u16 nextLo; // 0x02 + u16 currHi; // 0x04 + u16 currLo; // 0x06 - u16 srcSelect; // 0x08 - u16 coefSelect; // 0x0A + u16 srcSelect; // 0x08 + u16 coefSelect; // 0x0A - u32 mixerCtrl; // 0x0C + u32 mixerCtrl; // 0x0C - u16 state; // 0x10 - u16 type; // 0x12 - AXPBMIX mix; // 0x14 - AXPBITD itd; // 0x44 - AXPBDPOP dpop; // 0x52 - AXPBVE ve; // 0x6A - - AXPBADDR addr; // 0x6E - AXPBADPCM adpcm; // 0x7E - AXPBSRC src; // 0xA6 - AXPBADPCMLOOP adpcmLoop; // 0xB4 + u16 state; // 0x10 + u16 type; // 0x12 + AXPBMIX mix; // 0x14 + AXPBITD itd; // 0x44 + AXPBDPOP dpop; // 0x52 + AXPBVE ve; // 0x6A - AXPBLPF lpf; // 0xBA - AXPBBIQUAD biquad; // 0xC2 + AXPBADDR addr; // 0x6E + AXPBADPCM adpcm; // 0x7E + AXPBSRC src; // 0xA6 + AXPBADPCMLOOP adpcmLoop; // 0xB4 - u16 remote; // 0xD6 - u16 rmtMixerCtrl; // 0xD8 - AXPBRMTMIX rmtMix; // 0xDA - AXPBRMTDPOP rmtDpop; // 0xFA - AXPBRMTSRC rmtSrc; // 0x10A - AXPBRMTIIR rmtIIR; // 0x114 + AXPBLPF lpf; // 0xBA + AXPBBIQUAD biquad; // 0xC2 - u16 pad[12]; // 0x128 + u16 remote; // 0xD6 + u16 rmtMixerCtrl; // 0xD8 + AXPBRMTMIX rmtMix; // 0xDA + AXPBRMTDPOP rmtDpop; // 0xFA + AXPBRMTSRC rmtSrc; // 0x10A + AXPBRMTIIR rmtIIR; // 0x114 + + u16 pad[12]; // 0x128 } AXPB; #ifdef __cplusplus } #endif -#endif // REVOLUTION_AX_PB_H +#endif // REVOLUTION_AX_PB_H diff --git a/libs/RVL_SDK/include/revolution/ax/AXVPB.h b/libs/RVL_SDK/include/revolution/ax/AXVPB.h index a7f28e07..d57d5423 100644 --- a/libs/RVL_SDK/include/revolution/ax/AXVPB.h +++ b/libs/RVL_SDK/include/revolution/ax/AXVPB.h @@ -48,37 +48,37 @@ enum { typedef void (*AXVoiceCallback)(void*); typedef struct _AXVPB { - void* next; // 0x00 - void* prev; // 0x04 - void* next1; // 0x08 - u32 priority; // 0x0C - AXVoiceCallback callback; // 0x10 - u32 userContext; // 0x14 - u32 index; // 0x18 - u32 sync; // 0x1C - u32 depop; // 0x20 - void* itdBuffer; // 0x24 - AXPB pb; // 0x28 + void* next; // 0x00 + void* prev; // 0x04 + void* next1; // 0x08 + u32 priority; // 0x0C + AXVoiceCallback callback; // 0x10 + u32 userContext; // 0x14 + u32 index; // 0x18 + u32 sync; // 0x1C + u32 depop; // 0x20 + void* itdBuffer; // 0x24 + AXPB pb; // 0x28 } AXVPB; -void AXSetVoiceSrcType(AXVPB* vpb, u32 type); -void AXSetVoiceState(AXVPB* vpb, u16 state); -void AXSetVoiceType(AXVPB* vpb, u16 type); -void AXSetVoiceMix(AXVPB* vpb, AXPBMIX* mix); -void AXSetVoiceVe(AXVPB* vpb, AXPBVE* ve); -void AXSetVoiceAddr(AXVPB* vpb, AXPBADDR* addr); -void AXSetVoiceAdpcm(AXVPB* vpb, AXPBADPCM* adpcm); -void AXSetVoiceSrc(AXVPB* vpb, AXPBSRC* src_); -void AXSetVoiceSrcRatio(AXVPB* vpb, float ratio); -void AXSetVoiceAdpcmLoop(AXVPB* vpb, AXPBADPCMLOOP* adpcmloop); -void AXSetVoiceLpf(AXVPB* vpb, AXPBLPF* lpf); -void AXSetVoiceLpfCoefs(AXVPB* vpb, u16 a0, u16 b0); -void AXGetLpfCoefs(u16 freq, u16* a, u16* b); -void AXSetVoiceRmtOn(AXVPB *vpb, u16 on); -void AXSetVoiceRmtMix(AXVPB* vpb, AXPBRMTMIX* mix); +void AXSetVoiceSrcType(AXVPB* vpb, u32 type); +void AXSetVoiceState(AXVPB* vpb, u16 state); +void AXSetVoiceType(AXVPB* vpb, u16 type); +void AXSetVoiceMix(AXVPB* vpb, AXPBMIX* mix); +void AXSetVoiceVe(AXVPB* vpb, AXPBVE* ve); +void AXSetVoiceAddr(AXVPB* vpb, AXPBADDR* addr); +void AXSetVoiceAdpcm(AXVPB* vpb, AXPBADPCM* adpcm); +void AXSetVoiceSrc(AXVPB* vpb, AXPBSRC* src_); +void AXSetVoiceSrcRatio(AXVPB* vpb, float ratio); +void AXSetVoiceAdpcmLoop(AXVPB* vpb, AXPBADPCMLOOP* adpcmloop); +void AXSetVoiceLpf(AXVPB* vpb, AXPBLPF* lpf); +void AXSetVoiceLpfCoefs(AXVPB* vpb, u16 a0, u16 b0); +void AXGetLpfCoefs(u16 freq, u16* a, u16* b); +void AXSetVoiceRmtOn(AXVPB* vpb, u16 on); +void AXSetVoiceRmtMix(AXVPB* vpb, AXPBRMTMIX* mix); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AX_VPB_H +#endif // REVOLUTION_AX_VPB_H diff --git a/libs/RVL_SDK/include/revolution/axfx.h b/libs/RVL_SDK/include/revolution/axfx.h index 5e10c060..f0f39898 100644 --- a/libs/RVL_SDK/include/revolution/axfx.h +++ b/libs/RVL_SDK/include/revolution/axfx.h @@ -17,4 +17,4 @@ #include #include -#endif // REVOLUTION_AXFX_H +#endif // REVOLUTION_AXFX_H diff --git a/libs/RVL_SDK/include/revolution/axfx/AXFXChorus.h b/libs/RVL_SDK/include/revolution/axfx/AXFXChorus.h index 6cb2e075..2dc6114f 100644 --- a/libs/RVL_SDK/include/revolution/axfx/AXFXChorus.h +++ b/libs/RVL_SDK/include/revolution/axfx/AXFXChorus.h @@ -8,20 +8,20 @@ extern "C" { #endif typedef struct AXFX_CHORUS { - AXFX_CHORUS_EXP chorusInner; // 0x00 - u32 baseDelay; // 0xA0 - u32 variation; // 0xA4 - u32 period; // 0xA8 + AXFX_CHORUS_EXP chorusInner; // 0x00 + u32 baseDelay; // 0xA0 + u32 variation; // 0xA4 + u32 period; // 0xA8 } AXFX_CHORUS; -u32 AXFXChorusGetMemSize(const AXFX_CHORUS* fx); -BOOL AXFXChorusInit(AXFX_CHORUS* fx); -BOOL AXFXChorusShutdown(AXFX_CHORUS* fx); -BOOL AXFXChorusSettings(AXFX_CHORUS* fx); -void AXFXChorusCallback(void* chans, void* context); +u32 AXFXChorusGetMemSize(const AXFX_CHORUS* fx); +BOOL AXFXChorusInit(AXFX_CHORUS* fx); +BOOL AXFXChorusShutdown(AXFX_CHORUS* fx); +BOOL AXFXChorusSettings(AXFX_CHORUS* fx); +void AXFXChorusCallback(void* chans, void* context); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AXFX_CHORUS_H +#endif // REVOLUTION_AXFX_CHORUS_H diff --git a/libs/RVL_SDK/include/revolution/axfx/AXFXChorusExp.h b/libs/RVL_SDK/include/revolution/axfx/AXFXChorusExp.h index 5d4d6caa..42f00898 100644 --- a/libs/RVL_SDK/include/revolution/axfx/AXFXChorusExp.h +++ b/libs/RVL_SDK/include/revolution/axfx/AXFXChorusExp.h @@ -8,51 +8,51 @@ extern "C" { #endif typedef struct AXFX_CHORUS_EXP_DELAY { - f32* line[3]; // 0x0 - u32 inPos; // 0xC - u32 outPos; // 0x10 - u32 lastPos; // 0x14 - u32 sizeFP; // 0x18 - u32 size; // 0x1C + f32* line[3]; // 0x0 + u32 inPos; // 0xC + u32 outPos; // 0x10 + u32 lastPos; // 0x14 + u32 sizeFP; // 0x18 + u32 size; // 0x1C } AXFX_CHORUS_EXP_DELAY; typedef struct AXFX_CHORUS_EXP_LFO { - s32* table; // 0x0 - s32 phaseAdd; // 0x4 - s32 stepSamp; // 0x8 - s32 depthSamp; // 0xC - u32 phase; // 0x10 - u32 sign; // 0x14 - u32 lastNum; // 0x18 - s32 lastValue; // 0x1C - s32 grad; // 0x20 - s32 gradFactor; // 0x24 + s32* table; // 0x0 + s32 phaseAdd; // 0x4 + s32 stepSamp; // 0x8 + s32 depthSamp; // 0xC + u32 phase; // 0x10 + u32 sign; // 0x14 + u32 lastNum; // 0x18 + s32 lastValue; // 0x1C + s32 grad; // 0x20 + s32 gradFactor; // 0x24 } AXFX_CHORUS_EXP_LFO; typedef struct AXFX_CHORUS_EXP { - AXFX_CHORUS_EXP_DELAY delay; // 0x00 - AXFX_CHORUS_EXP_LFO lfo; // 0x20 - f32 history[3][4]; // 0x48 - u32 histIndex; // 0x78 - u32 active; // 0x7C - f32 delayTime; // 0x80 - f32 depth; // 0x84 - f32 rate; // 0x88 - f32 feedback; // 0x8C - AXFX_BUS* busIn; // 0x90 - AXFX_BUS* busOut; // 0x94 - f32 outGain; // 0x98 - f32 sendGain; // 0x9C + AXFX_CHORUS_EXP_DELAY delay; // 0x00 + AXFX_CHORUS_EXP_LFO lfo; // 0x20 + f32 history[3][4]; // 0x48 + u32 histIndex; // 0x78 + u32 active; // 0x7C + f32 delayTime; // 0x80 + f32 depth; // 0x84 + f32 rate; // 0x88 + f32 feedback; // 0x8C + AXFX_BUS* busIn; // 0x90 + AXFX_BUS* busOut; // 0x94 + f32 outGain; // 0x98 + f32 sendGain; // 0x9C } AXFX_CHORUS_EXP; -u32 AXFXChorusExpGetMemSize(const AXFX_CHORUS_EXP* fx); -BOOL AXFXChorusExpInit(AXFX_CHORUS_EXP* fx); -void AXFXChorusExpShutdown(AXFX_CHORUS_EXP* fx); -BOOL AXFXChorusExpSettings(AXFX_CHORUS_EXP* fx); -void AXFXChorusExpCallback(AXFX_BUFFERUPDATE* update, AXFX_CHORUS_EXP* fx); +u32 AXFXChorusExpGetMemSize(const AXFX_CHORUS_EXP* fx); +BOOL AXFXChorusExpInit(AXFX_CHORUS_EXP* fx); +void AXFXChorusExpShutdown(AXFX_CHORUS_EXP* fx); +BOOL AXFXChorusExpSettings(AXFX_CHORUS_EXP* fx); +void AXFXChorusExpCallback(AXFX_BUFFERUPDATE* update, AXFX_CHORUS_EXP* fx); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AXFX_CHORUS_EXP_H +#endif // REVOLUTION_AXFX_CHORUS_EXP_H diff --git a/libs/RVL_SDK/include/revolution/axfx/AXFXCommon.h b/libs/RVL_SDK/include/revolution/axfx/AXFXCommon.h index 6d101c06..51dcaa39 100644 --- a/libs/RVL_SDK/include/revolution/axfx/AXFXCommon.h +++ b/libs/RVL_SDK/include/revolution/axfx/AXFXCommon.h @@ -8,26 +8,26 @@ extern "C" { #endif typedef struct AXFX_BUS { - s32* left; // 0x00 - s32* right; // 0x04 - s32* surround; // 0x08 + s32* left; // 0x00 + s32* right; // 0x04 + s32* surround; // 0x08 } AXFX_BUS; typedef struct AXFX_BUFFERUPDATE { - s32* left; // 0x00 - s32* right; // 0x04 - s32* surround; // 0x08 + s32* left; // 0x00 + s32* right; // 0x04 + s32* surround; // 0x08 } AXFX_BUFFERUPDATE; typedef struct AXFX_BUFFERUPDATE_DPL2 { - s32* left; // 0x00 - s32* right; // 0x04 - s32* left_surround; // 0x08 - s32* right_surround; // 0x0C + s32* left; // 0x00 + s32* right; // 0x04 + s32* left_surround; // 0x08 + s32* right_surround; // 0x0C } AXFX_BUFFERUPDATE_DPL2; #ifdef __cplusplus } #endif -#endif // REVOLUTION_AXFX_COMMON_H +#endif // REVOLUTION_AXFX_COMMON_H diff --git a/libs/RVL_SDK/include/revolution/axfx/AXFXDelay.h b/libs/RVL_SDK/include/revolution/axfx/AXFXDelay.h index 0b223dcb..947ac4dd 100644 --- a/libs/RVL_SDK/include/revolution/axfx/AXFXDelay.h +++ b/libs/RVL_SDK/include/revolution/axfx/AXFXDelay.h @@ -8,25 +8,25 @@ extern "C" { #endif typedef struct AXFX_DELAY { - s32* line[3]; // 0x00 - u32 curPos[3]; // 0x0C - u32 length[3]; // 0x18 - s32 feedbackGain[3]; // 0x24 - s32 outGain[3]; // 0x30 - u32 active; // 0x3C - u32 delay[3]; // 0x40 - u32 feedback[3]; // 0x4C - u32 output[3]; // 0x58 + s32* line[3]; // 0x00 + u32 curPos[3]; // 0x0C + u32 length[3]; // 0x18 + s32 feedbackGain[3]; // 0x24 + s32 outGain[3]; // 0x30 + u32 active; // 0x3C + u32 delay[3]; // 0x40 + u32 feedback[3]; // 0x4C + u32 output[3]; // 0x58 } AXFX_DELAY; -u32 AXFXDelayGetMemSize(const AXFX_DELAY* fx); -BOOL AXFXDelayInit(AXFX_DELAY* fx); -BOOL AXFXDelaySettings(AXFX_DELAY* fx); -void AXFXDelayShutdown(AXFX_DELAY* fx); -void AXFXDelayCallback(void* chans, void* context); +u32 AXFXDelayGetMemSize(const AXFX_DELAY* fx); +BOOL AXFXDelayInit(AXFX_DELAY* fx); +BOOL AXFXDelaySettings(AXFX_DELAY* fx); +void AXFXDelayShutdown(AXFX_DELAY* fx); +void AXFXDelayCallback(void* chans, void* context); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AXFX_DELAY_H +#endif // REVOLUTION_AXFX_DELAY_H diff --git a/libs/RVL_SDK/include/revolution/axfx/AXFXHooks.h b/libs/RVL_SDK/include/revolution/axfx/AXFXHooks.h index cfe37c0d..618a8f39 100644 --- a/libs/RVL_SDK/include/revolution/axfx/AXFXHooks.h +++ b/libs/RVL_SDK/include/revolution/axfx/AXFXHooks.h @@ -7,14 +7,14 @@ extern "C" { #endif -typedef void* (*AXFXAllocHook)(u32); -typedef void (*AXFXFreeHook)(void*); +typedef void* (*AXFXAllocHook)(u32); +typedef void (*AXFXFreeHook)(void*); -void AXFXSetHooks(AXFXAllocHook alloc, AXFXFreeHook free); -void AXFXGetHooks(AXFXAllocHook* alloc, AXFXFreeHook* free); +void AXFXSetHooks(AXFXAllocHook alloc, AXFXFreeHook free); +void AXFXGetHooks(AXFXAllocHook* alloc, AXFXFreeHook* free); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AXFX_HOOKS_H +#endif // REVOLUTION_AXFX_HOOKS_H diff --git a/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHi.h b/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHi.h index fb97f1b6..db51b419 100644 --- a/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHi.h +++ b/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHi.h @@ -8,23 +8,23 @@ extern "C" { #endif typedef struct AXFX_REVERBHI { - AXFX_REVERBHI_EXP reverbInner; // 0x00 - f32 coloration; // 0x148 - f32 mix; // 0x14C - f32 time; // 0x150 - f32 damping; // 0x154 - f32 preDelay; // 0x158 - f32 crosstalk; // 0x15C + AXFX_REVERBHI_EXP reverbInner; // 0x00 + f32 coloration; // 0x148 + f32 mix; // 0x14C + f32 time; // 0x150 + f32 damping; // 0x154 + f32 preDelay; // 0x158 + f32 crosstalk; // 0x15C } AXFX_REVERBHI; -u32 AXFXReverbHiGetMemSize(AXFX_REVERBHI* fx); -BOOL AXFXReverbHiInit(AXFX_REVERBHI* fx); -BOOL AXFXReverbHiShutdown(AXFX_REVERBHI* fx); -BOOL AXFXReverbHiSettings(AXFX_REVERBHI* fx); -void AXFXReverbHiCallback(void* chans, void* context); +u32 AXFXReverbHiGetMemSize(AXFX_REVERBHI* fx); +BOOL AXFXReverbHiInit(AXFX_REVERBHI* fx); +BOOL AXFXReverbHiShutdown(AXFX_REVERBHI* fx); +BOOL AXFXReverbHiSettings(AXFX_REVERBHI* fx); +void AXFXReverbHiCallback(void* chans, void* context); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AXFX_REVERB_HI_H +#endif // REVOLUTION_AXFX_REVERB_HI_H diff --git a/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHiDpl2.h b/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHiDpl2.h index fd16db6d..9fe5d1f8 100644 --- a/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHiDpl2.h +++ b/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHiDpl2.h @@ -8,23 +8,23 @@ extern "C" { #endif typedef struct AXFX_REVERBHI_DPL2 { - AXFX_REVERBHI_EXP_DPL2 reverbInner; // 0x00 - f32 coloration; // 0x148 - f32 mix; // 0x14C - f32 time; // 0x150 - f32 damping; // 0x154 - f32 preDelay; // 0x158 - f32 crosstalk; // 0x15C + AXFX_REVERBHI_EXP_DPL2 reverbInner; // 0x00 + f32 coloration; // 0x148 + f32 mix; // 0x14C + f32 time; // 0x150 + f32 damping; // 0x154 + f32 preDelay; // 0x158 + f32 crosstalk; // 0x15C } AXFX_REVERBHI_DPL2; -u32 AXFXReverbHiGetMemSizeDpl2(AXFX_REVERBHI_DPL2* fx); -BOOL AXFXReverbHiInitDpl2(AXFX_REVERBHI_DPL2* fx); -BOOL AXFXReverbHiShutdownDpl2(AXFX_REVERBHI_DPL2* fx); -BOOL AXFXReverbHiSettingsDpl2(AXFX_REVERBHI_DPL2* fx); -void AXFXReverbHiCallbackDpl2(void* chans, void* context); +u32 AXFXReverbHiGetMemSizeDpl2(AXFX_REVERBHI_DPL2* fx); +BOOL AXFXReverbHiInitDpl2(AXFX_REVERBHI_DPL2* fx); +BOOL AXFXReverbHiShutdownDpl2(AXFX_REVERBHI_DPL2* fx); +BOOL AXFXReverbHiSettingsDpl2(AXFX_REVERBHI_DPL2* fx); +void AXFXReverbHiCallbackDpl2(void* chans, void* context); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AXFX_REVERB_HI_DPL2_H +#endif // REVOLUTION_AXFX_REVERB_HI_DPL2_H diff --git a/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHiExp.h b/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHiExp.h index fa024ef4..b82cfef4 100644 --- a/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHiExp.h +++ b/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHiExp.h @@ -8,61 +8,61 @@ extern "C" { #endif typedef struct AXFX_REVERBHI_EXP { - f32* earlyLine[3]; // 0x00 - u32 earlyPos[3]; // 0x0C - u32 earlyLength; // 0x18 - u32 earlyMaxLength; // 0x1C - f32 earlyCoef[3]; // 0x20 + f32* earlyLine[3]; // 0x00 + u32 earlyPos[3]; // 0x0C + u32 earlyLength; // 0x18 + u32 earlyMaxLength; // 0x1C + f32 earlyCoef[3]; // 0x20 - f32* preDelayLine[3]; // 0x2C - u32 preDelayPos; // 0x38 - u32 preDelayLength; // 0x3C - u32 preDelayMaxLength; // 0x40 + f32* preDelayLine[3]; // 0x2C + u32 preDelayPos; // 0x38 + u32 preDelayLength; // 0x3C + u32 preDelayMaxLength; // 0x40 - f32* combLine[3][3]; // 0x44 - u32 combPos[3]; // 0x68 - u32 combLength[3]; // 0x74 - u32 combMaxLength[3]; // 0x80 - f32 combCoef[3]; // 0x8C + f32* combLine[3][3]; // 0x44 + u32 combPos[3]; // 0x68 + u32 combLength[3]; // 0x74 + u32 combMaxLength[3]; // 0x80 + f32 combCoef[3]; // 0x8C - f32* allpassLine[3][2]; // 0x98 - u32 allpassPos[2]; // 0xB0 - u32 allpassLength[2]; // 0xB8 - u32 allpassMaxLength[2]; // 0xC0 + f32* allpassLine[3][2]; // 0x98 + u32 allpassPos[2]; // 0xB0 + u32 allpassLength[2]; // 0xB8 + u32 allpassMaxLength[2]; // 0xC0 - f32* lastAllpassLine[3]; // 0xC8 - u32 lastAllpassPos[3]; // 0xD4 - u32 lastAllpassLength[3]; // 0xE0 - u32 lastAllpassMaxLength[3]; // 0xEC + f32* lastAllpassLine[3]; // 0xC8 + u32 lastAllpassPos[3]; // 0xD4 + u32 lastAllpassLength[3]; // 0xE0 + u32 lastAllpassMaxLength[3]; // 0xEC - f32 allpassCoef; // 0xF8 - f32 lastLpfOut[3]; // 0xFC - f32 lpfCoef; // 0x108 - u32 active; // 0x10C - u32 earlyMode; // 0x110 - f32 preDelayTimeMax; // 0x114 - f32 preDelayTime; // 0x118 - u32 fusedMode; // 0x11C - f32 fusedTime; // 0x120 - f32 coloration; // 0x124 - f32 damping; // 0x128 - f32 crosstalk; // 0x12C - f32 earlyGain; // 0x130 - f32 fusedGain; // 0x134 - AXFX_BUS* busIn; // 0x138 - AXFX_BUS* busOut; // 0x13C - f32 outGain; // 0x140 - f32 sendGain; // 0x144 + f32 allpassCoef; // 0xF8 + f32 lastLpfOut[3]; // 0xFC + f32 lpfCoef; // 0x108 + u32 active; // 0x10C + u32 earlyMode; // 0x110 + f32 preDelayTimeMax; // 0x114 + f32 preDelayTime; // 0x118 + u32 fusedMode; // 0x11C + f32 fusedTime; // 0x120 + f32 coloration; // 0x124 + f32 damping; // 0x128 + f32 crosstalk; // 0x12C + f32 earlyGain; // 0x130 + f32 fusedGain; // 0x134 + AXFX_BUS* busIn; // 0x138 + AXFX_BUS* busOut; // 0x13C + f32 outGain; // 0x140 + f32 sendGain; // 0x144 } AXFX_REVERBHI_EXP; -u32 AXFXReverbHiExpGetMemSize(const AXFX_REVERBHI_EXP* fx); -BOOL AXFXReverbHiExpInit(AXFX_REVERBHI_EXP* fx); -void AXFXReverbHiExpShutdown(AXFX_REVERBHI_EXP* fx); -BOOL AXFXReverbHiExpSettings(AXFX_REVERBHI_EXP* fx); -void AXFXReverbHiExpCallback(AXFX_BUFFERUPDATE* update, AXFX_REVERBHI_EXP* fx); +u32 AXFXReverbHiExpGetMemSize(const AXFX_REVERBHI_EXP* fx); +BOOL AXFXReverbHiExpInit(AXFX_REVERBHI_EXP* fx); +void AXFXReverbHiExpShutdown(AXFX_REVERBHI_EXP* fx); +BOOL AXFXReverbHiExpSettings(AXFX_REVERBHI_EXP* fx); +void AXFXReverbHiExpCallback(AXFX_BUFFERUPDATE* update, AXFX_REVERBHI_EXP* fx); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AXFX_REVERB_HI_EXP_H +#endif // REVOLUTION_AXFX_REVERB_HI_EXP_H diff --git a/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHiExpDpl2.h b/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHiExpDpl2.h index c075e61b..6c9d7cb0 100644 --- a/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHiExpDpl2.h +++ b/libs/RVL_SDK/include/revolution/axfx/AXFXReverbHiExpDpl2.h @@ -8,62 +8,61 @@ extern "C" { #endif typedef struct AXFX_REVERBHI_EXP_DPL2 { - f32* earlyLine[4]; // 0x00 - u32 earlyPos[3]; // 0x10 - u32 earlyLength; // 0x1C - u32 earlyMaxLength; // 0x20 - f32 earlyCoef[3]; // 0x24 + f32* earlyLine[4]; // 0x00 + u32 earlyPos[3]; // 0x10 + u32 earlyLength; // 0x1C + u32 earlyMaxLength; // 0x20 + f32 earlyCoef[3]; // 0x24 - f32* preDelayLine[4]; // 0x30 - u32 preDelayPos; // 0x40 - u32 preDelayLength; // 0x44 - u32 preDelayMaxLength; // 0x48 + f32* preDelayLine[4]; // 0x30 + u32 preDelayPos; // 0x40 + u32 preDelayLength; // 0x44 + u32 preDelayMaxLength; // 0x48 - f32* combLine[4][3]; // 0x4C - u32 combPos[3]; // 0x7C - u32 combLength[3]; // 0x88 - u32 combMaxLength[3]; // 0x94 - f32 combCoef[3]; // 0xA0 + f32* combLine[4][3]; // 0x4C + u32 combPos[3]; // 0x7C + u32 combLength[3]; // 0x88 + u32 combMaxLength[3]; // 0x94 + f32 combCoef[3]; // 0xA0 - f32* allpassLine[4][2]; // 0xAC - u32 allpassPos[2]; // 0xCC - u32 allpassLength[2]; // 0xD4 - u32 allpassMaxLength[2]; // 0xDC + f32* allpassLine[4][2]; // 0xAC + u32 allpassPos[2]; // 0xCC + u32 allpassLength[2]; // 0xD4 + u32 allpassMaxLength[2]; // 0xDC - f32* lastAllpassLine[4]; // 0xE4 - u32 lastAllpassPos[4]; // 0xF4 - u32 lastAllpassLength[4]; // 0x104 - u32 lastAllpassMaxLength[4]; // 0x114 + f32* lastAllpassLine[4]; // 0xE4 + u32 lastAllpassPos[4]; // 0xF4 + u32 lastAllpassLength[4]; // 0x104 + u32 lastAllpassMaxLength[4]; // 0x114 - f32 allpassCoef; // 0x124 - f32 lastLpfOut[4]; // 0x128 - f32 lpfCoef; // 0x138 - u32 active; // 0x13C - u32 earlyMode; // 0x140 - f32 preDelayTimeMax; // 0x144 - f32 preDelayTime; // 0x148 - u32 fusedMode; // 0x14C - f32 fusedTime; // 0x150 - f32 coloration; // 0x154 - f32 damping; // 0x158 - f32 crosstalk; // 0x15C - f32 earlyGain; // 0x160 - f32 fusedGain; // 0x164 - AXFX_BUS* busIn; // 0x168 - AXFX_BUS* busOut; // 0x16C - f32 outGain; // 0x170 - f32 sendGain; // 0x174 + f32 allpassCoef; // 0x124 + f32 lastLpfOut[4]; // 0x128 + f32 lpfCoef; // 0x138 + u32 active; // 0x13C + u32 earlyMode; // 0x140 + f32 preDelayTimeMax; // 0x144 + f32 preDelayTime; // 0x148 + u32 fusedMode; // 0x14C + f32 fusedTime; // 0x150 + f32 coloration; // 0x154 + f32 damping; // 0x158 + f32 crosstalk; // 0x15C + f32 earlyGain; // 0x160 + f32 fusedGain; // 0x164 + AXFX_BUS* busIn; // 0x168 + AXFX_BUS* busOut; // 0x16C + f32 outGain; // 0x170 + f32 sendGain; // 0x174 } AXFX_REVERBHI_EXP_DPL2; -u32 AXFXReverbHiExpGetMemSizeDpl2(const AXFX_REVERBHI_EXP_DPL2* fx); -BOOL AXFXReverbHiExpInitDpl2(AXFX_REVERBHI_EXP_DPL2* fx); -void AXFXReverbHiExpShutdownDpl2(AXFX_REVERBHI_EXP_DPL2* fx); -BOOL AXFXReverbHiExpSettingsDpl2(AXFX_REVERBHI_EXP_DPL2* fx); -void AXFXReverbHiExpCallbackDpl2(AXFX_BUFFERUPDATE_DPL2* update, AXFX_REVERBHI_EXP_DPL2* fx); - +u32 AXFXReverbHiExpGetMemSizeDpl2(const AXFX_REVERBHI_EXP_DPL2* fx); +BOOL AXFXReverbHiExpInitDpl2(AXFX_REVERBHI_EXP_DPL2* fx); +void AXFXReverbHiExpShutdownDpl2(AXFX_REVERBHI_EXP_DPL2* fx); +BOOL AXFXReverbHiExpSettingsDpl2(AXFX_REVERBHI_EXP_DPL2* fx); +void AXFXReverbHiExpCallbackDpl2(AXFX_BUFFERUPDATE_DPL2* update, AXFX_REVERBHI_EXP_DPL2* fx); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AXFX_REVERB_HI_EXP_DPL2_H +#endif // REVOLUTION_AXFX_REVERB_HI_EXP_DPL2_H diff --git a/libs/RVL_SDK/include/revolution/axfx/AXFXReverbStd.h b/libs/RVL_SDK/include/revolution/axfx/AXFXReverbStd.h index 8387f4d3..b974ba65 100644 --- a/libs/RVL_SDK/include/revolution/axfx/AXFXReverbStd.h +++ b/libs/RVL_SDK/include/revolution/axfx/AXFXReverbStd.h @@ -8,22 +8,22 @@ extern "C" { #endif typedef struct AXFX_REVERBSTD { - AXFX_REVERBSTD_EXP reverbInner; // 0x00 - f32 coloration; // 0xE8 - f32 mix; // 0xEC - f32 time; // 0xF0 - f32 damping; // 0xF4 - f32 preDelay; // 0xF8 + AXFX_REVERBSTD_EXP reverbInner; // 0x00 + f32 coloration; // 0xE8 + f32 mix; // 0xEC + f32 time; // 0xF0 + f32 damping; // 0xF4 + f32 preDelay; // 0xF8 } AXFX_REVERBSTD; -u32 AXFXReverbStdGetMemSize(AXFX_REVERBSTD* fx); -BOOL AXFXReverbStdInit(AXFX_REVERBSTD* fx); -BOOL AXFXReverbStdShutdown(AXFX_REVERBSTD* fx); -BOOL AXFXReverbStdSettings(AXFX_REVERBSTD* fx); -void AXFXReverbStdCallback(void* chans, void* context); +u32 AXFXReverbStdGetMemSize(AXFX_REVERBSTD* fx); +BOOL AXFXReverbStdInit(AXFX_REVERBSTD* fx); +BOOL AXFXReverbStdShutdown(AXFX_REVERBSTD* fx); +BOOL AXFXReverbStdSettings(AXFX_REVERBSTD* fx); +void AXFXReverbStdCallback(void* chans, void* context); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AXFX_REVERB_STD_H +#endif // REVOLUTION_AXFX_REVERB_STD_H diff --git a/libs/RVL_SDK/include/revolution/axfx/AXFXReverbStdExp.h b/libs/RVL_SDK/include/revolution/axfx/AXFXReverbStdExp.h index 13a31499..3d4bf8b4 100644 --- a/libs/RVL_SDK/include/revolution/axfx/AXFXReverbStdExp.h +++ b/libs/RVL_SDK/include/revolution/axfx/AXFXReverbStdExp.h @@ -8,55 +8,55 @@ extern "C" { #endif typedef struct AXFX_REVERBSTD_EXP { - f32* earlyLine[3]; // 0x00 - u32 earlyPos; // 0x0C - u32 earlyLength; // 0x10 - u32 earlyMaxLength; // 0x14 - f32 earlyCoef; // 0x18 - f32* preDelayLine[3]; // 0x1C + f32* earlyLine[3]; // 0x00 + u32 earlyPos; // 0x0C + u32 earlyLength; // 0x10 + u32 earlyMaxLength; // 0x14 + f32 earlyCoef; // 0x18 + f32* preDelayLine[3]; // 0x1C - u32 preDelayPos; // 0x28 - u32 preDelayLength; // 0x2C - u32 preDelayMaxLength; // 0x30 + u32 preDelayPos; // 0x28 + u32 preDelayLength; // 0x2C + u32 preDelayMaxLength; // 0x30 - f32* combLine[3][2]; // 0x34 - u32 combPos[2]; // 0x4C - u32 combLength[2]; // 0x54 - u32 combMaxLength[2]; // 0x5C - f32 combCoef[2]; // 0x64 + f32* combLine[3][2]; // 0x34 + u32 combPos[2]; // 0x4C + u32 combLength[2]; // 0x54 + u32 combMaxLength[2]; // 0x5C + f32 combCoef[2]; // 0x64 - f32* allpassLine[3][2]; // 0x6C - u32 allpassPos[2]; // 0x84 - u32 allpassLength[2]; // 0x8C - u32 allpassMaxLength[2]; // 0x94 - f32 allpassCoef; // 0x9C + f32* allpassLine[3][2]; // 0x6C + u32 allpassPos[2]; // 0x84 + u32 allpassLength[2]; // 0x8C + u32 allpassMaxLength[2]; // 0x94 + f32 allpassCoef; // 0x9C - f32 lastLpfOut[3]; // 0xA0 - f32 lpfCoef; // 0xAC - u32 active; // 0xB0 - u32 earlyMode; // 0xB4 - f32 preDelayTimeMax; // 0xB8 - f32 preDelayTime; // 0xBC - u32 fusedMode; // 0xC0 - f32 fusedTime; // 0xC4 - f32 coloration; // 0xC8 - f32 damping; // 0xCC - f32 earlyGain; // 0xD0 - f32 fusedGain; // 0xD4 - AXFX_BUS* busIn; // 0xD8 - AXFX_BUS* busOut; // 0xDC - f32 outGain; // 0xE0 - f32 sendGain; // 0xE4 + f32 lastLpfOut[3]; // 0xA0 + f32 lpfCoef; // 0xAC + u32 active; // 0xB0 + u32 earlyMode; // 0xB4 + f32 preDelayTimeMax; // 0xB8 + f32 preDelayTime; // 0xBC + u32 fusedMode; // 0xC0 + f32 fusedTime; // 0xC4 + f32 coloration; // 0xC8 + f32 damping; // 0xCC + f32 earlyGain; // 0xD0 + f32 fusedGain; // 0xD4 + AXFX_BUS* busIn; // 0xD8 + AXFX_BUS* busOut; // 0xDC + f32 outGain; // 0xE0 + f32 sendGain; // 0xE4 } AXFX_REVERBSTD_EXP; -u32 AXFXReverbStdExpGetMemSize(const AXFX_REVERBSTD_EXP* fx); -BOOL AXFXReverbStdExpInit(AXFX_REVERBSTD_EXP* fx); -void AXFXReverbStdExpShutdown(AXFX_REVERBSTD_EXP* fx); -BOOL AXFXReverbStdExpSettings(AXFX_REVERBSTD_EXP* fx); -void AXFXReverbStdExpCallback(void* chans, AXFX_REVERBSTD_EXP* context); +u32 AXFXReverbStdExpGetMemSize(const AXFX_REVERBSTD_EXP* fx); +BOOL AXFXReverbStdExpInit(AXFX_REVERBSTD_EXP* fx); +void AXFXReverbStdExpShutdown(AXFX_REVERBSTD_EXP* fx); +BOOL AXFXReverbStdExpSettings(AXFX_REVERBSTD_EXP* fx); +void AXFXReverbStdExpCallback(void* chans, AXFX_REVERBSTD_EXP* context); #ifdef __cplusplus } #endif -#endif // REVOLUTION_AXFX_REVERB_STD_EXP_H +#endif // REVOLUTION_AXFX_REVERB_STD_EXP_H diff --git a/libs/RVL_SDK/include/revolution/base/PPCArch.h b/libs/RVL_SDK/include/revolution/base/PPCArch.h index 0908d60d..2e677d0b 100644 --- a/libs/RVL_SDK/include/revolution/base/PPCArch.h +++ b/libs/RVL_SDK/include/revolution/base/PPCArch.h @@ -15,39 +15,39 @@ typedef union FpscrUnion { } u; } FpscrUnion; -u32 PPCMfmsr(); -void PPCMtmsr(u32 val); +u32 PPCMfmsr(); +void PPCMtmsr(u32 val); -u32 PPCMfhid0(); -void PPCMthid0(u32 val); +u32 PPCMfhid0(); +void PPCMthid0(u32 val); -u32 PPCMfl2cr(); -void PPCMtl2cr(u32 val); +u32 PPCMfl2cr(); +void PPCMtl2cr(u32 val); -void PPCMtdec(u32 val); +void PPCMtdec(u32 val); -void PPCSync(); -void PPCHalt(); +void PPCSync(); +void PPCHalt(); -void PPCMtmmcr0(u32 val); -void PPCMtmmcr1(u32 val); +void PPCMtmmcr0(u32 val); +void PPCMtmmcr1(u32 val); -void PPCMtpmc1(u32 val); -void PPCMtpmc2(u32 val); -void PPCMtpmc3(u32 val); -void PPCMtpmc4(u32 val); +void PPCMtpmc1(u32 val); +void PPCMtpmc2(u32 val); +void PPCMtpmc3(u32 val); +void PPCMtpmc4(u32 val); -u32 PPCMffpscr(); -void PPCMtfpscr(u32 val); +u32 PPCMffpscr(); +void PPCMtfpscr(u32 val); -u32 PPCMfhid2(); -void PPCMthid2(u32 val); +u32 PPCMfhid2(); +void PPCMthid2(u32 val); -u32 PPCMfwpar(); -void PPCMtwpar(u32 val); +u32 PPCMfwpar(); +void PPCMtwpar(u32 val); -void PPCDisableSpeculation(); -void PPCSetFpNonIEEEMode(); +void PPCDisableSpeculation(); +void PPCSetFpNonIEEEMode(); void PPCMthid4(u32 val); @@ -55,418 +55,423 @@ void PPCMthid4(u32 val); } #endif -#define CTR 9 -#define XER 1 -#define LR 8 +#define CTR 9 +#define XER 1 +#define LR 8 -#define UPMC1 937 -#define UPMC2 938 -#define UPMC3 941 -#define UPMC4 942 +#define UPMC1 937 +#define UPMC2 938 +#define UPMC3 941 +#define UPMC4 942 -#define USIA 939 +#define USIA 939 -#define UMMCR0 936 -#define UMMCR1 940 +#define UMMCR0 936 +#define UMMCR1 940 -#define HID0 1008 -#define HID1 1009 +#define HID0 1008 +#define HID1 1009 -#define PVR 287 +#define PVR 287 -#define IBAT0U 528 -#define IBAT0L 529 -#define IBAT1U 530 -#define IBAT1L 531 -#define IBAT2U 532 -#define IBAT2L 533 -#define IBAT3U 534 -#define IBAT3L 535 +#define IBAT0U 528 +#define IBAT0L 529 +#define IBAT1U 530 +#define IBAT1L 531 +#define IBAT2U 532 +#define IBAT2L 533 +#define IBAT3U 534 +#define IBAT3L 535 -#define DBAT0U 536 -#define DBAT0L 537 -#define DBAT1U 538 -#define DBAT1L 539 -#define DBAT2U 540 -#define DBAT2L 541 -#define DBAT3U 542 -#define DBAT3L 543 +#define DBAT0U 536 +#define DBAT0L 537 +#define DBAT1U 538 +#define DBAT1L 539 +#define DBAT2U 540 +#define DBAT2L 541 +#define DBAT3U 542 +#define DBAT3L 543 -#define SDR1 25 +#define SDR1 25 -#define SPRG0 272 -#define SPRG1 273 -#define SPRG2 274 -#define SPRG3 275 +#define SPRG0 272 +#define SPRG1 273 +#define SPRG2 274 +#define SPRG3 275 -#define DAR 19 -#define DSISR 18 +#define DAR 19 +#define DSISR 18 -#define SRR0 26 -#define SRR1 27 +#define SRR0 26 +#define SRR1 27 -#define EAR 282 +#define EAR 282 -#define DABR 1013 +#define DABR 1013 -#define TBL 284 -#define TBU 285 +#define TBL 284 +#define TBU 285 -#define L2CR 1017 +#define L2CR 1017 -#define DEC 22 +#define DEC 22 -#define IABR 1010 +#define IABR 1010 -#define PMC1 953 -#define PMC2 954 -#define PMC3 957 -#define PMC4 958 +#define PMC1 953 +#define PMC2 954 +#define PMC3 957 +#define PMC4 958 -#define SIA 955 +#define SIA 955 -#define MMCR0 952 -#define MMCR1 956 +#define MMCR0 952 +#define MMCR1 956 -#define THRM1 1020 -#define THRM2 1021 -#define THRM3 1022 +#define THRM1 1020 +#define THRM2 1021 +#define THRM3 1022 -#define ICTC 1019 +#define ICTC 1019 -#define GQR0 912 -#define GQR1 913 -#define GQR2 914 -#define GQR3 915 -#define GQR4 916 -#define GQR5 917 -#define GQR6 918 -#define GQR7 919 +#define GQR0 912 +#define GQR1 913 +#define GQR2 914 +#define GQR3 915 +#define GQR4 916 +#define GQR5 917 +#define GQR6 918 +#define GQR7 919 -#define HID2 920 +#define HID2 920 -#define WPAR 921 +#define WPAR 921 -#define DMA_U 922 -#define DMA_L 923 +#define DMA_U 922 +#define DMA_L 923 -#define MSR_POW 0x00040000 // Power Management -#define MSR_ILE 0x00010000 // Interrupt Little Endian -#define MSR_EE 0x00008000 // external interrupt -#define MSR_PR 0x00004000 // privilege level(should be 0) -#define MSR_FP 0x00002000 // floating point available -#define MSR_ME 0x00001000 // machine check enable -#define MSR_FE0 0x00000800 // floating point exception enable -#define MSR_SE 0x00000400 // single step trace enable -#define MSR_BE 0x00000200 // branch trace enable -#define MSR_FE1 0x00000100 // floating point exception enable -#define MSR_IP 0x00000040 // Exception prefix -#define MSR_IR 0x00000020 // instruction relocate -#define MSR_DR 0x00000010 // data relocate -#define MSR_PM 0x00000004 // Performance monitor marked mode -#define MSR_RI 0x00000002 // Recoverable interrupt -#define MSR_LE 0x00000001 // Little Endian +#define MSR_POW 0x00040000 // Power Management +#define MSR_ILE 0x00010000 // Interrupt Little Endian +#define MSR_EE 0x00008000 // external interrupt +#define MSR_PR 0x00004000 // privilege level(should be 0) +#define MSR_FP 0x00002000 // floating point available +#define MSR_ME 0x00001000 // machine check enable +#define MSR_FE0 0x00000800 // floating point exception enable +#define MSR_SE 0x00000400 // single step trace enable +#define MSR_BE 0x00000200 // branch trace enable +#define MSR_FE1 0x00000100 // floating point exception enable +#define MSR_IP 0x00000040 // Exception prefix +#define MSR_IR 0x00000020 // instruction relocate +#define MSR_DR 0x00000010 // data relocate +#define MSR_PM 0x00000004 // Performance monitor marked mode +#define MSR_RI 0x00000002 // Recoverable interrupt +#define MSR_LE 0x00000001 // Little Endian -#define MSR_POW_BIT 13 // Power Management -#define MSR_ILE_BIT 15 // Interrupt Little Endian -#define MSR_EE_BIT 16 // external interrupt -#define MSR_PR_BIT 17 // privilege level (should be 0) -#define MSR_FP_BIT 18 // floating point available -#define MSR_ME_BIT 19 // machine check enable -#define MSR_FE0_BIT 20 // floating point exception enable -#define MSR_SE_BIT 21 // single step trace enable -#define MSR_BE_BIT 22 // branch trace enable -#define MSR_FE1_BIT 23 // floating point exception enable -#define MSR_IP_BIT 25 // Exception prefix -#define MSR_IR_BIT 26 // instruction relocate -#define MSR_DR_BIT 27 // data relocate -#define MSR_PM_BIT 29 // Performance monitor marked mode -#define MSR_RI_BIT 30 // Recoverable interrupt -#define MSR_LE_BIT 31 // Little Endian +#define MSR_POW_BIT 13 // Power Management +#define MSR_ILE_BIT 15 // Interrupt Little Endian +#define MSR_EE_BIT 16 // external interrupt +#define MSR_PR_BIT 17 // privilege level (should be 0) +#define MSR_FP_BIT 18 // floating point available +#define MSR_ME_BIT 19 // machine check enable +#define MSR_FE0_BIT 20 // floating point exception enable +#define MSR_SE_BIT 21 // single step trace enable +#define MSR_BE_BIT 22 // branch trace enable +#define MSR_FE1_BIT 23 // floating point exception enable +#define MSR_IP_BIT 25 // Exception prefix +#define MSR_IR_BIT 26 // instruction relocate +#define MSR_DR_BIT 27 // data relocate +#define MSR_PM_BIT 29 // Performance monitor marked mode +#define MSR_RI_BIT 30 // Recoverable interrupt +#define MSR_LE_BIT 31 // Little Endian -#define HID0_EMCP 0x80000000 // Enable MCP -#define HID0_DBP 0x40000000 // Enable 60x bus address and data parity chk -#define HID0_EBA 0x20000000 // Enable 60x address parity checking -#define HID0_EBD 0x10000000 // Enable 60x data parity checking -#define HID0_BCLK 0x08000000 // CLK_OUT output enable and clk selection -#define HID0_ECLK 0x02000000 // CLK_OUT output enable and clk selection -#define HID0_PAR 0x01000000 // Disable !ARTRY precharge -#define HID0_DOZE 0x00800000 // Doze mode enable -#define HID0_NAP 0x00400000 // Nap mode enable -#define HID0_SLEEP 0x00200000 // Sleep mode enable -#define HID0_DPM 0x00100000 // Dynamic power management enable -#define HID0_NHR 0x00010000 // Not hard reset (0 hard reset if s/w set it) -#define HID0_ICE 0x00008000 // Instruction cache enable -#define HID0_DCE 0x00004000 // Data cache enable -#define HID0_ILOCK 0x00002000 // ICache lock -#define HID0_DLOCK 0x00001000 // DCache lock -#define HID0_ICFI 0x00000800 // ICache flash invalidate -#define HID0_DCFI 0x00000400 // DCache flash invalidate -#define HID0_SPD 0x00000200 // Speculative cache access enable (0 enable) -#define HID0_IFEM 0x00000100 // Enable M bit on bus for Ifetch -#define HID0_SGE 0x00000080 // Store gathering enable -#define HID0_DCFA 0x00000040 // DCache flush assist - set before a flush -#define HID0_BTIC 0x00000020 // Branch target icache enable -#define HID0_ABE 0x00000008 // Address bcast enable -#define HID0_BHT 0x00000004 // Branch history table enable -#define HID0_NOOPTI 0x00000001 // No-op Dcache touch instructions +#define HID0_EMCP 0x80000000 // Enable MCP +#define HID0_DBP 0x40000000 // Enable 60x bus address and data parity chk +#define HID0_EBA 0x20000000 // Enable 60x address parity checking +#define HID0_EBD 0x10000000 // Enable 60x data parity checking +#define HID0_BCLK 0x08000000 // CLK_OUT output enable and clk selection +#define HID0_ECLK 0x02000000 // CLK_OUT output enable and clk selection +#define HID0_PAR 0x01000000 // Disable !ARTRY precharge +#define HID0_DOZE 0x00800000 // Doze mode enable +#define HID0_NAP 0x00400000 // Nap mode enable +#define HID0_SLEEP 0x00200000 // Sleep mode enable +#define HID0_DPM 0x00100000 // Dynamic power management enable +#define HID0_NHR 0x00010000 // Not hard reset (0 hard reset if s/w set it) +#define HID0_ICE 0x00008000 // Instruction cache enable +#define HID0_DCE 0x00004000 // Data cache enable +#define HID0_ILOCK 0x00002000 // ICache lock +#define HID0_DLOCK 0x00001000 // DCache lock +#define HID0_ICFI 0x00000800 // ICache flash invalidate +#define HID0_DCFI 0x00000400 // DCache flash invalidate +#define HID0_SPD 0x00000200 // Speculative cache access enable (0 enable) +#define HID0_IFEM 0x00000100 // Enable M bit on bus for Ifetch +#define HID0_SGE 0x00000080 // Store gathering enable +#define HID0_DCFA 0x00000040 // DCache flush assist - set before a flush +#define HID0_BTIC 0x00000020 // Branch target icache enable +#define HID0_ABE 0x00000008 // Address bcast enable +#define HID0_BHT 0x00000004 // Branch history table enable +#define HID0_NOOPTI 0x00000001 // No-op Dcache touch instructions -#define HID0_ICE_BIT 16 // Instruction cache enable -#define HID0_DCE_BIT 17 // Data cache enable -#define HID0_ILOCK_BIT 18 // ICache lock -#define HID0_DLOCK_BIT 19 // DCache lock +#define HID0_ICE_BIT 16 // Instruction cache enable +#define HID0_DCE_BIT 17 // Data cache enable +#define HID0_ILOCK_BIT 18 // ICache lock +#define HID0_DLOCK_BIT 19 // DCache lock -#define HID2_LSQE 0x80000000 // L/S quantize enable -#define HID2_WPE 0x40000000 // Write pipe enable -#define HID2_PSE 0x20000000 // Paired single enable -#define HID2_LCE 0x10000000 // Locked cache enable +#define HID2_LSQE 0x80000000 // L/S quantize enable +#define HID2_WPE 0x40000000 // Write pipe enable +#define HID2_PSE 0x20000000 // Paired single enable +#define HID2_LCE 0x10000000 // Locked cache enable -#define HID2_DCHERR 0x00800000 // ERROR: dcbz_l cache hit -#define HID2_DNCERR 0x00400000 // ERROR: DMA access to normal cache -#define HID2_DCMERR 0x00200000 // ERROR: DMA cache miss error -#define HID2_DQOERR 0x00100000 // ERROR: DMA queue overflow -#define HID2_DCHEE 0x00080000 // dcbz_l cache hit error enable -#define HID2_DNCEE 0x00040000 // DMA access to normal cache error enable -#define HID2_DCMEE 0x00020000 // DMA cache miss error error enable -#define HID2_DQOEE 0x00010000 // DMA queue overflow error enable +#define HID2_DCHERR 0x00800000 // ERROR: dcbz_l cache hit +#define HID2_DNCERR 0x00400000 // ERROR: DMA access to normal cache +#define HID2_DCMERR 0x00200000 // ERROR: DMA cache miss error +#define HID2_DQOERR 0x00100000 // ERROR: DMA queue overflow +#define HID2_DCHEE 0x00080000 // dcbz_l cache hit error enable +#define HID2_DNCEE 0x00040000 // DMA access to normal cache error enable +#define HID2_DCMEE 0x00020000 // DMA cache miss error error enable +#define HID2_DQOEE 0x00010000 // DMA queue overflow error enable -#define HID2_DMAQL_MASK 0x0F000000 // DMA queue length mask -#define HID2_DMAQL_SHIFT 24 // DMA queue shift +#define HID2_DMAQL_MASK 0x0F000000 // DMA queue length mask +#define HID2_DMAQL_SHIFT 24 // DMA queue shift -#define HID2_LSQE_BIT 0 -#define HID2_WPE_BIT 1 -#define HID2_PSE_BIT 2 -#define HID2_LCE_BIT 3 +#define HID2_LSQE_BIT 0 +#define HID2_WPE_BIT 1 +#define HID2_PSE_BIT 2 +#define HID2_LCE_BIT 3 -#define HID2_DCHERR_BIT 8 -#define HID2_DNCERR_BIT 9 -#define HID2_DCMERR_BIT 10 -#define HID2_DQOERR_BIT 11 -#define HID2_DCHEE_BIT 12 -#define HID2_DNCEE_BIT 13 -#define HID2_DCMEE_BIT 14 -#define HID2_DQOEE_BIT 15 +#define HID2_DCHERR_BIT 8 +#define HID2_DNCERR_BIT 9 +#define HID2_DCMERR_BIT 10 +#define HID2_DQOERR_BIT 11 +#define HID2_DCHEE_BIT 12 +#define HID2_DNCEE_BIT 13 +#define HID2_DCMEE_BIT 14 +#define HID2_DQOEE_BIT 15 -#define GQR_LOAD_SCALE_MASK 0x3F000000 // load scale field -#define GQR_LOAD_TYPE_MASK 0x00070000 // load type field -#define GQR_STORE_SCALE_MASK 0x00003F00 // store scale field -#define GQR_STORE_TYPE_MASK 0x00000007 // store type field +#define GQR_LOAD_SCALE_MASK 0x3F000000 // load scale field +#define GQR_LOAD_TYPE_MASK 0x00070000 // load type field +#define GQR_STORE_SCALE_MASK 0x00003F00 // store scale field +#define GQR_STORE_TYPE_MASK 0x00000007 // store type field -#define DMA_U_ADDR_MASK 0xFFFFFFE0 // Start addr in memory -#define DMA_U_LEN_U_MASK 0x0000001F // lines to transfer (U) +#define DMA_U_ADDR_MASK 0xFFFFFFE0 // Start addr in memory +#define DMA_U_LEN_U_MASK 0x0000001F // lines to transfer (U) -#define DMA_L_LC_ADDR_MASK 0xFFFFFFE0 // Start addr in LC -#define DMA_L_LOAD 0x00000010 // 0 - store, 1 - load -#define DMA_L_STORE 0x00000000 // 0 - store, 1 - load -#define DMA_L_LEN_MASK 0x0000000C // lines to transfer (L) -#define DMA_L_TRIGGER 0x00000002 // 0 - cmd inactive, 1 - cmd rdy -#define DMA_L_FLUSH 0x00000001 // 1 - Flush DMA queue +#define DMA_L_LC_ADDR_MASK 0xFFFFFFE0 // Start addr in LC +#define DMA_L_LOAD 0x00000010 // 0 - store, 1 - load +#define DMA_L_STORE 0x00000000 // 0 - store, 1 - load +#define DMA_L_LEN_MASK 0x0000000C // lines to transfer (L) +#define DMA_L_TRIGGER 0x00000002 // 0 - cmd inactive, 1 - cmd rdy +#define DMA_L_FLUSH 0x00000001 // 1 - Flush DMA queue -#define WPAR_ADDR 0xFFFFFFE0 // 32byte gather address -#define WPAR_BNE 0x00000001 // Buffer not empty (R) +#define WPAR_ADDR 0xFFFFFFE0 // 32byte gather address +#define WPAR_BNE 0x00000001 // Buffer not empty (R) -#define SRR1_DMA_BIT 0x00200000 -#define SRR1_L2DP_BIT 0x00100000 +#define SRR1_DMA_BIT 0x00200000 +#define SRR1_L2DP_BIT 0x00100000 -#define L2CR_L2E 0x80000000 // L2 Enable -#define L2CR_L2PE 0x40000000 // L2 data parity generation and checking enable +#define L2CR_L2E 0x80000000 // L2 Enable +#define L2CR_L2PE 0x40000000 // L2 data parity generation and checking enable -#define L2CR_L2SIZ_256K 0x10000000 // L2 size 256K -#define L2CR_L2SIZ_512K 0x20000000 // L2 size 512 -#define L2CR_L2SIZ_1M 0x30000000 // L2 size 1M +#define L2CR_L2SIZ_256K 0x10000000 // L2 size 256K +#define L2CR_L2SIZ_512K 0x20000000 // L2 size 512 +#define L2CR_L2SIZ_1M 0x30000000 // L2 size 1M -#define L2CR_L2CLK_1_0 0x02000000 // L2 clock ratio 1 -#define L2CR_L2CLK_1_5 0x04000000 // L2 clock ratio 1.5 -#define L2CR_L2CLK_2_0 0x08000000 // L2 clock ratio 2 -#define L2CR_L2CLK_2_5 0x0A000000 // L2 clock ratio 2.5 -#define L2CR_L2CLK_3_0 0x0C000000 // L2 clock ratio 3 +#define L2CR_L2CLK_1_0 0x02000000 // L2 clock ratio 1 +#define L2CR_L2CLK_1_5 0x04000000 // L2 clock ratio 1.5 +#define L2CR_L2CLK_2_0 0x08000000 // L2 clock ratio 2 +#define L2CR_L2CLK_2_5 0x0A000000 // L2 clock ratio 2.5 +#define L2CR_L2CLK_3_0 0x0C000000 // L2 clock ratio 3 -#define L2CR_RAM_FLOW_THRU_BURST 0x00000000 // L2 RAM type flow-through sync. burst SRAM -#define L2CR_RAM_PIPELINE_BURST 0x01000000 // L2 RAM type pipelined sync. burst SRAM -#define L2CR_RAM_PIPELINE_LATE 0x01800000 // L2 RAM type pipelined sync. late-write SRAM +#define L2CR_RAM_FLOW_THRU_BURST 0x00000000 // L2 RAM type flow-through sync. burst SRAM +#define L2CR_RAM_PIPELINE_BURST 0x01000000 // L2 RAM type pipelined sync. burst SRAM +#define L2CR_RAM_PIPELINE_LATE 0x01800000 // L2 RAM type pipelined sync. late-write SRAM -#define L2CR_L2DO 0x00400000 // Data only -#define L2CR_L2I 0x00200000 // Global invalidate -#define L2CR_L2CTL 0x00100000 // ZZ enable -#define L2CR_L2WT 0x00080000 // L2 write through -#define L2CR_L2TS 0x00040000 // L2 test support +#define L2CR_L2DO 0x00400000 // Data only +#define L2CR_L2I 0x00200000 // Global invalidate +#define L2CR_L2CTL 0x00100000 // ZZ enable +#define L2CR_L2WT 0x00080000 // L2 write through +#define L2CR_L2TS 0x00040000 // L2 test support -#define L2CR_L2OH_0_5 0x00000000 // L2 output hold 0.5 ns -#define L2CR_L2OH_1_0 0x00010000 // L2 output hold 1.0 ns +#define L2CR_L2OH_0_5 0x00000000 // L2 output hold 0.5 ns +#define L2CR_L2OH_1_0 0x00010000 // L2 output hold 1.0 ns -#define L2CR_L2SL 0x00008000 // L2 DLL slow -#define L2CR_L2DF 0x00004000 // L2 differential clock -#define L2CR_L2BYP 0x00002000 // L2 DLL bypass -#define L2CR_L2CS 0x00000200 // L2 clock stop -#define L2CR_L2DRO 0x00000100 // L2 DLL rollover checkstop enable -#define L2CR_L2CTR_MASK 0x000000FE // L2 counter value mask -#define L2CR_L2IP 0x00000001 // L2 global invalidate in progress +#define L2CR_L2SL 0x00008000 // L2 DLL slow +#define L2CR_L2DF 0x00004000 // L2 differential clock +#define L2CR_L2BYP 0x00002000 // L2 DLL bypass +#define L2CR_L2CS 0x00000200 // L2 clock stop +#define L2CR_L2DRO 0x00000100 // L2 DLL rollover checkstop enable +#define L2CR_L2CTR_MASK 0x000000FE // L2 counter value mask +#define L2CR_L2IP 0x00000001 // L2 global invalidate in progress -#define MMCR0_DIS 0x80000000 // Disables counting unconditionally -#define MMCR0_DP 0x40000000 // Disables counting while in supervisor mode -#define MMCR0_DU 0x20000000 // Disables counting while in user mode -#define MMCR0_DMS 0x10000000 // Disables counting while MSR[PM] is set -#define MMCR0_DMR 0x08000000 // Disables counting while MSR[PM] is zero -#define MMCR0_ENINT 0x04000000 // Enables performance monitor interrupt signaling -#define MMCR0_DISCOUNT 0x02000000 // Disables counting of PMCn when a performance monitor interrupt is signaled or... -#define MMCR0_RTCSELECT_MASK 0x01800000 // 64-bit time base, bit selection enable -#define MMCR0_RTCSELECT_63 0x00000000 // Pick bit 63 to count -#define MMCR0_RTCSELECT_55 0x00800000 // Pick bit 55 to count -#define MMCR0_RTCSELECT_51 0x01000000 // Pick bit 51 to count -#define MMCR0_RTCSELECT_47 0x01800000 // Pick bit 47 to count -#define MMCR0_INTONBITTRANS 0x00400000 // Causes interrupt signaling on bit transition from off to on -#define MMCR0_THRESHOLD_MASK 0x003F0000 // Threshold value -#define MMCR0_THRESHOLD(n) ((n) << 16) // Threshold value (0 - 63) -#define MMCR0_PMC1INTCONTROL 0x00008000 // Enables interrupt signaling due to PMC1 counter overflow -#define MMCR0_PMC2INTCONTROL 0x00004000 // Enables interrupt signaling due to PMC2-PMC4 counter overflow -#define MMCR0_PMCTRIGGER 0x00002000 // Can be used to trigger counting of PMC2-PMC4 after PMC1 has overflowed or... -#define MMCR0_PMC1SELECT_MASK 0x00001FC0 // PMC1 input selector -#define MMCR0_PMC2SELECT_MASK 0x0000003F // PMC2 input selector +#define MMCR0_DIS 0x80000000 // Disables counting unconditionally +#define MMCR0_DP 0x40000000 // Disables counting while in supervisor mode +#define MMCR0_DU 0x20000000 // Disables counting while in user mode +#define MMCR0_DMS 0x10000000 // Disables counting while MSR[PM] is set +#define MMCR0_DMR 0x08000000 // Disables counting while MSR[PM] is zero +#define MMCR0_ENINT 0x04000000 // Enables performance monitor interrupt signaling +#define MMCR0_DISCOUNT 0x02000000 // Disables counting of PMCn when a performance monitor interrupt is signaled or... +#define MMCR0_RTCSELECT_MASK 0x01800000 // 64-bit time base, bit selection enable +#define MMCR0_RTCSELECT_63 0x00000000 // Pick bit 63 to count +#define MMCR0_RTCSELECT_55 0x00800000 // Pick bit 55 to count +#define MMCR0_RTCSELECT_51 0x01000000 // Pick bit 51 to count +#define MMCR0_RTCSELECT_47 0x01800000 // Pick bit 47 to count +#define MMCR0_INTONBITTRANS 0x00400000 // Causes interrupt signaling on bit transition from off to on +#define MMCR0_THRESHOLD_MASK 0x003F0000 // Threshold value +#define MMCR0_THRESHOLD(n) ((n) << 16) // Threshold value (0 - 63) +#define MMCR0_PMC1INTCONTROL 0x00008000 // Enables interrupt signaling due to PMC1 counter overflow +#define MMCR0_PMC2INTCONTROL 0x00004000 // Enables interrupt signaling due to PMC2-PMC4 counter overflow +#define MMCR0_PMCTRIGGER 0x00002000 // Can be used to trigger counting of PMC2-PMC4 after PMC1 has overflowed or... +#define MMCR0_PMC1SELECT_MASK 0x00001FC0 // PMC1 input selector +#define MMCR0_PMC2SELECT_MASK 0x0000003F // PMC2 input selector -#define MMCR1_PMC3SELECT_MASK 0xF8000000 // PMC3 input selector -#define MMCR1_PMC4SELECT_MASK 0x07C00000 // PMC4 input selector +#define MMCR1_PMC3SELECT_MASK 0xF8000000 // PMC3 input selector +#define MMCR1_PMC4SELECT_MASK 0x07C00000 // PMC4 input selector -#define PMC1_OV 0x80000000 // Overflow -#define PMC1_COUNTER 0x7FFFFFFF // Counter value -#define PMC2_OV 0x80000000 // Overflow -#define PMC2_COUNTER 0x7FFFFFFF // Counter value -#define PMC3_OV 0x80000000 // Overflow -#define PMC3_COUNTER 0x7FFFFFFF // Counter value -#define PMC4_OV 0x80000000 // Overflow -#define PMC4_COUNTER 0x7FFFFFFF // Counter value +#define PMC1_OV 0x80000000 // Overflow +#define PMC1_COUNTER 0x7FFFFFFF // Counter value +#define PMC2_OV 0x80000000 // Overflow +#define PMC2_COUNTER 0x7FFFFFFF // Counter value +#define PMC3_OV 0x80000000 // Overflow +#define PMC3_COUNTER 0x7FFFFFFF // Counter value +#define PMC4_OV 0x80000000 // Overflow +#define PMC4_COUNTER 0x7FFFFFFF // Counter value -#define MMCR0_PMC1_HOLD 0x00000000 // Register holds current value -#define MMCR0_PMC1_CYCLE 0x00000040 // Processor cycles -#define MMCR0_PMC1_INSTRUCTION 0x00000080 // # of instructions completed. -#define MMCR0_PMC1_TRANSITION 0x000000C0 // # of transitions for 0 to 1 -#define MMCR0_PMC1_DISPATCHED 0x00000100 // # of instructions dispatched -#define MMCR0_PMC1_EIEIO 0x00000140 // # of eieio instructions completed -#define MMCR0_PMC1_ITLB_CYCLE 0x00000180 // # of cycles spent performing table search op. for the ITLB -#define MMCR0_PMC1_L2_HIT 0x000001C0 // # of access that hit the L2. -#define MMCR0_PMC1_EA 0x00000200 // # of valid instruction EAs delivered to the memory subsystem -#define MMCR0_PMC1_IABR 0x00000240 // # of time the address of an instruction matches the IABR -#define MMCR0_PMC1_L1_MISS 0x00000280 // # of loads that miss the L1 -#define MMCR0_PMC1_Bx_UNRESOLVED 0x000002C0 // # of branches that are unresolved when processed -#define MMCR0_PMC1_Bx_STALL_CYCLE 0x00000300 // # of cycles that dispatcher stalls due to a second - // unresolved branch in the instruction stream -#define MMCR0_PMC1_IC_FETCH_MISS 0x00000340 // # of times an instruction fetch missed the L1 Icache -#define MMCR0_PMC2_HOLD 0x00000000 // Register holds current value -#define MMCR0_PMC2_CYCLE 0x00000001 // Processor cycles -#define MMCR0_PMC2_INSTRUCTION 0x00000002 // # of instructions completed -#define MMCR0_PMC2_TRANSITION 0x00000003 // # of time-base (lower) bit transitions -#define MMCR0_PMC2_DISPATCHED 0x00000004 // # of instructions dispatched -#define MMCR0_PMC2_IC_MISS 0x00000005 // # of L1 instruction cache misses -#define MMCR0_PMC2_ITLB_MISS 0x00000006 // # of ITLB misses -#define MMCR0_PMC2_L2_I_MISS 0x00000007 // # of L2 instruction misses -#define MMCR0_PMC2_Bx_FALL_TROUGH 0x00000008 // # of fall-through branches -#define MMCR0_PMC2_PR_SWITCH 0x00000009 // # of MSR[PR] bit toggles -#define MMCR0_PMC2_RESERVED_LOAD 0x0000000A // # of reserved loads completed -#define MMCR0_PMC2_LOAD_STORE 0x0000000B // # of completed loads and stores -#define MMCR0_PMC2_SNOOP 0x0000000C // # of snoops -#define MMCR0_PMC2_L1_CASTOUT 0x0000000D // # of L1 castouts to L2 -#define MMCR0_PMC2_SYSTEM 0x0000000E // # of completed system unit instructions -#define MMCR0_PMC2_IC_FETCH_MISS 0x0000000F // # of instruction fetch misses in the L1 -#define MMCR0_PMC2_Bx_OUT_OF_ORDER 0x00000010 // # of branches allowing out-of-order execution +#define MMCR0_PMC1_HOLD 0x00000000 // Register holds current value +#define MMCR0_PMC1_CYCLE 0x00000040 // Processor cycles +#define MMCR0_PMC1_INSTRUCTION 0x00000080 // # of instructions completed. +#define MMCR0_PMC1_TRANSITION 0x000000C0 // # of transitions for 0 to 1 +#define MMCR0_PMC1_DISPATCHED 0x00000100 // # of instructions dispatched +#define MMCR0_PMC1_EIEIO 0x00000140 // # of eieio instructions completed +#define MMCR0_PMC1_ITLB_CYCLE 0x00000180 // # of cycles spent performing table search op. for the ITLB +#define MMCR0_PMC1_L2_HIT 0x000001C0 // # of access that hit the L2. +#define MMCR0_PMC1_EA 0x00000200 // # of valid instruction EAs delivered to the memory subsystem +#define MMCR0_PMC1_IABR 0x00000240 // # of time the address of an instruction matches the IABR +#define MMCR0_PMC1_L1_MISS 0x00000280 // # of loads that miss the L1 +#define MMCR0_PMC1_Bx_UNRESOLVED 0x000002C0 // # of branches that are unresolved when processed +#define MMCR0_PMC1_Bx_STALL_CYCLE \ + 0x00000300 // # of cycles that dispatcher stalls due to a second + // unresolved branch in the instruction stream +#define MMCR0_PMC1_IC_FETCH_MISS 0x00000340 // # of times an instruction fetch missed the L1 Icache +#define MMCR0_PMC2_HOLD 0x00000000 // Register holds current value +#define MMCR0_PMC2_CYCLE 0x00000001 // Processor cycles +#define MMCR0_PMC2_INSTRUCTION 0x00000002 // # of instructions completed +#define MMCR0_PMC2_TRANSITION 0x00000003 // # of time-base (lower) bit transitions +#define MMCR0_PMC2_DISPATCHED 0x00000004 // # of instructions dispatched +#define MMCR0_PMC2_IC_MISS 0x00000005 // # of L1 instruction cache misses +#define MMCR0_PMC2_ITLB_MISS 0x00000006 // # of ITLB misses +#define MMCR0_PMC2_L2_I_MISS 0x00000007 // # of L2 instruction misses +#define MMCR0_PMC2_Bx_FALL_TROUGH 0x00000008 // # of fall-through branches +#define MMCR0_PMC2_PR_SWITCH 0x00000009 // # of MSR[PR] bit toggles +#define MMCR0_PMC2_RESERVED_LOAD 0x0000000A // # of reserved loads completed +#define MMCR0_PMC2_LOAD_STORE 0x0000000B // # of completed loads and stores +#define MMCR0_PMC2_SNOOP 0x0000000C // # of snoops +#define MMCR0_PMC2_L1_CASTOUT 0x0000000D // # of L1 castouts to L2 +#define MMCR0_PMC2_SYSTEM 0x0000000E // # of completed system unit instructions +#define MMCR0_PMC2_IC_FETCH_MISS 0x0000000F // # of instruction fetch misses in the L1 +#define MMCR0_PMC2_Bx_OUT_OF_ORDER 0x00000010 // # of branches allowing out-of-order execution -#define MMCR1_PMC3_HOLD 0x00000000 // Register holds current value -#define MMCR1_PMC3_CYCLE 0x08000000 // Processor cycles -#define MMCR1_PMC3_INSTRUCTION 0x10000000 // # of instructions completed -#define MMCR1_PMC3_TRANSITION 0x18000000 // # of time-base (lower) bit transitions -#define MMCR1_PMC3_DISPATCHED 0x20000000 // # of instructions dispatched -#define MMCR1_PMC3_DC_MISS 0x28000000 // # of L1 data cache misses -#define MMCR1_PMC3_DTLB_MISS 0x30000000 // # of DTLB misses -#define MMCR1_PMC3_L2_D_MISS 0x38000000 // # of L2 data misses -#define MMCR1_PMC3_Bx_TAKEN 0x40000000 // # predicted branches that were taken -#define MMCR1_PMC3_PM_SWITCH 0x48000000 // # of transitions between marked and unmarked processes -#define MMCR1_PMC3_COND_STORE 0x50000000 // # of store conditional instructions completed -#define MMCR1_PMC3_FPU 0x58000000 // # of instructions completed from the FPU +#define MMCR1_PMC3_HOLD 0x00000000 // Register holds current value +#define MMCR1_PMC3_CYCLE 0x08000000 // Processor cycles +#define MMCR1_PMC3_INSTRUCTION 0x10000000 // # of instructions completed +#define MMCR1_PMC3_TRANSITION 0x18000000 // # of time-base (lower) bit transitions +#define MMCR1_PMC3_DISPATCHED 0x20000000 // # of instructions dispatched +#define MMCR1_PMC3_DC_MISS 0x28000000 // # of L1 data cache misses +#define MMCR1_PMC3_DTLB_MISS 0x30000000 // # of DTLB misses +#define MMCR1_PMC3_L2_D_MISS 0x38000000 // # of L2 data misses +#define MMCR1_PMC3_Bx_TAKEN 0x40000000 // # predicted branches that were taken +#define MMCR1_PMC3_PM_SWITCH 0x48000000 // # of transitions between marked and unmarked processes +#define MMCR1_PMC3_COND_STORE 0x50000000 // # of store conditional instructions completed +#define MMCR1_PMC3_FPU 0x58000000 // # of instructions completed from the FPU #define MMCR1_PMC3_L2_SNOOP_CASTOUT 0x60000000 // # of L2 castout caused by snoops to modified lines -#define MMCR1_PMC3_L2_HIT 0x68000000 // # of cache operations that hit in the L2 cache -#define MMCR1_PMC3_L1_MISS_CYCLE 0x78000000 // # of cycles generated by L1 load misses -#define MMCR1_PMC3_Bx_SECOND 0x80000000 // # of branches in the second speculative branch - // resolved correctly -#define MMCR1_PMC3_BPU_LR_CR 0x88000000 // # of cycles the BPU stalls due to LR or CR unresolved - // dependencies +#define MMCR1_PMC3_L2_HIT 0x68000000 // # of cache operations that hit in the L2 cache +#define MMCR1_PMC3_L1_MISS_CYCLE 0x78000000 // # of cycles generated by L1 load misses +#define MMCR1_PMC3_Bx_SECOND \ + 0x80000000 // # of branches in the second speculative branch + // resolved correctly +#define MMCR1_PMC3_BPU_LR_CR \ + 0x88000000 // # of cycles the BPU stalls due to LR or CR unresolved + // dependencies -#define MMCR1_PMC4_HOLD 0x00000000 // Register holds current value -#define MMCR1_PMC4_CYCLE 0x00400000 // Processor cycles -#define MMCR1_PMC4_INSTRUCTION 0x00800000 // # of instructions completed -#define MMCR1_PMC4_TRANSITION 0x00C00000 // # of time-base (lower) bit transitions -#define MMCR1_PMC4_DISPATCHED 0x01000000 // # of instructions dispatched -#define MMCR1_PMC4_L2_CASTOUT 0x01400000 // # of L2 castouts -#define MMCR1_PMC4_DTLB_CYCLE 0x01800000 // # of cycles spent performing table searches for DTLB accesses -#define MMCR1_PMC4_Bx_MISSED 0x02000000 // # of mispredicted branches -#define MMCR1_PMC4_COND_STORE_INT 0x02800000 // # of store conditional instructions completed - // with reservation intact -#define MMCR1_PMC4_SYNC 0x02C00000 // # of completed sync instructions -#define MMCR1_PMC4_SNOOP_RETRY 0x03000000 // # of snoop request retries -#define MMCR1_PMC4_INTEGER 0x03400000 // # of completed integer operations -#define MMCR1_PMC4_BPU_THIRD 0x03800000 // # of cycles the BPU cannot process new branches - // due to having two unresolved branches -#define MMCR1_PMC4_DC_MISS 0x07C00000 // # of L1 data cache misses +#define MMCR1_PMC4_HOLD 0x00000000 // Register holds current value +#define MMCR1_PMC4_CYCLE 0x00400000 // Processor cycles +#define MMCR1_PMC4_INSTRUCTION 0x00800000 // # of instructions completed +#define MMCR1_PMC4_TRANSITION 0x00C00000 // # of time-base (lower) bit transitions +#define MMCR1_PMC4_DISPATCHED 0x01000000 // # of instructions dispatched +#define MMCR1_PMC4_L2_CASTOUT 0x01400000 // # of L2 castouts +#define MMCR1_PMC4_DTLB_CYCLE 0x01800000 // # of cycles spent performing table searches for DTLB accesses +#define MMCR1_PMC4_Bx_MISSED 0x02000000 // # of mispredicted branches +#define MMCR1_PMC4_COND_STORE_INT \ + 0x02800000 // # of store conditional instructions completed + // with reservation intact +#define MMCR1_PMC4_SYNC 0x02C00000 // # of completed sync instructions +#define MMCR1_PMC4_SNOOP_RETRY 0x03000000 // # of snoop request retries +#define MMCR1_PMC4_INTEGER 0x03400000 // # of completed integer operations +#define MMCR1_PMC4_BPU_THIRD \ + 0x03800000 // # of cycles the BPU cannot process new branches + // due to having two unresolved branches +#define MMCR1_PMC4_DC_MISS 0x07C00000 // # of L1 data cache misses -#define FPSCR_FX 0x80000000 // Exception summary -#define FPSCR_FEX 0x40000000 // Enabled exception summary -#define FPSCR_VX 0x20000000 // Invalid operation -#define FPSCR_OX 0x10000000 // Overflow exception -#define FPSCR_UX 0x08000000 // Underflow exception -#define FPSCR_ZX 0x04000000 // Zero divide exception -#define FPSCR_XX 0x02000000 // Inexact exception -#define FPSCR_VXSNAN 0x01000000 // SNaN -#define FPSCR_VXISI 0x00800000 // Infinity - Infinity -#define FPSCR_VXIDI 0x00400000 // Infinity / Infinity -#define FPSCR_VXZDZ 0x00200000 // 0 / 0 -#define FPSCR_VXIMZ 0x00100000 // Infinity * 0 -#define FPSCR_VXVC 0x00080000 // Invalid compare -#define FPSCR_FR 0x00040000 // Fraction rounded -#define FPSCR_FI 0x00020000 // Fraction inexact -#define FPSCR_VXSOFT 0x00000400 // Software request -#define FPSCR_VXSQRT 0x00000200 // Invalid square root -#define FPSCR_VXCVI 0x00000100 // Invalid integer convert -#define FPSCR_VE 0x00000080 // Invalid operation exception enable -#define FPSCR_OE 0x00000040 // Overflow exception enable -#define FPSCR_UE 0x00000020 // Underflow exception enable -#define FPSCR_ZE 0x00000010 // Zero divide exception enable -#define FPSCR_XE 0x00000008 // Inexact exception enable -#define FPSCR_NI 0x00000004 // Non-IEEE mode +#define FPSCR_FX 0x80000000 // Exception summary +#define FPSCR_FEX 0x40000000 // Enabled exception summary +#define FPSCR_VX 0x20000000 // Invalid operation +#define FPSCR_OX 0x10000000 // Overflow exception +#define FPSCR_UX 0x08000000 // Underflow exception +#define FPSCR_ZX 0x04000000 // Zero divide exception +#define FPSCR_XX 0x02000000 // Inexact exception +#define FPSCR_VXSNAN 0x01000000 // SNaN +#define FPSCR_VXISI 0x00800000 // Infinity - Infinity +#define FPSCR_VXIDI 0x00400000 // Infinity / Infinity +#define FPSCR_VXZDZ 0x00200000 // 0 / 0 +#define FPSCR_VXIMZ 0x00100000 // Infinity * 0 +#define FPSCR_VXVC 0x00080000 // Invalid compare +#define FPSCR_FR 0x00040000 // Fraction rounded +#define FPSCR_FI 0x00020000 // Fraction inexact +#define FPSCR_VXSOFT 0x00000400 // Software request +#define FPSCR_VXSQRT 0x00000200 // Invalid square root +#define FPSCR_VXCVI 0x00000100 // Invalid integer convert +#define FPSCR_VE 0x00000080 // Invalid operation exception enable +#define FPSCR_OE 0x00000040 // Overflow exception enable +#define FPSCR_UE 0x00000020 // Underflow exception enable +#define FPSCR_ZE 0x00000010 // Zero divide exception enable +#define FPSCR_XE 0x00000008 // Inexact exception enable +#define FPSCR_NI 0x00000004 // Non-IEEE mode -#define FPSCR_FX_BIT 0 // Exception summary -#define FPSCR_FEX_BIT 1 // Enabled exception summary -#define FPSCR_VX_BIT 2 // Invalid operation -#define FPSCR_OX_BIT 3 // Overflow exception -#define FPSCR_UX_BIT 4 // Underflow exception -#define FPSCR_ZX_BIT 5 // Zero divide exception -#define FPSCR_XX_BIT 6 // Inexact exception -#define FPSCR_VXSNAN_BIT 7 // SNaN -#define FPSCR_VXISI_BIT 8 // Infinity - Infinity -#define FPSCR_VXIDI_BIT 9 // Infinity / Infinity -#define FPSCR_VXZDZ_BIT 10 // 0 / 0 -#define FPSCR_VXIMZ_BIT 11 // Infinity * 0 -#define FPSCR_VXVC_BIT 12 // Invalid compare -#define FPSCR_FR_BIT 13 // Fraction rounded -#define FPSCR_FI_BIT 14 // Fraction inexact -#define FPSCR_VXSOFT_BIT 21 // Software request -#define FPSCR_VXSQRT_BIT 22 // Invalid square root -#define FPSCR_VXCVI_BIT 23 // Invalid integer convert -#define FPSCR_VE_BIT 24 // Invalid operation exception enable -#define FPSCR_OE_BIT 25 // Overflow exception enable -#define FPSCR_UE_BIT 26 // Underflow exception enable -#define FPSCR_ZE_BIT 27 // Zero divide exception enable -#define FPSCR_XE_BIT 28 // Inexact exception enable -#define FPSCR_NI_BIT 29 // Non-IEEE mode +#define FPSCR_FX_BIT 0 // Exception summary +#define FPSCR_FEX_BIT 1 // Enabled exception summary +#define FPSCR_VX_BIT 2 // Invalid operation +#define FPSCR_OX_BIT 3 // Overflow exception +#define FPSCR_UX_BIT 4 // Underflow exception +#define FPSCR_ZX_BIT 5 // Zero divide exception +#define FPSCR_XX_BIT 6 // Inexact exception +#define FPSCR_VXSNAN_BIT 7 // SNaN +#define FPSCR_VXISI_BIT 8 // Infinity - Infinity +#define FPSCR_VXIDI_BIT 9 // Infinity / Infinity +#define FPSCR_VXZDZ_BIT 10 // 0 / 0 +#define FPSCR_VXIMZ_BIT 11 // Infinity * 0 +#define FPSCR_VXVC_BIT 12 // Invalid compare +#define FPSCR_FR_BIT 13 // Fraction rounded +#define FPSCR_FI_BIT 14 // Fraction inexact +#define FPSCR_VXSOFT_BIT 21 // Software request +#define FPSCR_VXSQRT_BIT 22 // Invalid square root +#define FPSCR_VXCVI_BIT 23 // Invalid integer convert +#define FPSCR_VE_BIT 24 // Invalid operation exception enable +#define FPSCR_OE_BIT 25 // Overflow exception enable +#define FPSCR_UE_BIT 26 // Underflow exception enable +#define FPSCR_ZE_BIT 27 // Zero divide exception enable +#define FPSCR_XE_BIT 28 // Inexact exception enable +#define FPSCR_NI_BIT 29 // Non-IEEE mode /** BROADWAY EXCLUSIVE **/ -#define HID4 1011 -#define HID4_H4A (1 << (31 - 0)) // H4A (Apparently "reserved") -#define HID4_L2FM (0b11 << (31 - 2)) // L2 fetch mode -#define HID4_BPD (0b11 << (31 - 4)) // Bus pipeline depth -#define HID4_BCO (1 << (31 - 5)) // L2 second castout buffer enable -#define HID4_SBE (1 << (31 - 6)) // Secondary BAT enable -#define HID4_PS1_CTL (1 << (31 - 7)) // Paired-singles control bit 1 -#define HID4_DBP (1 << (31 - 9)) // Data bus parking -#define HID4_L2MUM (1 << (31 - 10)) // L2 MUM enable -#define HID4_L2_CCFI (1 << (31 - 11)) // L2CFI - L2 complete castout prior to L2 flash invalidate -#define HID4_PSS2_CTL (1 << (31 - 12)) // Paired-singles control bit 2 +#define HID4 1011 +#define HID4_H4A (1 << (31 - 0)) // H4A (Apparently "reserved") +#define HID4_L2FM (0b11 << (31 - 2)) // L2 fetch mode +#define HID4_BPD (0b11 << (31 - 4)) // Bus pipeline depth +#define HID4_BCO (1 << (31 - 5)) // L2 second castout buffer enable +#define HID4_SBE (1 << (31 - 6)) // Secondary BAT enable +#define HID4_PS1_CTL (1 << (31 - 7)) // Paired-singles control bit 1 +#define HID4_DBP (1 << (31 - 9)) // Data bus parking +#define HID4_L2MUM (1 << (31 - 10)) // L2 MUM enable +#define HID4_L2_CCFI (1 << (31 - 11)) // L2CFI - L2 complete castout prior to L2 flash invalidate +#define HID4_PSS2_CTL (1 << (31 - 12)) // Paired-singles control bit 2 -#endif // REVOLUTION_BASE_ARCH_H +#endif // REVOLUTION_BASE_ARCH_H diff --git a/libs/RVL_SDK/include/revolution/base/PPCWGPipe.h b/libs/RVL_SDK/include/revolution/base/PPCWGPipe.h index fd2a8446..d4636033 100644 --- a/libs/RVL_SDK/include/revolution/base/PPCWGPipe.h +++ b/libs/RVL_SDK/include/revolution/base/PPCWGPipe.h @@ -8,11 +8,11 @@ extern "C" { #endif typedef union PPCWGPipe { - u8 u8; + u8 u8; u16 u16; u32 u32; u64 u64; - s8 s8; + s8 s8; s16 s16; s32 s32; s64 s64; @@ -24,4 +24,4 @@ typedef union PPCWGPipe { } #endif -#endif // REVOLUTION_BASE_PPCWGPIPE_H +#endif // REVOLUTION_BASE_PPCWGPIPE_H diff --git a/libs/RVL_SDK/include/revolution/card.h b/libs/RVL_SDK/include/revolution/card.h index 310065a5..e66c6051 100644 --- a/libs/RVL_SDK/include/revolution/card.h +++ b/libs/RVL_SDK/include/revolution/card.h @@ -3,301 +3,301 @@ #include -#include #include +#include #ifdef __cplusplus extern "C" { #endif -#define CARD_CHAN_0 0 -#define CARD_CHAN_1 1 -#define CARD_CHAN_MAX 2 +#define CARD_CHAN_0 0 +#define CARD_CHAN_1 1 +#define CARD_CHAN_MAX 2 -#define CARD_ATTR_PUBLIC 0x04 -#define CARD_ATTR_NO_COPY 0x08 -#define CARD_ATTR_NO_MOVE 0x10 -#define CARD_ATTR_GLOBAL 0x20 -#define CARD_ATTR_COMPANY 0x40 +#define CARD_ATTR_PUBLIC 0x04 +#define CARD_ATTR_NO_COPY 0x08 +#define CARD_ATTR_NO_MOVE 0x10 +#define CARD_ATTR_GLOBAL 0x20 +#define CARD_ATTR_COMPANY 0x40 -#define CARD_FAT_AVAIL 0x0000 -#define CARD_FAT_CHECKSUM 0x0000 -#define CARD_FAT_CHECKSUMINV 0x0001 -#define CARD_FAT_CHECKCODE 0x0002 -#define CARD_FAT_FREEBLOCKS 0x0003 -#define CARD_FAT_LASTSLOT 0x0004 +#define CARD_FAT_AVAIL 0x0000 +#define CARD_FAT_CHECKSUM 0x0000 +#define CARD_FAT_CHECKSUMINV 0x0001 +#define CARD_FAT_CHECKCODE 0x0002 +#define CARD_FAT_FREEBLOCKS 0x0003 +#define CARD_FAT_LASTSLOT 0x0004 #define CARD_WORKAREA_SIZE (5 * 8 * 1024) -#define CARD_SEG_SIZE 0x200 -#define CARD_PAGE_SIZE 0x80 -#define CARD_MAX_SIZE 0x01000000 +#define CARD_SEG_SIZE 0x200 +#define CARD_PAGE_SIZE 0x80 +#define CARD_MAX_SIZE 0x01000000 -#define CARD_NUM_SYSTEM_BLOCK 5 -#define CARD_SYSTEM_BLOCK_SIZE (8 * 1024) +#define CARD_NUM_SYSTEM_BLOCK 5 +#define CARD_SYSTEM_BLOCK_SIZE (8 * 1024) #define CARD_MAX_MOUNT_STEP (CARD_NUM_SYSTEM_BLOCK + 2) -#define CARD_STAT_SPEED_END 0 -#define CARD_STAT_SPEED_FAST 1 -#define CARD_STAT_SPEED_MIDDLE 2 -#define CARD_STAT_SPEED_SLOW 3 -#define CARD_STAT_SPEED_MASK 3 +#define CARD_STAT_SPEED_END 0 +#define CARD_STAT_SPEED_FAST 1 +#define CARD_STAT_SPEED_MIDDLE 2 +#define CARD_STAT_SPEED_SLOW 3 +#define CARD_STAT_SPEED_MASK 3 -#define CARD_RESULT_UNLOCKED 1 -#define CARD_RESULT_READY 0 -#define CARD_RESULT_BUSY -1 -#define CARD_RESULT_WRONGDEVICE -2 -#define CARD_RESULT_NOCARD -3 -#define CARD_RESULT_NOFILE -4 -#define CARD_RESULT_IOERROR -5 -#define CARD_RESULT_BROKEN -6 -#define CARD_RESULT_EXIST -7 -#define CARD_RESULT_NOENT -8 -#define CARD_RESULT_INSSPACE -9 -#define CARD_RESULT_NOPERM -10 -#define CARD_RESULT_LIMIT -11 -#define CARD_RESULT_NAMETOOLONG -12 -#define CARD_RESULT_ENCODING -13 -#define CARD_RESULT_CANCELED -14 +#define CARD_RESULT_UNLOCKED 1 +#define CARD_RESULT_READY 0 +#define CARD_RESULT_BUSY -1 +#define CARD_RESULT_WRONGDEVICE -2 +#define CARD_RESULT_NOCARD -3 +#define CARD_RESULT_NOFILE -4 +#define CARD_RESULT_IOERROR -5 +#define CARD_RESULT_BROKEN -6 +#define CARD_RESULT_EXIST -7 +#define CARD_RESULT_NOENT -8 +#define CARD_RESULT_INSSPACE -9 +#define CARD_RESULT_NOPERM -10 +#define CARD_RESULT_LIMIT -11 +#define CARD_RESULT_NAMETOOLONG -12 +#define CARD_RESULT_ENCODING -13 +#define CARD_RESULT_CANCELED -14 #define CARD_RESULT_FATAL_ERROR -128 -#define CARD_READ_SIZE 512 -#define CARD_COMMENT_SIZE 64 +#define CARD_READ_SIZE 512 +#define CARD_COMMENT_SIZE 64 -#define CARD_ICON_WIDTH 32 -#define CARD_ICON_HEIGHT 32 +#define CARD_ICON_WIDTH 32 +#define CARD_ICON_HEIGHT 32 -#define CARD_BANNER_WIDTH 96 -#define CARD_BANNER_HEIGHT 32 +#define CARD_BANNER_WIDTH 96 +#define CARD_BANNER_HEIGHT 32 -#define CARD_STAT_ICON_NONE 0 -#define CARD_STAT_ICON_C8 1 -#define CARD_STAT_ICON_RGB5A3 2 -#define CARD_STAT_ICON_MASK 3 +#define CARD_STAT_ICON_NONE 0 +#define CARD_STAT_ICON_C8 1 +#define CARD_STAT_ICON_RGB5A3 2 +#define CARD_STAT_ICON_MASK 3 -#define CARD_STAT_BANNER_NONE 0 -#define CARD_STAT_BANNER_C8 1 +#define CARD_STAT_BANNER_NONE 0 +#define CARD_STAT_BANNER_C8 1 #define CARD_STAT_BANNER_RGB5A3 2 -#define CARD_STAT_BANNER_MASK 3 +#define CARD_STAT_BANNER_MASK 3 -#define CARD_ENCODE_ANSI 0 -#define CARD_ENCODE_SJIS 1 +#define CARD_ENCODE_ANSI 0 +#define CARD_ENCODE_SJIS 1 -#define CARD_FILENAME_MAX 32 -#define CARD_MAX_FILE 127 -#define CARD_ICON_MAX 8 +#define CARD_FILENAME_MAX 32 +#define CARD_MAX_FILE 127 +#define CARD_ICON_MAX 8 typedef void (*CARDCallback)(s32 chan, s32 result); typedef struct CARDFileInfo { - s32 chan; // 0x00 - s32 fileNo; // 0x04 + s32 chan; // 0x00 + s32 fileNo; // 0x04 - s32 offset; // 0x08 - s32 length; // 0x0C + s32 offset; // 0x08 + s32 length; // 0x0C - u16 iBlock; // 0x10 + u16 iBlock; // 0x10 } CARDFileInfo; typedef struct CARDDir { - u8 gameName[4]; // 0x00 - u8 company[2]; // 0x04 - u8 _padding0; // 0x06 + u8 gameName[4]; // 0x00 + u8 company[2]; // 0x04 + u8 _padding0; // 0x06 - u8 bannerFormat; // 0x07 + u8 bannerFormat; // 0x07 - u8 fileName[CARD_FILENAME_MAX]; // 0x08 - u32 time; // 0x28 + u8 fileName[CARD_FILENAME_MAX]; // 0x08 + u32 time; // 0x28 - u32 iconAddr; // 0x2C - u16 iconFormat; // 0x30 - u16 iconSpeed; // 0x32 + u32 iconAddr; // 0x2C + u16 iconFormat; // 0x30 + u16 iconSpeed; // 0x32 - u8 permission; // 0x34 - u8 copyTimes; // 0x35 + u8 permission; // 0x34 + u8 copyTimes; // 0x35 - u16 startBlock; // 0x36 - u16 length; // 0x38 + u16 startBlock; // 0x36 + u16 length; // 0x38 - u8 _padding1[2]; // 0x3A + u8 _padding1[2]; // 0x3A - u32 commentAddr; // 0x3C + u32 commentAddr; // 0x3C } CARDDir; typedef struct CARDControl { - BOOL attached; // 0x00 - s32 result; // 0x04 + BOOL attached; // 0x00 + s32 result; // 0x04 - u16 size; // 0x08 - u16 pageSize; // 0x0A - s32 sectorSize; // 0x0C - u16 cBlock; // 0x10 + u16 size; // 0x08 + u16 pageSize; // 0x0A + s32 sectorSize; // 0x0C + u16 cBlock; // 0x10 - u16 vendorID; // 0x12 - s32 latency; // 0x14 - u8 id[12]; // 0x18 + u16 vendorID; // 0x12 + s32 latency; // 0x14 + u8 id[12]; // 0x18 - int mountStep; // 0x24 - int formatStep; // 0x28 + int mountStep; // 0x24 + int formatStep; // 0x28 - u32 scramble; // 0x28 + u32 scramble; // 0x28 - DSPTaskInfo task; // 0x2C + DSPTaskInfo task; // 0x2C - void* workArea; // 0x80 + void* workArea; // 0x80 - CARDDir* currentDir; // 0x84 - u16* currentFat; // 0x88 + CARDDir* currentDir; // 0x84 + u16* currentFat; // 0x88 - OSThreadQueue threadQueue; // 0x8C + OSThreadQueue threadQueue; // 0x8C - u8 cmd[9]; // 0x94 - s32 cmdlen; // 0xA0 + u8 cmd[9]; // 0x94 + s32 cmdlen; // 0xA0 - u32 mode; // 0xA4 - int retry; // 0xA8 - int repeat; // 0xAC + u32 mode; // 0xA4 + int retry; // 0xA8 + int repeat; // 0xAC - u32 addr; // 0xB0 - void* buffer; // 0xB4 - s32 xferred; // 0xB8 - u16 freeNo; // 0xBC - u16 startBlock; // 0xBE + u32 addr; // 0xB0 + void* buffer; // 0xB4 + s32 xferred; // 0xB8 + u16 freeNo; // 0xBC + u16 startBlock; // 0xBE - CARDFileInfo* fileInfo; // 0xC0 + CARDFileInfo* fileInfo; // 0xC0 - CARDCallback extCallback; // 0xC4 - CARDCallback txCallback; // 0xC8 - CARDCallback exiCallback; // 0xCC - CARDCallback apiCallback; // 0xD0 - CARDCallback xferCallback; // 0xD4 - CARDCallback eraseCallback; // 0xD8 - CARDCallback unlockCallback; // 0xDC + CARDCallback extCallback; // 0xC4 + CARDCallback txCallback; // 0xC8 + CARDCallback exiCallback; // 0xCC + CARDCallback apiCallback; // 0xD0 + CARDCallback xferCallback; // 0xD4 + CARDCallback eraseCallback; // 0xD8 + CARDCallback unlockCallback; // 0xDC - OSAlarm alarm; // 0xE0 - u32 cid; // 0x108 - const DVDDiskID* diskID; // 0x10C + OSAlarm alarm; // 0xE0 + u32 cid; // 0x108 + const DVDDiskID* diskID; // 0x10C } CARDControl; typedef struct CARDDecParam { - u8* inputAddr; // 0x00 - u32 inputLength; // 0x04 + u8* inputAddr; // 0x00 + u32 inputLength; // 0x04 - u32 aramAddr; // 0x08 + u32 aramAddr; // 0x08 - u8* outputAddr; // 0x0C + u8* outputAddr; // 0x0C } CARDDecParam; typedef struct CARDID { - u8 serial[32]; // 0x00 - u16 deviceID; // 0x20 + u8 serial[32]; // 0x00 + u16 deviceID; // 0x20 - u16 size; // 0x22 - u16 encode; // 0x24 + u16 size; // 0x22 + u16 encode; // 0x24 - u8 padding[470]; // 0x26 + u8 padding[470]; // 0x26 - u16 checkSum; // 0x1FC - u16 checkSumInv; // 0x1FE + u16 checkSum; // 0x1FC + u16 checkSumInv; // 0x1FE } CARDID; typedef struct CARDDirCheck { - u8 padding0[56]; // 0x00 - u16 padding1; // 0x38 + u8 padding0[56]; // 0x00 + u16 padding1; // 0x38 - s16 checkCode; // 0x3A + s16 checkCode; // 0x3A - u16 checkSum; // 0x3C - u16 checkSumInv; // 0x3E + u16 checkSum; // 0x3C + u16 checkSumInv; // 0x3E } CARDDirCheck; typedef struct CARDStat { - char fileName[CARD_FILENAME_MAX]; // 0x00 - u32 length; // 0x20 - u32 time; // 0x24 + char fileName[CARD_FILENAME_MAX]; // 0x00 + u32 length; // 0x20 + u32 time; // 0x24 - u8 gameName[4]; // 0x28 - u8 company[2]; // 0x2C + u8 gameName[4]; // 0x28 + u8 company[2]; // 0x2C - u8 bannerFormat; // 0x2E + u8 bannerFormat; // 0x2E - u32 iconAddr; // 0x30 - u16 iconFormat; // 0x34 - u16 iconSpeed; // 0x36 + u32 iconAddr; // 0x30 + u16 iconFormat; // 0x34 + u16 iconSpeed; // 0x36 - u32 commentAddr; // 0x38 + u32 commentAddr; // 0x38 - u32 offsetBanner; // 0x3C - u32 offsetBannerTlut; // 0x40 - u32 offsetIcon[CARD_ICON_MAX]; // 0x44 - u32 offsetIconTlut; // 0x64 - u32 offsetData; // 0x68 + u32 offsetBanner; // 0x3C + u32 offsetBannerTlut; // 0x40 + u32 offsetIcon[CARD_ICON_MAX]; // 0x44 + u32 offsetIconTlut; // 0x64 + u32 offsetData; // 0x68 } CARDStat; -#define CARDGetFileNo(fileInfo) ((fileInfo)->fileNo) +#define CARDGetFileNo(fileInfo) ((fileInfo)->fileNo) -#define CARDIsValidBlockNo(card, blockNo) ((blockNo) >= CARD_NUM_SYSTEM_BLOCK && (blockNo) < (card)->cBlock) +#define CARDIsValidBlockNo(card, blockNo) ((blockNo) >= CARD_NUM_SYSTEM_BLOCK && (blockNo) < (card)->cBlock) -#define CARDGetDirCheck(dir) ((CARDDirCheck*)&(dir)[CARD_MAX_FILE]) +#define CARDGetDirCheck(dir) ((CARDDirCheck*)&(dir)[CARD_MAX_FILE]) -#define CARDGetBannerFormat(stat) (((stat)->bannerFormat) & CARD_STAT_BANNER_MASK) -#define CARDSetBannerFormat(stat, f) ((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_BANNER_MASK) | (f))) +#define CARDGetBannerFormat(stat) (((stat)->bannerFormat) & CARD_STAT_BANNER_MASK) +#define CARDSetBannerFormat(stat, f) ((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_BANNER_MASK) | (f))) -#define CARDGetIconAnim(stat) (((stat)->bannerFormat) & CARD_STAT_ANIM_MASK) -#define CARDGetIconFormat(stat, n) (((stat)->iconFormat >> (2 * (n))) & CARD_STAT_ICON_MASK) -#define CARDGetIconSpeed(stat, n) (((stat)->iconSpeed >> (2 * (n))) & CARD_STAT_SPEED_MASK) -#define CARDSetIconAnim(stat, f) ((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_ANIM_MASK) | (f))) -#define CARDSetIconFormat(stat, n, f) ((stat)->iconFormat = (u16)(((stat)->iconFormat & ~(CARD_STAT_ICON_MASK << (2 * (n)))) | ((f) << (2 * (n))))) -#define CARDSetIconSpeed(stat, n, f) ((stat)->iconSpeed = (u16)(((stat)->iconSpeed & ~(CARD_STAT_SPEED_MASK << (2 * (n)))) | ((f) << (2 * (n))))) -#define CARDSetIconAddress(stat, addr) ((stat)->iconAddr = (u32)(addr)) +#define CARDGetIconAnim(stat) (((stat)->bannerFormat) & CARD_STAT_ANIM_MASK) +#define CARDGetIconFormat(stat, n) (((stat)->iconFormat >> (2 * (n))) & CARD_STAT_ICON_MASK) +#define CARDGetIconSpeed(stat, n) (((stat)->iconSpeed >> (2 * (n))) & CARD_STAT_SPEED_MASK) +#define CARDSetIconAnim(stat, f) ((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_ANIM_MASK) | (f))) +#define CARDSetIconFormat(stat, n, f) ((stat)->iconFormat = (u16)(((stat)->iconFormat & ~(CARD_STAT_ICON_MASK << (2 * (n)))) | ((f) << (2 * (n))))) +#define CARDSetIconSpeed(stat, n, f) ((stat)->iconSpeed = (u16)(((stat)->iconSpeed & ~(CARD_STAT_SPEED_MASK << (2 * (n)))) | ((f) << (2 * (n))))) +#define CARDSetIconAddress(stat, addr) ((stat)->iconAddr = (u32)(addr)) -#define CARDSetCommentAddress(stat, addr) ((stat)->commentAddr = (u32)(addr)) +#define CARDSetCommentAddress(stat, addr) ((stat)->commentAddr = (u32)(addr)) -#define CARDFreq 4 /* EXI_FREQ_16M */ +#define CARDFreq 4 /* EXI_FREQ_16M */ -void CARDInit(); -s32 CARDGetResultCode(s32 chan); -s32 CARDFreeBlocks(s32 chan, s32* byteNotUsed, s32* filesNotUsed); -s32 CARDGetMemSize(s32 chan, u16* size); -s32 CARDGetSectorSize(s32 chan, u32* size); -BOOL CARDGetFastMode(); +void CARDInit(); +s32 CARDGetResultCode(s32 chan); +s32 CARDFreeBlocks(s32 chan, s32* byteNotUsed, s32* filesNotUsed); +s32 CARDGetMemSize(s32 chan, u16* size); +s32 CARDGetSectorSize(s32 chan, u32* size); +BOOL CARDGetFastMode(); -s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback); -s32 CARDCheckAsync(s32 chan, CARDCallback callback); -s32 CARDCheckEx(s32 chan, s32* xferBytes); -s32 CARDCheck(s32 chan); +s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback); +s32 CARDCheckAsync(s32 chan, CARDCallback callback); +s32 CARDCheckEx(s32 chan, s32* xferBytes); +s32 CARDCheck(s32 chan); -s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo, CARDCallback callback); -s32 CARDCreate(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo); +s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo, CARDCallback callback); +s32 CARDCreate(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo); -s32 CARDFastDeleteAsync(s32 chan, s32 fileNo, CARDCallback callback); -s32 CARDFastDelete(s32 chan, s32 fileNo); -s32 CARDDeleteAsync(s32 chan, const char* fileName, CARDCallback callback); -s32 CARDDelete(s32 chan, const char* fileName); +s32 CARDFastDeleteAsync(s32 chan, s32 fileNo, CARDCallback callback); +s32 CARDFastDelete(s32 chan, s32 fileNo); +s32 CARDDeleteAsync(s32 chan, const char* fileName, CARDCallback callback); +s32 CARDDelete(s32 chan, const char* fileName); -s32 CARDFormat(s32 chan); +s32 CARDFormat(s32 chan); -int CARDProbe(s32 chan); -s32 CARDMountAsync(s32 chan, void* workArea, CARDCallback detachCallback, CARDCallback attachCallback); -s32 CARDMount(s32 chan, void* workArea, CARDCallback detachCallback); -s32 CARDUnmount(s32 chan); +int CARDProbe(s32 chan); +s32 CARDMountAsync(s32 chan, void* workArea, CARDCallback detachCallback, CARDCallback attachCallback); +s32 CARDMount(s32 chan, void* workArea, CARDCallback detachCallback); +s32 CARDUnmount(s32 chan); -s32 CARDFastOpen(s32 chan, s32 fileNo, CARDFileInfo* fileInfo); -s32 CARDOpen(s32 chan, const char* fileName, CARDFileInfo* fileInfo); -s32 CARDClose(CARDFileInfo* fileInfo); +s32 CARDFastOpen(s32 chan, s32 fileNo, CARDFileInfo* fileInfo); +s32 CARDOpen(s32 chan, const char* fileName, CARDFileInfo* fileInfo); +s32 CARDClose(CARDFileInfo* fileInfo); -s32 CARDGetXferredBytes(s32 chan); +s32 CARDGetXferredBytes(s32 chan); -s32 CARDReadAsync(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset, CARDCallback callback); -s32 CARDRead(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset); -s32 CARDCancel(CARDFileInfo* fileInfo); +s32 CARDReadAsync(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset, CARDCallback callback); +s32 CARDRead(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset); +s32 CARDCancel(CARDFileInfo* fileInfo); -s32 CARDWriteAsync(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset, CARDCallback callback); -s32 CARDWrite(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset); +s32 CARDWriteAsync(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset, CARDCallback callback); +s32 CARDWrite(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset); #ifdef __cplusplus } #endif -#endif // REVOLUTION_CARD_H +#endif // REVOLUTION_CARD_H diff --git a/libs/RVL_SDK/include/revolution/cnt.h b/libs/RVL_SDK/include/revolution/cnt.h index 116f11be..2b0612ca 100644 --- a/libs/RVL_SDK/include/revolution/cnt.h +++ b/libs/RVL_SDK/include/revolution/cnt.h @@ -1,8 +1,8 @@ #ifndef REVOLUTION_CNT_H #define REVOLUTION_CNT_H -#include #include +#include #include #ifdef __cplusplus @@ -10,68 +10,68 @@ extern "C" { #endif typedef struct CNTHandleNAND { - ARCHandle ArcHandle; // 0x00 - s32 FileDescriptor; // 0x1C - MEMAllocator* allocator; // 0x20 + ARCHandle ArcHandle; // 0x00 + s32 FileDescriptor; // 0x1C + MEMAllocator* allocator; // 0x20 } CNTHandleNAND; typedef struct CNTFileInfoNAND { - CNTHandleNAND* CntHandle; // 0x00 - u32 startOffset; // 0x04 - u32 length; // 0x08 - s32 readOffset; // 0x0C + CNTHandleNAND* CntHandle; // 0x00 + u32 startOffset; // 0x04 + u32 length; // 0x08 + s32 readOffset; // 0x0C } CNTFileInfoNAND; typedef struct CNTHandleDVD { - u32 index; // 0x00 - s32 rootDir; // 0x04 - s32 currDir; // 0x08 - u8 reserved[24]; // 0x0C + u32 index; // 0x00 + s32 rootDir; // 0x04 + s32 currDir; // 0x08 + u8 reserved[24]; // 0x0C } CNTHandleDVD; typedef struct CNTFileInfoDVD { - DVDFileInfo fileInfo; // 0x00 - s32 readOffset; // 0x3C + DVDFileInfo fileInfo; // 0x00 + s32 readOffset; // 0x3C } CNTFileInfoDVD; typedef s32 CNTError; /* NAND */ -CNTError contentInitHandleNAND(u32 contentId, CNTHandleNAND* cntHandle, MEMAllocator* allocator); -CNTError contentConvertPathToEntrynumNAND(CNTHandleNAND* cntHandle, const char* path); -CNTError contentOpenNAND(CNTHandleNAND* cntHandle, const char* path, CNTFileInfoNAND* cntFileInfo); -CNTError contentFastOpenNAND(CNTHandleNAND* cntHandle, s32 entryNum, CNTFileInfoNAND* cntFileInfo); -BOOL contentOpenDirNAND(CNTHandleNAND* cntFileInfo, const char* path, ARCDir* dir); -CNTError contentReadNAND(CNTFileInfoNAND* cntFileInfo, void* buffer, u32 length, s32 offset); -s32 contentGetLengthNAND(CNTFileInfoNAND* cntFileInfo); -CNTError contentSeekNAND(CNTFileInfoNAND* cntFileInfo, s32 offset, u32 whence); -CNTError contentCloseNAND(CNTFileInfoNAND* cntFileInfo); -CNTError contentReleaseHandleNAND(CNTHandleNAND* cntFileInfo); +CNTError contentInitHandleNAND(u32 contentId, CNTHandleNAND* cntHandle, MEMAllocator* allocator); +CNTError contentConvertPathToEntrynumNAND(CNTHandleNAND* cntHandle, const char* path); +CNTError contentOpenNAND(CNTHandleNAND* cntHandle, const char* path, CNTFileInfoNAND* cntFileInfo); +CNTError contentFastOpenNAND(CNTHandleNAND* cntHandle, s32 entryNum, CNTFileInfoNAND* cntFileInfo); +BOOL contentOpenDirNAND(CNTHandleNAND* cntFileInfo, const char* path, ARCDir* dir); +CNTError contentReadNAND(CNTFileInfoNAND* cntFileInfo, void* buffer, u32 length, s32 offset); +s32 contentGetLengthNAND(CNTFileInfoNAND* cntFileInfo); +CNTError contentSeekNAND(CNTFileInfoNAND* cntFileInfo, s32 offset, u32 whence); +CNTError contentCloseNAND(CNTFileInfoNAND* cntFileInfo); +CNTError contentReleaseHandleNAND(CNTHandleNAND* cntFileInfo); /* DVD */ -s32 contentOpenDVD(CNTHandleDVD* cntHandle, const char* path, CNTFileInfoDVD* cntFileInfo); -CNTError contentReadDVD(CNTFileInfoDVD* cntFileInfo, void* buffer, u32 length, s32 offset); -CNTError contentSeekDVD(CNTFileInfoDVD* cntFileInfo, s32 offset, u32 whence); -CNTError contentCloseDVD(CNTFileInfoDVD* cntFileInfo); +s32 contentOpenDVD(CNTHandleDVD* cntHandle, const char* path, CNTFileInfoDVD* cntFileInfo); +CNTError contentReadDVD(CNTFileInfoDVD* cntFileInfo, void* buffer, u32 length, s32 offset); +CNTError contentSeekDVD(CNTFileInfoDVD* cntFileInfo, s32 offset, u32 whence); +CNTError contentCloseDVD(CNTFileInfoDVD* cntFileInfo); enum { - CNT_RESULT_OK = 0, - CNT_RESULT_MAXFD = -5000, - CNT_RESULT_ALLOC_FAILED = -5001, - CNT_RESULT_OPEN_ERR = -5002, - CNT_RESULT_READ_ERR = -5003, - CNT_RESULT_SEEK_ERR = -5004, - CNT_RESULT_CLOSE_ERR = -5005, + CNT_RESULT_OK = 0, + CNT_RESULT_MAXFD = -5000, + CNT_RESULT_ALLOC_FAILED = -5001, + CNT_RESULT_OPEN_ERR = -5002, + CNT_RESULT_READ_ERR = -5003, + CNT_RESULT_SEEK_ERR = -5004, + CNT_RESULT_CLOSE_ERR = -5005, CNT_RESULT_NOT_ENOUGH_SPACE = -5007, - CNT_RESULT_OUT_OF_MEMORY = -5008, - CNT_RESULT_INVALID = -5009, - CNT_RESULT_ACCESS = -5010, - CNT_RESULT_CORRUPT = -5011, - CNT_RESULT_ECC_CRIT = -5012, - CNT_RESULT_AUTHENTICATION = -5013, - CNT_RESULT_UNKNOWN = -5063, + CNT_RESULT_OUT_OF_MEMORY = -5008, + CNT_RESULT_INVALID = -5009, + CNT_RESULT_ACCESS = -5010, + CNT_RESULT_CORRUPT = -5011, + CNT_RESULT_ECC_CRIT = -5012, + CNT_RESULT_AUTHENTICATION = -5013, + CNT_RESULT_UNKNOWN = -5063, - CNT_RESULT_SHUTDOWN = -5127 + CNT_RESULT_SHUTDOWN = -5127 }; enum { @@ -84,4 +84,4 @@ enum { } #endif -#endif // REVOLUTION_DSP_H +#endif // REVOLUTION_DSP_H diff --git a/libs/RVL_SDK/include/revolution/cntcache.h b/libs/RVL_SDK/include/revolution/cntcache.h index 9a25bb06..eab8810f 100644 --- a/libs/RVL_SDK/include/revolution/cntcache.h +++ b/libs/RVL_SDK/include/revolution/cntcache.h @@ -7,8 +7,8 @@ extern "C" { #endif -void CNTCACHEInit(int unk0, int unk1); -void CNTCACHEClear(); +void CNTCACHEInit(int unk0, int unk1); +void CNTCACHEClear(); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/revolution/cx.h b/libs/RVL_SDK/include/revolution/cx.h index 806729f1..1828099e 100644 --- a/libs/RVL_SDK/include/revolution/cx.h +++ b/libs/RVL_SDK/include/revolution/cx.h @@ -3,18 +3,18 @@ #include -#define CX_COMPRESSION_TYPE_LZ 0x10 /* Lempel-Ziv encoded */ -#define CX_COMPRESSION_TYPE_HUFFMAN 0x20 /* Huffman encoded */ -#define CX_COMPRESSION_TYPE_RUN_LENGTH 0x30 /* Runlength encoded */ +#define CX_COMPRESSION_TYPE_LZ 0x10 /* Lempel-Ziv encoded */ +#define CX_COMPRESSION_TYPE_HUFFMAN 0x20 /* Huffman encoded */ +#define CX_COMPRESSION_TYPE_RUN_LENGTH 0x30 /* Runlength encoded */ -#define CX_COMPRESSION_TYPE_MASK 0xF0 +#define CX_COMPRESSION_TYPE_MASK 0xF0 static inline int CXGetCompressionType(const void* data) { return *(u8*)data & CX_COMPRESSION_TYPE_MASK; } -#include #include #include +#include #endif // REVOLUTION_CX_H diff --git a/libs/RVL_SDK/include/revolution/cx/CXSecureUncompression.h b/libs/RVL_SDK/include/revolution/cx/CXSecureUncompression.h index e9dd9b85..da7de79d 100644 --- a/libs/RVL_SDK/include/revolution/cx/CXSecureUncompression.h +++ b/libs/RVL_SDK/include/revolution/cx/CXSecureUncompression.h @@ -8,19 +8,19 @@ extern "C" { #include typedef s32 CXSecureResult; -#define CX_SECURE_ERR_OK 0 -#define CX_SECURE_ERR_BAD_FILE_TYPE -1 -#define CX_SECURE_ERR_BUFFER_TOO_SMALL -2 -#define CX_SECURE_ERR_BUFFER_TOO_LARGE -3 -#define CX_SECURE_ERR_BAD_FILE_SIZE -4 -#define CX_SECURE_ERR_BAD_FILE_TABLE -5 +#define CX_SECURE_ERR_OK 0 +#define CX_SECURE_ERR_BAD_FILE_TYPE -1 +#define CX_SECURE_ERR_BUFFER_TOO_SMALL -2 +#define CX_SECURE_ERR_BUFFER_TOO_LARGE -3 +#define CX_SECURE_ERR_BAD_FILE_SIZE -4 +#define CX_SECURE_ERR_BAD_FILE_TABLE -5 -CXSecureResult CXSecureUncompressRL(const void* src, u32 length, void* dst); -CXSecureResult CXSecureUncompressLZ(const void* src, u32 length, void* dst); -CXSecureResult CXSecureUncompressHuffman(const void* src, u32 length, void* dst); +CXSecureResult CXSecureUncompressRL(const void* src, u32 length, void* dst); +CXSecureResult CXSecureUncompressLZ(const void* src, u32 length, void* dst); +CXSecureResult CXSecureUncompressHuffman(const void* src, u32 length, void* dst); #ifdef __cplusplus } #endif -#endif // REVOLUTION_CX_SECURE_UNCOMPRESS_H +#endif // REVOLUTION_CX_SECURE_UNCOMPRESS_H diff --git a/libs/RVL_SDK/include/revolution/cx/CXStreamingUncompression.h b/libs/RVL_SDK/include/revolution/cx/CXStreamingUncompression.h index 74a27d10..9afabd2b 100644 --- a/libs/RVL_SDK/include/revolution/cx/CXStreamingUncompression.h +++ b/libs/RVL_SDK/include/revolution/cx/CXStreamingUncompression.h @@ -8,61 +8,61 @@ extern "C" { #include typedef s32 CXStreamingResult; -#define CX_STREAMING_ERR_OK 0 -#define CX_STREAMING_ERR_BAD_FILE_TYPE -1 -#define CX_STREAMING_ERR_BUFFER_TOO_SMALL -2 -#define CX_STREAMING_ERR_BUFFER_TOO_LARGE -3 -#define CX_STREAMING_ERR_BAD_FILE_SIZE -4 -#define CX_STREAMING_ERR_BAD_FILE_TABLE -5 +#define CX_STREAMING_ERR_OK 0 +#define CX_STREAMING_ERR_BAD_FILE_TYPE -1 +#define CX_STREAMING_ERR_BUFFER_TOO_SMALL -2 +#define CX_STREAMING_ERR_BUFFER_TOO_LARGE -3 +#define CX_STREAMING_ERR_BAD_FILE_SIZE -4 +#define CX_STREAMING_ERR_BAD_FILE_TABLE -5 typedef struct CXUncompContextRL { - u8* unk_0x00; // 0x00 - int unk_0x04; // 0x04 - int unk_0x08; // 0x08 - u16 unk_0x0c; // 0x0C - u8 unk_0x0e; // 0x0E - u8 unk_0x0f; // 0x0F + u8* unk_0x00; // 0x00 + int unk_0x04; // 0x04 + int unk_0x08; // 0x08 + u16 unk_0x0c; // 0x0C + u8 unk_0x0e; // 0x0E + u8 unk_0x0f; // 0x0F } CXUncompContextRL; typedef struct CXUncompContextLZ { - u8* unk_0x00; // 0x00 - int unk_0x04; // 0x04 - int unk_0x08; // 0x08 - int unk_0x0c; // 0x0C - u8 unk_0x10; // 0x10 - u8 unk_0x11; // 0x11 - u8 unk_0x12; // 0x12 - u8 unk_0x13; // 0x13 - u8 unk_0x14; // 0x14 - u8 padding[3]; + u8* unk_0x00; // 0x00 + int unk_0x04; // 0x04 + int unk_0x08; // 0x08 + int unk_0x0c; // 0x0C + u8 unk_0x10; // 0x10 + u8 unk_0x11; // 0x11 + u8 unk_0x12; // 0x12 + u8 unk_0x13; // 0x13 + u8 unk_0x14; // 0x14 + u8 padding[3]; } CXUncompContextLZ; typedef struct CXUncompContextHuffman { - int* unk_0x00; // 0x00 - int unk_0x04; // 0x04 - int unk_0x08; // 0x08 - u8* unk_0x0c; // 0x0C - u32 unk_0x10; // 0x10 - u32 unk_0x14; // 0x14 - s16 unk_0x18; // 0x18 - u8 unk_0x1a; // 0x1A - u8 unk_0x1b; // 0x1B - u8 unk_0x1c; // 0x1C - u8 unk_0x1d; // 0x1D - u8 padding[2]; - u8 unk_0x20[2]; // 0x20 + int* unk_0x00; // 0x00 + int unk_0x04; // 0x04 + int unk_0x08; // 0x08 + u8* unk_0x0c; // 0x0C + u32 unk_0x10; // 0x10 + u32 unk_0x14; // 0x14 + s16 unk_0x18; // 0x18 + u8 unk_0x1a; // 0x1A + u8 unk_0x1b; // 0x1B + u8 unk_0x1c; // 0x1C + u8 unk_0x1d; // 0x1D + u8 padding[2]; + u8 unk_0x20[2]; // 0x20 } CXUncompContextHuffman; -void CXInitUncompContextRL(CXUncompContextRL* context, u8* param_2); -void CXInitUncompContextLZ(CXUncompContextLZ* context, u8* param_2); -void CXInitUncompContextHuffman(CXUncompContextHuffman* context, int* param_2); +void CXInitUncompContextRL(CXUncompContextRL* context, u8* param_2); +void CXInitUncompContextLZ(CXUncompContextLZ* context, u8* param_2); +void CXInitUncompContextHuffman(CXUncompContextHuffman* context, int* param_2); -CXStreamingResult CXReadUncompRL(CXUncompContextRL* context, const void* src, u32 size); -CXStreamingResult CXReadUncompLZ(CXUncompContextLZ* context, const void* src, u32 size); -CXStreamingResult CXReadUncompHuffman(CXUncompContextHuffman* context, const void* src, u32 size); +CXStreamingResult CXReadUncompRL(CXUncompContextRL* context, const void* src, u32 size); +CXStreamingResult CXReadUncompLZ(CXUncompContextLZ* context, const void* src, u32 size); +CXStreamingResult CXReadUncompHuffman(CXUncompContextHuffman* context, const void* src, u32 size); #ifdef __cplusplus } #endif -#endif // REVOLUTION_CX_STREAMING_UNCOMPRESS_H +#endif // REVOLUTION_CX_STREAMING_UNCOMPRESS_H diff --git a/libs/RVL_SDK/include/revolution/cx/CXUncompression.h b/libs/RVL_SDK/include/revolution/cx/CXUncompression.h index e503ef14..bcb03cbb 100644 --- a/libs/RVL_SDK/include/revolution/cx/CXUncompression.h +++ b/libs/RVL_SDK/include/revolution/cx/CXUncompression.h @@ -7,11 +7,11 @@ extern "C" { #include -u32 CXGetUncompressedSize(const void* src); -void CXUncompressLZ(const void* src, void* dst); +u32 CXGetUncompressedSize(const void* src); +void CXUncompressLZ(const void* src, void* dst); #ifdef __cplusplus } #endif -#endif // REVOLUTION_CX_UNCOMPRESS_H +#endif // REVOLUTION_CX_UNCOMPRESS_H diff --git a/libs/RVL_SDK/include/revolution/dsp.h b/libs/RVL_SDK/include/revolution/dsp.h index 11fd21c1..dda23f4a 100644 --- a/libs/RVL_SDK/include/revolution/dsp.h +++ b/libs/RVL_SDK/include/revolution/dsp.h @@ -1,8 +1,8 @@ #ifndef REVOLUTION_DSP_H #define REVOLUTION_DSP_H -#include #include +#include #ifdef __cplusplus extern "C" { @@ -11,32 +11,32 @@ extern "C" { typedef void (*DSPCallback)(void*); typedef struct STRUCT_DSP_TASK DSPTaskInfo; -struct STRUCT_DSP_TASK { - vu32 state; // 0x00 - vu32 priority; // 0x04 - vu32 flags; // 0x08 +struct STRUCT_DSP_TASK { + vu32 state; // 0x00 + vu32 priority; // 0x04 + vu32 flags; // 0x08 - u16* iram_mmem_addr; // 0x0C - u32 iram_length; // 0x10 - u32 iram_addr; // 0x14 + u16* iram_mmem_addr; // 0x0C + u32 iram_length; // 0x10 + u32 iram_addr; // 0x14 - u16* dram_mmem_addr; // 0x18 - u32 dram_length; // 0x1C - u32 dram_addr; // 0x20 + u16* dram_mmem_addr; // 0x18 + u32 dram_length; // 0x1C + u32 dram_addr; // 0x20 - u16 dsp_init_vector; // 0x24 - u16 dsp_resume_vector; // 0x26 + u16 dsp_init_vector; // 0x24 + u16 dsp_resume_vector; // 0x26 - DSPCallback init_cb; // 0x28 - DSPCallback res_cb; // 0x2C - DSPCallback done_cb; // 0x30 - DSPCallback req_cb; // 0x34 + DSPCallback init_cb; // 0x28 + DSPCallback res_cb; // 0x2C + DSPCallback done_cb; // 0x30 + DSPCallback req_cb; // 0x34 - DSPTaskInfo* next; // 0x38 - DSPTaskInfo* prev; // 0x3C + DSPTaskInfo* next; // 0x38 + DSPTaskInfo* prev; // 0x3C - OSTime t_context; // 0x40 - OSTime t_task; // 0x48 + OSTime t_context; // 0x40 + OSTime t_task; // 0x48 }; enum { @@ -44,20 +44,20 @@ enum { DSP_TASK_CANCELED = (1 << 1), }; -u32 DSPCheckMailToDSP(); -u32 DSPCheckMailFromDSP(); -u32 DSPReadMailFromDSP(); -void DSPSendMailToDSP(u32 mail); +u32 DSPCheckMailToDSP(); +u32 DSPCheckMailFromDSP(); +u32 DSPReadMailFromDSP(); +void DSPSendMailToDSP(u32 mail); -void DSPInit(); -BOOL DSPCheckInit(); +void DSPInit(); +BOOL DSPCheckInit(); -DSPTaskInfo* DSPAddTask(DSPTaskInfo* task); -DSPTaskInfo* DSPCancelTask(DSPTaskInfo* task); -DSPTaskInfo* DSPAssertTask(DSPTaskInfo* task); +DSPTaskInfo* DSPAddTask(DSPTaskInfo* task); +DSPTaskInfo* DSPCancelTask(DSPTaskInfo* task); +DSPTaskInfo* DSPAssertTask(DSPTaskInfo* task); #ifdef __cplusplus } #endif -#endif // REVOLUTION_DSP_H +#endif // REVOLUTION_DSP_H diff --git a/libs/RVL_SDK/include/revolution/dvd.h b/libs/RVL_SDK/include/revolution/dvd.h index 38755c29..86a0dcbe 100644 --- a/libs/RVL_SDK/include/revolution/dvd.h +++ b/libs/RVL_SDK/include/revolution/dvd.h @@ -5,8 +5,8 @@ #include -#include #include +#include #include @@ -49,42 +49,42 @@ enum { }; typedef struct DVDDiskID { - char gameName[4]; // 0x00 - char company[2]; // 0x04 + char gameName[4]; // 0x00 + char company[2]; // 0x04 - u8 diskNumber; // 0x06 - u8 gameVersion; // 0x07 + u8 diskNumber; // 0x06 + u8 gameVersion; // 0x07 - u8 streaming; // 0x08 - u8 streamingBufSize; // 0x09 + u8 streaming; // 0x08 + u8 streamingBufSize; // 0x09 - u8 padding[14]; // 0x0A + u8 padding[14]; // 0x0A - u32 rvlMagic; // 0x18 - u32 gcMagic; // 0x1C + u32 rvlMagic; // 0x18 + u32 gcMagic; // 0x1C } DVDDiskID; typedef struct DVDCommandBlock DVDCommandBlock; typedef void (*DVDCommandCallback)(s32 result, DVDCommandBlock* block); struct DVDCommandBlock { - DVDCommandBlock* next; // 0x00 - DVDCommandBlock* prev; // 0x04 + DVDCommandBlock* next; // 0x00 + DVDCommandBlock* prev; // 0x04 - u32 command; // 0x08 - s32 state; // 0x0C + u32 command; // 0x08 + s32 state; // 0x0C - u32 offset; // 0x10 - u32 length; // 0x14 - void* addr; // 0x18 + u32 offset; // 0x10 + u32 length; // 0x14 + void* addr; // 0x18 - u32 currTransferSize; // 0x1C - u32 transferredSize; // 0x20 + u32 currTransferSize; // 0x1C + u32 transferredSize; // 0x20 - DVDDiskID* id; // 0x24 - DVDCommandCallback callback; // 0x28 + DVDDiskID* id; // 0x24 + DVDCommandCallback callback; // 0x28 - void* userData; // 0x2C + void* userData; // 0x2C }; typedef struct DVDFileInfo DVDFileInfo; @@ -93,110 +93,110 @@ typedef void (*DVDLowCallback)(u32 intType); typedef void (*DVDOptionalCommandChecker)(DVDCommandBlock* block, void (*cb)(u32)); struct DVDFileInfo { - DVDCommandBlock cb; // 0x00 - u32 startAddr; // 0x30 - u32 length; // 0x34 - DVDCallback callback; // 0x38 + DVDCommandBlock cb; // 0x00 + u32 startAddr; // 0x30 + u32 length; // 0x34 + DVDCallback callback; // 0x38 }; typedef struct DVDDir { - u32 entryNum; // 0x00 - u32 location; // 0x04 - u32 next; // 0x08 + u32 entryNum; // 0x00 + u32 location; // 0x04 + u32 next; // 0x08 } DVDDir; typedef struct DVDDirEntry { - u32 entryNum; // 0x00 - BOOL isDir; // 0x04 - char* name; // 0x08 + u32 entryNum; // 0x00 + BOOL isDir; // 0x04 + char* name; // 0x08 } DVDDirEntry; typedef struct DVDDriveInfo { u16 revisionLevel; // 0x00 u16 deviceCode; // 0x02 u32 releaseDate; // 0x04 - u8 pad_0x08[0x18]; + u8 pad_0x08[0x18]; } DVDDriveInfo; typedef struct DVDCommandInfo { - u32 command; // 0x00 + u32 command; // 0x00 - u32 offset; // 0x04 - u32 length; // 0x08 + u32 offset; // 0x04 + u32 length; // 0x08 - u32 intType; // 0x0C - u32 tick; // 0x10 + u32 intType; // 0x0C + u32 tick; // 0x10 } DVDCommandInfo; #define DVD_ERROR_CMD_MAX 5 typedef struct DVDErrorInfo { - char gameName[4]; // 0x00 - u8 diskNumber; // 0x04 - u8 gameVersion; // 0x05 + char gameName[4]; // 0x00 + u8 diskNumber; // 0x04 + u8 gameVersion; // 0x05 - u8 reserved0[2]; // 0x06 + u8 reserved0[2]; // 0x06 - u32 error; // 0x08 - u32 dateTime; // 0x0C - u32 status; // 0x10 + u32 error; // 0x08 + u32 dateTime; // 0x0C + u32 status; // 0x10 - u8 reserved1[4]; // 0x14 + u8 reserved1[4]; // 0x14 - u32 nextOffset; // 0x18 - DVDCommandInfo lastCommand[DVD_ERROR_CMD_MAX]; // 0x1C + u32 nextOffset; // 0x18 + DVDCommandInfo lastCommand[DVD_ERROR_CMD_MAX]; // 0x1C } DVDErrorInfo; -void DVDInit(); +void DVDInit(); -BOOL DVDReadAbsAsyncPrio(DVDCommandBlock* block, void* addr, s32 length, u32 offset, DVDCommandCallback callback, s32 prio); -BOOL DVDReadAbsAsyncForBS(DVDCommandBlock* block, void* addr, s32 length, u32 offset, DVDCommandCallback callback, s32 prio); +BOOL DVDReadAbsAsyncPrio(DVDCommandBlock* block, void* addr, s32 length, u32 offset, DVDCommandCallback callback, s32 prio); +BOOL DVDReadAbsAsyncForBS(DVDCommandBlock* block, void* addr, s32 length, u32 offset, DVDCommandCallback callback, s32 prio); -BOOL DVDReadDiskID(DVDCommandBlock* block, DVDDiskID* diskID, DVDCommandCallback callback); -BOOL DVDCompareDiskID(const DVDDiskID* id1, const DVDDiskID* id2); +BOOL DVDReadDiskID(DVDCommandBlock* block, DVDDiskID* diskID, DVDCommandCallback callback); +BOOL DVDCompareDiskID(const DVDDiskID* id1, const DVDDiskID* id2); -BOOL DVDChangeDiskAsyncForBS(DVDCommandBlock* block, DVDCommandCallback callback); +BOOL DVDChangeDiskAsyncForBS(DVDCommandBlock* block, DVDCommandCallback callback); -BOOL DVDInquiryAsync(DVDCommandBlock* block, DVDDriveInfo* info, DVDCommandCallback callback); +BOOL DVDInquiryAsync(DVDCommandBlock* block, DVDDriveInfo* info, DVDCommandCallback callback); -BOOL DVDResetAsync(DVDCommandBlock* block, DVDCommandCallback callback); -BOOL DVDResetRequired(); +BOOL DVDResetAsync(DVDCommandBlock* block, DVDCommandCallback callback); +BOOL DVDResetRequired(); -s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block); -s32 DVDGetDriveStatus(); +s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block); +s32 DVDGetDriveStatus(); -void DVDPause(); -void DVDResume(); +void DVDPause(); +void DVDResume(); -s32 DVDCancel(DVDCommandBlock* block); -BOOL DVDCancelAsync(DVDCommandBlock* block, DVDCommandCallback callback); -BOOL DVDCancelAllAsync(DVDCommandCallback callback); +s32 DVDCancel(DVDCommandBlock* block); +BOOL DVDCancelAsync(DVDCommandBlock* block, DVDCommandCallback callback); +BOOL DVDCancelAllAsync(DVDCommandCallback callback); -DVDDiskID* DVDGetCurrentDiskID(); +DVDDiskID* DVDGetCurrentDiskID(); /* Filesystem stuff */ -s32 DVDConvertPathToEntrynum(const char* pathPtr); -BOOL DVDEntrynumIsDir(s32 entry); +s32 DVDConvertPathToEntrynum(const char* pathPtr); +BOOL DVDEntrynumIsDir(s32 entry); -BOOL DVDFastOpen(s32 entry, DVDFileInfo* fileInfo); -BOOL DVDOpen(const char* fileName, DVDFileInfo* fileInfo); -BOOL DVDReadAsyncPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset, DVDCallback callback, s32 prio); -s32 DVDReadPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset, s32 prio); -BOOL DVDClose(DVDFileInfo* fileInfo); +BOOL DVDFastOpen(s32 entry, DVDFileInfo* fileInfo); +BOOL DVDOpen(const char* fileName, DVDFileInfo* fileInfo); +BOOL DVDReadAsyncPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset, DVDCallback callback, s32 prio); +s32 DVDReadPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset, s32 prio); +BOOL DVDClose(DVDFileInfo* fileInfo); -BOOL DVDOpenDir(const char* dirName, DVDDir* dir); -BOOL DVDReadDir(DVDDir* dir, DVDDirEntry* dirent); -BOOL DVDCloseDir(DVDDir* dir); +BOOL DVDOpenDir(const char* dirName, DVDDir* dir); +BOOL DVDReadDir(DVDDir* dir, DVDDirEntry* dirent); +BOOL DVDCloseDir(DVDDir* dir); -void* DVDGetFSTLocation(); +void* DVDGetFSTLocation(); /* Fatal stuff*/ -BOOL DVDSetAutoFatalMessaging(BOOL enable); +BOOL DVDSetAutoFatalMessaging(BOOL enable); #ifdef __cplusplus } #endif -#endif // REVOLUTION_DVD_H +#endif // REVOLUTION_DVD_H diff --git a/libs/RVL_SDK/include/revolution/enc.h b/libs/RVL_SDK/include/revolution/enc.h index d6dc1efc..601a0dad 100644 --- a/libs/RVL_SDK/include/revolution/enc.h +++ b/libs/RVL_SDK/include/revolution/enc.h @@ -1,82 +1,82 @@ #ifndef REVOLUTION_ENC_H #define REVOLUTION_ENC_H -#include #include +#include #ifdef __cplusplus extern "C" { #endif -ENCResult ENCInitContext(ENCContext* context); -ENCResult ENCDuplicateContext(ENCContext* dst, const ENCContext* src); -ENCResult ENCSetExternalEncoding(ENCContext* context, const char* name); -ENCResult ENCGetExternalEncoding(ENCContext* context, char* name); -ENCResult ENCSetBreakType(ENCContext* context, ENCBreakType breakType); -ENCResult ENCSetAlternativeCharacter(ENCContext* context, u16 nomap, u16 invalid); -ENCResult ENCGetExternalCharacterWidth(ENCContext* context, u32* width); -ENCResult ENCConvertToInternalEncoding(ENCContext* context, u16* dst, s32* dstSize, const void* src, s32* srcSize); -ENCResult ENCConvertFromInternalEncoding(ENCContext* context, void* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCCheckEncoding(int* index, const char* names[], int num, const u16* src, u32 srcSize); -ENCResult ENCIs7BitEncoding(BOOL* is7Bit, const char* name); +ENCResult ENCInitContext(ENCContext* context); +ENCResult ENCDuplicateContext(ENCContext* dst, const ENCContext* src); +ENCResult ENCSetExternalEncoding(ENCContext* context, const char* name); +ENCResult ENCGetExternalEncoding(ENCContext* context, char* name); +ENCResult ENCSetBreakType(ENCContext* context, ENCBreakType breakType); +ENCResult ENCSetAlternativeCharacter(ENCContext* context, u16 nomap, u16 invalid); +ENCResult ENCGetExternalCharacterWidth(ENCContext* context, u32* width); +ENCResult ENCConvertToInternalEncoding(ENCContext* context, u16* dst, s32* dstSize, const void* src, s32* srcSize); +ENCResult ENCConvertFromInternalEncoding(ENCContext* context, void* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCCheckEncoding(int* index, const char* names[], int num, const u16* src, u32 srcSize); +ENCResult ENCIs7BitEncoding(BOOL* is7Bit, const char* name); -ENCResult ENCGetNextCharacterWidth(ENCContext* context, const void* src, u32* width); +ENCResult ENCGetNextCharacterWidth(ENCContext* context, const void* src, u32* width); -ENCResult ENCConvertStringUnicodeToAscii(u8* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringAsciiToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringUtf32ToUtf16(u16* dst, s32* dstSize, const u32* src, s32* srcSize); -ENCResult ENCConvertStringUtf16ToUtf32(u32* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringUtf32ToUtf8(u8* dst, s32* dstSize, const u32* src, s32* srcSize); -ENCResult ENCConvertStringUtf8ToUtf32(u32* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringUtf16ToUtf8(u8* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringUtf8ToUtf16(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringUtf16ToUtf16(u16* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringUtf16LEToUtf16BE(u16* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringUtf7ToUtf16(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUnicodeToAscii(u8* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringAsciiToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUtf32ToUtf16(u16* dst, s32* dstSize, const u32* src, s32* srcSize); +ENCResult ENCConvertStringUtf16ToUtf32(u32* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringUtf32ToUtf8(u8* dst, s32* dstSize, const u32* src, s32* srcSize); +ENCResult ENCConvertStringUtf8ToUtf32(u32* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUtf16ToUtf8(u8* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringUtf8ToUtf16(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUtf16ToUtf16(u16* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringUtf16LEToUtf16BE(u16* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringUtf7ToUtf16(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCSetUnicodeBOM(u16* dst, s32 dstSize); -ENCResult ENCSetUnicodeBOM32(u32* dst, s32 dstSize); -ENCResult ENCSetUnicodeBOM16(u16* dst, s32 dstSize); -ENCResult ENCSetUnicodeBOM8(u8* dst, s32 dstSize); +ENCResult ENCSetUnicodeBOM(u16* dst, s32 dstSize); +ENCResult ENCSetUnicodeBOM32(u32* dst, s32 dstSize); +ENCResult ENCSetUnicodeBOM16(u16* dst, s32 dstSize); +ENCResult ENCSetUnicodeBOM8(u8* dst, s32 dstSize); -ENCResult ENCConvertStringSjisToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringUnicodeToSjis(u8* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringJisToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringUnicodeToJis(u8* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringJisToSjis(u8* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringSjisToJis(u8* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringSjisToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUnicodeToSjis(u8* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringJisToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUnicodeToJis(u8* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringJisToSjis(u8* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringSjisToJis(u8* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringLatin1ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringUnicodeToLatin1(u8* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringLatin2ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringUnicodeToLatin2(u8* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringLatin3ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringUnicodeToLatin3(u8* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringGreekToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringUnicodeToGreek(u8* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringLatin6ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringUnicodeToLatin6(u8* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringLatin9ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringUnicodeToLatin9(u8* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringWin1252ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringUnicodeToWin1252(u8* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringLatin1ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUnicodeToLatin1(u8* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringLatin2ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUnicodeToLatin2(u8* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringLatin3ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUnicodeToLatin3(u8* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringGreekToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUnicodeToGreek(u8* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringLatin6ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUnicodeToLatin6(u8* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringLatin9ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUnicodeToLatin9(u8* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringWin1252ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUnicodeToWin1252(u8* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringWin1250ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringWin1253ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringMacromanToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringMacgreekToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringMacceToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringIbm850ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringIbm852ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringWin1250ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringWin1253ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringMacromanToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringMacgreekToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringMacceToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringIbm850ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringIbm852ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringGb2312ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringUnicodeToGb2312(u8* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringGb2312ToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUnicodeToGb2312(u8* dst, s32* dstSize, const u16* src, s32* srcSize); -ENCResult ENCConvertStringUhcToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); -ENCResult ENCConvertStringUnicodeToUhc(u8* dst, s32* dstSize, const u16* src, s32* srcSize); +ENCResult ENCConvertStringUhcToUnicode(u16* dst, s32* dstSize, const u8* src, s32* srcSize); +ENCResult ENCConvertStringUnicodeToUhc(u8* dst, s32* dstSize, const u16* src, s32* srcSize); #ifdef __cplusplus } #endif -#endif // REVOLUTION_ENC_H +#endif // REVOLUTION_ENC_H diff --git a/libs/RVL_SDK/include/revolution/enc/enctypes.h b/libs/RVL_SDK/include/revolution/enc/enctypes.h index 578981cb..1f82fba9 100644 --- a/libs/RVL_SDK/include/revolution/enc/enctypes.h +++ b/libs/RVL_SDK/include/revolution/enc/enctypes.h @@ -7,22 +7,22 @@ extern "C" { #endif -#define ENC_DST_INVALID (-1) -#define ENC_SRC_UNLIMITED (-1) +#define ENC_DST_INVALID (-1) +#define ENC_SRC_UNLIMITED (-1) -#define ENC_CHECK_ENCODING_NOT_FOUND (-1) -#define ENC_CHECK_ENCODING_MAX_NUM 24 +#define ENC_CHECK_ENCODING_NOT_FOUND (-1) +#define ENC_CHECK_ENCODING_MAX_NUM 24 typedef enum ENCResult { - ENC_OK = 0, - ENC_ERR_NO_BUF_LEFT = -1, - ENC_ERR_NO_MAP_RULE = -2, - ENC_ERR_INVALID_PARAM = -3, - ENC_ERR_INVALID_FORMAT = -4, - ENC_ERR_UNKNOWN_ENCODING = -5, - ENC_ERR_UNSUPPORTED = -6, + ENC_OK = 0, + ENC_ERR_NO_BUF_LEFT = -1, + ENC_ERR_NO_MAP_RULE = -2, + ENC_ERR_INVALID_PARAM = -3, + ENC_ERR_INVALID_FORMAT = -4, + ENC_ERR_UNKNOWN_ENCODING = -5, + ENC_ERR_UNSUPPORTED = -6, - ENC_ERR_NOT_LOADED = -7, + ENC_ERR_NOT_LOADED = -7, } ENCResult; typedef enum ENCEncoding { @@ -60,21 +60,22 @@ typedef enum ENCEncoding { ENC_MAX_ENCODING - /* Likely ERRATUM: ENC_MAX_ENCODING (or whatever the original was called) - * was very likely set to 24 instead of 26, judging from the bounds checks - * in the encconvert.c functions (x <= 0 || x >= 24). This is most apparent - * in ENCGetNextCharacterWidth, where there is one case in the switch block - * that cannot be reached because of the bounds check: ENC_ENCODING_IBM850 - * (25). Judging from the placement of the next two cases, - * ENC_ENCODING_EUC_KR (14) and ENC_ENCODING_GB2312 (15), these two - * encodings may have been added after the rest, and ENC_MAX_ENCODING was - * not updated accordingly. They were most likely put in the middle of the - * enum because that is the end of the list of encodings that you are able - * to convert to from the internal encoding. - * - * Also, the bounds check is supposed to be > 24, not >= 24. - */, - ENC_BAD_MAX_ENCODING = 24, + /* Likely ERRATUM: ENC_MAX_ENCODING (or whatever the original was called) + * was very likely set to 24 instead of 26, judging from the bounds checks + * in the encconvert.c functions (x <= 0 || x >= 24). This is most apparent + * in ENCGetNextCharacterWidth, where there is one case in the switch block + * that cannot be reached because of the bounds check: ENC_ENCODING_IBM850 + * (25). Judging from the placement of the next two cases, + * ENC_ENCODING_EUC_KR (14) and ENC_ENCODING_GB2312 (15), these two + * encodings may have been added after the rest, and ENC_MAX_ENCODING was + * not updated accordingly. They were most likely put in the middle of the + * enum because that is the end of the list of encodings that you are able + * to convert to from the internal encoding. + * + * Also, the bounds check is supposed to be > 24, not >= 24. + */ + , + ENC_BAD_MAX_ENCODING = 24, } ENCEncoding; typedef enum ENCBreakType { @@ -86,14 +87,14 @@ typedef enum ENCBreakType { } ENCBreakType; typedef s32 ENCMBState; -#define ENC_STATE_INITIAL 0 +#define ENC_STATE_INITIAL 0 typedef struct ENCContext { - ENCEncoding encoding; // 0x00 - ENCBreakType brtype; // 0x04 - ENCMBState state; // 0x08 - u16 nomap; // 0x0C - u16 invalid; // 0x0E + ENCEncoding encoding; // 0x00 + ENCBreakType brtype; // 0x04 + ENCMBState state; // 0x08 + u16 nomap; // 0x0C + u16 invalid; // 0x0E } ENCContext; #define ENC_INTERNAL_CHAR_WIDTH sizeof(u16) @@ -110,4 +111,4 @@ typedef struct ENCContext { } #endif -#endif // REVOLUTION_ENC_TYPES_H +#endif // REVOLUTION_ENC_TYPES_H diff --git a/libs/RVL_SDK/include/revolution/esp.h b/libs/RVL_SDK/include/revolution/esp.h index 98ed7f81..7a04d139 100644 --- a/libs/RVL_SDK/include/revolution/esp.h +++ b/libs/RVL_SDK/include/revolution/esp.h @@ -14,14 +14,14 @@ ESError ESP_CloseLib(); ESError ESP_LaunchTitle(ESTitleId titleId, ESTicketView* ticket); -ESFd ESP_OpenContentFile(ESContentId contentId); +ESFd ESP_OpenContentFile(ESContentId contentId); ESError ESP_ReadContentFile(ESFd fd, void* buffer, u32 size); ESError ESP_SeekContentFile(ESFd fd, s32 offset, u32 whence); ESError ESP_CloseContentFile(ESFd fd); ESError ESP_ListTitleContentsOnCard(ESTitleId titleId, ESContentId* contentIds, u32* numContents); -ESError ESP_GetTicketViews(ESTitleId titleId, ESTicketView* ticketViewList, u32* numTicketViews); +ESError ESP_GetTicketViews(ESTitleId titleId, ESTicketView* ticketViewList, u32* numTicketViews); ESError ESP_DiGetTicketView(void* ticket, ESTicketView* ticketView); @@ -37,4 +37,4 @@ ESError ESP_GetConsumption(ESTicketId ticketId, ESLpEntry* limitEntries, u32* nu } #endif -#endif // REVOLUTION_ESP_H +#endif // REVOLUTION_ESP_H diff --git a/libs/RVL_SDK/include/revolution/fa.h b/libs/RVL_SDK/include/revolution/fa.h index 52ea8d48..299c194b 100644 --- a/libs/RVL_SDK/include/revolution/fa.h +++ b/libs/RVL_SDK/include/revolution/fa.h @@ -29,8 +29,8 @@ FAError FAErrnum(); FAFILE* FACreate(const char* fileName, int unk); FAFILE* FAFopen(const char* fileName, const char* mode); -size_t FAFread(void* buffer, size_t size, size_t count, FAFILE* stream); -size_t FAFwrite(void* buffer, size_t size, size_t count, FAFILE* stream); +size_t FAFread(void* buffer, size_t size, size_t count, FAFILE* stream); +size_t FAFwrite(void* buffer, size_t size, size_t count, FAFILE* stream); FAError FAFseek(FAFILE* stream, s32 offset, int origin); FAError FAFinfo(FAFILE* stream, FAFileInfo* info); @@ -49,4 +49,4 @@ FAError FACreatedir(const char* dirName, s32 unk, FADta* dta); } #endif -#endif // REVOLUTION_FA_H +#endif // REVOLUTION_FA_H diff --git a/libs/RVL_SDK/include/revolution/fa/types.h b/libs/RVL_SDK/include/revolution/fa/types.h index 897fcc89..8ecf6cc2 100644 --- a/libs/RVL_SDK/include/revolution/fa/types.h +++ b/libs/RVL_SDK/include/revolution/fa/types.h @@ -7,33 +7,33 @@ extern "C" { #endif -typedef s32 FAError; +typedef s32 FAError; /* From VF ErrInfoTbl */ enum { - FA_ERR_SUCCESS = 0, // Success - FA_ERR_EPERM = 1, // "Operation is not possible" - FA_ERR_ENOENT = 2, // "No such file or directory" - FA_ERR_EIO = 5, // "I/O Error(Driver Error)" - FA_ERR_ENOEXEC = 8, // "Not Executable by internal" - FA_ERR_EBADF = 9, // "Bad file descripto" - FA_ERR_ENOMEM = 12, // "Not enough system memory" - FA_ERR_EACCES = 13, // "Permission denied" - FA_ERR_EBUSY = 16, // "Can not use system resouces" - FA_ERR_EEXIST = 17, // "File already exists" - FA_ERR_EISDIR = 21, // "find directory when file req" - FA_ERR_EINVAL = 22, // "Invalid argument" - FA_ERR_ENFILE = 23, // "Too many open files(system)" - FA_ERR_EMFILE = 24, // "Too many open files(user)" - FA_ERR_EFBIG = 27, // "Over file size limit(4GB-1)" - FA_ERR_ENOSPC = 28, // "Device out of space" - FA_ERR_ENOLCK = 46, // "Can not lock the file" - FA_ERR_ENOSYS = 88, // "Not implement function" - FA_ERR_ENOTEMPTY = 90, // "Directory is not empty" + FA_ERR_SUCCESS = 0, // Success + FA_ERR_EPERM = 1, // "Operation is not possible" + FA_ERR_ENOENT = 2, // "No such file or directory" + FA_ERR_EIO = 5, // "I/O Error(Driver Error)" + FA_ERR_ENOEXEC = 8, // "Not Executable by internal" + FA_ERR_EBADF = 9, // "Bad file descripto" + FA_ERR_ENOMEM = 12, // "Not enough system memory" + FA_ERR_EACCES = 13, // "Permission denied" + FA_ERR_EBUSY = 16, // "Can not use system resouces" + FA_ERR_EEXIST = 17, // "File already exists" + FA_ERR_EISDIR = 21, // "find directory when file req" + FA_ERR_EINVAL = 22, // "Invalid argument" + FA_ERR_ENFILE = 23, // "Too many open files(system)" + FA_ERR_EMFILE = 24, // "Too many open files(user)" + FA_ERR_EFBIG = 27, // "Over file size limit(4GB-1)" + FA_ERR_ENOSPC = 28, // "Device out of space" + FA_ERR_ENOLCK = 46, // "Can not lock the file" + FA_ERR_ENOSYS = 88, // "Not implement function" + FA_ERR_ENOTEMPTY = 90, // "Directory is not empty" - FA_ERR_EWRTPROTECT = 201, // Is Write Protected + FA_ERR_EWRTPROTECT = 201, // Is Write Protected - FA_ERR_SYSTEM = -1 // "system error(general error)" + FA_ERR_SYSTEM = -1 // "system error(general error)" }; enum { @@ -58,194 +58,194 @@ enum { #define FA_INSERTED(driveTable) (driveTable.stat & FA_STATUS_INSERTED) -typedef void FAFILE; -typedef void FADIR; -typedef void FAVOLUME; +typedef void FAFILE; +typedef void FADIR; +typedef void FAVOLUME; -typedef struct FADisk FADisk; -typedef struct FADiskInfo FADiskInfo; -typedef struct FAPartition FAPartition; +typedef struct FADisk FADisk; +typedef struct FADiskInfo FADiskInfo; +typedef struct FAPartition FAPartition; -typedef u8 FACacheBuf[512]; +typedef u8 FACacheBuf[512]; -typedef void (*FAInsertCallback)(s8); -typedef void (*FAEjectCallback)(s8); +typedef void (*FAInsertCallback)(s8); +typedef void (*FAEjectCallback)(s8); -typedef FAError (*FAInitDiskFunc)(FADisk*); -typedef FAError (*FAFinalizeDiskFunc)(FADisk*); -typedef FAError (*FAMountDiskFunc)(FADisk*); -typedef FAError (*FAUnmountDiskFunc)(FADisk*); -typedef FAError (*FAFormatDiskFunc)(FADisk*, u8*); -typedef FAError (*FAReadDiskFunc)(FADisk*, u8*, u32, u32, u32*); -typedef FAError (*FAWriteDiskFunc)(FADisk*, u8*, u32, u32, u32*); -typedef FAError (*FAGetDiskInfoFunc)(FADisk*, FADiskInfo*); +typedef FAError (*FAInitDiskFunc)(FADisk*); +typedef FAError (*FAFinalizeDiskFunc)(FADisk*); +typedef FAError (*FAMountDiskFunc)(FADisk*); +typedef FAError (*FAUnmountDiskFunc)(FADisk*); +typedef FAError (*FAFormatDiskFunc)(FADisk*, u8*); +typedef FAError (*FAReadDiskFunc)(FADisk*, u8*, u32, u32, u32*); +typedef FAError (*FAWriteDiskFunc)(FADisk*, u8*, u32, u32, u32*); +typedef FAError (*FAGetDiskInfoFunc)(FADisk*, FADiskInfo*); -typedef void (*FAInsertPartition)(FAPartition*); -typedef void (*FAEjectPartition)(FAPartition*); +typedef void (*FAInsertPartition)(FAPartition*); +typedef void (*FAEjectPartition)(FAPartition*); typedef struct FACachePage FACachePage; struct FACachePage { - u16 stat; // 0x00 - u16 option; // 0x02 - u8* buffer; // 0x04 + u16 stat; // 0x00 + u16 option; // 0x02 + u8* buffer; // 0x04 - u8* pBuf; // 0x08 - u8* pModSbuf; // 0x0C - u8* pModEbuf; // 0x10 + u8* pBuf; // 0x08 + u8* pModSbuf; // 0x0C + u8* pModEbuf; // 0x10 - u32 size; // 0x14 - u32 sector; // 0x18 - void* signature; // 0x1C + u32 size; // 0x14 + u32 sector; // 0x18 + void* signature; // 0x1C - FACachePage* pNext; // 0x20 - FACachePage* pPrev; // 0x24 + FACachePage* pNext; // 0x20 + FACachePage* pPrev; // 0x24 }; typedef struct FACacheSetting { - FACachePage* pages; // 0x00 - FACacheBuf* buffers; // 0x04 + FACachePage* pages; // 0x00 + FACacheBuf* buffers; // 0x04 - u16 numFatPages; // 0x08 - u16 numDataPages; // 0x0A + u16 numFatPages; // 0x08 + u16 numDataPages; // 0x0A - u32 numFatBufSize; // 0x0C - u32 numDataBufSize; // 0x10 + u32 numFatBufSize; // 0x0C + u32 numDataBufSize; // 0x10 } FACacheSetting; typedef struct FADevInf { - u32 cls; // 0x00 - u32 ecl; // 0x04 - u32 bps; // 0x08 - u32 spc; // 0x0C + u32 cls; // 0x00 + u32 ecl; // 0x04 + u32 bps; // 0x08 + u32 spc; // 0x0C } FADevInf; typedef struct FAFuncTbl { - FAInitDiskFunc init; // 0x00 - FAFinalizeDiskFunc finalize; // 0x04 + FAInitDiskFunc init; // 0x00 + FAFinalizeDiskFunc finalize; // 0x04 - FAMountDiskFunc mount; // 0x08 - FAUnmountDiskFunc unmount; // 0x0C + FAMountDiskFunc mount; // 0x08 + FAUnmountDiskFunc unmount; // 0x0C - FAFormatDiskFunc format; // 0x10 + FAFormatDiskFunc format; // 0x10 - FAReadDiskFunc physicalRead; // 0x14 - FAWriteDiskFunc physicalWrite; // 0x18 + FAReadDiskFunc physicalRead; // 0x14 + FAWriteDiskFunc physicalWrite; // 0x18 - FAGetDiskInfoFunc getDiskInfo; // 0x1C + FAGetDiskInfoFunc getDiskInfo; // 0x1C } FAFuncTbl; typedef struct FAPartFunc { - FAInsertCallback insert; // 0x00 - FAEjectCallback eject; // 0x04 + FAInsertCallback insert; // 0x00 + FAEjectCallback eject; // 0x04 } FAPartFunc; struct FAPartition { - u32 status; // 0x00 - FADisk* pDisk; // 0x04 - u32 partId; // 0x08 + u32 status; // 0x00 + FADisk* pDisk; // 0x04 + u32 partId; // 0x08 - u32 startSector; // 0x0C - u32 totalSector; // 0x10 + u32 startSector; // 0x0C + u32 totalSector; // 0x10 - s32 driverLastError; // 0x14 + s32 driverLastError; // 0x14 - int partSemId; // 0x18 + int partSemId; // 0x18 - FAVOLUME* pVol; // 0x1C + FAVOLUME* pVol; // 0x1C - FAPartFunc func; // 0x20 + FAPartFunc func; // 0x20 }; typedef struct FADiskTbl { - FAFuncTbl* pFunc; // 0x00 - u32 uiExt; // 0x04 + FAFuncTbl* pFunc; // 0x00 + u32 uiExt; // 0x04 } FADiskTbl; struct FADiskInfo { - u32 totalSectors; // 0x00 - u16 cylinders; // 0x04 + u32 totalSectors; // 0x00 + u16 cylinders; // 0x04 - u8 heads; // 0x06 + u8 heads; // 0x06 - u8 sectorsPerTrack; // 0x07 - u16 bytesPerSector; // 0x08 + u8 sectorsPerTrack; // 0x07 + u16 bytesPerSector; // 0x08 - u32 mediaAttr; // 0x0C + u32 mediaAttr; // 0x0C - void* formatParam; // 0x10 + void* formatParam; // 0x10 }; struct FADisk { - u32 status; // 0x00 + u32 status; // 0x00 - FADiskTbl diskTbl; // 0x04 + FADiskTbl diskTbl; // 0x04 - u16 attachPartCnt; // 0x0C - u16 mountPartCnt; // 0x0E + u16 attachPartCnt; // 0x0C + u16 mountPartCnt; // 0x0E - int diskSemId; // 0x10 - int drvSemId; // 0x14 + int diskSemId; // 0x10 + int drvSemId; // 0x14 - FADiskInfo diskInfo; // 0x18 - FAPartition* pCurPart; // 0x2C + FADiskInfo diskInfo; // 0x18 + FAPartition* pCurPart; // 0x2C }; typedef struct FADrvTbl { - FAPartition* pPart; // 0x00 - FACacheSetting* pCache; // 0x04 + FAPartition* pPart; // 0x00 + FACacheSetting* pCache; // 0x04 - s8 drive; // 0x08 - u8 stat; // 0x09 + s8 drive; // 0x08 + u8 stat; // 0x09 } FADrvTbl; typedef struct FAFileInfo { - u8 unknown[32]; + u8 unknown[32]; } FAFileInfo; /* Unsure; This were copied from VF */ typedef struct FADta { - FAFILE* file; // 0x00 - FADIR* dir; // 0x04 - FAVOLUME* vol; // 0x08 + FAFILE* file; // 0x00 + FADIR* dir; // 0x04 + FAVOLUME* vol; // 0x08 - u32 parentStartCluster; // 0x0C - u32 parentPos; // 0x10 + u32 parentStartCluster; // 0x0C + u32 parentPos; // 0x10 - u32 status; // 0x14 - u8 numEntryLFNs; // 0x18 - u8 ordinal; // 0x19 - u8 check_sum; // 0x1A - u8 attr; // 0x1B - char regExp[520]; // 0x1C + u32 status; // 0x14 + u8 numEntryLFNs; // 0x18 + u8 ordinal; // 0x19 + u8 check_sum; // 0x1A + u8 attr; // 0x1B + char regExp[520]; // 0x1C - u16 time; // 0x224 - u16 date; // 0x226 - u32 fileSize; // 0x228 - u8 attribute; // 0x22C - char fileName[13]; // 0x22D - char longName[520]; // 0x23A - s8 pad[2]; // 0x442 + u16 time; // 0x224 + u16 date; // 0x226 + u32 fileSize; // 0x228 + u8 attribute; // 0x22C + char fileName[13]; // 0x22D + char longName[520]; // 0x23A + s8 pad[2]; // 0x442 } FADta; /* Unsure; This were copied from VF */ typedef struct FAFileStat { - u32 size; // 0x00 + u32 size; // 0x00 - u32 accessDate; // 0x04 + u32 accessDate; // 0x04 - u32 updateTime; // 0x06 - u32 updateDate; // 0x08 + u32 updateTime; // 0x06 + u32 updateDate; // 0x08 - u32 createTime; // 0x0A - u32 createDate; // 0x0C + u32 createTime; // 0x0A + u32 createDate; // 0x0C - u32 compSec; // 0x0E + u32 compSec; // 0x0E - u8 stat; // 0x10 + u8 stat; // 0x10 } FAFileStat; #ifdef __cplusplus } #endif -#endif // REVOLUTION_FA_TYPES_H +#endif // REVOLUTION_FA_TYPES_H diff --git a/libs/RVL_SDK/include/revolution/gx.h b/libs/RVL_SDK/include/revolution/gx.h index 4f469438..dd51a3d0 100644 --- a/libs/RVL_SDK/include/revolution/gx.h +++ b/libs/RVL_SDK/include/revolution/gx.h @@ -7,30 +7,29 @@ extern "C" { #include -#include #include +#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef __cplusplus } #endif -#endif // REVOLUTION_GX_H +#endif // REVOLUTION_GX_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXBump.h b/libs/RVL_SDK/include/revolution/gx/GXBump.h index acf50e0e..a7927e34 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXBump.h +++ b/libs/RVL_SDK/include/revolution/gx/GXBump.h @@ -1,14 +1,15 @@ #ifndef REVOLUTION_GX_BUMP_H #define REVOLUTION_GX_BUMP_H -#include #include +#include #ifdef __cplusplus extern "C" { #endif -void GXSetTevIndirect(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXIndTexFormat format, GXIndTexBiasSel bias_sel, GXIndTexMtxID matrix_sel, GXIndTexWrap wrap_s, GXIndTexWrap wrap_t, GXBool add_prev, GXBool utc_lod, GXIndTexAlphaSel alpha_sel) NO_INLINE; +void GXSetTevIndirect(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXIndTexFormat format, GXIndTexBiasSel bias_sel, GXIndTexMtxID matrix_sel, + GXIndTexWrap wrap_s, GXIndTexWrap wrap_t, GXBool add_prev, GXBool utc_lod, GXIndTexAlphaSel alpha_sel) NO_INLINE; void GXSetIndTexMtx(GXIndTexMtxID mtx_id, const f32 offset[2][3], s8 scale_exp); void GXSetIndTexCoordScale(GXIndTexStageID ind_state, GXIndTexScale scale_s, GXIndTexScale scale_t); @@ -22,4 +23,4 @@ void GXSetTevDirect(GXTevStageID tev_stage); } #endif -#endif // REVOLUTION_GX_BUMP_H +#endif // REVOLUTION_GX_BUMP_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXCommandList.h b/libs/RVL_SDK/include/revolution/gx/GXCommandList.h index ac89431a..6ccc67cf 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXCommandList.h +++ b/libs/RVL_SDK/include/revolution/gx/GXCommandList.h @@ -7,31 +7,31 @@ extern "C" { #endif -#define GX_NOP 0x00 -#define GX_LOAD_CP_REG 0x08 -#define GX_LOAD_XF_REG 0x10 -#define GX_LOAD_INDX_A 0x20 -#define GX_LOAD_INDX_B 0x28 -#define GX_LOAD_INDX_C 0x30 -#define GX_LOAD_INDX_D 0x38 -#define GX_LOAD_BP_REG 0x61 +#define GX_NOP 0x00 +#define GX_LOAD_CP_REG 0x08 +#define GX_LOAD_XF_REG 0x10 +#define GX_LOAD_INDX_A 0x20 +#define GX_LOAD_INDX_B 0x28 +#define GX_LOAD_INDX_C 0x30 +#define GX_LOAD_INDX_D 0x38 +#define GX_LOAD_BP_REG 0x61 -#define GX_DRAW_QUADS 0x80 -#define GX_DRAW_TRIANGLES 0x90 +#define GX_DRAW_QUADS 0x80 +#define GX_DRAW_TRIANGLES 0x90 #define GX_DRAW_TRIANGLE_STRIP 0x98 -#define GX_DRAW_TRIANGLE_FAN 0xA0 -#define GX_DRAW_LINES 0xA8 -#define GX_DRAW_LINE_STRIP 0xB0 -#define GX_DRAW_POINTS 0xB8 +#define GX_DRAW_TRIANGLE_FAN 0xA0 +#define GX_DRAW_LINES 0xA8 +#define GX_DRAW_LINE_STRIP 0xB0 +#define GX_DRAW_POINTS 0xB8 -#define GX_CMD_CALL_DL 0x40 +#define GX_CMD_CALL_DL 0x40 #define GX_CMD_INVAL_VTX 0x48 #define GX_OPCODE_MASK 0xF8 -#define GX_VAT_MASK 0x07 +#define GX_VAT_MASK 0x07 #ifdef __cplusplus } #endif -#endif // REVOLUTION_GX_COMMAND_LIST_H +#endif // REVOLUTION_GX_COMMAND_LIST_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXCpu2Efb.h b/libs/RVL_SDK/include/revolution/gx/GXCpu2Efb.h index e8720c49..0e3b7c26 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXCpu2Efb.h +++ b/libs/RVL_SDK/include/revolution/gx/GXCpu2Efb.h @@ -1,8 +1,8 @@ #ifndef REVOLUTION_GX_CPU_TO_EFB_H #define REVOLUTION_GX_CPU_TO_EFB_H -#include #include +#include #ifdef __cplusplus extern "C" { @@ -26,4 +26,4 @@ void GXPokeZMode(GXBool compare_enable, GXCompare func, GXBool update_enable); } #endif -#endif // REVOLUTION_GX_CPU_TO_EFB_H +#endif // REVOLUTION_GX_CPU_TO_EFB_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXCull.h b/libs/RVL_SDK/include/revolution/gx/GXCull.h index 42890be1..1ab4c127 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXCull.h +++ b/libs/RVL_SDK/include/revolution/gx/GXCull.h @@ -1,8 +1,8 @@ #ifndef REVOLUTION_GX_CULLING_H #define REVOLUTION_GX_CULLING_H -#include #include +#include #ifdef __cplusplus extern "C" { @@ -17,4 +17,4 @@ void GXSetCoPlanar(GXBool enable); } #endif -#endif // REVOLUTION_GX_CULLING_H +#endif // REVOLUTION_GX_CULLING_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXDispList.h b/libs/RVL_SDK/include/revolution/gx/GXDispList.h index 44d950ee..8c475964 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXDispList.h +++ b/libs/RVL_SDK/include/revolution/gx/GXDispList.h @@ -1,20 +1,20 @@ #ifndef REVOLUTION_GX_DISPLAY_LIST_H #define REVOLUTION_GX_DISPLAY_LIST_H -#include #include +#include #ifdef __cplusplus extern "C" { #endif -void GXBeginDisplayList(void* list, u32 size); -u32 GXEndDisplayList(); +void GXBeginDisplayList(void* list, u32 size); +u32 GXEndDisplayList(); -void GXCallDisplayList(void* list, u32 nbytes); +void GXCallDisplayList(void* list, u32 nbytes); #ifdef __cplusplus } #endif -#endif // REVOLUTION_GX_DISPLAY_LIST_H +#endif // REVOLUTION_GX_DISPLAY_LIST_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXEnum.h b/libs/RVL_SDK/include/revolution/gx/GXEnum.h index a01a7f60..11580e7e 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXEnum.h +++ b/libs/RVL_SDK/include/revolution/gx/GXEnum.h @@ -9,9 +9,9 @@ extern "C" { typedef u8 GXBool; -#define GX_TRUE ((GXBool)1) -#define GX_FALSE ((GXBool)0) -#define GX_ENABLE ((GXBool)1) +#define GX_TRUE ((GXBool)1) +#define GX_FALSE ((GXBool)0) +#define GX_ENABLE ((GXBool)1) #define GX_DISABLE ((GXBool)0) typedef enum _GXAttr { @@ -143,7 +143,10 @@ typedef enum _GXChannelID { GX_COLOR_NULL = 0xff } GXChannelID; -typedef enum _GXColorSrc { GX_SRC_REG = 0, GX_SRC_VTX } GXColorSrc; +typedef enum _GXColorSrc { + GX_SRC_REG = 0, + GX_SRC_VTX +} GXColorSrc; typedef enum _GXTlut { GX_TLUT0 = 0, @@ -279,45 +282,45 @@ typedef enum _GXTevStageID { #define _GX_TF_ZTF 0x10 /* Z-texture-format */ typedef enum _GXTexFmt { - GX_TF_I4 = 0x0, - GX_TF_I8 = 0x1, - GX_TF_IA4 = 0x2, - GX_TF_IA8 = 0x3, - GX_TF_RGB565 = 0x4, - GX_TF_RGB5A3 = 0x5, - GX_TF_RGBA8 = 0x6, - GX_TF_CMPR = 0xE, + GX_TF_I4 = 0x0, + GX_TF_I8 = 0x1, + GX_TF_IA4 = 0x2, + GX_TF_IA8 = 0x3, + GX_TF_RGB565 = 0x4, + GX_TF_RGB5A3 = 0x5, + GX_TF_RGBA8 = 0x6, + GX_TF_CMPR = 0xE, - GX_CTF_R4 = 0x0 | _GX_TF_CTF, - GX_CTF_RA4 = 0x2 | _GX_TF_CTF, - GX_CTF_RA8 = 0x3 | _GX_TF_CTF, - GX_CTF_YUVA8 = 0x6 | _GX_TF_CTF, - GX_CTF_A8 = 0x7 | _GX_TF_CTF, - GX_CTF_R8 = 0x8 | _GX_TF_CTF, - GX_CTF_G8 = 0x9 | _GX_TF_CTF, - GX_CTF_B8 = 0xA | _GX_TF_CTF, - GX_CTF_RG8 = 0xB | _GX_TF_CTF, - GX_CTF_GB8 = 0xC | _GX_TF_CTF, + GX_CTF_R4 = 0x0 | _GX_TF_CTF, + GX_CTF_RA4 = 0x2 | _GX_TF_CTF, + GX_CTF_RA8 = 0x3 | _GX_TF_CTF, + GX_CTF_YUVA8 = 0x6 | _GX_TF_CTF, + GX_CTF_A8 = 0x7 | _GX_TF_CTF, + GX_CTF_R8 = 0x8 | _GX_TF_CTF, + GX_CTF_G8 = 0x9 | _GX_TF_CTF, + GX_CTF_B8 = 0xA | _GX_TF_CTF, + GX_CTF_RG8 = 0xB | _GX_TF_CTF, + GX_CTF_GB8 = 0xC | _GX_TF_CTF, - GX_TF_Z8 = 0x1 | _GX_TF_ZTF, - GX_TF_Z16 = 0x3 | _GX_TF_ZTF, - GX_TF_Z24X8 = 0x6 | _GX_TF_ZTF, + GX_TF_Z8 = 0x1 | _GX_TF_ZTF, + GX_TF_Z16 = 0x3 | _GX_TF_ZTF, + GX_TF_Z24X8 = 0x6 | _GX_TF_ZTF, - GX_CTF_Z4 = 0x0 | _GX_TF_ZTF | _GX_TF_CTF, - GX_CTF_Z8M = 0x9 | _GX_TF_ZTF | _GX_TF_CTF, - GX_CTF_Z8L = 0xA | _GX_TF_ZTF | _GX_TF_CTF, - GX_CTF_Z16L = 0xC | _GX_TF_ZTF | _GX_TF_CTF, + GX_CTF_Z4 = 0x0 | _GX_TF_ZTF | _GX_TF_CTF, + GX_CTF_Z8M = 0x9 | _GX_TF_ZTF | _GX_TF_CTF, + GX_CTF_Z8L = 0xA | _GX_TF_ZTF | _GX_TF_CTF, + GX_CTF_Z16L = 0xC | _GX_TF_ZTF | _GX_TF_CTF, GX_TF_A8 = GX_CTF_A8 } GXTexFmt; typedef enum _GXTexOffset { - GX_TO_ZERO = 0, + GX_TO_ZERO = 0, GX_TO_SIXTEENTH = 1, - GX_TO_EIGHTH = 2, - GX_TO_FOURTH = 3, - GX_TO_HALF = 4, - GX_TO_ONE = 5, + GX_TO_EIGHTH = 2, + GX_TO_FOURTH = 3, + GX_TO_HALF = 4, + GX_TO_ONE = 5, GX_MAX_TEXOFFSET, } GXTexOffset; @@ -328,7 +331,10 @@ typedef enum _GXCullMode { GX_CULL_ALL } GXCullMode; -typedef enum _GXClipMode { GX_CLIP_ENABLE = 0, GX_CLIP_DISABLE = 1 } GXClipMode; +typedef enum _GXClipMode { + GX_CLIP_ENABLE = 0, + GX_CLIP_DISABLE = 1 +} GXClipMode; typedef enum _GXTexWrapMode { GX_CLAMP, @@ -347,15 +353,15 @@ typedef enum _GXTexFilter { } GXTexFilter; typedef enum _GXLightID { - GX_LIGHT0 = 0x001, - GX_LIGHT1 = 0x002, - GX_LIGHT2 = 0x004, - GX_LIGHT3 = 0x008, - GX_LIGHT4 = 0x010, - GX_LIGHT5 = 0x020, - GX_LIGHT6 = 0x040, - GX_LIGHT7 = 0x080, - GX_MAX_LIGHT = 0x100, + GX_LIGHT0 = 0x001, + GX_LIGHT1 = 0x002, + GX_LIGHT2 = 0x004, + GX_LIGHT3 = 0x008, + GX_LIGHT4 = 0x010, + GX_LIGHT5 = 0x020, + GX_LIGHT6 = 0x040, + GX_LIGHT7 = 0x080, + GX_MAX_LIGHT = 0x100, GX_LIGHT_NULL = 0x000 } GXLightID; @@ -365,18 +371,22 @@ typedef enum _GXDiffuseFn { GX_DF_CLAMP } GXDiffuseFn; -typedef enum _GXAttnFn { GX_AF_SPEC = 0, GX_AF_SPOT = 1, GX_AF_NONE } GXAttnFn; +typedef enum _GXAttnFn { + GX_AF_SPEC = 0, + GX_AF_SPOT = 1, + GX_AF_NONE +} GXAttnFn; typedef enum _GXCompCnt { - GX_POS_XY = 0, - GX_POS_XYZ = 1, - GX_NRM_XYZ = 0, - GX_NRM_NBT = 1, // one index per NBT - GX_NRM_NBT3 = 2, // one index per each of N/B/T - GX_CLR_RGB = 0, + GX_POS_XY = 0, + GX_POS_XYZ = 1, + GX_NRM_XYZ = 0, + GX_NRM_NBT = 1, // one index per NBT + GX_NRM_NBT3 = 2, // one index per each of N/B/T + GX_CLR_RGB = 0, GX_CLR_RGBA = 1, - GX_TEX_S = 0, - GX_TEX_ST = 1 + GX_TEX_S = 0, + GX_TEX_ST = 1 } GXCompCnt; typedef enum _GXTevRegID { @@ -391,17 +401,17 @@ typedef enum _GXTevOp { GX_TEV_ADD = 0, GX_TEV_SUB = 1, - GX_TEV_COMP_R8_GT = 8, - GX_TEV_COMP_R8_EQ = 9, - GX_TEV_COMP_GR16_GT = 10, - GX_TEV_COMP_GR16_EQ = 11, - GX_TEV_COMP_BGR24_GT = 12, - GX_TEV_COMP_BGR24_EQ = 13, - GX_TEV_COMP_RGB8_GT = 14, - GX_TEV_COMP_RGB8_EQ = 15, + GX_TEV_COMP_R8_GT = 8, + GX_TEV_COMP_R8_EQ = 9, + GX_TEV_COMP_GR16_GT = 10, + GX_TEV_COMP_GR16_EQ = 11, + GX_TEV_COMP_BGR24_GT = 12, + GX_TEV_COMP_BGR24_EQ = 13, + GX_TEV_COMP_RGB8_GT = 14, + GX_TEV_COMP_RGB8_EQ = 15, - GX_TEV_COMP_A8_GT = GX_TEV_COMP_RGB8_GT, - GX_TEV_COMP_A8_EQ = GX_TEV_COMP_RGB8_EQ + GX_TEV_COMP_A8_GT = GX_TEV_COMP_RGB8_GT, + GX_TEV_COMP_A8_EQ = GX_TEV_COMP_RGB8_EQ } GXTevOp; typedef enum _GXTevColorArg { @@ -458,73 +468,73 @@ typedef enum _GXTevKColorID { } GXTevKColorID; typedef enum _GXTevKColorSel { - GX_TEV_KCSEL_8_8 = 0x00, - GX_TEV_KCSEL_7_8 = 0x01, - GX_TEV_KCSEL_6_8 = 0x02, - GX_TEV_KCSEL_5_8 = 0x03, - GX_TEV_KCSEL_4_8 = 0x04, - GX_TEV_KCSEL_3_8 = 0x05, - GX_TEV_KCSEL_2_8 = 0x06, - GX_TEV_KCSEL_1_8 = 0x07, + GX_TEV_KCSEL_8_8 = 0x00, + GX_TEV_KCSEL_7_8 = 0x01, + GX_TEV_KCSEL_6_8 = 0x02, + GX_TEV_KCSEL_5_8 = 0x03, + GX_TEV_KCSEL_4_8 = 0x04, + GX_TEV_KCSEL_3_8 = 0x05, + GX_TEV_KCSEL_2_8 = 0x06, + GX_TEV_KCSEL_1_8 = 0x07, - GX_TEV_KCSEL_1 = GX_TEV_KCSEL_8_8, - GX_TEV_KCSEL_3_4 = GX_TEV_KCSEL_6_8, - GX_TEV_KCSEL_1_2 = GX_TEV_KCSEL_4_8, - GX_TEV_KCSEL_1_4 = GX_TEV_KCSEL_2_8, + GX_TEV_KCSEL_1 = GX_TEV_KCSEL_8_8, + GX_TEV_KCSEL_3_4 = GX_TEV_KCSEL_6_8, + GX_TEV_KCSEL_1_2 = GX_TEV_KCSEL_4_8, + GX_TEV_KCSEL_1_4 = GX_TEV_KCSEL_2_8, - GX_TEV_KCSEL_K0 = 0x0C, - GX_TEV_KCSEL_K1 = 0x0D, - GX_TEV_KCSEL_K2 = 0x0E, - GX_TEV_KCSEL_K3 = 0x0F, - GX_TEV_KCSEL_K0_R = 0x10, - GX_TEV_KCSEL_K1_R = 0x11, - GX_TEV_KCSEL_K2_R = 0x12, - GX_TEV_KCSEL_K3_R = 0x13, - GX_TEV_KCSEL_K0_G = 0x14, - GX_TEV_KCSEL_K1_G = 0x15, - GX_TEV_KCSEL_K2_G = 0x16, - GX_TEV_KCSEL_K3_G = 0x17, - GX_TEV_KCSEL_K0_B = 0x18, - GX_TEV_KCSEL_K1_B = 0x19, - GX_TEV_KCSEL_K2_B = 0x1A, - GX_TEV_KCSEL_K3_B = 0x1B, - GX_TEV_KCSEL_K0_A = 0x1C, - GX_TEV_KCSEL_K1_A = 0x1D, - GX_TEV_KCSEL_K2_A = 0x1E, - GX_TEV_KCSEL_K3_A = 0x1F + GX_TEV_KCSEL_K0 = 0x0C, + GX_TEV_KCSEL_K1 = 0x0D, + GX_TEV_KCSEL_K2 = 0x0E, + GX_TEV_KCSEL_K3 = 0x0F, + GX_TEV_KCSEL_K0_R = 0x10, + GX_TEV_KCSEL_K1_R = 0x11, + GX_TEV_KCSEL_K2_R = 0x12, + GX_TEV_KCSEL_K3_R = 0x13, + GX_TEV_KCSEL_K0_G = 0x14, + GX_TEV_KCSEL_K1_G = 0x15, + GX_TEV_KCSEL_K2_G = 0x16, + GX_TEV_KCSEL_K3_G = 0x17, + GX_TEV_KCSEL_K0_B = 0x18, + GX_TEV_KCSEL_K1_B = 0x19, + GX_TEV_KCSEL_K2_B = 0x1A, + GX_TEV_KCSEL_K3_B = 0x1B, + GX_TEV_KCSEL_K0_A = 0x1C, + GX_TEV_KCSEL_K1_A = 0x1D, + GX_TEV_KCSEL_K2_A = 0x1E, + GX_TEV_KCSEL_K3_A = 0x1F } GXTevKColorSel; typedef enum _GXTevKAlphaSel { - GX_TEV_KASEL_8_8 = 0x00, - GX_TEV_KASEL_7_8 = 0x01, - GX_TEV_KASEL_6_8 = 0x02, - GX_TEV_KASEL_5_8 = 0x03, - GX_TEV_KASEL_4_8 = 0x04, - GX_TEV_KASEL_3_8 = 0x05, - GX_TEV_KASEL_2_8 = 0x06, - GX_TEV_KASEL_1_8 = 0x07, + GX_TEV_KASEL_8_8 = 0x00, + GX_TEV_KASEL_7_8 = 0x01, + GX_TEV_KASEL_6_8 = 0x02, + GX_TEV_KASEL_5_8 = 0x03, + GX_TEV_KASEL_4_8 = 0x04, + GX_TEV_KASEL_3_8 = 0x05, + GX_TEV_KASEL_2_8 = 0x06, + GX_TEV_KASEL_1_8 = 0x07, - GX_TEV_KASEL_1 = GX_TEV_KASEL_8_8, - GX_TEV_KASEL_3_4 = GX_TEV_KASEL_6_8, - GX_TEV_KASEL_1_2 = GX_TEV_KASEL_4_8, - GX_TEV_KASEL_1_4 = GX_TEV_KASEL_2_8, + GX_TEV_KASEL_1 = GX_TEV_KASEL_8_8, + GX_TEV_KASEL_3_4 = GX_TEV_KASEL_6_8, + GX_TEV_KASEL_1_2 = GX_TEV_KASEL_4_8, + GX_TEV_KASEL_1_4 = GX_TEV_KASEL_2_8, - GX_TEV_KASEL_K0_R = 0x10, - GX_TEV_KASEL_K1_R = 0x11, - GX_TEV_KASEL_K2_R = 0x12, - GX_TEV_KASEL_K3_R = 0x13, - GX_TEV_KASEL_K0_G = 0x14, - GX_TEV_KASEL_K1_G = 0x15, - GX_TEV_KASEL_K2_G = 0x16, - GX_TEV_KASEL_K3_G = 0x17, - GX_TEV_KASEL_K0_B = 0x18, - GX_TEV_KASEL_K1_B = 0x19, - GX_TEV_KASEL_K2_B = 0x1A, - GX_TEV_KASEL_K3_B = 0x1B, - GX_TEV_KASEL_K0_A = 0x1C, - GX_TEV_KASEL_K1_A = 0x1D, - GX_TEV_KASEL_K2_A = 0x1E, - GX_TEV_KASEL_K3_A = 0x1F + GX_TEV_KASEL_K0_R = 0x10, + GX_TEV_KASEL_K1_R = 0x11, + GX_TEV_KASEL_K2_R = 0x12, + GX_TEV_KASEL_K3_R = 0x13, + GX_TEV_KASEL_K0_G = 0x14, + GX_TEV_KASEL_K1_G = 0x15, + GX_TEV_KASEL_K2_G = 0x16, + GX_TEV_KASEL_K3_G = 0x17, + GX_TEV_KASEL_K0_B = 0x18, + GX_TEV_KASEL_K1_B = 0x19, + GX_TEV_KASEL_K2_B = 0x1A, + GX_TEV_KASEL_K3_B = 0x1B, + GX_TEV_KASEL_K0_A = 0x1C, + GX_TEV_KASEL_K1_A = 0x1D, + GX_TEV_KASEL_K2_A = 0x1E, + GX_TEV_KASEL_K3_A = 0x1F } GXTevKAlphaSel; typedef enum _GXAlphaOp { @@ -544,22 +554,22 @@ typedef enum _GXTevScale { } GXTevScale; typedef enum _GXFogType { - GX_FOG_NONE = 0x00, - GX_FOG_PERSP_LIN = 0x02, - GX_FOG_PERSP_EXP = 0x04, - GX_FOG_PERSP_EXP2 = 0x05, - GX_FOG_PERSP_REVEXP = 0x06, - GX_FOG_PERSP_REVEXP2 = 0x07, - GX_FOG_ORTHO_LIN = 0x0A, - GX_FOG_ORTHO_EXP = 0x0C, - GX_FOG_ORTHO_EXP2 = 0x0D, - GX_FOG_ORTHO_REVEXP = 0x0E, - GX_FOG_ORTHO_REVEXP2 = 0x0F, - GX_FOG_LIN = GX_FOG_PERSP_LIN, - GX_FOG_EXP = GX_FOG_PERSP_EXP, - GX_FOG_EXP2 = GX_FOG_PERSP_EXP2, - GX_FOG_REVEXP = GX_FOG_PERSP_REVEXP, - GX_FOG_REVEXP2 = GX_FOG_PERSP_REVEXP2 + GX_FOG_NONE = 0x00, + GX_FOG_PERSP_LIN = 0x02, + GX_FOG_PERSP_EXP = 0x04, + GX_FOG_PERSP_EXP2 = 0x05, + GX_FOG_PERSP_REVEXP = 0x06, + GX_FOG_PERSP_REVEXP2 = 0x07, + GX_FOG_ORTHO_LIN = 0x0A, + GX_FOG_ORTHO_EXP = 0x0C, + GX_FOG_ORTHO_EXP2 = 0x0D, + GX_FOG_ORTHO_REVEXP = 0x0E, + GX_FOG_ORTHO_REVEXP2 = 0x0F, + GX_FOG_LIN = GX_FOG_PERSP_LIN, + GX_FOG_EXP = GX_FOG_PERSP_EXP, + GX_FOG_EXP2 = GX_FOG_PERSP_EXP2, + GX_FOG_REVEXP = GX_FOG_PERSP_REVEXP, + GX_FOG_REVEXP2 = GX_FOG_PERSP_REVEXP2 } GXFogType; typedef enum _GXBlendMode { @@ -580,7 +590,7 @@ typedef enum _GXBlendFactor { GX_BL_DSTALPHA, GX_BL_INVDSTALPHA, - GX_BL_DSTCLR = GX_BL_SRCCLR, + GX_BL_DSTCLR = GX_BL_SRCCLR, GX_BL_INVDSTCLR = GX_BL_INVSRCCLR } GXBlendFactor; @@ -679,16 +689,19 @@ typedef enum _GXZTexOp { } GXZTexOp; -typedef enum _GXTexMtxType { GX_MTX3x4 = 0, GX_MTX2x4 } GXTexMtxType; +typedef enum _GXTexMtxType { + GX_MTX3x4 = 0, + GX_MTX2x4 +} GXTexMtxType; typedef enum _GXPrimitive { - GX_POINTS = 0xb8, - GX_LINES = 0xa8, - GX_LINESTRIP = 0xb0, - GX_TRIANGLES = 0x90, - GX_TRIANGLESTRIP = 0x98, - GX_TRIANGLEFAN = 0xa0, - GX_QUADS = 0x80 + GX_POINTS = 0xb8, + GX_LINES = 0xa8, + GX_LINESTRIP = 0xb0, + GX_TRIANGLES = 0x90, + GX_TRIANGLESTRIP = 0x98, + GX_TRIANGLEFAN = 0xa0, + GX_QUADS = 0x80 } GXPrimitive; typedef enum _GXPerf0 { @@ -774,14 +787,14 @@ typedef enum _GXVCachePerf { typedef enum _GXCopyMode { GX_COPY_PROGRESSIVE = 0, - GX_COPY_INTLC_EVEN = 2, - GX_COPY_INTLC_ODD = 3 + GX_COPY_INTLC_EVEN = 2, + GX_COPY_INTLC_ODD = 3 } GXCopyMode; typedef enum _GXTlutFmt { - GX_TL_IA8 = 0x0, - GX_TL_RGB565 = 0x1, - GX_TL_RGB5A3 = 0x2, + GX_TL_IA8 = 0x0, + GX_TL_RGB565 = 0x1, + GX_TL_RGB5A3 = 0x2, GX_MAX_TLUTFMT } GXTlutFmt; @@ -807,16 +820,16 @@ typedef enum _GXPosNrmMtx { } GXPosNrmMtx; typedef enum _GXTexMtx { - GX_TEXMTX0 = 30, - GX_TEXMTX1 = 33, - GX_TEXMTX2 = 36, - GX_TEXMTX3 = 39, - GX_TEXMTX4 = 42, - GX_TEXMTX5 = 45, - GX_TEXMTX6 = 48, - GX_TEXMTX7 = 51, - GX_TEXMTX8 = 54, - GX_TEXMTX9 = 57, + GX_TEXMTX0 = 30, + GX_TEXMTX1 = 33, + GX_TEXMTX2 = 36, + GX_TEXMTX3 = 39, + GX_TEXMTX4 = 42, + GX_TEXMTX5 = 45, + GX_TEXMTX6 = 48, + GX_TEXMTX7 = 51, + GX_TEXMTX8 = 54, + GX_TEXMTX9 = 57, GX_IDENTITY = 60 } GXTexMtx; @@ -828,8 +841,8 @@ typedef enum _GXTevColorChan { } GXTevColorChan; typedef enum _GXCITexFmt { - GX_TF_C4 = 0x8, - GX_TF_C8 = 0x9, + GX_TF_C4 = 0x8, + GX_TF_C8 = 0x9, GX_TF_C14X2 = 0xA } GXCITexFmt; @@ -895,4 +908,4 @@ typedef enum _GXTlutSize { } #endif -#endif // REVOLUTION_GX_ENUM_H +#endif // REVOLUTION_GX_ENUM_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXFifo.h b/libs/RVL_SDK/include/revolution/gx/GXFifo.h index c855d478..715c6ccc 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXFifo.h +++ b/libs/RVL_SDK/include/revolution/gx/GXFifo.h @@ -1,8 +1,9 @@ #ifndef REVOLUTION_GX_FIFO_H #define REVOLUTION_GX_FIFO_H -#include #include +#include + #ifdef __cplusplus extern "C" { @@ -10,25 +11,25 @@ extern "C" { typedef void (*GXBreakPtCallback)(); -void GXInitFifoBase(GXFifoObj* fifo, void* base, u32 size); -void GXInitFifoPtrs(GXFifoObj* fifo, void* readPtr, void* writePtr); -void GXInitFifoLimits(GXFifoObj* fifo, u32 hiWatermark, u32 loWatermark); +void GXInitFifoBase(GXFifoObj* fifo, void* base, u32 size); +void GXInitFifoPtrs(GXFifoObj* fifo, void* readPtr, void* writePtr); +void GXInitFifoLimits(GXFifoObj* fifo, u32 hiWatermark, u32 loWatermark); -void GXSetCPUFifo(GXFifoObj* fifo); -void GXSetGPFifo(GXFifoObj* fifo); +void GXSetCPUFifo(GXFifoObj* fifo); +void GXSetGPFifo(GXFifoObj* fifo); -void GXGetGPStatus(GXBool* overhi, GXBool* underlow, GXBool* readIdle, GXBool* cmdIdle, GXBool* brkpt); +void GXGetGPStatus(GXBool* overhi, GXBool* underlow, GXBool* readIdle, GXBool* cmdIdle, GXBool* brkpt); -GXBreakPtCallback GXSetBreakPtCallback(GXBreakPtCallback cb); +GXBreakPtCallback GXSetBreakPtCallback(GXBreakPtCallback cb); -GXBool GXGetCPUFifo(GXFifoObj *fifo); -GXFifoObj* GXGetGPFifo(); +GXBool GXGetCPUFifo(GXFifoObj* fifo); +GXFifoObj* GXGetGPFifo(); -u32 GXGetFifoCount(const GXFifoObj* fifo); -GXBool GXGetFifoWrap(const GXFifoObj* fifo); +u32 GXGetFifoCount(const GXFifoObj* fifo); +GXBool GXGetFifoWrap(const GXFifoObj* fifo); #ifdef __cplusplus } #endif -#endif // REVOLUTION_GX_FIFO_H +#endif // REVOLUTION_GX_FIFO_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXFrameBuffer.h b/libs/RVL_SDK/include/revolution/gx/GXFrameBuffer.h index 3d5a19fb..6fa17fa3 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXFrameBuffer.h +++ b/libs/RVL_SDK/include/revolution/gx/GXFrameBuffer.h @@ -1,47 +1,48 @@ #ifndef REVOLUTION_GX_FRAMEBUFFER_H #define REVOLUTION_GX_FRAMEBUFFER_H -#include #include #include +#include + #ifdef __cplusplus extern "C" { #endif -#define GX_MAX_Z24 0x00ffffff +#define GX_MAX_Z24 0x00ffffff extern GXRenderModeObj GXNtsc480IntDf; extern GXRenderModeObj GXMpal480IntDf; extern GXRenderModeObj GXPal528IntDf; extern GXRenderModeObj GXEurgb60Hz480IntDf; -void GXSetDispCopySrc(u16 left, u16 top, u16 wd, u16 ht); -void GXSetTexCopySrc(u16 left, u16 top, u16 wd, u16 ht); +void GXSetDispCopySrc(u16 left, u16 top, u16 wd, u16 ht); +void GXSetTexCopySrc(u16 left, u16 top, u16 wd, u16 ht); -void GXSetDispCopyDst(u16 wd, u16 ht); -void GXSetTexCopyDst(u16 wd, u16 ht, GXTexFmt fmt, GXBool mipmap); +void GXSetDispCopyDst(u16 wd, u16 ht); +void GXSetTexCopyDst(u16 wd, u16 ht, GXTexFmt fmt, GXBool mipmap); -void GXSetDispCopyFrame2Field(GXCopyMode mode); +void GXSetDispCopyFrame2Field(GXCopyMode mode); -void GXSetCopyClamp(GXFBClamp clamp); +void GXSetCopyClamp(GXFBClamp clamp); -u32 GXSetDispCopyYScale(f32 vscale); +u32 GXSetDispCopyYScale(f32 vscale); -void GXSetCopyClear(GXColor clear_clr, u32 clear_z); -void GXSetCopyFilter(GXBool aa, const u8 sample_pattern[12][2], GXBool vf, const u8 vfilter[7]); +void GXSetCopyClear(GXColor clear_clr, u32 clear_z); +void GXSetCopyFilter(GXBool aa, const u8 sample_pattern[12][2], GXBool vf, const u8 vfilter[7]); -void GXSetDispCopyGamma(GXGamma gamma); +void GXSetDispCopyGamma(GXGamma gamma); -void GXCopyDisp(void* dest, GXBool clear); -void GXCopyTex(void* dest, GXBool clear); +void GXCopyDisp(void* dest, GXBool clear); +void GXCopyTex(void* dest, GXBool clear); -void GXClearBoundingBox(); +void GXClearBoundingBox(); -f32 GXGetYScaleFactor(u16 efbHeight, u16 xfbHeight); +f32 GXGetYScaleFactor(u16 efbHeight, u16 xfbHeight); #ifdef __cplusplus } #endif -#endif // REVOLUTION_GX_FRAMEBUFFER_H +#endif // REVOLUTION_GX_FRAMEBUFFER_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXGeometry.h b/libs/RVL_SDK/include/revolution/gx/GXGeometry.h index d108d8d1..f91955f0 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXGeometry.h +++ b/libs/RVL_SDK/include/revolution/gx/GXGeometry.h @@ -1,37 +1,38 @@ #ifndef REVOLUTION_GX_GEOMETRY_H #define REVOLUTION_GX_GEOMETRY_H -#include #include #include +#include #ifdef __cplusplus extern "C" { #endif -void GXSetVtxDesc(GXAttr attr, GXAttrType type); -void GXClearVtxDesc(); -void GXSetVtxAttrFmt(GXVtxFmt vtxfmt, GXAttr attr, GXCompCnt cnt, GXCompType type, u8 frac); -void GXSetVtxAttrFmtv(GXVtxFmt vtxfmt, const GXVtxAttrFmtList* list); -void GXSetArray(GXAttr attr, void* base_ptr, u8 stride); -void GXInvalidateVtxCache(); -void GXSetTexCoordGen2(GXTexCoordID dst_coord, GXTexGenType func, GXTexGenSrc src_param, u32 mtx, GXBool normalize, u32 pt_texmtx); -void GXSetNumTexGens(u8 nTexGens); +void GXSetVtxDesc(GXAttr attr, GXAttrType type); +void GXClearVtxDesc(); +void GXSetVtxAttrFmt(GXVtxFmt vtxfmt, GXAttr attr, GXCompCnt cnt, GXCompType type, u8 frac); +void GXSetVtxAttrFmtv(GXVtxFmt vtxfmt, const GXVtxAttrFmtList* list); +void GXSetArray(GXAttr attr, void* base_ptr, u8 stride); +void GXInvalidateVtxCache(); +void GXSetTexCoordGen2(GXTexCoordID dst_coord, GXTexGenType func, GXTexGenSrc src_param, u32 mtx, GXBool normalize, u32 pt_texmtx); +void GXSetNumTexGens(u8 nTexGens); -static inline void GXSetTexCoordGen(GXTexCoordID dst_coord, GXTexGenType func, GXTexGenSrc src_param, u32 mtx) { +static inline void GXSetTexCoordGen(GXTexCoordID dst_coord, GXTexGenType func, GXTexGenSrc src_param, u32 mtx) { GXSetTexCoordGen2(dst_coord, func, src_param, mtx, GX_FALSE, GX_PTIDENTITY); } -void GXBegin(GXPrimitive type, GXVtxFmt vtxfmt, u16 nverts); +void GXBegin(GXPrimitive type, GXVtxFmt vtxfmt, u16 nverts); -static inline void GXEnd() {} +static inline void GXEnd() { +} -void GXSetLineWidth(u8 width, GXTexOffset texOffsets); -void GXSetPointSize(u8 pointSize, GXTexOffset texOffsets); -void GXEnableTexOffsets(GXTexCoordID coord, u8 line_enable, u8 point_enable); +void GXSetLineWidth(u8 width, GXTexOffset texOffsets); +void GXSetPointSize(u8 pointSize, GXTexOffset texOffsets); +void GXEnableTexOffsets(GXTexCoordID coord, u8 line_enable, u8 point_enable); #ifdef __cplusplus } #endif -#endif // REVOLUTION_GX_GEOMETRY_H +#endif // REVOLUTION_GX_GEOMETRY_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXGet.h b/libs/RVL_SDK/include/revolution/gx/GXGet.h index e0c597e3..e339c4c0 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXGet.h +++ b/libs/RVL_SDK/include/revolution/gx/GXGet.h @@ -1,30 +1,30 @@ #ifndef REVOLUTION_GX_GET_H #define REVOLUTION_GX_GET_H -#include #include #include +#include #ifdef __cplusplus extern "C" { #endif // Texture -GXBool GXGetTexObjMipMap(const GXTexObj* to); -GXTexFmt GXGetTexObjFmt(const GXTexObj* to); -void* GXGetTexObjData(const GXTexObj* to); -u16 GXGetTexObjWidth(const GXTexObj* to); -u16 GXGetTexObjHeight(const GXTexObj* to); -GXTexWrapMode GXGetTexObjWrapS(const GXTexObj* to); -GXTexWrapMode GXGetTexObjWrapT(const GXTexObj* to); +GXBool GXGetTexObjMipMap(const GXTexObj* to); +GXTexFmt GXGetTexObjFmt(const GXTexObj* to); +void* GXGetTexObjData(const GXTexObj* to); +u16 GXGetTexObjWidth(const GXTexObj* to); +u16 GXGetTexObjHeight(const GXTexObj* to); +GXTexWrapMode GXGetTexObjWrapS(const GXTexObj* to); +GXTexWrapMode GXGetTexObjWrapT(const GXTexObj* to); // Transform -void GXGetProjectionv(f32* ptr); -void GXGetViewportv(f32* vp); -void GXGetScissor(u32* left, u32* top, u32* wd, u32* ht); +void GXGetProjectionv(f32* ptr); +void GXGetViewportv(f32* vp); +void GXGetScissor(u32* left, u32* top, u32* wd, u32* ht); #ifdef __cplusplus } #endif -#endif // REVOLUTION_GX_GEOMETRY_H +#endif // REVOLUTION_GX_GEOMETRY_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXLighting.h b/libs/RVL_SDK/include/revolution/gx/GXLighting.h index 7ec991b0..54dacdf2 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXLighting.h +++ b/libs/RVL_SDK/include/revolution/gx/GXLighting.h @@ -1,15 +1,14 @@ #ifndef REVOLUTION_GX_LIGHTING_H #define REVOLUTION_GX_LIGHTING_H -#include -#include #include +#include +#include #ifdef __cplusplus extern "C" { #endif - void GXInitLightPos(GXLightObj* lt_obj, f32 x, f32 y, f32 z); void GXInitLightColor(GXLightObj* lt_obj, GXColor color); @@ -26,4 +25,4 @@ void GXSetChanCtrl(GXChannelID chan, GXBool enable, GXColorSrc amb_src, GXColorS } #endif -#endif // REVOLUTION_GX_LIGHTING_H +#endif // REVOLUTION_GX_LIGHTING_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXManage.h b/libs/RVL_SDK/include/revolution/gx/GXManage.h index ebdef4bd..54f2e05d 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXManage.h +++ b/libs/RVL_SDK/include/revolution/gx/GXManage.h @@ -1,8 +1,8 @@ #ifndef REVOLUTION_GX_MANAGE_H #define REVOLUTION_GX_MANAGE_H -#include #include +#include #ifdef __cplusplus extern "C" { @@ -12,32 +12,32 @@ typedef void (*GXDrawSyncCallback)(u16 token); typedef void (*GXDrawDoneCallback)(); // Init -GXFifoObj* GXInit(void* base, u32 size); +GXFifoObj* GXInit(void* base, u32 size); // Misc -void GXSetMisc(GXMiscToken token, u32 val); +void GXSetMisc(GXMiscToken token, u32 val); -void GXFlush(); +void GXFlush(); -void GXResetWriteGatherPipe(); +void GXResetWriteGatherPipe(); -void GXAbortFrame(); +void GXAbortFrame(); -void GXSetDrawSync(u16 token); -u16 GXReadDrawSync(); +void GXSetDrawSync(u16 token); +u16 GXReadDrawSync(); -void GXSetDrawDone(); -void GXWaitDrawDone(); -void GXDrawDone(); +void GXSetDrawDone(); +void GXWaitDrawDone(); +void GXDrawDone(); -void GXPixModeSync(); -void GXTexModeSync(); +void GXPixModeSync(); +void GXTexModeSync(); -GXDrawSyncCallback GXSetDrawSyncCallback(GXDrawSyncCallback cb); -GXDrawDoneCallback GXSetDrawDoneCallback(GXDrawDoneCallback cb); +GXDrawSyncCallback GXSetDrawSyncCallback(GXDrawSyncCallback cb); +GXDrawDoneCallback GXSetDrawDoneCallback(GXDrawDoneCallback cb); #ifdef __cplusplus } #endif -#endif // REVOLUTION_GX_MANAGE_H +#endif // REVOLUTION_GX_MANAGE_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXPerf.h b/libs/RVL_SDK/include/revolution/gx/GXPerf.h index f265e67d..13508502 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXPerf.h +++ b/libs/RVL_SDK/include/revolution/gx/GXPerf.h @@ -1,18 +1,18 @@ #ifndef REVOLUTION_GX_PERF_H #define REVOLUTION_GX_PERF_H -#include #include +#include #ifdef __cplusplus extern "C" { #endif -void GXSetGPMetric(GXPerf0 perf0, GXPerf1 perf1); -void GXClearGPMetric(); +void GXSetGPMetric(GXPerf0 perf0, GXPerf1 perf1); +void GXClearGPMetric(); #ifdef __cplusplus } #endif -#endif // REVOLUTION_GX_PERF_H +#endif // REVOLUTION_GX_PERF_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXPixel.h b/libs/RVL_SDK/include/revolution/gx/GXPixel.h index a019b255..67c40143 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXPixel.h +++ b/libs/RVL_SDK/include/revolution/gx/GXPixel.h @@ -1,8 +1,8 @@ #ifndef REVOLUTION_GX_PIXEL_H #define REVOLUTION_GX_PIXEL_H -#include #include +#include #ifdef __cplusplus extern "C" { @@ -32,4 +32,4 @@ void GXSetFieldMode(GXBool field_mode, GXBool half_aspect_ratio); } #endif -#endif // REVOLUTION_GX_PIXEL_H +#endif // REVOLUTION_GX_PIXEL_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXStruct.h b/libs/RVL_SDK/include/revolution/gx/GXStruct.h index 3d71f1e7..76eb7bf2 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXStruct.h +++ b/libs/RVL_SDK/include/revolution/gx/GXStruct.h @@ -1,8 +1,8 @@ #ifndef REVOLUTION_GX_STRUCTS_H #define REVOLUTION_GX_STRUCTS_H -#include #include +#include #include #ifdef __cplusplus @@ -10,15 +10,15 @@ extern "C" { #endif typedef struct _GXColor { - u8 r, g, b, a; // 0x00 + u8 r, g, b, a; // 0x00 } GXColor; typedef struct _GXColorS10 { - s16 r, g, b, a; // 0x00 + s16 r, g, b, a; // 0x00 } GXColorS10; typedef struct _GXTexObj { - u32 dummy[8]; // 0x00 + u32 dummy[8]; // 0x00 } GXTexObj; typedef struct _GXLightObj { @@ -26,19 +26,19 @@ typedef struct _GXLightObj { } GXLightObj; typedef struct _GXTexRegion { - u32 dummy[4]; // 0x00 + u32 dummy[4]; // 0x00 } GXTexRegion; typedef struct _GXTlutObj { - u32 dummy[3]; // 0x00 + u32 dummy[3]; // 0x00 } GXTlutObj; typedef struct _GXTlutRegion { - u32 dummy[4]; // 0x00 + u32 dummy[4]; // 0x00 } GXTlutRegion; typedef struct GXFifoObj { - u8 pad[128]; // 0x00 + u8 pad[128]; // 0x00 } GXFifoObj; typedef struct _GXFogAdjTable { @@ -46,42 +46,42 @@ typedef struct _GXFogAdjTable { } GXFogAdjTable; typedef struct _GXVtxDescList { - GXAttr attr; // 0x00 - GXAttrType type; // 0x04 + GXAttr attr; // 0x00 + GXAttrType type; // 0x04 } GXVtxDescList; typedef struct _GXVtxAttrFmtList { - GXAttr attr; // 0x00 + GXAttr attr; // 0x00 - GXCompCnt cnt; // 0x04 - GXCompType type; // 0x08 + GXCompCnt cnt; // 0x04 + GXCompType type; // 0x08 - u8 frac; // 0x0C + u8 frac; // 0x0C } GXVtxAttrFmtList; typedef struct _GXRenderModeObj { - VITVMode viTVmode; // 0x00 + VITVMode viTVmode; // 0x00 - u16 fbWidth; // 0x04 + u16 fbWidth; // 0x04 - u16 efbHeight; // 0x06 - u16 xfbHeight; // 0x08 + u16 efbHeight; // 0x06 + u16 xfbHeight; // 0x08 - u16 viXOrigin; // 0x0A - u16 viYOrigin; // 0x0C - u16 viWidth; // 0x0E - u16 viHeight; // 0x10 + u16 viXOrigin; // 0x0A + u16 viYOrigin; // 0x0C + u16 viWidth; // 0x0E + u16 viHeight; // 0x10 - VIXFBMode xFBmode; // 0x14 + VIXFBMode xFBmode; // 0x14 - u8 field_rendering; // 0x18 - u8 aa; // 0x19 - u8 sample_pattern[12][2]; // 0x1A - u8 vfilter[7]; // 0x32 + u8 field_rendering; // 0x18 + u8 aa; // 0x19 + u8 sample_pattern[12][2]; // 0x1A + u8 vfilter[7]; // 0x32 } GXRenderModeObj; #ifdef __cplusplus } #endif -#endif // REVOLUTION_GX_STRUCTS_H +#endif // REVOLUTION_GX_STRUCTS_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXTev.h b/libs/RVL_SDK/include/revolution/gx/GXTev.h index 8feffa69..06ac229f 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXTev.h +++ b/libs/RVL_SDK/include/revolution/gx/GXTev.h @@ -1,9 +1,10 @@ #ifndef REVOLUTION_GX_TEV_H #define REVOLUTION_GX_TEV_H -#include #include #include +#include + #ifdef __cplusplus extern "C" { @@ -36,4 +37,4 @@ void GXSetNumTevStages(u8 nStages); } #endif -#endif // REVOLUTION_GX_TEV_H +#endif // REVOLUTION_GX_TEV_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXTexture.h b/libs/RVL_SDK/include/revolution/gx/GXTexture.h index d340c587..07df3094 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXTexture.h +++ b/libs/RVL_SDK/include/revolution/gx/GXTexture.h @@ -1,44 +1,47 @@ #ifndef REVOLUTION_GX_TEXTURE_H #define REVOLUTION_GX_TEXTURE_H -#include -#include #include +#include +#include #ifdef __cplusplus extern "C" { #endif -typedef GXTexRegion *(*GXTexRegionCallback)(const GXTexObj* t_obj, GXTexMapID id); -typedef GXTlutRegion *(*GXTlutRegionCallback)(u32 idx); +typedef GXTexRegion* (*GXTexRegionCallback)(const GXTexObj* t_obj, GXTexMapID id); +typedef GXTlutRegion* (*GXTlutRegionCallback)(u32 idx); -u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, u8 mipmap, u8 max_lod); +u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, u8 mipmap, u8 max_lod); -void GXInitTexObj(const GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t, u8 mipmap); -void GXInitTexObjCI(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXCITexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t, u8 mipmap, u32 tlut_name); -void GXInitTexObjLOD(GXTexObj* obj, GXTexFilter min_filt, GXTexFilter mag_filt, f32 min_lod, f32 max_lod, f32 lod_bias, GXBool bias_clamp, GXBool do_edge_lod, GXAnisotropy max_aniso); -void GXInitTexObjWrapMode(const GXTexObj* obj, GXTexWrapMode s, GXTexWrapMode t); -void GXInitTexObjTlut(const GXTexObj* obj, u32 tlut_name); +void GXInitTexObj(const GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t, + u8 mipmap); +void GXInitTexObjCI(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXCITexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t, u8 mipmap, + u32 tlut_name); +void GXInitTexObjLOD(GXTexObj* obj, GXTexFilter min_filt, GXTexFilter mag_filt, f32 min_lod, f32 max_lod, f32 lod_bias, GXBool bias_clamp, + GXBool do_edge_lod, GXAnisotropy max_aniso); +void GXInitTexObjWrapMode(const GXTexObj* obj, GXTexWrapMode s, GXTexWrapMode t); +void GXInitTexObjTlut(const GXTexObj* obj, u32 tlut_name); -void GXInitTexObjUserData(const GXTexObj* obj, void* user_data); -void* GXGetTexObjUserData(const GXTexObj* obj); +void GXInitTexObjUserData(const GXTexObj* obj, void* user_data); +void* GXGetTexObjUserData(const GXTexObj* obj); -void GXLoadTexObjPreLoaded(const GXTexObj *obj, const GXTexRegion *region, GXTexMapID id); -void GXLoadTexObj(const GXTexObj* obj, GXTexMapID id); +void GXLoadTexObjPreLoaded(const GXTexObj* obj, const GXTexRegion* region, GXTexMapID id); +void GXLoadTexObj(const GXTexObj* obj, GXTexMapID id); -void GXInitTlutObj(const GXTlutObj* tlut_obj, void* lut, GXTlutFmt fmt, u16 n_entries); -void GXLoadTlut(const GXTlutObj* tlut_obj, u32 tlut_name); +void GXInitTlutObj(const GXTlutObj* tlut_obj, void* lut, GXTlutFmt fmt, u16 n_entries); +void GXLoadTlut(const GXTlutObj* tlut_obj, u32 tlut_name); -void GXInitTexCacheRegion(GXTexRegion* region, u8 is_32b_mipmap, u32 tmem_even, GXTexCacheSize size_even, u32 tmem_odd, GXTexCacheSize size_odd); -void GXInitTlutRegion(GXTlutRegion* region, u32 tmem_addr, GXTlutSize tlut_size); +void GXInitTexCacheRegion(GXTexRegion* region, u8 is_32b_mipmap, u32 tmem_even, GXTexCacheSize size_even, u32 tmem_odd, GXTexCacheSize size_odd); +void GXInitTlutRegion(GXTlutRegion* region, u32 tmem_addr, GXTlutSize tlut_size); -void GXInvalidateTexAll(); +void GXInvalidateTexAll(); -GXTexRegionCallback GXSetTexRegionCallback(GXTexRegionCallback f); -GXTlutRegionCallback GXSetTlutRegionCallback(GXTlutRegionCallback f); +GXTexRegionCallback GXSetTexRegionCallback(GXTexRegionCallback f); +GXTlutRegionCallback GXSetTlutRegionCallback(GXTlutRegionCallback f); #ifdef __cplusplus } #endif -#endif // REVOLUTION_GX_TEXTURE_H +#endif // REVOLUTION_GX_TEXTURE_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXTransform.h b/libs/RVL_SDK/include/revolution/gx/GXTransform.h index 9a2b501f..79cc1940 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXTransform.h +++ b/libs/RVL_SDK/include/revolution/gx/GXTransform.h @@ -1,17 +1,17 @@ #ifndef REVOLUTION_GX_TRANSFORM_H #define REVOLUTION_GX_TRANSFORM_H -#include #include #include #include +#include #ifdef __cplusplus extern "C" { #endif -#define GX_PROJECTION_SZ 7 -#define GX_VIEWPORT_SZ 6 +#define GX_PROJECTION_SZ 7 +#define GX_VIEWPORT_SZ 6 void GXSetProjection(const Mtx44 mtx, GXProjectionType type); void GXSetProjectionv(const f32* ptr); @@ -41,4 +41,4 @@ inline void GXSetViewportv(const f32* view) { } #endif -#endif // REVOLUTION_GX_TRANSFORM_H +#endif // REVOLUTION_GX_TRANSFORM_H diff --git a/libs/RVL_SDK/include/revolution/gx/GXVert.h b/libs/RVL_SDK/include/revolution/gx/GXVert.h index 6360a61e..0085e868 100644 --- a/libs/RVL_SDK/include/revolution/gx/GXVert.h +++ b/libs/RVL_SDK/include/revolution/gx/GXVert.h @@ -12,17 +12,41 @@ extern "C" { #define GXFIFO_ADDR 0xCC008000 volatile PPCWGPipe GXWGFifo ADDRESS(GXFIFO_ADDR); -#define GX_INLINE_VERT_FUNC_1PARAM(name, T) static inline void name##1##T(T x) { GXWGFifo.T = x; } +#define GX_INLINE_VERT_FUNC_1PARAM(name, T) \ + static inline void name##1##T(T x) { \ + GXWGFifo.T = x; \ + } -#define GX_INLINE_VERT_FUNC_2PARAM(name, T) static inline void name##2##T(T x, T y) { GXWGFifo.T = x; GXWGFifo.T = y; } +#define GX_INLINE_VERT_FUNC_2PARAM(name, T) \ + static inline void name##2##T(T x, T y) { \ + GXWGFifo.T = x; \ + GXWGFifo.T = y; \ + } -#define GX_INLINE_VERT_FUNC_3PARAM(name, T) static inline void name##3##T(T x, T y, T z) { GXWGFifo.T = x; GXWGFifo.T = y; GXWGFifo.T = z; } +#define GX_INLINE_VERT_FUNC_3PARAM(name, T) \ + static inline void name##3##T(T x, T y, T z) { \ + GXWGFifo.T = x; \ + GXWGFifo.T = y; \ + GXWGFifo.T = z; \ + } -#define GX_INLINE_VERT_FUNC_4PARAM(name, T) static inline void name##4##T(T x, T y, T z, T w) { GXWGFifo.T = x; GXWGFifo.T = y; GXWGFifo.T = z; GXWGFifo.T = w; } +#define GX_INLINE_VERT_FUNC_4PARAM(name, T) \ + static inline void name##4##T(T x, T y, T z, T w) { \ + GXWGFifo.T = x; \ + GXWGFifo.T = y; \ + GXWGFifo.T = z; \ + GXWGFifo.T = w; \ + } -#define GX_INLINE_VERT_FUNC_INDEX8(name) static inline void name##1x8(u8 x) { GXWGFifo.u8 = x; } +#define GX_INLINE_VERT_FUNC_INDEX8(name) \ + static inline void name##1x8(u8 x) { \ + GXWGFifo.u8 = x; \ + } -#define GX_INLINE_VERT_FUNC_INDEX16(name) static inline void name##1x16(u16 x) { GXWGFifo.u16 = x; } +#define GX_INLINE_VERT_FUNC_INDEX16(name) \ + static inline void name##1x16(u16 x) { \ + GXWGFifo.u16 = x; \ + } // GXCmd GX_INLINE_VERT_FUNC_1PARAM(GXCmd, u8) @@ -97,4 +121,4 @@ GX_INLINE_VERT_FUNC_1PARAM(GXMatrixIndex, u8) } #endif -#endif // REVOLUTION_GX_VERT_H +#endif // REVOLUTION_GX_VERT_H diff --git a/libs/RVL_SDK/include/revolution/kbd.h b/libs/RVL_SDK/include/revolution/kbd.h index 3d089a64..41aae23e 100644 --- a/libs/RVL_SDK/include/revolution/kbd.h +++ b/libs/RVL_SDK/include/revolution/kbd.h @@ -30,15 +30,15 @@ typedef enum _KBDCountryCode { } KBDCountryCode; typedef struct _KBDKeyEvent { - u8 unk_0x00[32]; + u8 unk_0x00[32]; } KBDKeyEvent; typedef struct _KBDDevEvent { - u8 unk_0x00[32]; + u8 unk_0x00[32]; } KBDDevEvent; #ifdef __cplusplus } #endif -#endif // REVOLUTION_KBD_H +#endif // REVOLUTION_KBD_H diff --git a/libs/RVL_SDK/include/revolution/kpad.h b/libs/RVL_SDK/include/revolution/kpad.h index b689990d..52a25682 100644 --- a/libs/RVL_SDK/include/revolution/kpad.h +++ b/libs/RVL_SDK/include/revolution/kpad.h @@ -4,82 +4,82 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus -#include #include +#include typedef WPADCallback KPADCallback; typedef union KPADEXStatus { struct { - Vec2 stick; + Vec2 stick; - Vec acc; - f32 acc_value; - f32 acc_speed; + Vec acc; + f32 acc_value; + f32 acc_speed; } fs; struct { - u32 hold; - u32 trig; - u32 release; + u32 hold; + u32 trig; + u32 release; - Vec2 lstick; - Vec2 rstick; + Vec2 lstick; + Vec2 rstick; - f32 ltrigger; - f32 rtrigger; + f32 ltrigger; + f32 rtrigger; } cl; } KPADEXStatus; typedef struct KPADStatus { - u32 hold; - u32 trig; - u32 release; + u32 hold; + u32 trig; + u32 release; - Vec acc; - f32 acc_value; - f32 acc_speed; + Vec acc; + f32 acc_value; + f32 acc_speed; - Vec2 pos; - Vec2 vec; - f32 speed; - - Vec2 horizon; - Vec2 hori_vec; - f32 hori_speed; + Vec2 pos; + Vec2 vec; + f32 speed; - f32 dist; - f32 dist_vec; - f32 dist_speed; + Vec2 horizon; + Vec2 hori_vec; + f32 hori_speed; - Vec2 acc_vertical; + f32 dist; + f32 dist_vec; + f32 dist_speed; - u8 dev_type; - s8 wpad_err; - s8 dpd_valid_fg; - u8 data_format; + Vec2 acc_vertical; - KPADEXStatus ex_status; + u8 dev_type; + s8 wpad_err; + s8 dpd_valid_fg; + u8 data_format; + + KPADEXStatus ex_status; } KPADStatus; -void KPADInit(); -s32 KPADRead(s32 chan, KPADStatus* status, u32 length); +void KPADInit(); +s32 KPADRead(s32 chan, KPADStatus* status, u32 length); -void KPADSetSensorHeight(s32 chan, f32 sensorHeight); -void KPADGetProjectionPos(Vec2* dest, Vec2* src, const Rect* param_3, f32 param_4); +void KPADSetSensorHeight(s32 chan, f32 sensorHeight); +void KPADGetProjectionPos(Vec2* dest, Vec2* src, const Rect* param_3, f32 param_4); -void KPADSetPosParam(s32 chan, f32 x, f32 y); -void KPADSetBtnRepeat(s32 chan, f32, f32); +void KPADSetPosParam(s32 chan, f32 x, f32 y); +void KPADSetBtnRepeat(s32 chan, f32, f32); -void KPADEnableDPD(s32 chan); -void KPADDisableDPD(s32 chan); +void KPADEnableDPD(s32 chan); +void KPADDisableDPD(s32 chan); -void KPADSetControlDpdCallback(s32 chan, KPADCallback *cb); +void KPADSetControlDpdCallback(s32 chan, KPADCallback* cb); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // REVOLUTION_KPAD_H +#endif // REVOLUTION_KPAD_H diff --git a/libs/RVL_SDK/include/revolution/kpr.h b/libs/RVL_SDK/include/revolution/kpr.h index d936ed77..5039a959 100644 --- a/libs/RVL_SDK/include/revolution/kpr.h +++ b/libs/RVL_SDK/include/revolution/kpr.h @@ -2,29 +2,30 @@ #define REVOLUTION_KPR_H #include +#include #ifdef __cplusplus extern "C" { #endif typedef enum _KPRMode { - KPR_MODE_NONE = 0, - KPR_MODE_ALT_KEYPAD = (1 << 0), - KPR_MODE_DEADKEY = (1 << 1), + KPR_MODE_NONE = 0, + KPR_MODE_ALT_KEYPAD = (1 << 0), + KPR_MODE_DEADKEY = (1 << 1), KPR_MODE_JP_ROMAJI_HIRAGANA = (1 << 2), KPR_MODE_JP_ROMAJI_KATAKANA = (1 << 3) } KPRMode; typedef struct _KPRQueue { - wchar_t text[5]; // 0x00 - KPRMode mode; // 0x0C - u8 oCount; // 0x10 - u8 iCount; // 0x11 - u32 altVal; // 0x14 + wchar_t text[5]; // 0x00 + KPRMode mode; // 0x0C + u8 oCount; // 0x10 + u8 iCount; // 0x11 + u32 altVal; // 0x14 } KPRQueue; #ifdef __cplusplus } #endif -#endif // REVOLUTION_KPR_H +#endif // REVOLUTION_KPR_H diff --git a/libs/RVL_SDK/include/revolution/mem.h b/libs/RVL_SDK/include/revolution/mem.h index 8bde4e8e..8bc35c45 100644 --- a/libs/RVL_SDK/include/revolution/mem.h +++ b/libs/RVL_SDK/include/revolution/mem.h @@ -11,4 +11,4 @@ #include -#endif // REVOLUTION_MEM_H +#endif // REVOLUTION_MEM_H diff --git a/libs/RVL_SDK/include/revolution/mem/allocator.h b/libs/RVL_SDK/include/revolution/mem/allocator.h index 250df35c..cbd49956 100644 --- a/libs/RVL_SDK/include/revolution/mem/allocator.h +++ b/libs/RVL_SDK/include/revolution/mem/allocator.h @@ -13,28 +13,28 @@ typedef void* (*MEMAllocatorAllocFunc)(MEMAllocator*, u32); typedef void (*MEMAllocatorFreeFunc)(MEMAllocator*, void*); typedef struct MEMAllocatorFunc { - MEMAllocatorAllocFunc allocFunc; // 0x00 - MEMAllocatorFreeFunc freeFunc; // 0x04 + MEMAllocatorAllocFunc allocFunc; // 0x00 + MEMAllocatorFreeFunc freeFunc; // 0x04 } MEMAllocatorFunc; struct MEMAllocator { - const MEMAllocatorFunc* func; // 0x00 - - void* heap; // 0x04 - - u32 heapParam1; // 0x08 - u32 heapParam2; // 0x0C + const MEMAllocatorFunc* func; // 0x00 + + void* heap; // 0x04 + + u32 heapParam1; // 0x08 + u32 heapParam2; // 0x0C }; -void* MEMAllocFromAllocator(MEMAllocator*, u32 size); -void MEMFreeToAllocator(MEMAllocator*, void* buffer); +void* MEMAllocFromAllocator(MEMAllocator*, u32 size); +void MEMFreeToAllocator(MEMAllocator*, void* buffer); -void MEMInitAllocatorForExpHeap(MEMAllocator* allocator, MEMHeapHandle heap, s32 align); -void MEMInitAllocatorForFrmHeap(MEMAllocator* allocator, MEMHeapHandle heap, s32 align); -void MEMInitAllocatorForUnitHeap(MEMAllocator* allocator, MEMHeapHandle heap); +void MEMInitAllocatorForExpHeap(MEMAllocator* allocator, MEMHeapHandle heap, s32 align); +void MEMInitAllocatorForFrmHeap(MEMAllocator* allocator, MEMHeapHandle heap, s32 align); +void MEMInitAllocatorForUnitHeap(MEMAllocator* allocator, MEMHeapHandle heap); #ifdef __cplusplus } #endif -#endif // REVOLUTION_MEM_ALLOCATOR_H +#endif // REVOLUTION_MEM_ALLOCATOR_H diff --git a/libs/RVL_SDK/include/revolution/mem/expHeap.h b/libs/RVL_SDK/include/revolution/mem/expHeap.h index f32e0425..086325e9 100644 --- a/libs/RVL_SDK/include/revolution/mem/expHeap.h +++ b/libs/RVL_SDK/include/revolution/mem/expHeap.h @@ -3,8 +3,8 @@ #include -#include #include +#include #include @@ -17,61 +17,60 @@ typedef struct MEMiExpHeapBlockHead MEMiExpHeapBlockHead; typedef struct MEMiExpHeapMBlockHead MEMiExpHeapMBlockHead; typedef struct MEMiExpBlockLink { - MEMiExpHeapMBlockHead *prev; - MEMiExpHeapMBlockHead *next; + MEMiExpHeapMBlockHead* prev; + MEMiExpHeapMBlockHead* next; } MEMiExpBlockLink; typedef struct MEMiExpBlockList { - MEMiExpHeapMBlockHead *head; - MEMiExpHeapMBlockHead *tail; + MEMiExpHeapMBlockHead* head; + MEMiExpHeapMBlockHead* tail; } MEMiExpBlockList; struct MEMiExpHeapMBlockHead { - u16 signature; // 0x00 + u16 signature; // 0x00 union { u16 val; struct { - u16 dir : 1; // 1000000000000000 - u16 align : 7; // 0111111100000000 - u16 groupID : 8; // 0000000011111111 + u16 dir : 1; // 1000000000000000 + u16 align : 7; // 0111111100000000 + u16 groupID : 8; // 0000000011111111 } fields; - } attribute; // 0x02 + } attribute; // 0x02 - u32 blockSize; // 0x04 + u32 blockSize; // 0x04 - MEMiExpBlockLink link; // 0x08 + MEMiExpBlockLink link; // 0x08 }; - typedef struct MEMiExpHeapHead { - MEMiExpBlockList freeBlocks; // 0x00 - MEMiExpBlockList usedBlocks; // 0x08 + MEMiExpBlockList freeBlocks; // 0x00 + MEMiExpBlockList usedBlocks; // 0x08 - u16 groupID; // 0x10 + u16 groupID; // 0x10 union { u16 val; struct { - u16 _reserved : 15; // 1111111111111110 - u16 allocMode : 1; // 0000000000000001 + u16 _reserved : 15; // 1111111111111110 + u16 allocMode : 1; // 0000000000000001 } fields; - } attribute; // 0x12 + } attribute; // 0x12 } MEMiExpHeapHead; -MEMHeapHandle MEMCreateExpHeapEx(void* startAddress, u32 size, u16 opt); -void* MEMDestroyExpHeap(MEMHeapHandle heap); +MEMHeapHandle MEMCreateExpHeapEx(void* startAddress, u32 size, u16 opt); +void* MEMDestroyExpHeap(MEMHeapHandle heap); -void* MEMAllocFromExpHeapEx(MEMHeapHandle heap, u32 size, int align); -u32 MEMResizeForMBlockExpHeap(MEMHeapHandle heap, void* block, u32 size); -void MEMFreeToExpHeap(MEMHeapHandle heap, void* block); +void* MEMAllocFromExpHeapEx(MEMHeapHandle heap, u32 size, int align); +u32 MEMResizeForMBlockExpHeap(MEMHeapHandle heap, void* block, u32 size); +void MEMFreeToExpHeap(MEMHeapHandle heap, void* block); -u32 MEMGetTotalFreeSizeForExpHeap(MEMHeapHandle heap); -u32 MEMGetAllocatableSizeForExpHeapEx(MEMHeapHandle heap, int align); +u32 MEMGetTotalFreeSizeForExpHeap(MEMHeapHandle heap); +u32 MEMGetAllocatableSizeForExpHeapEx(MEMHeapHandle heap, int align); -void MEMVisitAllocatedForExpHeap(MEMHeapHandle heap, void (*visitor)(void* , MEMHeapHandle , u32), u32 param); +void MEMVisitAllocatedForExpHeap(MEMHeapHandle heap, void (*visitor)(void*, MEMHeapHandle, u32), u32 param); -u32 MEMAdjustExpHeap(MEMHeapHandle heap); +u32 MEMAdjustExpHeap(MEMHeapHandle heap); inline MEMHeapHandle MEMCreateExpHeap(void* start, u32 size) { return MEMCreateExpHeapEx(start, size, 0); @@ -89,4 +88,4 @@ inline u32 MEMGetAllocatableSizeForExpHeap(MEMiHeapHead* heap) { } #endif -#endif // REVOLUTION_MEM_EXP_HEAP_H +#endif // REVOLUTION_MEM_EXP_HEAP_H diff --git a/libs/RVL_SDK/include/revolution/mem/frameHeap.h b/libs/RVL_SDK/include/revolution/mem/frameHeap.h index 1d1e07db..c44104de 100644 --- a/libs/RVL_SDK/include/revolution/mem/frameHeap.h +++ b/libs/RVL_SDK/include/revolution/mem/frameHeap.h @@ -17,34 +17,34 @@ typedef enum { typedef struct MEMiFrmHeapState MEMiFrmHeapState; struct MEMiFrmHeapState { - u32 tag; // 0x00 - void* head; // 0x04 - void* tail; // 0x08 - MEMiFrmHeapState* prevState; // 0x0C + u32 tag; // 0x00 + void* head; // 0x04 + void* tail; // 0x08 + MEMiFrmHeapState* prevState; // 0x0C }; typedef struct MEMiFrmHeapHead { - void* head; // 0x00 - void* tail; // 0x04 - MEMiFrmHeapState* state; // 0x08 + void* head; // 0x00 + void* tail; // 0x04 + MEMiFrmHeapState* state; // 0x08 } MEMiFrmHeapHead; -#define MEM_FRM_HEAP_MIN_SIZE (sizeof(MEMiHeapHead) + sizeof(MEMiFrmHeapHead)) +#define MEM_FRM_HEAP_MIN_SIZE (sizeof(MEMiHeapHead) + sizeof(MEMiFrmHeapHead)) -MEMHeapHandle MEMCreateFrmHeapEx(void* start, u32 size, u16 flags); -void* MEMDestroyFrmHeap(MEMHeapHandle heap); +MEMHeapHandle MEMCreateFrmHeapEx(void* start, u32 size, u16 flags); +void* MEMDestroyFrmHeap(MEMHeapHandle heap); -void* MEMAllocFromFrmHeapEx(MEMHeapHandle heap, u32 size, int align); -void MEMFreeToFrmHeap(MEMHeapHandle heap, int mode); +void* MEMAllocFromFrmHeapEx(MEMHeapHandle heap, u32 size, int align); +void MEMFreeToFrmHeap(MEMHeapHandle heap, int mode); -u32 MEMGetAllocatableSizeForFrmHeapEx(MEMHeapHandle heap, int align); +u32 MEMGetAllocatableSizeForFrmHeapEx(MEMHeapHandle heap, int align); -int MEMRecordStateForFrmHeap(MEMHeapHandle heap, u32 tag); -int MEMFreeByStateToFrmHeap(MEMHeapHandle heap, u32 tag); +int MEMRecordStateForFrmHeap(MEMHeapHandle heap, u32 tag); +int MEMFreeByStateToFrmHeap(MEMHeapHandle heap, u32 tag); -u32 MEMAdjustFrmHeap(MEMHeapHandle heap); +u32 MEMAdjustFrmHeap(MEMHeapHandle heap); -u32 MEMResizeForMBlockFrmHeap(MEMHeapHandle heap, void* memBlock, u32 size); +u32 MEMResizeForMBlockFrmHeap(MEMHeapHandle heap, void* memBlock, u32 size); static MEMiHeapHead* MEMCreateFrmHeap(void* start, u32 size) { return MEMCreateFrmHeapEx(start, size, 0); @@ -62,4 +62,4 @@ static u32 MEMGetAllocatableSizeForFrmHeap(MEMiHeapHead* heap) { } #endif -#endif // REVOLUTION_MEM_FRAME_HEAP_H +#endif // REVOLUTION_MEM_FRAME_HEAP_H diff --git a/libs/RVL_SDK/include/revolution/mem/heapCommon.h b/libs/RVL_SDK/include/revolution/mem/heapCommon.h index 0aa7dcfa..3bfcbb10 100644 --- a/libs/RVL_SDK/include/revolution/mem/heapCommon.h +++ b/libs/RVL_SDK/include/revolution/mem/heapCommon.h @@ -12,36 +12,36 @@ extern "C" { #endif typedef enum MEMHeapOpt { - MEM_HEAP_OPT_CLEAR_ALLOC = (1 << 0), - MEM_HEAP_OPT_DEBUG_FILL = (1 << 1), - MEM_HEAP_OPT_THREAD_SAFE = (1 << 2) + MEM_HEAP_OPT_CLEAR_ALLOC = (1 << 0), + MEM_HEAP_OPT_DEBUG_FILL = (1 << 1), + MEM_HEAP_OPT_THREAD_SAFE = (1 << 2) } MEMHeapOpt; typedef struct MEMiHeapHead { - u32 magic; // 0x00 + u32 magic; // 0x00 - MEMLink link; // 0x04 - MEMList list; // 0x0C + MEMLink link; // 0x04 + MEMList list; // 0x0C - void* heapStart; // 0x18 - void* heapEnd; // 0x1C + void* heapStart; // 0x18 + void* heapEnd; // 0x1C - OSMutex mutex; // 0x20 + OSMutex mutex; // 0x20 union { u32 attr; struct { - u32 reserved : 24; // 11111111111111111111111100000000 - u32 optFlag : 8; // 00000000000000000000000011111111 + u32 reserved : 24; // 11111111111111111111111100000000 + u32 optFlag : 8; // 00000000000000000000000011111111 }; - }; // 0x38 + }; // 0x38 } MEMiHeapHead; typedef MEMiHeapHead* MEMHeapHandle; -void MEMiInitHeapHead(MEMHeapHandle heap, u32 magic, void* heapStart, void* heapEnd, u16 optFlag); -void MEMiFinalizeHeap(MEMHeapHandle heap); -MEMHeapHandle MEMFindContainHeap(const void* memBlock); +void MEMiInitHeapHead(MEMHeapHandle heap, u32 magic, void* heapStart, void* heapEnd, u16 optFlag); +void MEMiFinalizeHeap(MEMHeapHandle heap); +MEMHeapHandle MEMFindContainHeap(const void* memBlock); static inline void* MEMGetHeapStartAddress(MEMHeapHandle heap) { return heap->heapStart; @@ -59,4 +59,4 @@ static s32 MEMGetHeapTotalSize(const MEMiHeapHead* heap) { } #endif -#endif // REVOLUTION_MEM_HEAP_COMMON_H +#endif // REVOLUTION_MEM_HEAP_COMMON_H diff --git a/libs/RVL_SDK/include/revolution/mem/list.h b/libs/RVL_SDK/include/revolution/mem/list.h index 54ef521a..aea1f213 100644 --- a/libs/RVL_SDK/include/revolution/mem/list.h +++ b/libs/RVL_SDK/include/revolution/mem/list.h @@ -8,27 +8,27 @@ extern "C" { #endif typedef struct MEMList { - void* head; // 0x00 - void* tail; // 0x04 + void* head; // 0x00 + void* tail; // 0x04 - u16 length; // 0x08 - u16 offset; // 0x0A + u16 length; // 0x08 + u16 offset; // 0x0A } MEMList; typedef struct MEMLink { - void* prev; // 0x00 - void* next; // 0x04 + void* prev; // 0x00 + void* next; // 0x04 } MEMLink; -void MEMInitList(MEMList* list, u16 offset); +void MEMInitList(MEMList* list, u16 offset); -void MEMAppendListObject(MEMList* list, void* object); -void MEMRemoveListObject(MEMList* list, void* object); +void MEMAppendListObject(MEMList* list, void* object); +void MEMRemoveListObject(MEMList* list, void* object); -void* MEMGetNextListObject(MEMList* list, void* object); +void* MEMGetNextListObject(MEMList* list, void* object); #ifdef __cplusplus } #endif -#endif // REVOLUTION_MEM_LIST_H +#endif // REVOLUTION_MEM_LIST_H diff --git a/libs/RVL_SDK/include/revolution/mem/unitHeap.h b/libs/RVL_SDK/include/revolution/mem/unitHeap.h index dc4270e9..d565dbb4 100644 --- a/libs/RVL_SDK/include/revolution/mem/unitHeap.h +++ b/libs/RVL_SDK/include/revolution/mem/unitHeap.h @@ -11,21 +11,21 @@ extern "C" { typedef struct MEMiUntHeapMBlockHead MEMiUntHeapMBlockHead; struct MEMiUntHeapMBlockHead { - MEMiUntHeapMBlockHead* next; // 0x00 + MEMiUntHeapMBlockHead* next; // 0x00 }; typedef struct MEMiUntHeapHead { - MEMiUntHeapMBlockHead* freeList; // 0x00 - u32 blockSize; // 0x04 + MEMiUntHeapMBlockHead* freeList; // 0x00 + u32 blockSize; // 0x04 } MEMiUntHeapHead; -MEMHeapHandle MEMCreateUnitHeapEx(void* start, u32 heapSize, u32 memBlockSize, int align, u16 flags); -void* MEMDestroyUnitHeap(MEMHeapHandle heap); +MEMHeapHandle MEMCreateUnitHeapEx(void* start, u32 heapSize, u32 memBlockSize, int align, u16 flags); +void* MEMDestroyUnitHeap(MEMHeapHandle heap); -void* MEMAllocFromUnitHeap(MEMHeapHandle heap); -void MEMFreeToUnitHeap(MEMHeapHandle heap, void* addr); +void* MEMAllocFromUnitHeap(MEMHeapHandle heap); +void MEMFreeToUnitHeap(MEMHeapHandle heap, void* addr); -u32 MEMCalcHeapSizeForUnitHeap(u32 unit_size, u32 unit_count, int align); +u32 MEMCalcHeapSizeForUnitHeap(u32 unit_size, u32 unit_count, int align); static u32 MEMGetMemBlockSizeForUnitHeap(MEMHeapHandle heap) { return ((MEMiUntHeapHead*)((u8*)heap + sizeof(MEMiHeapHead)))->blockSize; @@ -39,4 +39,4 @@ static inline MEMHeapHandle MEMCreateUnitHeap(void* start, u32 heapSize, u32 mem } #endif -#endif // REVOLUTION_MEM_UNIT_HEAP_H +#endif // REVOLUTION_MEM_UNIT_HEAP_H diff --git a/libs/RVL_SDK/include/revolution/mtx.h b/libs/RVL_SDK/include/revolution/mtx.h index 28eb4ed8..31e206be 100644 --- a/libs/RVL_SDK/include/revolution/mtx.h +++ b/libs/RVL_SDK/include/revolution/mtx.h @@ -9,98 +9,98 @@ extern "C" { // Mtx -void PSMTXIdentity(Mtx m); -void PSMTXCopy(const Mtx src, Mtx dst); -void PSMTXConcat(const Mtx a, const Mtx b, Mtx ab); -u32 PSMTXInverse(const Mtx src, Mtx inv); -u32 PSMTXInvXpose(const Mtx src, Mtx invX); -void PSMTXRotRad(Mtx m, char axis, f32 rad); -void PSMTXRotTrig(Mtx m, char axis, f32 sinA, f32 cosA); -void PSMTXTrans(Mtx m, f32 xT, f32 yT, f32 zT); -void PSMTXTransApply(const Mtx src, Mtx dst, f32 xT, f32 yT, f32 zT); -void PSMTXScale(Mtx m, f32 xS, f32 yS, f32 zS); -void PSMTXScaleApply(const Mtx src, Mtx dst, f32 xS, f32 yS, f32 zS); +void PSMTXIdentity(Mtx m); +void PSMTXCopy(const Mtx src, Mtx dst); +void PSMTXConcat(const Mtx a, const Mtx b, Mtx ab); +u32 PSMTXInverse(const Mtx src, Mtx inv); +u32 PSMTXInvXpose(const Mtx src, Mtx invX); +void PSMTXRotRad(Mtx m, char axis, f32 rad); +void PSMTXRotTrig(Mtx m, char axis, f32 sinA, f32 cosA); +void PSMTXTrans(Mtx m, f32 xT, f32 yT, f32 zT); +void PSMTXTransApply(const Mtx src, Mtx dst, f32 xT, f32 yT, f32 zT); +void PSMTXScale(Mtx m, f32 xS, f32 yS, f32 zS); +void PSMTXScaleApply(const Mtx src, Mtx dst, f32 xS, f32 yS, f32 zS); -void C_MTXIdentity(Mtx m); -void C_MTXCopy(const Mtx src, Mtx dst); -void C_MTXConcat(const Mtx a, const Mtx b, Mtx ab); -u32 C_MTXInverse(const Mtx src, Mtx inv); -u32 C_MTXInvXpose(const Mtx src, Mtx invX); -void C_MTXRotRad(Mtx m, char axis, f32 rad); -void C_MTXRotTrig(Mtx m, char axis, f32 sinA, f32 cosA); -void C_MTXTrans(Mtx m, f32 xT, f32 yT, f32 zT); -void C_MTXTransApply(const Mtx src, Mtx dst, f32 xT, f32 yT, f32 zT); -void C_MTXScale(Mtx m, f32 xS, f32 yS, f32 zS); -void C_MTXScaleApply(const Mtx src, Mtx dst, f32 xS, f32 yS, f32 zS); -void C_MTXLookAt(Mtx m, const Point3d* camPos, const Vec* camUp, const Point3d* target); +void C_MTXIdentity(Mtx m); +void C_MTXCopy(const Mtx src, Mtx dst); +void C_MTXConcat(const Mtx a, const Mtx b, Mtx ab); +u32 C_MTXInverse(const Mtx src, Mtx inv); +u32 C_MTXInvXpose(const Mtx src, Mtx invX); +void C_MTXRotRad(Mtx m, char axis, f32 rad); +void C_MTXRotTrig(Mtx m, char axis, f32 sinA, f32 cosA); +void C_MTXTrans(Mtx m, f32 xT, f32 yT, f32 zT); +void C_MTXTransApply(const Mtx src, Mtx dst, f32 xT, f32 yT, f32 zT); +void C_MTXScale(Mtx m, f32 xS, f32 yS, f32 zS); +void C_MTXScaleApply(const Mtx src, Mtx dst, f32 xS, f32 yS, f32 zS); +void C_MTXLookAt(Mtx m, const Point3d* camPos, const Vec* camUp, const Point3d* target); #ifdef DEBUG -#define MTXIdentity C_MTXIdentity -#define MTXCopy C_MTXCopy -#define MTXConcat C_MTXConcat -#define MTXInverse C_MTXInverse -#define MTXInvXpose C_MTXInvXpose -#define MTXRotRad C_MTXRotRad -#define MTXRotTrig C_MTXRotTrig -#define MTXTrans C_MTXTrans -#define MTXTransApply C_MTXTransApply -#define MTXScale C_MTXScale -#define MTXScaleApply C_MTXScaleApply +#define MTXIdentity C_MTXIdentity +#define MTXCopy C_MTXCopy +#define MTXConcat C_MTXConcat +#define MTXInverse C_MTXInverse +#define MTXInvXpose C_MTXInvXpose +#define MTXRotRad C_MTXRotRad +#define MTXRotTrig C_MTXRotTrig +#define MTXTrans C_MTXTrans +#define MTXTransApply C_MTXTransApply +#define MTXScale C_MTXScale +#define MTXScaleApply C_MTXScaleApply #else -#define MTXIdentity PSMTXIdentity -#define MTXCopy PSMTXCopy -#define MTXConcat PSMTXConcat -#define MTXInverse PSMTXInverse -#define MTXInvXpose PSMTXInvXpose -#define MTXRotRad PSMTXRotRad -#define MTXRotTrig PSMTXRotTrig -#define MTXTrans PSMTXTrans -#define MTXTransApply PSMTXTransApply -#define MTXScale PSMTXScale -#define MTXScaleApply PSMTXScaleApply -#endif // DEBUG -#define MTXLookAt C_MTXLookAt /* C only */ +#define MTXIdentity PSMTXIdentity +#define MTXCopy PSMTXCopy +#define MTXConcat PSMTXConcat +#define MTXInverse PSMTXInverse +#define MTXInvXpose PSMTXInvXpose +#define MTXRotRad PSMTXRotRad +#define MTXRotTrig PSMTXRotTrig +#define MTXTrans PSMTXTrans +#define MTXTransApply PSMTXTransApply +#define MTXScale PSMTXScale +#define MTXScaleApply PSMTXScaleApply +#endif // DEBUG +#define MTXLookAt C_MTXLookAt /* C only */ // MtxVec -void PSMTXMultVec(const Mtx m, const Vec* src, Vec* dst); +void PSMTXMultVec(const Mtx m, const Vec* src, Vec* dst); -void C_MTXMultVec(const Mtx m, const Vec* src, Vec* dst); +void C_MTXMultVec(const Mtx m, const Vec* src, Vec* dst); #ifdef DEBUG -#define MTXMultVec C_MTXMultVec +#define MTXMultVec C_MTXMultVec #else -#define MTXMultVec PSMTXMultVec -#endif // DEBUG +#define MTXMultVec PSMTXMultVec +#endif // DEBUG // Mtx44 -void C_MTXFrustum(Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f); -void C_MTXPerspective(Mtx44 m, f32 fovY, f32 aspect, f32 n, f32 f); -void C_MTXOrtho(Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f); +void C_MTXFrustum(Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f); +void C_MTXPerspective(Mtx44 m, f32 fovY, f32 aspect, f32 n, f32 f); +void C_MTXOrtho(Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f); -#define MTXFrustum C_MTXFrustum -#define MTXPerspective C_MTXPerspective -#define MTXOrtho C_MTXOrtho +#define MTXFrustum C_MTXFrustum +#define MTXPerspective C_MTXPerspective +#define MTXOrtho C_MTXOrtho // Vec -void PSVECNormalize(const Vec* src, Vec* dst); -void PSVECCrossProduct(const Vec* a, const Vec* b, Vec* axb); +void PSVECNormalize(const Vec* src, Vec* dst); +void PSVECCrossProduct(const Vec* a, const Vec* b, Vec* axb); -void C_VECNormalize(const Vec* src, Vec* dst); -void C_VECCrossProduct(const Vec* a, const Vec* b, Vec* axb); +void C_VECNormalize(const Vec* src, Vec* dst); +void C_VECCrossProduct(const Vec* a, const Vec* b, Vec* axb); #ifdef DEBUG -#define VECNormalize C_VECNormalize +#define VECNormalize C_VECNormalize #define VECCrossProduct C_VECCrossProduct #else -#define VECNormalize PSVECNormalize +#define VECNormalize PSVECNormalize #define VECCrossProduct PSVECCrossProduct -#endif // DEBUG +#endif // DEBUG #ifdef __cplusplus } #endif -#endif // REVOLUTION_MTX_H +#endif // REVOLUTION_MTX_H diff --git a/libs/RVL_SDK/include/revolution/mtx/GeoTypes.h b/libs/RVL_SDK/include/revolution/mtx/GeoTypes.h index 42d438ab..f73232d0 100644 --- a/libs/RVL_SDK/include/revolution/mtx/GeoTypes.h +++ b/libs/RVL_SDK/include/revolution/mtx/GeoTypes.h @@ -16,15 +16,15 @@ typedef struct { } S16Vec, *S16VecPtr; typedef struct Vec2 { - f32 x; // 0x00 - f32 y; // 0x04 + f32 x; // 0x00 + f32 y; // 0x04 } Vec2; typedef struct Rect { - f32 left; // 0x00 - f32 top; // 0x04 - f32 right; // 0x08 - f32 bottom; // 0x0C + f32 left; // 0x00 + f32 top; // 0x04 + f32 right; // 0x08 + f32 bottom; // 0x0C } Rect; typedef struct { @@ -53,4 +53,4 @@ typedef f32 (*ROMtxPtr)[4]; } #endif -#endif // REVOLUTION_MTX_GEO_TYPES_H +#endif // REVOLUTION_MTX_GEO_TYPES_H diff --git a/libs/RVL_SDK/include/revolution/nand.h b/libs/RVL_SDK/include/revolution/nand.h index 4c66ae83..f2c6c1ac 100644 --- a/libs/RVL_SDK/include/revolution/nand.h +++ b/libs/RVL_SDK/include/revolution/nand.h @@ -23,36 +23,36 @@ extern "C" { * `shared2/title` */ -#define NAND_BLOCK_SIZE (16*1024) /* 16 KB */ +#define NAND_BLOCK_SIZE (16 * 1024) /* 16 KB */ -#define NAND_MB_TO_BYTES(x) (((x)*1024)*1024) -#define NAND_MB_TO_BLOCKS(x) (NAND_MB_TO_BYTES(x)/NAND_BLOCK_SIZE) +#define NAND_MB_TO_BYTES(x) (((x) * 1024) * 1024) +#define NAND_MB_TO_BLOCKS(x) (NAND_MB_TO_BYTES(x) / NAND_BLOCK_SIZE) // The amount of blocks of the entire area of the System Memory. -#define NAND_MAX_BLOCKS NAND_MB_TO_BLOCKS(512) /* 32768 blocks / 4096 data management blocks */ -//The amount of blocks of the user area of the System Memory. -#define NAND_MAX_USER_BLOCKS NAND_MB_TO_BLOCKS(272) /* 17408 blocks / 2176 data management blocks */ -//The amount of blocks of the user area of the System Memory. -#define NAND_MAX_SYSTEM_BLOCKS NAND_MB_TO_BLOCKS(240) /* 17408 blocks / 2176 data management blocks */ +#define NAND_MAX_BLOCKS NAND_MB_TO_BLOCKS(512) /* 32768 blocks / 4096 data management blocks */ +// The amount of blocks of the user area of the System Memory. +#define NAND_MAX_USER_BLOCKS NAND_MB_TO_BLOCKS(272) /* 17408 blocks / 2176 data management blocks */ +// The amount of blocks of the user area of the System Memory. +#define NAND_MAX_SYSTEM_BLOCKS NAND_MB_TO_BLOCKS(240) /* 17408 blocks / 2176 data management blocks */ -#define NAND_BOOT_BLOCKS NAND_MB_TO_BLOCKS(1) /* 64 blocks / 8 data management blocks */ -#define NAND_FAT_BLOCKS NAND_MB_TO_BLOCKS(4) /* 256 blocks / 32 data management blocks */ +#define NAND_BOOT_BLOCKS NAND_MB_TO_BLOCKS(1) /* 64 blocks / 8 data management blocks */ +#define NAND_FAT_BLOCKS NAND_MB_TO_BLOCKS(4) /* 256 blocks / 32 data management blocks */ -#define NAND_CRITICAL_BLOCKS (NAND_BOOT_BLOCKS+NAND_FAT_BLOCKS) +#define NAND_CRITICAL_BLOCKS (NAND_BOOT_BLOCKS + NAND_FAT_BLOCKS) /* I-NODES */ -#define NAND_MAX_USER_INODES 4000 -#define NAND_MAX_SYSTEM_INODES 2143 -#define NAND_MAX_INODES 6143 +#define NAND_MAX_USER_INODES 4000 +#define NAND_MAX_SYSTEM_INODES 2143 +#define NAND_MAX_INODES 6143 /* OTHER STUFF */ -#define NAND_MAX_PATH 64 -#define NAND_MAX_DIR_PATH 12 +#define NAND_MAX_PATH 64 +#define NAND_MAX_DIR_PATH 12 -#define NANDTitleIdLo(t) (u32)((((u64)(t))) & 0xFFFFFFFF) -#define NANDTitleIdHi(t) (u32)((((u64)(t)) >> 32) & 0xFFFFFFFF) +#define NANDTitleIdLo(t) (u32)((((u64)(t))) & 0xFFFFFFFF) +#define NANDTitleIdHi(t) (u32)((((u64)(t)) >> 32) & 0xFFFFFFFF) enum { NAND_RESULT_FATAL_ERROR = -128, @@ -92,9 +92,9 @@ enum { }; enum { - NAND_PERM_MASK_BOTH = 0, + NAND_PERM_MASK_BOTH = 0, NAND_PERM_MASK_GROUP = 2, - NAND_PERM_MASK_USER = 4, + NAND_PERM_MASK_USER = 4, }; enum { @@ -104,153 +104,153 @@ enum { }; enum { - NAND_PERM_USER_READ = (NAND_ACCESS_READ << NAND_PERM_MASK_USER), - NAND_PERM_USER_WRITE = (NAND_ACCESS_WRITE << NAND_PERM_MASK_USER), - NAND_PERM_USER = NAND_PERM_USER_READ | NAND_PERM_USER_WRITE, + NAND_PERM_USER_READ = (NAND_ACCESS_READ << NAND_PERM_MASK_USER), + NAND_PERM_USER_WRITE = (NAND_ACCESS_WRITE << NAND_PERM_MASK_USER), + NAND_PERM_USER = NAND_PERM_USER_READ | NAND_PERM_USER_WRITE, - NAND_PERM_GROUP_READ = (NAND_ACCESS_READ << NAND_PERM_MASK_GROUP), - NAND_PERM_GROUP_WRITE = (NAND_ACCESS_WRITE << NAND_PERM_MASK_GROUP), - NAND_PERM_GROUP = NAND_PERM_GROUP_READ | NAND_PERM_GROUP_WRITE, + NAND_PERM_GROUP_READ = (NAND_ACCESS_READ << NAND_PERM_MASK_GROUP), + NAND_PERM_GROUP_WRITE = (NAND_ACCESS_WRITE << NAND_PERM_MASK_GROUP), + NAND_PERM_GROUP = NAND_PERM_GROUP_READ | NAND_PERM_GROUP_WRITE, - NAND_PERM_BOTH_READ = (NAND_ACCESS_READ << NAND_PERM_MASK_BOTH), - NAND_PERM_BOTH_WRITE = (NAND_ACCESS_WRITE << NAND_PERM_MASK_BOTH), - NAND_PERM_BOTH = NAND_PERM_BOTH_READ | NAND_PERM_BOTH_WRITE, + NAND_PERM_BOTH_READ = (NAND_ACCESS_READ << NAND_PERM_MASK_BOTH), + NAND_PERM_BOTH_WRITE = (NAND_ACCESS_WRITE << NAND_PERM_MASK_BOTH), + NAND_PERM_BOTH = NAND_PERM_BOTH_READ | NAND_PERM_BOTH_WRITE, - NAND_PERM_ALL_READ = NAND_PERM_USER_READ | NAND_PERM_GROUP_READ | NAND_PERM_BOTH_READ, - NAND_PERM_ALL_WRITE = NAND_PERM_USER_WRITE | NAND_PERM_GROUP_WRITE | NAND_PERM_BOTH_WRITE, - NAND_PERM_ALL_RW = NAND_PERM_ALL_READ | NAND_PERM_ALL_WRITE + NAND_PERM_ALL_READ = NAND_PERM_USER_READ | NAND_PERM_GROUP_READ | NAND_PERM_BOTH_READ, + NAND_PERM_ALL_WRITE = NAND_PERM_USER_WRITE | NAND_PERM_GROUP_WRITE | NAND_PERM_BOTH_WRITE, + NAND_PERM_ALL_RW = NAND_PERM_ALL_READ | NAND_PERM_ALL_WRITE }; typedef struct NANDFileInfo { - s32 fileDescriptor; // 0x00 - s32 origFd; // 0x04 + s32 fileDescriptor; // 0x00 + s32 origFd; // 0x04 - char origPath[NAND_MAX_PATH]; // 0x08 - char tmpPath[NAND_MAX_PATH]; // 0x48 + char origPath[NAND_MAX_PATH]; // 0x08 + char tmpPath[NAND_MAX_PATH]; // 0x48 - u8 accType; // 0x88 - u8 stage; // 0x89 - u8 mark; // 0x8A + u8 accType; // 0x88 + u8 stage; // 0x89 + u8 mark; // 0x8A } NANDFileInfo; typedef struct NANDStatus { u32 ownerId; // 0x00 u16 groupId; // 0x04 - u8 attribute; // 0x06 - u8 permission; // 0x07 + u8 attribute; // 0x06 + u8 permission; // 0x07 } NANDStatus; typedef struct NANDCommandBlock NANDCommandBlock; typedef void (*NANDCallback)(s32 result, NANDCommandBlock* block); struct NANDCommandBlock { - void* userData; // 0x00 - NANDCallback callback; // 0x04 - void* fileInfo; // 0x08 - void* bytes; // 0x0C - void* inodes; // 0x10 - void* status; // 0x14 + void* userData; // 0x00 + NANDCallback callback; // 0x04 + void* fileInfo; // 0x08 + void* bytes; // 0x0C + void* inodes; // 0x10 + void* status; // 0x14 - u32 ownerId; // 0x18 - u16 groupId; // 0x1C + u32 ownerId; // 0x18 + u16 groupId; // 0x1C - u8 nextStage; // 0x1E - u32 attr; // 0x20 + u8 nextStage; // 0x1E + u32 attr; // 0x20 - u32 ownerAcc; // 0x24 - u32 groupAcc; // 0x28 - u32 othersAcc; // 0x2C + u32 ownerAcc; // 0x24 + u32 groupAcc; // 0x28 + u32 othersAcc; // 0x2C - u32 num; // 0x30 - char absPath[NAND_MAX_PATH]; // 0x34 - u32* length; // 0x74 - u32* pos; // 0x78 - int state; // 0x7C - void* copyBuf; // 0x80 - u32 bufLength; // 0x84 - u8* type; // 0x88 - u32 uniqueNo; // 0x8C + u32 num; // 0x30 + char absPath[NAND_MAX_PATH]; // 0x34 + u32* length; // 0x74 + u32* pos; // 0x78 + int state; // 0x7C + void* copyBuf; // 0x80 + u32 bufLength; // 0x84 + u8* type; // 0x88 + u32 uniqueNo; // 0x8C - u32 reqBlocks; // 0x90 - u32 reqInodes; // 0x94 + u32 reqBlocks; // 0x90 + u32 reqInodes; // 0x94 - u32* answer; // 0x98 + u32* answer; // 0x98 - u32 homeBlocks; // 0x9C - u32 homeInodes; // 0xA0 + u32 homeBlocks; // 0x9C + u32 homeInodes; // 0xA0 - u32 userBlocks; // 0xA4 - u32 userInodes; // 0xA8 + u32 userBlocks; // 0xA4 + u32 userInodes; // 0xA8 - u32 workBlocks; // 0xAC - u32 workInodes; // 0xB0 + u32 workBlocks; // 0xAC + u32 workInodes; // 0xB0 - const char** dir; // 0xB4 + const char** dir; // 0xB4 - BOOL simpleFlag; // 0xB8 + BOOL simpleFlag; // 0xB8 }; -s32 NANDInit(); +s32 NANDInit(); -s32 NANDCreate(const char* path, u8 perm, u8 attr); +s32 NANDCreate(const char* path, u8 perm, u8 attr); -s32 NANDOpen(const char* path, NANDFileInfo* info, u8 accType); -s32 NANDOpenAsync(const char* path, NANDFileInfo* info, u8 accType, NANDCallback callback, NANDCommandBlock* block); -s32 NANDSafeOpen(const char* path, NANDFileInfo* info, u8 accType, void* buffer, u32 length); +s32 NANDOpen(const char* path, NANDFileInfo* info, u8 accType); +s32 NANDOpenAsync(const char* path, NANDFileInfo* info, u8 accType, NANDCallback callback, NANDCommandBlock* block); +s32 NANDSafeOpen(const char* path, NANDFileInfo* info, u8 accType, void* buffer, u32 length); -s32 NANDRead(NANDFileInfo* info, void* buffer, u32 length); -s32 NANDReadAsync(NANDFileInfo* info, void* buffer, u32 length, NANDCallback callback, NANDCommandBlock* block); +s32 NANDRead(NANDFileInfo* info, void* buffer, u32 length); +s32 NANDReadAsync(NANDFileInfo* info, void* buffer, u32 length, NANDCallback callback, NANDCommandBlock* block); -s32 NANDWrite(NANDFileInfo* info, const void* buffer, u32 length); -s32 NANDWriteAsync(NANDFileInfo* info, const void* buffer, u32 length, NANDCallback callback, NANDCommandBlock* block); +s32 NANDWrite(NANDFileInfo* info, const void* buffer, u32 length); +s32 NANDWriteAsync(NANDFileInfo* info, const void* buffer, u32 length, NANDCallback callback, NANDCommandBlock* block); -s32 NANDSeek(NANDFileInfo* info, s32 offset, s32 whence); -s32 NANDSeekAsync(NANDFileInfo* info, s32 offset, s32 whence, NANDCallback callback, NANDCommandBlock* block); +s32 NANDSeek(NANDFileInfo* info, s32 offset, s32 whence); +s32 NANDSeekAsync(NANDFileInfo* info, s32 offset, s32 whence, NANDCallback callback, NANDCommandBlock* block); -s32 NANDTell(NANDFileInfo* info, u32* pos); +s32 NANDTell(NANDFileInfo* info, u32* pos); -s32 NANDGetLength(NANDFileInfo* info, u32* length); -s32 NANDGetLengthAsync(NANDFileInfo* info, u32* length, NANDCallback callback, NANDCommandBlock* block); +s32 NANDGetLength(NANDFileInfo* info, u32* length); +s32 NANDGetLengthAsync(NANDFileInfo* info, u32* length, NANDCallback callback, NANDCommandBlock* block); -s32 NANDGetStatus(const char* path, NANDStatus* status); -s32 NANDSetStatus(const char* path, NANDStatus* status); +s32 NANDGetStatus(const char* path, NANDStatus* status); +s32 NANDSetStatus(const char* path, NANDStatus* status); -s32 NANDClose(NANDFileInfo* info); -s32 NANDCloseAsync(NANDFileInfo* info, NANDCallback callback, NANDCommandBlock* block); -s32 NANDSafeClose(NANDFileInfo* info); -s32 NANDSafeCloseAsync(NANDFileInfo* info, NANDCallback callback, NANDCommandBlock* block); +s32 NANDClose(NANDFileInfo* info); +s32 NANDCloseAsync(NANDFileInfo* info, NANDCallback callback, NANDCommandBlock* block); +s32 NANDSafeClose(NANDFileInfo* info); +s32 NANDSafeCloseAsync(NANDFileInfo* info, NANDCallback callback, NANDCommandBlock* block); -s32 NANDDelete(const char* path); +s32 NANDDelete(const char* path); -s32 NANDGetType(const char* path, u8* type); +s32 NANDGetType(const char* path, u8* type); -void NANDSetUserData(NANDCommandBlock* block, void* data); -void* NANDGetUserData(NANDCommandBlock* block); +void NANDSetUserData(NANDCommandBlock* block, void* data); +void* NANDGetUserData(NANDCommandBlock* block); -s32 NANDCreateDir(const char* path, u8 perm, u8 attr); +s32 NANDCreateDir(const char* path, u8 perm, u8 attr); -s32 NANDChangeDir(const char* path); -s32 NANDGetCurrentDir(char* path); +s32 NANDChangeDir(const char* path); +s32 NANDGetCurrentDir(char* path); -s32 NANDReadDir(const char* path, char* nameList, u32* num); +s32 NANDReadDir(const char* path, char* nameList, u32* num); -s32 NANDGetHomeDir(char* path); +s32 NANDGetHomeDir(char* path); /* NANDCheck */ enum { - NAND_CHECK_SUCCESS = 0, + NAND_CHECK_SUCCESS = 0, - NAND_CHECK_HOME_INSSPACE = (1 << 0), - NAND_CHECK_HOME_INSINODE = (1 << 1), - NAND_CHECK_SYS_INSSPACE = (1 << 2), - NAND_CHECK_SYS_INSINODE = (1 << 3), + NAND_CHECK_HOME_INSSPACE = (1 << 0), + NAND_CHECK_HOME_INSINODE = (1 << 1), + NAND_CHECK_SYS_INSSPACE = (1 << 2), + NAND_CHECK_SYS_INSINODE = (1 << 3), }; -s32 NANDCheck(u32 fsblock, u32 inode, u32* answer); +s32 NANDCheck(u32 fsblock, u32 inode, u32* answer); #ifdef __cplusplus } #endif -#endif // REVOLUTION_NAND_H +#endif // REVOLUTION_NAND_H diff --git a/libs/RVL_SDK/include/revolution/os.h b/libs/RVL_SDK/include/revolution/os.h index 14a28643..400df1b3 100644 --- a/libs/RVL_SDK/include/revolution/os.h +++ b/libs/RVL_SDK/include/revolution/os.h @@ -11,72 +11,72 @@ extern "C" { #include -#define OS_CONSOLE_MASK (0xF000 << 16) -#define OS_CONSOLE_MASK_RVL (0x0000 << 16) -#define OS_CONSOLE_MASK_DEV (0x1000 << 16) -#define OS_CONSOLE_MASK_TDEV (0x2000 << 16) +#define OS_CONSOLE_MASK (0xF000 << 16) +#define OS_CONSOLE_MASK_RVL (0x0000 << 16) +#define OS_CONSOLE_MASK_DEV (0x1000 << 16) +#define OS_CONSOLE_MASK_TDEV (0x2000 << 16) -#define OS_CONSOLE_RVL_PP_0 (OS_CONSOLE_MASK_RVL + 0x0010) -#define OS_CONSOLE_RVL_PP_1 (OS_CONSOLE_MASK_RVL + 0x0011) -#define OS_CONSOLE_RVL_PP_2_1 (OS_CONSOLE_MASK_RVL + 0x0012) -#define OS_CONSOLE_RVL_PP_2_2 (OS_CONSOLE_MASK_RVL + 0x0020) -#define OS_CONSOLE_RETAIL (OS_CONSOLE_MASK_RVL + 0x0021) -#define OS_CONSOLE_RETAIL_RVA (OS_CONSOLE_MASK_RVL + 0x0100) +#define OS_CONSOLE_RVL_PP_0 (OS_CONSOLE_MASK_RVL + 0x0010) +#define OS_CONSOLE_RVL_PP_1 (OS_CONSOLE_MASK_RVL + 0x0011) +#define OS_CONSOLE_RVL_PP_2_1 (OS_CONSOLE_MASK_RVL + 0x0012) +#define OS_CONSOLE_RVL_PP_2_2 (OS_CONSOLE_MASK_RVL + 0x0020) +#define OS_CONSOLE_RETAIL (OS_CONSOLE_MASK_RVL + 0x0021) +#define OS_CONSOLE_RETAIL_RVA (OS_CONSOLE_MASK_RVL + 0x0100) -#define OS_CONSOLE_UNK (OS_CONSOLE_MASK_DEV + 0x0002) -#define OS_CONSOLE_RVL_EMU (OS_CONSOLE_MASK_DEV + 0x0008) -#define OS_CONSOLE_NDEV_1_0 (OS_CONSOLE_MASK_DEV + 0x0010) -#define OS_CONSOLE_NDEV_1_1 (OS_CONSOLE_MASK_DEV + 0x0011) -#define OS_CONSOLE_NDEV_1_2 (OS_CONSOLE_MASK_DEV + 0x0012) -#define OS_CONSOLE_NDEV_2_0 (OS_CONSOLE_MASK_DEV + 0x0020) -#define OS_CONSOLE_NDEV_2_1 (OS_CONSOLE_MASK_DEV + 0x0021) +#define OS_CONSOLE_UNK (OS_CONSOLE_MASK_DEV + 0x0002) +#define OS_CONSOLE_RVL_EMU (OS_CONSOLE_MASK_DEV + 0x0008) +#define OS_CONSOLE_NDEV_1_0 (OS_CONSOLE_MASK_DEV + 0x0010) +#define OS_CONSOLE_NDEV_1_1 (OS_CONSOLE_MASK_DEV + 0x0011) +#define OS_CONSOLE_NDEV_1_2 (OS_CONSOLE_MASK_DEV + 0x0012) +#define OS_CONSOLE_NDEV_2_0 (OS_CONSOLE_MASK_DEV + 0x0020) +#define OS_CONSOLE_NDEV_2_1 (OS_CONSOLE_MASK_DEV + 0x0021) -#define OS_CONSOLE_TDEV_EMU (OS_CONSOLE_MASK_TDEV + 0x0000) +#define OS_CONSOLE_TDEV_EMU (OS_CONSOLE_MASK_TDEV + 0x0000) -#define OS_CACHED_REGION_PREFIX 0x8000 -#define OS_UNCACHED_REGION_PREFIX 0xC000 -#define OS_PHYSICAL_MASK 0x3FFF +#define OS_CACHED_REGION_PREFIX 0x8000 +#define OS_UNCACHED_REGION_PREFIX 0xC000 +#define OS_PHYSICAL_MASK 0x3FFF -#define OS_BASE_CACHED (OS_CACHED_REGION_PREFIX << 16) -#define OS_BASE_UNCACHED (OS_UNCACHED_REGION_PREFIX << 16) +#define OS_BASE_CACHED (OS_CACHED_REGION_PREFIX << 16) +#define OS_BASE_UNCACHED (OS_UNCACHED_REGION_PREFIX << 16) -#define OSPhysicalToCached(paddr) ((void*)((u32)(paddr) + OS_BASE_CACHED)) -#define OSPhysicalToUncached(paddr) ((void*)((u32)(paddr) + OS_BASE_UNCACHED)) -#define OSCachedToPhysical(caddr) ((u32) ((u8*)(caddr) - OS_BASE_CACHED)) -#define OSUncachedToPhysical(ucaddr) ((u32) ((u8*)(ucaddr) - OS_BASE_UNCACHED)) -#define OSCachedToUncached(caddr) ((void*)((u8*)(caddr) + (OS_BASE_UNCACHED - OS_BASE_CACHED))) -#define OSUncachedToCached(ucaddr) ((void*)((u8*)(ucaddr) - (OS_BASE_UNCACHED - OS_BASE_CACHED))) +#define OSPhysicalToCached(paddr) ((void*)((u32)(paddr) + OS_BASE_CACHED)) +#define OSPhysicalToUncached(paddr) ((void*)((u32)(paddr) + OS_BASE_UNCACHED)) +#define OSCachedToPhysical(caddr) ((u32)((u8*)(caddr) - OS_BASE_CACHED)) +#define OSUncachedToPhysical(ucaddr) ((u32)((u8*)(ucaddr) - OS_BASE_UNCACHED)) +#define OSCachedToUncached(caddr) ((void*)((u8*)(caddr) + (OS_BASE_UNCACHED - OS_BASE_CACHED))) +#define OSUncachedToCached(ucaddr) ((void*)((u8*)(ucaddr) - (OS_BASE_UNCACHED - OS_BASE_CACHED))) -#define OSRoundUp32B(x) ROUNDUP((unsigned long)(x), 32) -#define OSRoundDown32B(x) ROUNDDOWN((unsigned long)(x), 32) +#define OSRoundUp32B(x) ROUNDUP((unsigned long)(x), 32) +#define OSRoundDown32B(x) ROUNDDOWN((unsigned long)(x), 32) -u32 __OSBusClock ADDRESS(OS_BASE_CACHED + OS_ADDR_BUS_CLOCK_SPEED); -u32 __OSCoreClock ADDRESS(OS_BASE_CACHED + OS_ADDR_CPU_CLOCK_SPEED); -extern s64 __OSStartTime; +u32 __OSBusClock ADDRESS(OS_BASE_CACHED + OS_ADDR_BUS_CLOCK_SPEED); +u32 __OSCoreClock ADDRESS(OS_BASE_CACHED + OS_ADDR_CPU_CLOCK_SPEED); +extern s64 __OSStartTime; -#define OS_BUS_CLOCK __OSBusClock -#define OS_CORE_CLOCK __OSCoreClock -#define OS_TIMER_CLOCK (OS_BUS_CLOCK / 4) +#define OS_BUS_CLOCK __OSBusClock +#define OS_CORE_CLOCK __OSCoreClock +#define OS_TIMER_CLOCK (OS_BUS_CLOCK / 4) -#define OSTicksToCycles(ticks) (((ticks) * ((OS_CORE_CLOCK * 2) / OS_TIMER_CLOCK)) / 2) -#define OSTicksToSeconds(ticks) ((ticks) / OS_TIMER_CLOCK) -#define OSTicksToMilliseconds(ticks) ((ticks) / (OS_TIMER_CLOCK / 1000)) -#define OSTicksToMicroseconds(ticks) (((ticks) * 8) / (OS_TIMER_CLOCK / 125000)) -#define OSTicksToNanoseconds(ticks) (((ticks) * 8000) / (OS_TIMER_CLOCK / 125000)) +#define OSTicksToCycles(ticks) (((ticks) * ((OS_CORE_CLOCK * 2) / OS_TIMER_CLOCK)) / 2) +#define OSTicksToSeconds(ticks) ((ticks) / OS_TIMER_CLOCK) +#define OSTicksToMilliseconds(ticks) ((ticks) / (OS_TIMER_CLOCK / 1000)) +#define OSTicksToMicroseconds(ticks) (((ticks) * 8) / (OS_TIMER_CLOCK / 125000)) +#define OSTicksToNanoseconds(ticks) (((ticks) * 8000) / (OS_TIMER_CLOCK / 125000)) -#define OSSecondsToTicks(s) ((s) * OS_TIMER_CLOCK) -#define OSMillisecondsToTicks(ms) ((ms) * (OS_TIMER_CLOCK / 1000)) -#define OSMicrosecondsToTicks(us) (((us) * (OS_TIMER_CLOCK / 125000)) / 8) -#define OSNanosecondsToTicks(ns) (((ns) * (OS_TIMER_CLOCK / 125000)) / 8000) +#define OSSecondsToTicks(s) ((s) * OS_TIMER_CLOCK) +#define OSMillisecondsToTicks(ms) ((ms) * (OS_TIMER_CLOCK / 1000)) +#define OSMicrosecondsToTicks(us) (((us) * (OS_TIMER_CLOCK / 125000)) / 8) +#define OSNanosecondsToTicks(ns) (((ns) * (OS_TIMER_CLOCK / 125000)) / 8000) -#define OSDiffTick(tick1, tick0) ((s32)(tick1) - (s32)(tick0)) +#define OSDiffTick(tick1, tick0) ((s32)(tick1) - (s32)(tick0)) -#define OSSleepSeconds(s) OSSleepTicks(OSSecondsToTicks((OSTime)s)) -#define OSSleepMilliseconds(ms) OSSleepTicks(OSMillisecondsToTicks((OSTime)ms)) -#define OSSleepMicroseconds(us) OSSleepTicks(OSMicrosecondsToTicks((OSTime)us)) -#define OSSleepNanoseconds(ns) OSSleepTicks(OSNanosecondsToTicks((OSTime)ns)) +#define OSSleepSeconds(s) OSSleepTicks(OSSecondsToTicks((OSTime)s)) +#define OSSleepMilliseconds(ms) OSSleepTicks(OSMillisecondsToTicks((OSTime)ms)) +#define OSSleepMicroseconds(us) OSSleepTicks(OSMicrosecondsToTicks((OSTime)us)) +#define OSSleepNanoseconds(ns) OSSleepTicks(OSNanosecondsToTicks((OSTime)ns)) -void OSInit(); +void OSInit(); enum { OS_APP_TYPE_IPL = 0x40, @@ -85,18 +85,18 @@ enum { OS_APP_TYPE_84 = 0x84, }; -u8 OSGetAppType(); -u32 OSGetConsoleType(); +u8 OSGetAppType(); +u32 OSGetConsoleType(); const char* OSGetAppGamename(); #ifdef DEBUG -#define ASSERTLINE(x, line) (void)((x) || (OSPanic(__FILE__, line, "Failed assertion "#x), 0)) +#define ASSERTLINE(x, line) (void)((x) || (OSPanic(__FILE__, line, "Failed assertion " #x), 0)) #define ASSERTMSGLINE(x, line, ...) (void)((x) || (OSPanic(__FILE__, line, __VA_ARGS__), 0)) #else -#define ASSERTLINE(x, line) ((void)0) +#define ASSERTLINE(x, line) ((void)0) #define ASSERTMSGLINE(x, line, ...) ((void)0) #endif @@ -104,27 +104,27 @@ const char* OSGetAppGamename(); #include #include #include -#include #include #include #include #include #include -#include #include +#include +#include +#include #include -#include #include #include -#include +#include #include +#include #include #include -#include #ifdef __cplusplus } #endif -#endif // REVOLUTION_OS_H +#endif // REVOLUTION_OS_H diff --git a/libs/RVL_SDK/include/revolution/os/OSAlarm.h b/libs/RVL_SDK/include/revolution/os/OSAlarm.h index 3c0f1bb2..596e2e44 100644 --- a/libs/RVL_SDK/include/revolution/os/OSAlarm.h +++ b/libs/RVL_SDK/include/revolution/os/OSAlarm.h @@ -3,8 +3,8 @@ #include -#include #include +#include #ifdef __cplusplus extern "C" { @@ -15,36 +15,36 @@ typedef struct OSAlarm OSAlarm; typedef void (*OSAlarmHandler)(OSAlarm* alarm, OSContext* context); struct OSAlarm { - OSAlarmHandler handler; // 0x00 - u32 tag; // 0x04 - OSTime fire; // 0x08 - OSAlarm* prev; // 0x10 - OSAlarm* next; // 0x14 + OSAlarmHandler handler; // 0x00 + u32 tag; // 0x04 + OSTime fire; // 0x08 + OSAlarm* prev; // 0x10 + OSAlarm* next; // 0x14 - OSTime period; // 0x18 - OSTime start; // 0x20 + OSTime period; // 0x18 + OSTime start; // 0x20 - void* userData; // 0x28 + void* userData; // 0x28 }; typedef struct OSAlarmQueue { - OSAlarm* head; // 0x00 - OSAlarm* tail; // 0x04 + OSAlarm* head; // 0x00 + OSAlarm* tail; // 0x04 } OSAlarmQueue; -void OSCreateAlarm(OSAlarm* alarm); -void OSSetAlarm(OSAlarm* alarm, OSTime start, OSAlarmHandler handler); -void OSCancelAlarm(OSAlarm* alarm); +void OSCreateAlarm(OSAlarm* alarm); +void OSSetAlarm(OSAlarm* alarm, OSTime start, OSAlarmHandler handler); +void OSCancelAlarm(OSAlarm* alarm); -void OSSetPeriodicAlarm(OSAlarm* alarm, OSTime start, OSTime period, OSAlarmHandler handler); +void OSSetPeriodicAlarm(OSAlarm* alarm, OSTime start, OSTime period, OSAlarmHandler handler); -void OSSetAlarmTag(OSAlarm* alarm, u32 tag); +void OSSetAlarmTag(OSAlarm* alarm, u32 tag); -void OSSetAlarmUserData(OSAlarm* alarm, void* userData); -void* OSGetAlarmUserData(OSAlarm* alarm); +void OSSetAlarmUserData(OSAlarm* alarm, void* userData); +void* OSGetAlarmUserData(OSAlarm* alarm); #ifdef __cplusplus } #endif -#endif // REVOLUTION_OS_ALARM_H +#endif // REVOLUTION_OS_ALARM_H diff --git a/libs/RVL_SDK/include/revolution/os/OSAlloc.h b/libs/RVL_SDK/include/revolution/os/OSAlloc.h index 125fcd0f..f68bfbba 100644 --- a/libs/RVL_SDK/include/revolution/os/OSAlloc.h +++ b/libs/RVL_SDK/include/revolution/os/OSAlloc.h @@ -11,13 +11,13 @@ typedef int OSHeapHandle; extern volatile OSHeapHandle __OSCurrHeap; -void* OSInitAlloc(void* arenaStart, void* arenaEnd, int maxHeaps); +void* OSInitAlloc(void* arenaStart, void* arenaEnd, int maxHeaps); -OSHeapHandle OSCreateHeap(void* start, void* end); -OSHeapHandle OSSetCurrentHeap(OSHeapHandle heap); +OSHeapHandle OSCreateHeap(void* start, void* end); +OSHeapHandle OSSetCurrentHeap(OSHeapHandle heap); -void* OSAllocFromHeap(OSHeapHandle heap, u32 size); -void OSFreeToHeap(OSHeapHandle heap, void* ptr); +void* OSAllocFromHeap(OSHeapHandle heap, u32 size); +void OSFreeToHeap(OSHeapHandle heap, void* ptr); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/revolution/os/OSArena.h b/libs/RVL_SDK/include/revolution/os/OSArena.h index a6b692af..c8790be5 100644 --- a/libs/RVL_SDK/include/revolution/os/OSArena.h +++ b/libs/RVL_SDK/include/revolution/os/OSArena.h @@ -9,27 +9,27 @@ extern "C" { #endif -void* OSGetMEM1ArenaHi(); -void* OSGetMEM2ArenaHi(); -void* OSGetArenaHi(); +void* OSGetMEM1ArenaHi(); +void* OSGetMEM2ArenaHi(); +void* OSGetArenaHi(); -void* OSGetMEM1ArenaLo(); -void* OSGetMEM2ArenaLo(); -void* OSGetArenaLo(); +void* OSGetMEM1ArenaLo(); +void* OSGetMEM2ArenaLo(); +void* OSGetArenaLo(); -void OSSetMEM1ArenaHi(void* hi); -void OSSetMEM2ArenaHi(void* hi); -void OSSetArenaHi(void* hi); +void OSSetMEM1ArenaHi(void* hi); +void OSSetMEM2ArenaHi(void* hi); +void OSSetArenaHi(void* hi); -void OSSetMEM1ArenaLo(void* lo); -void OSSetMEM2ArenaLo(void* lo); -void OSSetArenaLo(void* lo); +void OSSetMEM1ArenaLo(void* lo); +void OSSetMEM2ArenaLo(void* lo); +void OSSetArenaLo(void* lo); -void* OSAllocFromMEM1ArenaLo(u32 size, u32 align); -void* OSAllocFromMEM2ArenaLo(u32 size, u32 align); +void* OSAllocFromMEM1ArenaLo(u32 size, u32 align); +void* OSAllocFromMEM2ArenaLo(u32 size, u32 align); #ifdef __cplusplus } #endif -#endif // REVOLUTION_OS_ARENA_H +#endif // REVOLUTION_OS_ARENA_H diff --git a/libs/RVL_SDK/include/revolution/os/OSBootInfo.h b/libs/RVL_SDK/include/revolution/os/OSBootInfo.h index 6195915a..3d664023 100644 --- a/libs/RVL_SDK/include/revolution/os/OSBootInfo.h +++ b/libs/RVL_SDK/include/revolution/os/OSBootInfo.h @@ -3,32 +3,32 @@ #include -#include #include +#include #ifdef __cplusplus extern "C" { #endif typedef struct OSBootInfo { - DVDDiskID DVDDiskID; // 0x00 - - u32 magic; // 0x20 - u32 version; // 0x24 - - u32 memorySize; // 0x28 - - u32 consoleType; // 0x2C - - void* arenaLo; // 0x30 - void* arenaHi; // 0x34 + DVDDiskID DVDDiskID; // 0x00 - void* FSTLocation; // 0x38 - u32 FSTMaxLength; // 0x3C + u32 magic; // 0x20 + u32 version; // 0x24 + + u32 memorySize; // 0x28 + + u32 consoleType; // 0x2C + + void* arenaLo; // 0x30 + void* arenaHi; // 0x34 + + void* FSTLocation; // 0x38 + u32 FSTMaxLength; // 0x3C } OSBootInfo; #ifdef __cplusplus } #endif -#endif // REVOLUTION_OS_BOOT_INFO_H +#endif // REVOLUTION_OS_BOOT_INFO_H diff --git a/libs/RVL_SDK/include/revolution/os/OSCache.h b/libs/RVL_SDK/include/revolution/os/OSCache.h index bfaba5b6..8d8dea0b 100644 --- a/libs/RVL_SDK/include/revolution/os/OSCache.h +++ b/libs/RVL_SDK/include/revolution/os/OSCache.h @@ -1,35 +1,36 @@ #ifndef REVOLUTION_OS_CACHE_H #define REVOLUTION_OS_CACHE_H -#include #include +#include + #ifdef __cplusplus extern "C" { #endif -#define LC_MAX_DMA_BLOCKS (128) -#define LC_MAX_DMA_BYTES (LC_MAX_DMA_BLOCKS * 32) +#define LC_MAX_DMA_BLOCKS (128) +#define LC_MAX_DMA_BYTES (LC_MAX_DMA_BLOCKS * 32) -void DCEnable(); +void DCEnable(); -void DCInvalidateRange(void* addr, u32 len); +void DCInvalidateRange(void* addr, u32 len); -void DCFlushRange(void* addr, u32 len); -void DCFlushRangeNoSync(void* addr, u32 len); +void DCFlushRange(void* addr, u32 len); +void DCFlushRangeNoSync(void* addr, u32 len); -void DCStoreRange(void* addr, u32 len); +void DCStoreRange(void* addr, u32 len); -void DCZeroRange(void* addr, u32 len); +void DCZeroRange(void* addr, u32 len); -void ICEnable(); -void ICFlashInvalidate(); -void ICInvalidateRange(void* addr, u32 len); +void ICEnable(); +void ICFlashInvalidate(); +void ICInvalidateRange(void* addr, u32 len); -void LCDisable(); +void LCDisable(); #ifdef __cplusplus } #endif -#endif // REVOLUTION_OS_CACHE_H +#endif // REVOLUTION_OS_CACHE_H diff --git a/libs/RVL_SDK/include/revolution/os/OSCond.h b/libs/RVL_SDK/include/revolution/os/OSCond.h index c41ccea2..303ce3c9 100644 --- a/libs/RVL_SDK/include/revolution/os/OSCond.h +++ b/libs/RVL_SDK/include/revolution/os/OSCond.h @@ -7,10 +7,10 @@ extern "C" { #include -void OSInitCond(OSCond* cond); -void OSWaitCond(OSCond* cond, OSMutex* mutex); +void OSInitCond(OSCond* cond); +void OSWaitCond(OSCond* cond, OSMutex* mutex); -void OSSignalCond(OSCond* cond); +void OSSignalCond(OSCond* cond); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/revolution/os/OSContext.h b/libs/RVL_SDK/include/revolution/os/OSContext.h index de30f688..9295bc0d 100644 --- a/libs/RVL_SDK/include/revolution/os/OSContext.h +++ b/libs/RVL_SDK/include/revolution/os/OSContext.h @@ -7,55 +7,55 @@ extern "C" { #endif -#define OS_CONTEXT_STATE_FPSAVED (1<<0) +#define OS_CONTEXT_STATE_FPSAVED (1 << 0) typedef struct OSContext { - u32 gpr[32]; // 0x00 - u32 cr; // 0x80 - u32 lr; // 0x84 - u32 ctr; // 0x88 - u32 xer; // 0x8C + u32 gpr[32]; // 0x00 + u32 cr; // 0x80 + u32 lr; // 0x84 + u32 ctr; // 0x88 + u32 xer; // 0x8C f64 fpr[32]; // 0x90 u32 fpscr_pad; // 0x190 u32 fpscr; // 0x194 - u32 srr0; // 0x198 - u32 srr1; // 0x19C + u32 srr0; // 0x198 + u32 srr1; // 0x19C - u16 mode; // 0x1A0 - u16 state; // 0x1A2 + u16 mode; // 0x1A0 + u16 state; // 0x1A2 - u32 gqr[8]; // 0x1A4 - u32 psf_pad; // 0x1C4 - f64 psf[32]; // 0x1C8 + u32 gqr[8]; // 0x1A4 + u32 psf_pad; // 0x1C4 + f64 psf[32]; // 0x1C8 } OSContext; -void OSLoadFPUContext(OSContext* fpucontext); -void OSSaveFPUContext(OSContext* fpucontext); +void OSLoadFPUContext(OSContext* fpucontext); +void OSSaveFPUContext(OSContext* fpucontext); -void OSFillFPUContext(OSContext* context); +void OSFillFPUContext(OSContext* context); -void OSInitContext(OSContext* context, u32 pc, u32 newsp); +void OSInitContext(OSContext* context, u32 pc, u32 newsp); -void OSSetCurrentContext(OSContext* context); -OSContext* OSGetCurrentContext(); +void OSSetCurrentContext(OSContext* context); +OSContext* OSGetCurrentContext(); -u32 OSSaveContext(OSContext* context); -void OSLoadContext(OSContext* context); +u32 OSSaveContext(OSContext* context); +void OSLoadContext(OSContext* context); -void OSClearContext(OSContext* context); +void OSClearContext(OSContext* context); -void OSDumpContext(OSContext* context); +void OSDumpContext(OSContext* context); -u32 OSGetStackPointer(); -u32 OSSwitchStack(u32 newsp); +u32 OSGetStackPointer(); +u32 OSSwitchStack(u32 newsp); -int OSSwitchFiber(u32 pc, u32 newsp); -void OSSwitchFiberEx(u32 r3, u32 r4, u32 r5, u32 r6, void* pc, void* newsp); +int OSSwitchFiber(u32 pc, u32 newsp); +void OSSwitchFiberEx(u32 r3, u32 r4, u32 r5, u32 r6, void* pc, void* newsp); #ifdef __cplusplus } #endif -#endif // REVOLUTION_OS_CONTEXT_H +#endif // REVOLUTION_OS_CONTEXT_H diff --git a/libs/RVL_SDK/include/revolution/os/OSError.h b/libs/RVL_SDK/include/revolution/os/OSError.h index d2a31a04..5447fbbd 100644 --- a/libs/RVL_SDK/include/revolution/os/OSError.h +++ b/libs/RVL_SDK/include/revolution/os/OSError.h @@ -14,28 +14,32 @@ extern "C" { #endif -#define OS_ERROR_MAX 15 +#define OS_ERROR_MAX 15 typedef u16 OSError; typedef void (*OSErrorHandler)(OSError, OSContext*, ...); -OSErrorHandler OSSetErrorHandler(OSError error, OSErrorHandler handler); +OSErrorHandler OSSetErrorHandler(OSError error, OSErrorHandler handler); -void OSReport(const char* msg, ...); -void OSVReport(const char* msg, va_list list); +void OSReport(const char* msg, ...); +void OSVReport(const char* msg, va_list list); -void OSPanic(const char* file, int line, const char* msg, ...); +void OSPanic(const char* file, int line, const char* msg, ...); -#define OSHalt(msg, line) OSPanic(__FILE__, line, msg) -#define OSAssertMsg(exp, msg, line) if (!(exp)) OSHalt(msg, line) -#define OSAssertVMsg(exp, line, ...) if (!(exp)) OSPanic(__FILE__, line, __VA_ARGS__) +#define OSHalt(msg, line) OSPanic(__FILE__, line, msg) +#define OSAssertMsg(exp, msg, line) \ + if (!(exp)) \ + OSHalt(msg, line) +#define OSAssertVMsg(exp, line, ...) \ + if (!(exp)) \ + OSPanic(__FILE__, line, __VA_ARGS__) -void OSRegisterVersion(const char* version); +void OSRegisterVersion(const char* version); -void OSFatal(GXColor front, GXColor back, const char* msg); +void OSFatal(GXColor front, GXColor back, const char* msg); #ifdef __cplusplus } #endif -#endif // REVOLUTION_OS_ERROR_H +#endif // REVOLUTION_OS_ERROR_H diff --git a/libs/RVL_SDK/include/revolution/os/OSException.h b/libs/RVL_SDK/include/revolution/os/OSException.h index 042142b9..a3f10c90 100644 --- a/libs/RVL_SDK/include/revolution/os/OSException.h +++ b/libs/RVL_SDK/include/revolution/os/OSException.h @@ -1,37 +1,37 @@ #ifndef REVOLUTION_OS_EXCEPTION_H #define REVOLUTION_OS_EXCEPTION_H -#include #include +#include #ifdef __cplusplus extern "C" { #endif -#define OS_EXCEPTION_SYSTEM_RESET 0 -#define OS_EXCEPTION_MACHINE_CHECK 1 -#define OS_EXCEPTION_DSI 2 -#define OS_EXCEPTION_ISI 3 -#define OS_EXCEPTION_EXTERNAL_INTERRUPT 4 -#define OS_EXCEPTION_ALIGNMENT 5 -#define OS_EXCEPTION_PROGRAM 6 -#define OS_EXCEPTION_FLOATING_POINT 7 -#define OS_EXCEPTION_DECREMENTER 8 -#define OS_EXCEPTION_SYSTEM_CALL 9 -#define OS_EXCEPTION_TRACE 10 -#define OS_EXCEPTION_PERFORMACE_MONITOR 11 -#define OS_EXCEPTION_BREAKPOINT 12 -#define OS_EXCEPTION_SYSTEM_INTERRUPT 13 -#define OS_EXCEPTION_THERMAL_INTERRUPT 14 -#define OS_EXCEPTION_MEMORY_PROTECTION 15 -#define OS_EXCEPTION_FLOATING_POINT_EXCEPTION 16 -#define OS_EXCEPTION_MAX 17 +#define OS_EXCEPTION_SYSTEM_RESET 0 +#define OS_EXCEPTION_MACHINE_CHECK 1 +#define OS_EXCEPTION_DSI 2 +#define OS_EXCEPTION_ISI 3 +#define OS_EXCEPTION_EXTERNAL_INTERRUPT 4 +#define OS_EXCEPTION_ALIGNMENT 5 +#define OS_EXCEPTION_PROGRAM 6 +#define OS_EXCEPTION_FLOATING_POINT 7 +#define OS_EXCEPTION_DECREMENTER 8 +#define OS_EXCEPTION_SYSTEM_CALL 9 +#define OS_EXCEPTION_TRACE 10 +#define OS_EXCEPTION_PERFORMACE_MONITOR 11 +#define OS_EXCEPTION_BREAKPOINT 12 +#define OS_EXCEPTION_SYSTEM_INTERRUPT 13 +#define OS_EXCEPTION_THERMAL_INTERRUPT 14 +#define OS_EXCEPTION_MEMORY_PROTECTION 15 +#define OS_EXCEPTION_FLOATING_POINT_EXCEPTION 16 +#define OS_EXCEPTION_MAX 17 -typedef u8 __OSException; -typedef void (*__OSExceptionHandler)(__OSException exception, OSContext* context); +typedef u8 __OSException; +typedef void (*__OSExceptionHandler)(__OSException exception, OSContext* context); -__OSExceptionHandler __OSGetExceptionHandler(__OSException type); -__OSExceptionHandler __OSSetExceptionHandler(__OSException type, __OSExceptionHandler handler); +__OSExceptionHandler __OSGetExceptionHandler(__OSException type); +__OSExceptionHandler __OSSetExceptionHandler(__OSException type, __OSExceptionHandler handler); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/revolution/os/OSFastCast.h b/libs/RVL_SDK/include/revolution/os/OSFastCast.h index e4602c81..c7fd6475 100644 --- a/libs/RVL_SDK/include/revolution/os/OSFastCast.h +++ b/libs/RVL_SDK/include/revolution/os/OSFastCast.h @@ -8,6 +8,7 @@ extern "C" { #endif static void OSInitFastCast() { + // clang-format off #ifdef __MWERKS__ asm { li r3, 4 @@ -27,15 +28,18 @@ static void OSInitFastCast() { mtspr 0x395, r3 } #endif + // clang-format on } /*** TO F32 ***/ static f32 __OSu16tof32(register const u16* arg) { register f32 ret; + // clang-format off #ifdef __MWERKS__ asm { psq_l ret, 0(arg), 1, 3 } #endif + // clang-format on return ret; } @@ -49,11 +53,13 @@ static u8 __OSf32tou8(register f32 arg) { f32 a; register f32* ptr = &a; u8 r; - #ifdef __MWERKS__ + // clang-format off +#ifdef __MWERKS__ asm { psq_st arg, 0(ptr), 1, 2 } - #endif +#endif + // clang-format on r = *(u8*)ptr; return r; } @@ -66,9 +72,11 @@ static u16 __OSf32tou16(register f32 arg) { f32 a; register f32* ptr = &a; u16 r; + // clang-format off #ifdef __MWERKS__ asm { psq_st arg, 0(ptr), 1, 3 } #endif + // clang-format on r = *(u16*)ptr; return r; } @@ -79,9 +87,11 @@ static void OSf32tou16(const f32* in, u16* out) { static f32 __OSs16tof32(register const s16* arg) { register f32 ret; + // clang-format off #ifdef __MWERKS__ asm { psq_l ret, 0(arg), 1, 5 } #endif + // clang-format on return ret; } @@ -93,9 +103,11 @@ static s16 __OSf32tos16(register f32 arg) { f32 a; register f32* ptr = &a; s16 r; + // clang-format off #ifdef __MWERKS__ asm { psq_st arg, 0(ptr), 1, 5 } #endif + // clang-format on r = *(s16*)ptr; return r; } diff --git a/libs/RVL_SDK/include/revolution/os/OSFont.h b/libs/RVL_SDK/include/revolution/os/OSFont.h index 74ad6e1d..bbc98d5a 100644 --- a/libs/RVL_SDK/include/revolution/os/OSFont.h +++ b/libs/RVL_SDK/include/revolution/os/OSFont.h @@ -1,8 +1,8 @@ #ifndef REVOLUTION_OS_FONT_H #define REVOLUTION_OS_FONT_H -#include #include +#include #ifdef __cplusplus extern "C" { @@ -18,50 +18,50 @@ enum { OS_FONT_ENCODE_MAX = OS_FONT_ENCODE_UTF32, }; -#define OS_FONT_SIZE_ANSI (288 + 131072) // 9 sheets -#define OS_FONT_SIZE_SJIS (3840 + 1179648) // 1 sheet +#define OS_FONT_SIZE_ANSI (288 + 131072) // 9 sheets +#define OS_FONT_SIZE_SJIS (3840 + 1179648) // 1 sheet #define OS_FONT_ROM_OFFSET_SJIS 0x1AFF00 #define OS_FONT_ROM_OFFSET_ANSI 0x1FCF00 -#define OS_FONT_ROM_SIZE_ANSI 0x003000 -#define OS_FONT_ROM_SIZE_ANSI 0x003000 -#define OS_FONT_ROM_SIZE_SJIS 0x04D000 +#define OS_FONT_ROM_SIZE_ANSI 0x003000 +#define OS_FONT_ROM_SIZE_ANSI 0x003000 +#define OS_FONT_ROM_SIZE_SJIS 0x04D000 typedef struct OSFontHeader { - u16 fontType; + u16 fontType; - u16 firstChar; - u16 lastChar; - u16 invalChar; + u16 firstChar; + u16 lastChar; + u16 invalChar; - u16 ascent; - u16 descent; + u16 ascent; + u16 descent; - u16 width; - u16 leading; - u16 cellWidth; - u16 cellHeight; + u16 width; + u16 leading; + u16 cellWidth; + u16 cellHeight; - u32 sheetSize; - u16 sheetFormat; - u16 sheetColumn; - u16 sheetRow; - u16 sheetWidth; - u16 sheetHeight; + u32 sheetSize; + u16 sheetFormat; + u16 sheetColumn; + u16 sheetRow; + u16 sheetWidth; + u16 sheetHeight; - u16 widthTable; + u16 widthTable; - u32 sheetImage; - u32 sheetFullSize; + u32 sheetImage; + u32 sheetFullSize; GXColor col; } OSFontHeader; -u16 OSGetFontEncode(); -u16 OSSetFontEncode(u16 encode); +u16 OSGetFontEncode(); +u16 OSSetFontEncode(u16 encode); -u32 OSLoadFont(OSFontHeader* fontData, void* tmp); +u32 OSLoadFont(OSFontHeader* fontData, void* tmp); -char* OSGetFontTexel(const char* string, void* image, s32 pos, s32 stride, s32* width); +char* OSGetFontTexel(const char* string, void* image, s32 pos, s32 stride, s32* width); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/revolution/os/OSInterrupt.h b/libs/RVL_SDK/include/revolution/os/OSInterrupt.h index c2a8df62..f95fc523 100644 --- a/libs/RVL_SDK/include/revolution/os/OSInterrupt.h +++ b/libs/RVL_SDK/include/revolution/os/OSInterrupt.h @@ -9,12 +9,12 @@ extern "C" { #endif -int OSDisableInterrupts(); -int OSEnableInterrupts(); -int OSRestoreInterrupts(int level); +int OSDisableInterrupts(); +int OSEnableInterrupts(); +int OSRestoreInterrupts(int level); #ifdef __cplusplus } #endif -#endif // REVOLUTION_OS_INTERRUPT_H +#endif // REVOLUTION_OS_INTERRUPT_H diff --git a/libs/RVL_SDK/include/revolution/os/OSL2.h b/libs/RVL_SDK/include/revolution/os/OSL2.h index 16668b9f..edabc924 100644 --- a/libs/RVL_SDK/include/revolution/os/OSL2.h +++ b/libs/RVL_SDK/include/revolution/os/OSL2.h @@ -7,9 +7,9 @@ extern "C" { #endif -void L2Enable(); -void L2Disable(); -void L2GlobalInvalidate(); +void L2Enable(); +void L2Disable(); +void L2GlobalInvalidate(); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/revolution/os/OSLink.h b/libs/RVL_SDK/include/revolution/os/OSLink.h index f18fe6ec..029611d3 100644 --- a/libs/RVL_SDK/include/revolution/os/OSLink.h +++ b/libs/RVL_SDK/include/revolution/os/OSLink.h @@ -23,16 +23,16 @@ typedef struct OSModuleLink { } OSModuleLink; struct OSModuleInfo { - OSModuleID id; // 0x00 - OSModuleLink link; // 0x04 + OSModuleID id; // 0x00 + OSModuleLink link; // 0x04 - u32 numSections; // 0x0C - u32 sectionInfoOffset; // 0x10 + u32 numSections; // 0x0C + u32 sectionInfoOffset; // 0x10 - u32 nameOffset; // 0x14 - u32 nameSize; // 0x18 + u32 nameOffset; // 0x14 + u32 nameSize; // 0x18 - u32 version; // 0x1C + u32 version; // 0x1C }; #ifdef __cplusplus diff --git a/libs/RVL_SDK/include/revolution/os/OSMemMap.h b/libs/RVL_SDK/include/revolution/os/OSMemMap.h index 0773fc2b..50424d43 100644 --- a/libs/RVL_SDK/include/revolution/os/OSMemMap.h +++ b/libs/RVL_SDK/include/revolution/os/OSMemMap.h @@ -1,105 +1,105 @@ #ifndef REVOLUTION_OS_MEMORY_MAP_H #define REVOLUTION_OS_MEMORY_MAP_H -#define OS_ADDR_MEMORY_MAP_PART_1 0x0000 -#define OS_ADDR_MEMORY_MAP_SIZE 0x0100 +#define OS_ADDR_MEMORY_MAP_PART_1 0x0000 +#define OS_ADDR_MEMORY_MAP_SIZE 0x0100 -#define OS_ADDR_BOOT_INFO 0x0000 +#define OS_ADDR_BOOT_INFO 0x0000 -#define OS_ADDR_DB_INTERFACE 0x0040 -#define OS_ADDR_DB_INTEGRATOR_HOOK 0x0060 +#define OS_ADDR_DB_INTERFACE 0x0040 +#define OS_ADDR_DB_INTEGRATOR_HOOK 0x0060 -#define OS_ADDR_CURRENT_CONTEXT_REAL 0x00C0 +#define OS_ADDR_CURRENT_CONTEXT_REAL 0x00C0 -#define OS_ADDR_PREVIOUS_INTERRUPT 0x00C4 -#define OS_ADDR_CURRENT_INTERRUPT 0x00C8 +#define OS_ADDR_PREVIOUS_INTERRUPT 0x00C4 +#define OS_ADDR_CURRENT_INTERRUPT 0x00C8 -#define OS_ADDR_TV_VIDEO_FORMAT 0x00CC +#define OS_ADDR_TV_VIDEO_FORMAT 0x00CC -#define OS_ADDR_AUDIO_RAM_LENGTH 0x00D0 +#define OS_ADDR_AUDIO_RAM_LENGTH 0x00D0 -#define OS_ADDR_CURRENT_CONTEXT 0x00D4 -#define OS_ADDR_CURRENT_FPU_CONTEXT 0x00D8 +#define OS_ADDR_CURRENT_CONTEXT 0x00D4 +#define OS_ADDR_CURRENT_FPU_CONTEXT 0x00D8 -#define OS_ADDR_ACTIVE_THREAD_QUEUE 0x00DC +#define OS_ADDR_ACTIVE_THREAD_QUEUE 0x00DC -#define OS_ADDR_CURRENT_THREAD 0x00E4 +#define OS_ADDR_CURRENT_THREAD 0x00E4 -#define OS_ADDR_DEBUG_MONITOR_SIZE 0x00E8 -#define OS_ADDR_DEBUG_MONITOR 0x00EC +#define OS_ADDR_DEBUG_MONITOR_SIZE 0x00E8 +#define OS_ADDR_DEBUG_MONITOR 0x00EC -#define OS_ADDR_SIMULATED_MEMORY_SIZE 0x00F0 +#define OS_ADDR_SIMULATED_MEMORY_SIZE 0x00F0 -#define OS_ADDR_BOOT_INFO_2 0x00F4 +#define OS_ADDR_BOOT_INFO_2 0x00F4 -#define OS_ADDR_BUS_CLOCK_SPEED 0x00F8 -#define OS_ADDR_CPU_CLOCK_SPEED 0x00FC +#define OS_ADDR_BUS_CLOCK_SPEED 0x00F8 +#define OS_ADDR_CPU_CLOCK_SPEED 0x00FC -#define OS_ADDR_MEMORY_MAP_PART_2 0x3000 +#define OS_ADDR_MEMORY_MAP_PART_2 0x3000 -#define OS_ADDR_EXCEPTION_TABLE 0x3000 +#define OS_ADDR_EXCEPTION_TABLE 0x3000 -#define OS_ADDR_INTERRUPT_TABLE 0x3040 +#define OS_ADDR_INTERRUPT_TABLE 0x3040 -#define OS_ADDR_EXI_LAST_PROBES 0x30C0 +#define OS_ADDR_EXI_LAST_PROBES 0x30C0 -#define OS_ADDR_LINK_MODULE_LIST 0x30C8 -#define OS_ADDR_LINK_LAST_MODULE_LIST 0x30CC -#define OS_ADDR_LINK_STRING_TABLE 0x30D0 +#define OS_ADDR_LINK_MODULE_LIST 0x30C8 +#define OS_ADDR_LINK_LAST_MODULE_LIST 0x30CC +#define OS_ADDR_LINK_STRING_TABLE 0x30D0 -#define OS_ADDR_SYSTEM_TIME 0x30D8 +#define OS_ADDR_SYSTEM_TIME 0x30D8 -#define OS_ADDR_PAD_WIRELESS_FIX_MODE 0x30E0 -#define OS_ADDR_PAD_BUTTON 0x30E3 -#define OS_ADDR_DEVICE_CODE 0x30E6 -#define OS_ADDR_BI2_DEBUG_FLAG 0x30E8 -#define OS_ADDR_BI2_PAD_SPEC 0x30E9 +#define OS_ADDR_PAD_WIRELESS_FIX_MODE 0x30E0 +#define OS_ADDR_PAD_BUTTON 0x30E3 +#define OS_ADDR_DEVICE_CODE 0x30E6 +#define OS_ADDR_BI2_DEBUG_FLAG 0x30E8 +#define OS_ADDR_BI2_PAD_SPEC 0x30E9 -#define OS_ADDR_LAUNCH_EXEC_PARAMS 0x30F0 +#define OS_ADDR_LAUNCH_EXEC_PARAMS 0x30F0 -#define OS_ADDR_PHYSICAL_MEM1_SIZE 0x3100 -#define OS_ADDR_SIMULATED_MEM1_SIZE 0x3104 -#define OS_ADDR_AVAILABLE_MEM1_START 0x310C -#define OS_ADDR_AVAILABLE_MEM1_END 0x3110 +#define OS_ADDR_PHYSICAL_MEM1_SIZE 0x3100 +#define OS_ADDR_SIMULATED_MEM1_SIZE 0x3104 +#define OS_ADDR_AVAILABLE_MEM1_START 0x310C +#define OS_ADDR_AVAILABLE_MEM1_END 0x3110 -#define OS_ADDR_PHYSICAL_MEM2_SIZE 0x3118 -#define OS_ADDR_SIMULATED_MEM2_SIZE 0x311C -#define OS_ADDR_ACCESSIBLE_MEM2 0x3120 -#define OS_ADDR_AVAILABLE_MEM2_START 0x3124 -#define OS_ADDR_AVAILABLE_MEM2_END 0x3128 +#define OS_ADDR_PHYSICAL_MEM2_SIZE 0x3118 +#define OS_ADDR_SIMULATED_MEM2_SIZE 0x311C +#define OS_ADDR_ACCESSIBLE_MEM2 0x3120 +#define OS_ADDR_AVAILABLE_MEM2_START 0x3124 +#define OS_ADDR_AVAILABLE_MEM2_END 0x3128 -#define OS_ADDR_IPC_BUFFER_START 0x3130 -#define OS_ADDR_IPC_BUFFER_END 0x3134 +#define OS_ADDR_IPC_BUFFER_START 0x3130 +#define OS_ADDR_IPC_BUFFER_END 0x3134 -#define OS_ADDR_HOLLYWOOD_REVISION 0x3138 +#define OS_ADDR_HOLLYWOOD_REVISION 0x3138 -#define OS_ADDR_IOS_REVISION 0x3140 -#define OS_ADDR_IOS_BUILD_DATE 0x3144 -#define OS_ADDR_IOS_HEAP_START 0x3148 -#define OS_ADDR_IOS_HEAP_END 0x314C +#define OS_ADDR_IOS_REVISION 0x3140 +#define OS_ADDR_IOS_BUILD_DATE 0x3144 +#define OS_ADDR_IOS_HEAP_START 0x3148 +#define OS_ADDR_IOS_HEAP_END 0x314C -#define OS_ADDR_GDDR_VENDOR_CODE 0x3158 +#define OS_ADDR_GDDR_VENDOR_CODE 0x3158 -#define OS_ADDR_BOOT_PROGRAM_TARGET 0x315C -#define OS_ADDR_APP_LOADER_TARGET 0x315D -#define OS_ADDR_DEV_KIT_VERSION 0x315E +#define OS_ADDR_BOOT_PROGRAM_TARGET 0x315C +#define OS_ADDR_APP_LOADER_TARGET 0x315D +#define OS_ADDR_DEV_KIT_VERSION 0x315E -#define OS_ADDR_SEMAPHORE_BUSY 0x3160 +#define OS_ADDR_SEMAPHORE_BUSY 0x3160 -#define OS_ADDR_MIOS_SHUTDOWN_FLAG 0x3164 +#define OS_ADDR_MIOS_SHUTDOWN_FLAG 0x3164 -#define OS_ADDR_CURRENT_APP_NAME 0x3180 -#define OS_ADDR_CURRENT_APP_TYPE 0x3184 +#define OS_ADDR_CURRENT_APP_NAME 0x3180 +#define OS_ADDR_CURRENT_APP_TYPE 0x3184 -#define OS_ADDR_LOCKED_APP_TYPE 0x3187 -#define OS_ADDR_MINIMUM_IOS_VERSION 0x3188 +#define OS_ADDR_LOCKED_APP_TYPE 0x3187 +#define OS_ADDR_MINIMUM_IOS_VERSION 0x3188 -#define OS_ADDR_NAND_TITLE_LAUNCH_CODE 0x318C -#define OS_ADDR_NAND_TITLE_RETURN_CODE 0x3190 +#define OS_ADDR_NAND_TITLE_LAUNCH_CODE 0x318C +#define OS_ADDR_NAND_TITLE_RETURN_CODE 0x3190 -#define OS_ADDR_BOOT_PART_TYPE 0x3194 -#define OS_ADDR_BOOT_PART_OFFSET 0x3198 +#define OS_ADDR_BOOT_PART_TYPE 0x3194 +#define OS_ADDR_BOOT_PART_OFFSET 0x3198 -#define OS_ADDR_WIFI_AFH_CHANNEL 0x31A2 +#define OS_ADDR_WIFI_AFH_CHANNEL 0x31A2 -#endif // REVOLUTION_OS_MEMORY_MAP_H +#endif // REVOLUTION_OS_MEMORY_MAP_H diff --git a/libs/RVL_SDK/include/revolution/os/OSMemory.h b/libs/RVL_SDK/include/revolution/os/OSMemory.h index ab70208a..3b05f316 100644 --- a/libs/RVL_SDK/include/revolution/os/OSMemory.h +++ b/libs/RVL_SDK/include/revolution/os/OSMemory.h @@ -9,13 +9,13 @@ extern "C" { #endif -u32 OSGetPhysicalMem1Size(); -u32 OSGetPhysicalMem2Size(); +u32 OSGetPhysicalMem1Size(); +u32 OSGetPhysicalMem2Size(); -u32 OSGetConsoleSimulatedMem1Size(); -u32 OSGetConsoleSimulatedMem2Size(); +u32 OSGetConsoleSimulatedMem1Size(); +u32 OSGetConsoleSimulatedMem2Size(); -void OSProtectRange(u32 chan, void *addr, u32 nBytes, u32 control); +void OSProtectRange(u32 chan, void* addr, u32 nBytes, u32 control); #define OSIsMEM1Region(addr) (((u32)(addr) & 0x30000000) == 0) #define OSIsMEM2Region(addr) (((u32)(addr) & 0x30000000) == 0x10000000) @@ -24,4 +24,4 @@ void OSProtectRange(u32 chan, void *addr, u32 nBytes, u32 control); } #endif -#endif // REVOLUTION_OS_MEMORY_H +#endif // REVOLUTION_OS_MEMORY_H diff --git a/libs/RVL_SDK/include/revolution/os/OSMessage.h b/libs/RVL_SDK/include/revolution/os/OSMessage.h index 28937855..c7a92d66 100644 --- a/libs/RVL_SDK/include/revolution/os/OSMessage.h +++ b/libs/RVL_SDK/include/revolution/os/OSMessage.h @@ -1,33 +1,33 @@ #ifndef REVOLUTION_OS_MESSAGE_H #define REVOLUTION_OS_MESSAGE_H -#include #include +#include #ifdef __cplusplus extern "C" { #endif -typedef void* OSMessage; +typedef void* OSMessage; typedef struct { - OSThreadQueue queueSend; // 0x00 - OSThreadQueue queueReceive; // 0x08 - OSMessage* msgArray; // 0x10 - s32 msgCount; // 0x14 - s32 firstIndex; // 0x18 - s32 usedCount; // 0x1C + OSThreadQueue queueSend; // 0x00 + OSThreadQueue queueReceive; // 0x08 + OSMessage* msgArray; // 0x10 + s32 msgCount; // 0x14 + s32 firstIndex; // 0x18 + s32 usedCount; // 0x1C } OSMessageQueue; -#define OS_MESSAGE_BLOCK (1 << 0) +#define OS_MESSAGE_BLOCK (1 << 0) -void OSInitMessageQueue(OSMessageQueue* queue, OSMessage* msgArray, s32 msgCount); -BOOL OSSendMessage(OSMessageQueue* queue, OSMessage msg, s32 flags); -BOOL OSJamMessage(OSMessageQueue* queue, OSMessage msg, s32 flags); -BOOL OSReceiveMessage(OSMessageQueue* queue, OSMessage* msgArray, s32 flags); +void OSInitMessageQueue(OSMessageQueue* queue, OSMessage* msgArray, s32 msgCount); +BOOL OSSendMessage(OSMessageQueue* queue, OSMessage msg, s32 flags); +BOOL OSJamMessage(OSMessageQueue* queue, OSMessage msg, s32 flags); +BOOL OSReceiveMessage(OSMessageQueue* queue, OSMessage* msgArray, s32 flags); #ifdef __cplusplus } #endif -#endif // REVOLUTION_OS_MESSAGE_H +#endif // REVOLUTION_OS_MESSAGE_H diff --git a/libs/RVL_SDK/include/revolution/os/OSMutex.h b/libs/RVL_SDK/include/revolution/os/OSMutex.h index 057be040..0475d964 100644 --- a/libs/RVL_SDK/include/revolution/os/OSMutex.h +++ b/libs/RVL_SDK/include/revolution/os/OSMutex.h @@ -8,20 +8,20 @@ extern "C" { #include struct OSMutex { - OSThreadQueue queue; // 0x00 - OSThread* thread; // 0x08 - s32 count; // 0x0C - OSMutexLink link; // 0x10 + OSThreadQueue queue; // 0x00 + OSThread* thread; // 0x08 + s32 count; // 0x0C + OSMutexLink link; // 0x10 }; struct OSCond { - OSThreadQueue queue; // 0x00 + OSThreadQueue queue; // 0x00 }; -void OSInitMutex(OSMutex* mutex); -void OSLockMutex(OSMutex* mutex); -void OSUnlockMutex(OSMutex* mutex); -BOOL OSTryLockMutex(OSMutex* mutex); +void OSInitMutex(OSMutex* mutex); +void OSLockMutex(OSMutex* mutex); +void OSUnlockMutex(OSMutex* mutex); +BOOL OSTryLockMutex(OSMutex* mutex); #include diff --git a/libs/RVL_SDK/include/revolution/os/OSReset.h b/libs/RVL_SDK/include/revolution/os/OSReset.h index 8c99f7a7..103cd69c 100644 --- a/libs/RVL_SDK/include/revolution/os/OSReset.h +++ b/libs/RVL_SDK/include/revolution/os/OSReset.h @@ -11,27 +11,27 @@ typedef BOOL (*OSShutdownFunction)(BOOL, u32); typedef struct OSShutdownFunctionInfo OSShutdownFunctionInfo; struct OSShutdownFunctionInfo { - OSShutdownFunction func; // 0x00 + OSShutdownFunction func; // 0x00 - u32 priority; // 0x04 + u32 priority; // 0x04 - OSShutdownFunctionInfo* next; // 0x08 - OSShutdownFunctionInfo* prev; // 0x0C + OSShutdownFunctionInfo* next; // 0x08 + OSShutdownFunctionInfo* prev; // 0x0C }; typedef struct OSShutdownFunctionQueue { - OSShutdownFunctionInfo* head; // 0x00 - OSShutdownFunctionInfo* tail; // 0x04 + OSShutdownFunctionInfo* head; // 0x00 + OSShutdownFunctionInfo* tail; // 0x04 } OSShutdownFunctionQueue; -void OSRegisterShutdownFunction(OSShutdownFunctionInfo* info); -void OSUnregisterShutdownFunction(OSShutdownFunctionInfo* info); +void OSRegisterShutdownFunction(OSShutdownFunctionInfo* info); +void OSUnregisterShutdownFunction(OSShutdownFunctionInfo* info); -u32 OSGetResetCode(); +u32 OSGetResetCode(); -void OSRebootSystem(); -void OSReturnToMenu(); -void OSShutdownSystem(); +void OSRebootSystem(); +void OSReturnToMenu(); +void OSShutdownSystem(); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/revolution/os/OSRtc.h b/libs/RVL_SDK/include/revolution/os/OSRtc.h index b9bfeed7..bc5056b4 100644 --- a/libs/RVL_SDK/include/revolution/os/OSRtc.h +++ b/libs/RVL_SDK/include/revolution/os/OSRtc.h @@ -7,50 +7,50 @@ extern "C" { #endif -u16 OSGetGbsMode(); -void OSSetGbsMode(u16 mode); +u16 OSGetGbsMode(); +void OSSetGbsMode(u16 mode); -#define OS_SOUND_MODE_MONO 0 -#define OS_SOUND_MODE_STEREO 1 +#define OS_SOUND_MODE_MONO 0 +#define OS_SOUND_MODE_STEREO 1 -u32 OSGetSoundMode(); -void OSSetSoundMode(u32 mode); +u32 OSGetSoundMode(); +void OSSetSoundMode(u32 mode); -#define OS_PROGRESSIVE_MODE_OFF 0 -#define OS_PROGRESSIVE_MODE_ON 1 +#define OS_PROGRESSIVE_MODE_OFF 0 +#define OS_PROGRESSIVE_MODE_ON 1 -u32 OSGetProgressiveMode(); -void OSSetProgressiveMode(u32 mode); +u32 OSGetProgressiveMode(); +void OSSetProgressiveMode(u32 mode); -#define OS_VIDEO_MODE_NTSC 0 -#define OS_VIDEO_MODE_PAL 1 -#define OS_VIDEO_MODE_MPAL 2 +#define OS_VIDEO_MODE_NTSC 0 +#define OS_VIDEO_MODE_PAL 1 +#define OS_VIDEO_MODE_MPAL 2 -void OSSetVideoMode(u32 mode); +void OSSetVideoMode(u32 mode); -#define OS_LANG_ENGLISH 0 -#define OS_LANG_ENGLISH 0 -#define OS_LANG_GERMAN 1 -#define OS_LANG_FRENCH 2 -#define OS_LANG_SPANISH 3 -#define OS_LANG_ITALIAN 4 -#define OS_LANG_DUTCH 5 -#define OS_LANG_SIMP_CHINESE 6 -#define OS_LANG_TRAD_CHINESE 7 -#define OS_LANG_KOREAN 8 -#define OS_LANG_MAX 9 +#define OS_LANG_ENGLISH 0 +#define OS_LANG_ENGLISH 0 +#define OS_LANG_GERMAN 1 +#define OS_LANG_FRENCH 2 +#define OS_LANG_SPANISH 3 +#define OS_LANG_ITALIAN 4 +#define OS_LANG_DUTCH 5 +#define OS_LANG_SIMP_CHINESE 6 +#define OS_LANG_TRAD_CHINESE 7 +#define OS_LANG_KOREAN 8 +#define OS_LANG_MAX 9 -u8 OSGetLanguage(); -void OSSetLanguage(u8 language); +u8 OSGetLanguage(); +void OSSetLanguage(u8 language); -#define OS_EURGB60_OFF 0 -#define OS_EURGB60_ON 1 +#define OS_EURGB60_OFF 0 +#define OS_EURGB60_ON 1 -u32 OSGetEuRgb60Mode(); -void OSSetEuRgb60Mode(u32 on); +u32 OSGetEuRgb60Mode(); +void OSSetEuRgb60Mode(u32 on); -u16 OSGetWirelessID(s32 chan); -void OSSetWirelessID(s32 chan, u16 id); +u16 OSGetWirelessID(s32 chan); +void OSSetWirelessID(s32 chan, u16 id); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/revolution/os/OSSemaphore.h b/libs/RVL_SDK/include/revolution/os/OSSemaphore.h index b66a4b07..a138e00f 100644 --- a/libs/RVL_SDK/include/revolution/os/OSSemaphore.h +++ b/libs/RVL_SDK/include/revolution/os/OSSemaphore.h @@ -12,12 +12,12 @@ typedef struct OSSemaphore { OSThreadQueue queue; } OSSemaphore; -void OSInitSemaphore(OSSemaphore* sem, s32 count); -s32 OSWaitSemaphore(OSSemaphore* sem); -s32 OSSignalSemaphore(OSSemaphore* sem); +void OSInitSemaphore(OSSemaphore* sem, s32 count); +s32 OSWaitSemaphore(OSSemaphore* sem); +s32 OSSignalSemaphore(OSSemaphore* sem); #ifdef __cplusplus } #endif -#endif // REVOLUTION_OS_SEMAPHORE_H +#endif // REVOLUTION_OS_SEMAPHORE_H diff --git a/libs/RVL_SDK/include/revolution/os/OSThread.h b/libs/RVL_SDK/include/revolution/os/OSThread.h index 67a80641..ad633aeb 100644 --- a/libs/RVL_SDK/include/revolution/os/OSThread.h +++ b/libs/RVL_SDK/include/revolution/os/OSThread.h @@ -1,8 +1,8 @@ #ifndef REVOLUTION_OS_THREAD_H #define REVOLUTION_OS_THREAD_H -#include #include +#include #ifdef __cplusplus extern "C" { @@ -10,109 +10,109 @@ extern "C" { typedef s32 OSPriority; -#define OS_PRIORITY_MIN 0 -#define OS_PRIORITY_MAX 31 +#define OS_PRIORITY_MIN 0 +#define OS_PRIORITY_MAX 31 -#define OS_THREAD_SPECIFIC_MAX 2 +#define OS_THREAD_SPECIFIC_MAX 2 typedef struct OSThread OSThread; -typedef struct OSMutex OSMutex; -typedef struct OSCond OSCond; +typedef struct OSMutex OSMutex; +typedef struct OSCond OSCond; typedef struct { - OSThread* head; // 0x00 - OSThread* tail; // 0x04 + OSThread* head; // 0x00 + OSThread* tail; // 0x04 } OSThreadQueue; typedef struct { - OSThread* next; // 0x00 - OSThread* prev; // 0x04 + OSThread* next; // 0x00 + OSThread* prev; // 0x04 } OSThreadLink; typedef struct { - OSMutex* head; // 0x00 - OSMutex* tail; // 0x04 + OSMutex* head; // 0x00 + OSMutex* tail; // 0x04 } OSMutexQueue; typedef struct { - OSMutex* next; // 0x00 - OSMutex* prev; // 0x04 + OSMutex* next; // 0x00 + OSMutex* prev; // 0x04 } OSMutexLink; -void OSInitMutexQueue(OSMutexQueue* queue); +void OSInitMutexQueue(OSMutexQueue* queue); struct OSThread { - OSContext context; // 0x00 - u16 state; // 0x2C8 - u16 attr; // 0x2CA - s32 suspend; // 0x2CC - OSPriority priority; // 0x2D0 - OSPriority base; // 0x2D4 + OSContext context; // 0x00 + u16 state; // 0x2C8 + u16 attr; // 0x2CA + s32 suspend; // 0x2CC + OSPriority priority; // 0x2D0 + OSPriority base; // 0x2D4 - void* value; // 0x2D8 + void* value; // 0x2D8 - OSThreadQueue* queue; // 0x2DC - OSThreadLink link; // 0x2E0 + OSThreadQueue* queue; // 0x2DC + OSThreadLink link; // 0x2E0 - OSThreadQueue queueJoin; // 0x2E8 - OSMutex* mutex; // 0x2F0 - OSMutexQueue queueMutex; // 0x2F4 + OSThreadQueue queueJoin; // 0x2E8 + OSMutex* mutex; // 0x2F0 + OSMutexQueue queueMutex; // 0x2F4 - OSThreadLink linkActive; // 0x2FC + OSThreadLink linkActive; // 0x2FC - u8* stackBase; // 0x304 - u32* stackEnd; // 0x308 + u8* stackBase; // 0x304 + u32* stackEnd; // 0x308 - s32 error; // 0x30C + s32 error; // 0x30C - void* specific[OS_THREAD_SPECIFIC_MAX]; // 0x310 + void* specific[OS_THREAD_SPECIFIC_MAX]; // 0x310 }; -#define OS_THREAD_STATE_UNINITIALIZED 0 -#define OS_THREAD_STATE_READY 1 -#define OS_THREAD_STATE_RUNNING 2 -#define OS_THREAD_STATE_WAITING 4 -#define OS_THREAD_STATE_DEAD 8 +#define OS_THREAD_STATE_UNINITIALIZED 0 +#define OS_THREAD_STATE_READY 1 +#define OS_THREAD_STATE_RUNNING 2 +#define OS_THREAD_STATE_WAITING 4 +#define OS_THREAD_STATE_DEAD 8 -#define OS_THREAD_ATTR_DETACH 1 +#define OS_THREAD_ATTR_DETACH 1 typedef void (*OSIdleFunction)(void* param); typedef void (*OSSwitchThreadCallback)(OSThread* from, OSThread* to); -void OSInitThreadQueue(OSThreadQueue* queue); +void OSInitThreadQueue(OSThreadQueue* queue); -void OSSleepThread(OSThreadQueue* queue); -void OSWakeupThread(OSThreadQueue* queue); +void OSSleepThread(OSThreadQueue* queue); +void OSWakeupThread(OSThreadQueue* queue); -void OSSetCurrentThread(OSThread* thread); -OSThread* OSGetCurrentThread(); +void OSSetCurrentThread(OSThread* thread); +OSThread* OSGetCurrentThread(); -s32 OSEnableScheduler(); -s32 OSDisableScheduler(); +s32 OSEnableScheduler(); +s32 OSDisableScheduler(); -BOOL OSIsThreadSuspended(OSThread* thread); -BOOL OSIsThreadTerminated(OSThread* thread); +BOOL OSIsThreadSuspended(OSThread* thread); +BOOL OSIsThreadTerminated(OSThread* thread); -BOOL OSCreateThread(OSThread* thread, void* (*ThreadFunc)(void*), void* param, void* stack, u32 stackSize, OSPriority priority, u16 attr); -void OSExitThread(void* val); -void OSCancelThread(OSThread* thread); -BOOL OSJoinThread(OSThread* thread, void* val); -void OSDetachThread(OSThread* thread); +BOOL OSCreateThread(OSThread* thread, void* (*ThreadFunc)(void*), void* param, void* stack, u32 stackSize, OSPriority priority, u16 attr); +void OSExitThread(void* val); +void OSCancelThread(OSThread* thread); +BOOL OSJoinThread(OSThread* thread, void* val); +void OSDetachThread(OSThread* thread); -void OSYieldThread(); +void OSYieldThread(); -s32 OSSuspendThread(OSThread* thread); -s32 OSResumeThread(OSThread* thread); +s32 OSSuspendThread(OSThread* thread); +s32 OSResumeThread(OSThread* thread); -BOOL OSSetThreadPriority(OSThread* thread, OSPriority priority); -s32 OSGetThreadPriority(OSThread* thread); +BOOL OSSetThreadPriority(OSThread* thread, OSPriority priority); +s32 OSGetThreadPriority(OSThread* thread); -s32 OSCheckActiveThreads(); +s32 OSCheckActiveThreads(); -void OSSetThreadSpecific(s32 index, void* ptr); -void* OSGetThreadSpecific(s32 index); +void OSSetThreadSpecific(s32 index, void* ptr); +void* OSGetThreadSpecific(s32 index); -OSSwitchThreadCallback OSSetSwitchThreadCallback(OSSwitchThreadCallback callback); +OSSwitchThreadCallback OSSetSwitchThreadCallback(OSSwitchThreadCallback callback); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/revolution/os/OSTime.h b/libs/RVL_SDK/include/revolution/os/OSTime.h index e42c7e61..0b61b691 100644 --- a/libs/RVL_SDK/include/revolution/os/OSTime.h +++ b/libs/RVL_SDK/include/revolution/os/OSTime.h @@ -10,45 +10,45 @@ extern "C" { typedef s64 OSTime; typedef u32 OSTick; -#define MAX_YEAR 2035 -#define MAX_MONTH 12 -#define MAX_DAY 31 -#define MAX_HOUR 23 -#define MAX_MINUTE 59 -#define MAX_SECOND 59 +#define MAX_YEAR 2035 +#define MAX_MONTH 12 +#define MAX_DAY 31 +#define MAX_HOUR 23 +#define MAX_MINUTE 59 +#define MAX_SECOND 59 -#define MIN_YEAR 2000 -#define MIN_MONTH 1 -#define MIN_DAY 1 -#define MIN_HOUR 0 -#define MIN_MINUTE 0 -#define MIN_SECOND 0 +#define MIN_YEAR 2000 +#define MIN_MONTH 1 +#define MIN_DAY 1 +#define MIN_HOUR 0 +#define MIN_MINUTE 0 +#define MIN_SECOND 0 typedef struct OSCalendarTime { - int sec; // 0x00 - int min; // 0x04 - int hour; // 0x08 + int sec; // 0x00 + int min; // 0x04 + int hour; // 0x08 - int mday; // 0x0C + int mday; // 0x0C - int mon; // 0x10 - int year; // 0x14 - int wday; // 0x18 - int yday; // 0x1C + int mon; // 0x10 + int year; // 0x14 + int wday; // 0x18 + int yday; // 0x1C - int msec; // 0x20 - int usec; // 0x24 + int msec; // 0x20 + int usec; // 0x24 } OSCalendarTime; -OSTime OSGetTime(); -OSTick OSGetTick(); -void OSSleepTicks(OSTime ticks); +OSTime OSGetTime(); +OSTick OSGetTick(); +void OSSleepTicks(OSTime ticks); -void OSTicksToCalendarTime(OSTime ticks, OSCalendarTime* pTime); -OSTime OSCalendarTimeToTicks(OSCalendarTime* pTime); +void OSTicksToCalendarTime(OSTime ticks, OSCalendarTime* pTime); +OSTime OSCalendarTimeToTicks(OSCalendarTime* pTime); #ifdef __cplusplus } #endif -#endif // REVOLUTION_OS_TIME_H +#endif // REVOLUTION_OS_TIME_H diff --git a/libs/RVL_SDK/include/revolution/os/OSUtf.h b/libs/RVL_SDK/include/revolution/os/OSUtf.h index 4d4e8f3d..e2d682e1 100644 --- a/libs/RVL_SDK/include/revolution/os/OSUtf.h +++ b/libs/RVL_SDK/include/revolution/os/OSUtf.h @@ -7,17 +7,17 @@ extern "C" { #endif -char* OSUTF8to32(const char* utf8, u32* utf32); -char* OSUTF32to8(u32 utf32, char* utf8); +char* OSUTF8to32(const char* utf8, u32* utf32); +char* OSUTF32to8(u32 utf32, char* utf8); -u16* OSUTF16to32(const u16* utf16, u32* utf32); -u16* OSUTF32to16(u32 utf32, u16* utf16); +u16* OSUTF16to32(const u16* utf16, u32* utf32); +u16* OSUTF32to16(u32 utf32, u16* utf16); -u8 OSUTF32toANSI(u32 utf32); -u32 OSANSItoUTF32(u8 ansi); +u8 OSUTF32toANSI(u32 utf32); +u32 OSANSItoUTF32(u8 ansi); -u16 OSUTF32toSJIS(u32 utf32); -u32 OSSJIStoUTF32(u16 sjis); +u16 OSUTF32toSJIS(u32 utf32); +u32 OSSJIStoUTF32(u16 sjis); #ifdef __cplusplus } diff --git a/libs/RVL_SDK/include/revolution/pad.h b/libs/RVL_SDK/include/revolution/pad.h index 3b251ed2..1811f95b 100644 --- a/libs/RVL_SDK/include/revolution/pad.h +++ b/libs/RVL_SDK/include/revolution/pad.h @@ -7,74 +7,74 @@ extern "C" { #endif -#define PAD_SPEC_0 0 -#define PAD_SPEC_1 1 -#define PAD_SPEC_2 2 -#define PAD_SPEC_3 3 -#define PAD_SPEC_4 4 -#define PAD_SPEC_5 5 +#define PAD_SPEC_0 0 +#define PAD_SPEC_1 1 +#define PAD_SPEC_2 2 +#define PAD_SPEC_3 3 +#define PAD_SPEC_4 4 +#define PAD_SPEC_5 5 -#define PAD_CHAN0_BIT 0x80000000 -#define PAD_CHAN1_BIT 0x40000000 -#define PAD_CHAN2_BIT 0x20000000 -#define PAD_CHAN3_BIT 0x10000000 +#define PAD_CHAN0_BIT 0x80000000 +#define PAD_CHAN1_BIT 0x40000000 +#define PAD_CHAN2_BIT 0x20000000 +#define PAD_CHAN3_BIT 0x10000000 -#define PAD_MAX_CONTROLLER 4 +#define PAD_MAX_CONTROLLER 4 -#define PAD_BUTTON_LEFT (1 << 0) -#define PAD_BUTTON_RIGHT (1 << 1) -#define PAD_BUTTON_DOWN (1 << 2) -#define PAD_BUTTON_UP (1 << 3) -#define PAD_TRIGGER_Z (1 << 4) -#define PAD_TRIGGER_R (1 << 5) -#define PAD_TRIGGER_L (1 << 6) -#define PAD_BUTTON_A (1 << 8) -#define PAD_BUTTON_B (1 << 9) -#define PAD_BUTTON_X (1 << 10) -#define PAD_BUTTON_Y (1 << 11) -#define PAD_BUTTON_MENU (1 << 12) -#define PAD_BUTTON_START (1 << 12) +#define PAD_BUTTON_LEFT (1 << 0) +#define PAD_BUTTON_RIGHT (1 << 1) +#define PAD_BUTTON_DOWN (1 << 2) +#define PAD_BUTTON_UP (1 << 3) +#define PAD_TRIGGER_Z (1 << 4) +#define PAD_TRIGGER_R (1 << 5) +#define PAD_TRIGGER_L (1 << 6) +#define PAD_BUTTON_A (1 << 8) +#define PAD_BUTTON_B (1 << 9) +#define PAD_BUTTON_X (1 << 10) +#define PAD_BUTTON_Y (1 << 11) +#define PAD_BUTTON_MENU (1 << 12) +#define PAD_BUTTON_START (1 << 12) -#define PAD_ERR_NONE 0 -#define PAD_ERR_NO_CONTROLLER -1 -#define PAD_ERR_NOT_READY -2 -#define PAD_ERR_TRANSFER -3 +#define PAD_ERR_NONE 0 +#define PAD_ERR_NO_CONTROLLER -1 +#define PAD_ERR_NOT_READY -2 +#define PAD_ERR_TRANSFER -3 typedef struct PADStatus { - u16 button; // 0x00 + u16 button; // 0x00 - s8 stickX; // 0x02 - s8 stickY; // 0x03 + s8 stickX; // 0x02 + s8 stickY; // 0x03 - s8 substickX; // 0x04 - s8 substickY; // 0x05 + s8 substickX; // 0x04 + s8 substickY; // 0x05 - u8 triggerLeft; // 0x06 - u8 triggerRight; // 0x07 + u8 triggerLeft; // 0x06 + u8 triggerRight; // 0x07 - u8 analogA; // 0x08 - u8 analogB; // 0x09 + u8 analogA; // 0x08 + u8 analogB; // 0x09 - s8 err; // 0x0A + s8 err; // 0x0A } PADStatus; typedef void (*PADSamplingCallback)(); -int PADReset(u32 mask) NO_INLINE; -BOOL PADRecalibrate(u32 mask) NO_INLINE; +int PADReset(u32 mask) NO_INLINE; +BOOL PADRecalibrate(u32 mask) NO_INLINE; -BOOL PADInit(); +BOOL PADInit(); -u32 PADRead(PADStatus* status); +u32 PADRead(PADStatus* status); -void PADSetSpec(u32 spec); +void PADSetSpec(u32 spec); -int PADGetType(s32 chan, u32* type); +int PADGetType(s32 chan, u32* type); -BOOL PADSync(); +BOOL PADSync(); #ifdef __cplusplus } #endif -#endif // REVOLUTION_PAD_H +#endif // REVOLUTION_PAD_H diff --git a/libs/RVL_SDK/include/revolution/rso.h b/libs/RVL_SDK/include/revolution/rso.h index 2c2a52c4..aebb7437 100644 --- a/libs/RVL_SDK/include/revolution/rso.h +++ b/libs/RVL_SDK/include/revolution/rso.h @@ -10,60 +10,60 @@ extern "C" { typedef struct RSOObjectInfo RSOObjectInfo; typedef struct RSOSymbolHeader { - u32 tableOffset; // 0x00 - u32 tableSize; // 0x04 - u32 stringOffset; // 0x08 + u32 tableOffset; // 0x00 + u32 tableSize; // 0x04 + u32 stringOffset; // 0x08 } RSOSymbolHeader; typedef struct RSOSectionInfo { - u32 offset; // 0x00 - u32 size; // 0x04 + u32 offset; // 0x00 + u32 size; // 0x04 } RSOSectionInfo; typedef struct RSOObjectLink { - RSOObjectInfo* next; // 0x00 - RSOObjectInfo* prev; // 0x04 + RSOObjectInfo* next; // 0x00 + RSOObjectInfo* prev; // 0x04 } RSOObjectLink; struct RSOObjectInfo { - RSOObjectLink link; // 0x00 + RSOObjectLink link; // 0x00 - u32 numSections; // 0x08 - u32 sectionInfoOffset; // 0x0C + u32 numSections; // 0x08 + u32 sectionInfoOffset; // 0x0C - u32 nameOffset; // 0x10 - u32 nameSize; // 0x14 + u32 nameOffset; // 0x10 + u32 nameSize; // 0x14 - u32 version; // 0x18 + u32 version; // 0x18 }; typedef struct RSOObjectList { - RSOObjectInfo* head; // 0x00 - RSOObjectInfo* tail; // 0x04 + RSOObjectInfo* head; // 0x00 + RSOObjectInfo* tail; // 0x04 } RSOObjectList; typedef struct RSOObjectHeader { - RSOObjectInfo info; // 0x00 + RSOObjectInfo info; // 0x00 - u32 bssSize; // 0x1C + u32 bssSize; // 0x1C - u8 prologSection; // 0x20 - u8 epilogSection; // 0x21 - u8 unresolvedSection; // 0x22 - u8 bssSection; // 0x23 + u8 prologSection; // 0x20 + u8 epilogSection; // 0x21 + u8 unresolvedSection; // 0x22 + u8 bssSection; // 0x23 - u32 prolog; // 0x24 - u32 epilog; // 0x28 - u32 unresolved; // 0x2C + u32 prolog; // 0x24 + u32 epilog; // 0x28 + u32 unresolved; // 0x2C - u32 internalRelOffset; // 0x30 - u32 internalRelSize; // 0x34 + u32 internalRelOffset; // 0x30 + u32 internalRelSize; // 0x34 - u32 externalRelOffset; // 0x38 - u32 externalRelSize; // 0x3C + u32 externalRelOffset; // 0x38 + u32 externalRelSize; // 0x3C - RSOSymbolHeader expHeader; // 0x40 - RSOSymbolHeader impHeader; // 0x4C + RSOSymbolHeader expHeader; // 0x40 + RSOSymbolHeader impHeader; // 0x4C } RSOObjectHeader; typedef struct RSOImportTable { @@ -79,7 +79,6 @@ typedef struct RSOExportTable { u32 hash; // 0x0C } RSOExportTable; - typedef enum { RSO_FL_NON, RSO_FL_INTERNAL, @@ -88,40 +87,40 @@ typedef enum { typedef u32 RSOHash; -BOOL RSOLocateObject(void* newModule, void* bss); -BOOL RSOLocateObjectFixed(void* newModule, void* bss); -BOOL RSOStaticLocateObject(void* newModule); -BOOL RSOUnLocateObject(void* oldModule); +BOOL RSOLocateObject(void* newModule, void* bss); +BOOL RSOLocateObjectFixed(void* newModule, void* bss); +BOOL RSOStaticLocateObject(void* newModule); +BOOL RSOUnLocateObject(void* oldModule); RSOImportTable* RSOGetImport(RSOSymbolHeader* imp); RSOExportTable* RSOGetExport(RSOSymbolHeader* exp); -int RSOLink(RSOObjectHeader* rsoImp, RSOObjectHeader* rsoExp); -void RSOUnLink(RSOObjectHeader* rsoImp, RSOObjectHeader* rsoExp); +int RSOLink(RSOObjectHeader* rsoImp, RSOObjectHeader* rsoExp); +void RSOUnLink(RSOObjectHeader* rsoImp, RSOObjectHeader* rsoExp); -RSOHash RSOGetHash(const char* symbolname); +RSOHash RSOGetHash(const char* symbolname); -int RSOGetNumImportSymbols(RSOSymbolHeader* imp); -int RSOGetNumImportSymbolsUnresolved(RSOObjectHeader* rso); +int RSOGetNumImportSymbols(RSOSymbolHeader* imp); +int RSOGetNumImportSymbolsUnresolved(RSOObjectHeader* rso); -char* RSOGetImportSymbolName(RSOSymbolHeader* imp, int index); -BOOL RSOIsImportSymbolResolved(RSOObjectHeader* rso, int index); -BOOL RSOIsImportSymbolResolvedAll(RSOObjectHeader* rso); +char* RSOGetImportSymbolName(RSOSymbolHeader* imp, int index); +BOOL RSOIsImportSymbolResolved(RSOObjectHeader* rso, int index); +BOOL RSOIsImportSymbolResolvedAll(RSOObjectHeader* rso); -int RSOGetNumExportSymbols(RSOSymbolHeader* exp); -char* RSOGetExportSymbolName(RSOSymbolHeader* exp, int index); -void* RSOGetExportSymbolAddr(RSOObjectHeader* rso, int index); +int RSOGetNumExportSymbols(RSOSymbolHeader* exp); +char* RSOGetExportSymbolName(RSOSymbolHeader* exp, int index); +void* RSOGetExportSymbolAddr(RSOObjectHeader* rso, int index); -void* RSOFindExportSymbolAddr(RSOObjectHeader* rso, const char* name); +void* RSOFindExportSymbolAddr(RSOObjectHeader* rso, const char* name); RSOExportTable* RSOFindExportSymbol(RSOObjectHeader* rso, const char* name); -BOOL RSOListInit(void* staticRso); +BOOL RSOListInit(void* staticRso); -BOOL RSOLinkList(void* newRso, void* bss); -BOOL RSOUnLinkList(void* oldRso); +BOOL RSOLinkList(void* newRso, void* bss); +BOOL RSOUnLinkList(void* oldRso); #ifdef __cplusplus } #endif -#endif // REVOLUTION_RSO_H +#endif // REVOLUTION_RSO_H diff --git a/libs/RVL_SDK/include/revolution/sc.h b/libs/RVL_SDK/include/revolution/sc.h index f9db9152..d5f885c3 100644 --- a/libs/RVL_SDK/include/revolution/sc.h +++ b/libs/RVL_SDK/include/revolution/sc.h @@ -11,193 +11,193 @@ extern "C" { typedef int SCStatus; -#define SC_STATUS_OK 0 -#define SC_STATUS_BUSY 1 +#define SC_STATUS_OK 0 +#define SC_STATUS_BUSY 1 #define SC_STATUS_FATAL 2 #define SC_STATUS_PARSE 3 typedef void (*SCFlushCallback)(int status); -void SCInit(); +void SCInit(); -u32 SCFlush(); -void SCFlushAsync(SCFlushCallback callback); +u32 SCFlush(); +void SCFlushAsync(SCFlushCallback callback); -u32 SCCheckStatus(); +u32 SCCheckStatus(); /* Product Configuration (setting.txt) */ #define SC_PRODUCT_AREA_UNKNOWN -1 -#define SC_PRODUCT_AREA_JPN 0 /* Japan */ -#define SC_PRODUCT_AREA_USA 1 /* United states of America */ -#define SC_PRODUCT_AREA_EUR 2 /* Europe */ -#define SC_PRODUCT_AREA_AUS 3 /* Austrailia */ -#define SC_PRODUCT_AREA_BRA 4 /* Brazil */ -#define SC_PRODUCT_AREA_TWN 5 /* Taiwan */ -#define SC_PRODUCT_AREA_KOR 6 /* Korea */ -#define SC_PRODUCT_AREA_HKG 7 /* Hong kong */ -#define SC_PRODUCT_AREA_ASI 8 /* Asia */ -#define SC_PRODUCT_AREA_LTN 9 /* Latin */ -#define SC_PRODUCT_AREA_SAF 10 /* South Africa */ -#define SC_PRODUCT_AREA_CHN 11 /* China */ -#define SC_PRODUCT_AREA_MAX 12 +#define SC_PRODUCT_AREA_JPN 0 /* Japan */ +#define SC_PRODUCT_AREA_USA 1 /* United states of America */ +#define SC_PRODUCT_AREA_EUR 2 /* Europe */ +#define SC_PRODUCT_AREA_AUS 3 /* Austrailia */ +#define SC_PRODUCT_AREA_BRA 4 /* Brazil */ +#define SC_PRODUCT_AREA_TWN 5 /* Taiwan */ +#define SC_PRODUCT_AREA_KOR 6 /* Korea */ +#define SC_PRODUCT_AREA_HKG 7 /* Hong kong */ +#define SC_PRODUCT_AREA_ASI 8 /* Asia */ +#define SC_PRODUCT_AREA_LTN 9 /* Latin */ +#define SC_PRODUCT_AREA_SAF 10 /* South Africa */ +#define SC_PRODUCT_AREA_CHN 11 /* China */ +#define SC_PRODUCT_AREA_MAX 12 -BOOL SCGetProductAreaString(char* buf, u32 sz); -s8 SCGetProductArea(); -char* SCGetProductCode(); +BOOL SCGetProductAreaString(char* buf, u32 sz); +s8 SCGetProductArea(); +char* SCGetProductCode(); -#define SC_PRODUCT_VIDEO_UNKNOWN -1 -#define SC_PRODUCT_VIDEO_NTSC 0 -#define SC_PRODUCT_VIDEO_PAL 1 -#define SC_PRODUCT_VIDEO_MPAL 2 +#define SC_PRODUCT_VIDEO_UNKNOWN -1 +#define SC_PRODUCT_VIDEO_NTSC 0 +#define SC_PRODUCT_VIDEO_PAL 1 +#define SC_PRODUCT_VIDEO_MPAL 2 -BOOL SCGetProductVideoModeString(char* buf, u32 sz); -s8 SCGetProductVideoMode(); +BOOL SCGetProductVideoModeString(char* buf, u32 sz); +s8 SCGetProductVideoMode(); -#define SC_PRODUCT_GAME_REGION_UNKNOWN -1 -#define SC_PRODUCT_GAME_REGION_JP 0 -#define SC_PRODUCT_GAME_REGION_US 1 -#define SC_PRODUCT_GAME_REGION_EU 2 +#define SC_PRODUCT_GAME_REGION_UNKNOWN -1 +#define SC_PRODUCT_GAME_REGION_JP 0 +#define SC_PRODUCT_GAME_REGION_US 1 +#define SC_PRODUCT_GAME_REGION_EU 2 // #define SC_PRODUCT_GAME_REGION_ALL 3 /* Not a thing */ -#define SC_PRODUCT_GAME_REGION_KR 4 -#define SC_PRODUCT_GAME_REGION_CN 5 +#define SC_PRODUCT_GAME_REGION_KR 4 +#define SC_PRODUCT_GAME_REGION_CN 5 -BOOL SCGetProductGameRegionString(char* buf, u32 sz); -s8 SCGetProductGameRegion(); +BOOL SCGetProductGameRegionString(char* buf, u32 sz); +s8 SCGetProductGameRegion(); -BOOL SCGetProductSNString(char* buf, u32 sz); +BOOL SCGetProductSNString(char* buf, u32 sz); /* System Configuration (SYSCONF) */ -#define SC_ASPECT_RATIO_4x3 0 -#define SC_ASPECT_RATIO_16x9 1 +#define SC_ASPECT_RATIO_4x3 0 +#define SC_ASPECT_RATIO_16x9 1 -u8 SCGetAspectRatio(); -BOOL SCSetAspectRatio(u8 aspectRatio); +u8 SCGetAspectRatio(); +BOOL SCSetAspectRatio(u8 aspectRatio); -s8 SCGetDisplayOffsetH(); -BOOL SCSetDisplayOffsetH(s8 displayOffsetH); +s8 SCGetDisplayOffsetH(); +BOOL SCSetDisplayOffsetH(s8 displayOffsetH); #define SC_EURGB60_MODE_OFF 0 -#define SC_EURGB60_MODE_ON 1 +#define SC_EURGB60_MODE_ON 1 -u8 SCGetEuRgb60Mode(); -BOOL SCSetEuRgb60Mode(u8 eurgb60Mode); +u8 SCGetEuRgb60Mode(); +BOOL SCSetEuRgb60Mode(u8 eurgb60Mode); -#define SC_IDLE_MODE_STANDBY_OFF 0 -#define SC_IDLE_MODE_STANDBY_ON 1 +#define SC_IDLE_MODE_STANDBY_OFF 0 +#define SC_IDLE_MODE_STANDBY_ON 1 -#define SC_IDLE_MODE_LED_OFF 0 -#define SC_IDLE_MODE_LED_DIM 1 +#define SC_IDLE_MODE_LED_OFF 0 +#define SC_IDLE_MODE_LED_DIM 1 #define SC_IDLE_MODE_LED_BRIGHT 2 typedef struct SCIdleModeInfo { - u8 standby; // 0x00 - u8 led; // 0x01 + u8 standby; // 0x00 + u8 led; // 0x01 } SCIdleModeInfo; -BOOL SCGetIdleMode(SCIdleModeInfo* info); -BOOL SCSetIdleMode(SCIdleModeInfo* info); +BOOL SCGetIdleMode(SCIdleModeInfo* info); +BOOL SCSetIdleMode(SCIdleModeInfo* info); -#define SC_LANG_JAPANESE 0 -#define SC_LANG_ENGLISH 1 -#define SC_LANG_GERMAN 2 -#define SC_LANG_FRENCH 3 -#define SC_LANG_SPANISH 4 -#define SC_LANG_ITALIAN 5 -#define SC_LANG_DUTCH 6 -#define SC_LANG_SIMP_CHINESE 7 -#define SC_LANG_TRAD_CHINESE 8 -#define SC_LANG_KOREAN 9 -#define SC_LANG_MAX 10 +#define SC_LANG_JAPANESE 0 +#define SC_LANG_ENGLISH 1 +#define SC_LANG_GERMAN 2 +#define SC_LANG_FRENCH 3 +#define SC_LANG_SPANISH 4 +#define SC_LANG_ITALIAN 5 +#define SC_LANG_DUTCH 6 +#define SC_LANG_SIMP_CHINESE 7 +#define SC_LANG_TRAD_CHINESE 8 +#define SC_LANG_KOREAN 9 +#define SC_LANG_MAX 10 -u8 SCGetLanguage(); -BOOL SCSetLanguage(u8 language); +u8 SCGetLanguage(); +BOOL SCSetLanguage(u8 language); -#define SC_PARENTAL_PASSWORD_LENGTH 4 -#define SC_PARENTAL_SECRET_ANSWER_LENGTH 32 +#define SC_PARENTAL_PASSWORD_LENGTH 4 +#define SC_PARENTAL_SECRET_ANSWER_LENGTH 32 typedef struct SCParentalControlsInfo { - u8 enable; // 0x00 - u8 org; // 0x01 + u8 enable; // 0x00 + u8 org; // 0x01 - u8 rating; // 0x02 + u8 rating; // 0x02 - char password[SC_PARENTAL_PASSWORD_LENGTH]; // 0x03 + char password[SC_PARENTAL_PASSWORD_LENGTH]; // 0x03 - u8 secretQuestion; // 0x07 - u16 secretAnswer[SC_PARENTAL_SECRET_ANSWER_LENGTH]; // 0x08 - u16 secretAnswerLength; // 0x48 + u8 secretQuestion; // 0x07 + u16 secretAnswer[SC_PARENTAL_SECRET_ANSWER_LENGTH]; // 0x08 + u16 secretAnswerLength; // 0x48 } SCParentalControlsInfo; -#define SC_PARENTAL_FLAG_ENABLED (1 << 7) -#define SC_PARENTAL_RATING_ENABLED 0x1F +#define SC_PARENTAL_FLAG_ENABLED (1 << 7) +#define SC_PARENTAL_RATING_ENABLED 0x1F -#define SC_PARENTAL_ORG_CERO 0 -#define SC_PARENTAL_ORG_ESRB 1 -#define SC_PARENTAL_ORG_USK 3 -#define SC_PARENTAL_ORG_PEGI 4 -#define SC_PARENTAL_ORG_PEGI_FINLAND 5 -#define SC_PARENTAL_ORG_PEGI_PORTUGAL 6 -#define SC_PARENTAL_ORG_BBFC 7 -#define SC_PARENTAL_ORG_OFLC 8 -#define SC_PARENTAL_ORG_GRB 9 -#define SC_PARENTAL_ORG_GRAC SC_PARENTAL_ORG_GRB /* GRB is now called GRAC */ +#define SC_PARENTAL_ORG_CERO 0 +#define SC_PARENTAL_ORG_ESRB 1 +#define SC_PARENTAL_ORG_USK 3 +#define SC_PARENTAL_ORG_PEGI 4 +#define SC_PARENTAL_ORG_PEGI_FINLAND 5 +#define SC_PARENTAL_ORG_PEGI_PORTUGAL 6 +#define SC_PARENTAL_ORG_BBFC 7 +#define SC_PARENTAL_ORG_OFLC 8 +#define SC_PARENTAL_ORG_GRB 9 +#define SC_PARENTAL_ORG_GRAC SC_PARENTAL_ORG_GRB /* GRB is now called GRAC */ -BOOL SCGetParentalControl(SCParentalControlsInfo* pcInfo); -BOOL SCSetParentalControl(SCParentalControlsInfo* pcInfo); +BOOL SCGetParentalControl(SCParentalControlsInfo* pcInfo); +BOOL SCSetParentalControl(SCParentalControlsInfo* pcInfo); #define SC_PROGRESSIVE_MODE_OFF 0 -#define SC_PROGRESSIVE_MODE_ON 1 +#define SC_PROGRESSIVE_MODE_ON 1 -u8 SCGetProgressiveMode(); -BOOL SCSetProgressiveMode(u8 progressiveMode); +u8 SCGetProgressiveMode(); +BOOL SCSetProgressiveMode(u8 progressiveMode); -#define SC_SCREEN_SAVER_MODE_OFF 0 -#define SC_SCREEN_SAVER_MODE_ON 1 +#define SC_SCREEN_SAVER_MODE_OFF 0 +#define SC_SCREEN_SAVER_MODE_ON 1 -u8 SCGetScreenSaverMode(); -BOOL SCSetScreenSaverMode(u8 screenSaverMode); +u8 SCGetScreenSaverMode(); +BOOL SCSetScreenSaverMode(u8 screenSaverMode); -#define SC_SOUND_MODE_MONO 0 -#define SC_SOUND_MODE_STEREO 1 -#define SC_SOUND_MODE_SURROUND 2 +#define SC_SOUND_MODE_MONO 0 +#define SC_SOUND_MODE_STEREO 1 +#define SC_SOUND_MODE_SURROUND 2 -u8 SCGetSoundMode(); -BOOL SCSetSoundMode(u8 soundMode); +u8 SCGetSoundMode(); +BOOL SCSetSoundMode(u8 soundMode); -u32 SCGetCounterBias(); -BOOL SCSetCounterBias(u32 counterBias); +u32 SCGetCounterBias(); +BOOL SCSetCounterBias(u32 counterBias); -BOOL SCGetWwwRestriction(); -BOOL SCSetWwwRestriction(BOOL wwwRestrictFlag); +BOOL SCGetWwwRestriction(); +BOOL SCSetWwwRestriction(BOOL wwwRestrictFlag); -#define SC_WPAD_MOTOR_MODE_OFF 0 -#define SC_WPAD_MOTOR_MODE_ON 1 +#define SC_WPAD_MOTOR_MODE_OFF 0 +#define SC_WPAD_MOTOR_MODE_ON 1 -u8 SCGetWpadMotorMode(); -BOOL SCSetWpadMotorMode(u8 motorMode); +u8 SCGetWpadMotorMode(); +BOOL SCSetWpadMotorMode(u8 motorMode); -#define SC_WPAD_SENSOR_BAR_POSITION_BOTTOM 0 -#define SC_WPAD_SENSOR_BAR_POSITION_TOP 1 +#define SC_WPAD_SENSOR_BAR_POSITION_BOTTOM 0 +#define SC_WPAD_SENSOR_BAR_POSITION_TOP 1 -u8 SCGetWpadSensorBarPosition(); -BOOL SCSetWpadSensorBarPosition(u8 sensorBarPosition); +u8 SCGetWpadSensorBarPosition(); +BOOL SCSetWpadSensorBarPosition(u8 sensorBarPosition); -u8 SCGetWpadSpeakerVolume(); -BOOL SCSetWpadSpeakerVolume(u8 speakerVolume); +u8 SCGetWpadSpeakerVolume(); +BOOL SCSetWpadSpeakerVolume(u8 speakerVolume); typedef struct SCOwnerNickname { - u16 name[10]; // 0x00 - u16 length; // 0x14 + u16 name[10]; // 0x00 + u16 length; // 0x14 } SCOwnerNickname; -BOOL SCGetOwnerNickName(SCOwnerNickname* ownerNickname); -BOOL SCSetOwnerNickName(SCOwnerNickname* ownerNickname); +BOOL SCGetOwnerNickName(SCOwnerNickname* ownerNickname); +BOOL SCSetOwnerNickName(SCOwnerNickname* ownerNickname); -#define SC_SIMPLE_ADDRESS_ID_COUNTRY 24 -#define SC_SIMPLE_ADDRESS_ID_REGION 16 -#define SC_SIMPLE_ADDRESS_ID_CITY 0 +#define SC_SIMPLE_ADDRESS_ID_COUNTRY 24 +#define SC_SIMPLE_ADDRESS_ID_REGION 16 +#define SC_SIMPLE_ADDRESS_ID_CITY 0 enum { SC_COUNTRY_JP = 1, @@ -317,60 +317,60 @@ enum { SC_COUNTRY_JO, }; -u32 SCGetSimpleAddressID(); +u32 SCGetSimpleAddressID(); typedef struct SCSimpleAddress { - u32 id; // 0x00 - u16 countryName[16][64]; // 0x04 - u16 regionName[16][64]; // 0x804 - u16 latitude; // 0x1004 - u16 longitude; // 0x1006 + u32 id; // 0x00 + u16 countryName[16][64]; // 0x04 + u16 regionName[16][64]; // 0x804 + u16 latitude; // 0x1004 + u16 longitude; // 0x1006 } SCSimpleAddress; -BOOL SCGetSimpleAddressData(SCSimpleAddress* address); -BOOL SCSetSimpleAddressData(SCSimpleAddress* address); +BOOL SCGetSimpleAddressData(SCSimpleAddress* address); +BOOL SCSetSimpleAddressData(SCSimpleAddress* address); -#define SC_NET_RESTRICTIONS_NONE 0 -#define SC_NET_RESTRICTIONS_OPERA (1 << 0) -#define SC_NET_RESTRICTIONS_MSG_BOARD (1 << 1) -#define SC_NET_RESTRICTIONS_SHOPPING (1 << 2) +#define SC_NET_RESTRICTIONS_NONE 0 +#define SC_NET_RESTRICTIONS_OPERA (1 << 0) +#define SC_NET_RESTRICTIONS_MSG_BOARD (1 << 1) +#define SC_NET_RESTRICTIONS_SHOPPING (1 << 2) -u32 SCGetNetContentRestrictions(); -BOOL SCSetNetContentRestrictions(u32 netRestrictions); +u32 SCGetNetContentRestrictions(); +BOOL SCSetNetContentRestrictions(u32 netRestrictions); -BOOL SCGetConfigDoneFlag(); -BOOL SCSetConfigDoneFlag(BOOL configDoneFlag); +BOOL SCGetConfigDoneFlag(); +BOOL SCSetConfigDoneFlag(BOOL configDoneFlag); -BOOL SCGetConfigDoneFlag2(); -BOOL SCSetConfigDoneFlag2(BOOL configDone2Flag); +BOOL SCGetConfigDoneFlag2(); +BOOL SCSetConfigDoneFlag2(BOOL configDone2Flag); -#define SC_UPDATE_TYPE_NONE 0 -#define SC_UPDATE_TYPE_DISC 1 -#define SC_UPDATE_TYPE_NETWORK 2 +#define SC_UPDATE_TYPE_NONE 0 +#define SC_UPDATE_TYPE_DISC 1 +#define SC_UPDATE_TYPE_NETWORK 2 -u8 SCGetUpdateType(); -BOOL SCSetUpdateType(u8 updateType); +u8 SCGetUpdateType(); +BOOL SCSetUpdateType(u8 updateType); -BOOL SCGetEULA(); -BOOL SCSetEULA(BOOL eulaFlag); +BOOL SCGetEULA(); +BOOL SCSetEULA(BOOL eulaFlag); -#define SC_WC_FLAGS_DISABLED 0 -#define SC_WC_FLAGS_ENABLED 1 +#define SC_WC_FLAGS_DISABLED 0 +#define SC_WC_FLAGS_ENABLED 1 -u32 SCGetWCFlags(); -BOOL SCSetWCFlags(u32 wcFlags); +u32 SCGetWCFlags(); +BOOL SCSetWCFlags(u32 wcFlags); -BOOL SCGetFreeChannelAppCount(u32* count); -BOOL SCSetFreeChannelAppCount(u32 count); +BOOL SCGetFreeChannelAppCount(u32* count); +BOOL SCSetFreeChannelAppCount(u32 count); -BOOL SCGetInstalledChannelAppCount(u32* count); -BOOL SCSetInstalledChannelAppCount(u32 count); +BOOL SCGetInstalledChannelAppCount(u32* count); +BOOL SCSetInstalledChannelAppCount(u32 count); -u64 SCGetTmpTitleID(); -BOOL SCSetTmpTitleID(u64 titleId); +u64 SCGetTmpTitleID(); +BOOL SCSetTmpTitleID(u64 titleId); #ifdef __cplusplus } #endif -#endif // REVOLUTION_SYSCONF_H +#endif // REVOLUTION_SYSCONF_H diff --git a/libs/RVL_SDK/include/revolution/sdi.h b/libs/RVL_SDK/include/revolution/sdi.h index 0a6218fa..f6befa53 100644 --- a/libs/RVL_SDK/include/revolution/sdi.h +++ b/libs/RVL_SDK/include/revolution/sdi.h @@ -3,12 +3,12 @@ #include -#define SD_ERROR_BASE 0xC0000000 +#define SD_ERROR_BASE 0xC0000000 typedef s32 ISD_Error; /* slot0, slot1, slotw */ -#define SD_MAX_SLOTS 3 +#define SD_MAX_SLOTS 3 enum { SD_ERROR_SUCCESS = 0, @@ -19,7 +19,7 @@ enum { }; typedef struct _ISD_Device { - s32 fd; // 0x00 + s32 fd; // 0x00 u32 unk_0x04; u32 unk_0x08; u32 unk_0x0C; @@ -31,9 +31,9 @@ typedef struct _ISD_Device { u32 unk_0x24; } ISD_Device; -ISD_Error ISD_MountCard(u32 slot, ISD_Device** dev); -void ISD_UnmountCard(ISD_Device* dev); +ISD_Error ISD_MountCard(u32 slot, ISD_Device** dev); +void ISD_UnmountCard(ISD_Device* dev); -ISD_Error ISD_GetHCRegister(ISD_Device* dev, u32 param_2, u32* param_3, u32 param_4) NO_INLINE; +ISD_Error ISD_GetHCRegister(ISD_Device* dev, u32 param_2, u32* param_3, u32 param_4) NO_INLINE; -#endif // REVOLUTION_SDI_H +#endif // REVOLUTION_SDI_H diff --git a/libs/RVL_SDK/include/revolution/tpl.h b/libs/RVL_SDK/include/revolution/tpl.h index 3841a0b2..fb37350b 100644 --- a/libs/RVL_SDK/include/revolution/tpl.h +++ b/libs/RVL_SDK/include/revolution/tpl.h @@ -1,61 +1,62 @@ #ifndef REVOLUTION_TPL_H #define REVOLUTION_TPL_H -#include #include #include +#include + #ifdef __cplusplus extern "C" { #endif typedef struct TPLHeader { - u16 height; // 0x00 - u16 width; // 0x02 + u16 height; // 0x00 + u16 width; // 0x02 - u32 format; // 0x04 + u32 format; // 0x04 - char* data; // 0x08 + char* data; // 0x08 - GXTexWrapMode wrapS; // 0x0C - GXTexWrapMode wrapT; // 0x10 + GXTexWrapMode wrapS; // 0x0C + GXTexWrapMode wrapT; // 0x10 - GXTexFilter minFilter; // 0x14 - GXTexFilter magFilter; // 0x18 + GXTexFilter minFilter; // 0x14 + GXTexFilter magFilter; // 0x18 - f32 LODBias; // 0x1C - u8 edgeLODEnable; // 0x20 - u8 minLOD; // 0x21 - u8 maxLOD; // 0x22 + f32 LODBias; // 0x1C + u8 edgeLODEnable; // 0x20 + u8 minLOD; // 0x21 + u8 maxLOD; // 0x22 - u8 unpacked; // 0x23 + u8 unpacked; // 0x23 } TPLHeader; typedef struct TPLClutHeader { - u16 numEntries; // 0x00 - u8 unpacked; // 0x01 - GXTlutFmt format; // 0x04 - char* data; // 0x08 + u16 numEntries; // 0x00 + u8 unpacked; // 0x01 + GXTlutFmt format; // 0x04 + char* data; // 0x08 } TPLClutHeader; typedef struct TPLDescriptor { - TPLHeader* textureHeader; // 0x00 - TPLClutHeader* CLUTHeader; // 0x04 + TPLHeader* textureHeader; // 0x00 + TPLClutHeader* CLUTHeader; // 0x04 } TPLDescriptor; typedef struct TPLPalette { - u32 versionNumber; // 0x00 - u32 numDescriptors; // 0x04 - TPLDescriptor* descriptorArray; // 0x08 + u32 versionNumber; // 0x00 + u32 numDescriptors; // 0x04 + TPLDescriptor* descriptorArray; // 0x08 } TPLPalette; -void TPLBind(TPLPalette* pal); +void TPLBind(TPLPalette* pal); -TPLDescriptor* TPLGet(TPLPalette* pal, u32 id); -void TPLGetGXTexObjFromPalette(TPLPalette* pal, GXTexObj* texObj, u32 id); +TPLDescriptor* TPLGet(TPLPalette* pal, u32 id); +void TPLGetGXTexObjFromPalette(TPLPalette* pal, GXTexObj* texObj, u32 id); #ifdef __cplusplus } #endif -#endif // REVOLUTION_TPL_H +#endif // REVOLUTION_TPL_H diff --git a/libs/RVL_SDK/include/revolution/types.h b/libs/RVL_SDK/include/revolution/types.h index dd427720..fa7822cd 100644 --- a/libs/RVL_SDK/include/revolution/types.h +++ b/libs/RVL_SDK/include/revolution/types.h @@ -3,52 +3,52 @@ #include -typedef signed char s8; -typedef signed short s16; -typedef signed long s32; -typedef signed long long s64; -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned long u32; -typedef unsigned long long u64; +typedef signed char s8; +typedef signed short s16; +typedef signed long s32; +typedef signed long long s64; +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned long u32; +typedef unsigned long long u64; -typedef volatile u8 vu8; -typedef volatile u16 vu16; -typedef volatile u32 vu32; -typedef volatile u64 vu64; -typedef volatile s8 vs8; -typedef volatile s16 vs16; -typedef volatile s32 vs32; -typedef volatile s64 vs64; +typedef volatile u8 vu8; +typedef volatile u16 vu16; +typedef volatile u32 vu32; +typedef volatile u64 vu64; +typedef volatile s8 vs8; +typedef volatile s16 vs16; +typedef volatile s32 vs32; +typedef volatile s64 vs64; -typedef float f32; -typedef double f64; -typedef volatile f32 vf32; -typedef volatile f64 vf64; +typedef float f32; +typedef double f64; +typedef volatile f32 vf32; +typedef volatile f64 vf64; -typedef char* Ptr; +typedef char* Ptr; -typedef int BOOL; -typedef unsigned int uBOOL; -typedef volatile BOOL vBOOL; -typedef volatile uBOOL vuBOOL; +typedef int BOOL; +typedef unsigned int uBOOL; +typedef volatile BOOL vBOOL; +typedef volatile uBOOL vuBOOL; -#define TRUE 1 -#define FALSE 0 +#define TRUE 1 +#define FALSE 0 #ifndef NULL #ifdef __cplusplus -#define NULL 0 +#define NULL 0 #else -#define NULL ((void*)0) +#define NULL ((void*)0) #endif // __cplusplus #endif -#define ATTRIBUTE_ALIGN(num) __attribute__((aligned(num))) +#define ATTRIBUTE_ALIGN(num) __attribute__((aligned(num))) -#define DEFAULT_ALIGN 32 +#define DEFAULT_ALIGN 32 -#define ALIGN32 ATTRIBUTE_ALIGN(DEFAULT_ALIGN) -#define ALIGN64 ATTRIBUTE_ALIGN(64) +#define ALIGN32 ATTRIBUTE_ALIGN(DEFAULT_ALIGN) +#define ALIGN64 ATTRIBUTE_ALIGN(64) -#endif // REVOLUTION_TYPES_H +#endif // REVOLUTION_TYPES_H diff --git a/libs/RVL_SDK/include/revolution/usbkbd.h b/libs/RVL_SDK/include/revolution/usbkbd.h index 2348120d..9b4f8cfe 100644 --- a/libs/RVL_SDK/include/revolution/usbkbd.h +++ b/libs/RVL_SDK/include/revolution/usbkbd.h @@ -17,25 +17,25 @@ enum { typedef void (*USBKBDAttachCallback)(void*); typedef void (*USBKBDDetachCallback)(void*); typedef void (*USBKBDEventCallback)(void*, char*); -typedef void (*USBKBDCmdLEDCallback)(BOOL success, void *cbarg); +typedef void (*USBKBDCmdLEDCallback)(BOOL success, void* cbarg); typedef struct USBKBDCmdLED { vu32 unk_0x00; - vu8 unk_0x04; + vu8 unk_0x04; } USBKBDCmdLED; typedef struct USBKBDCmdLEDAsync { - USBKBDCmdLED base; // 0x00 - u8 unk_0x08[0x10]; - USBKBDCmdLEDCallback cb; // 0x18 - void* cbArg; // 0x1C + USBKBDCmdLED base; // 0x00 + u8 unk_0x08[0x10]; + USBKBDCmdLEDCallback cb; // 0x18 + void* cbArg; // 0x1C } USBKBDCmdLEDAsync; -USBKBDErr USBKBDInitialize(USBKBDAttachCallback attachCb, USBKBDDetachCallback detachCb); +USBKBDErr USBKBDInitialize(USBKBDAttachCallback attachCb, USBKBDDetachCallback detachCb); -USBKBDErr USBKBDSetLED(u32, u8, USBKBDCmdLED* cmd); -USBKBDErr USBKBDSetLEDAsync(u32, u8, USBKBDCmdLEDAsync* cmd, USBKBDCmdLEDCallback cb, void* cbArg); +USBKBDErr USBKBDSetLED(u32, u8, USBKBDCmdLED* cmd); +USBKBDErr USBKBDSetLEDAsync(u32, u8, USBKBDCmdLEDAsync* cmd, USBKBDCmdLEDCallback cb, void* cbArg); -USBKBDErr USBKBDRegisterEventCallback(USBKBDEventCallback cb); +USBKBDErr USBKBDRegisterEventCallback(USBKBDEventCallback cb); #endif // REVOLUTION_USB_KBD_H diff --git a/libs/RVL_SDK/include/revolution/verdefs.h b/libs/RVL_SDK/include/revolution/verdefs.h index 25e57c49..490ccaf7 100644 --- a/libs/RVL_SDK/include/revolution/verdefs.h +++ b/libs/RVL_SDK/include/revolution/verdefs.h @@ -2,27 +2,30 @@ #define REVOLUTION_VERSION_MACROS_H // weird hack to stop compile errors -#define STRDEF(x) VALDEF(x) -#define VALDEF(x) #x +#define STRDEF(x) VALDEF(x) +#define VALDEF(x) #x #if defined(DEBUG) -#define BUILD_TYPE " \tdebug build: " +#define BUILD_TYPE " \tdebug build: " #elif defined(NDEBUG) -#define BUILD_TYPE " \trelease build: " +#define BUILD_TYPE " \trelease build: " #else -#define BUILD_TYPE " \tunknown build: " -#endif // DEBUG +#define BUILD_TYPE " \tunknown build: " +#endif // DEBUG #if defined(NON_MATCHING) -#define DefineVersion(package, lib, date, time) \ - const char* __##lib##Version = "<< "STRDEF(package)" - "STRDEF(lib) BUILD_TYPE __DATE__" "__TIME__" ("STRDEF(__CWCC__)"_"STRDEF(__CWBUILD__)") >>" -#define DefineVersionEx(package, lib, date, time, cwbuild) \ - const char* __##lib##Version = "<< "STRDEF(package)" - "STRDEF(lib) BUILD_TYPE __DATE__" "__TIME__" ("STRDEF(__CWCC__)"_"STRDEF(cwbuild)") >>" +#define DefineVersion(package, lib, date, time) \ + const char* __##lib##Version = "<< " STRDEF(package) " - " STRDEF(lib) BUILD_TYPE __DATE__ " "__TIME__ \ + " (" STRDEF(__CWCC__) "_" STRDEF(__CWBUILD__) ") >>" +#define DefineVersionEx(package, lib, date, time, cwbuild) \ + const char* __##lib##Version = "<< " STRDEF(package) " - " STRDEF(lib) BUILD_TYPE __DATE__ " "__TIME__ \ + " (" STRDEF(__CWCC__) "_" STRDEF(cwbuild) ") >>" #else -#define DefineVersion(package, lib, date, time) \ - const char* __##lib##Version = "<< "STRDEF(package)" - "STRDEF(lib) BUILD_TYPE date" "time" ("STRDEF(__CWCC__)"_"STRDEF(__CWBUILD__)") >>" -#define DefineVersionEx(package, lib, date, time, cwbuild) \ - const char* __##lib##Version = "<< "STRDEF(package)" - "STRDEF(lib) BUILD_TYPE date" "time" ("STRDEF(__CWCC__)"_"STRDEF(cwbuild)") >>" +#define DefineVersion(package, lib, date, time) \ + const char* __##lib##Version = \ + "<< " STRDEF(package) " - " STRDEF(lib) BUILD_TYPE date " " time " (" STRDEF(__CWCC__) "_" STRDEF(__CWBUILD__) ") >>" +#define DefineVersionEx(package, lib, date, time, cwbuild) \ + const char* __##lib##Version = "<< " STRDEF(package) " - " STRDEF(lib) BUILD_TYPE date " " time " (" STRDEF(__CWCC__) "_" STRDEF(cwbuild) ") >>" #endif #define GetVersion(lib) __##lib##Version @@ -35,4 +38,4 @@ #define SDKDefineVersionEx(lib, date, time, cwbuild) DefineVersionEx(RVL_SDK, lib, date, time, cwbuild) -#endif // REVOLUTION_VERSION_MACROS_H +#endif // REVOLUTION_VERSION_MACROS_H diff --git a/libs/RVL_SDK/include/revolution/vi.h b/libs/RVL_SDK/include/revolution/vi.h index 825db8a1..1ead1f32 100644 --- a/libs/RVL_SDK/include/revolution/vi.h +++ b/libs/RVL_SDK/include/revolution/vi.h @@ -5,13 +5,12 @@ extern "C" { #endif -#include #include +#include + #ifdef __cplusplus } #endif -#endif // REVOLUTION_VI_H - - +#endif // REVOLUTION_VI_H diff --git a/libs/RVL_SDK/include/revolution/vi/vifuncs.h b/libs/RVL_SDK/include/revolution/vi/vifuncs.h index 59cdacba..b0b4e11a 100644 --- a/libs/RVL_SDK/include/revolution/vi/vifuncs.h +++ b/libs/RVL_SDK/include/revolution/vi/vifuncs.h @@ -1,8 +1,8 @@ #ifndef REVOLUTION_VI_FUNCTIONS_H #define REVOLUTION_VI_FUNCTIONS_H -#include #include +#include #ifdef __cplusplus extern "C" { @@ -10,38 +10,38 @@ extern "C" { #define VIPadFrameBufferWidth(width) ((u16)(((u16)(width) + 15) & ~15)) -void VIInit(); -void VIWaitForRetrace(); +void VIInit(); +void VIWaitForRetrace(); -void VIConfigure(const GXRenderModeObj *rm); -void VIConfigurePan(u16 xOrg, u16 yOrg, u16 width, u16 height); +void VIConfigure(const GXRenderModeObj* rm); +void VIConfigurePan(u16 xOrg, u16 yOrg, u16 width, u16 height); VIRetraceCallback VISetPreRetraceCallback(VIRetraceCallback cb); VIRetraceCallback VISetPostRetraceCallback(VIRetraceCallback cb); -#define VI_DTV_COMPONENT (1 << 0) +#define VI_DTV_COMPONENT (1 << 0) -void VIFlush(); -void VISetNextFrameBuffer(void* fb); +void VIFlush(); +void VISetNextFrameBuffer(void* fb); -void VISetBlack(BOOL setBlack); +void VISetBlack(BOOL setBlack); -void VISetTrapFilter(BOOL setTrap); -void VIResetDimmingCount(); -void VIEnableDimming(BOOL enableDim); +void VISetTrapFilter(BOOL setTrap); +void VIResetDimmingCount(); +void VIEnableDimming(BOOL enableDim); -u32 VIGetRetraceCount(); -u32 VIGetDTVStatus(); -u32 VIGetScanMode(); +u32 VIGetRetraceCount(); +u32 VIGetDTVStatus(); +u32 VIGetScanMode(); -u32 VIGetTvFormat(); +u32 VIGetTvFormat(); -u32 VIGetCurrentLine(); +u32 VIGetCurrentLine(); -void* VIGetCurrentFrameBuffer(); +void* VIGetCurrentFrameBuffer(); #ifdef __cplusplus } #endif -#endif // REVOLUTION_VI_FUNCTIONS_H +#endif // REVOLUTION_VI_FUNCTIONS_H diff --git a/libs/RVL_SDK/include/revolution/vi/vitypes.h b/libs/RVL_SDK/include/revolution/vi/vitypes.h index a131d955..aa6f0dfe 100644 --- a/libs/RVL_SDK/include/revolution/vi/vitypes.h +++ b/libs/RVL_SDK/include/revolution/vi/vitypes.h @@ -7,19 +7,19 @@ extern "C" { #endif -#define VI_DISPLAY_PIX_SZ (2) +#define VI_DISPLAY_PIX_SZ (2) -#define VI_MAX_WIDTH_NTSC (720) -#define VI_MAX_HEIGHT_NTSC (480) +#define VI_MAX_WIDTH_NTSC (720) +#define VI_MAX_HEIGHT_NTSC (480) -#define VI_MAX_WIDTH_PAL (720) -#define VI_MAX_HEIGHT_PAL (574) +#define VI_MAX_WIDTH_PAL (720) +#define VI_MAX_HEIGHT_PAL (574) -#define VI_MAX_WIDTH_MPAL (720) -#define VI_MAX_HEIGHT_MPAL (480) +#define VI_MAX_WIDTH_MPAL (720) +#define VI_MAX_HEIGHT_MPAL (480) -#define VI_MAX_WIDTH_EURGB60 VI_MAX_WIDTH_NTSC -#define VI_MAX_HEIGHT_EURGB60 VI_MAX_HEIGHT_NTSC +#define VI_MAX_WIDTH_EURGB60 VI_MAX_WIDTH_NTSC +#define VI_MAX_HEIGHT_EURGB60 VI_MAX_HEIGHT_NTSC enum { VI_NTSC = 0, @@ -36,31 +36,31 @@ enum { VI_PROGRESSIVE }; -#define VI_TVMODE(format, interlace) (((format) << 2) + (interlace)) +#define VI_TVMODE(format, interlace) (((format) << 2) + (interlace)) typedef enum { - VI_TVMODE_NTSC_INT = VI_TVMODE(VI_NTSC, VI_INTERLACE), - VI_TVMODE_NTSC_DS = VI_TVMODE(VI_NTSC, VI_NON_INTERLACE), - VI_TVMODE_NTSC_PROG = VI_TVMODE(VI_NTSC, VI_PROGRESSIVE), + VI_TVMODE_NTSC_INT = VI_TVMODE(VI_NTSC, VI_INTERLACE), + VI_TVMODE_NTSC_DS = VI_TVMODE(VI_NTSC, VI_NON_INTERLACE), + VI_TVMODE_NTSC_PROG = VI_TVMODE(VI_NTSC, VI_PROGRESSIVE), - VI_TVMODE_PAL_INT = VI_TVMODE(VI_PAL, VI_INTERLACE), - VI_TVMODE_PAL_DS = VI_TVMODE(VI_PAL, VI_NON_INTERLACE), + VI_TVMODE_PAL_INT = VI_TVMODE(VI_PAL, VI_INTERLACE), + VI_TVMODE_PAL_DS = VI_TVMODE(VI_PAL, VI_NON_INTERLACE), - VI_TVMODE_EURGB60_INT = VI_TVMODE(VI_EURGB60, VI_INTERLACE), - VI_TVMODE_EURGB60_DS = VI_TVMODE(VI_EURGB60, VI_NON_INTERLACE), - VI_TVMODE_EURGB60_PROG = VI_TVMODE(VI_EURGB60, VI_PROGRESSIVE), - - VI_TVMODE_MPAL_INT = VI_TVMODE(VI_MPAL, VI_INTERLACE), - VI_TVMODE_MPAL_DS = VI_TVMODE(VI_MPAL, VI_NON_INTERLACE), - VI_TVMODE_MPAL_PROG = VI_TVMODE(VI_MPAL, VI_PROGRESSIVE), - - VI_TVMODE_DEBUG_INT = VI_TVMODE(VI_DEBUG, VI_INTERLACE), + VI_TVMODE_EURGB60_INT = VI_TVMODE(VI_EURGB60, VI_INTERLACE), + VI_TVMODE_EURGB60_DS = VI_TVMODE(VI_EURGB60, VI_NON_INTERLACE), + VI_TVMODE_EURGB60_PROG = VI_TVMODE(VI_EURGB60, VI_PROGRESSIVE), + + VI_TVMODE_MPAL_INT = VI_TVMODE(VI_MPAL, VI_INTERLACE), + VI_TVMODE_MPAL_DS = VI_TVMODE(VI_MPAL, VI_NON_INTERLACE), + VI_TVMODE_MPAL_PROG = VI_TVMODE(VI_MPAL, VI_PROGRESSIVE), + + VI_TVMODE_DEBUG_INT = VI_TVMODE(VI_DEBUG, VI_INTERLACE), VI_TVMODE_DEBUG_PAL_INT = VI_TVMODE(VI_DEBUG_PAL, VI_INTERLACE), - VI_TVMODE_DEBUG_PAL_DS = VI_TVMODE(VI_DEBUG_PAL, VI_NON_INTERLACE) + VI_TVMODE_DEBUG_PAL_DS = VI_TVMODE(VI_DEBUG_PAL, VI_NON_INTERLACE) } VITVMode; - + typedef enum { - VI_XFBMODE_SF = 0, + VI_XFBMODE_SF = 0, VI_XFBMODE_DF } VIXFBMode; @@ -70,4 +70,4 @@ typedef void (*VIRetraceCallback)(u32 retraceCount); } #endif -#endif // REVOLUTION_VI_TYPES_H +#endif // REVOLUTION_VI_TYPES_H diff --git a/libs/RVL_SDK/include/revolution/wad.h b/libs/RVL_SDK/include/revolution/wad.h index b0e0091b..d5ef7a8a 100644 --- a/libs/RVL_SDK/include/revolution/wad.h +++ b/libs/RVL_SDK/include/revolution/wad.h @@ -9,49 +9,49 @@ extern "C" { #endif -#define WAD_IMPORT_TYPE_BOOT "ib" /* "import boot" */ -#define WAD_IMPORT_TYPE_SOFTWARE "Is" /* "Import software" */ -#define WAD_IMPORT_TYPE_BACKUP "Bk" /* "Backup"*/ +#define WAD_IMPORT_TYPE_BOOT "ib" /* "import boot" */ +#define WAD_IMPORT_TYPE_SOFTWARE "Is" /* "Import software" */ +#define WAD_IMPORT_TYPE_BACKUP "Bk" /* "Backup"*/ typedef struct WADHeader { - u32 hdrSize; // 0x00 (Always 32) + u32 hdrSize; // 0x00 (Always 32) - u8 wadType[2]; // 0x04 - u16 wadVersion; // 0x06 + u8 wadType[2]; // 0x04 + u16 wadVersion; // 0x06 - u32 certSize; // 0x08 - u32 crlSize; // 0x0C + u32 certSize; // 0x08 + u32 crlSize; // 0x0C - u32 ticketSize; // 0x10 - u32 tmdSize; // 0x14 - u32 contentSize; // 0x18 - u32 metaSize; // 0x20 + u32 ticketSize; // 0x10 + u32 tmdSize; // 0x14 + u32 contentSize; // 0x18 + u32 metaSize; // 0x20 } WADHeader; typedef struct WADBackupHeader { - u32 hdrSize; // 0x00 (Always 112) + u32 hdrSize; // 0x00 (Always 112) - u8 wadType[2]; // 0x04 - u16 wadVersion; // 0x06 + u8 wadType[2]; // 0x04 + u16 wadVersion; // 0x06 - ESDeviceId deviceId; // 0x08 + ESDeviceId deviceId; // 0x08 - u32 numFiles; // 0x0C - u32 fileSize; // 0x10 + u32 numFiles; // 0x0C + u32 fileSize; // 0x10 - u32 tmdSize; // 0x14 - u32 contentSize; // 0x18 - u32 backupAreaLen; // 0x1C + u32 tmdSize; // 0x14 + u32 contentSize; // 0x18 + u32 backupAreaLen; // 0x1C - ESContentMask cidx; // 0x20 + ESContentMask cidx; // 0x20 - ESTitleId titleId; // 0x60 + ESTitleId titleId; // 0x60 - u8 deviceMac[6]; // 0x68 + u8 deviceMac[6]; // 0x68 } WADBackupHeader; #ifdef __cplusplus } #endif -#endif // REVOLUTION_WAD_H +#endif // REVOLUTION_WAD_H diff --git a/libs/RVL_SDK/include/revolution/wenc.h b/libs/RVL_SDK/include/revolution/wenc.h index 89d7542b..178eae24 100644 --- a/libs/RVL_SDK/include/revolution/wenc.h +++ b/libs/RVL_SDK/include/revolution/wenc.h @@ -12,7 +12,7 @@ enum { }; typedef struct WENCInfo { - u8 data[0x20]; + u8 data[0x20]; } WENCInfo; s32 WENCGetEncodeData(WENCInfo* info, u32 flag, const s16* pbyPcmData, s32 nSampleNum, u8* pbyAdpcmData); @@ -21,4 +21,4 @@ s32 WENCGetEncodeData(WENCInfo* info, u32 flag, const s16* pbyPcmData, s32 nSamp } #endif -#endif // REVOLUTION_WENC_H +#endif // REVOLUTION_WENC_H diff --git a/libs/RVL_SDK/include/revolution/wpad.h b/libs/RVL_SDK/include/revolution/wpad.h index 5ffc6c58..b0d34c82 100644 --- a/libs/RVL_SDK/include/revolution/wpad.h +++ b/libs/RVL_SDK/include/revolution/wpad.h @@ -5,15 +5,15 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus -#define WPAD_MAX_DPD_OBJECTS 4 +#define WPAD_MAX_DPD_OBJECTS 4 -#define WPAD_MIN_DPD_SENS 1 -#define WPAD_MAX_DPD_SENS 5 +#define WPAD_MIN_DPD_SENS 1 +#define WPAD_MAX_DPD_SENS 5 -#define WPAD_MAX_DPD_X 1023 -#define WPAD_MAX_DPD_Y 767 +#define WPAD_MAX_DPD_X 1023 +#define WPAD_MAX_DPD_Y 767 #define WPAD_MAX_SPEAKER_VOLUME 127 @@ -25,25 +25,25 @@ typedef void (*WPADClearDeviceCallback)(s32 result); /* WPAD CHANNEL */ -#define WPAD_CHAN_INVALID -1 -#define WPAD_CHAN0 0 -#define WPAD_CHAN1 1 -#define WPAD_CHAN2 2 -#define WPAD_CHAN3 3 +#define WPAD_CHAN_INVALID -1 +#define WPAD_CHAN0 0 +#define WPAD_CHAN1 1 +#define WPAD_CHAN2 2 +#define WPAD_CHAN3 3 -#define WPAD_MAX_CONTROLLERS 4 +#define WPAD_MAX_CONTROLLERS 4 /* ERRORS */ enum { WPAD_ERR_OK = 0, WPAD_ERR_NO_CONTROLLER = -1, - WPAD_ERR_COMMUNICATION_ERROR = -2, + WPAD_ERR_COMMUNICATION_ERROR = -2, WPAD_ERR_TRANSFER = -3, WPAD_ERR_INVALID = -4, WPAD_ERR_CORRUPTED = -7, - WPAD_ERR_BUSY = WPAD_ERR_COMMUNICATION_ERROR , + WPAD_ERR_BUSY = WPAD_ERR_COMMUNICATION_ERROR, }; /* DEVICE TYPE */ @@ -62,35 +62,35 @@ enum { /* WIRELESS REMOTE */ -#define WPAD_BUTTON_LEFT (1 << 0) // 0x01 -#define WPAD_BUTTON_RIGHT (1 << 1) // 0x02 -#define WPAD_BUTTON_DOWN (1 << 2) // 0x04 -#define WPAD_BUTTON_UP (1 << 3) // 0x08 -#define WPAD_BUTTON_PLUS (1 << 4) // 0x10 -#define WPAD_BUTTON_2 (1 << 8) // 0x100 -#define WPAD_BUTTON_1 (1 << 9) // 0x200 -#define WPAD_BUTTON_B (1 << 10) // 0x400 -#define WPAD_BUTTON_A (1 << 11) // 0x800 -#define WPAD_BUTTON_MINUS (1 << 12) // 0x1000 -#define WPAD_BUTTON_HOME (1 << 15) // 0x2000 +#define WPAD_BUTTON_LEFT (1 << 0) // 0x01 +#define WPAD_BUTTON_RIGHT (1 << 1) // 0x02 +#define WPAD_BUTTON_DOWN (1 << 2) // 0x04 +#define WPAD_BUTTON_UP (1 << 3) // 0x08 +#define WPAD_BUTTON_PLUS (1 << 4) // 0x10 +#define WPAD_BUTTON_2 (1 << 8) // 0x100 +#define WPAD_BUTTON_1 (1 << 9) // 0x200 +#define WPAD_BUTTON_B (1 << 10) // 0x400 +#define WPAD_BUTTON_A (1 << 11) // 0x800 +#define WPAD_BUTTON_MINUS (1 << 12) // 0x1000 +#define WPAD_BUTTON_HOME (1 << 15) // 0x2000 /* CLASSIC CONTROLLER */ -#define WPAD_BUTTON_CL_UP (1 << 0) // 0x01 -#define WPAD_BUTTON_CL_LEFT (1 << 1) // 0x02 -#define WPAD_BUTTON_CL_ZR (1 << 2) // 0x04 -#define WPAD_BUTTON_CL_X (1 << 3) // 0x08 -#define WPAD_BUTTON_CL_A (1 << 4) // 0x10 -#define WPAD_BUTTON_CL_Y (1 << 5) // 0x20 -#define WPAD_BUTTON_CL_B (1 << 6) // 0x40 -#define WPAD_BUTTON_CL_ZL (1 << 7) // 0x80 -#define WPAD_BUTTON_CL_FULL_R (1 << 9) // 0x200 -#define WPAD_BUTTON_CL_PLUS (1 << 10) // 0x400 -#define WPAD_BUTTON_CL_HOME (1 << 11) // 0x800 -#define WPAD_BUTTON_CL_MINUS (1 << 12) // 0x1000 -#define WPAD_BUTTON_CL_FULL_L (1 << 13) // 0x2000 -#define WPAD_BUTTON_CL_DOWN (1 << 14) // 0x4000 -#define WPAD_BUTTON_CL_RIGHT (1 << 15) // 0x8000 +#define WPAD_BUTTON_CL_UP (1 << 0) // 0x01 +#define WPAD_BUTTON_CL_LEFT (1 << 1) // 0x02 +#define WPAD_BUTTON_CL_ZR (1 << 2) // 0x04 +#define WPAD_BUTTON_CL_X (1 << 3) // 0x08 +#define WPAD_BUTTON_CL_A (1 << 4) // 0x10 +#define WPAD_BUTTON_CL_Y (1 << 5) // 0x20 +#define WPAD_BUTTON_CL_B (1 << 6) // 0x40 +#define WPAD_BUTTON_CL_ZL (1 << 7) // 0x80 +#define WPAD_BUTTON_CL_FULL_R (1 << 9) // 0x200 +#define WPAD_BUTTON_CL_PLUS (1 << 10) // 0x400 +#define WPAD_BUTTON_CL_HOME (1 << 11) // 0x800 +#define WPAD_BUTTON_CL_MINUS (1 << 12) // 0x1000 +#define WPAD_BUTTON_CL_FULL_L (1 << 13) // 0x2000 +#define WPAD_BUTTON_CL_DOWN (1 << 14) // 0x4000 +#define WPAD_BUTTON_CL_RIGHT (1 << 15) // 0x8000 enum { WPAD_LIB_STATUS_0, @@ -106,7 +106,6 @@ enum { WPAD_SYNC_DONE, }; - enum { WPAD_FMT_CORE_BTN, WPAD_FMT_CORE_BTN_ACC, @@ -167,137 +166,137 @@ enum { }; typedef struct DPDObject { - s16 x; // 0x00 - s16 y; // 0x02 - u16 size; // 0x04 - u8 traceId; // 0x06 + s16 x; // 0x00 + s16 y; // 0x02 + u16 size; // 0x04 + u8 traceId; // 0x06 } DPDObject; typedef struct DPDObjEx { - s16 range_x1; // 0x0 - s16 range_y1; // 0x2 - s16 range_x2; // 0x4 - s16 range_y2; // 0x6 - u16 pixel; // 0x8 - s8 radius; // 0xA + s16 range_x1; // 0x0 + s16 range_y1; // 0x2 + s16 range_x2; // 0x4 + s16 range_y2; // 0x6 + u16 pixel; // 0x8 + s8 radius; // 0xA } DPDObjEx; typedef struct WPADStatus { - u16 button; // 0x00 - s16 accX; // 0x02 - s16 accY; // 0x04 - s16 accZ; // 0x06 + u16 button; // 0x00 + s16 accX; // 0x02 + s16 accY; // 0x04 + s16 accZ; // 0x06 - DPDObject obj[WPAD_MAX_CONTROLLERS]; // 0x08 + DPDObject obj[WPAD_MAX_CONTROLLERS]; // 0x08 - u8 dev; // 0x28 - s8 err; // 0x29 + u8 dev; // 0x28 + s8 err; // 0x29 } WPADStatus; typedef struct WPADStatusEx { - u16 button; // at 0x0 + u16 button; // at 0x0 - s16 accX; // at 0x2 - s16 accY; // at 0x4 - s16 accZ; // at 0x6 + s16 accX; // at 0x2 + s16 accY; // at 0x4 + s16 accZ; // at 0x6 - DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // at 0x8 - u8 dev; // at 0x28 - s8 err; // at 0x29 + DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // at 0x8 + u8 dev; // at 0x28 + s8 err; // at 0x29 - DPDObjEx exp[WPAD_MAX_DPD_OBJECTS]; // at 0x2A + DPDObjEx exp[WPAD_MAX_DPD_OBJECTS]; // at 0x2A } WPADStatusEx; typedef struct WPADFSStatus { - u16 button; // 0x00 + u16 button; // 0x00 - s16 accX; // 0x02 - s16 accY; // 0x04 - s16 accZ; // 0x06 + s16 accX; // 0x02 + s16 accY; // 0x04 + s16 accZ; // 0x06 - DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // 0x08 - u8 dev; // 0x28 - s8 err; // 0x29 + DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // 0x08 + u8 dev; // 0x28 + s8 err; // 0x29 - s16 fsAccX; // 0x2A - s16 fsAccY; // 0x2C - s16 fsAccZ; // 0x2E + s16 fsAccX; // 0x2A + s16 fsAccY; // 0x2C + s16 fsAccZ; // 0x2E - s8 fsStickX; // 0x30 - s8 fsStickY; // 0x31 + s8 fsStickX; // 0x30 + s8 fsStickY; // 0x31 } WPADFSStatus; typedef struct WPADCLStatus { - u16 button; // 0x00 - s16 accX; // 0x02 - s16 accY; // 0x04 - s16 accZ; // 0x06 + u16 button; // 0x00 + s16 accX; // 0x02 + s16 accY; // 0x04 + s16 accZ; // 0x06 - DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // 0x08 + DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // 0x08 - u8 dev; // 0x28 - s8 err; // 0x29 + u8 dev; // 0x28 + s8 err; // 0x29 - u16 clButton; // 0x2A + u16 clButton; // 0x2A - s16 clLStickX; // 0x2C - s16 clLStickY; // 0x2E - s16 clRStickX; // 0x30 - s16 clRStickY; // 0x32 + s16 clLStickX; // 0x2C + s16 clLStickY; // 0x2E + s16 clRStickX; // 0x30 + s16 clRStickY; // 0x32 - u8 clTriggerL; // 0x34 - u8 clTriggerR; // 0x35 + u8 clTriggerL; // 0x34 + u8 clTriggerR; // 0x35 } WPADCLStatus; typedef struct WPADTRStatus { - u16 button; // 0x00 - s16 accX; // 0x02 - s16 accY; // 0x04 - s16 accZ; // 0x06 + u16 button; // 0x00 + s16 accX; // 0x02 + s16 accY; // 0x04 + s16 accZ; // 0x06 - DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // 0x08 + DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // 0x08 - u8 dev; // 0x28 - s8 err; // 0x29 + u8 dev; // 0x28 + s8 err; // 0x29 - u16 trButton; // 0x2A - u8 brake; // 0x2C - u8 mascon; // 0x2D + u16 trButton; // 0x2A + u8 brake; // 0x2C + u8 mascon; // 0x2D } WPADTRStatus; typedef struct WPADBLStatus { - u16 button; // 0x00 - s16 accX; // 0x02 - s16 accY; // 0x04 - s16 accZ; // 0x06 + u16 button; // 0x00 + s16 accX; // 0x02 + s16 accY; // 0x04 + s16 accZ; // 0x06 - DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // 0x08 + DPDObject obj[WPAD_MAX_DPD_OBJECTS]; // 0x08 - u8 dev; // 0x28 - s8 err; // 0x29 + u8 dev; // 0x28 + s8 err; // 0x29 - u16 press[WPAD_MAX_DPD_OBJECTS]; // 0x2A - s8 temp; // 0x32 - u8 battery; // 0x33 + u16 press[WPAD_MAX_DPD_OBJECTS]; // 0x2A + s8 temp; // 0x32 + u8 battery; // 0x33 } WPADBLStatus; typedef struct WPADInfo { - BOOL dpd; // 0x00 - BOOL speaker; // 0x04 - BOOL attach; // 0x08 - BOOL lowBat; // 0x0C - BOOL nearempty; // 0x10 + BOOL dpd; // 0x00 + BOOL speaker; // 0x04 + BOOL attach; // 0x08 + BOOL lowBat; // 0x0C + BOOL nearempty; // 0x10 - u8 battery; // 0x14 - u8 led; // 0x15 - u8 protocol; // 0x16 - u8 firmware; // 0x17 + u8 battery; // 0x14 + u8 led; // 0x15 + u8 protocol; // 0x16 + u8 firmware; // 0x17 } WPADInfo; typedef struct WPADAccGravityUnit { - s16 x; // at 0x0 - s16 y; // at 0x2 - s16 z; // at 0x4 + s16 x; // at 0x0 + s16 y; // at 0x2 + s16 z; // at 0x4 } WPADAccGravityUnit; typedef void (*WPADCallback)(s32 chan, s32 result); @@ -306,71 +305,71 @@ typedef void (*WPADConnectCallback)(s32 chan, s32 result); typedef void (*WPADExtensionCallback)(s32 chan, s32 dev); typedef void (*WPADSaveCallback)(int status); -void WPADInit(); -void WPADShutdown(); +void WPADInit(); +void WPADShutdown(); -BOOL WPADStartSimpleSync(); -BOOL WPADStartFastSimpleSync(); -BOOL WPADStopSimpleSync(); -BOOL WPADStartClearDevice(); +BOOL WPADStartSimpleSync(); +BOOL WPADStartFastSimpleSync(); +BOOL WPADStopSimpleSync(); +BOOL WPADStartClearDevice(); -WPADSyncDeviceCallback WPADSetSimpleSyncCallback(WPADSyncDeviceCallback pCallback); +WPADSyncDeviceCallback WPADSetSimpleSyncCallback(WPADSyncDeviceCallback pCallback); WPADClearDeviceCallback WPADSetClearDeviceCallback(WPADClearDeviceCallback pCallback); -void WPADRegisterAllocator(WPADAllocFunc pAllocFunc, WPADFreeFunc pFreeFunc); -u32 WPADGetWorkMemorySize(); +void WPADRegisterAllocator(WPADAllocFunc pAllocFunc, WPADFreeFunc pFreeFunc); +u32 WPADGetWorkMemorySize(); -s32 WPADGetStatus(); -u8 WPADGetSensorBarPosition(); +s32 WPADGetStatus(); +u8 WPADGetSensorBarPosition(); -void WPADGetAccGravityUnit(s32 chan, u32 type, WPADAccGravityUnit* acc); +void WPADGetAccGravityUnit(s32 chan, u32 type, WPADAccGravityUnit* acc); -void WPADDisconnect(s32 chan); -s32 WPADProbe(s32 chan, u32* pDevType); +void WPADDisconnect(s32 chan); +s32 WPADProbe(s32 chan, u32* pDevType); -WPADSamplingCallback WPADSetSamplingCallback(s32 chan, WPADSamplingCallback callback); -WPADConnectCallback WPADSetConnectCallback(s32 chan, WPADConnectCallback callback); -WPADExtensionCallback WPADSetExtensionCallback(s32 chan, WPADExtensionCallback callback); +WPADSamplingCallback WPADSetSamplingCallback(s32 chan, WPADSamplingCallback callback); +WPADConnectCallback WPADSetConnectCallback(s32 chan, WPADConnectCallback callback); +WPADExtensionCallback WPADSetExtensionCallback(s32 chan, WPADExtensionCallback callback); -u32 WPADGetDataFormat(s32 chan); -s32 WPADSetDataFormat(s32 chan, u32 format); +u32 WPADGetDataFormat(s32 chan); +s32 WPADSetDataFormat(s32 chan, u32 format); -s32 WPADGetInfoAsync(s32 chan, WPADInfo* info, WPADCallback callback); +s32 WPADGetInfoAsync(s32 chan, WPADInfo* info, WPADCallback callback); -void WPADControlMotor(s32 chan, u32 command); -void WPADEnableMotor(BOOL enable); -BOOL WPADIsMotorEnabled(); +void WPADControlMotor(s32 chan, u32 command); +void WPADEnableMotor(BOOL enable); +BOOL WPADIsMotorEnabled(); -s32 WPADControlLed(s32 chan, u8 flags, WPADCallback pCallback); -BOOL WPADSaveConfig(WPADSaveCallback callback); +s32 WPADControlLed(s32 chan, u8 flags, WPADCallback pCallback); +BOOL WPADSaveConfig(WPADSaveCallback callback); -void WPADRead(s32 chan, WPADStatus* status); -void WPADSetAutoSamplingBuf(s32 chan, void* buffer, u32 len); +void WPADRead(s32 chan, WPADStatus* status); +void WPADSetAutoSamplingBuf(s32 chan, void* buffer, u32 len); -u32 WPADGetLatestIndexInBuf(s32 chan); +u32 WPADGetLatestIndexInBuf(s32 chan); -BOOL WPADIsSpeakerEnabled(s32 chan); -s32 WPADControlSpeaker(s32 chan, u32 command, WPADCallback callback); -u8 WPADGetSpeakerVolume(); -void WPADSetSpeakerVolume(u8 volume); +BOOL WPADIsSpeakerEnabled(s32 chan); +s32 WPADControlSpeaker(s32 chan, u32 command, WPADCallback callback); +u8 WPADGetSpeakerVolume(); +void WPADSetSpeakerVolume(u8 volume); -BOOL WPADCanSendStreamData(s32 chan); -s32 WPADSendStreamData(s32 chan, void* data, u16 len); +BOOL WPADCanSendStreamData(s32 chan); +s32 WPADSendStreamData(s32 chan, void* data, u16 len); -void WPADSetDpdSensitivity(u8 sensitivity); -u8 WPADGetDpdSensitivity(); -BOOL WPADSetSensorBarPower(BOOL enable); -BOOL WPADIsDpdEnabled(s32 chan); -s32 WPADControlDpd(s32 chan, u32 command, WPADCallback callback); +void WPADSetDpdSensitivity(u8 sensitivity); +u8 WPADGetDpdSensitivity(); +BOOL WPADSetSensorBarPower(BOOL enable); +BOOL WPADIsDpdEnabled(s32 chan); +s32 WPADControlDpd(s32 chan, u32 command, WPADCallback callback); -void WPADRecalibrate(s32 chan); +void WPADRecalibrate(s32 chan); -s32 WPADReadFaceData(s32 chan, void* dst, u16 size, u16 src, WPADCallback cb); -s32 WPADWriteFaceData(s32 chan, void *dst, u16 size, u16 src, WPADCallback cb); +s32 WPADReadFaceData(s32 chan, void* dst, u16 size, u16 src, WPADCallback cb); +s32 WPADWriteFaceData(s32 chan, void* dst, u16 size, u16 src, WPADCallback cb); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // REVOLUTION_WPAD_H +#endif // REVOLUTION_WPAD_H diff --git a/libs/RVL_SDK/src/ai/ai.c b/libs/RVL_SDK/src/ai/ai.c index a3bcc0fb..bb1850ef 100644 --- a/libs/RVL_SDK/src/ai/ai.c +++ b/libs/RVL_SDK/src/ai/ai.c @@ -1,5 +1,6 @@ -#include #include +#include + #include @@ -11,17 +12,17 @@ SDKDefineVersion(AI, "Apr 20 2010", "11:18:54"); -static AIDCallback __AID_Callback; +static AIDCallback __AID_Callback; -static void* __CallbackStack; -static void* __OldStack; +static void* __CallbackStack; +static void* __OldStack; -static s64 bound_32KHz; -static s64 bound_48KHz; +static s64 bound_32KHz; +static s64 bound_48KHz; -static s64 min_wait; -static s64 max_wait; -static s64 buffer; +static s64 min_wait; +static s64 max_wait; +static s64 buffer; static BOOL __AID_Active; static BOOL __AI_init_flag; @@ -55,11 +56,11 @@ void AIInitDMA(u32 startAddr, u32 length) { } void AIStartDMA() { - DSP_SET_REG_F(DSP_DMA_CONTROL_LENGTH, (1<> 6) ^ 1; + return (AI_HAS_REG_F(AI_CONTROL, (1 << AI_CONTROL_SAMPLERATE)) >> 6) ^ 1; } void AIInit(void* stack) { @@ -106,12 +107,12 @@ void AIInit(void* stack) { max_wait = OSNanosecondsToTicks(63000); buffer = OSNanosecondsToTicks(3000); - AI_DEL_REG_F(AI_CONTROL, (1<= bound_32KHz + buffer && diff < bound_48KHz - buffer) { + } else if (diff >= bound_32KHz + buffer && diff < bound_48KHz - buffer) { wait = max_wait; exit = TRUE; - } - else { + } else { exit = FALSE; } } - while (end + wait > OSGetTime()) {} + while (end + wait > OSGetTime()) { + } } diff --git a/libs/RVL_SDK/src/arc/arc.c b/libs/RVL_SDK/src/arc/arc.c index e39d63d5..70784e86 100644 --- a/libs/RVL_SDK/src/arc/arc.c +++ b/libs/RVL_SDK/src/arc/arc.c @@ -4,24 +4,24 @@ #include -#define ARC_MAX_PATH 128 +#define ARC_MAX_PATH 128 typedef struct FSTEntry { u32 isDirAndStringOff; // 0x00 union { struct { - u32 parent; // 0x04 - u32 next; // 0x08 + u32 parent; // 0x04 + u32 next; // 0x08 } dir; struct { - u32 position; // 0x04 - u32 length; // 0x08 + u32 position; // 0x04 + u32 length; // 0x08 } file; }; } FSTEntry; -#define IS_ENTRY_DIR(fstStart, i) ((((fstStart)[i].isDirAndStringOff & 0xFF000000) == 0) ? FALSE : TRUE) -#define FILE_STRING_OFF(fstStart, i) ((fstStart)[i].isDirAndStringOff & 0x00FFFFFF) +#define IS_ENTRY_DIR(fstStart, i) ((((fstStart)[i].isDirAndStringOff & 0xFF000000) == 0) ? FALSE : TRUE) +#define FILE_STRING_OFF(fstStart, i) ((fstStart)[i].isDirAndStringOff & 0x00FFFFFF) static BOOL ARCGetCurrentDir(ARCHandle* handle, char* path, u32 maxlen); @@ -52,19 +52,19 @@ BOOL ARCInitHandle(void* arcStart, ARCHandle* handle) { OSAssertMsg(header->magic == ARC_MAGIC, "ARCInitHandle: bad archive format", 74); - handle->archiveStartAddr = arcStart; + handle->archiveStartAddr = arcStart; - FSTEntries = (FSTEntry*)((u32)arcStart + header->fstStart); - handle->FSTStart = FSTEntries; + FSTEntries = (FSTEntry*)((u32)arcStart + header->fstStart); + handle->FSTStart = FSTEntries; + + handle->fileStart = (void*)((u32)arcStart + header->fileStart); + handle->entryNum = FSTEntries[0].dir.next; + + handle->FSTStringStart = (char*)&FSTEntries[handle->entryNum]; + handle->FSTLength = header->fstSize; + + handle->currDir = 0; - handle->fileStart = (void*)((u32)arcStart + header->fileStart); - handle->entryNum = FSTEntries[0].dir.next; - - handle->FSTStringStart = (char*)&FSTEntries[handle->entryNum]; - handle->FSTLength = header->fstSize; - - handle->currDir = 0; - return TRUE; } @@ -85,7 +85,7 @@ BOOL ARCOpen(ARCHandle* handle, const char* fileName, ARCFileInfo* file) { // If entry number was not a file, abort if (entryNum < 0 || IS_ENTRY_DIR(FSTEntries, entryNum)) { return FALSE; - } + } // Otherwise, prepare for read. file->handle = handle; @@ -115,7 +115,7 @@ s32 ARCConvertPathToEntrynum(ARCHandle* handle, const char* path) { const char* ptrPath; BOOL isDir; - s32 pathLen, dirLookAt, i; + s32 pathLen, dirLookAt, i; FSTEntry* FSTEntries; @@ -126,7 +126,7 @@ s32 ARCConvertPathToEntrynum(ARCHandle* handle, const char* path) { // End of path? Done! if (*path == 0) { return dirLookAt; - } + } // Ignore initial slash. else if (*path == '/') { dirLookAt = 0; @@ -143,30 +143,31 @@ s32 ARCConvertPathToEntrynum(ARCHandle* handle, const char* path) { continue; } // If the input path was literally just `../`, then return the parent. - else if (*(path+2) == 0) { + else if (*(path + 2) == 0) { return FSTEntries[dirLookAt].dir.parent; } } // "." directory does nothing - else if (*(path+1) == '/') { + else if (*(path + 1) == '/') { path += 2; continue; } // Ignore trailing dot - else if (*(path+1) == 0) { + else if (*(path + 1) == 0) { return dirLookAt; } } // The directory is not special, isolate the path! - for (ptrPath = path; *ptrPath != 0 && *ptrPath != '/'; ptrPath++) {} - - isDir = *ptrPath == 0 ? FALSE : TRUE; + for (ptrPath = path; *ptrPath != 0 && *ptrPath != '/'; ptrPath++) { + } + + isDir = *ptrPath == 0 ? FALSE : TRUE; pathLen = ptrPath - path; ptrPath = path; - for (i = dirLookAt+1; i < FSTEntries[dirLookAt].dir.next; i = IS_ENTRY_DIR(FSTEntries, i) ? FSTEntries[i].dir.next : i+1) { + for (i = dirLookAt + 1; i < FSTEntries[dirLookAt].dir.next; i = IS_ENTRY_DIR(FSTEntries, i) ? FSTEntries[i].dir.next : i + 1) { char* name; -loop_back: + loop_back: // Skip directories if (IS_ENTRY_DIR(FSTEntries, i) == FALSE && isDir == TRUE) { continue; @@ -175,7 +176,7 @@ loop_back: name = handle->FSTStringStart + FILE_STRING_OFF(FSTEntries, i); // Skip empty entries - if (*name == '.' && *(name+1) == 0) { + if (*name == '.' && *(name + 1) == 0) { i++; goto loop_back; } @@ -187,7 +188,7 @@ loop_back: } return -1; -next_in_hier: + next_in_hier: // Path was truncated? There is nowhere else to go. if (!isDir) { return i; @@ -205,9 +206,9 @@ BOOL ARCEntrynumIsDir(ARCHandle* handle, s32 entryNum) { #pragma pop static u32 entryToPath(ARCHandle* handle, u32 entry, char* path, u32 maxlen) { - char* name; - u32 loc; - FSTEntry* FSTEntries = (FSTEntry*)handle->FSTStart; + char* name; + u32 loc; + FSTEntry* FSTEntries = (FSTEntry*)handle->FSTStart; if (entry == 0) { return 0; @@ -215,14 +216,14 @@ static u32 entryToPath(ARCHandle* handle, u32 entry, char* path, u32 maxlen) { name = handle->FSTStringStart + FILE_STRING_OFF(FSTEntries, entry); loc = entryToPath(handle, FSTEntries[entry].dir.parent, path, maxlen); - + if (loc == maxlen) { return loc; } *(path + loc++) = '/'; loc += myStrncpy(path + loc, name, maxlen - loc); - + return loc; } @@ -233,19 +234,19 @@ static BOOL ARCConvertEntrynumToPath(ARCHandle* handle, s32 entryNum, char* path loc = entryToPath(handle, entryNum, path, maxlen); if (loc == maxlen) { - path[maxlen-1] = 0; + path[maxlen - 1] = 0; return FALSE; } if (IS_ENTRY_DIR(FSTEntries, entryNum)) { - if (loc == maxlen-1) { + if (loc == maxlen - 1) { path[loc] = 0; return FALSE; } path[loc++] = '/'; } path[loc] = 0; - + return TRUE; } @@ -272,7 +273,7 @@ BOOL ARCClose(ARCFileInfo* file) { } BOOL ARCChangeDir(ARCHandle* handle, const char* dirName) { - s32 entry; + s32 entry; FSTEntry* FSTEntries; entry = ARCConvertPathToEntrynum(handle, dirName); @@ -283,13 +284,13 @@ BOOL ARCChangeDir(ARCHandle* handle, const char* dirName) { } handle->currDir = (u32)entry; - + return TRUE; } BOOL ARCOpenDir(ARCHandle* handle, const char* dirName, ARCDir* dir) { - s32 entry; - FSTEntry* FSTEntries; + s32 entry; + FSTEntry* FSTEntries; entry = ARCConvertPathToEntrynum(handle, dirName); FSTEntries = (FSTEntry*)handle->FSTStart; @@ -300,9 +301,9 @@ BOOL ARCOpenDir(ARCHandle* handle, const char* dirName, ARCDir* dir) { dir->handle = handle; dir->entryNum = entry; - dir->location = entry+1; + dir->location = entry + 1; dir->next = FSTEntries[entry].dir.next; - + return TRUE; } @@ -329,8 +330,8 @@ retry: goto retry; } - dir->location = IS_ENTRY_DIR(FSTEntries, loc) ? FSTEntries[loc].dir.next : (loc+1); - + dir->location = IS_ENTRY_DIR(FSTEntries, loc) ? FSTEntries[loc].dir.next : (loc + 1); + return TRUE; } diff --git a/libs/RVL_SDK/src/ax/AX.c b/libs/RVL_SDK/src/ax/AX.c index 953b1c4c..2e1866f6 100644 --- a/libs/RVL_SDK/src/ax/AX.c +++ b/libs/RVL_SDK/src/ax/AX.c @@ -1,5 +1,5 @@ -#include #include +#include #include #include diff --git a/libs/RVL_SDK/src/ax/AXAlloc.c b/libs/RVL_SDK/src/ax/AXAlloc.c index 6295ff6b..eaad5814 100644 --- a/libs/RVL_SDK/src/ax/AXAlloc.c +++ b/libs/RVL_SDK/src/ax/AXAlloc.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -21,7 +21,7 @@ void __AXServiceCallbackStack() { if (vpb->callback) { vpb->callback(vpb); } - + __AXRemoveFromStack(vpb); __AXPushFreeStack(vpb); } @@ -110,8 +110,7 @@ void __AXPushStackHead(AXVPB* vpb, u32 priority) { if (vpb->next) { __AXStackHead[priority]->prev = vpb; __AXStackHead[priority] = vpb; - } - else { + } else { __AXStackTail[priority] = vpb; __AXStackHead[priority] = vpb; } @@ -127,8 +126,7 @@ AXVPB* __AXPopStackFromBottom(u32 priority) { if (__AXStackHead[priority] == __AXStackTail[priority]) { vpb = __AXStackHead[priority]; __AXStackHead[priority] = __AXStackTail[priority] = 0; - } - else if (__AXStackTail[priority]) { + } else if (__AXStackTail[priority]) { vpb = __AXStackTail[priority]; __AXStackTail[priority] = vpb->prev; __AXStackTail[priority]->next = 0; diff --git a/libs/RVL_SDK/src/ax/AXAux.c b/libs/RVL_SDK/src/ax/AXAux.c index 8f17b91f..5eef932d 100644 --- a/libs/RVL_SDK/src/ax/AXAux.c +++ b/libs/RVL_SDK/src/ax/AXAux.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -102,8 +102,7 @@ void __AXAuxInit() { void __AXGetAuxAInput(void** out) { if (__AXCallbackAuxA) { *out = __AXBufferAuxA[__AXAuxDspWritePosition]; - } - else { + } else { *out = NULL; } } @@ -131,8 +130,7 @@ void __AXGetAuxAOutputDpl2Rs(void** out) { void __AXGetAuxBInput(void** out) { if (__AXCallbackAuxB) { *out = __AXBufferAuxB[__AXAuxDspWritePosition]; - } - else { + } else { *out = NULL; } } @@ -160,8 +158,7 @@ void __AXGetAuxBOutputDpl2Rs(void** out) { void __AXGetAuxCInput(void** out) { if (__AXCallbackAuxC) { *out = __AXBufferAuxC[__AXAuxDspWritePosition]; - } - else { + } else { *out = NULL; } } @@ -183,16 +180,15 @@ void __AXProcessAux() { if (__AXCallbackAuxA) { if (__AXClMode == AX_OUTPUT_DPL2) { void* chans[AX_DPL2_MAX]; - chans[AX_DPL2_L] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_L_BEGIN]; - chans[AX_DPL2_R] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_R_BEGIN]; + chans[AX_DPL2_L] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_L_BEGIN]; + chans[AX_DPL2_R] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_R_BEGIN]; chans[AX_DPL2_LS] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_LS_BEGIN]; chans[AX_DPL2_RS] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_RS_BEGIN]; DCInvalidateRange(chans[0], DPL2_FRAME_SIZE); __AXCallbackAuxA(chans, __AXContextAuxA); DCFlushRangeNoSync(chans[0], DPL2_FRAME_SIZE); - } - else { + } else { void* chans[AX_STEREO_MAX]; chans[AX_STEREO_L] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][STEREO_SAMPLE_L_BEGIN]; chans[AX_STEREO_R] = &__AXBufferAuxA[__AXAuxCpuReadWritePosition][STEREO_SAMPLE_R_BEGIN]; @@ -202,8 +198,7 @@ void __AXProcessAux() { __AXCallbackAuxA(chans, __AXContextAuxA); DCFlushRangeNoSync(chans[0], STEREO_FRAME_SIZE); } - } - else if (__clearAuxA[__AXAuxCpuReadWritePosition]) { + } else if (__clearAuxA[__AXAuxCpuReadWritePosition]) { void* chan = __AXBufferAuxA[__AXAuxCpuReadWritePosition]; memset(chan, 0, DPL2_FRAME_SIZE); DCFlushRange(chan, DPL2_FRAME_SIZE); @@ -213,16 +208,15 @@ void __AXProcessAux() { if (__AXCallbackAuxB) { if (__AXClMode == AX_OUTPUT_DPL2) { void* chans[AX_DPL2_MAX]; - chans[AX_DPL2_L] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_L_BEGIN]; - chans[AX_DPL2_R] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_R_BEGIN]; + chans[AX_DPL2_L] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_L_BEGIN]; + chans[AX_DPL2_R] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_R_BEGIN]; chans[AX_DPL2_LS] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_LS_BEGIN]; chans[AX_DPL2_RS] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][DPL2_SAMPLE_RS_BEGIN]; DCInvalidateRange(chans[0], DPL2_FRAME_SIZE); __AXCallbackAuxB(chans, __AXContextAuxB); DCFlushRangeNoSync(chans[0], DPL2_FRAME_SIZE); - } - else { + } else { void* chans[AX_STEREO_MAX]; chans[AX_STEREO_L] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][STEREO_SAMPLE_L_BEGIN]; chans[AX_STEREO_R] = &__AXBufferAuxB[__AXAuxCpuReadWritePosition][STEREO_SAMPLE_R_BEGIN]; @@ -232,8 +226,7 @@ void __AXProcessAux() { __AXCallbackAuxB(chans, __AXContextAuxB); DCFlushRangeNoSync(chans[0], STEREO_FRAME_SIZE); } - } - else if (__clearAuxB[__AXAuxCpuReadWritePosition]) { + } else if (__clearAuxB[__AXAuxCpuReadWritePosition]) { void* chan = __AXBufferAuxB[__AXAuxCpuReadWritePosition]; memset(chan, 0, DPL2_FRAME_SIZE); @@ -250,8 +243,7 @@ void __AXProcessAux() { DCInvalidateRange(chans[0], STEREO_FRAME_SIZE); __AXCallbackAuxC(chans, __AXContextAuxC); DCFlushRangeNoSync(chans[0], STEREO_FRAME_SIZE); - } - else if (!__AXCallbackAuxC && __clearAuxC[__AXAuxCpuReadWritePosition]) { + } else if (!__AXCallbackAuxC && __clearAuxC[__AXAuxCpuReadWritePosition]) { void* chan = __AXBufferAuxC[__AXAuxCpuReadWritePosition]; memset(chan, 0, STEREO_FRAME_SIZE); diff --git a/libs/RVL_SDK/src/ax/AXCL.c b/libs/RVL_SDK/src/ax/AXCL.c index 333a095a..b0073210 100644 --- a/libs/RVL_SDK/src/ax/AXCL.c +++ b/libs/RVL_SDK/src/ax/AXCL.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -11,12 +11,11 @@ // Space is allocated for two commands lists #define LIST_MAX 2 -#define LIST_WRITE_16(x) \ - __AXWriteToCommandList((x)) \ +#define LIST_WRITE_16(x) __AXWriteToCommandList((x)) -#define LIST_WRITE_32(x) \ - __AXWriteToCommandList((x) >> 16); \ - __AXWriteToCommandList((x)) \ +#define LIST_WRITE_32(x) \ + __AXWriteToCommandList((x) >> 16); \ + __AXWriteToCommandList((x)) /** * Command list opcodes (from Dolphin Emulator) @@ -158,8 +157,7 @@ void __AXNextFrame(void* surround, void* lr, void* rmt) { __AXCommandListCycles += 3036; } - } - else { + } else { __AXGetAuxAInput(&imm); if (imm != NULL) { LIST_WRITE_16(COMMAND_MIX_AUXA); @@ -218,8 +216,7 @@ void __AXNextFrame(void* surround, void* lr, void* rmt) { LIST_WRITE_32((u32)surround); LIST_WRITE_32((u32)lr); __AXCommandListCycles += 1195; - } - else { + } else { LIST_WRITE_16(COMMAND_OUTPUT); LIST_WRITE_16(__AXMasterVolume); LIST_WRITE_32((u32)surround); diff --git a/libs/RVL_SDK/src/ax/AXComp.c b/libs/RVL_SDK/src/ax/AXComp.c index fb19c310..e65f2905 100644 --- a/libs/RVL_SDK/src/ax/AXComp.c +++ b/libs/RVL_SDK/src/ax/AXComp.c @@ -1,188 +1,104 @@ #include u16 __AXCompressorTable[] ALIGN32 = { - 32611, 32455, 32299, 32145, 31991, 31838, 31685, 31534, 31383, 31233, 31083, - 30934, 30786, 30639, 30492, 30347, 30201, 30057, 29913, 29770, 29627, 29486, - 29344, 29204, 29064, 28925, 28787, 28649, 28512, 28375, 28240, 28104, 27970, - 27836, 27703, 27570, 27438, 27307, 27176, 27046, 26917, 26788, 26660, 26532, - 26405, 26279, 26153, 26028, 25903, 25780, 25656, 25533, 25411, 25290, 25169, - 25048, 24928, 24809, 24690, 24572, 24454, 24337, 24221, 24105, 23990, 23875, - 23761, 23647, 23534, 23421, 23309, 23197, 23086, 22976, 22866, 22757, 22648, - 22539, 22431, 22324, 22217, 22111, 22005, 21900, 21795, 21691, 21587, 21484, - 21381, 21278, 21177, 21075, 20974, 20874, 20774, 20675, 31158, 31024, 30890, - 30757, 30624, 30492, 30361, 30230, 30100, 29970, 29841, 29713, 29585, 29457, - 29330, 29204, 29078, 28953, 28828, 28704, 28580, 28457, 28335, 28213, 28091, - 27970, 27849, 27730, 27610, 27491, 27373, 27255, 27137, 27020, 26904, 26788, - 26673, 26558, 26443, 26329, 26216, 26103, 25991, 25879, 25767, 25656, 25546, - 25436, 25326, 25217, 25108, 25000, 24892, 24785, 24678, 24572, 24466, 24361, - 24256, 24151, 24047, 23944, 23841, 23738, 23636, 23534, 23432, 23331, 23231, - 23131, 23031, 22932, 22833, 22735, 22637, 22539, 22442, 22346, 22249, 22153, - 22058, 21963, 21868, 21774, 21680, 21587, 21494, 21401, 21309, 21217, 21126, - 21035, 20944, 20854, 20764, 20675, 29770, 29656, 29542, 29429, 29316, 29204, - 29092, 28981, 28870, 28759, 28649, 28539, 28430, 28321, 28213, 28104, 27997, - 27890, 27783, 27676, 27570, 27465, 27360, 27255, 27150, 27046, 26943, 26840, - 26737, 26634, 26532, 26431, 26329, 26229, 26128, 26028, 25928, 25829, 25730, - 25632, 25533, 25436, 25338, 25241, 25144, 25048, 24952, 24857, 24761, 24667, - 24572, 24478, 24384, 24291, 24198, 24105, 24013, 23921, 23829, 23738, 23647, - 23556, 23466, 23376, 23287, 23197, 23109, 23020, 22932, 22844, 22757, 22669, - 22583, 22496, 22410, 22324, 22239, 22153, 22069, 21984, 21900, 21816, 21732, - 21649, 21566, 21484, 21401, 21319, 21238, 21156, 21075, 20995, 20914, 20834, - 20754, 20675, 28444, 28348, 28253, 28158, 28064, 27970, 27876, 27783, 27690, - 27597, 27504, 27412, 27320, 27229, 27137, 27046, 26956, 26865, 26775, 26685, - 26596, 26507, 26418, 26329, 26241, 26153, 26066, 25978, 25891, 25804, 25718, - 25632, 25546, 25460, 25375, 25290, 25205, 25120, 25036, 24952, 24868, 24785, - 24702, 24619, 24537, 24454, 24372, 24291, 24209, 24128, 24047, 23967, 23886, - 23806, 23726, 23647, 23568, 23489, 23410, 23331, 23253, 23175, 23098, 23020, - 22943, 22866, 22789, 22713, 22637, 22561, 22485, 22410, 22335, 22260, 22185, - 22111, 22037, 21963, 21889, 21816, 21743, 21670, 21597, 21525, 21453, 21381, - 21309, 21238, 21166, 21095, 21025, 20954, 20884, 20814, 20744, 20675, 27176, - 27098, 27020, 26943, 26865, 26788, 26711, 26634, 26558, 26481, 26405, 26329, - 26254, 26178, 26103, 26028, 25953, 25879, 25804, 25730, 25656, 25582, 25509, - 25436, 25362, 25290, 25217, 25144, 25072, 25000, 24928, 24857, 24785, 24714, - 24643, 24572, 24501, 24431, 24361, 24291, 24221, 24151, 24082, 24013, 23944, - 23875, 23806, 23738, 23670, 23602, 23534, 23466, 23399, 23331, 23264, 23197, - 23131, 23064, 22998, 22932, 22866, 22800, 22735, 22669, 22604, 22539, 22475, - 22410, 22346, 22281, 22217, 22153, 22090, 22026, 21963, 21900, 21837, 21774, - 21712, 21649, 21587, 21525, 21463, 21401, 21340, 21278, 21217, 21156, 21095, - 21035, 20974, 20914, 20854, 20794, 20734, 20675, 25966, 25903, 25841, 25780, - 25718, 25656, 25595, 25533, 25472, 25411, 25350, 25290, 25229, 25169, 25108, - 25048, 24988, 24928, 24868, 24809, 24749, 24690, 24631, 24572, 24513, 24454, - 24396, 24337, 24279, 24221, 24163, 24105, 24047, 23990, 23932, 23875, 23818, - 23761, 23704, 23647, 23590, 23534, 23477, 23421, 23365, 23309, 23253, 23197, - 23142, 23086, 23031, 22976, 22921, 22866, 22811, 22757, 22702, 22648, 22593, - 22539, 22485, 22431, 22378, 22324, 22271, 22217, 22164, 22111, 22058, 22005, - 21952, 21900, 21847, 21795, 21743, 21691, 21639, 21587, 21535, 21484, 21432, - 21381, 21330, 21278, 21227, 21177, 21126, 21075, 21025, 20974, 20924, 20874, - 20824, 20774, 20724, 20675, 24809, 24761, 24714, 24667, 24619, 24572, 24525, - 24478, 24431, 24384, 24337, 24291, 24244, 24198, 24151, 24105, 24059, 24013, - 23967, 23921, 23875, 23829, 23783, 23738, 23692, 23647, 23602, 23556, 23511, - 23466, 23421, 23376, 23331, 23287, 23242, 23197, 23153, 23109, 23064, 23020, - 22976, 22932, 22888, 22844, 22800, 22757, 22713, 22669, 22626, 22583, 22539, - 22496, 22453, 22410, 22367, 22324, 22281, 22239, 22196, 22153, 22111, 22069, - 22026, 21984, 21942, 21900, 21858, 21816, 21774, 21732, 21691, 21649, 21608, - 21566, 21525, 21484, 21442, 21401, 21360, 21319, 21278, 21238, 21197, 21156, - 21116, 21075, 21035, 20995, 20954, 20914, 20874, 20834, 20794, 20754, 20714, - 20675, 23704, 23670, 23636, 23602, 23568, 23534, 23500, 23466, 23432, 23399, - 23365, 23331, 23298, 23264, 23231, 23197, 23164, 23131, 23098, 23064, 23031, - 22998, 22965, 22932, 22899, 22866, 22833, 22800, 22768, 22735, 22702, 22669, - 22637, 22604, 22572, 22539, 22507, 22475, 22442, 22410, 22378, 22346, 22313, - 22281, 22249, 22217, 22185, 22153, 22122, 22090, 22058, 22026, 21995, 21963, - 21931, 21900, 21868, 21837, 21805, 21774, 21743, 21712, 21680, 21649, 21618, - 21587, 21556, 21525, 21494, 21463, 21432, 21401, 21371, 21340, 21309, 21278, - 21248, 21217, 21187, 21156, 21126, 21095, 21065, 21035, 21005, 20974, 20944, - 20914, 20884, 20854, 20824, 20794, 20764, 20734, 20704, 20675, 22648, 22626, - 22604, 22583, 22561, 22539, 22518, 22496, 22475, 22453, 22431, 22410, 22388, - 22367, 22346, 22324, 22303, 22281, 22260, 22239, 22217, 22196, 22175, 22153, - 22132, 22111, 22090, 22069, 22047, 22026, 22005, 21984, 21963, 21942, 21921, - 21900, 21879, 21858, 21837, 21816, 21795, 21774, 21753, 21732, 21712, 21691, - 21670, 21649, 21628, 21608, 21587, 21566, 21545, 21525, 21504, 21484, 21463, - 21442, 21422, 21401, 21381, 21360, 21340, 21319, 21299, 21278, 21258, 21238, - 21217, 21197, 21177, 21156, 21136, 21116, 21095, 21075, 21055, 21035, 21015, - 20995, 20974, 20954, 20934, 20914, 20894, 20874, 20854, 20834, 20814, 20794, - 20774, 20754, 20734, 20714, 20695, 20675, 21639, 21628, 21618, 21608, 21597, - 21587, 21577, 21566, 21556, 21545, 21535, 21525, 21515, 21504, 21494, 21484, - 21473, 21463, 21453, 21442, 21432, 21422, 21412, 21401, 21391, 21381, 21371, - 21360, 21350, 21340, 21330, 21319, 21309, 21299, 21289, 21278, 21268, 21258, - 21248, 21238, 21227, 21217, 21207, 21197, 21187, 21177, 21166, 21156, 21146, - 21136, 21126, 21116, 21106, 21095, 21085, 21075, 21065, 21055, 21045, 21035, - 21025, 21015, 21005, 20995, 20984, 20974, 20964, 20954, 20944, 20934, 20924, - 20914, 20904, 20894, 20884, 20874, 20864, 20854, 20844, 20834, 20824, 20814, - 20804, 20794, 20784, 20774, 20764, 20754, 20744, 20734, 20724, 20714, 20704, - 20695, 20685, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, - 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, - 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, - 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, - 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, - 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, - 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, - 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, - 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, - 31308, 31323, 31338, 31353, 31368, 31383, 31398, 31413, 31428, 31443, 31458, - 31473, 31488, 31504, 31519, 31534, 31549, 31564, 31579, 31594, 31609, 31625, - 31640, 31655, 31670, 31685, 31701, 31716, 31731, 31746, 31761, 31777, 31792, - 31807, 31822, 31838, 31853, 31868, 31884, 31899, 31914, 31930, 31945, 31960, - 31975, 31991, 32006, 32022, 32037, 32052, 32068, 32083, 32098, 32114, 32129, - 32145, 32160, 32176, 32191, 32206, 32222, 32237, 32253, 32268, 32284, 32299, - 32315, 32330, 32346, 32361, 32377, 32392, 32408, 32423, 32439, 32455, 32470, - 32486, 32501, 32517, 32532, 32548, 32564, 32579, 32595, 32611, 32626, 32642, - 32658, 32673, 32689, 32705, 32720, 32736, 32752, 32768, 29899, 29913, 29927, - 29942, 29956, 29970, 29985, 29999, 30014, 30028, 30042, 30057, 30071, 30086, - 30100, 30114, 30129, 30143, 30158, 30172, 30187, 30201, 30216, 30230, 30245, - 30259, 30274, 30288, 30303, 30317, 30332, 30346, 30361, 30376, 30390, 30405, - 30419, 30434, 30449, 30463, 30478, 30492, 30507, 30522, 30536, 30551, 30566, - 30580, 30595, 30610, 30624, 30639, 30654, 30668, 30683, 30698, 30713, 30727, - 30742, 30757, 30772, 30786, 30801, 30816, 30831, 30846, 30860, 30875, 30890, - 30905, 30920, 30934, 30949, 30964, 30979, 30994, 31009, 31024, 31038, 31053, - 31068, 31083, 31098, 31113, 31128, 31143, 31158, 31173, 31188, 31203, 31218, - 31233, 31248, 31263, 31278, 31293, 28553, 28567, 28580, 28594, 28608, 28621, - 28635, 28649, 28663, 28676, 28690, 28704, 28718, 28731, 28745, 28759, 28773, - 28787, 28800, 28814, 28828, 28842, 28856, 28870, 28884, 28897, 28911, 28925, - 28939, 28953, 28967, 28981, 28995, 29008, 29022, 29036, 29050, 29064, 29078, - 29092, 29106, 29120, 29134, 29148, 29162, 29176, 29190, 29204, 29218, 29232, - 29246, 29260, 29274, 29288, 29302, 29316, 29330, 29344, 29358, 29373, 29387, - 29401, 29415, 29429, 29443, 29457, 29471, 29485, 29500, 29514, 29528, 29542, - 29556, 29570, 29585, 29599, 29613, 29627, 29641, 29656, 29670, 29684, 29698, - 29713, 29727, 29741, 29755, 29770, 29784, 29798, 29813, 29827, 29841, 29856, - 29870, 29884, 27268, 27281, 27294, 27307, 27320, 27333, 27346, 27359, 27373, - 27386, 27399, 27412, 27425, 27438, 27451, 27465, 27478, 27491, 27504, 27517, - 27531, 27544, 27557, 27570, 27583, 27597, 27610, 27623, 27636, 27650, 27663, - 27676, 27690, 27703, 27716, 27729, 27743, 27756, 27769, 27783, 27796, 27809, - 27823, 27836, 27849, 27863, 27876, 27890, 27903, 27916, 27930, 27943, 27956, - 27970, 27983, 27997, 28010, 28024, 28037, 28051, 28064, 28077, 28091, 28104, - 28118, 28131, 28145, 28158, 28172, 28185, 28199, 28212, 28226, 28240, 28253, - 28267, 28280, 28294, 28307, 28321, 28335, 28348, 28362, 28375, 28389, 28403, - 28416, 28430, 28443, 28457, 28471, 28484, 28498, 28512, 28525, 28539, 26040, - 26053, 26065, 26078, 26090, 26103, 26116, 26128, 26141, 26153, 26166, 26178, - 26191, 26203, 26216, 26229, 26241, 26254, 26266, 26279, 26291, 26304, 26317, - 26329, 26342, 26355, 26367, 26380, 26393, 26405, 26418, 26431, 26443, 26456, - 26469, 26481, 26494, 26507, 26520, 26532, 26545, 26558, 26570, 26583, 26596, - 26609, 26621, 26634, 26647, 26660, 26673, 26685, 26698, 26711, 26724, 26737, - 26749, 26762, 26775, 26788, 26801, 26814, 26827, 26839, 26852, 26865, 26878, - 26891, 26904, 26917, 26930, 26943, 26956, 26969, 26981, 26994, 27007, 27020, - 27033, 27046, 27059, 27072, 27085, 27098, 27111, 27124, 27137, 27150, 27163, - 27176, 27189, 27202, 27215, 27229, 27242, 27255, 24868, 24880, 24892, 24904, - 24916, 24928, 24940, 24952, 24964, 24976, 24988, 25000, 25012, 25024, 25036, - 25048, 25060, 25072, 25084, 25096, 25108, 25120, 25132, 25144, 25156, 25168, - 25181, 25193, 25205, 25217, 25229, 25241, 25253, 25265, 25277, 25289, 25302, - 25314, 25326, 25338, 25350, 25362, 25375, 25387, 25399, 25411, 25423, 25435, - 25448, 25460, 25472, 25484, 25497, 25509, 25521, 25533, 25546, 25558, 25570, - 25582, 25595, 25607, 25619, 25631, 25644, 25656, 25668, 25681, 25693, 25705, - 25718, 25730, 25742, 25755, 25767, 25779, 25792, 25804, 25817, 25829, 25841, - 25854, 25866, 25879, 25891, 25903, 25916, 25928, 25941, 25953, 25966, 25978, - 25991, 26003, 26015, 26028, 23749, 23761, 23772, 23783, 23795, 23806, 23818, - 23829, 23840, 23852, 23863, 23875, 23886, 23898, 23909, 23921, 23932, 23944, - 23955, 23967, 23978, 23990, 24001, 24013, 24024, 24036, 24047, 24059, 24070, - 24082, 24093, 24105, 24117, 24128, 24140, 24151, 24163, 24174, 24186, 24198, - 24209, 24221, 24233, 24244, 24256, 24267, 24279, 24291, 24302, 24314, 24326, - 24337, 24349, 24361, 24372, 24384, 24396, 24407, 24419, 24431, 24443, 24454, - 24466, 24478, 24490, 24501, 24513, 24525, 24537, 24548, 24560, 24572, 24584, - 24596, 24607, 24619, 24631, 24643, 24655, 24666, 24678, 24690, 24702, 24714, - 24726, 24738, 24749, 24761, 24773, 24785, 24797, 24809, 24821, 24833, 24845, - 24857, 22680, 22691, 22702, 22713, 22724, 22735, 22746, 22757, 22767, 22778, - 22789, 22800, 22811, 22822, 22833, 22844, 22855, 22866, 22877, 22888, 22899, - 22910, 22921, 22932, 22943, 22954, 22965, 22976, 22987, 22998, 23009, 23020, - 23031, 23042, 23053, 23064, 23075, 23086, 23097, 23109, 23120, 23131, 23142, - 23153, 23164, 23175, 23186, 23197, 23209, 23220, 23231, 23242, 23253, 23264, - 23275, 23287, 23298, 23309, 23320, 23331, 23343, 23354, 23365, 23376, 23387, - 23399, 23410, 23421, 23432, 23444, 23455, 23466, 23477, 23489, 23500, 23511, - 23522, 23534, 23545, 23556, 23568, 23579, 23590, 23602, 23613, 23624, 23636, - 23647, 23658, 23670, 23681, 23692, 23704, 23715, 23726, 23738, 21659, 21670, - 21680, 21691, 21701, 21711, 21722, 21732, 21743, 21753, 21764, 21774, 21785, - 21795, 21805, 21816, 21826, 21837, 21847, 21858, 21868, 21879, 21889, 21900, - 21910, 21921, 21931, 21942, 21952, 21963, 21973, 21984, 21995, 22005, 22016, - 22026, 22037, 22047, 22058, 22069, 22079, 22090, 22100, 22111, 22122, 22132, - 22143, 22153, 22164, 22175, 22185, 22196, 22207, 22217, 22228, 22239, 22249, - 22260, 22271, 22281, 22292, 22303, 22313, 22324, 22335, 22345, 22356, 22367, - 22378, 22388, 22399, 22410, 22421, 22431, 22442, 22453, 22464, 22474, 22485, - 22496, 22507, 22518, 22528, 22539, 22550, 22561, 22572, 22583, 22593, 22604, - 22615, 22626, 22637, 22648, 22659, 22669, 20685, 20695, 20704, 20714, 20724, - 20734, 20744, 20754, 20764, 20774, 20784, 20794, 20804, 20814, 20824, 20834, - 20844, 20854, 20864, 20874, 20884, 20894, 20904, 20914, 20924, 20934, 20944, - 20954, 20964, 20974, 20984, 20995, 21005, 21015, 21025, 21035, 21045, 21055, - 21065, 21075, 21085, 21095, 21106, 21116, 21126, 21136, 21146, 21156, 21166, - 21177, 21187, 21197, 21207, 21217, 21227, 21238, 21248, 21258, 21268, 21278, - 21289, 21299, 21309, 21319, 21330, 21340, 21350, 21360, 21370, 21381, 21391, - 21401, 21412, 21422, 21432, 21442, 21453, 21463, 21473, 21484, 21494, 21504, - 21515, 21525, 21535, 21545, 21556, 21566, 21577, 21587, 21597, 21608, 21618, - 21628, 21639, 21649 -}; + 32611, 32455, 32299, 32145, 31991, 31838, 31685, 31534, 31383, 31233, 31083, 30934, 30786, 30639, 30492, 30347, 30201, 30057, 29913, 29770, + 29627, 29486, 29344, 29204, 29064, 28925, 28787, 28649, 28512, 28375, 28240, 28104, 27970, 27836, 27703, 27570, 27438, 27307, 27176, 27046, + 26917, 26788, 26660, 26532, 26405, 26279, 26153, 26028, 25903, 25780, 25656, 25533, 25411, 25290, 25169, 25048, 24928, 24809, 24690, 24572, + 24454, 24337, 24221, 24105, 23990, 23875, 23761, 23647, 23534, 23421, 23309, 23197, 23086, 22976, 22866, 22757, 22648, 22539, 22431, 22324, + 22217, 22111, 22005, 21900, 21795, 21691, 21587, 21484, 21381, 21278, 21177, 21075, 20974, 20874, 20774, 20675, 31158, 31024, 30890, 30757, + 30624, 30492, 30361, 30230, 30100, 29970, 29841, 29713, 29585, 29457, 29330, 29204, 29078, 28953, 28828, 28704, 28580, 28457, 28335, 28213, + 28091, 27970, 27849, 27730, 27610, 27491, 27373, 27255, 27137, 27020, 26904, 26788, 26673, 26558, 26443, 26329, 26216, 26103, 25991, 25879, + 25767, 25656, 25546, 25436, 25326, 25217, 25108, 25000, 24892, 24785, 24678, 24572, 24466, 24361, 24256, 24151, 24047, 23944, 23841, 23738, + 23636, 23534, 23432, 23331, 23231, 23131, 23031, 22932, 22833, 22735, 22637, 22539, 22442, 22346, 22249, 22153, 22058, 21963, 21868, 21774, + 21680, 21587, 21494, 21401, 21309, 21217, 21126, 21035, 20944, 20854, 20764, 20675, 29770, 29656, 29542, 29429, 29316, 29204, 29092, 28981, + 28870, 28759, 28649, 28539, 28430, 28321, 28213, 28104, 27997, 27890, 27783, 27676, 27570, 27465, 27360, 27255, 27150, 27046, 26943, 26840, + 26737, 26634, 26532, 26431, 26329, 26229, 26128, 26028, 25928, 25829, 25730, 25632, 25533, 25436, 25338, 25241, 25144, 25048, 24952, 24857, + 24761, 24667, 24572, 24478, 24384, 24291, 24198, 24105, 24013, 23921, 23829, 23738, 23647, 23556, 23466, 23376, 23287, 23197, 23109, 23020, + 22932, 22844, 22757, 22669, 22583, 22496, 22410, 22324, 22239, 22153, 22069, 21984, 21900, 21816, 21732, 21649, 21566, 21484, 21401, 21319, + 21238, 21156, 21075, 20995, 20914, 20834, 20754, 20675, 28444, 28348, 28253, 28158, 28064, 27970, 27876, 27783, 27690, 27597, 27504, 27412, + 27320, 27229, 27137, 27046, 26956, 26865, 26775, 26685, 26596, 26507, 26418, 26329, 26241, 26153, 26066, 25978, 25891, 25804, 25718, 25632, + 25546, 25460, 25375, 25290, 25205, 25120, 25036, 24952, 24868, 24785, 24702, 24619, 24537, 24454, 24372, 24291, 24209, 24128, 24047, 23967, + 23886, 23806, 23726, 23647, 23568, 23489, 23410, 23331, 23253, 23175, 23098, 23020, 22943, 22866, 22789, 22713, 22637, 22561, 22485, 22410, + 22335, 22260, 22185, 22111, 22037, 21963, 21889, 21816, 21743, 21670, 21597, 21525, 21453, 21381, 21309, 21238, 21166, 21095, 21025, 20954, + 20884, 20814, 20744, 20675, 27176, 27098, 27020, 26943, 26865, 26788, 26711, 26634, 26558, 26481, 26405, 26329, 26254, 26178, 26103, 26028, + 25953, 25879, 25804, 25730, 25656, 25582, 25509, 25436, 25362, 25290, 25217, 25144, 25072, 25000, 24928, 24857, 24785, 24714, 24643, 24572, + 24501, 24431, 24361, 24291, 24221, 24151, 24082, 24013, 23944, 23875, 23806, 23738, 23670, 23602, 23534, 23466, 23399, 23331, 23264, 23197, + 23131, 23064, 22998, 22932, 22866, 22800, 22735, 22669, 22604, 22539, 22475, 22410, 22346, 22281, 22217, 22153, 22090, 22026, 21963, 21900, + 21837, 21774, 21712, 21649, 21587, 21525, 21463, 21401, 21340, 21278, 21217, 21156, 21095, 21035, 20974, 20914, 20854, 20794, 20734, 20675, + 25966, 25903, 25841, 25780, 25718, 25656, 25595, 25533, 25472, 25411, 25350, 25290, 25229, 25169, 25108, 25048, 24988, 24928, 24868, 24809, + 24749, 24690, 24631, 24572, 24513, 24454, 24396, 24337, 24279, 24221, 24163, 24105, 24047, 23990, 23932, 23875, 23818, 23761, 23704, 23647, + 23590, 23534, 23477, 23421, 23365, 23309, 23253, 23197, 23142, 23086, 23031, 22976, 22921, 22866, 22811, 22757, 22702, 22648, 22593, 22539, + 22485, 22431, 22378, 22324, 22271, 22217, 22164, 22111, 22058, 22005, 21952, 21900, 21847, 21795, 21743, 21691, 21639, 21587, 21535, 21484, + 21432, 21381, 21330, 21278, 21227, 21177, 21126, 21075, 21025, 20974, 20924, 20874, 20824, 20774, 20724, 20675, 24809, 24761, 24714, 24667, + 24619, 24572, 24525, 24478, 24431, 24384, 24337, 24291, 24244, 24198, 24151, 24105, 24059, 24013, 23967, 23921, 23875, 23829, 23783, 23738, + 23692, 23647, 23602, 23556, 23511, 23466, 23421, 23376, 23331, 23287, 23242, 23197, 23153, 23109, 23064, 23020, 22976, 22932, 22888, 22844, + 22800, 22757, 22713, 22669, 22626, 22583, 22539, 22496, 22453, 22410, 22367, 22324, 22281, 22239, 22196, 22153, 22111, 22069, 22026, 21984, + 21942, 21900, 21858, 21816, 21774, 21732, 21691, 21649, 21608, 21566, 21525, 21484, 21442, 21401, 21360, 21319, 21278, 21238, 21197, 21156, + 21116, 21075, 21035, 20995, 20954, 20914, 20874, 20834, 20794, 20754, 20714, 20675, 23704, 23670, 23636, 23602, 23568, 23534, 23500, 23466, + 23432, 23399, 23365, 23331, 23298, 23264, 23231, 23197, 23164, 23131, 23098, 23064, 23031, 22998, 22965, 22932, 22899, 22866, 22833, 22800, + 22768, 22735, 22702, 22669, 22637, 22604, 22572, 22539, 22507, 22475, 22442, 22410, 22378, 22346, 22313, 22281, 22249, 22217, 22185, 22153, + 22122, 22090, 22058, 22026, 21995, 21963, 21931, 21900, 21868, 21837, 21805, 21774, 21743, 21712, 21680, 21649, 21618, 21587, 21556, 21525, + 21494, 21463, 21432, 21401, 21371, 21340, 21309, 21278, 21248, 21217, 21187, 21156, 21126, 21095, 21065, 21035, 21005, 20974, 20944, 20914, + 20884, 20854, 20824, 20794, 20764, 20734, 20704, 20675, 22648, 22626, 22604, 22583, 22561, 22539, 22518, 22496, 22475, 22453, 22431, 22410, + 22388, 22367, 22346, 22324, 22303, 22281, 22260, 22239, 22217, 22196, 22175, 22153, 22132, 22111, 22090, 22069, 22047, 22026, 22005, 21984, + 21963, 21942, 21921, 21900, 21879, 21858, 21837, 21816, 21795, 21774, 21753, 21732, 21712, 21691, 21670, 21649, 21628, 21608, 21587, 21566, + 21545, 21525, 21504, 21484, 21463, 21442, 21422, 21401, 21381, 21360, 21340, 21319, 21299, 21278, 21258, 21238, 21217, 21197, 21177, 21156, + 21136, 21116, 21095, 21075, 21055, 21035, 21015, 20995, 20974, 20954, 20934, 20914, 20894, 20874, 20854, 20834, 20814, 20794, 20774, 20754, + 20734, 20714, 20695, 20675, 21639, 21628, 21618, 21608, 21597, 21587, 21577, 21566, 21556, 21545, 21535, 21525, 21515, 21504, 21494, 21484, + 21473, 21463, 21453, 21442, 21432, 21422, 21412, 21401, 21391, 21381, 21371, 21360, 21350, 21340, 21330, 21319, 21309, 21299, 21289, 21278, + 21268, 21258, 21248, 21238, 21227, 21217, 21207, 21197, 21187, 21177, 21166, 21156, 21146, 21136, 21126, 21116, 21106, 21095, 21085, 21075, + 21065, 21055, 21045, 21035, 21025, 21015, 21005, 20995, 20984, 20974, 20964, 20954, 20944, 20934, 20924, 20914, 20904, 20894, 20884, 20874, + 20864, 20854, 20844, 20834, 20824, 20814, 20804, 20794, 20784, 20774, 20764, 20754, 20744, 20734, 20724, 20714, 20704, 20695, 20685, 20675, + 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, + 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, + 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, + 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, + 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 20675, 31308, 31323, 31338, 31353, + 31368, 31383, 31398, 31413, 31428, 31443, 31458, 31473, 31488, 31504, 31519, 31534, 31549, 31564, 31579, 31594, 31609, 31625, 31640, 31655, + 31670, 31685, 31701, 31716, 31731, 31746, 31761, 31777, 31792, 31807, 31822, 31838, 31853, 31868, 31884, 31899, 31914, 31930, 31945, 31960, + 31975, 31991, 32006, 32022, 32037, 32052, 32068, 32083, 32098, 32114, 32129, 32145, 32160, 32176, 32191, 32206, 32222, 32237, 32253, 32268, + 32284, 32299, 32315, 32330, 32346, 32361, 32377, 32392, 32408, 32423, 32439, 32455, 32470, 32486, 32501, 32517, 32532, 32548, 32564, 32579, + 32595, 32611, 32626, 32642, 32658, 32673, 32689, 32705, 32720, 32736, 32752, 32768, 29899, 29913, 29927, 29942, 29956, 29970, 29985, 29999, + 30014, 30028, 30042, 30057, 30071, 30086, 30100, 30114, 30129, 30143, 30158, 30172, 30187, 30201, 30216, 30230, 30245, 30259, 30274, 30288, + 30303, 30317, 30332, 30346, 30361, 30376, 30390, 30405, 30419, 30434, 30449, 30463, 30478, 30492, 30507, 30522, 30536, 30551, 30566, 30580, + 30595, 30610, 30624, 30639, 30654, 30668, 30683, 30698, 30713, 30727, 30742, 30757, 30772, 30786, 30801, 30816, 30831, 30846, 30860, 30875, + 30890, 30905, 30920, 30934, 30949, 30964, 30979, 30994, 31009, 31024, 31038, 31053, 31068, 31083, 31098, 31113, 31128, 31143, 31158, 31173, + 31188, 31203, 31218, 31233, 31248, 31263, 31278, 31293, 28553, 28567, 28580, 28594, 28608, 28621, 28635, 28649, 28663, 28676, 28690, 28704, + 28718, 28731, 28745, 28759, 28773, 28787, 28800, 28814, 28828, 28842, 28856, 28870, 28884, 28897, 28911, 28925, 28939, 28953, 28967, 28981, + 28995, 29008, 29022, 29036, 29050, 29064, 29078, 29092, 29106, 29120, 29134, 29148, 29162, 29176, 29190, 29204, 29218, 29232, 29246, 29260, + 29274, 29288, 29302, 29316, 29330, 29344, 29358, 29373, 29387, 29401, 29415, 29429, 29443, 29457, 29471, 29485, 29500, 29514, 29528, 29542, + 29556, 29570, 29585, 29599, 29613, 29627, 29641, 29656, 29670, 29684, 29698, 29713, 29727, 29741, 29755, 29770, 29784, 29798, 29813, 29827, + 29841, 29856, 29870, 29884, 27268, 27281, 27294, 27307, 27320, 27333, 27346, 27359, 27373, 27386, 27399, 27412, 27425, 27438, 27451, 27465, + 27478, 27491, 27504, 27517, 27531, 27544, 27557, 27570, 27583, 27597, 27610, 27623, 27636, 27650, 27663, 27676, 27690, 27703, 27716, 27729, + 27743, 27756, 27769, 27783, 27796, 27809, 27823, 27836, 27849, 27863, 27876, 27890, 27903, 27916, 27930, 27943, 27956, 27970, 27983, 27997, + 28010, 28024, 28037, 28051, 28064, 28077, 28091, 28104, 28118, 28131, 28145, 28158, 28172, 28185, 28199, 28212, 28226, 28240, 28253, 28267, + 28280, 28294, 28307, 28321, 28335, 28348, 28362, 28375, 28389, 28403, 28416, 28430, 28443, 28457, 28471, 28484, 28498, 28512, 28525, 28539, + 26040, 26053, 26065, 26078, 26090, 26103, 26116, 26128, 26141, 26153, 26166, 26178, 26191, 26203, 26216, 26229, 26241, 26254, 26266, 26279, + 26291, 26304, 26317, 26329, 26342, 26355, 26367, 26380, 26393, 26405, 26418, 26431, 26443, 26456, 26469, 26481, 26494, 26507, 26520, 26532, + 26545, 26558, 26570, 26583, 26596, 26609, 26621, 26634, 26647, 26660, 26673, 26685, 26698, 26711, 26724, 26737, 26749, 26762, 26775, 26788, + 26801, 26814, 26827, 26839, 26852, 26865, 26878, 26891, 26904, 26917, 26930, 26943, 26956, 26969, 26981, 26994, 27007, 27020, 27033, 27046, + 27059, 27072, 27085, 27098, 27111, 27124, 27137, 27150, 27163, 27176, 27189, 27202, 27215, 27229, 27242, 27255, 24868, 24880, 24892, 24904, + 24916, 24928, 24940, 24952, 24964, 24976, 24988, 25000, 25012, 25024, 25036, 25048, 25060, 25072, 25084, 25096, 25108, 25120, 25132, 25144, + 25156, 25168, 25181, 25193, 25205, 25217, 25229, 25241, 25253, 25265, 25277, 25289, 25302, 25314, 25326, 25338, 25350, 25362, 25375, 25387, + 25399, 25411, 25423, 25435, 25448, 25460, 25472, 25484, 25497, 25509, 25521, 25533, 25546, 25558, 25570, 25582, 25595, 25607, 25619, 25631, + 25644, 25656, 25668, 25681, 25693, 25705, 25718, 25730, 25742, 25755, 25767, 25779, 25792, 25804, 25817, 25829, 25841, 25854, 25866, 25879, + 25891, 25903, 25916, 25928, 25941, 25953, 25966, 25978, 25991, 26003, 26015, 26028, 23749, 23761, 23772, 23783, 23795, 23806, 23818, 23829, + 23840, 23852, 23863, 23875, 23886, 23898, 23909, 23921, 23932, 23944, 23955, 23967, 23978, 23990, 24001, 24013, 24024, 24036, 24047, 24059, + 24070, 24082, 24093, 24105, 24117, 24128, 24140, 24151, 24163, 24174, 24186, 24198, 24209, 24221, 24233, 24244, 24256, 24267, 24279, 24291, + 24302, 24314, 24326, 24337, 24349, 24361, 24372, 24384, 24396, 24407, 24419, 24431, 24443, 24454, 24466, 24478, 24490, 24501, 24513, 24525, + 24537, 24548, 24560, 24572, 24584, 24596, 24607, 24619, 24631, 24643, 24655, 24666, 24678, 24690, 24702, 24714, 24726, 24738, 24749, 24761, + 24773, 24785, 24797, 24809, 24821, 24833, 24845, 24857, 22680, 22691, 22702, 22713, 22724, 22735, 22746, 22757, 22767, 22778, 22789, 22800, + 22811, 22822, 22833, 22844, 22855, 22866, 22877, 22888, 22899, 22910, 22921, 22932, 22943, 22954, 22965, 22976, 22987, 22998, 23009, 23020, + 23031, 23042, 23053, 23064, 23075, 23086, 23097, 23109, 23120, 23131, 23142, 23153, 23164, 23175, 23186, 23197, 23209, 23220, 23231, 23242, + 23253, 23264, 23275, 23287, 23298, 23309, 23320, 23331, 23343, 23354, 23365, 23376, 23387, 23399, 23410, 23421, 23432, 23444, 23455, 23466, + 23477, 23489, 23500, 23511, 23522, 23534, 23545, 23556, 23568, 23579, 23590, 23602, 23613, 23624, 23636, 23647, 23658, 23670, 23681, 23692, + 23704, 23715, 23726, 23738, 21659, 21670, 21680, 21691, 21701, 21711, 21722, 21732, 21743, 21753, 21764, 21774, 21785, 21795, 21805, 21816, + 21826, 21837, 21847, 21858, 21868, 21879, 21889, 21900, 21910, 21921, 21931, 21942, 21952, 21963, 21973, 21984, 21995, 22005, 22016, 22026, + 22037, 22047, 22058, 22069, 22079, 22090, 22100, 22111, 22122, 22132, 22143, 22153, 22164, 22175, 22185, 22196, 22207, 22217, 22228, 22239, + 22249, 22260, 22271, 22281, 22292, 22303, 22313, 22324, 22335, 22345, 22356, 22367, 22378, 22388, 22399, 22410, 22421, 22431, 22442, 22453, + 22464, 22474, 22485, 22496, 22507, 22518, 22528, 22539, 22550, 22561, 22572, 22583, 22593, 22604, 22615, 22626, 22637, 22648, 22659, 22669, + 20685, 20695, 20704, 20714, 20724, 20734, 20744, 20754, 20764, 20774, 20784, 20794, 20804, 20814, 20824, 20834, 20844, 20854, 20864, 20874, + 20884, 20894, 20904, 20914, 20924, 20934, 20944, 20954, 20964, 20974, 20984, 20995, 21005, 21015, 21025, 21035, 21045, 21055, 21065, 21075, + 21085, 21095, 21106, 21116, 21126, 21136, 21146, 21156, 21166, 21177, 21187, 21197, 21207, 21217, 21227, 21238, 21248, 21258, 21268, 21278, + 21289, 21299, 21309, 21319, 21330, 21340, 21350, 21360, 21370, 21381, 21391, 21401, 21412, 21422, 21432, 21442, 21453, 21463, 21473, 21484, + 21494, 21504, 21515, 21525, 21535, 21545, 21556, 21566, 21577, 21587, 21597, 21608, 21618, 21628, 21639, 21649}; diff --git a/libs/RVL_SDK/src/ax/AXOut.c b/libs/RVL_SDK/src/ax/AXOut.c index aea56914..acfa40a2 100644 --- a/libs/RVL_SDK/src/ax/AXOut.c +++ b/libs/RVL_SDK/src/ax/AXOut.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -8,9 +8,11 @@ #include extern u16 axDspSlave[]; -extern u16 axDspInitVector;; +extern u16 axDspInitVector; +; extern u16 axDspResumeVector; -extern u16 axDspSlaveLength;; +extern u16 axDspSlaveLength; +; // Output uses a ring buffer #define OUT_RING_MAX 3 @@ -48,10 +50,12 @@ static u32 __AXOutBuffer[OUT_RING_MAX][AX_SAMPLES_PER_FRAME] ALIGN32; static DSPTaskInfo __AXDSPTask ALIGN32; static u8 __AXDramImage[64] ALIGN32; -#define DSP_SEND_MAIL_TO_DSP(mail) { \ - DSPSendMailToDSP((u32)mail); \ - while (DSPCheckMailToDSP()) {} \ -} +#define DSP_SEND_MAIL_TO_DSP(mail) \ + { \ + DSPSendMailToDSP((u32)mail); \ + while (DSPCheckMailToDSP()) { \ + } \ + } u32 __AXOutNewFrame() { AXPROFILE* current; @@ -62,14 +66,11 @@ u32 __AXOutNewFrame() { __AXLocalProfile.timeBegin = OSGetTime(); - cycles = - (AX_SAMPLES_PER_FRAME - (AIGetDMABytesLeft() / AX_SAMPLE_DEPTH_BYTES)) * - 3797; + cycles = (AX_SAMPLES_PER_FRAME - (AIGetDMABytesLeft() / AX_SAMPLE_DEPTH_BYTES)) * 3797; if (__AXOutputBufferMode == 1) { __AXSyncPBs(0); - } - else { + } else { __AXSyncPBs(24400); } @@ -101,8 +102,7 @@ u32 __AXOutNewFrame() { ptr = 0; } - if (__AXRmtCpuPtr >= __AXRmtDspPtr && - __AXRmtCpuPtr < __AXRmtDspPtr + AX_SAMPLES_PER_FRAME_RMT) { + if (__AXRmtCpuPtr >= __AXRmtDspPtr && __AXRmtCpuPtr < __AXRmtDspPtr + AX_SAMPLES_PER_FRAME_RMT) { __AXRmtCpuPtr = ptr; } @@ -112,8 +112,7 @@ u32 __AXOutNewFrame() { if (__AXOutputBufferMode == 1) { __AXOutFrame %= OUT_RING_MAX; - } - else { + } else { __AXOutFrame &= 1; AIInitDMA((u32)__AXOutBuffer[__AXOutFrame], AX_FRAME_SIZE); } @@ -148,8 +147,7 @@ void __AXOutAiCallback() { if (__AXOutDspReady == 1) { __AXOutDspReady = 0; __AXOutNewFrame(); - } - else { + } else { __AXOutDspReady = 2; DSPAssertTask(&__AXDSPTask); } @@ -182,8 +180,7 @@ static void __AXDSPResumeCallback(DSPTaskInfo* task) { __AXExceedCallback(cycles); } - } - else { + } else { __AXOutDspReady = 1; } } @@ -193,7 +190,8 @@ static void __AXDSPDoneCallback(DSPTaskInfo* task) { OSWakeupThread(&__AXOutThreadQueue); } -static void __AXDSPRequestCallback(DSPTaskInfo* task) {} +static void __AXDSPRequestCallback(DSPTaskInfo* task) { +} void __AXOutInitDSP() { __AXDSPTask.iram_mmem_addr = axDspSlave; @@ -224,7 +222,8 @@ void __AXOutInitDSP() { } DSPAddTask(&__AXDSPTask); - while (!__AXDSPInitFlag) {} + while (!__AXDSPInitFlag) { + } } void __AXOutInit(u32 mode) { @@ -238,20 +237,17 @@ void __AXOutInit(u32 mode) { __AXOutputBufferMode = mode; __AXDebugSteppingMode = 0; - for (dst = (u32*)__AXOutBuffer, i = 0; - i < sizeof(__AXOutBuffer) / sizeof(u32); i++) { + for (dst = (u32*)__AXOutBuffer, i = 0; i < sizeof(__AXOutBuffer) / sizeof(u32); i++) { *dst++ = 0; } DCFlushRange(__AXOutBuffer, sizeof(__AXOutBuffer)); - for (dst2 = (u32*)__AXOutSBuffer, i = 0; - i < sizeof(__AXOutSBuffer) / sizeof(u32); i++) { + for (dst2 = (u32*)__AXOutSBuffer, i = 0; i < sizeof(__AXOutSBuffer) / sizeof(u32); i++) { *dst2++ = 0; } DCFlushRange(__AXOutSBuffer, sizeof(__AXOutSBuffer)); - for (dst2 = (u32*)__AXRmtOutBuffer, i = 0; - i < sizeof(__AXRmtOutBuffer) / sizeof(u32); i++) { + for (dst2 = (u32*)__AXRmtOutBuffer, i = 0; i < sizeof(__AXRmtOutBuffer) / sizeof(u32); i++) { *dst2++ = 0; } DCFlushRange(__AXRmtOutBuffer, sizeof(__AXRmtOutBuffer)); @@ -270,8 +266,7 @@ void __AXOutInit(u32 mode) { if (__AXOutputBufferMode == 1) { __AXNextFrame(__AXOutSBuffer, __AXOutBuffer[2], rmt); - } - else { + } else { __AXNextFrame(__AXOutSBuffer, __AXOutBuffer[1], rmt); } @@ -281,8 +276,7 @@ void __AXOutInit(u32 mode) { if (__AXOutputBufferMode == 1) { AIInitDMA((u32)__AXOutBuffer[__AXAiDmaFrame], AX_FRAME_SIZE); __AXAiDmaFrame++; - } - else { + } else { AIInitDMA((u32)__AXOutBuffer[__AXOutFrame], AX_FRAME_SIZE); } diff --git a/libs/RVL_SDK/src/ax/AXProf.c b/libs/RVL_SDK/src/ax/AXProf.c index 7ae6b586..0853480e 100644 --- a/libs/RVL_SDK/src/ax/AXProf.c +++ b/libs/RVL_SDK/src/ax/AXProf.c @@ -1,18 +1,18 @@ #include -static AXPROFILE* __AXProfile; +static AXPROFILE* __AXProfile; -static u32 __AXMaxProfiles; -static u32 __AXCurrentProfile; +static u32 __AXMaxProfiles; +static u32 __AXCurrentProfile; -static BOOL __AXProfileInitialized; +static BOOL __AXProfileInitialized; AXPROFILE* __AXGetCurrentProfile() { if (__AXProfileInitialized) { AXPROFILE* profile = &__AXProfile[__AXCurrentProfile]; __AXCurrentProfile++; - __AXCurrentProfile %= __AXMaxProfiles; // Prevent overflow + __AXCurrentProfile %= __AXMaxProfiles; // Prevent overflow return profile; } diff --git a/libs/RVL_SDK/src/ax/AXSPB.c b/libs/RVL_SDK/src/ax/AXSPB.c index 44e18a14..4cda8057 100644 --- a/libs/RVL_SDK/src/ax/AXSPB.c +++ b/libs/RVL_SDK/src/ax/AXSPB.c @@ -1,19 +1,19 @@ -#include #include +#include #include #define DEPOP_MIN (-20) -#define DEPOP_MAX (20) +#define DEPOP_MAX (20) -static AXSPB __AXStudio ALIGN32; +static AXSPB __AXStudio ALIGN32; -static s32 __AXSpbAL, __AXSpbAR, __AXSpbAS; -static s32 __AXSpbAAL, __AXSpbAAR, __AXSpbAAS; -static s32 __AXSpbABL, __AXSpbABR, __AXSpbABS; -static s32 __AXSpbACL, __AXSpbACR, __AXSpbACS; -static s32 __AXSpbMain0, __AXSpbMain1, __AXSpbMain2, __AXSpbMain3; -static s32 __AXSpbAux0, __AXSpbAux1, __AXSpbAux2, __AXSpbAux3; +static s32 __AXSpbAL, __AXSpbAR, __AXSpbAS; +static s32 __AXSpbAAL, __AXSpbAAR, __AXSpbAAS; +static s32 __AXSpbABL, __AXSpbABR, __AXSpbABS; +static s32 __AXSpbACL, __AXSpbACR, __AXSpbACS; +static s32 __AXSpbMain0, __AXSpbMain1, __AXSpbMain2, __AXSpbMain3; +static s32 __AXSpbAux0, __AXSpbAux1, __AXSpbAux2, __AXSpbAux3; AXSPB* __AXGetStudio() { return &__AXStudio; @@ -35,8 +35,7 @@ void __AXDepopFadeMain(s32* all, s32* value, s16* depop) { *value = *all; *all -= avg * AX_SAMPLES_PER_FRAME; *depop = -avg; - } - else { + } else { *all = 0; *value = 0; *depop = 0; @@ -59,8 +58,7 @@ void __AXDepopFadeRmt(s32* all, s32* value, s16* depop) { *value = *all; *all -= avg * AX_SAMPLES_PER_FRAME_RMT; *depop = -avg; - } - else { + } else { *all = 0; *value = 0; *depop = 0; @@ -68,9 +66,9 @@ void __AXDepopFadeRmt(s32* all, s32* value, s16* depop) { } void __AXPrintStudio() { - __AXDepopFadeMain(&__AXSpbAL, (void*)&__AXStudio.dpopLHi, &__AXStudio.dpopLDelta); - __AXDepopFadeMain(&__AXSpbAR, (void*)&__AXStudio.dpopRHi, &__AXStudio.dpopRDelta); - __AXDepopFadeMain(&__AXSpbAS, (void*)&__AXStudio.dpopSHi, &__AXStudio.dpopSDelta); + __AXDepopFadeMain(&__AXSpbAL, (void*)&__AXStudio.dpopLHi, &__AXStudio.dpopLDelta); + __AXDepopFadeMain(&__AXSpbAR, (void*)&__AXStudio.dpopRHi, &__AXStudio.dpopRDelta); + __AXDepopFadeMain(&__AXSpbAS, (void*)&__AXStudio.dpopSHi, &__AXStudio.dpopSDelta); __AXDepopFadeMain(&__AXSpbAAL, (void*)&__AXStudio.dpopALHi, &__AXStudio.dpopALDelta); __AXDepopFadeMain(&__AXSpbAAR, (void*)&__AXStudio.dpopARHi, &__AXStudio.dpopARDelta); @@ -83,7 +81,7 @@ void __AXPrintStudio() { __AXDepopFadeMain(&__AXSpbACL, (void*)&__AXStudio.dpopCLHi, &__AXStudio.dpopCLDelta); __AXDepopFadeMain(&__AXSpbACR, (void*)&__AXStudio.dpopCRHi, &__AXStudio.dpopCRDelta); __AXDepopFadeMain(&__AXSpbACS, (void*)&__AXStudio.dpopCSHi, &__AXStudio.dpopCSDelta); - + __AXDepopFadeRmt(&__AXSpbMain0, (void*)&__AXStudio.dpopMain0Hi, &__AXStudio.dpopMain0Delta); __AXDepopFadeRmt(&__AXSpbMain1, (void*)&__AXStudio.dpopMain1Hi, &__AXStudio.dpopMain1Delta); __AXDepopFadeRmt(&__AXSpbMain2, (void*)&__AXStudio.dpopMain2Hi, &__AXStudio.dpopMain2Delta); @@ -98,13 +96,13 @@ void __AXPrintStudio() { } void __AXSPBInit() { - __AXSpbAux0 = __AXSpbAux1 = __AXSpbAux2 = __AXSpbAux3 = 0; + __AXSpbAux0 = __AXSpbAux1 = __AXSpbAux2 = __AXSpbAux3 = 0; __AXSpbMain0 = __AXSpbMain1 = __AXSpbMain2 = __AXSpbMain3 = 0; - - __AXSpbACL = __AXSpbACR = __AXSpbACS = 0; - __AXSpbABL = __AXSpbABR = __AXSpbABS = 0; - __AXSpbAAL = __AXSpbAAR = __AXSpbAAS = 0; - __AXSpbAL = __AXSpbAR = __AXSpbAS = 0; + + __AXSpbACL = __AXSpbACR = __AXSpbACS = 0; + __AXSpbABL = __AXSpbABR = __AXSpbABS = 0; + __AXSpbAAL = __AXSpbAAR = __AXSpbAAS = 0; + __AXSpbAL = __AXSpbAR = __AXSpbAS = 0; } void __AXDepopVoice(AXPB* pb) { diff --git a/libs/RVL_SDK/src/ax/AXVPB.c b/libs/RVL_SDK/src/ax/AXVPB.c index 727f2638..06fab960 100644 --- a/libs/RVL_SDK/src/ax/AXVPB.c +++ b/libs/RVL_SDK/src/ax/AXVPB.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -26,10 +26,8 @@ static s32 __AXNumVoices = 0; static u32 __AXRecDspCycles = 0; static u32 __AXMaxDspCycles = 0; -static u32 __AXMixCycles[] = {2, 408, 408, 810, 1404, 1404, 1404, 1404, - 408, 816, 816, 1218, 1812, 1812, 1812, 1812, - 707, 1115, 1115, 1517, 2111, 2111, 2111, 2111, - 707, 1115, 1115, 1517, 2111, 2111, 2111, 2111}; +static u32 __AXMixCycles[] = {2, 408, 408, 810, 1404, 1404, 1404, 1404, 408, 816, 816, 1218, 1812, 1812, 1812, 1812, + 707, 1115, 1115, 1517, 2111, 2111, 2111, 2111, 707, 1115, 1115, 1517, 2111, 2111, 2111, 2111}; static u32 __AXRmtMixCycles[] = {4, 86, 151, 151}; @@ -75,8 +73,7 @@ void __AXServiceVPB(AXVPB* vpb) { if (sync & AX_PBSYNC_STATE) { ppbDsp->state = ppbUser->state; - } - else { + } else { ppbUser->state = ppbDsp->state; } @@ -91,37 +88,64 @@ void __AXServiceVPB(AXVPB* vpb) { if (sync & AX_PBSYNC_ITD_SHIFT) { ppbDsp->itd.targetShiftL = ppbUser->itd.targetShiftL; ppbDsp->itd.targetShiftR = ppbUser->itd.targetShiftR; - } - else if (sync & AX_PBSYNC_ITD) { + } else if (sync & AX_PBSYNC_ITD) { u16* src; u16* dst; u32* dst_; src = (void*)&ppbUser->itd; dst = (void*)&ppbDsp->itd; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); src+=1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + src += 1; dst_ = vpb->itdBuffer; - *(dst_) = 0; dst_+=1; - *(dst_) = 0; dst_+=1; - *(dst_) = 0; dst_+=1; - *(dst_) = 0; dst_+=1; - *(dst_) = 0; dst_+=1; - *(dst_) = 0; dst_+=1; - *(dst_) = 0; dst_+=1; - *(dst_) = 0; dst_+=1; - *(dst_) = 0; dst_+=1; - *(dst_) = 0; dst_+=1; - *(dst_) = 0; dst_+=1; - *(dst_) = 0; dst_+=1; - *(dst_) = 0; dst_+=1; - *(dst_) = 0; dst_+=1; - *(dst_) = 0; dst_+=1; + *(dst_) = 0; + dst_ += 1; + *(dst_) = 0; + dst_ += 1; + *(dst_) = 0; + dst_ += 1; + *(dst_) = 0; + dst_ += 1; + *(dst_) = 0; + dst_ += 1; + *(dst_) = 0; + dst_ += 1; + *(dst_) = 0; + dst_ += 1; + *(dst_) = 0; + dst_ += 1; + *(dst_) = 0; + dst_ += 1; + *(dst_) = 0; + dst_ += 1; + *(dst_) = 0; + dst_ += 1; + *(dst_) = 0; + dst_ += 1; + *(dst_) = 0; + dst_ += 1; + *(dst_) = 0; + dst_ += 1; + *(dst_) = 0; + dst_ += 1; *(dst_) = 0; } @@ -132,14 +156,12 @@ void __AXServiceVPB(AXVPB* vpb) { if (sync & AX_PBSYNC_VE_DELTA) { ppbUser->ve.currentVolume = ppbDsp->ve.currentVolume; ppbDsp->ve.currentDelta = ppbUser->ve.currentDelta; - } - else if (sync & AX_PBSYNC_VE) { + } else if (sync & AX_PBSYNC_VE) { ppbDsp->ve.currentVolume = ppbUser->ve.currentVolume; ppbDsp->ve.currentDelta = ppbUser->ve.currentDelta; } - if (sync & (AX_PBSYNC_LOOP_FLAG | AX_PBSYNC_LOOP_ADDR | AX_PBSYNC_END_ADDR | - AX_PBSYNC_CURR_ADDR)) { + if (sync & (AX_PBSYNC_LOOP_FLAG | AX_PBSYNC_LOOP_ADDR | AX_PBSYNC_END_ADDR | AX_PBSYNC_CURR_ADDR)) { if (sync & AX_PBSYNC_LOOP_FLAG) { ppbDsp->addr.loopFlag = ppbUser->addr.loopFlag; } @@ -154,22 +176,25 @@ void __AXServiceVPB(AXVPB* vpb) { if (sync & AX_PBSYNC_CURR_ADDR) { *(u32*)&ppbDsp->addr.currentAddressHi = *(u32*)&ppbUser->addr.currentAddressHi; - } - else { + } else { *(u32*)&ppbUser->addr.currentAddressHi = *(u32*)&ppbDsp->addr.currentAddressHi; } - } - else if (sync & AX_PBSYNC_ADDR) { + } else if (sync & AX_PBSYNC_ADDR) { u32* src; u32* dst; dst = (void*)&ppbDsp->addr; src = (void*)&ppbUser->addr; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); - } - else { + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + } else { ppbUser->addr.currentAddressHi = ppbDsp->addr.currentAddressHi; ppbUser->addr.currentAddressLo = ppbDsp->addr.currentAddressLo; } @@ -179,34 +204,67 @@ void __AXServiceVPB(AXVPB* vpb) { u32* dst; dst = (void*)&ppbDsp->adpcm; src = (void*)&ppbUser->adpcm; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; } if (sync & AX_PBSYNC_SRC_RATIO) { ppbDsp->src.ratioHi = ppbUser->src.ratioHi; ppbDsp->src.ratioLo = ppbUser->src.ratioLo; - } - else if (sync & AX_PBSYNC_SRC) { + } else if (sync & AX_PBSYNC_SRC) { u16* src; u16* dst; dst = (void*)&ppbDsp->src; src = (void*)&ppbUser->src; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; } if (sync & AX_PBSYNC_ADPCM_LOOP) { @@ -214,24 +272,33 @@ void __AXServiceVPB(AXVPB* vpb) { u16* dst; dst = (void*)&ppbDsp->adpcmLoop; src = (void*)&ppbUser->adpcmLoop; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; *(dst) = *(src); } if (sync & AX_PBSYNC_LPF_COEFS) { ppbDsp->lpf.a0 = ppbUser->lpf.a0; ppbDsp->lpf.b0 = ppbUser->lpf.b0; - } - else if (sync & AX_PBSYNC_LPF) { + } else if (sync & AX_PBSYNC_LPF) { u16* src; u16* dst; dst = (void*)&ppbDsp->lpf; src = (void*)&ppbUser->lpf; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; *(dst) = *(src); } @@ -241,22 +308,39 @@ void __AXServiceVPB(AXVPB* vpb) { ppbDsp->biquad.b2 = ppbUser->biquad.b2; ppbDsp->biquad.a1 = ppbUser->biquad.a1; ppbDsp->biquad.a2 = ppbUser->biquad.a2; - } - else if (sync & AX_PBSYNC_BIQUAD) { + } else if (sync & AX_PBSYNC_BIQUAD) { u16* src; u16* dst; dst = (void*)&ppbDsp->biquad; src = (void*)&ppbUser->biquad; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; *(dst) = *(src); } @@ -283,29 +367,45 @@ void __AXServiceVPB(AXVPB* vpb) { if (sync & AX_PBSYNC_RMTIIR_LPF_COEFS) { ppbDsp->rmtIIR.lpf.a0 = ppbUser->rmtIIR.lpf.a0; ppbDsp->rmtIIR.lpf.b0 = ppbUser->rmtIIR.lpf.b0; - } - else if (sync & AX_PBSYNC_RMTIIR_BIQUAD_COEFS) { + } else if (sync & AX_PBSYNC_RMTIIR_BIQUAD_COEFS) { ppbDsp->rmtIIR.biquad.b0 = ppbUser->rmtIIR.biquad.b0; ppbDsp->rmtIIR.biquad.b1 = ppbUser->rmtIIR.biquad.b1; ppbDsp->rmtIIR.biquad.b2 = ppbUser->rmtIIR.biquad.b2; ppbDsp->rmtIIR.biquad.a1 = ppbUser->rmtIIR.biquad.a1; ppbDsp->rmtIIR.biquad.a2 = ppbUser->rmtIIR.biquad.a2; - } - else if (sync & AX_PBSYNC_RMTIIR) { + } else if (sync & AX_PBSYNC_RMTIIR) { u16* src; u16* dst; dst = (void*)&ppbDsp->rmtIIR; src = (void*)&ppbUser->rmtIIR; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; *(dst) = *(src); } } @@ -361,40 +461,30 @@ void __AXSyncPBs(u32 baseCycles) { } cycles += __AXGetSrcCycles(head->pb.srcSelect, &head->pb.src); - cycles += __AXMixCycles[head->pb.mixerCtrl >> 0 & 31] + - __AXMixCycles[head->pb.mixerCtrl >> 16 & 31] + - __AXMixCycles[head->pb.mixerCtrl >> 21 & 31] + - __AXMixCycles[head->pb.mixerCtrl >> 26 & 31]; + cycles += __AXMixCycles[head->pb.mixerCtrl >> 0 & 31] + __AXMixCycles[head->pb.mixerCtrl >> 16 & 31] + + __AXMixCycles[head->pb.mixerCtrl >> 21 & 31] + __AXMixCycles[head->pb.mixerCtrl >> 26 & 31]; if (head->pb.remote == TRUE) { cycles += 613; if (head->pb.rmtIIR.lpf.on == AX_PB_LPF_ON) { cycles += 118; - } - else if (head->pb.rmtIIR.biquad.on == AX_PB_BIQUAD_ON) { + } else if (head->pb.rmtIIR.biquad.on == AX_PB_BIQUAD_ON) { cycles += 834; } - cycles += - __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 0 & 3] + - __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 2 & 3] + - __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 4 & 3] + - __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 6 & 3] + - __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 8 & 3] + - __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 10 & 3] + - __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 12 & 3] + - __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 14 & 3]; + cycles += __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 0 & 3] + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 2 & 3] + + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 4 & 3] + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 6 & 3] + + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 8 & 3] + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 10 & 3] + + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 12 & 3] + __AXRmtMixCycles[head->pb.rmtMixerCtrl >> 14 & 3]; } if (__AXMaxDspCycles > cycles) { __AXServiceVPB(head); - } - else { + } else { __AXDumpVPB(head); } - } - else { + } else { __AXServiceVPB(head); } @@ -405,8 +495,7 @@ void __AXSyncPBs(u32 baseCycles) { __AXRecDspCycles = cycles; - for (head = __AXGetStackHead(AX_PRIORITY_FREE); head != NULL; - head = head->next) { + for (head = __AXGetStackHead(AX_PRIORITY_FREE); head != NULL; head = head->next) { if (head->depop) { __AXDepopVoice(&__AXPB[head->index]); } @@ -426,9 +515,7 @@ AXPB* __AXGetPBs() { void __AXSetPBDefault(AXVPB* vpb) { vpb->pb.state = AX_VOICE_STOP; vpb->pb.itd.flag = 0; - vpb->sync = AX_PBSYNC_STATE | AX_PBSYNC_ITD | AX_PBSYNC_LPF | - AX_PBSYNC_BIQUAD | AX_PBSYNC_REMOTE | AX_PBSYNC_RMTSRC | - AX_PBSYNC_RMTIIR; + vpb->sync = AX_PBSYNC_STATE | AX_PBSYNC_ITD | AX_PBSYNC_LPF | AX_PBSYNC_BIQUAD | AX_PBSYNC_REMOTE | AX_PBSYNC_RMTSRC | AX_PBSYNC_RMTIIR; vpb->pb.lpf.on = 0; vpb->pb.biquad.on = 0; vpb->pb.remote = 0; @@ -457,18 +544,15 @@ static void __AXVPBInitCommon() { __AXMaxDspCycles = OS_BUS_CLOCK / 667; __AXRecDspCycles = 0; - for (dst = (u32*)__AXPB, i = __AXMaxVoices * (sizeof(AXPB) / sizeof(u32)); - i > 0; i--) { + for (dst = (u32*)__AXPB, i = __AXMaxVoices * (sizeof(AXPB) / sizeof(u32)); i > 0; i--) { *dst++ = 0; } - for (dst = (u32*)__AXITD, i = __AXMaxVoices * (sizeof(AXPBITDBUFFER) / sizeof(u32)); - i > 0; i--) { + for (dst = (u32*)__AXITD, i = __AXMaxVoices * (sizeof(AXPBITDBUFFER) / sizeof(u32)); i > 0; i--) { *dst++ = 0; } - for (dst = (u32*)__AXVPB, i = __AXMaxVoices * (sizeof(AXVPB) / sizeof(u32)); - i > 0; i--) { + for (dst = (u32*)__AXVPB, i = __AXMaxVoices * (sizeof(AXVPB) / sizeof(u32)); i > 0; i--) { *dst++ = 0; } @@ -484,8 +568,7 @@ static void __AXVPBInitCommon() { if (i == __AXMaxVoices - 1) { pb->nextHi = pb->nextLo = 0; vpb->pb.nextHi = vpb->pb.nextLo = 0; - } - else { + } else { vpb->pb.nextHi = ADDRHI((u32)pb + 320); vpb->pb.nextLo = ADDRLO((u32)pb + 320); @@ -580,37 +663,61 @@ void AXSetVoiceMix(AXVPB* vpb, AXPBMIX* mix) { s32 mixerCtrl; u16* dst; u16* src; - + src = (u16*)mix; dst = (u16*)&vpb->pb.mix; mixerCtrl = 0; old = OSDisableInterrupts(); - if ((*dst++ = *src++)) mixerCtrl |= 0x1; - if ((*dst++ = *src++)) mixerCtrl |= 0x5; - if ((*dst++ = *src++)) mixerCtrl |= 0x2; - if ((*dst++ = *src++)) mixerCtrl |= 0x6; - if ((*dst++ = *src++)) mixerCtrl |= 0x10000; - if ((*dst++ = *src++)) mixerCtrl |= 0x50000; - if ((*dst++ = *src++)) mixerCtrl |= 0x20000; - if ((*dst++ = *src++)) mixerCtrl |= 0x60000; - if ((*dst++ = *src++)) mixerCtrl |= 0x200000; - if ((*dst++ = *src++)) mixerCtrl |= 0xA00000; - if ((*dst++ = *src++)) mixerCtrl |= 0x400000; - if ((*dst++ = *src++)) mixerCtrl |= 0xC00000; - if ((*dst++ = *src++)) mixerCtrl |= 0x4000000; - if ((*dst++ = *src++)) mixerCtrl |= 0x14000000; - if ((*dst++ = *src++)) mixerCtrl |= 0x8000000; - if ((*dst++ = *src++)) mixerCtrl |= 0x18000000; - if ((*dst++ = *src++)) mixerCtrl |= 0x8; - if ((*dst++ = *src++)) mixerCtrl |= 0x18; - if ((*dst++ = *src++)) mixerCtrl |= 0x80000; - if ((*dst++ = *src++)) mixerCtrl |= 0x180000; - if ((*dst++ = *src++)) mixerCtrl |= 0x1000000; - if ((*dst++ = *src++)) mixerCtrl |= 0x3000000; - if ((*dst++ = *src++)) mixerCtrl |= 0x20000000; - if ((*dst++ = *src++)) mixerCtrl |= 0x60000000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x1; + if ((*dst++ = *src++)) + mixerCtrl |= 0x5; + if ((*dst++ = *src++)) + mixerCtrl |= 0x2; + if ((*dst++ = *src++)) + mixerCtrl |= 0x6; + if ((*dst++ = *src++)) + mixerCtrl |= 0x10000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x50000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x20000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x60000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x200000; + if ((*dst++ = *src++)) + mixerCtrl |= 0xA00000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x400000; + if ((*dst++ = *src++)) + mixerCtrl |= 0xC00000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x4000000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x14000000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x8000000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x18000000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x8; + if ((*dst++ = *src++)) + mixerCtrl |= 0x18; + if ((*dst++ = *src++)) + mixerCtrl |= 0x80000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x180000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x1000000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x3000000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x20000000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x60000000; vpb->pb.mixerCtrl = mixerCtrl; vpb->sync |= (AX_PBSYNC_MIX | AX_PBSYNC_MIXER_CTRL); @@ -683,8 +790,7 @@ void AXSetVoiceAddr(AXVPB* vpb, AXPBADDR* addr) { } } - vpb->sync &= ~(AX_PBSYNC_LOOP_FLAG | AX_PBSYNC_LOOP_ADDR | - AX_PBSYNC_END_ADDR | AX_PBSYNC_CURR_ADDR); + vpb->sync &= ~(AX_PBSYNC_LOOP_FLAG | AX_PBSYNC_LOOP_ADDR | AX_PBSYNC_END_ADDR | AX_PBSYNC_CURR_ADDR); vpb->sync |= AX_PBSYNC_ADDR | AX_PBSYNC_ADPCM; OSRestoreInterrupts(enabled); @@ -715,16 +821,36 @@ void AXSetVoiceAdpcm(AXVPB* vpb, AXPBADPCM* adpcm) { old = OSDisableInterrupts(); { - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; } vpb->sync |= AX_PBSYNC_ADPCM; OSRestoreInterrupts(old); @@ -740,13 +866,27 @@ void AXSetVoiceSrc(AXVPB* vpb, AXPBSRC* src_) { old = OSDisableInterrupts(); { - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; } vpb->sync &= ~(AX_PBSYNC_SRC_RATIO); vpb->sync |= AX_PBSYNC_SRC; @@ -758,7 +898,7 @@ void AXSetVoiceSrcRatio(AXVPB* vpb, float ratio) { BOOL old; old = OSDisableInterrupts(); - r = 65536.0f* ratio; + r = 65536.0f * ratio; vpb->pb.src.ratioHi = ((u32)r >> 0x10); vpb->pb.src.ratioLo = ((u32)r); vpb->sync |= AX_PBSYNC_SRC_RATIO; @@ -774,9 +914,15 @@ void AXSetVoiceAdpcmLoop(AXVPB* vpb, AXPBADPCMLOOP* adpcmloop) { src = (void*)adpcmloop; old = OSDisableInterrupts(); { - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; - *(dst) = *(src); dst+=1; src+=1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; + *(dst) = *(src); + dst += 1; + src += 1; } vpb->sync |= AX_PBSYNC_ADPCM_LOOP; OSRestoreInterrupts(old); @@ -792,10 +938,18 @@ void AXSetVoiceLpf(AXVPB* vpb, AXPBLPF* lpf) { old = OSDisableInterrupts(); - *dst = *src; dst++; src++; - *dst = *src; dst++; src++; - *dst = *src; dst++; src++; - *dst = *src; dst++; src++; + *dst = *src; + dst++; + src++; + *dst = *src; + dst++; + src++; + *dst = *src; + dst++; + src++; + *dst = *src; + dst++; + src++; vpb->sync |= AX_PBSYNC_LPF; OSRestoreInterrupts(old); @@ -812,7 +966,7 @@ void AXSetVoiceLpfCoefs(AXVPB* vpb, u16 a0, u16 b0) { OSRestoreInterrupts(old); } -#define fM_PI 3.14159265358979323846f /* Must be as float */ +#define fM_PI 3.14159265358979323846f /* Must be as float */ void AXGetLpfCoefs(u16 freq, u16* a, u16* b) { f32 rf31 = 2.0f - (f32)cos(2 * fM_PI * freq / AX_SAMPLE_RATE); @@ -822,10 +976,10 @@ void AXGetLpfCoefs(u16 freq, u16* a, u16* b) { *a = 32767 - *b; } -void AXSetVoiceRmtOn(AXVPB *vpb, u16 on) { +void AXSetVoiceRmtOn(AXVPB* vpb, u16 on) { BOOL old = OSDisableInterrupts(); vpb->pb.remote = on; - vpb->sync |= AX_PBSYNC_REMOTE; + vpb->sync |= AX_PBSYNC_REMOTE; OSRestoreInterrupts(old); } @@ -834,29 +988,45 @@ void AXSetVoiceRmtMix(AXVPB* vpb, AXPBRMTMIX* mix) { u16 mixerCtrl; u16* dst; u16* src; - + src = (u16*)mix; dst = (u16*)&vpb->pb.rmtMix; mixerCtrl = 0; old = OSDisableInterrupts(); - if ((*dst++ = *src++)) mixerCtrl |= 0x1; - if ((*dst++ = *src++)) mixerCtrl |= 0x2; - if ((*dst++ = *src++)) mixerCtrl |= 0x4; - if ((*dst++ = *src++)) mixerCtrl |= 0x8; - if ((*dst++ = *src++)) mixerCtrl |= 0x10; - if ((*dst++ = *src++)) mixerCtrl |= 0x20; - if ((*dst++ = *src++)) mixerCtrl |= 0x40; - if ((*dst++ = *src++)) mixerCtrl |= 0x80; - if ((*dst++ = *src++)) mixerCtrl |= 0x100; - if ((*dst++ = *src++)) mixerCtrl |= 0x200; - if ((*dst++ = *src++)) mixerCtrl |= 0x400; - if ((*dst++ = *src++)) mixerCtrl |= 0x800; - if ((*dst++ = *src++)) mixerCtrl |= 0x1000; - if ((*dst++ = *src++)) mixerCtrl |= 0x2000; - if ((*dst++ = *src++)) mixerCtrl |= 0x4000; - if ((*dst++ = *src++)) mixerCtrl |= 0x8000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x1; + if ((*dst++ = *src++)) + mixerCtrl |= 0x2; + if ((*dst++ = *src++)) + mixerCtrl |= 0x4; + if ((*dst++ = *src++)) + mixerCtrl |= 0x8; + if ((*dst++ = *src++)) + mixerCtrl |= 0x10; + if ((*dst++ = *src++)) + mixerCtrl |= 0x20; + if ((*dst++ = *src++)) + mixerCtrl |= 0x40; + if ((*dst++ = *src++)) + mixerCtrl |= 0x80; + if ((*dst++ = *src++)) + mixerCtrl |= 0x100; + if ((*dst++ = *src++)) + mixerCtrl |= 0x200; + if ((*dst++ = *src++)) + mixerCtrl |= 0x400; + if ((*dst++ = *src++)) + mixerCtrl |= 0x800; + if ((*dst++ = *src++)) + mixerCtrl |= 0x1000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x2000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x4000; + if ((*dst++ = *src++)) + mixerCtrl |= 0x8000; vpb->pb.rmtMixerCtrl = mixerCtrl; vpb->sync |= (AX_PBSYNC_RMTMIX | AX_PBSYNC_RMT_MIXER_CTRL); diff --git a/libs/RVL_SDK/src/axfx/AXFXDelay.c b/libs/RVL_SDK/src/axfx/AXFXDelay.c index 8e4c2af4..2f0de7f5 100644 --- a/libs/RVL_SDK/src/axfx/AXFXDelay.c +++ b/libs/RVL_SDK/src/axfx/AXFXDelay.c @@ -1,5 +1,5 @@ -#include #include +#include #include diff --git a/libs/RVL_SDK/src/axfx/AXFXHooks.c b/libs/RVL_SDK/src/axfx/AXFXHooks.c index 0ee0efeb..7e142248 100644 --- a/libs/RVL_SDK/src/axfx/AXFXHooks.c +++ b/libs/RVL_SDK/src/axfx/AXFXHooks.c @@ -5,8 +5,8 @@ static void* __AXFXAllocFunction(size_t size); static void __AXFXFreeFunction(void* block); -AXFXAllocHook __AXFXAlloc = __AXFXAllocFunction; -AXFXFreeHook __AXFXFree = __AXFXFreeFunction; +AXFXAllocHook __AXFXAlloc = __AXFXAllocFunction; +AXFXFreeHook __AXFXFree = __AXFXFreeFunction; static void* __AXFXAllocFunction(size_t size) { return OSAllocFromHeap(__OSCurrHeap, size); diff --git a/libs/RVL_SDK/src/axfx/AXFXLfoTable.c b/libs/RVL_SDK/src/axfx/AXFXLfoTable.c index 4b3611d4..f7be930e 100644 --- a/libs/RVL_SDK/src/axfx/AXFXLfoTable.c +++ b/libs/RVL_SDK/src/axfx/AXFXLfoTable.c @@ -1,26 +1,16 @@ #include static s32 __SinTableFixedPoint[128] = { - 0, 411733, 823219, 1234208, 1644454, 2053710, 2461728, - 2868264, 3273072, 3675908, 4076531, 4474698, 4870168, 5262706, - 5652074, 6038037, 6420363, 6798821, 7173184, 7543226, 7908725, - 8269460, 8625213, 8975771, 9320922, 9660459, 9994176, 10321874, - 10643354, 10958422, 11266890, 11568571, 11863283, 12150850, 12431098, - 12703857, 12968963, 13226258, 13475586, 13716797, 13949746, 14174291, - 14390299, 14597637, 14796184, 14985817, 15166424, 15337895, 15500126, - 15653022, 15796488, 15930440, 16054795, 16169479, 16274424, 16369565, - 16454847, 16530216, 16595628, 16651044, 16696429, 16731757, 16757007, - 16772163, 16777216, 16772163, 16757007, 16731757, 16696429, 16651043, - 16595628, 16530216, 16454846, 16369565, 16274424, 16169479, 16054794, - 15930439, 15796488, 15653022, 15500126, 15337894, 15166424, 14985817, - 14796183, 14597638, 14390298, 14174290, 13949744, 13716797, 13475586, - 13226257, 12968964, 12703856, 12431096, 12150848, 11863283, 11568570, - 11266888, 10958422, 10643353, 10321872, 9994173, 9660458, 9320921, - 8975768, 8625213, 8269458, 7908723, 7543227, 7173183, 6798819, - 6420360, 6038037, 5652073, 5262704, 4870169, 4474697, 4076529, - 3675906, 3273072, 2868263, 2461726, 2053710, 1644454, 1234206, - 823215, 411733 -}; + 0, 411733, 823219, 1234208, 1644454, 2053710, 2461728, 2868264, 3273072, 3675908, 4076531, 4474698, 4870168, + 5262706, 5652074, 6038037, 6420363, 6798821, 7173184, 7543226, 7908725, 8269460, 8625213, 8975771, 9320922, 9660459, + 9994176, 10321874, 10643354, 10958422, 11266890, 11568571, 11863283, 12150850, 12431098, 12703857, 12968963, 13226258, 13475586, + 13716797, 13949746, 14174291, 14390299, 14597637, 14796184, 14985817, 15166424, 15337895, 15500126, 15653022, 15796488, 15930440, + 16054795, 16169479, 16274424, 16369565, 16454847, 16530216, 16595628, 16651044, 16696429, 16731757, 16757007, 16772163, 16777216, + 16772163, 16757007, 16731757, 16696429, 16651043, 16595628, 16530216, 16454846, 16369565, 16274424, 16169479, 16054794, 15930439, + 15796488, 15653022, 15500126, 15337894, 15166424, 14985817, 14796183, 14597638, 14390298, 14174290, 13949744, 13716797, 13475586, + 13226257, 12968964, 12703856, 12431096, 12150848, 11863283, 11568570, 11266888, 10958422, 10643353, 10321872, 9994173, 9660458, + 9320921, 8975768, 8625213, 8269458, 7908723, 7543227, 7173183, 6798819, 6420360, 6038037, 5652073, 5262704, 4870169, + 4474697, 4076529, 3675906, 3273072, 2868263, 2461726, 2053710, 1644454, 1234206, 823215, 411733}; s32* __AXFXGetLfoSinTable() { return __SinTableFixedPoint; diff --git a/libs/RVL_SDK/src/axfx/AXFXSrcCoef.c b/libs/RVL_SDK/src/axfx/AXFXSrcCoef.c index a5d2635b..581ec666 100644 --- a/libs/RVL_SDK/src/axfx/AXFXSrcCoef.c +++ b/libs/RVL_SDK/src/axfx/AXFXSrcCoef.c @@ -1,138 +1,71 @@ #include static f32 __SrcTab12khz[128][4] = { - {0.09750366211f, 0.80221557617f, 0.10159301758f, -0.00097656250f}, - {0.09350585938f, 0.80203247070f, 0.10580444336f, -0.00103759766f}, - {0.08959960938f, 0.80169677734f, 0.11010742188f, -0.00115966797f}, - {0.08578491211f, 0.80117797852f, 0.11447143555f, -0.00128173828f}, - {0.08203125000f, 0.80047607422f, 0.11892700195f, -0.00140380859f}, - {0.07836914062f, 0.79962158203f, 0.12347412109f, -0.00152587891f}, - {0.07479858398f, 0.79861450195f, 0.12814331055f, -0.00164794922f}, - {0.07135009766f, 0.79742431641f, 0.13287353516f, -0.00177001953f}, - {0.06796264648f, 0.79605102539f, 0.13769531250f, -0.00192260742f}, - {0.06469726562f, 0.79452514648f, 0.14260864258f, -0.00204467773f}, - {0.06149291992f, 0.79284667969f, 0.14761352539f, -0.00219726562f}, - {0.05834960938f, 0.79098510742f, 0.15270996094f, -0.00231933594f}, - {0.05532836914f, 0.78894042969f, 0.15789794922f, -0.00247192383f}, - {0.05236816406f, 0.78674316406f, 0.16317749023f, -0.00265502930f}, - {0.04949951172f, 0.78442382812f, 0.16851806641f, -0.00280761719f}, - {0.04672241211f, 0.78189086914f, 0.17398071289f, -0.00299072266f}, - {0.04400634766f, 0.77920532227f, 0.17950439453f, -0.00314331055f}, - {0.04141235352f, 0.77636718750f, 0.18511962891f, -0.00332641602f}, - {0.03887939453f, 0.77337646484f, 0.19082641602f, -0.00350952148f}, - {0.03640747070f, 0.77023315430f, 0.19659423828f, -0.00369262695f}, - {0.03402709961f, 0.76693725586f, 0.20248413086f, -0.00387573242f}, - {0.03173828125f, 0.76348876953f, 0.20843505859f, -0.00405883789f}, - {0.02951049805f, 0.75985717773f, 0.21444702148f, -0.00427246094f}, - {0.02737426758f, 0.75610351562f, 0.22055053711f, -0.00445556641f}, - {0.02529907227f, 0.75219726562f, 0.22674560547f, -0.00466918945f}, - {0.02331542969f, 0.74816894531f, 0.23300170898f, -0.00485229492f}, - {0.02139282227f, 0.74398803711f, 0.23931884766f, -0.00506591797f}, - {0.01956176758f, 0.73965454102f, 0.24572753906f, -0.00531005859f}, - {0.01779174805f, 0.73519897461f, 0.25219726562f, -0.00552368164f}, - {0.01605224609f, 0.73059082031f, 0.25872802734f, -0.00570678711f}, - {0.01440429688f, 0.72586059570f, 0.26535034180f, -0.00592041016f}, - {0.01281738281f, 0.72100830078f, 0.27203369141f, -0.00616455078f}, - {0.01132202148f, 0.71600341797f, 0.27877807617f, -0.00637817383f}, - {0.00988769531f, 0.71090698242f, 0.28558349609f, -0.00656127930f}, - {0.00851440430f, 0.70565795898f, 0.29244995117f, -0.00677490234f}, - {0.00720214844f, 0.70031738281f, 0.29934692383f, -0.00701904297f}, - {0.00592041016f, 0.69485473633f, 0.30633544922f, -0.00723266602f}, - {0.00469970703f, 0.68927001953f, 0.31338500977f, -0.00741577148f}, - {0.00357055664f, 0.68356323242f, 0.32046508789f, -0.00762939453f}, - {0.00247192383f, 0.67773437500f, 0.32760620117f, -0.00787353516f}, - {0.00143432617f, 0.67184448242f, 0.33477783203f, -0.00808715820f}, - {0.00045776367f, 0.66583251953f, 0.34197998047f, -0.00827026367f}, - {-0.00048828125f, 0.65972900391f, 0.34924316406f, -0.00845336914f}, - {-0.00134277344f, 0.65353393555f, 0.35656738281f, -0.00863647461f}, - {-0.00216674805f, 0.64721679688f, 0.36389160156f, -0.00885009766f}, - {-0.00296020508f, 0.64083862305f, 0.37127685547f, -0.00903320312f}, - {-0.00369262695f, 0.63433837891f, 0.37869262695f, -0.00921630859f}, - {-0.00436401367f, 0.62777709961f, 0.38613891602f, -0.00933837891f}, - {-0.00497436523f, 0.62115478516f, 0.39361572266f, -0.00949096680f}, - {-0.00558471680f, 0.61444091797f, 0.40109252930f, -0.00964355469f}, - {-0.00613403320f, 0.60763549805f, 0.40859985352f, -0.00979614258f}, - {-0.00665283203f, 0.60076904297f, 0.41610717773f, -0.00991821289f}, - {-0.00714111328f, 0.59384155273f, 0.42364501953f, -0.01000976562f}, - {-0.00756835938f, 0.58685302734f, 0.43121337891f, -0.01013183594f}, - {-0.00796508789f, 0.57977294922f, 0.43875122070f, -0.01022338867f}, - {-0.00833129883f, 0.57266235352f, 0.44631958008f, -0.01028442383f}, - {-0.00866699219f, 0.56552124023f, 0.45388793945f, -0.01034545898f}, - {-0.00897216797f, 0.55831909180f, 0.46145629883f, -0.01040649414f}, - {-0.00921630859f, 0.55105590820f, 0.46902465820f, -0.01040649414f}, - {-0.00946044922f, 0.54373168945f, 0.47659301758f, -0.01040649414f}, - {-0.00967407227f, 0.53640747070f, 0.48413085938f, -0.01037597656f}, - {-0.00985717773f, 0.52902221680f, 0.49166870117f, -0.01037597656f}, - {-0.01000976562f, 0.52160644531f, 0.49917602539f, -0.01031494141f}, - {-0.01013183594f, 0.51416015625f, 0.50668334961f, -0.01025390625f}, - {-0.01025390625f, 0.50668334961f, 0.51416015625f, -0.01013183594f}, - {-0.01031494141f, 0.49917602539f, 0.52160644531f, -0.01000976562f}, - {-0.01037597656f, 0.49166870117f, 0.52902221680f, -0.00985717773f}, - {-0.01037597656f, 0.48413085938f, 0.53640747070f, -0.00967407227f}, - {-0.01040649414f, 0.47659301758f, 0.54373168945f, -0.00946044922f}, - {-0.01040649414f, 0.46902465820f, 0.55105590820f, -0.00921630859f}, - {-0.01040649414f, 0.46145629883f, 0.55831909180f, -0.00897216797f}, - {-0.01034545898f, 0.45388793945f, 0.56552124023f, -0.00866699219f}, - {-0.01028442383f, 0.44631958008f, 0.57266235352f, -0.00833129883f}, - {-0.01022338867f, 0.43875122070f, 0.57977294922f, -0.00796508789f}, - {-0.01013183594f, 0.43121337891f, 0.58685302734f, -0.00756835938f}, - {-0.01000976562f, 0.42364501953f, 0.59384155273f, -0.00714111328f}, - {-0.00991821289f, 0.41610717773f, 0.60076904297f, -0.00665283203f}, - {-0.00979614258f, 0.40859985352f, 0.60763549805f, -0.00613403320f}, - {-0.00964355469f, 0.40109252930f, 0.61444091797f, -0.00558471680f}, - {-0.00949096680f, 0.39361572266f, 0.62115478516f, -0.00497436523f}, - {-0.00933837891f, 0.38613891602f, 0.62777709961f, -0.00436401367f}, - {-0.00921630859f, 0.37869262695f, 0.63433837891f, -0.00369262695f}, - {-0.00903320312f, 0.37127685547f, 0.64083862305f, -0.00296020508f}, - {-0.00885009766f, 0.36389160156f, 0.64721679688f, -0.00216674805f}, - {-0.00863647461f, 0.35656738281f, 0.65353393555f, -0.00134277344f}, - {-0.00845336914f, 0.34924316406f, 0.65972900391f, -0.00048828125f}, - {-0.00827026367f, 0.34197998047f, 0.66583251953f, 0.00045776367f}, - {-0.00808715820f, 0.33477783203f, 0.67184448242f, 0.00143432617f}, - {-0.00787353516f, 0.32760620117f, 0.67773437500f, 0.00247192383f}, - {-0.00762939453f, 0.32046508789f, 0.68356323242f, 0.00357055664f}, - {-0.00741577148f, 0.31338500977f, 0.68927001953f, 0.00469970703f}, - {-0.00723266602f, 0.30633544922f, 0.69485473633f, 0.00592041016f}, - {-0.00701904297f, 0.29934692383f, 0.70031738281f, 0.00720214844f}, - {-0.00677490234f, 0.29244995117f, 0.70565795898f, 0.00851440430f}, - {-0.00656127930f, 0.28558349609f, 0.71090698242f, 0.00988769531f}, - {-0.00637817383f, 0.27877807617f, 0.71600341797f, 0.01132202148f}, - {-0.00616455078f, 0.27203369141f, 0.72100830078f, 0.01281738281f}, - {-0.00592041016f, 0.26535034180f, 0.72586059570f, 0.01440429688f}, - {-0.00570678711f, 0.25872802734f, 0.73059082031f, 0.01605224609f}, - {-0.00552368164f, 0.25219726562f, 0.73519897461f, 0.01779174805f}, - {-0.00531005859f, 0.24572753906f, 0.73965454102f, 0.01956176758f}, - {-0.00506591797f, 0.23931884766f, 0.74398803711f, 0.02139282227f}, - {-0.00485229492f, 0.23300170898f, 0.74816894531f, 0.02331542969f}, - {-0.00466918945f, 0.22674560547f, 0.75219726562f, 0.02529907227f}, - {-0.00445556641f, 0.22055053711f, 0.75610351562f, 0.02737426758f}, - {-0.00427246094f, 0.21444702148f, 0.75985717773f, 0.02951049805f}, - {-0.00405883789f, 0.20843505859f, 0.76348876953f, 0.03173828125f}, - {-0.00387573242f, 0.20248413086f, 0.76693725586f, 0.03402709961f}, - {-0.00369262695f, 0.19659423828f, 0.77023315430f, 0.03640747070f}, - {-0.00350952148f, 0.19082641602f, 0.77337646484f, 0.03887939453f}, - {-0.00332641602f, 0.18511962891f, 0.77636718750f, 0.04141235352f}, - {-0.00314331055f, 0.17950439453f, 0.77920532227f, 0.04400634766f}, - {-0.00299072266f, 0.17398071289f, 0.78189086914f, 0.04672241211f}, - {-0.00280761719f, 0.16851806641f, 0.78442382812f, 0.04949951172f}, - {-0.00265502930f, 0.16317749023f, 0.78674316406f, 0.05236816406f}, - {-0.00247192383f, 0.15789794922f, 0.78894042969f, 0.05532836914f}, - {-0.00231933594f, 0.15270996094f, 0.79098510742f, 0.05834960938f}, - {-0.00219726562f, 0.14761352539f, 0.79284667969f, 0.06149291992f}, - {-0.00204467773f, 0.14260864258f, 0.79452514648f, 0.06469726562f}, - {-0.00192260742f, 0.13769531250f, 0.79605102539f, 0.06796264648f}, - {-0.00177001953f, 0.13287353516f, 0.79742431641f, 0.07135009766f}, - {-0.00164794922f, 0.12814331055f, 0.79861450195f, 0.07479858398f}, - {-0.00152587891f, 0.12347412109f, 0.79962158203f, 0.07836914062f}, - {-0.00140380859f, 0.11892700195f, 0.80047607422f, 0.08203125000f}, - {-0.00128173828f, 0.11447143555f, 0.80117797852f, 0.08578491211f}, - {-0.00115966797f, 0.11010742188f, 0.80169677734f, 0.08959960938f}, - {-0.00103759766f, 0.10580444336f, 0.80203247070f, 0.09350585938f}, - {-0.00097656250f, 0.10159301758f, 0.80221557617f, 0.09750366211f} -}; + {0.09750366211f, 0.80221557617f, 0.10159301758f, -0.00097656250f}, {0.09350585938f, 0.80203247070f, 0.10580444336f, -0.00103759766f}, + {0.08959960938f, 0.80169677734f, 0.11010742188f, -0.00115966797f}, {0.08578491211f, 0.80117797852f, 0.11447143555f, -0.00128173828f}, + {0.08203125000f, 0.80047607422f, 0.11892700195f, -0.00140380859f}, {0.07836914062f, 0.79962158203f, 0.12347412109f, -0.00152587891f}, + {0.07479858398f, 0.79861450195f, 0.12814331055f, -0.00164794922f}, {0.07135009766f, 0.79742431641f, 0.13287353516f, -0.00177001953f}, + {0.06796264648f, 0.79605102539f, 0.13769531250f, -0.00192260742f}, {0.06469726562f, 0.79452514648f, 0.14260864258f, -0.00204467773f}, + {0.06149291992f, 0.79284667969f, 0.14761352539f, -0.00219726562f}, {0.05834960938f, 0.79098510742f, 0.15270996094f, -0.00231933594f}, + {0.05532836914f, 0.78894042969f, 0.15789794922f, -0.00247192383f}, {0.05236816406f, 0.78674316406f, 0.16317749023f, -0.00265502930f}, + {0.04949951172f, 0.78442382812f, 0.16851806641f, -0.00280761719f}, {0.04672241211f, 0.78189086914f, 0.17398071289f, -0.00299072266f}, + {0.04400634766f, 0.77920532227f, 0.17950439453f, -0.00314331055f}, {0.04141235352f, 0.77636718750f, 0.18511962891f, -0.00332641602f}, + {0.03887939453f, 0.77337646484f, 0.19082641602f, -0.00350952148f}, {0.03640747070f, 0.77023315430f, 0.19659423828f, -0.00369262695f}, + {0.03402709961f, 0.76693725586f, 0.20248413086f, -0.00387573242f}, {0.03173828125f, 0.76348876953f, 0.20843505859f, -0.00405883789f}, + {0.02951049805f, 0.75985717773f, 0.21444702148f, -0.00427246094f}, {0.02737426758f, 0.75610351562f, 0.22055053711f, -0.00445556641f}, + {0.02529907227f, 0.75219726562f, 0.22674560547f, -0.00466918945f}, {0.02331542969f, 0.74816894531f, 0.23300170898f, -0.00485229492f}, + {0.02139282227f, 0.74398803711f, 0.23931884766f, -0.00506591797f}, {0.01956176758f, 0.73965454102f, 0.24572753906f, -0.00531005859f}, + {0.01779174805f, 0.73519897461f, 0.25219726562f, -0.00552368164f}, {0.01605224609f, 0.73059082031f, 0.25872802734f, -0.00570678711f}, + {0.01440429688f, 0.72586059570f, 0.26535034180f, -0.00592041016f}, {0.01281738281f, 0.72100830078f, 0.27203369141f, -0.00616455078f}, + {0.01132202148f, 0.71600341797f, 0.27877807617f, -0.00637817383f}, {0.00988769531f, 0.71090698242f, 0.28558349609f, -0.00656127930f}, + {0.00851440430f, 0.70565795898f, 0.29244995117f, -0.00677490234f}, {0.00720214844f, 0.70031738281f, 0.29934692383f, -0.00701904297f}, + {0.00592041016f, 0.69485473633f, 0.30633544922f, -0.00723266602f}, {0.00469970703f, 0.68927001953f, 0.31338500977f, -0.00741577148f}, + {0.00357055664f, 0.68356323242f, 0.32046508789f, -0.00762939453f}, {0.00247192383f, 0.67773437500f, 0.32760620117f, -0.00787353516f}, + {0.00143432617f, 0.67184448242f, 0.33477783203f, -0.00808715820f}, {0.00045776367f, 0.66583251953f, 0.34197998047f, -0.00827026367f}, + {-0.00048828125f, 0.65972900391f, 0.34924316406f, -0.00845336914f}, {-0.00134277344f, 0.65353393555f, 0.35656738281f, -0.00863647461f}, + {-0.00216674805f, 0.64721679688f, 0.36389160156f, -0.00885009766f}, {-0.00296020508f, 0.64083862305f, 0.37127685547f, -0.00903320312f}, + {-0.00369262695f, 0.63433837891f, 0.37869262695f, -0.00921630859f}, {-0.00436401367f, 0.62777709961f, 0.38613891602f, -0.00933837891f}, + {-0.00497436523f, 0.62115478516f, 0.39361572266f, -0.00949096680f}, {-0.00558471680f, 0.61444091797f, 0.40109252930f, -0.00964355469f}, + {-0.00613403320f, 0.60763549805f, 0.40859985352f, -0.00979614258f}, {-0.00665283203f, 0.60076904297f, 0.41610717773f, -0.00991821289f}, + {-0.00714111328f, 0.59384155273f, 0.42364501953f, -0.01000976562f}, {-0.00756835938f, 0.58685302734f, 0.43121337891f, -0.01013183594f}, + {-0.00796508789f, 0.57977294922f, 0.43875122070f, -0.01022338867f}, {-0.00833129883f, 0.57266235352f, 0.44631958008f, -0.01028442383f}, + {-0.00866699219f, 0.56552124023f, 0.45388793945f, -0.01034545898f}, {-0.00897216797f, 0.55831909180f, 0.46145629883f, -0.01040649414f}, + {-0.00921630859f, 0.55105590820f, 0.46902465820f, -0.01040649414f}, {-0.00946044922f, 0.54373168945f, 0.47659301758f, -0.01040649414f}, + {-0.00967407227f, 0.53640747070f, 0.48413085938f, -0.01037597656f}, {-0.00985717773f, 0.52902221680f, 0.49166870117f, -0.01037597656f}, + {-0.01000976562f, 0.52160644531f, 0.49917602539f, -0.01031494141f}, {-0.01013183594f, 0.51416015625f, 0.50668334961f, -0.01025390625f}, + {-0.01025390625f, 0.50668334961f, 0.51416015625f, -0.01013183594f}, {-0.01031494141f, 0.49917602539f, 0.52160644531f, -0.01000976562f}, + {-0.01037597656f, 0.49166870117f, 0.52902221680f, -0.00985717773f}, {-0.01037597656f, 0.48413085938f, 0.53640747070f, -0.00967407227f}, + {-0.01040649414f, 0.47659301758f, 0.54373168945f, -0.00946044922f}, {-0.01040649414f, 0.46902465820f, 0.55105590820f, -0.00921630859f}, + {-0.01040649414f, 0.46145629883f, 0.55831909180f, -0.00897216797f}, {-0.01034545898f, 0.45388793945f, 0.56552124023f, -0.00866699219f}, + {-0.01028442383f, 0.44631958008f, 0.57266235352f, -0.00833129883f}, {-0.01022338867f, 0.43875122070f, 0.57977294922f, -0.00796508789f}, + {-0.01013183594f, 0.43121337891f, 0.58685302734f, -0.00756835938f}, {-0.01000976562f, 0.42364501953f, 0.59384155273f, -0.00714111328f}, + {-0.00991821289f, 0.41610717773f, 0.60076904297f, -0.00665283203f}, {-0.00979614258f, 0.40859985352f, 0.60763549805f, -0.00613403320f}, + {-0.00964355469f, 0.40109252930f, 0.61444091797f, -0.00558471680f}, {-0.00949096680f, 0.39361572266f, 0.62115478516f, -0.00497436523f}, + {-0.00933837891f, 0.38613891602f, 0.62777709961f, -0.00436401367f}, {-0.00921630859f, 0.37869262695f, 0.63433837891f, -0.00369262695f}, + {-0.00903320312f, 0.37127685547f, 0.64083862305f, -0.00296020508f}, {-0.00885009766f, 0.36389160156f, 0.64721679688f, -0.00216674805f}, + {-0.00863647461f, 0.35656738281f, 0.65353393555f, -0.00134277344f}, {-0.00845336914f, 0.34924316406f, 0.65972900391f, -0.00048828125f}, + {-0.00827026367f, 0.34197998047f, 0.66583251953f, 0.00045776367f}, {-0.00808715820f, 0.33477783203f, 0.67184448242f, 0.00143432617f}, + {-0.00787353516f, 0.32760620117f, 0.67773437500f, 0.00247192383f}, {-0.00762939453f, 0.32046508789f, 0.68356323242f, 0.00357055664f}, + {-0.00741577148f, 0.31338500977f, 0.68927001953f, 0.00469970703f}, {-0.00723266602f, 0.30633544922f, 0.69485473633f, 0.00592041016f}, + {-0.00701904297f, 0.29934692383f, 0.70031738281f, 0.00720214844f}, {-0.00677490234f, 0.29244995117f, 0.70565795898f, 0.00851440430f}, + {-0.00656127930f, 0.28558349609f, 0.71090698242f, 0.00988769531f}, {-0.00637817383f, 0.27877807617f, 0.71600341797f, 0.01132202148f}, + {-0.00616455078f, 0.27203369141f, 0.72100830078f, 0.01281738281f}, {-0.00592041016f, 0.26535034180f, 0.72586059570f, 0.01440429688f}, + {-0.00570678711f, 0.25872802734f, 0.73059082031f, 0.01605224609f}, {-0.00552368164f, 0.25219726562f, 0.73519897461f, 0.01779174805f}, + {-0.00531005859f, 0.24572753906f, 0.73965454102f, 0.01956176758f}, {-0.00506591797f, 0.23931884766f, 0.74398803711f, 0.02139282227f}, + {-0.00485229492f, 0.23300170898f, 0.74816894531f, 0.02331542969f}, {-0.00466918945f, 0.22674560547f, 0.75219726562f, 0.02529907227f}, + {-0.00445556641f, 0.22055053711f, 0.75610351562f, 0.02737426758f}, {-0.00427246094f, 0.21444702148f, 0.75985717773f, 0.02951049805f}, + {-0.00405883789f, 0.20843505859f, 0.76348876953f, 0.03173828125f}, {-0.00387573242f, 0.20248413086f, 0.76693725586f, 0.03402709961f}, + {-0.00369262695f, 0.19659423828f, 0.77023315430f, 0.03640747070f}, {-0.00350952148f, 0.19082641602f, 0.77337646484f, 0.03887939453f}, + {-0.00332641602f, 0.18511962891f, 0.77636718750f, 0.04141235352f}, {-0.00314331055f, 0.17950439453f, 0.77920532227f, 0.04400634766f}, + {-0.00299072266f, 0.17398071289f, 0.78189086914f, 0.04672241211f}, {-0.00280761719f, 0.16851806641f, 0.78442382812f, 0.04949951172f}, + {-0.00265502930f, 0.16317749023f, 0.78674316406f, 0.05236816406f}, {-0.00247192383f, 0.15789794922f, 0.78894042969f, 0.05532836914f}, + {-0.00231933594f, 0.15270996094f, 0.79098510742f, 0.05834960938f}, {-0.00219726562f, 0.14761352539f, 0.79284667969f, 0.06149291992f}, + {-0.00204467773f, 0.14260864258f, 0.79452514648f, 0.06469726562f}, {-0.00192260742f, 0.13769531250f, 0.79605102539f, 0.06796264648f}, + {-0.00177001953f, 0.13287353516f, 0.79742431641f, 0.07135009766f}, {-0.00164794922f, 0.12814331055f, 0.79861450195f, 0.07479858398f}, + {-0.00152587891f, 0.12347412109f, 0.79962158203f, 0.07836914062f}, {-0.00140380859f, 0.11892700195f, 0.80047607422f, 0.08203125000f}, + {-0.00128173828f, 0.11447143555f, 0.80117797852f, 0.08578491211f}, {-0.00115966797f, 0.11010742188f, 0.80169677734f, 0.08959960938f}, + {-0.00103759766f, 0.10580444336f, 0.80203247070f, 0.09350585938f}, {-0.00097656250f, 0.10159301758f, 0.80221557617f, 0.09750366211f}}; f32* __AXFXGetSrcCoef(u32 i) { return __SrcTab12khz[i]; } - - diff --git a/libs/RVL_SDK/src/base/PPCArch.c b/libs/RVL_SDK/src/base/PPCArch.c index b3688a2f..e7848fa8 100644 --- a/libs/RVL_SDK/src/base/PPCArch.c +++ b/libs/RVL_SDK/src/base/PPCArch.c @@ -1,6 +1,8 @@ #include #include +// clang-format off + asm u32 PPCMfmsr() { #ifdef __MWERKS__ nofralloc @@ -390,3 +392,5 @@ void PPCMthid4(register u32 val) { } #endif // __MWERKS__ } + +// clang-format on diff --git a/libs/RVL_SDK/src/card/CARDBios.c b/libs/RVL_SDK/src/card/CARDBios.c index 54f11c1c..c4c977f5 100644 --- a/libs/RVL_SDK/src/card/CARDBios.c +++ b/libs/RVL_SDK/src/card/CARDBios.c @@ -3,8 +3,8 @@ #include -#include #include +#include #include @@ -25,7 +25,8 @@ static BOOL OnShutdown(BOOL f, u32 val); static OSShutdownFunctionInfo ShutdownFunctionInfo = {OnShutdown, 127}; -void __CARDDefaultApiCallback(s32 chan, s32 result) {} +void __CARDDefaultApiCallback(s32 chan, s32 result) { +} void __CARDSyncCallback(s32 chan, s32 result) { CARDControl* card; @@ -224,7 +225,7 @@ static void TimeoutHandler(OSAlarm* alarm, OSContext* context) { static void SetupTimeoutAlarm(CARDControl* card) { OSCancelAlarm(&card->alarm); switch (card->cmd[0]) { - case 0xF2: { + case 0xF2: { OSSetAlarm(&card->alarm, OSMillisecondsToTicks(100), TimeoutHandler); break; } @@ -291,8 +292,7 @@ static void UnlockedCallback(s32 chan, s32 result) { card->unlockCallback = UnlockedCallback; if (!EXILock(chan, EXI_DEV_EXT, __CARDUnlockedHandler)) { result = CARD_RESULT_READY; - } - else { + } else { card->unlockCallback = 0; result = Retry(chan); } @@ -332,8 +332,7 @@ static s32 __CARDStart(s32 chan, CARDCallback txCallback, CARDCallback exiCallba card = &__CARDBlock[chan]; if (!card->attached) { result = CARD_RESULT_NOCARD; - } - else { + } else { if (txCallback) { card->txCallback = txCallback; } @@ -346,15 +345,13 @@ static s32 __CARDStart(s32 chan, CARDCallback txCallback, CARDCallback exiCallba if (!EXILock(chan, EXI_DEV_EXT, __CARDUnlockedHandler)) { result = CARD_RESULT_BUSY; - } - else { + } else { card->unlockCallback = 0; if (!EXISelect(chan, EXI_DEV_EXT, CARDFreq)) { EXIUnlock(chan); result = CARD_RESULT_NOCARD; - } - else { + } else { SetupTimeoutAlarm(card); result = CARD_RESULT_READY; } @@ -369,7 +366,7 @@ static s32 __CARDStart(s32 chan, CARDCallback txCallback, CARDCallback exiCallba #define AD1EX(x) ((u8)(AD1(x) | 0x80)); #define AD2(x) ((u8)(((x) >> 9) & 0xff)) #define AD3(x) ((u8)(((x) >> 7) & 0x03)) -#define BA(x) ((u8)((x)&0x7f)) +#define BA(x) ((u8)((x) & 0x7f)) s32 __CARDReadSegment(s32 chan, CARDCallback callback) { CARDControl* card; @@ -389,17 +386,14 @@ s32 __CARDReadSegment(s32 chan, CARDCallback callback) { result = __CARDStart(chan, callback, 0); if (result == CARD_RESULT_BUSY) { result = CARD_RESULT_READY; - } - else if (result >= CARD_RESULT_READY) { - if (!EXIImmEx(chan, card->cmd, card->cmdlen, EXI_WRITE) - || !EXIImmEx(chan, (u8* )card->workArea + sizeof(CARDID), card->latency, EXI_WRITE) - || !EXIDma(chan, card->buffer, 512, card->mode, __CARDTxHandler)) { + } else if (result >= CARD_RESULT_READY) { + if (!EXIImmEx(chan, card->cmd, card->cmdlen, EXI_WRITE) || !EXIImmEx(chan, (u8*)card->workArea + sizeof(CARDID), card->latency, EXI_WRITE) || + !EXIDma(chan, card->buffer, 512, card->mode, __CARDTxHandler)) { card->txCallback = NULL; EXIDeselect(chan); EXIUnlock(chan); result = CARD_RESULT_NOCARD; - } - else { + } else { result = CARD_RESULT_READY; } } @@ -416,8 +410,7 @@ s32 __CARDWritePage(s32 chan, CARDCallback callback) { if (card->pageSize > 0x80) { card->cmd[1] = AD1(card->addr) | 0x80; - } - else { + } else { card->cmd[1] = AD1(card->addr); } @@ -431,20 +424,17 @@ s32 __CARDWritePage(s32 chan, CARDCallback callback) { result = __CARDStart(chan, 0, callback); if (result == CARD_RESULT_BUSY) { result = CARD_RESULT_READY; - } - else if (result >= CARD_RESULT_READY) { - if (!EXIImmEx(chan, card->cmd, card->cmdlen, EXI_WRITE) - || !EXIDma(chan, card->buffer, card->pageSize, card->mode, __CARDTxHandler)) { + } else if (result >= CARD_RESULT_READY) { + if (!EXIImmEx(chan, card->cmd, card->cmdlen, EXI_WRITE) || !EXIDma(chan, card->buffer, card->pageSize, card->mode, __CARDTxHandler)) { card->exiCallback = 0; EXIDeselect(chan); EXIUnlock(chan); result = CARD_RESULT_NOCARD; - } - else { + } else { result = CARD_RESULT_READY; } } - + return result; } @@ -472,13 +462,11 @@ s32 __CARDEraseSector(s32 chan, u32 addr, CARDCallback callback) { if (result == CARD_RESULT_BUSY) { result = CARD_RESULT_READY; - } - else if (result >= CARD_RESULT_READY) { + } else if (result >= CARD_RESULT_READY) { if (!EXIImmEx(chan, card->cmd, card->cmdlen, EXI_WRITE)) { result = CARD_RESULT_NOCARD; card->exiCallback = NULL; - } - else { + } else { result = CARD_RESULT_READY; } @@ -537,11 +525,9 @@ s32 __CARDGetControlBlock(s32 chan, CARDControl** pcard) { if (!card->attached) { result = CARD_RESULT_NOCARD; - } - else if (card->result == CARD_RESULT_BUSY) { + } else if (card->result == CARD_RESULT_BUSY) { result = CARD_RESULT_BUSY; - } - else { + } else { card->result = CARD_RESULT_BUSY; result = CARD_RESULT_READY; card->apiCallback = NULL; @@ -558,8 +544,7 @@ s32 __CARDPutControlBlock(CARDControl* card, s32 result) { enabled = OSDisableInterrupts(); if (card->attached) { card->result = result; - } - else if (card->result == CARD_RESULT_BUSY) { + } else if (card->result == CARD_RESULT_BUSY) { card->result = result; } diff --git a/libs/RVL_SDK/src/card/CARDBlock.c b/libs/RVL_SDK/src/card/CARDBlock.c index cc74ad34..30b8a070 100644 --- a/libs/RVL_SDK/src/card/CARDBlock.c +++ b/libs/RVL_SDK/src/card/CARDBlock.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -25,8 +25,7 @@ static void WriteCallback(s32 chan, s32 result) { if (card->currentFat == fat0) { card->currentFat = fat1; memcpy(fat1, fat0, 0x2000); - } - else { + } else { card->currentFat = fat0; memcpy(fat0, fat1, 0x2000); } @@ -108,8 +107,7 @@ s32 __CARDAllocBlock(s32 chan, u32 cBlock, CARDCallback callback) { if (fat[iBlock] == 0x0000u) { if (startBlock == 0xFFFF) { startBlock = iBlock; - } - else { + } else { fat[prevBlock] = iBlock; } prevBlock = iBlock; diff --git a/libs/RVL_SDK/src/card/CARDCheck.c b/libs/RVL_SDK/src/card/CARDCheck.c index 58ae4def..596a600d 100644 --- a/libs/RVL_SDK/src/card/CARDCheck.c +++ b/libs/RVL_SDK/src/card/CARDCheck.c @@ -1,8 +1,8 @@ -#include #include +#include -#include #include +#include #include @@ -93,14 +93,12 @@ static s32 VerifyDir(CARDControl* card, int* pcurrent) { if (card->currentDir == 0) { if ((check[0]->checkCode - check[1]->checkCode) < 0) { current = 0; - } - else { + } else { current = 1; } card->currentDir = dir[current]; memcpy(dir[current], dir[current ^ 1], CARD_SYSTEM_BLOCK_SIZE); - } - else { + } else { current = (card->currentDir == dir[0]) ? 0 : 1; } } @@ -154,14 +152,12 @@ static s32 VerifyFAT(CARDControl* card, int* pcurrent) { if (card->currentFat == 0) { if (((s16)fat[0][CARD_FAT_CHECKCODE] - (s16)fat[1][CARD_FAT_CHECKCODE]) < 0) { current = 0; - } - else { + } else { current = 1; } card->currentFat = fat[current]; memcpy(fat[current], fat[current ^ 1], CARD_SYSTEM_BLOCK_SIZE); - } - else { + } else { current = (card->currentFat == fat[0]) ? 0 : 1; } } @@ -248,8 +244,7 @@ s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback) { card->currentDir = dir[currentDir]; memcpy(dir[currentDir], dir[currentDir ^ 1], CARD_SYSTEM_BLOCK_SIZE); updateDir = TRUE; - } - else { + } else { card->currentFat = fat[currentFat]; memcpy(fat[currentFat], fat[currentFat ^ 1], CARD_SYSTEM_BLOCK_SIZE); updateFat = TRUE; @@ -269,8 +264,7 @@ s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback) { continue; } - for (iBlock = ent->startBlock, cBlock = 0; iBlock != 0xFFFF && cBlock < ent->length; - iBlock = card->currentFat[iBlock], ++cBlock) { + for (iBlock = ent->startBlock, cBlock = 0; iBlock != 0xFFFF && cBlock < ent->length; iBlock = card->currentFat[iBlock], ++cBlock) { if (!CARDIsValidBlockNo(card, iBlock) || 1 < ++map[iBlock]) { return __CARDPutControlBlock(card, CARD_RESULT_BROKEN); } @@ -292,8 +286,7 @@ s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback) { updateOrphan = TRUE; } cFree++; - } - else if (!CARDIsValidBlockNo(card, nextBlock) && nextBlock != 0xFFFF) { + } else if (!CARDIsValidBlockNo(card, nextBlock) && nextBlock != 0xFFFF) { return __CARDPutControlBlock(card, CARD_RESULT_BROKEN); } } @@ -304,8 +297,7 @@ s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback) { } if (updateOrphan) { - __CARDCheckSum(&card->currentFat[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), - &card->currentFat[CARD_FAT_CHECKSUM], + __CARDCheckSum(&card->currentFat[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &card->currentFat[CARD_FAT_CHECKSUM], &card->currentFat[CARD_FAT_CHECKSUMINV]); } diff --git a/libs/RVL_SDK/src/card/CARDCreate.c b/libs/RVL_SDK/src/card/CARDCreate.c index 3feaf1f5..e617d53a 100644 --- a/libs/RVL_SDK/src/card/CARDCreate.c +++ b/libs/RVL_SDK/src/card/CARDCreate.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -17,7 +17,7 @@ static void CreateCallbackFat(s32 chan, s32 result) { dir = __CARDGetDirBlock(card); ent = &dir[card->freeNo]; memcpy(ent->gameName, card->diskID->gameName, sizeof(ent->gameName)); - memcpy(ent->company, card->diskID->company, sizeof(ent->company)); + memcpy(ent->company, card->diskID->company, sizeof(ent->company)); ent->permission = 4; ent->copyTimes = 0; @@ -36,9 +36,8 @@ static void CreateCallbackFat(s32 chan, s32 result) { if (result < 0) { goto after; } - } - else { -after: + } else { + after: __CARDPutControlBlock(card, result); if (callback) { callback(chan, result); @@ -64,7 +63,7 @@ s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* file return result; } - if (size <= 0 || (size % card->sectorSize) != 0) { + if (size <= 0 || (size % card->sectorSize) != 0) { return CARD_RESULT_FATAL_ERROR; } @@ -76,10 +75,8 @@ s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* file if (freeNo == (u16)-1) { freeNo = fileNo; } - } - else if (memcmp(ent->gameName, card->diskID->gameName, sizeof(ent->gameName)) == 0 && - memcmp(ent->company, card->diskID->company, sizeof(ent->company)) == 0 && - __CARDCompareFileName(ent, fileName)) { + } else if (memcmp(ent->gameName, card->diskID->gameName, sizeof(ent->gameName)) == 0 && + memcmp(ent->company, card->diskID->company, sizeof(ent->company)) == 0 && __CARDCompareFileName(ent, fileName)) { return __CARDPutControlBlock(card, CARD_RESULT_EXIST); } } diff --git a/libs/RVL_SDK/src/card/CARDDelete.c b/libs/RVL_SDK/src/card/CARDDelete.c index e1d010cd..3af71925 100644 --- a/libs/RVL_SDK/src/card/CARDDelete.c +++ b/libs/RVL_SDK/src/card/CARDDelete.c @@ -1,5 +1,5 @@ -#include #include +#include #include diff --git a/libs/RVL_SDK/src/card/CARDDir.c b/libs/RVL_SDK/src/card/CARDDir.c index 1fc85eb1..ba00b2a2 100644 --- a/libs/RVL_SDK/src/card/CARDDir.c +++ b/libs/RVL_SDK/src/card/CARDDir.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -21,8 +21,7 @@ static void WriteCallback(s32 chan, s32 result) { if (card->currentDir == dir0) { card->currentDir = dir1; memcpy(dir1, dir0, 0x2000); - } - else { + } else { card->currentDir = dir0; memcpy(dir0, dir1, 0x2000); } diff --git a/libs/RVL_SDK/src/card/CARDFormat.c b/libs/RVL_SDK/src/card/CARDFormat.c index bcee9228..328d4268 100644 --- a/libs/RVL_SDK/src/card/CARDFormat.c +++ b/libs/RVL_SDK/src/card/CARDFormat.c @@ -1,8 +1,8 @@ -#include #include +#include -#include #include +#include #include @@ -21,15 +21,13 @@ static void FormatCallback(s32 chan, s32 result) { result = __CARDEraseSector(chan, (u32)card->sectorSize * card->formatStep, FormatCallback); if (result >= 0) return; - } - else if (card->formatStep < 2 * CARD_NUM_SYSTEM_BLOCK) { + } else if (card->formatStep < 2 * CARD_NUM_SYSTEM_BLOCK) { int step = card->formatStep - CARD_NUM_SYSTEM_BLOCK; - result = __CARDWrite(chan, (u32)card->sectorSize * step, CARD_SYSTEM_BLOCK_SIZE, - (u8* )card->workArea + (CARD_SYSTEM_BLOCK_SIZE * step), FormatCallback); + result = __CARDWrite(chan, (u32)card->sectorSize * step, CARD_SYSTEM_BLOCK_SIZE, (u8*)card->workArea + (CARD_SYSTEM_BLOCK_SIZE * step), + FormatCallback); if (result >= 0) return; - } - else { + } else { card->currentDir = (CARDDir*)((u8*)card->workArea + (1 + 0) * CARD_SYSTEM_BLOCK_SIZE); memcpy(card->currentDir, (u8*)card->workArea + (1 + 1) * CARD_SYSTEM_BLOCK_SIZE, CARD_SYSTEM_BLOCK_SIZE); card->currentFat = (u16*)((u8*)card->workArea + (3 + 0) * CARD_SYSTEM_BLOCK_SIZE); @@ -103,8 +101,7 @@ s32 __CARDFormatRegionAsync(s32 chan, u16 encode, CARDCallback callback) { fat[CARD_FAT_CHECKCODE] = (u16)i; fat[CARD_FAT_FREEBLOCKS] = (u16)(card->cBlock - CARD_NUM_SYSTEM_BLOCK); fat[CARD_FAT_LASTSLOT] = CARD_NUM_SYSTEM_BLOCK - 1; - __CARDCheckSum(&fat[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &fat[CARD_FAT_CHECKSUM], - &fat[CARD_FAT_CHECKSUMINV]); + __CARDCheckSum(&fat[CARD_FAT_CHECKCODE], CARD_SYSTEM_BLOCK_SIZE - sizeof(u32), &fat[CARD_FAT_CHECKSUM], &fat[CARD_FAT_CHECKSUMINV]); } card->apiCallback = callback ? callback : __CARDDefaultApiCallback; diff --git a/libs/RVL_SDK/src/card/CARDMount.c b/libs/RVL_SDK/src/card/CARDMount.c index 05dece9f..971a1ab9 100644 --- a/libs/RVL_SDK/src/card/CARDMount.c +++ b/libs/RVL_SDK/src/card/CARDMount.c @@ -1,22 +1,15 @@ -#include #include +#include -#include #include +#include #include -#define SECTOR(x) ((x)*1024) +#define SECTOR(x) ((x) * 1024) static u32 SectorSizeTable[8] = { - SECTOR(8), - SECTOR(16), - SECTOR(32), - SECTOR(64), - SECTOR(128), - SECTOR(256), - 0, - 0, + SECTOR(8), SECTOR(16), SECTOR(32), SECTOR(64), SECTOR(128), SECTOR(256), 0, 0, }; static u32 LatencyTable[8] = { @@ -69,8 +62,7 @@ static BOOL IsCard(u32 id) { int CARDProbe(s32 chan) { if (__OSPADButton & 0x80) { return 0; - } - else { + } else { return EXIProbe(chan); } } @@ -89,11 +81,9 @@ static s32 DoMount(s32 chan) { if (card->mountStep == 0) { if (EXIGetID(chan, 0, &id) == 0) { result = CARD_RESULT_NOCARD; - } - else if (IsCard(id)) { + } else if (IsCard(id)) { result = CARD_RESULT_READY; - } - else { + } else { result = CARD_RESULT_WRONGDEVICE; } @@ -117,8 +107,7 @@ static s32 DoMount(s32 chan) { if (CARDGetFastMode() && (card->vendorID >> 8) == 0xEC) { card->pageSize = 512; - } - else { + } else { card->pageSize = 128; } @@ -153,8 +142,7 @@ static s32 DoMount(s32 chan) { __OSUnlockSramEx(TRUE); return result; - } - else { + } else { card->mountStep = 1; checkSum = 0; @@ -198,8 +186,8 @@ static s32 DoMount(s32 chan) { } step = card->mountStep - 2; - result = __CARDRead(chan, (u32)card->sectorSize * step, CARD_SYSTEM_BLOCK_SIZE, - (u8 *)card->workArea + (CARD_SYSTEM_BLOCK_SIZE * step), __CARDMountCallback); + result = __CARDRead(chan, (u32)card->sectorSize * step, CARD_SYSTEM_BLOCK_SIZE, (u8*)card->workArea + (CARD_SYSTEM_BLOCK_SIZE * step), + __CARDMountCallback); if (result < 0) { __CARDPutControlBlock(card, result); } @@ -222,8 +210,7 @@ void __CARDMountCallback(s32 chan, s32 result) { result = DoMount(chan); if (0 <= result) return; - } - else { + } else { result = __CARDVerify(card); } break; diff --git a/libs/RVL_SDK/src/card/CARDNet.c b/libs/RVL_SDK/src/card/CARDNet.c index b05a6d22..142ea230 100644 --- a/libs/RVL_SDK/src/card/CARDNet.c +++ b/libs/RVL_SDK/src/card/CARDNet.c @@ -1,5 +1,5 @@ -#include #include +#include u16 __CARDVendorID = -1; -u8 __CARDPermMask = 0x1C; +u8 __CARDPermMask = 0x1C; diff --git a/libs/RVL_SDK/src/card/CARDOpen.c b/libs/RVL_SDK/src/card/CARDOpen.c index 1df11c21..fefdddb6 100644 --- a/libs/RVL_SDK/src/card/CARDOpen.c +++ b/libs/RVL_SDK/src/card/CARDOpen.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -12,8 +12,7 @@ BOOL __CARDCompareFileName(CARDDir* ent, const char* fileName) { while (--n >= 0) { if ((c1 = *entName++) != (c2 = *fileName++)) { return FALSE; - } - else if (c2 == '\0') { + } else if (c2 == '\0') { return TRUE; } } @@ -30,9 +29,8 @@ s32 __CARDAccess(CARDControl* card, CARDDir* ent) { if (ent->gameName[0] == 0xFF) return CARD_RESULT_NOFILE; - if (diskID == &__CARDDiskNone - || (memcmp(ent->gameName, diskID->gameName, sizeof(ent->gameName)) == 0 - && memcmp(ent->company, diskID->company, sizeof(ent->company)) == 0)) { + if (diskID == &__CARDDiskNone || + (memcmp(ent->gameName, diskID->gameName, sizeof(ent->gameName)) == 0 && memcmp(ent->company, diskID->company, sizeof(ent->company)) == 0)) { return CARD_RESULT_READY; } @@ -48,11 +46,10 @@ s32 __CARDIsWritable(CARDControl* card, CARDDir* ent) { if (result == CARD_RESULT_NOPERM) { perm = ent->permission & __CARDPermMask; if (perm & 0x20 && (memcmp(ent->gameName, __CARDDiskNone.gameName, sizeof(ent->gameName)) == 0 && - memcmp(ent->company, __CARDDiskNone.company, sizeof(ent->company)) == 0)) { + memcmp(ent->company, __CARDDiskNone.company, sizeof(ent->company)) == 0)) { return CARD_RESULT_READY; - } - else if (perm & 0x40 && (memcmp(ent->gameName, __CARDDiskNone.gameName, sizeof(ent->gameName)) == 0 && - memcmp(ent->company, diskID->company, sizeof(ent->company)) == 0)) { + } else if (perm & 0x40 && (memcmp(ent->gameName, __CARDDiskNone.gameName, sizeof(ent->gameName)) == 0 && + memcmp(ent->company, diskID->company, sizeof(ent->company)) == 0)) { return CARD_RESULT_READY; } } @@ -118,8 +115,7 @@ s32 CARDFastOpen(s32 chan, s32 fileNo, CARDFileInfo* fileInfo) { if (0 <= result) { if (!CARDIsValidBlockNo(card, ent->startBlock)) { result = CARD_RESULT_BROKEN; - } - else { + } else { fileInfo->chan = chan; fileInfo->fileNo = fileNo; fileInfo->offset = 0; @@ -148,8 +144,7 @@ s32 CARDOpen(s32 chan, const char* fileName, CARDFileInfo* fileInfo) { ent = &dir[fileNo]; if (!CARDIsValidBlockNo(card, ent->startBlock)) { result = CARD_RESULT_BROKEN; - } - else { + } else { fileInfo->chan = chan; fileInfo->fileNo = fileNo; fileInfo->offset = 0; diff --git a/libs/RVL_SDK/src/card/CARDRdwr.c b/libs/RVL_SDK/src/card/CARDRdwr.c index 20e84b77..252971ac 100644 --- a/libs/RVL_SDK/src/card/CARDRdwr.c +++ b/libs/RVL_SDK/src/card/CARDRdwr.c @@ -1,5 +1,5 @@ -#include #include +#include static void BlockReadCallback(s32 chan, s32 result); static void BlockWriteCallback(s32 chan, s32 result); diff --git a/libs/RVL_SDK/src/card/CARDRead.c b/libs/RVL_SDK/src/card/CARDRead.c index 5e345517..45117784 100644 --- a/libs/RVL_SDK/src/card/CARDRead.c +++ b/libs/RVL_SDK/src/card/CARDRead.c @@ -1,10 +1,10 @@ -#include #include +#include #include -#define TRUNC(n, a) (((u32)(n)) & ~((a)-1)) -#define OFFSET(addr, align) (((u32)(addr) & ((align)-1))) +#define TRUNC(n, a) (((u32)(n)) & ~((a) - 1)) +#define OFFSET(addr, align) (((u32)(addr) & ((align) - 1))) static void ReadCallback(s32 chan, s32 result); @@ -88,9 +88,8 @@ static void ReadCallback(s32 chan, s32 result) { goto error; } - result = __CARDRead(chan, card->sectorSize * (u32)fileInfo->iBlock, - (fileInfo->length < card->sectorSize) ? fileInfo->length : card->sectorSize, card->buffer, - ReadCallback); + result = __CARDRead(chan, card->sectorSize * (u32)fileInfo->iBlock, (fileInfo->length < card->sectorSize) ? fileInfo->length : card->sectorSize, + card->buffer, ReadCallback); if (result < 0) { goto error; } @@ -154,13 +153,12 @@ s32 CARDCancel(CARDFileInfo* fileInfo) { CARDControl* card; enabled = OSDisableInterrupts(); - + card = &__CARDBlock[fileInfo->chan]; result = CARD_RESULT_READY; if (!card->attached) { result = CARD_RESULT_NOCARD; - } - else if (card->result == CARD_RESULT_BUSY && card->fileInfo == fileInfo) { + } else if (card->result == CARD_RESULT_BUSY && card->fileInfo == fileInfo) { fileInfo->length = -1; result = CARD_RESULT_CANCELED; } diff --git a/libs/RVL_SDK/src/card/CARDStatEx.c b/libs/RVL_SDK/src/card/CARDStatEx.c index 22b7cd9a..6e0620f7 100644 --- a/libs/RVL_SDK/src/card/CARDStatEx.c +++ b/libs/RVL_SDK/src/card/CARDStatEx.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -8,7 +8,7 @@ s32 __CARDGetStatusEx(s32 chan, s32 fileNo, CARDDir* dirent) { CARDDir* dir; CARDDir* ent; s32 result; - + if (fileNo < 0 || fileNo >= CARD_MAX_FILE) { return CARD_RESULT_FATAL_ERROR; } @@ -71,14 +71,13 @@ s32 __CARDSetStatusExAsync(s32 chan, s32 fileNo, CARDDir* dirent, CARDCallback c memset(dirent->gameName, 0, sizeof(dirent->gameName)); } - if ((memcmp(&ent->fileName, &dirent->fileName, 32) != 0) || (memcmp(ent->gameName, dirent->gameName, 4) != 0) || (memcmp(ent->company, dirent->company, 2) != 0)) { + if ((memcmp(&ent->fileName, &dirent->fileName, 32) != 0) || (memcmp(ent->gameName, dirent->gameName, 4) != 0) || + (memcmp(ent->company, dirent->company, 2) != 0)) { for (i = 0; i < CARD_MAX_FILE; i++) { if (i != fileNo) { CARDDir* ent = &dir[i]; - if (((u8)ent->gameName[0] != 0xFF) - && (memcmp(&ent->gameName, &dirent->gameName, 4) == 0) - && (memcmp(&ent->company, &dirent->company, 2) == 0) - && (memcmp(&ent->fileName, &dirent->fileName, 0x20) == 0)) { + if (((u8)ent->gameName[0] != 0xFF) && (memcmp(&ent->gameName, &dirent->gameName, 4) == 0) && + (memcmp(&ent->company, &dirent->company, 2) == 0) && (memcmp(&ent->fileName, &dirent->fileName, 0x20) == 0)) { return __CARDPutControlBlock(card, -7); } } diff --git a/libs/RVL_SDK/src/card/CARDUnlock.c b/libs/RVL_SDK/src/card/CARDUnlock.c index 931a4a9e..baacea89 100644 --- a/libs/RVL_SDK/src/card/CARDUnlock.c +++ b/libs/RVL_SDK/src/card/CARDUnlock.c @@ -1,28 +1,24 @@ -#include #include +#include #include static u8 CardData[352] ALIGN32 = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x02, 0xFF, 0x00, 0x21, 0x13, 0x06, 0x12, 0x03, 0x12, 0x04, - 0x13, 0x05, 0x00, 0x92, 0x00, 0xFF, 0x00, 0x88, 0xFF, 0xFF, 0x00, 0x89, 0xFF, 0xFF, 0x00, 0x8A, 0xFF, 0xFF, 0x00, - 0x8B, 0xFF, 0xFF, 0x8F, 0x00, 0x02, 0xBF, 0x00, 0x88, 0x16, 0xFC, 0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x00, 0x16, 0xFB, - 0x00, 0x01, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x03, 0x80, 0xFF, 0x00, 0x02, 0x94, 0x00, 0x27, 0x02, 0xBF, 0x00, - 0x8E, 0x1F, 0xDF, 0x24, 0xFF, 0x02, 0x40, 0x3F, 0xFF, 0x00, 0x98, 0x04, 0x00, 0x00, 0x9A, 0x00, 0x10, 0x00, 0x99, - 0x00, 0x00, 0x8E, 0x00, 0x02, 0xBF, 0x00, 0x94, 0x02, 0xBF, 0x86, 0x44, 0x02, 0xBF, 0x00, 0x88, 0x16, 0xFC, 0xDC, - 0xD1, 0x16, 0xFD, 0x00, 0x03, 0x16, 0xFB, 0x00, 0x01, 0x8F, 0x00, 0x02, 0xBF, 0x00, 0x8E, 0x03, 0x80, 0xCD, 0xD1, - 0x02, 0x94, 0x00, 0x48, 0x27, 0xFF, 0x03, 0x80, 0x00, 0x01, 0x02, 0x95, 0x00, 0x5A, 0x03, 0x80, 0x00, 0x02, 0x02, - 0x95, 0x80, 0x00, 0x02, 0x9F, 0x00, 0x48, 0x00, 0x21, 0x8E, 0x00, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x02, 0xBF, - 0x00, 0x8E, 0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC5, 0xFF, 0xFF, 0x03, - 0x40, 0x3F, 0xFF, 0x1C, 0x9F, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC7, 0xFF, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC6, - 0xFF, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC0, 0xFF, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x20, 0xFF, 0x03, 0x40, 0x3F, - 0xFF, 0x1F, 0x5F, 0x02, 0xBF, 0x00, 0x8E, 0x21, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x23, 0xFF, 0x12, 0x05, 0x12, 0x06, - 0x02, 0x9F, 0x80, 0xB5, 0x00, 0x21, 0x27, 0xFC, 0x03, 0xC0, 0x80, 0x00, 0x02, 0x9D, 0x00, 0x88, 0x02, 0xDF, 0x27, - 0xFE, 0x03, 0xC0, 0x80, 0x00, 0x02, 0x9C, 0x00, 0x8E, 0x02, 0xDF, 0x2E, 0xCE, 0x2C, 0xCF, 0x00, 0xF8, 0xFF, 0xCD, - 0x00, 0xF9, 0xFF, 0xC9, 0x00, 0xFA, 0xFF, 0xCB, 0x26, 0xC9, 0x02, 0xC0, 0x00, 0x04, 0x02, 0x9D, 0x00, 0x9C, 0x02, - 0xDF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x21, 0x02, 0xFF, 0x00, 0x21, 0x13, 0x06, 0x12, 0x03, 0x12, 0x04, 0x13, 0x05, 0x00, 0x92, 0x00, 0xFF, 0x00, 0x88, 0xFF, 0xFF, + 0x00, 0x89, 0xFF, 0xFF, 0x00, 0x8A, 0xFF, 0xFF, 0x00, 0x8B, 0xFF, 0xFF, 0x8F, 0x00, 0x02, 0xBF, 0x00, 0x88, 0x16, 0xFC, 0xDC, 0xD1, 0x16, 0xFD, + 0x00, 0x00, 0x16, 0xFB, 0x00, 0x01, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x03, 0x80, 0xFF, 0x00, 0x02, 0x94, 0x00, 0x27, 0x02, 0xBF, 0x00, 0x8E, + 0x1F, 0xDF, 0x24, 0xFF, 0x02, 0x40, 0x3F, 0xFF, 0x00, 0x98, 0x04, 0x00, 0x00, 0x9A, 0x00, 0x10, 0x00, 0x99, 0x00, 0x00, 0x8E, 0x00, 0x02, 0xBF, + 0x00, 0x94, 0x02, 0xBF, 0x86, 0x44, 0x02, 0xBF, 0x00, 0x88, 0x16, 0xFC, 0xDC, 0xD1, 0x16, 0xFD, 0x00, 0x03, 0x16, 0xFB, 0x00, 0x01, 0x8F, 0x00, + 0x02, 0xBF, 0x00, 0x8E, 0x03, 0x80, 0xCD, 0xD1, 0x02, 0x94, 0x00, 0x48, 0x27, 0xFF, 0x03, 0x80, 0x00, 0x01, 0x02, 0x95, 0x00, 0x5A, 0x03, 0x80, + 0x00, 0x02, 0x02, 0x95, 0x80, 0x00, 0x02, 0x9F, 0x00, 0x48, 0x00, 0x21, 0x8E, 0x00, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E, + 0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x25, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC5, 0xFF, 0xFF, 0x03, 0x40, 0x3F, 0xFF, 0x1C, 0x9F, 0x02, 0xBF, + 0x00, 0x8E, 0x00, 0xC7, 0xFF, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC6, 0xFF, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x00, 0xC0, 0xFF, 0xFF, 0x02, 0xBF, + 0x00, 0x8E, 0x20, 0xFF, 0x03, 0x40, 0x3F, 0xFF, 0x1F, 0x5F, 0x02, 0xBF, 0x00, 0x8E, 0x21, 0xFF, 0x02, 0xBF, 0x00, 0x8E, 0x23, 0xFF, 0x12, 0x05, + 0x12, 0x06, 0x02, 0x9F, 0x80, 0xB5, 0x00, 0x21, 0x27, 0xFC, 0x03, 0xC0, 0x80, 0x00, 0x02, 0x9D, 0x00, 0x88, 0x02, 0xDF, 0x27, 0xFE, 0x03, 0xC0, + 0x80, 0x00, 0x02, 0x9C, 0x00, 0x8E, 0x02, 0xDF, 0x2E, 0xCE, 0x2C, 0xCF, 0x00, 0xF8, 0xFF, 0xCD, 0x00, 0xF9, 0xFF, 0xC9, 0x00, 0xFA, 0xFF, 0xCB, + 0x26, 0xC9, 0x02, 0xC0, 0x00, 0x04, 0x02, 0x9D, 0x00, 0x9C, 0x02, 0xDF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; static u32 next = 1; @@ -84,13 +80,11 @@ static u32 bitrev(u32 data) { if (i > 15) { if (i == 31) { wk |= (((data & (0x01 << 31)) >> 31) & 0x01); - } - else { + } else { wk |= ((data & (0x01 << i)) >> j); j += 2; } - } - else { + } else { wk |= ((data & (0x01 << i)) << (31 - i - k)); k++; } @@ -122,15 +116,14 @@ static s32 ReadArrayUnlock(s32 chan, u32 data, void* rbuf, s32 rlen, int mode) { cmd[2] = SEC_AD2(data); cmd[3] = SEC_AD3(data); cmd[4] = SEC_BA(data); - } - else { + } else { cmd[1] = (u8)((data & 0xff000000) >> 24); cmd[2] = (u8)((data & 0x00ff0000) >> 16); } err = FALSE; err |= !EXIImmEx(chan, cmd, 5, 1); - err |= !EXIImmEx(chan, (u8* )card->workArea + (u32)sizeof(CARDID), card->latency, 1); + err |= !EXIImmEx(chan, (u8*)card->workArea + (u32)sizeof(CARDID), card->latency, 1); err |= !EXIImmEx(chan, rbuf, rlen, 0); err |= !EXIDeselect(chan); @@ -212,7 +205,7 @@ s32 __CARDUnlock(s32 chan, u8 flashID[12]) { card = &__CARDBlock[chan]; task = &card->task; param = (CARDDecParam*)card->workArea; - input = (u8*)((u8* )param + sizeof(CARDDecParam)); + input = (u8*)((u8*)param + sizeof(CARDDecParam)); input = (u8*)OSRoundUp32B(input); output = input + 32; @@ -326,10 +319,12 @@ static void InitCallback(void* _task) { param = (CARDDecParam*)card->workArea; DSPSendMailToDSP(0xff000000); - while (DSPCheckMailToDSP()) {} + while (DSPCheckMailToDSP()) { + } DSPSendMailToDSP((u32)param); - while (DSPCheckMailToDSP()) {} + while (DSPCheckMailToDSP()) { + } } static void DoneCallback(void* _task) { diff --git a/libs/RVL_SDK/src/card/CARDWrite.c b/libs/RVL_SDK/src/card/CARDWrite.c index 859c4114..c3767589 100644 --- a/libs/RVL_SDK/src/card/CARDWrite.c +++ b/libs/RVL_SDK/src/card/CARDWrite.c @@ -1,7 +1,7 @@ -#include #include +#include -#define OFFSET(addr, align) (((u32)(addr) & ((align)-1))) +#define OFFSET(addr, align) (((u32)(addr) & ((align) - 1))) static void WriteCallback(s32 chan, s32 result); static void EraseCallback(s32 chan, s32 result); @@ -25,13 +25,12 @@ static void WriteCallback(s32 chan, s32 result) { if (fileInfo->length <= 0) { dir = __CARDGetDirBlock(card); ent = dir + fileInfo->fileNo; - ent->time = OSGetTime()/(__OSBusClock/4); + ent->time = OSGetTime() / (__OSBusClock / 4); callback = card->apiCallback; card->apiCallback = NULL; result = __CARDUpdateDir(chan, callback); goto check; - } - else { + } else { fat = __CARDGetFatBlock(card); fileInfo->offset += card->sectorSize; fileInfo->iBlock = fat[fileInfo->iBlock]; @@ -40,14 +39,13 @@ static void WriteCallback(s32 chan, s32 result) { goto after; } result = __CARDEraseSector(chan, card->sectorSize * fileInfo->iBlock, EraseCallback); -check: + check: if (result < 0) { goto after; } } - } - else { -after: + } else { + after: callback = card->apiCallback; card->apiCallback = NULL; __CARDPutControlBlock(card, result); @@ -67,9 +65,8 @@ static void EraseCallback(s32 chan, s32 result) { if (result < 0) { goto after; } - } - else { -after: + } else { + after: callback = card->apiCallback; card->apiCallback = NULL; __CARDPutControlBlock(card, result); diff --git a/libs/RVL_SDK/src/cnt/cnt.c b/libs/RVL_SDK/src/cnt/cnt.c index 7cdc89a3..e96ec247 100644 --- a/libs/RVL_SDK/src/cnt/cnt.c +++ b/libs/RVL_SDK/src/cnt/cnt.c @@ -1,15 +1,15 @@ #include +#include #include #include -#include -#include -#include #include +#include +#include +#include #include #include -#include DECOMP_FORCE_ACTIVE(cnt_c, "<< RVL_SDK - CNT \trelease build: Apr 20 2010 11:21:37 (0x4199_60831) >>"); DECOMP_FORCE_ACTIVE(cnt_c, "/content%d"); @@ -19,18 +19,18 @@ typedef struct FSTEntry { u32 isDirAndStringOff; // 0x00 union { struct { - u32 parent; // 0x04 - u32 next; // 0x08 + u32 parent; // 0x04 + u32 next; // 0x08 } dir; struct { - u32 position; // 0x04 - u32 length; // 0x08 + u32 position; // 0x04 + u32 length; // 0x08 } file; }; } FSTEntry; -#define IS_ENTRY_DIR(fstStart, i) ((((fstStart)[i].isDirAndStringOff & 0xFF000000) == 0) ? FALSE : TRUE) -#define FILE_STRING_OFF(fstStart, i) ((fstStart)[i].isDirAndStringOff & 0x00FFFFFF) +#define IS_ENTRY_DIR(fstStart, i) ((((fstStart)[i].isDirAndStringOff & 0xFF000000) == 0) ? FALSE : TRUE) +#define FILE_STRING_OFF(fstStart, i) ((fstStart)[i].isDirAndStringOff & 0x00FFFFFF) static BOOL isSame(const char* path, const char* string) { while (*string != 0) { @@ -52,13 +52,13 @@ s32 contentConvertPathToEntrynumDVD(CNTHandleDVD* cntHandle, const char* path); #pragma force_active on CNTError contentInitHandleNAND(u32 contentId, CNTHandleNAND* cntHandle, MEMAllocator* allocator) { - ARCHeader arcHeader ALIGN32; - ARCHandle arcHandle; + ARCHeader arcHeader ALIGN32; + ARCHandle arcHandle; - void* buffer; - u32 size; + void* buffer; + u32 size; - s32 fd, ret; + s32 fd, ret; fd = ESP_OpenContentFile(contentId); if (fd < ES_ERR_OK) { @@ -97,8 +97,8 @@ CNTError contentInitHandleNAND(u32 contentId, CNTHandleNAND* cntHandle, MEMAlloc } CNTError contentOpenNAND(CNTHandleNAND* cntHandle, const char* path, CNTFileInfoNAND* cntFileInfo) { - s32 entryNum; - CNTError ret; + s32 entryNum; + CNTError ret; ARCFileInfo arcFile; @@ -120,8 +120,8 @@ CNTError contentOpenNAND(CNTHandleNAND* cntHandle, const char* path, CNTFileInfo } s32 contentOpenDVD(CNTHandleDVD* cntHandle, const char* path, CNTFileInfoDVD* cntFileInfo) { - s32 entryNum; - CNTError ret; + s32 entryNum; + CNTError ret; ARCFileInfo arcFile; @@ -140,7 +140,7 @@ s32 contentOpenDVD(CNTHandleDVD* cntHandle, const char* path, CNTFileInfoDVD* cn } CNTError contentFastOpenNAND(CNTHandleNAND* cntHandle, s32 entryNum, CNTFileInfoNAND* cntFileInfo) { - CNTError ret; + CNTError ret; ARCFileInfo arcFile; @@ -162,27 +162,27 @@ CNTError contentConvertPathToEntrynumNAND(CNTHandleNAND* cntHandle, const char* s32 contentConvertPathToEntrynumDVD(CNTHandleDVD* cntHandle, const char* path) { const char* ptrPath; - char* name; + char* name; BOOL isDir; - s32 pathLen, dirLookAt, i; + s32 pathLen, dirLookAt, i; const char* origPathPtr = path; - FSTEntry* FSTEntries; - u32 MaxEntryNum; - char* FSTStringStart; + FSTEntry* FSTEntries; + u32 MaxEntryNum; + char* FSTStringStart; - dirLookAt = cntHandle->currDir; - FSTEntries = DVDGetFSTLocation(); - MaxEntryNum = FSTEntries[0].dir.next; - FSTStringStart = (char*)&(FSTEntries[MaxEntryNum]); + dirLookAt = cntHandle->currDir; + FSTEntries = DVDGetFSTLocation(); + MaxEntryNum = FSTEntries[0].dir.next; + FSTStringStart = (char*)&(FSTEntries[MaxEntryNum]); while (TRUE) { // End of path? Done! if (*path == 0) { return dirLookAt; - } + } // Ignore initial slash. else if (*path == '/') { dirLookAt = cntHandle->rootDir; @@ -202,37 +202,38 @@ s32 contentConvertPathToEntrynumDVD(CNTHandleDVD* cntHandle, const char* path) { continue; } // If the input path was literally just `../`, then return the parent. - else if (*(path+2) == 0) { + else if (*(path + 2) == 0) { return FSTEntries[dirLookAt].dir.parent; } } // "." directory does nothing - else if (*(path+1) == '/') { + else if (*(path + 1) == '/') { path += 2; continue; } // Ignore trailing dot - else if (*(path+1) == 0) { + else if (*(path + 1) == 0) { return dirLookAt; } } - for (ptrPath = path; (*ptrPath != 0) && (*ptrPath != '/'); ptrPath++) {} + for (ptrPath = path; (*ptrPath != 0) && (*ptrPath != '/'); ptrPath++) { + } isDir = (*ptrPath == 0) ? FALSE : TRUE; pathLen = (u32)(ptrPath - path); ptrPath = path; - for (i = dirLookAt+1; i < FSTEntries[dirLookAt].dir.next; i = IS_ENTRY_DIR(FSTEntries, i) ? FSTEntries[i].dir.next : (i + 1)) { -loop_back: + for (i = dirLookAt + 1; i < FSTEntries[dirLookAt].dir.next; i = IS_ENTRY_DIR(FSTEntries, i) ? FSTEntries[i].dir.next : (i + 1)) { + loop_back: if (IS_ENTRY_DIR(FSTEntries, i) == FALSE && isDir == TRUE) { continue; } name = FSTStringStart + FILE_STRING_OFF(FSTEntries, i); - if (*name == '.' && *(name+1) == 0) { + if (*name == '.' && *(name + 1) == 0) { i++; goto loop_back; } @@ -245,7 +246,7 @@ loop_back: return -1; -next_in_hier: + next_in_hier: if (!isDir) { return i; } @@ -312,7 +313,7 @@ CNTError contentSeekDVD(CNTFileInfoDVD* cntFileInfo, s32 offset, u32 whence) { } CNTError contentReadNAND(CNTFileInfoNAND* cntFileInfo, void* buffer, u32 length, s32 offset) { - CNTError ret; + CNTError ret; s32 curOff = cntFileInfo->readOffset + offset; if (curOff < 0 || curOff > cntFileInfo->length) { @@ -333,8 +334,7 @@ CNTError contentReadDVD(CNTFileInfoDVD* cntFileInfo, void* buffer, u32 length, s readSize = DVDReadPrio(&cntFileInfo->fileInfo, buffer, length, offset + cntFileInfo->readOffset, 2); if (readSize >= 0) { return readSize; - } - else { + } else { return CNT_RESULT_READ_ERR; } } @@ -351,8 +351,8 @@ CNTError contentCloseDVD(CNTFileInfoDVD* cntFileInfo) { CNTError contentReleaseHandleNAND(CNTHandleNAND* cntFileInfo) { ESError ret; - - MEMFreeToAllocator(cntFileInfo->allocator,cntFileInfo->ArcHandle.archiveStartAddr); + + MEMFreeToAllocator(cntFileInfo->allocator, cntFileInfo->ArcHandle.archiveStartAddr); ret = ESP_CloseContentFile(cntFileInfo->FileDescriptor); return __CNTConvertErrorCode(ret); } @@ -364,89 +364,168 @@ BOOL contentOpenDirNAND(CNTHandleNAND* cntFileInfo, const char* path, ARCDir* di CNTError __CNTConvertErrorCode(s32 result) { int errorMap[] = { // ES codes - ES_ERR_OK, CNT_RESULT_OK, - -1001, CNT_RESULT_UNKNOWN, - -1002, CNT_RESULT_UNKNOWN, - -1003, CNT_RESULT_UNKNOWN, - -1004, CNT_RESULT_UNKNOWN, - ES_ERR_INVALID_PUB_KEY_TYPE, CNT_RESULT_UNKNOWN, - -1006, CNT_RESULT_UNKNOWN, - -1007, CNT_RESULT_UNKNOWN, - -1008, CNT_RESULT_UNKNOWN, - ES_ERR_FILE_READ_FAILED, CNT_RESULT_UNKNOWN, - ES_ERR_FILE_WRITE_FAILED, CNT_RESULT_UNKNOWN, - -1011, CNT_RESULT_UNKNOWN, - ES_ERR_INVALID_SIGNATURE, CNT_RESULT_UNKNOWN, - -1013, CNT_RESULT_UNKNOWN, - -1014, CNT_RESULT_UNKNOWN, - -1015, CNT_RESULT_UNKNOWN, - ES_ERR_TMD_MAXFD, CNT_RESULT_MAXFD, - ES_ERR_INVALID, CNT_RESULT_INVALID, - -1018, CNT_RESULT_UNKNOWN, - ES_ERR_INVALID_UNKNOWN, CNT_RESULT_UNKNOWN, - ES_ERR_INVALID_DEVICE_ID, CNT_RESULT_UNKNOWN, - -1021, CNT_RESULT_UNKNOWN, - ES_ERR_INVALID_CONTENT_HASH, CNT_RESULT_UNKNOWN, - -1023, CNT_RESULT_UNKNOWN, - ES_ERR_MEMORY_ERROR, CNT_RESULT_OUT_OF_MEMORY, - ES_ERR_NO_TMD_FILE_FOUND, CNT_RESULT_UNKNOWN, - ES_ERR_TMD_INVALID_RIGHT, CNT_RESULT_ACCESS, - ES_ERR_ISSUER_NOT_FOUND, CNT_RESULT_UNKNOWN, - ES_ERR_TICKET_NOT_FOUND, CNT_RESULT_UNKNOWN, - ES_ERR_INVALID_TICKET, CNT_RESULT_UNKNOWN, - -1030, CNT_RESULT_UNKNOWN, - ES_ERR_INVALID_BOOT2, CNT_RESULT_UNKNOWN, - ES_ERR_UNKNOWN_FATAL, CNT_RESULT_UNKNOWN, - ES_ERR_TICKET_EXPIRED, CNT_RESULT_UNKNOWN, - -1034, CNT_RESULT_UNKNOWN, - ES_ERR_INVALID_TITLE_VER, CNT_RESULT_UNKNOWN, - ES_ERR_BAD_SYSMENU_TICKET, CNT_RESULT_UNKNOWN, - ES_ERR_BAD_SYSMENU_CONTENTS, CNT_RESULT_UNKNOWN, - -1038, CNT_RESULT_UNKNOWN, + ES_ERR_OK, + CNT_RESULT_OK, + -1001, + CNT_RESULT_UNKNOWN, + -1002, + CNT_RESULT_UNKNOWN, + -1003, + CNT_RESULT_UNKNOWN, + -1004, + CNT_RESULT_UNKNOWN, + ES_ERR_INVALID_PUB_KEY_TYPE, + CNT_RESULT_UNKNOWN, + -1006, + CNT_RESULT_UNKNOWN, + -1007, + CNT_RESULT_UNKNOWN, + -1008, + CNT_RESULT_UNKNOWN, + ES_ERR_FILE_READ_FAILED, + CNT_RESULT_UNKNOWN, + ES_ERR_FILE_WRITE_FAILED, + CNT_RESULT_UNKNOWN, + -1011, + CNT_RESULT_UNKNOWN, + ES_ERR_INVALID_SIGNATURE, + CNT_RESULT_UNKNOWN, + -1013, + CNT_RESULT_UNKNOWN, + -1014, + CNT_RESULT_UNKNOWN, + -1015, + CNT_RESULT_UNKNOWN, + ES_ERR_TMD_MAXFD, + CNT_RESULT_MAXFD, + ES_ERR_INVALID, + CNT_RESULT_INVALID, + -1018, + CNT_RESULT_UNKNOWN, + ES_ERR_INVALID_UNKNOWN, + CNT_RESULT_UNKNOWN, + ES_ERR_INVALID_DEVICE_ID, + CNT_RESULT_UNKNOWN, + -1021, + CNT_RESULT_UNKNOWN, + ES_ERR_INVALID_CONTENT_HASH, + CNT_RESULT_UNKNOWN, + -1023, + CNT_RESULT_UNKNOWN, + ES_ERR_MEMORY_ERROR, + CNT_RESULT_OUT_OF_MEMORY, + ES_ERR_NO_TMD_FILE_FOUND, + CNT_RESULT_UNKNOWN, + ES_ERR_TMD_INVALID_RIGHT, + CNT_RESULT_ACCESS, + ES_ERR_ISSUER_NOT_FOUND, + CNT_RESULT_UNKNOWN, + ES_ERR_TICKET_NOT_FOUND, + CNT_RESULT_UNKNOWN, + ES_ERR_INVALID_TICKET, + CNT_RESULT_UNKNOWN, + -1030, + CNT_RESULT_UNKNOWN, + ES_ERR_INVALID_BOOT2, + CNT_RESULT_UNKNOWN, + ES_ERR_UNKNOWN_FATAL, + CNT_RESULT_UNKNOWN, + ES_ERR_TICKET_EXPIRED, + CNT_RESULT_UNKNOWN, + -1034, + CNT_RESULT_UNKNOWN, + ES_ERR_INVALID_TITLE_VER, + CNT_RESULT_UNKNOWN, + ES_ERR_BAD_SYSMENU_TICKET, + CNT_RESULT_UNKNOWN, + ES_ERR_BAD_SYSMENU_CONTENTS, + CNT_RESULT_UNKNOWN, + -1038, + CNT_RESULT_UNKNOWN, // FS codes - ISFS_ERROR_OK, CNT_RESULT_OK, - ISFS_ERROR_ACCESS, CNT_RESULT_ACCESS, - ISFS_ERROR_CORRUPT, CNT_RESULT_CORRUPT, - ISFS_ERROR_ECC_CRIT, CNT_RESULT_ECC_CRIT, - ISFS_ERROR_EXISTS, CNT_RESULT_UNKNOWN, - ISFS_ERROR_AUTHENTICATION, CNT_RESULT_AUTHENTICATION, - ISFS_ERROR_INVALID, CNT_RESULT_INVALID, - ISFS_ERROR_MAXBLOCKS, CNT_RESULT_UNKNOWN, - ISFS_ERROR_MAXFD, CNT_RESULT_MAXFD, - ISFS_ERROR_MAXFILES, CNT_RESULT_UNKNOWN, - ISFS_ERROR_NOEXISTS, CNT_RESULT_INVALID, - ISFS_ERROR_NOTEMPTY, CNT_RESULT_UNKNOWN, - ISFS_ERROR_NOTREADY, CNT_RESULT_UNKNOWN, - ISFS_ERROR_OPENFD, CNT_RESULT_UNKNOWN, - ISFS_ERROR_UNKNOWN, CNT_RESULT_UNKNOWN, - ISFS_ERROR_BUSY, CNT_RESULT_OUT_OF_MEMORY, // ...? - ISFS_ERROR_SHUTDOWN, CNT_RESULT_SHUTDOWN, + ISFS_ERROR_OK, + CNT_RESULT_OK, + ISFS_ERROR_ACCESS, + CNT_RESULT_ACCESS, + ISFS_ERROR_CORRUPT, + CNT_RESULT_CORRUPT, + ISFS_ERROR_ECC_CRIT, + CNT_RESULT_ECC_CRIT, + ISFS_ERROR_EXISTS, + CNT_RESULT_UNKNOWN, + ISFS_ERROR_AUTHENTICATION, + CNT_RESULT_AUTHENTICATION, + ISFS_ERROR_INVALID, + CNT_RESULT_INVALID, + ISFS_ERROR_MAXBLOCKS, + CNT_RESULT_UNKNOWN, + ISFS_ERROR_MAXFD, + CNT_RESULT_MAXFD, + ISFS_ERROR_MAXFILES, + CNT_RESULT_UNKNOWN, + ISFS_ERROR_NOEXISTS, + CNT_RESULT_INVALID, + ISFS_ERROR_NOTEMPTY, + CNT_RESULT_UNKNOWN, + ISFS_ERROR_NOTREADY, + CNT_RESULT_UNKNOWN, + ISFS_ERROR_OPENFD, + CNT_RESULT_UNKNOWN, + ISFS_ERROR_UNKNOWN, + CNT_RESULT_UNKNOWN, + ISFS_ERROR_BUSY, + CNT_RESULT_OUT_OF_MEMORY, // ...? + ISFS_ERROR_SHUTDOWN, + CNT_RESULT_SHUTDOWN, // IPC codes - IPC_RESULT_ACCESS, CNT_RESULT_ACCESS, - IPC_RESULT_EXISTS, CNT_RESULT_UNKNOWN, - IPC_RESULT_INTR, CNT_RESULT_UNKNOWN, - IPC_RESULT_INVALID, CNT_RESULT_INVALID, - IPC_RESULT_MAX, CNT_RESULT_UNKNOWN, - IPC_RESULT_NOEXISTS, CNT_RESULT_INVALID, - IPC_RESULT_EMPTYQUEUE, CNT_RESULT_UNKNOWN, - IPL_RESULT_FULLQUEUE, CNT_RESULT_OUT_OF_MEMORY, - IPC_RESULT_UNKNOWN, CNT_RESULT_UNKNOWN, - IPC_RESULT_NOTREADY, CNT_RESULT_UNKNOWN, - IPC_RESULT_ECC, CNT_RESULT_UNKNOWN, - IPC_RESULT_ECC_CRIT, CNT_RESULT_ECC_CRIT, - IPC_RESULT_BADBLOCK, CNT_RESULT_UNKNOWN, - IPC_RESULT_INVALID_OBJTYPE, CNT_RESULT_UNKNOWN, - IPC_RESULT_INVALID_RNG, CNT_RESULT_UNKNOWN, - IPC_RESULT_INVALID_FLAG, CNT_RESULT_UNKNOWN, - IPC_RESULT_INVALID_FORMAT, CNT_RESULT_UNKNOWN, - IPC_RESULT_INVALID_VERSION, CNT_RESULT_UNKNOWN, - IPC_RESULT_INVALID_SIGNATURE, CNT_RESULT_UNKNOWN, - IPC_RESULT_VERIFY_FAILED, CNT_RESULT_UNKNOWN, - IPC_RESULT_INTERNAL_FAILURE, CNT_RESULT_UNKNOWN, - IPC_RESULT_ALLOC_FAILED, CNT_RESULT_OUT_OF_MEMORY, - IPC_RESULT_INVALID_SIZE, CNT_RESULT_UNKNOWN, + IPC_RESULT_ACCESS, + CNT_RESULT_ACCESS, + IPC_RESULT_EXISTS, + CNT_RESULT_UNKNOWN, + IPC_RESULT_INTR, + CNT_RESULT_UNKNOWN, + IPC_RESULT_INVALID, + CNT_RESULT_INVALID, + IPC_RESULT_MAX, + CNT_RESULT_UNKNOWN, + IPC_RESULT_NOEXISTS, + CNT_RESULT_INVALID, + IPC_RESULT_EMPTYQUEUE, + CNT_RESULT_UNKNOWN, + IPL_RESULT_FULLQUEUE, + CNT_RESULT_OUT_OF_MEMORY, + IPC_RESULT_UNKNOWN, + CNT_RESULT_UNKNOWN, + IPC_RESULT_NOTREADY, + CNT_RESULT_UNKNOWN, + IPC_RESULT_ECC, + CNT_RESULT_UNKNOWN, + IPC_RESULT_ECC_CRIT, + CNT_RESULT_ECC_CRIT, + IPC_RESULT_BADBLOCK, + CNT_RESULT_UNKNOWN, + IPC_RESULT_INVALID_OBJTYPE, + CNT_RESULT_UNKNOWN, + IPC_RESULT_INVALID_RNG, + CNT_RESULT_UNKNOWN, + IPC_RESULT_INVALID_FLAG, + CNT_RESULT_UNKNOWN, + IPC_RESULT_INVALID_FORMAT, + CNT_RESULT_UNKNOWN, + IPC_RESULT_INVALID_VERSION, + CNT_RESULT_UNKNOWN, + IPC_RESULT_INVALID_SIGNATURE, + CNT_RESULT_UNKNOWN, + IPC_RESULT_VERIFY_FAILED, + CNT_RESULT_UNKNOWN, + IPC_RESULT_INTERNAL_FAILURE, + CNT_RESULT_UNKNOWN, + IPC_RESULT_ALLOC_FAILED, + CNT_RESULT_OUT_OF_MEMORY, + IPC_RESULT_INVALID_SIZE, + CNT_RESULT_UNKNOWN, }; int i = 0; @@ -457,17 +536,18 @@ CNTError __CNTConvertErrorCode(s32 result) { for (; i < ARRAY_LENGTH(errorMap); i += 2) { if (errorMap[i] == result) { - if (result == ISFS_ERROR_ECC_CRIT || result == ISFS_ERROR_AUTHENTICATION || result == ISFS_ERROR_UNKNOWN - || result == IPC_RESULT_UNKNOWN || result == IPC_RESULT_ECC_CRIT) { + if (result == ISFS_ERROR_ECC_CRIT || result == ISFS_ERROR_AUTHENTICATION || result == ISFS_ERROR_UNKNOWN || + result == IPC_RESULT_UNKNOWN || result == IPC_RESULT_ECC_CRIT) { char buf[128] ALIGN64; sprintf(buf, "ES error code: %d", result); NANDLoggingAddMessageAsync(NULL, buf); } - return errorMap[i+1]; + return errorMap[i + 1]; } } - OSReport("CAUTION! Unexpected error code [%d] was found.\n", result); { + OSReport("CAUTION! Unexpected error code [%d] was found.\n", result); + { char buf[128] ALIGN64; sprintf(buf, "ES unexpected error code: %d", result); NANDLoggingAddMessageAsync(NULL, buf); diff --git a/libs/RVL_SDK/src/cntcache/cntcache.c b/libs/RVL_SDK/src/cntcache/cntcache.c index 565df4e8..34c8975c 100644 --- a/libs/RVL_SDK/src/cntcache/cntcache.c +++ b/libs/RVL_SDK/src/cntcache/cntcache.c @@ -2,25 +2,25 @@ #include -#include #include +#include #include +#include #include #include #include #include -#include SDKDefineVersion(CNTCACHE, "Apr 20 2010", "14:15:28"); OSMutex _CNTCACHEMutex; -int _CNTCACHEUnused816997A8; -int _CNTCACHEUnused816997A4; +int _CNTCACHEUnused816997A8; +int _CNTCACHEUnused816997A4; -BOOL _CNTCACHEInitialized; +BOOL _CNTCACHEInitialized; void CNTCACHEClear(); BOOL _CNTCACHEIsTitleRemovable(ESTitleId titleId); @@ -51,13 +51,12 @@ void _CNTCACHEDeleteTitle() { errno = 0; titleId = strtoull(tok, NULL, 16); - + if (errno == 0 && NANDTitleIdHi(titleId) != 0x00000001) { BOOL result = _CNTCACHEIsTitleRemovable(titleId); if (result == TRUE) { ES_DeleteTitle(titleId); - } - else if (result == FALSE) { + } else if (result == FALSE) { ES_DeleteTitleContent(titleId); } } @@ -66,7 +65,7 @@ void _CNTCACHEDeleteTitle() { } static int GetSavePath(ESTitleId titleId) { - char nandPath[64] ALIGN32; + char nandPath[64] ALIGN32; s32 ret; u32 usedBlocks = 1; @@ -77,12 +76,10 @@ static int GetSavePath(ESTitleId titleId) { if (ret == NAND_RESULT_NOEXISTS) { ret = 2; - } - else if (ret >= NAND_RESULT_OK) { + } else if (ret >= NAND_RESULT_OK) { if (usedINodes == 1 && usedBlocks == 0) { ret = 1; - } - else { + } else { ret = 0; } } @@ -106,9 +103,9 @@ out: return ret; } -int _CNTCACHEIsTitleRemovable(ESTitleId titleId) { - ESTmdView tmd ALIGN32; - s32 ret = -1; +int _CNTCACHEIsTitleRemovable(ESTitleId titleId) { + ESTmdView tmd ALIGN32; + s32 ret = -1; ret = GetSavePath(titleId); if (ret == 1) { @@ -119,8 +116,7 @@ int _CNTCACHEIsTitleRemovable(ESTitleId titleId) { if (tmd.head.titleVersion >> 8 == 0) { ret = 1; - } - else { + } else { ret = 0; } goto out; diff --git a/libs/RVL_SDK/src/cx/CXSecureUncompression.c b/libs/RVL_SDK/src/cx/CXSecureUncompression.c index 999bd7a6..37ef73de 100644 --- a/libs/RVL_SDK/src/cx/CXSecureUncompression.c +++ b/libs/RVL_SDK/src/cx/CXSecureUncompression.c @@ -62,8 +62,7 @@ CXSecureResult CXSecureUncompressRL(const void* src, u32 length, void* dst) { do *pDst++ = *pSrc++; while (--runLength > 0); - } - else { + } else { u8 byte; runLength += 3; @@ -147,15 +146,13 @@ CXSecureResult CXSecureUncompressLZ(const void* src, u32 length, void* dst) { } size--; - } - else { + } else { s32 length2 = *pSrc >> 4; s32 offset; if (!stat) { length2 += 3; - } - else { + } else { if (length2 == 0x01) { length2 = (*pSrc++ & 0x0F) << 12; length2 |= *pSrc++ << 4; @@ -163,15 +160,13 @@ CXSecureResult CXSecureUncompressLZ(const void* src, u32 length, void* dst) { length2 += 0x111; remainingLength -= 2; - } - else if (length2 == 0x00) { + } else if (length2 == 0x00) { length2 = (*pSrc++ & 0x0F) << 4; length2 |= *pSrc >> 4; length2 += 0x11; remainingLength -= 1; - } - else { + } else { length2 += 0x01; } } @@ -226,8 +221,7 @@ CXSecureResult CXSecureUncompressLZ(const void* src, u32 length, void* dst) { return CX_SECURE_ERR_OK; } -BOOL CXiVerifyHuffmanTable_(const void* param_1, u8 param_2) -{ +BOOL CXiVerifyHuffmanTable_(const void* param_1, u8 param_2) { const u8* a = param_1; const u8* b = a + 1; u32 c = *a; @@ -309,8 +303,7 @@ CXSecureResult CXSecureUncompressHuffman(const void* src, u32 length, void* dst) } size = CXiConvertEndian32_(IN_BUFFER_AT(u32, pSrc, 4)); - } - else { + } else { if (length < e + 4) { return CX_SECURE_ERR_BUFFER_TOO_SMALL; } diff --git a/libs/RVL_SDK/src/cx/CXStreamingUncompression.c b/libs/RVL_SDK/src/cx/CXStreamingUncompression.c index 38d9f3ff..f7729126 100644 --- a/libs/RVL_SDK/src/cx/CXStreamingUncompression.c +++ b/libs/RVL_SDK/src/cx/CXStreamingUncompression.c @@ -1,8 +1,8 @@ #include #include -static inline int CXiReadHeader(u8*, int*, const u8*, int, int); -static inline u8* GetNextNode(u8*, int); +static inline int CXiReadHeader(u8*, int*, const u8*, int, int); +static inline u8* GetNextNode(u8*, int); void CXInitUncompContextRL(CXUncompContextRL* context, u8* param_2) { context->unk_0x00 = param_2; @@ -67,7 +67,7 @@ CXStreamingResult CXReadUncompRL(CXUncompContextRL* context, const void* src, u3 while (context->unk_0x04 > 0) { if (!(context->unk_0x0e & 0x80)) { while (context->unk_0x0c) { - *context->unk_0x00++ =* pSrc++; + *context->unk_0x00++ = *pSrc++; context->unk_0x0c--; context->unk_0x04--; @@ -77,9 +77,8 @@ CXStreamingResult CXReadUncompRL(CXUncompContextRL* context, const void* src, u3 return context->unk_0x04; } } - } - else if (context->unk_0x0c) { - u8 b =* pSrc++; + } else if (context->unk_0x0c) { + u8 b = *pSrc++; size--; while (context->unk_0x0c) { @@ -94,14 +93,13 @@ CXStreamingResult CXReadUncompRL(CXUncompContextRL* context, const void* src, u3 } } - context->unk_0x0e =* pSrc++; + context->unk_0x0e = *pSrc++; size--; context->unk_0x0c = context->unk_0x0e & 0x7f; if (context->unk_0x0e & 0x80) { context->unk_0x0c += 3; - } - else { + } else { context->unk_0x0c += 1; } @@ -134,26 +132,25 @@ static int CXiReadHeader(u8* param_1, int* param_2, const u8* param_3, int param (*param_1)--; if (*param_1 <= 3) { - *param_2 |=* param_3 << ((3 -* param_1) << 3); - } - else if (*param_1 <= 6) { - *param_2 |=* param_3 << ((6 -* param_1) << 3); + *param_2 |= *param_3 << ((3 - *param_1) << 3); + } else if (*param_1 <= 6) { + *param_2 |= *param_3 << ((6 - *param_1) << 3); } param_3++; a++; - if (*param_1 == 4 &&* param_2 > 0) { + if (*param_1 == 4 && *param_2 > 0) { *param_1 = 0; } param_4--; - if (param_4 == 0 &&* param_1 != 0) { + if (param_4 == 0 && *param_1 != 0) { return a; } } - if (param_5 > 0 && param_5 <* param_2) { + if (param_5 > 0 && param_5 < *param_2) { *param_2 = param_5; } @@ -170,7 +167,7 @@ CXStreamingResult CXReadUncompLZ(CXUncompContextLZ* context, const void* src, u3 return CX_STREAMING_ERR_BAD_FILE_TYPE; } - context->unk_0x14 =* pSrc & 0x0F; + context->unk_0x14 = *pSrc & 0x0F; if (context->unk_0x14 != 0 && context->unk_0x14 != 1) { return CX_STREAMING_ERR_BAD_FILE_TYPE; @@ -196,7 +193,7 @@ CXStreamingResult CXReadUncompLZ(CXUncompContextLZ* context, const void* src, u3 } if (!(context->unk_0x11 & 0x80)) { - *context->unk_0x00++ =* pSrc++; + *context->unk_0x00++ = *pSrc++; context->unk_0x04--; size--; @@ -208,25 +205,22 @@ CXStreamingResult CXReadUncompLZ(CXUncompContextLZ* context, const void* src, u3 context->unk_0x10--; if (!context->unk_0x14) { - context->unk_0x0c =* pSrc++; + context->unk_0x0c = *pSrc++; context->unk_0x0c += 0x30; context->unk_0x10 = 0; - } - else { + } else { switch (context->unk_0x10) { case 2: { - context->unk_0x0c =* pSrc++; + context->unk_0x0c = *pSrc++; if (context->unk_0x0c >> 4 == 1) { context->unk_0x0c = (context->unk_0x0c & 0x0F) << 16; context->unk_0x0c += 0x1110; - } - else if (context->unk_0x0c >> 4 == 0) { + } else if (context->unk_0x0c >> 4 == 0) { context->unk_0x0c = (context->unk_0x0c & 0x0F) << 8; context->unk_0x0c += 0x110; context->unk_0x10 = 1; - } - else { + } else { context->unk_0x0c += 0x10; context->unk_0x10 = 0; } @@ -234,11 +228,11 @@ CXStreamingResult CXReadUncompLZ(CXUncompContextLZ* context, const void* src, u3 break; } case 1: { - context->unk_0x0c +=* pSrc++ << 8; + context->unk_0x0c += *pSrc++ << 8; break; } case 0: { - context->unk_0x0c +=* pSrc++; + context->unk_0x0c += *pSrc++; break; } } @@ -253,7 +247,7 @@ CXStreamingResult CXReadUncompLZ(CXUncompContextLZ* context, const void* src, u3 a = (context->unk_0x0c & 0x0F) << 8; context->unk_0x0c >>= 4; - a = (a |* pSrc++) + 1; + a = (a | *pSrc++) + 1; size--; context->unk_0x10 = 3; @@ -272,7 +266,7 @@ CXStreamingResult CXReadUncompLZ(CXUncompContextLZ* context, const void* src, u3 context->unk_0x0c--; } - there: + there: if (!context->unk_0x04) { goto out; } @@ -285,7 +279,7 @@ CXStreamingResult CXReadUncompLZ(CXUncompContextLZ* context, const void* src, u3 return context->unk_0x04; } - context->unk_0x11 =* pSrc++; + context->unk_0x11 = *pSrc++; context->unk_0x12 = 8; size--; } @@ -303,7 +297,7 @@ CXStreamingResult CXReadUncompHuffman(CXUncompContextHuffman* context, const voi if (context->unk_0x1d) { int a; if (context->unk_0x1d == 8) { - context->unk_0x1c =* pSrc & 0x0F; + context->unk_0x1c = *pSrc & 0x0F; if ((*pSrc & CX_COMPRESSION_TYPE_MASK) != CX_COMPRESSION_TYPE_HUFFMAN) { return CX_STREAMING_ERR_BAD_FILE_TYPE; @@ -326,7 +320,7 @@ CXStreamingResult CXReadUncompHuffman(CXUncompContextHuffman* context, const voi if (context->unk_0x18 < 0) { context->unk_0x18 = ((*pSrc + 1) << 1) - 1; - *context->unk_0x0c++ =* pSrc++; + *context->unk_0x0c++ = *pSrc++; size--; } @@ -335,7 +329,7 @@ CXStreamingResult CXReadUncompHuffman(CXUncompContextHuffman* context, const voi return context->unk_0x04; } - *context->unk_0x0c++ =* pSrc++; + *context->unk_0x0c++ = *pSrc++; context->unk_0x18--; size--; @@ -356,7 +350,7 @@ CXStreamingResult CXReadUncompHuffman(CXUncompContextHuffman* context, const voi return context->unk_0x04; } - context->unk_0x10 |=* pSrc++ << context->unk_0x1a; + context->unk_0x10 |= *pSrc++ << context->unk_0x1a; size--; context->unk_0x1a += 8; @@ -364,7 +358,7 @@ CXStreamingResult CXReadUncompHuffman(CXUncompContextHuffman* context, const voi while (context->unk_0x1a) { int b = context->unk_0x10 >> 31; - int c = (*(vu8*)context->unk_0x0c << b) & 0x80; // ? + int c = (*(vu8*)context->unk_0x0c << b) & 0x80; // ? context->unk_0x0c = GetNextNode(context->unk_0x0c, b); context->unk_0x10 <<= 1; @@ -375,7 +369,7 @@ CXStreamingResult CXReadUncompHuffman(CXUncompContextHuffman* context, const voi } context->unk_0x14 >>= context->unk_0x1c; - context->unk_0x14 |=* context->unk_0x0c << (32 - context->unk_0x1c); + context->unk_0x14 |= *context->unk_0x0c << (32 - context->unk_0x1c); context->unk_0x0c = context->unk_0x20 + 1; context->unk_0x1b += context->unk_0x1c; diff --git a/libs/RVL_SDK/src/cx/CXUncompression.c b/libs/RVL_SDK/src/cx/CXUncompression.c index 5948beea..497531a8 100644 --- a/libs/RVL_SDK/src/cx/CXUncompression.c +++ b/libs/RVL_SDK/src/cx/CXUncompression.c @@ -25,39 +25,35 @@ void CXUncompressLZ(const void* src, void* dst) { while (size) { u32 i; - u32 flags =* pSrc++; + u32 flags = *pSrc++; for (i = 0; i < 8; ++i) { if (!(flags & 0x80)) { - *pDst++ =* pSrc++; + *pDst++ = *pSrc++; size--; - } - else { - s32 length =* pSrc >> 4; + } else { + s32 length = *pSrc >> 4; s32 offset; if (!stat) { length += 3; - } - else { + } else { if (length == 0x01) { length = (*pSrc++ & 0x0F) << 12; - length |=* pSrc++ << 4; - length |=* pSrc >> 4; + length |= *pSrc++ << 4; + length |= *pSrc >> 4; length += 0x111; - } - else if (length == 0x00) { + } else if (length == 0x00) { length = (*pSrc++ & 0x0F) << 4; - length |=* pSrc >> 4; + length |= *pSrc >> 4; length += 0x11; - } - else { + } else { length += 0x01; } } offset = (*pSrc++ & 0x0F) << 8; - offset = (offset |* pSrc++) + 1; + offset = (offset | *pSrc++) + 1; if (length > size) { length = size; diff --git a/libs/RVL_SDK/src/db/db.c b/libs/RVL_SDK/src/db/db.c index 7d63446d..f168aaff 100644 --- a/libs/RVL_SDK/src/db/db.c +++ b/libs/RVL_SDK/src/db/db.c @@ -5,8 +5,8 @@ #include -BOOL DBVerbose; -DBInterface* __DBInterface; +BOOL DBVerbose; +DBInterface* __DBInterface; void DBInit() { __DBInterface = OSPhysicalToCached(OS_ADDR_DB_INTERFACE); @@ -25,6 +25,7 @@ void __DBExceptionDestinationAux() { } asm void __DBExceptionDestination() { + // clang-format off #ifdef __MWERKS__ nofralloc @@ -35,6 +36,7 @@ asm void __DBExceptionDestination() { b __DBExceptionDestinationAux #endif // __MWERKS__ + // clang-format on } BOOL __DBIsExceptionMarked(__OSException exception) { diff --git a/libs/RVL_SDK/src/dsp/dsp.c b/libs/RVL_SDK/src/dsp/dsp.c index aec86f4d..bba8c836 100644 --- a/libs/RVL_SDK/src/dsp/dsp.c +++ b/libs/RVL_SDK/src/dsp/dsp.c @@ -1,23 +1,23 @@ -#include #include +#include #include -#include #include +#include #include -static BOOL __DSP_init_flag; +static BOOL __DSP_init_flag; SDKDefineVersion(DSP, "Apr 20 2010", "11:19:06"); u32 DSPCheckMailToDSP() { - return DSP_HAS_REG_F(DSP_MAILBOX, (1<> 16) & 0xFFFF); - DSP_WRITE_REG(DSP_MAILBOX_L, (mail) & 0xFFFF); + DSP_WRITE_REG(DSP_MAILBOX_L, (mail) & 0xFFFF); } void DSPAssertInt() { @@ -61,12 +61,13 @@ void DSPInit() { // Reset DSP tmp = DSP_READ_REG(DSP_CONTROL_STATUS); - CLEAR_FLAG(tmp, ((1< #include +#include + #include -#include #include +#include + enum { MAIL_SET_IRAM_MMEM_ADDR = 0x80F3A001, - MAIL_SET_IRAM_DSP_ADDR = 0x80F3C002, - MAIL_SET_IRAM_LENGTH = 0x80F3A002, + MAIL_SET_IRAM_DSP_ADDR = 0x80F3C002, + MAIL_SET_IRAM_LENGTH = 0x80F3A002, MAIL_SET_ARAM_MMEM_ADDR = 0x80F3B002, - MAIL_SET_START_VECTOR = 0x80F3D001 + MAIL_SET_START_VECTOR = 0x80F3D001 }; /* from Dolphin Emulator */ enum { - TASK_MAIL_MASK = 0xFFFF0000, - TASK_MAIL_TO_CPU = 0xDCD10000, - TASK_MAIL_TO_DSP = 0xCDD10000, + TASK_MAIL_MASK = 0xFFFF0000, + TASK_MAIL_TO_CPU = 0xDCD10000, + TASK_MAIL_TO_DSP = 0xCDD10000, - DSP_INIT = (TASK_MAIL_TO_CPU | 0x0000), - DSP_RESUME = (TASK_MAIL_TO_CPU | 0x0001), - DSP_YIELD = (TASK_MAIL_TO_CPU | 0x0002), - DSP_DONE = (TASK_MAIL_TO_CPU | 0x0003), - DSP_SYNC = (TASK_MAIL_TO_CPU | 0x0004), - DSP_FRAME_END = (TASK_MAIL_TO_CPU | 0x0005), + DSP_INIT = (TASK_MAIL_TO_CPU | 0x0000), + DSP_RESUME = (TASK_MAIL_TO_CPU | 0x0001), + DSP_YIELD = (TASK_MAIL_TO_CPU | 0x0002), + DSP_DONE = (TASK_MAIL_TO_CPU | 0x0003), + DSP_SYNC = (TASK_MAIL_TO_CPU | 0x0004), + DSP_FRAME_END = (TASK_MAIL_TO_CPU | 0x0005), - MAIL_RESUME = (TASK_MAIL_TO_DSP | 0x0000), - MAIL_NEW_UCODE = (TASK_MAIL_TO_DSP | 0x0001), - MAIL_RESET = (TASK_MAIL_TO_DSP | 0x0002), - MAIL_CONTINUE = (TASK_MAIL_TO_DSP | 0x0003) + MAIL_RESUME = (TASK_MAIL_TO_DSP | 0x0000), + MAIL_NEW_UCODE = (TASK_MAIL_TO_DSP | 0x0001), + MAIL_RESET = (TASK_MAIL_TO_DSP | 0x0002), + MAIL_CONTINUE = (TASK_MAIL_TO_DSP | 0x0003) }; -DSPTaskInfo* __DSP_curr_task; +DSPTaskInfo* __DSP_curr_task; -DSPTaskInfo* __DSP_first_task; -DSPTaskInfo* __DSP_last_task; +DSPTaskInfo* __DSP_first_task; +DSPTaskInfo* __DSP_last_task; -DSPTaskInfo* __DSP_tmp_task; +DSPTaskInfo* __DSP_tmp_task; -DSPTaskInfo* __DSP_rude_task; -BOOL __DSP_rude_task_pending; +DSPTaskInfo* __DSP_rude_task; +BOOL __DSP_rude_task_pending; -#define DSP_SEND_MAIL_TO_DSP(mail) { \ - DSPSendMailToDSP(mail); \ - while (DSPCheckMailToDSP()) {} \ -} +#define DSP_SEND_MAIL_TO_DSP(mail) \ + { \ + DSPSendMailToDSP(mail); \ + while (DSPCheckMailToDSP()) { \ + } \ + } void __DSPHandler(__OSInterrupt intr, OSContext* context) { - OSContext exceptionContext; - u16 tmp; - u32 mail; + OSContext exceptionContext; + u16 tmp; + u32 mail; tmp = DSP_READ_REG(DSP_CONTROL_STATUS); - CLEAR_FLAG(tmp, ((1<flags & DSP_TASK_CANCELED) && mail == DSP_YIELD) { @@ -94,8 +99,7 @@ void __DSPHandler(__OSInterrupt intr, OSContext* context) { if (__DSP_curr_task->res_cb != NULL) { __DSP_curr_task->res_cb(__DSP_curr_task); } - } - else { + } else { DSP_SEND_MAIL_TO_DSP(MAIL_NEW_UCODE); __DSP_exec_task(__DSP_curr_task, __DSP_rude_task); @@ -104,8 +108,7 @@ void __DSPHandler(__OSInterrupt intr, OSContext* context) { __DSP_rude_task = NULL; __DSP_rude_task_pending = FALSE; } - } - else { + } else { if (__DSP_curr_task->next == NULL) { if (__DSP_curr_task == __DSP_first_task) { DSP_SEND_MAIL_TO_DSP(MAIL_CONTINUE); @@ -113,16 +116,14 @@ void __DSPHandler(__OSInterrupt intr, OSContext* context) { if (__DSP_curr_task->res_cb != NULL) { __DSP_curr_task->res_cb(__DSP_curr_task); } - } - else { + } else { DSP_SEND_MAIL_TO_DSP(MAIL_NEW_UCODE); __DSP_exec_task(__DSP_curr_task, __DSP_first_task); __DSP_curr_task->state = 2; __DSP_curr_task = __DSP_first_task; } - } - else { + } else { DSP_SEND_MAIL_TO_DSP(MAIL_NEW_UCODE); __DSP_exec_task(__DSP_curr_task, __DSP_curr_task->next); @@ -162,8 +163,7 @@ void __DSPHandler(__OSInterrupt intr, OSContext* context) { __DSP_curr_task->state = 3; __DSP_remove_task(__DSP_curr_task); - } - else { + } else { if (__DSP_curr_task->done_cb != NULL) { __DSP_curr_task->done_cb(__DSP_curr_task); } @@ -175,8 +175,7 @@ void __DSPHandler(__OSInterrupt intr, OSContext* context) { __DSP_curr_task = __DSP_first_task; __DSP_remove_task(__DSP_last_task); } - } - else { + } else { if (__DSP_curr_task->done_cb != NULL) { __DSP_curr_task->done_cb(__DSP_curr_task); } @@ -206,13 +205,11 @@ void __DSPHandler(__OSInterrupt intr, OSContext* context) { } void __DSP_exec_task(DSPTaskInfo* curr, DSPTaskInfo* next) { - if (curr != NULL) { DSP_SEND_MAIL_TO_DSP((u32)curr->dram_mmem_addr); DSP_SEND_MAIL_TO_DSP(curr->dram_length); DSP_SEND_MAIL_TO_DSP(curr->dram_addr); - } - else { + } else { DSP_SEND_MAIL_TO_DSP(0); DSP_SEND_MAIL_TO_DSP(0); DSP_SEND_MAIL_TO_DSP(0); @@ -227,8 +224,7 @@ void __DSP_exec_task(DSPTaskInfo* curr, DSPTaskInfo* next) { DSP_SEND_MAIL_TO_DSP(0); DSP_SEND_MAIL_TO_DSP(0); DSP_SEND_MAIL_TO_DSP(0); - } - else { + } else { DSP_SEND_MAIL_TO_DSP(next->dsp_resume_vector); DSP_SEND_MAIL_TO_DSP((u32)next->dram_mmem_addr); DSP_SEND_MAIL_TO_DSP(next->dram_length); @@ -239,7 +235,8 @@ void __DSP_exec_task(DSPTaskInfo* curr, DSPTaskInfo* next) { void __DSP_boot_task(DSPTaskInfo* task) { volatile u32 mail; - while (DSPCheckMailFromDSP() == 0) {} + while (DSPCheckMailFromDSP() == 0) { + } mail = DSPReadMailFromDSP(); @@ -285,8 +282,7 @@ void __DSP_insert_task(DSPTaskInfo* task) { task->next = temp; if (task->prev == NULL) { __DSP_first_task = task; - } - else { + } else { task->prev->next = task; } break; @@ -308,8 +304,7 @@ void __DSP_add_task(DSPTaskInfo* task) { __DSP_last_task = task; __DSP_first_task = task; task->next = task->prev = NULL; - } - else { + } else { __DSP_last_task->next = task; task->next = NULL; task->prev = __DSP_last_task; @@ -329,8 +324,7 @@ void __DSP_remove_task(DSPTaskInfo* task) { if (task->next != NULL) { __DSP_first_task = task->next; task->next->prev = NULL; - } - else { + } else { __DSP_first_task = __DSP_last_task = __DSP_curr_task = NULL; } return; diff --git a/libs/RVL_SDK/src/dvd/dvd.c b/libs/RVL_SDK/src/dvd/dvd.c index 16b62696..d70778b1 100644 --- a/libs/RVL_SDK/src/dvd/dvd.c +++ b/libs/RVL_SDK/src/dvd/dvd.c @@ -1,10 +1,10 @@ -#include #include +#include #include -#include #include +#include #include @@ -12,7 +12,7 @@ #include -#define LIMIT_BLOCK_SIZE(a, b) (((a) > (b))? (b) : (a)) +#define LIMIT_BLOCK_SIZE(a, b) (((a) > (b)) ? (b) : (a)) SDKDefineVersion(DVD, "Apr 20 2010", "11:19:08"); @@ -119,75 +119,75 @@ enum { void defaultOptionalCommandChecker(DVDCommandBlock* block, DVDLowCallback callback); -extern DVDErrorInfo __ErrorInfo; +extern DVDErrorInfo __ErrorInfo; -static vu32 CommandInfoCounter = 0; +static vu32 CommandInfoCounter = 0; -static vBOOL PauseFlag = FALSE; -static vBOOL PausingFlag = FALSE; +static vBOOL PauseFlag = FALSE; +static vBOOL PausingFlag = FALSE; -static BOOL FatalErrorFlag = FALSE; +static BOOL FatalErrorFlag = FALSE; -static vBOOL Canceling = FALSE; +static vBOOL Canceling = FALSE; -static vu32 ResumeFromHere = 0; +static vu32 ResumeFromHere = 0; -static vs32 NumInternalRetry = 0; -static BOOL FirstTimeInBootrom = FALSE; -static BOOL Breaking = FALSE; +static vs32 NumInternalRetry = 0; +static BOOL FirstTimeInBootrom = FALSE; +static BOOL Breaking = FALSE; -static vBOOL WaitingForCoverOpen = FALSE; -static vBOOL WaitingForCoverClose = FALSE; +static vBOOL WaitingForCoverOpen = FALSE; +static vBOOL WaitingForCoverClose = FALSE; -static BOOL MotorStopped = FALSE; -static BOOL ChangedDisc = FALSE; -static vBOOL PreparingCover = FALSE; +static BOOL MotorStopped = FALSE; +static BOOL ChangedDisc = FALSE; +static vBOOL PreparingCover = FALSE; -vu32 __DVDLayoutFormat = 0; -BOOL DVDInitialized = FALSE; +vu32 __DVDLayoutFormat = 0; +BOOL DVDInitialized = FALSE; -vu32 __BS2DVDLowIntType = FALSE; +vu32 __BS2DVDLowIntType = FALSE; -static vBOOL Prepared = FALSE; +static vBOOL Prepared = FALSE; -static DVDPartitionInfo* BootGameInfo = NULL; -static DVDPartitionInfo* PartInfo = NULL; -static DVDGameTOC* GameToc = NULL; +static DVDPartitionInfo* BootGameInfo = NULL; +static DVDPartitionInfo* PartInfo = NULL; +static DVDGameTOC* GameToc = NULL; -static u32 __DVDNumTmdBytes ALIGN32 = 0; +static u32 __DVDNumTmdBytes ALIGN32 = 0; -static vs64 LastResetEnd = 0; -static u32 MotorState = 0; -static BOOL ResetRequired = FALSE; -static u32 LastError = 0; -static u32 CancelLastError = 0; -static DVDCommandCallback CancelCallback = NULL; +static vs64 LastResetEnd = 0; +static u32 MotorState = 0; +static BOOL ResetRequired = FALSE; +static u32 LastError = 0; +static u32 CancelLastError = 0; +static DVDCommandCallback CancelCallback = NULL; -static vu32 CurrCommand = 0; +static vu32 CurrCommand = 0; -static OSBootInfo* bootInfo = NULL; +static OSBootInfo* bootInfo = NULL; -static DVDDiskID* IDShouldBe = NULL; -static DVDCommandBlock* executing = NULL; -static DVDStateProc LastState = NULL; +static DVDDiskID* IDShouldBe = NULL; +static DVDCommandBlock* executing = NULL; +static DVDStateProc LastState = NULL; -static DVDCommandBlock DummyCommandBlock; -DVDCommandBlock __DVDStopMotorCommandBlock; -DVDCommandBlock __DVDRestartMotorCommandBlock; +static DVDCommandBlock DummyCommandBlock; +DVDCommandBlock __DVDStopMotorCommandBlock; +DVDCommandBlock __DVDRestartMotorCommandBlock; -static OSAlarm ResetAlarm; -static OSAlarm CoverAlarm; +static OSAlarm ResetAlarm; +static OSAlarm CoverAlarm; -static BOOL autoInvalidation = TRUE; -static DVDOptionalCommandChecker checkOptionalCommand = defaultOptionalCommandChecker; +static BOOL autoInvalidation = TRUE; +static DVDOptionalCommandChecker checkOptionalCommand = defaultOptionalCommandChecker; -static DVDBB2 BB2 ALIGN32; -static DVDDiskID CurrDiskID ALIGN32; +static DVDBB2 BB2 ALIGN32; +static DVDDiskID CurrDiskID ALIGN32; -static DVDGameTOC __DVDGameTocBuffer[4] ALIGN32; -static DVDPartitionInfo __DVDPartInfoBuffer[4] ALIGN32; -static ESTitleMeta __DVDTmdBuffer ALIGN64; -static ESTicketView __DVDTicketViewBuffer ALIGN32; +static DVDGameTOC __DVDGameTocBuffer[4] ALIGN32; +static DVDPartitionInfo __DVDPartInfoBuffer[4] ALIGN32; +static ESTitleMeta __DVDTmdBuffer ALIGN64; +static ESTicketView __DVDTicketViewBuffer ALIGN32; __declspec(weak) void StampCommand(u32 command, u32 offset, u32 length) { BOOL enabled = OSDisableInterrupts(); @@ -204,22 +204,22 @@ __declspec(weak) void StampCommand(u32 command, u32 offset, u32 length) { OSRestoreInterrupts(enabled); } -void defaultOptionalCommandChecker(DVDCommandBlock* block, DVDLowCallback callback) {} +void defaultOptionalCommandChecker(DVDCommandBlock* block, DVDLowCallback callback) { +} void StampIntType(u32 intType) { BOOL enabled = OSDisableInterrupts(); if (CommandInfoCounter == 0) { __ErrorInfo.lastCommand[DVD_ERROR_CMD_MAX - 1].intType = intType; - } - else { + } else { __ErrorInfo.lastCommand[CommandInfoCounter - 1].intType = intType; } OSRestoreInterrupts(enabled); } -vu32 __DVDLayoutFormat; +vu32 __DVDLayoutFormat; static void stateDownRotation(DVDCommandBlock* block); static void stateGettingError(); @@ -263,14 +263,14 @@ static void cbForCancelSync(s32 result, DVDCommandBlock* block); static void CoverAlarmHandler(OSAlarm* alarm, OSContext* context); static void ResetAlarmHandler(OSAlarm* alarm, OSContext* context); -static OSAlarm FatalAlarm; +static OSAlarm FatalAlarm; -static DVDGameTOC* GameToc; -static DVDPartitionInfo* PartInfo; -static DVDPartitionInfo* BootGameInfo; -static ESTitleMeta* Tmd; +static DVDGameTOC* GameToc; +static DVDPartitionInfo* PartInfo; +static DVDPartitionInfo* BootGameInfo; +static ESTitleMeta* Tmd; -static vBOOL Prepared; +static vBOOL Prepared; void DVDInit() { DVDDiskID* id; @@ -283,7 +283,7 @@ void DVDInit() { OSRegisterVersion(GetVersion(DVD)); DVDInitialized = TRUE; DVDLowInit(); - + if (!__OSInIPL && __OSLockedAppType == OS_APP_TYPE_DVD) { ret = ESP_InitLib(); @@ -314,12 +314,8 @@ void DVDInit() { DVDLowMaskCoverInterrupt(); if (bootInfo->magic == 0xE5207C22) { - - } - else if (bootInfo->magic == 0x0D15EA5E) { - - } - else { + } else if (bootInfo->magic == 0x0D15EA5E) { + } else { FirstTimeInBootrom = TRUE; } @@ -342,7 +338,8 @@ static void stateReadingFST() { DVDLowClearCoverInterrupt(NULL); StampCommand(COMMAND_READ, BB2.FSTPosition >> __DVDLayoutFormat, OSRoundUp32B(BB2.FSTLength << (~__DVDLayoutFormat & 2))); - DVDLowRead(bootInfo->FSTLocation, OSRoundUp32B(BB2.FSTLength << (~__DVDLayoutFormat & 2)), BB2.FSTPosition >> __DVDLayoutFormat, cbForStateReadingFST); + DVDLowRead(bootInfo->FSTLocation, OSRoundUp32B(BB2.FSTLength << (~__DVDLayoutFormat & 2)), BB2.FSTPosition >> __DVDLayoutFormat, + cbForStateReadingFST); } static void cbForStateReadingFST(u32 intType) { @@ -371,8 +368,7 @@ static void cbForStateReadingFST(u32 intType) { } stateReady(); - } - else { + } else { stateGettingError(); } } @@ -387,8 +383,7 @@ static void cbForStateError(u32 intType) { if (__DVDGetAutoFatalMessaging()) { OSCreateAlarm(&FatalAlarm); OSSetAlarm(&FatalAlarm, 1, FatalAlarmHandler); - } - else { + } else { executing->state = DVD_STATE_FATAL; if (intType == DVD_INTTYPE_TIME) { @@ -459,15 +454,12 @@ u32 CategorizeError(u32 error) { error &= 0xFFFFFF; - if (error == REQUEST_ERROR_MEDIUM_CHANGED - || error == REQUEST_ERROR_COVER_OPENED - || error == REQUEST_ERROR_053000h - || error == REQUEST_ERROR_MEDIUM_REMOVAL) { + if (error == REQUEST_ERROR_MEDIUM_CHANGED || error == REQUEST_ERROR_COVER_OPENED || error == REQUEST_ERROR_053000h || + error == REQUEST_ERROR_MEDIUM_REMOVAL) { return ERROR_TYPE_OK; } - if (error == REQUEST_ERROR_BAD_OPCODE - && (executing->command == COMMAND_SET_MAX_ROTATION || LastState == stateDownRotation)) { + if (error == REQUEST_ERROR_BAD_OPCODE && (executing->command == COMMAND_SET_MAX_ROTATION || LastState == stateDownRotation)) { return ERROR_TYPE_OK; } @@ -476,16 +468,14 @@ u32 CategorizeError(u32 error) { if (error == LastError) { LastError = error; return ERROR_TYPE_ERROR; - } - else { + } else { LastError = error; return ERROR_TYPE_FATAL; } - } - else { + } else { LastError = error; - if (error == REQUEST_ERROR_READ_FAIL || executing->command == COMMAND_READID) { + if (error == REQUEST_ERROR_READ_FAIL || executing->command == COMMAND_READID) { return ERROR_TYPE_FATAL; } return ERROR_TYPE_UNKNOWN; @@ -513,8 +503,7 @@ static BOOL CheckCancel(u32 resume) { stateReady(); return TRUE; - } - else { + } else { return FALSE; } } @@ -554,26 +543,20 @@ static void cbForStateGettingError(u32 intType) { if (errorCategory == ERROR_TYPE_FATAL || errorCategory == ERROR_TYPE_UNKNOWN) { resume = RESUME_POINT_NONE; - } - else { + } else { if (status == REQUEST_STATE_COVER_OPENED) { resume = RESUME_POINT_COVER_OPENED; - } - else if (status == REQUEST_STATE_DISK_CHANGED) { + } else if (status == REQUEST_STATE_DISK_CHANGED) { resume = RESUME_POINT_DISK_CHANGED; - } - else if (status == REQUEST_STATE_NO_DISK) { + } else if (status == REQUEST_STATE_NO_DISK) { resume = RESUME_POINT_NO_DISK; - } - else if (status == REQUEST_STATE_OK) { + } else if (status == REQUEST_STATE_OK) { if (error == REQUEST_ERROR_053000h) { resume = RESUME_POINT_WRONG_DISK_ID; - } - else { + } else { resume = RESUME_POINT_OK; } - } - else { + } else { resume = RESUME_POINT_OK; } } @@ -586,13 +569,12 @@ static void cbForStateGettingError(u32 intType) { __DVDStoreErrorCode(error, cbForStoreErrorCode3); return; } - + if (errorCategory == ERROR_TYPE_UNKNOWN) { if ((error & 0xFFFFFF) == REQUEST_ERROR_READ_FAIL) { StampCommand(COMMAND_SEEK, executing->offset, 0); DVDLowSeek(executing->offset, cbForUnrecoveredError); - } - else { + } else { LastState(executing); } @@ -603,29 +585,24 @@ static void cbForStateGettingError(u32 intType) { executing->state = DVD_STATE_COVER_OPENED; stateMotorStopped(); return; - } - else if (status == REQUEST_STATE_DISK_CHANGED) { + } else if (status == REQUEST_STATE_DISK_CHANGED) { executing->state = DVD_STATE_COVER_CLOSED; stateCoverClosed(); return; - } - else if (status == REQUEST_STATE_NO_DISK) { + } else if (status == REQUEST_STATE_NO_DISK) { executing->state = DVD_STATE_NO_DISK; stateMotorStopped(); return; - } - else if (status == REQUEST_STATE_OK) { + } else if (status == REQUEST_STATE_OK) { if (error == REQUEST_ERROR_053000h) { StampCommand(COMMAND_STOP_MOTOR, 0, 0); DVDLowStopMotor(FALSE, FALSE, cbForStateCheckID1); return; - } - else { + } else { stateError(NAND_ERROR_GENERIC); return; } - } - else { + } else { stateError(NAND_ERROR_GENERIC); return; } @@ -668,8 +645,7 @@ static void cbForUnrecoveredErrorRetry(u32 intType) { if (intType & DVD_INTTYPE_DE) { stateError(NAND_ERROR_GENERIC); - } - else { + } else { stateError(DVDLowGetImmBufferReg()); } @@ -701,14 +677,9 @@ static void cbForStateGoToRetry(u32 intType) { NumInternalRetry = 0; - if (CurrCommand == COMMAND_BSREAD || CurrCommand == COMMAND_READID - || CurrCommand == COMMAND_AUDIO_BUFFER_CONFIG - || CurrCommand == COMMAND_READ_UNENCRYPTED - || CurrCommand == COMMAND_OPEN_PARTITION - || CurrCommand == COMMAND_GET_PARTITION_PARAMS - || CurrCommand == COMMAND_OPEN_PARTITION_WITH_TMD - || CurrCommand == COMMAND_BS_CHANGE_DISK - || CurrCommand == COMMAND_SET_MAX_ROTATION) { + if (CurrCommand == COMMAND_BSREAD || CurrCommand == COMMAND_READID || CurrCommand == COMMAND_AUDIO_BUFFER_CONFIG || + CurrCommand == COMMAND_READ_UNENCRYPTED || CurrCommand == COMMAND_OPEN_PARTITION || CurrCommand == COMMAND_GET_PARTITION_PARAMS || + CurrCommand == COMMAND_OPEN_PARTITION_WITH_TMD || CurrCommand == COMMAND_BS_CHANGE_DISK || CurrCommand == COMMAND_SET_MAX_ROTATION) { ResetRequired = TRUE; } @@ -731,8 +702,7 @@ void stateCheckID() { NumInternalRetry = 0; stateReadingTOC(executing); return; - } - else { + } else { StampCommand(COMMAND_STOP_MOTOR, 0, 0); DVDLowStopMotor(FALSE, FALSE, cbForStateCheckID1); } @@ -742,8 +712,7 @@ void stateCheckID() { if (memcmp(&CurrDiskID, IDShouldBe, sizeof(DVDDiskID))) { StampCommand(COMMAND_STOP_MOTOR, 0, 0); DVDLowStopMotor(FALSE, FALSE, cbForStateCheckID1); - } - else { + } else { NumInternalRetry = 0; stateReadingTOC(executing); } @@ -779,8 +748,7 @@ static void cbForStateCheckID2a(u32 intType) { if (intType & DVD_INTTYPE_TC) { NumInternalRetry = 0; stateCheckID2(executing); - } - else { + } else { stateGettingError(); } } @@ -802,8 +770,7 @@ static void cbForStateReadingTOC(u32 intType) { NumInternalRetry = 0; GameToc = __DVDGameTocBuffer; stateReadingPartitionInfo(executing); - } - else { + } else { stateGettingError(); } } @@ -837,8 +804,7 @@ static void cbForStateReadingPartitionInfo(u32 intType) { BootGameInfo = PartInfo; BootGameInfo->partitionType = *((u32*)OSPhysicalToCached(OS_ADDR_BOOT_PART_TYPE)); BootGameInfo->partition = (DVDGamePartition*)*((u32*)OSPhysicalToCached(OS_ADDR_BOOT_PART_OFFSET)); - } - else { + } else { for (i = 0; i < GameToc->partitionCount; i++) { if (PartInfo->partitionType == __OSLaunchPartitionType) { BootGameInfo = PartInfo; @@ -861,15 +827,13 @@ static void cbForStateReadingPartitionInfo(u32 intType) { break; } } - } - else { + } else { if (!CheckCancel(RESUME_POINT_WRONG_DISK_ID)) { executing->state = DVD_STATE_WRONG_DISK_ID; stateMotorStopped(); } } - } - else { + } else { stateGettingError(); } } @@ -877,7 +841,8 @@ static void cbForStateReadingPartitionInfo(u32 intType) { static void stateReadingPartitionInfo(DVDCommandBlock* block) { DVDLowClearCoverInterrupt(NULL); StampCommand(COMMAND_READ_UNENCRYPTED, (0x40000 + OSRoundUp32B(sizeof(DVDGameTOC))) >> 2, OSRoundUp32B(sizeof(DVDPartitionInfo))); - DVDLowUnencryptedRead(__DVDPartInfoBuffer, OSRoundUp32B(sizeof(DVDPartitionInfo)), (0x40000 + OSRoundUp32B(sizeof(DVDGameTOC))) >> 2, cbForStateReadingPartitionInfo); + DVDLowUnencryptedRead(__DVDPartInfoBuffer, OSRoundUp32B(sizeof(DVDPartitionInfo)), (0x40000 + OSRoundUp32B(sizeof(DVDGameTOC))) >> 2, + cbForStateReadingPartitionInfo); } static void stateOpenPartition(DVDCommandBlock* block) { @@ -885,9 +850,9 @@ static void stateOpenPartition(DVDCommandBlock* block) { StampCommand(COMMAND_OPEN_PARTITION, (u32)BootGameInfo->partition, 0); if (__OSLockedAppType == OS_APP_TYPE_DVD) { - DVDLowOpenPartitionWithTmdAndTicketView((u32)BootGameInfo->partition, &__DVDTicketViewBuffer, __DVDNumTmdBytes, &__DVDTmdBuffer, 0, NULL, cbForStateOpenPartition); - } - else { + DVDLowOpenPartitionWithTmdAndTicketView((u32)BootGameInfo->partition, &__DVDTicketViewBuffer, __DVDNumTmdBytes, &__DVDTmdBuffer, 0, NULL, + cbForStateOpenPartition); + } else { DVDLowOpenPartition((u32)BootGameInfo->partition, NULL, 0, 0, &__DVDTmdBuffer, cbForStateOpenPartition); } } @@ -908,8 +873,7 @@ static void cbForStateOpenPartition(u32 intType) { if (intType & DVD_INTTYPE_TC) { NumInternalRetry = 0; stateCheckID2(executing); - } - else { + } else { stateGettingError(); } } @@ -934,8 +898,7 @@ static void cbForStateOpenPartition2(u32 intType) { executing->state = DVD_STATE_BUSY; stateBusy(executing); } - } - else { + } else { stateGettingError(); } } @@ -945,9 +908,9 @@ static void stateOpenPartition2(DVDCommandBlock* block) { StampCommand(COMMAND_OPEN_PARTITION, (u32)BootGameInfo->partition, 0); if (__OSLockedAppType == OS_APP_TYPE_DVD) { - DVDLowOpenPartitionWithTmdAndTicketView((u32)BootGameInfo->partition, &__DVDTicketViewBuffer, __DVDNumTmdBytes, &__DVDTmdBuffer, 0, NULL, cbForStateOpenPartition2); - } - else { + DVDLowOpenPartitionWithTmdAndTicketView((u32)BootGameInfo->partition, &__DVDTicketViewBuffer, __DVDNumTmdBytes, &__DVDTmdBuffer, 0, NULL, + cbForStateOpenPartition2); + } else { DVDLowOpenPartition((u32)BootGameInfo->partition, NULL, 0, 0, &__DVDTmdBuffer, cbForStateOpenPartition2); } } @@ -1000,8 +963,7 @@ static void cbForStateCheckID2(u32 intType) { if (intType & DVD_INTTYPE_TC) { NumInternalRetry = 0; stateReadingFST(); - } - else { + } else { stateGettingError(); } } @@ -1026,13 +988,11 @@ static void cbForStateCheckID3(u32 intType) { executing->state = DVD_STATE_BUSY; stateBusy(executing); } - } - else { + } else { stateGettingError(); } } - static void stateCoverClosed() { DVDCommandBlock* finished; MotorState = MOTOR_STATE_PENDING_STOP; @@ -1088,8 +1048,7 @@ static void ResetAlarmHandler(OSAlarm* alarm, OSContext* context) { if (__OSDeviceCode == (DVD_DEVICE_CODE | 0x003)) { LastState = stateDownRotation; stateDownRotation(executing); - } - else { + } else { DCInvalidateRange(&CurrDiskID, sizeof(DVDDiskID)); LastState = stateCoverClosed_CMD; stateCoverClosed_CMD(executing); @@ -1113,8 +1072,7 @@ static void cbForStateReset(u32 intType) { ResumeFromHere = RESUME_POINT_NONE; OSCreateAlarm(&ResetAlarm); OSSetAlarm(&ResetAlarm, OSMillisecondsToTicks(100), ResetAlarmHandler); - } - else { + } else { stateGettingError(); } } @@ -1152,8 +1110,7 @@ static void cbForStateMotorStopped(u32 intType) { if (executing) { executing->state = DVD_STATE_COVER_CLOSED; stateCoverClosed(); - } - else { + } else { ResumeFromHere = RESUME_POINT_7; } } @@ -1183,8 +1140,7 @@ static void cbForStateDownRotation(u32 intType) { DCInvalidateRange(&CurrDiskID, sizeof(DVDDiskID)); LastState = stateCoverClosed_CMD; stateCoverClosed_CMD(executing); - } - else { + } else { stateGettingError(); } } @@ -1197,8 +1153,7 @@ static void stateCoverClosed_CMD(DVDCommandBlock* block) { executing->state = DVD_STATE_BUSY; stateBusy(executing); } - } - else { + } else { DVDLowClearCoverInterrupt(NULL); StampCommand(COMMAND_READID, 0, sizeof(DVDDiskID)); DVDLowReadDiskID(&CurrDiskID, cbForStateCoverClosed); @@ -1221,8 +1176,7 @@ static void cbForStateCoverClosed(u32 intType) { if (intType & DVD_INTTYPE_TC) { NumInternalRetry = 0; stateCheckID(); - } - else { + } else { stateGettingError(); } } @@ -1246,12 +1200,10 @@ static void cbForPrepareCoverRegister(u32 intType) { if (MotorState == MOTOR_STATE_STOPPED) { executing->state = DVD_STATE_MOTOR_STOPPED; - } - else { + } else { executing->state = DVD_STATE_COVER_OPENED; } - } - else if (DVDLowGetCoverRegister() & DVD_DICVR_CVRINT) { + } else if (DVDLowGetCoverRegister() & DVD_DICVR_CVRINT) { OSCancelAlarm(&CoverAlarm); WaitingForCoverOpen = FALSE; DVDLowClearCoverInterrupt(NULL); @@ -1332,14 +1284,12 @@ static void stateReady() { } ResumeFromHere = RESUME_POINT_NONE; - } - else { + } else { switch (MotorState) { case MOTOR_STATE_STOPPED: { if (MotorStopped) { executing->state = DVD_STATE_MOTOR_STOPPED; - } - else { + } else { executing->state = DVD_STATE_COVER_CLOSED; stateCoverClosed(); } @@ -1402,12 +1352,12 @@ static void stateBusy(DVDCommandBlock* block) { } stateReady(); - } - else { + } else { DVDLowClearCoverInterrupt(NULL); block->currTransferSize = LIMIT_BLOCK_SIZE(block->length - block->transferredSize, 0x80000); StampCommand(block->command, ((block->offset) + (block->transferredSize >> 2)), block->currTransferSize); - DVDLowRead((void*)((u8*)block->addr + block->transferredSize), block->currTransferSize, (block->offset + (block->transferredSize >> 2)), cbForStateBusy); + DVDLowRead((void*)((u8*)block->addr + block->transferredSize), block->currTransferSize, + (block->offset + (block->transferredSize >> 2)), cbForStateBusy); } break; @@ -1451,18 +1401,18 @@ static void stateBusy(DVDCommandBlock* block) { finished = executing; executing = &DummyCommandBlock; finished->state = DVD_STATE_IDLE; - + if (finished->callback) { finished->callback(DVD_RESULT_OK, finished); } stateReady(); - } - else { + } else { DVDLowClearCoverInterrupt(NULL); block->currTransferSize = LIMIT_BLOCK_SIZE(block->length - block->transferredSize, 0x80000); StampCommand(block->command, (block->offset + (block->transferredSize >> 2)), block->currTransferSize); - DVDLowUnencryptedRead((void*)((u8*)block->addr + block->transferredSize), block->currTransferSize, ((block->offset) + (block->transferredSize >> 2)), cbForStateBusy); + DVDLowUnencryptedRead((void*)((u8*)block->addr + block->transferredSize), block->currTransferSize, + ((block->offset) + (block->transferredSize >> 2)), cbForStateBusy); } break; } @@ -1503,11 +1453,9 @@ static void stateBusy(DVDCommandBlock* block) { if (!params->numTmdBytes && !params->numCertBytes) { DVDLowGetNoDiscBufferSizes(block->offset, ¶ms->numTmdBytes, ¶ms->numCertBytes, cbForStateBusy); - } - else { - DVDLowGetNoDiscOpenPartitionParams(block->offset, ¶ms->ticket, ¶ms->numTmdBytes, - ¶ms->tmd, ¶ms->numCertBytes, params->certificates, - ¶ms->dataWordOffset, params->h3Hash, cbForStateBusy); + } else { + DVDLowGetNoDiscOpenPartitionParams(block->offset, ¶ms->ticket, ¶ms->numTmdBytes, ¶ms->tmd, ¶ms->numCertBytes, + params->certificates, ¶ms->dataWordOffset, params->h3Hash, cbForStateBusy); } break; } @@ -1515,8 +1463,8 @@ static void stateBusy(DVDCommandBlock* block) { DVDPartitionParams* params; DVDLowClearCoverInterrupt(NULL); params = block->addr; - DVDLowOpenPartitionWithTmdAndTicketView(block->offset, ¶ms->ticketView, params->numTmdBytes, ¶ms->tmd, - params->numCertBytes, params->certificates, cbForStateBusy); + DVDLowOpenPartitionWithTmdAndTicketView(block->offset, ¶ms->ticketView, params->numTmdBytes, ¶ms->tmd, params->numCertBytes, + params->certificates, cbForStateBusy); break; } default: { @@ -1528,14 +1476,12 @@ static void stateBusy(DVDCommandBlock* block) { // Must be defined here. static u32 ImmCommand[] = {-1, -1, -1}; -static u32 DmaCommand[] = { -1 }; +static u32 DmaCommand[] = {-1}; static BOOL IsImmCommandWithResult(u32 command) { u32 i; - if (command == COMMAND_REQUEST_AUDIO_ERROR || - command == COMMAND_REQUEST_PLAY_ADDR || - command == COMMAND_REQUEST_START_ADDR || + if (command == COMMAND_REQUEST_AUDIO_ERROR || command == COMMAND_REQUEST_PLAY_ADDR || command == COMMAND_REQUEST_START_ADDR || command == COMMAND_REQUEST_LENGTH) { return TRUE; } @@ -1552,13 +1498,12 @@ static BOOL IsImmCommandWithResult(u32 command) { static BOOL IsDmaCommand(u32 command) { u32 i; - if (command == COMMAND_READ - || command == COMMAND_BSREAD || command == COMMAND_READID || command == COMMAND_READ_UNENCRYPTED - || command == COMMAND_INQUIRY) { + if (command == COMMAND_READ || command == COMMAND_BSREAD || command == COMMAND_READID || command == COMMAND_READ_UNENCRYPTED || + command == COMMAND_INQUIRY) { return TRUE; } - for (i = 0 ; i < ARRAY_LENGTH(DmaCommand); i++) { + for (i = 0; i < ARRAY_LENGTH(DmaCommand); i++) { if (command == DmaCommand[i]) { return TRUE; } @@ -1570,9 +1515,8 @@ static BOOL IsDmaCommand(u32 command) { static BOOL issueCommand(s32 prio, DVDCommandBlock* block) { BOOL level, result; - if (autoInvalidation && (block->command == COMMAND_READ - || block->command == COMMAND_BSREAD || block->command == COMMAND_READID || block->command == COMMAND_READ_UNENCRYPTED - || block->command == COMMAND_INQUIRY)) { + if (autoInvalidation && (block->command == COMMAND_READ || block->command == COMMAND_BSREAD || block->command == COMMAND_READID || + block->command == COMMAND_READ_UNENCRYPTED || block->command == COMMAND_INQUIRY)) { DCInvalidateRange(block->addr, block->length); } @@ -1624,8 +1568,7 @@ static void cbForStateBusy(u32 intType) { } return; - } - else { + } else { if (IsDmaCommand(CurrCommand)) { executing->transferredSize += (intType & (DVD_INTTYPE_BR | DVD_INTTYPE_TC)) ? executing->currTransferSize : 0; } @@ -1656,8 +1599,7 @@ static void cbForStateBusy(u32 intType) { if (CurrCommand == COMMAND_STOP_MOTOR) { if (executing->offset) { MotorState = MOTOR_STATE_STOPPED; - } - else { + } else { MotorState = MOTOR_STATE_PENDING_STOP; } @@ -1703,18 +1645,16 @@ static void cbForStateBusy(u32 intType) { if (__OSGetSystemTime() - LastResetEnd < OSMillisecondsToTicks(100)) { retVal = DVD_COVER_BUSY; - } - else if (coverReg & DVD_DICVR_CVR) { + } else if (coverReg & DVD_DICVR_CVR) { retVal = DVD_COVER_OPENED; - } - else { + } else { retVal = DVD_COVER_CLOSED; } finished = executing; executing = &DummyCommandBlock; - finished->state = DVD_STATE_IDLE; + finished->state = DVD_STATE_IDLE; finished->offset = retVal; if (finished->callback) { finished->callback(retVal, finished); @@ -1731,12 +1671,10 @@ static void cbForStateBusy(u32 intType) { coverReg = DVDLowGetCoverRegister(); if ((coverReg & DVD_DICVR_CVRINT) >> 2 || (coverReg & DVD_DICVR_CVR)) { retVal = FALSE; - } - else { + } else { if (ResumeFromHere) { retVal = FALSE; - } - else { + } else { retVal = TRUE; } } @@ -1744,7 +1682,7 @@ static void cbForStateBusy(u32 intType) { finished = executing; executing = &DummyCommandBlock; - finished->state = DVD_STATE_IDLE; + finished->state = DVD_STATE_IDLE; finished->offset = retVal; if (finished->callback) { @@ -1761,7 +1699,7 @@ static void cbForStateBusy(u32 intType) { finished = executing; executing = &DummyCommandBlock; - finished->state = DVD_STATE_IDLE; + finished->state = DVD_STATE_IDLE; finished->offset = TRUE; if (finished->callback) { finished->callback(TRUE, finished); @@ -1771,8 +1709,7 @@ static void cbForStateBusy(u32 intType) { stateReady(); return; - } - else { + } else { StampCommand(COMMAND_STOP_MOTOR, 0, 0); DVDLowStopMotor(FALSE, FALSE, cbForStateCheckID1); return; @@ -1814,14 +1751,12 @@ static void cbForStateBusy(u32 intType) { finished->callback(finished->transferredSize, finished); } stateReady(); - } - else if (IsImmCommandWithResult(CurrCommand)) { + } else if (IsImmCommandWithResult(CurrCommand)) { s32 result; if (CurrCommand == COMMAND_REQUEST_START_ADDR || CurrCommand == COMMAND_REQUEST_PLAY_ADDR) { result = DVDLowGetImmBufferReg() << 2; - } - else { + } else { result = DVDLowGetImmBufferReg(); } @@ -1834,8 +1769,7 @@ static void cbForStateBusy(u32 intType) { } stateReady(); - } - else { + } else { finished = executing; executing = &DummyCommandBlock; @@ -1845,17 +1779,15 @@ static void cbForStateBusy(u32 intType) { } stateReady(); } - } - else { + } else { if (CurrCommand == COMMAND_INQUIRY) { stateError(NAND_ERROR_GENERIC); return; } - if ((CurrCommand == COMMAND_READ - || CurrCommand == COMMAND_BSREAD || CurrCommand == COMMAND_READID || CurrCommand == COMMAND_READ_UNENCRYPTED - || CurrCommand == COMMAND_INQUIRY) - && (executing->transferredSize == executing->length)) { + if ((CurrCommand == COMMAND_READ || CurrCommand == COMMAND_BSREAD || CurrCommand == COMMAND_READID || + CurrCommand == COMMAND_READ_UNENCRYPTED || CurrCommand == COMMAND_INQUIRY) && + (executing->transferredSize == executing->length)) { if (CheckCancel(RESUME_POINT_NONE)) { return; } @@ -1964,30 +1896,24 @@ s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block) { if (((volatile DVDCommandBlock*)block)->state == DVD_STATE_COVER_CLOSED) { retVal = DVD_STATE_BUSY; - } - else if (((volatile DVDCommandBlock*)block)->state == DVD_STATE_COVER_OPENED) { + } else if (((volatile DVDCommandBlock*)block)->state == DVD_STATE_COVER_OPENED) { retVal = DVD_STATE_NO_DISK; - } - else if (executing == &__DVDStopMotorCommandBlock) { + } else if (executing == &__DVDStopMotorCommandBlock) { next = __DVDGetNextWaitingQueue(); if (next) { - if(block == next) { + if (block == next) { retVal = DVD_STATE_BUSY; - } - else { + } else { retVal = ((volatile DVDCommandBlock*)block)->state; } - } - else { + } else { if (block == &__DVDStopMotorCommandBlock) { retVal = DVD_STATE_IDLE; - } - else { + } else { retVal = ((volatile DVDCommandBlock*)block)->state; } } - } - else { + } else { retVal = ((volatile DVDCommandBlock*)block)->state; } @@ -2004,18 +1930,14 @@ s32 DVDGetDriveStatus() { if (FatalErrorFlag) { retVal = DVD_STATE_FATAL; - } - else if (PausingFlag) { + } else if (PausingFlag) { retVal = DVD_STATE_PAUSED; - } - else { + } else { if (executing == NULL) { retVal = DVD_STATE_IDLE; - } - else if (executing == &DummyCommandBlock) { + } else if (executing == &DummyCommandBlock) { retVal = DVD_STATE_IDLE; - } - else { + } else { retVal = DVDGetCommandBlockStatus(executing); } } @@ -2033,21 +1955,16 @@ s32 __DVDGetDriveStatus() { if (FatalErrorFlag) { retVal = DVD_STATE_FATAL; - } - else if (PausingFlag) { + } else if (PausingFlag) { retVal = DVD_STATE_PAUSED; - } - else { + } else { if (executing == (DVDCommandBlock*)NULL) { retVal = DVD_STATE_IDLE; - } - else if (executing == &DummyCommandBlock) { + } else if (executing == &DummyCommandBlock) { retVal = DVD_STATE_IDLE; - } - else if (executing == &__DVDStopMotorCommandBlock) { + } else if (executing == &__DVDStopMotorCommandBlock) { retVal = DVD_STATE_BUSY; - } - else { + } else { retVal = executing->state; } } @@ -2109,12 +2026,9 @@ BOOL DVDCancelAsync(DVDCommandBlock* block, DVDCommandCallback callback) { Canceling = TRUE; CancelCallback = callback; - if (block->command == COMMAND_BSREAD - || block->command == COMMAND_READ_UNENCRYPTED - || block->command == COMMAND_OPEN_PARTITION - || block->command == COMMAND_GET_PARTITION_PARAMS - || block->command == COMMAND_OPEN_PARTITION_WITH_TMD - || block->command == COMMAND_READ) { + if (block->command == COMMAND_BSREAD || block->command == COMMAND_READ_UNENCRYPTED || block->command == COMMAND_OPEN_PARTITION || + block->command == COMMAND_GET_PARTITION_PARAMS || block->command == COMMAND_OPEN_PARTITION_WITH_TMD || + block->command == COMMAND_READ) { __DVDLowBreak(); } @@ -2253,7 +2167,7 @@ s32 DVDCancel(DVDCommandBlock* block) { s32 state; u32 command; BOOL enabled; - + result = DVDCancelAsync(block, cbForCancelSync); if (result == FALSE) { @@ -2272,14 +2186,9 @@ s32 DVDCancel(DVDCommandBlock* block) { if (state == DVD_STATE_COVER_CLOSED) { command = ((volatile DVDCommandBlock*)block)->command; - if (command == COMMAND_BSREAD || command == COMMAND_READID - || command == COMMAND_AUDIO_BUFFER_CONFIG - || command == COMMAND_READ_UNENCRYPTED - || command == COMMAND_OPEN_PARTITION - || command == COMMAND_GET_PARTITION_PARAMS - || command == COMMAND_OPEN_PARTITION_WITH_TMD - || command == COMMAND_BS_CHANGE_DISK - || command == COMMAND_SET_MAX_ROTATION) { + if (command == COMMAND_BSREAD || command == COMMAND_READID || command == COMMAND_AUDIO_BUFFER_CONFIG || + command == COMMAND_READ_UNENCRYPTED || command == COMMAND_OPEN_PARTITION || command == COMMAND_GET_PARTITION_PARAMS || + command == COMMAND_OPEN_PARTITION_WITH_TMD || command == COMMAND_BS_CHANGE_DISK || command == COMMAND_SET_MAX_ROTATION) { break; } } @@ -2308,8 +2217,7 @@ BOOL DVDCancelAllAsync(DVDCommandCallback callback) { if (executing) { retVal = DVDCancelAsync(executing, callback); - } - else { + } else { retVal = TRUE; if (callback) { callback(DVD_RESULT_OK, NULL); @@ -2343,7 +2251,8 @@ u32 __DVDGetCoverStatus() { __BS2DVDLowIntType = 0; DVDLowPrepareCoverRegister(__BS2DVDLowCallback); - while (!__BS2DVDLowIntType) { } + while (!__BS2DVDLowIntType) { + } if (!(__BS2DVDLowIntType & 1)) { return DVD_COVER_BUSY; @@ -2353,11 +2262,9 @@ u32 __DVDGetCoverStatus() { if (__OSGetSystemTime() - LastResetEnd < OSMillisecondsToTicks(100)) { return DVD_COVER_BUSY; - } - else if (reg & DVD_INTTYPE_TC) { + } else if (reg & DVD_INTTYPE_TC) { return DVD_COVER_OPENED; - } - else { + } else { return DVD_COVER_CLOSED; } } @@ -2368,7 +2275,6 @@ void __DVDResetWithNoSpinup() { DVDLowReset(__BS2DVDLowCallback); while (!__BS2DVDLowIntType) { - } } @@ -2379,8 +2285,7 @@ void __DVDPrepareResetAsync(DVDCommandCallback callback) { if (Canceling) { CancelCallback = callback; - } - else { + } else { if (executing != NULL) { executing->callback = NULL; } @@ -2403,7 +2308,8 @@ void __DVDPrepareReset() { __DVDPrepareResetAsync(Callback); OSEnableInterrupts(); - while (Prepared != TRUE) { } + while (Prepared != TRUE) { + } } BOOL __DVDTestAlarm(OSAlarm* alarm) { @@ -2455,7 +2361,7 @@ void __DVDRestartMotor() { BOOL DVDDownRotationAsync(DVDCommandBlock* block, DVDCommandCallback callback) { BOOL idle; - block->command = COMMAND_SET_MAX_ROTATION; + block->command = COMMAND_SET_MAX_ROTATION; block->callback = callback; idle = issueCommand(DVD_PRIO_MEDIUM, block); return idle; @@ -2464,8 +2370,8 @@ BOOL DVDDownRotationAsync(DVDCommandBlock* block, DVDCommandCallback callback) { BOOL DVDGetPartitionParamsAsync(DVDCommandBlock* block, DVDPartitionParams* params, u32 offset, DVDCommandCallback callback) { BOOL idle; - params->numTmdBytes = 0; - params->numCertBytes = 0; + params->numTmdBytes = 0; + params->numCertBytes = 0; params->dataWordOffset = 0; block->command = COMMAND_GET_PARTITION_PARAMS; diff --git a/libs/RVL_SDK/src/dvd/dvd_broadway.c b/libs/RVL_SDK/src/dvd/dvd_broadway.c index 8de9a136..f3bc36d9 100644 --- a/libs/RVL_SDK/src/dvd/dvd_broadway.c +++ b/libs/RVL_SDK/src/dvd/dvd_broadway.c @@ -1,12 +1,12 @@ #include -#include #include +#include #include -#include #include +#include #include @@ -40,15 +40,15 @@ enum { }; typedef struct DVDLowContext { - DVDLowCallback callback; - int callbackType; + DVDLowCallback callback; + int callbackType; - bool inUse; + bool inUse; - u32 contextMagic; - u32 contextNum; + u32 contextMagic; + u32 contextNum; - u32 pad[3]; + u32 pad[3]; } DVDLowContext; typedef struct DVDLowRegValues { @@ -59,43 +59,43 @@ typedef struct DVDLowRegValues { } DVDLowRegValues; typedef struct DVDLowCommand { - u8 diCmd; - u8 pad1[3]; + u8 diCmd; + u8 pad1[3]; u32 arg[5]; u32 pad2[2]; } DVDLowCommand; -#define CONTEXT_MAGIC 0xFEEBDAED +#define CONTEXT_MAGIC 0xFEEBDAED IOSFd DiFD = -1; -static u32 coverRegister[8] ALIGN32; -static u32 statusRegister[8] ALIGN32; -static u32 coverStatus[8] ALIGN32; -static u32 statusRegister[8] ALIGN32; +static u32 coverRegister[8] ALIGN32; +static u32 statusRegister[8] ALIGN32; +static u32 coverStatus[8] ALIGN32; +static u32 statusRegister[8] ALIGN32; -static DVDLowContext dvdContexts[4] ALIGN32; -static DVDLowRegValues diRegValCache ALIGN32; -static u32 registerBuf[8] ALIGN32; -static IOSIoVector ioVec[10] ALIGN32; -static s32 lastTicketError[8] ALIGN32; +static DVDLowContext dvdContexts[4] ALIGN32; +static DVDLowRegValues diRegValCache ALIGN32; +static u32 registerBuf[8] ALIGN32; +static IOSIoVector ioVec[10] ALIGN32; +static s32 lastTicketError[8] ALIGN32; -static u8 breakRequested; -static DVDLowCommand* diCommand; +static u8 breakRequested; +static DVDLowCommand* diCommand; -static char* pathBuf; +static char* pathBuf; -static u32 readLength; +static u32 readLength; -static BOOL spinUpValue; -static u8 DVDLowInitCalled; -static u8 dvdContextsInited; +static BOOL spinUpValue; +static u8 DVDLowInitCalled; +static u8 dvdContextsInited; -static s32 freeDvdContext; -static int freeCommandBuf; +static s32 freeDvdContext; +static int freeCommandBuf; -static bool callbackInProgress; -static bool requestInProgress; +static bool callbackInProgress; +static bool requestInProgress; #define IS_ALIGNED(addr) (((u32)(addr) & 0x1F) == 0) @@ -148,8 +148,7 @@ IOSError doPrepareCoverRegisterCallback(IOSError ret, void* context) { if (dvdContext->contextMagic != CONTEXT_MAGIC) { OSReport("(doTransactionCallback) Error - context mangled!\n"); dvdContext->contextMagic = CONTEXT_MAGIC; - } - else { + } else { if (dvdContext->callback != 0) { callbackInProgress = true; @@ -168,8 +167,8 @@ IOSError doPrepareCoverRegisterCallback(IOSError ret, void* context) { } static void* ddrAllocAligned32(int size) { - void* low; - void* high; + void* low; + void* high; if (!IS_ALIGNED(size)) { return 0; @@ -203,7 +202,7 @@ static bool allocateStructures() { return false; } - return true; + return true; } static void initDvdContexts() { @@ -220,18 +219,20 @@ static void initDvdContexts() { } static inline DVDLowContext* newContext(DVDLowCallback callback, int type) { - int returnIndex; - bool use = dvdContexts[freeDvdContext].inUse != 0; + int returnIndex; + bool use = dvdContexts[freeDvdContext].inUse != 0; - if (use == true) { + if (use == true) { OSReport("(newContext) ERROR: freeDvdContext.inUse (#%d) is true\n", freeDvdContext); OSReport("(newContext) Now spinning in infinite loop\n"); - while (TRUE) {} + while (TRUE) { + } } if (dvdContexts[freeDvdContext].contextMagic != CONTEXT_MAGIC) { OSReport("(newContext) Something overwrote the context magic - spinning \n"); - while (TRUE) {} + while (TRUE) { + } } dvdContexts[freeDvdContext].callback = callback; @@ -293,8 +294,7 @@ bool DVDLowInit() { if (DiFD >= 0) { return true; - } - else { + } else { switch (DiFD) { case IPC_RESULT_NOEXISTS: { OSReport("(DVDLowInit) Error: IOS_Open failed - pathname '/dev/di' does not exist\n"); @@ -317,8 +317,8 @@ bool DVDLowInit() { } bool DVDLowReadDiskID(DVDDiskID* diskID, DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; requestInProgress = true; @@ -331,7 +331,8 @@ bool DVDLowReadDiskID(DVDDiskID* diskID, DVDLowCallback callback) { nextCommandBuf(&freeCommandBuf); diCommand[freeCommandBuf].diCmd = DVD_IOCTL_READ_DISK_ID; - ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_READ_DISK_ID, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), diskID, sizeof(DVDDiskID), doTransactionCallback, dvdContext); + ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_READ_DISK_ID, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), diskID, sizeof(DVDDiskID), + doTransactionCallback, dvdContext); if (ret != IPC_RESULT_OK) { OSReport("@@@ (DVDLowReadDiskID) IOS_IoctlAsync returned error: %d\n", ret); dvdContext->inUse = false; @@ -342,9 +343,9 @@ bool DVDLowReadDiskID(DVDDiskID* diskID, DVDLowCallback callback) { } bool DVDLowOpenPartition(u32 partitionWordOffset, ESTicket* eTicket, u32 numCertBytes, u8* certificates, ESTitleMeta* tmd, DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; - + DVDLowContext* dvdContext; + IOSError ret; + if (eTicket != 0 && !IS_ALIGNED(eTicket)) { OSReport("(DVDLowOpenPartition) eTicket memory is unaligned\n"); return false; @@ -374,17 +375,15 @@ bool DVDLowOpenPartition(u32 partitionWordOffset, ESTicket* eTicket, u32 numCert ioVec[1].base = (u8*)eTicket; if (eTicket == 0) { ioVec[1].length = 0; - } - else { + } else { ioVec[1].length = sizeof(ESTicket); } ioVec[2].base = (u8*)certificates; if (certificates == 0) { ioVec[2].length = 0; - } - else { - ioVec[2].length = numCertBytes; + } else { + ioVec[2].length = numCertBytes; } ioVec[3].base = (u8*)tmd; @@ -412,10 +411,11 @@ DECOMP_FORCE_ACTIVE(dvd_broadway_c, "(%s) tmd parameter cannot be NULL\n"); DECOMP_FORCE_ACTIVE(dvd_broadway_c, "(%s) tmd memory is unaligned\n"); DECOMP_FORCE_ACTIVE(dvd_broadway_c, "(%s) eTicket parameter cannot be NULL\n"); -bool DVDLowOpenPartitionWithTmdAndTicketView(u32 partitionWordOffset, ESTicketView* eTicketView, u32 numTmdBytes, ESTitleMeta* tmd, u32 numCertBytes, u8* certificates, DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; - +bool DVDLowOpenPartitionWithTmdAndTicketView(u32 partitionWordOffset, ESTicketView* eTicketView, u32 numTmdBytes, ESTitleMeta* tmd, u32 numCertBytes, + u8* certificates, DVDLowCallback callback) { + DVDLowContext* dvdContext; + IOSError ret; + if (certificates != 0 && !IS_ALIGNED(certificates)) { return false; } @@ -423,8 +423,7 @@ bool DVDLowOpenPartitionWithTmdAndTicketView(u32 partitionWordOffset, ESTicketVi if (tmd == 0) { OSReport("(%s) tmd parameter cannot be NULL\n", __FUNCTION__); return false; - } - else if (!IS_ALIGNED(tmd)) { + } else if (!IS_ALIGNED(tmd)) { OSReport("(%s) tmd memory is unaligned\n", __FUNCTION__); return false; } @@ -432,8 +431,7 @@ bool DVDLowOpenPartitionWithTmdAndTicketView(u32 partitionWordOffset, ESTicketVi if (eTicketView == 0) { OSReport("(%s) eTicketView parameter cannot be NULL\n", __FUNCTION__); return false; - } - else if (!IS_ALIGNED(eTicketView)) { + } else if (!IS_ALIGNED(eTicketView)) { OSReport("(%s) eTicketView memory is unaligned\n", __FUNCTION__); return false; } @@ -458,9 +456,8 @@ bool DVDLowOpenPartitionWithTmdAndTicketView(u32 partitionWordOffset, ESTicketVi ioVec[3].base = (u8*)certificates; if (certificates == 0) { ioVec[3].length = 0; - } - else { - ioVec[3].length = numCertBytes; + } else { + ioVec[3].length = numCertBytes; } ioVec[4].base = (u8*)&lastTicketError[0]; @@ -477,8 +474,8 @@ bool DVDLowOpenPartitionWithTmdAndTicketView(u32 partitionWordOffset, ESTicketVi } bool DVDLowGetNoDiscBufferSizes(const u32 partitionWordOffset, u32* numTmdBytes, u32* numCertBytes, DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; if (numTmdBytes == 0 || numCertBytes == 0) { OSReport("(%s) Error: NULL pointer argument\n", __FUNCTION__); @@ -522,16 +519,18 @@ bool DVDLowGetNoDiscBufferSizes(const u32 partitionWordOffset, u32* numTmdBytes, return true; } -bool DVDLowGetNoDiscOpenPartitionParams(const u32 partitionWordOffset, ESTicket* eTicket, u32* numTmdBytes, ESTitleMeta* tmd, u32* numCertBytes, u8* certificates, u32* dataWordOffset, u8* h3HashPtr, DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; +bool DVDLowGetNoDiscOpenPartitionParams(const u32 partitionWordOffset, ESTicket* eTicket, u32* numTmdBytes, ESTitleMeta* tmd, u32* numCertBytes, + u8* certificates, u32* dataWordOffset, u8* h3HashPtr, DVDLowCallback callback) { + DVDLowContext* dvdContext; + IOSError ret; if (eTicket == 0 || numTmdBytes == 0 || tmd == 0 || numCertBytes == 0 || certificates == 0 || dataWordOffset == 0 || h3HashPtr == 0) { OSReport("(%s) Error: NULL pointer argument\n", __FUNCTION__); return false; } - if (!IS_ALIGNED(eTicket) || !IS_ALIGNED(numTmdBytes) || !IS_ALIGNED(tmd) || !IS_ALIGNED(numCertBytes) || !IS_ALIGNED(certificates) || !IS_ALIGNED(dataWordOffset) || !IS_ALIGNED(h3HashPtr)) { + if (!IS_ALIGNED(eTicket) || !IS_ALIGNED(numTmdBytes) || !IS_ALIGNED(tmd) || !IS_ALIGNED(numCertBytes) || !IS_ALIGNED(certificates) || + !IS_ALIGNED(dataWordOffset) || !IS_ALIGNED(h3HashPtr)) { OSReport("(%s) pointer argument is unaligned\n", __FUNCTION__); return false; } @@ -554,7 +553,7 @@ bool DVDLowGetNoDiscOpenPartitionParams(const u32 partitionWordOffset, ESTicket* ioVec[3].base = (u8*)eTicket; ioVec[3].length = sizeof(ESTicket); - ioVec[4].base = (u8*) numTmdBytes; + ioVec[4].base = (u8*)numTmdBytes; ioVec[4].length = 4; ioVec[5].base = (u8*)tmd; @@ -585,8 +584,8 @@ bool DVDLowGetNoDiscOpenPartitionParams(const u32 partitionWordOffset, ESTicket* DECOMP_FORCE_ACTIVE(dvd_broadway_c, "DVDLowNoDiscOpenPartition"); bool DVDLowClosePartition(DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; nextCommandBuf(&freeCommandBuf); diCommand[freeCommandBuf].diCmd = DVD_IOCTL_CLOSE_PARTITION; @@ -605,8 +604,8 @@ bool DVDLowClosePartition(DVDLowCallback callback) { } bool DVDLowUnencryptedRead(void* destAddr, u32 length, u32 wordOffset, DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; requestInProgress = true; @@ -618,7 +617,8 @@ bool DVDLowUnencryptedRead(void* destAddr, u32 length, u32 wordOffset, DVDLowCal diCommand[freeCommandBuf].arg[0] = length; diCommand[freeCommandBuf].arg[1] = wordOffset; - ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_UNENCRYPTED_READ, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), destAddr, length, doTransactionCallback, dvdContext); + ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_UNENCRYPTED_READ, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), destAddr, length, doTransactionCallback, + dvdContext); if (ret != IPC_RESULT_OK) { OSReport("@@@ (DVDLowUnencryptedRead) IOS_IoctlAsync returned error: %d\n", ret); dvdContext->inUse = false; @@ -629,8 +629,8 @@ bool DVDLowUnencryptedRead(void* destAddr, u32 length, u32 wordOffset, DVDLowCal } bool DVDLowStopMotor(bool eject, bool saving, DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; requestInProgress = true; @@ -641,7 +641,8 @@ bool DVDLowStopMotor(bool eject, bool saving, DVDLowCallback callback) { diCommand[freeCommandBuf].arg[0] = eject; diCommand[freeCommandBuf].arg[1] = saving; - ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_STOP_MOTOR, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), &diRegValCache, sizeof(DVDLowRegValues), doTransactionCallback, dvdContext); + ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_STOP_MOTOR, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), &diRegValCache, sizeof(DVDLowRegValues), + doTransactionCallback, dvdContext); if (ret != IPC_RESULT_OK) { OSReport("@@@ (DVDLowStopMotor) IOS_IoctlAsync returned error: %d\n", ret); dvdContext->inUse = false; @@ -659,8 +660,8 @@ DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowNotifyReset) IOS_IoctlAsync retu DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowReset) IOS_IoctlAsync returned error: %d\n"); bool DVDLowInquiry(DVDDriveInfo* info, DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; requestInProgress = true; @@ -669,7 +670,8 @@ bool DVDLowInquiry(DVDDriveInfo* info, DVDLowCallback callback) { nextCommandBuf(&freeCommandBuf); diCommand[freeCommandBuf].diCmd = DVD_IOCTL_INQUIRY; - ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_INQUIRY, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), info, sizeof(DVDDriveInfo), doTransactionCallback, dvdContext); + ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_INQUIRY, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), info, sizeof(DVDDriveInfo), + doTransactionCallback, dvdContext); if (ret != IPC_RESULT_OK) { OSReport("@@@ (DVDLowInquiry) IOS_IoctlAsync returned error: %d\n", ret); dvdContext->inUse = false; @@ -680,8 +682,8 @@ bool DVDLowInquiry(DVDDriveInfo* info, DVDLowCallback callback) { } bool DVDLowRequestError(DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; requestInProgress = true; @@ -690,7 +692,8 @@ bool DVDLowRequestError(DVDLowCallback callback) { nextCommandBuf(&freeCommandBuf); diCommand[freeCommandBuf].diCmd = DVD_IOCTL_REQUEST_ERROR; - ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_REQUEST_ERROR, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), &diRegValCache, sizeof(DVDLowRegValues), doTransactionCallback, dvdContext); + ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_REQUEST_ERROR, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), &diRegValCache, sizeof(DVDLowRegValues), + doTransactionCallback, dvdContext); if (ret != IPC_RESULT_OK) { OSReport("@@@ (DVDLowRequestError) IOS_IoctlAsync returned error: %d\n", ret); dvdContext->inUse = false; @@ -706,8 +709,8 @@ bool DVDLowSetSpinupFlag(u32 spinUp) { } bool DVDLowReset(DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; requestInProgress = true; @@ -728,8 +731,8 @@ bool DVDLowReset(DVDLowCallback callback) { } bool DVDLowAudioBufferConfig(BOOL enable, u32 size, DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; requestInProgress = true; @@ -740,7 +743,8 @@ bool DVDLowAudioBufferConfig(BOOL enable, u32 size, DVDLowCallback callback) { diCommand[freeCommandBuf].arg[0] = enable; diCommand[freeCommandBuf].arg[1] = size; - ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_AUDIO_BUFFER_CONFIG, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), &diRegValCache, sizeof(DVDLowRegValues), doTransactionCallback, dvdContext); + ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_AUDIO_BUFFER_CONFIG, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), &diRegValCache, + sizeof(DVDLowRegValues), doTransactionCallback, dvdContext); if (ret != IPC_RESULT_OK) { OSReport("@@@ (DVDLowAudioBufferConfig) IOS_IoctlAsync returned error: %d\n", ret); dvdContext->inUse = false; @@ -766,8 +770,8 @@ DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowRequestDiscStatus) IOS_IoctlAsyn DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowRequestRetryNumber) IOS_IoctlAsync returned error: %d\n"); bool DVDLowSetMaximumRotation(u32 subcmd, DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; requestInProgress = true; @@ -777,7 +781,8 @@ bool DVDLowSetMaximumRotation(u32 subcmd, DVDLowCallback callback) { diCommand[freeCommandBuf].diCmd = DVD_IOCTL_SET_MAX_ROTATION; diCommand[freeCommandBuf].arg[0] = (subcmd >> 16) & 3; - ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_SET_MAX_ROTATION, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), 0, 0, doTransactionCallback, dvdContext); + ret = + IOS_IoctlAsync(DiFD, DVD_IOCTL_SET_MAX_ROTATION, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), 0, 0, doTransactionCallback, dvdContext); if (ret != IPC_RESULT_OK) { OSReport("@@@ (DVDLowSetMaxRotation) IOS_IoctlAsync returned error: %d\n", ret); dvdContext->inUse = false; @@ -788,8 +793,8 @@ bool DVDLowSetMaximumRotation(u32 subcmd, DVDLowCallback callback) { } bool DVDLowRead(void* destAddr, u32 length, u32 wordOffset, DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; if (!IS_ALIGNED(destAddr)) { OSReport("(DVDLowRead): ERROR - destAddr buffer is not 32 byte aligned\n"); @@ -806,7 +811,8 @@ bool DVDLowRead(void* destAddr, u32 length, u32 wordOffset, DVDLowCallback callb diCommand[freeCommandBuf].arg[0] = length; diCommand[freeCommandBuf].arg[1] = wordOffset; - ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_READ, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), destAddr, length, doTransactionCallback, dvdContext); + ret = + IOS_IoctlAsync(DiFD, DVD_IOCTL_READ, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), destAddr, length, doTransactionCallback, dvdContext); if (ret != IPC_RESULT_OK) { OSReport("@@@ (DVDLowRead) IOS_IoctlAsync returned error: %d\n", ret); dvdContext->inUse = false; @@ -817,8 +823,8 @@ bool DVDLowRead(void* destAddr, u32 length, u32 wordOffset, DVDLowCallback callb } bool DVDLowSeek(u32 wordOffset, DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; requestInProgress = true; @@ -850,8 +856,8 @@ u32 DVDLowGetStatusRegister() { } bool DVDLowPrepareCoverRegister(DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; nextCommandBuf(&freeCommandBuf); diCommand[freeCommandBuf].diCmd = DVD_IOCTL_PREPARE_COVER_REGISTER; @@ -860,7 +866,8 @@ bool DVDLowPrepareCoverRegister(DVDLowCallback callback) { dvdContext = newContext(callback, 1); - ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_PREPARE_COVER_REGISTER, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), registerBuf, sizeof(registerBuf), doPrepareCoverRegisterCallback, dvdContext); + ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_PREPARE_COVER_REGISTER, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), registerBuf, sizeof(registerBuf), + doPrepareCoverRegisterCallback, dvdContext); if (ret != IPC_RESULT_OK) { OSReport("@@@ (DVDLowPrepareCoverRegsiter) IOS_IoctlAsync returned error: %d\n", ret); dvdContext->inUse = false; @@ -871,8 +878,8 @@ bool DVDLowPrepareCoverRegister(DVDLowCallback callback) { } bool DVDLowPrepareStatusRegister(DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; nextCommandBuf(&freeCommandBuf); diCommand[freeCommandBuf].diCmd = DVD_IOCTL_PREPARE_STATUS_REGISTER; @@ -881,7 +888,8 @@ bool DVDLowPrepareStatusRegister(DVDLowCallback callback) { dvdContext = newContext(callback, 1); - ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_PREPARE_STATUS_REGISTER, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), statusRegister, sizeof(statusRegister), doTransactionCallback, dvdContext); + ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_PREPARE_STATUS_REGISTER, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), statusRegister, + sizeof(statusRegister), doTransactionCallback, dvdContext); if (ret != IPC_RESULT_OK) { OSReport("@@@ (DVDLowPrepareStatusRegsiter) IOS_IoctlAsync returned error: %d\n", ret); dvdContext->inUse = false; @@ -904,8 +912,8 @@ bool DVDLowMaskCoverInterrupt() { } bool DVDLowClearCoverInterrupt(DVDLowCallback callback) { - DVDLowContext* dvdContext; - IOSError ret; + DVDLowContext* dvdContext; + IOSError ret; nextCommandBuf(&freeCommandBuf); diCommand[freeCommandBuf].diCmd = DVD_IOCTL_CLEAR_COVER_INTERRUPT; @@ -914,7 +922,8 @@ bool DVDLowClearCoverInterrupt(DVDLowCallback callback) { dvdContext = newContext(callback, 1); - ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_CLEAR_COVER_INTERRUPT, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), 0, 0, doTransactionCallback, dvdContext); + ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_CLEAR_COVER_INTERRUPT, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), 0, 0, doTransactionCallback, + dvdContext); if (ret != IPC_RESULT_OK) { OSReport("@@@ (DVDLowClearCoverInterrupt) IOS_IoctlAsync returned error: %d\n", ret); dvdContext->inUse = false; @@ -932,4 +941,4 @@ BOOL __DVDLowTestAlarm(OSAlarm* alarm) { return FALSE; } -DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowEnableDvdVideo) IOS_IoctlAsync returned error: %d\n"); // DVD video... +DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowEnableDvdVideo) IOS_IoctlAsync returned error: %d\n"); // DVD video... diff --git a/libs/RVL_SDK/src/dvd/dvderror.c b/libs/RVL_SDK/src/dvd/dvderror.c index 05d01c77..155175d1 100644 --- a/libs/RVL_SDK/src/dvd/dvderror.c +++ b/libs/RVL_SDK/src/dvd/dvderror.c @@ -1,21 +1,21 @@ #include -#include #include +#include -#include #include +#include -static BOOL ExistFlag = FALSE; +static BOOL ExistFlag = FALSE; -static NANDCommandBlock NandCb; -static NANDFileInfo NandInfo; +static NANDCommandBlock NandCb; +static NANDFileInfo NandInfo; -static DVDCommandCallback Callback; -static u32 NextOffset; +static DVDCommandCallback Callback; +static u32 NextOffset; -DVDErrorInfo __ErrorInfo ALIGN32; -DVDErrorInfo __FirstErrorInfo ALIGN32; +DVDErrorInfo __ErrorInfo ALIGN32; +DVDErrorInfo __FirstErrorInfo ALIGN32; void cbForNandClose(s32 result, NANDCommandBlock* block) { if (Callback) { @@ -38,8 +38,7 @@ void cbForNandSeek(s32 result, NANDCommandBlock* block) { if (NANDWriteAsync(&NandInfo, (void*)&__ErrorInfo, sizeof(__ErrorInfo), cbForNandWrite, &NandCb) != NAND_RESULT_OK) { cbForNandWrite(-1, NULL); } - } - else { + } else { if (Callback) { Callback(2, NULL); } @@ -51,8 +50,7 @@ void cbForNandWrite0(s32 result, NANDCommandBlock* block) { if (NANDSeekAsync(&NandInfo, (sizeof(DVDErrorInfo) * (1 + NextOffset)), NAND_SEEK_BEG, cbForNandSeek, &NandCb) != NAND_RESULT_OK) { cbForNandSeek(-1, NULL); } - } - else { + } else { if (Callback) { Callback(2, NULL); } @@ -66,8 +64,7 @@ void cbForNandSeek2(s32 result, NANDCommandBlock* block) { if (NANDWriteAsync(&NandInfo, (void*)&__FirstErrorInfo, sizeof(__FirstErrorInfo), cbForNandWrite0, &NandCb) != NAND_RESULT_OK) { cbForNandWrite0(-1, NULL); } - } - else { + } else { if (Callback) { Callback(2, NULL); } @@ -81,8 +78,7 @@ void cbForNandRead(s32 result, NANDCommandBlock* block) { if (NANDSeekAsync(&NandInfo, sizeof(DVDErrorInfo), NAND_SEEK_BEG, cbForNandSeek2, &NandCb) != NAND_RESULT_OK) { cbForNandSeek2(-1, NULL); } - } - else { + } else { __ErrorInfo.nextOffset = 1; if (NANDWriteAsync(&NandInfo, (void*)&__ErrorInfo, sizeof(__ErrorInfo), cbForNandWrite, &NandCb) != NAND_RESULT_OK) { cbForNandWrite(-1, NULL); @@ -98,8 +94,7 @@ void cbForNandSeek0(s32 result, NANDCommandBlock* block) { if (NANDWriteAsync(&NandInfo, (void*)&__FirstErrorInfo, sizeof(__FirstErrorInfo), cbForNandWrite0, &NandCb) != NAND_RESULT_OK) { cbForNandWrite0(-1, NULL); } - } - else { + } else { if (Callback) { Callback(2, NULL); } @@ -111,8 +106,7 @@ void cbForNandSeek1(s32 result, NANDCommandBlock* block) { if (NANDReadAsync(&NandInfo, (void*)&__FirstErrorInfo, sizeof(__FirstErrorInfo), cbForNandRead, &NandCb) != NAND_RESULT_OK) { cbForNandRead(-1, NULL); } - } - else { + } else { if (NANDSeekAsync(&NandInfo, 0, 0, cbForNandSeek0, &NandCb) != NAND_RESULT_OK) { cbForNandSeek0(-1, NULL); } @@ -125,16 +119,14 @@ void cbForNandOpen(s32 result, NANDCommandBlock* block) { if (NANDSeekAsync(&NandInfo, sizeof(DVDErrorInfo), NAND_SEEK_BEG, cbForNandSeek1, &NandCb) != NAND_RESULT_OK) { cbForNandSeek1(-1, NULL); } - } - else { + } else { NextOffset = 0; __ErrorInfo.nextOffset = 1; if (NANDWriteAsync(&NandInfo, (void*)&__FirstErrorInfo, sizeof(__FirstErrorInfo), cbForNandWrite0, &NandCb) != NAND_RESULT_OK) { cbForNandWrite0(-1, NULL); } } - } - else { + } else { if (Callback) { Callback(2, NULL); } @@ -149,11 +141,10 @@ void cbForNandCreate(s32 result, NANDCommandBlock* block) { if (NANDPrivateOpenAsync("/shared2/test2/dvderror.dat", &NandInfo, NAND_ACCESS_RW, cbForNandOpen, &NandCb) != NAND_RESULT_OK) { if (Callback) { - Callback(2, NULL); + Callback(2, NULL); } } - } - else { + } else { if (Callback) { Callback(2, NULL); } @@ -162,13 +153,12 @@ void cbForNandCreate(s32 result, NANDCommandBlock* block) { void cbForNandCreateDir(s32 result, NANDCommandBlock* block) { if (result == NAND_RESULT_OK || result == NAND_RESULT_EXISTS) { - if (NANDPrivateCreateAsync("/shared2/test2/dvderror.dat", NAND_PERM_ALL_RW, 0, cbForNandCreate, &NandCb) != NAND_RESULT_OK) { + if (NANDPrivateCreateAsync("/shared2/test2/dvderror.dat", NAND_PERM_ALL_RW, 0, cbForNandCreate, &NandCb) != NAND_RESULT_OK) { if (Callback) { Callback(2, NULL); } } - } - else { + } else { if (Callback) { Callback(2, NULL); } @@ -178,8 +168,7 @@ void cbForNandCreateDir(s32 result, NANDCommandBlock* block) { void cbForPrepareStatusRegister(u32 intType) { if (intType == DVD_INTTYPE_TC) { __ErrorInfo.status = DVDLowGetStatusRegister(); - } - else { + } else { __ErrorInfo.status = 0xFFFFFFFF; } diff --git a/libs/RVL_SDK/src/dvd/dvdfs.c b/libs/RVL_SDK/src/dvd/dvdfs.c index fce36b31..688539fe 100644 --- a/libs/RVL_SDK/src/dvd/dvdfs.c +++ b/libs/RVL_SDK/src/dvd/dvdfs.c @@ -1,5 +1,5 @@ -#include #include +#include #include #include @@ -10,40 +10,40 @@ // Few functions are unused. Make sure that they link. #pragma force_active on -extern u32 __DVDLayoutFormat; +extern u32 __DVDLayoutFormat; typedef struct FSTEntry { u32 isDirAndStringOff; // 0x00 union { struct { - u32 parent; // 0x04 - u32 next; // 0x08 + u32 parent; // 0x04 + u32 next; // 0x08 } dir; struct { - u32 position; // 0x04 - u32 length; // 0x08 + u32 position; // 0x04 + u32 length; // 0x08 } file; }; } FSTEntry; -static OSBootInfo* BootInfo; +static OSBootInfo* BootInfo; -static FSTEntry* FstStart; -static char* FstStringStart; +static FSTEntry* FstStart; +static char* FstStringStart; -static u32 MaxEntryNum; +static u32 MaxEntryNum; -static u32 currentDirectory = 0; +static u32 currentDirectory = 0; -OSThreadQueue __DVDThreadQueue; +OSThreadQueue __DVDThreadQueue; -u32 __DVDLongFileNameFlag = TRUE; +u32 __DVDLongFileNameFlag = TRUE; static void cbForReadAsync(s32 result, DVDCommandBlock* block); static void cbForReadSync(s32 result, DVDCommandBlock* block); -#define IS_ENTRY_DIR(fstStart, i) ((((fstStart)[i].isDirAndStringOff & 0xFF000000) == 0) ? FALSE : TRUE) -#define FILE_STRING_OFF(fstStart, i) ((fstStart)[i].isDirAndStringOff & 0x00FFFFFF) +#define IS_ENTRY_DIR(fstStart, i) ((((fstStart)[i].isDirAndStringOff & 0xFF000000) == 0) ? FALSE : TRUE) +#define FILE_STRING_OFF(fstStart, i) ((fstStart)[i].isDirAndStringOff & 0x00FFFFFF) static BOOL DVDGetCurrentDir(char* path, u32 maxlen); @@ -73,14 +73,14 @@ static BOOL isSame(const char* path, const char* str) { s32 DVDConvertPathToEntrynum(const char* path) { const char* ptrPath; - char* name; + char* name; BOOL isDir; - s32 pathLen, dirLookAt, i; + s32 pathLen, dirLookAt, i; const char* origPathPtr = path; const char* hasExtensionStart; - + BOOL isInvalid, hasExtension; dirLookAt = currentDirectory; @@ -89,7 +89,7 @@ s32 DVDConvertPathToEntrynum(const char* path) { // End of path? Done! if (*path == 0) { return dirLookAt; - } + } // Ignore initial slash. else if (*path == '/') { dirLookAt = 0; @@ -106,17 +106,17 @@ s32 DVDConvertPathToEntrynum(const char* path) { continue; } // If the input path was literally just `../`, then return the parent. - else if (*(path+2) == 0) { + else if (*(path + 2) == 0) { return FstStart[dirLookAt].dir.parent; } } // "." directory does nothing - else if (*(path+1) == '/') { + else if (*(path + 1) == '/') { path += 2; continue; } // Ignore trailing dot - else if (*(path+1) == 0) { + else if (*(path + 1) == 0) { return dirLookAt; } } @@ -135,8 +135,7 @@ s32 DVDConvertPathToEntrynum(const char* path) { hasExtension = TRUE; hasExtensionStart = ptrPath + 1; - } - else if (*ptrPath == ' ') { + } else if (*ptrPath == ' ') { isInvalid = TRUE; } } @@ -146,10 +145,13 @@ s32 DVDConvertPathToEntrynum(const char* path) { } // Yeah I wonder how soon the restriction was finally patched out (or was it even patched out at ALL) - OSAssertVMsg(!isInvalid, 443, "DVDConvertEntrynumToPath(possibly DVDOpen or DVDChangeDir or DVDOpenDir): specified directory or file (%s) doesn't match standard 8.3 format. This is a temporary restriction and will be removed soon\n", origPathPtr); - } - else { - for (ptrPath = path; (*ptrPath != '\0') && (*ptrPath != '/'); ptrPath++) {} + OSAssertVMsg(!isInvalid, 443, + "DVDConvertEntrynumToPath(possibly DVDOpen or DVDChangeDir or DVDOpenDir): specified directory or file (%s) doesn't match " + "standard 8.3 format. This is a temporary restriction and will be removed soon\n", + origPathPtr); + } else { + for (ptrPath = path; (*ptrPath != '\0') && (*ptrPath != '/'); ptrPath++) { + } } isDir = (*ptrPath == '\0') ? FALSE : TRUE; @@ -157,7 +159,7 @@ s32 DVDConvertPathToEntrynum(const char* path) { ptrPath = path; - for (i = dirLookAt+1; i < FstStart[dirLookAt].dir.next; i = IS_ENTRY_DIR(FstStart, i) ? FstStart[i].dir.next : (i + 1)) { + for (i = dirLookAt + 1; i < FstStart[dirLookAt].dir.next; i = IS_ENTRY_DIR(FstStart, i) ? FstStart[i].dir.next : (i + 1)) { // Skip directories if (IS_ENTRY_DIR(FstStart, i) == FALSE && isDir == TRUE) { continue; @@ -173,7 +175,7 @@ s32 DVDConvertPathToEntrynum(const char* path) { return -1; -next_in_hier: + next_in_hier: if (!isDir) { return i; } @@ -249,7 +251,7 @@ u32 entryToPath(u32 entry, char* path, u32 maxlen) { } name = FstStringStart + FILE_STRING_OFF(FstStart, entry); - loc = entryToPath(FstStart[entry].dir.parent , path, maxlen); + loc = entryToPath(FstStart[entry].dir.parent, path, maxlen); if (loc == maxlen) { return loc; @@ -316,7 +318,7 @@ s32 DVDReadPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset, s32 p block = &fileInfo->cb; result = DVDReadAbsAsyncPrio(block, addr, length, (u32)(fileInfo->startAddr + (offset >> 2)), cbForReadSync, prio); - + if (result == FALSE) { return -1; } diff --git a/libs/RVL_SDK/src/dvd/dvdidutils.c b/libs/RVL_SDK/src/dvd/dvdidutils.c index 1054b8be..a33de3df 100644 --- a/libs/RVL_SDK/src/dvd/dvdidutils.c +++ b/libs/RVL_SDK/src/dvd/dvdidutils.c @@ -3,23 +3,19 @@ #include BOOL DVDCompareDiskID(const DVDDiskID* id1, const DVDDiskID* id2) { - if (id1->gameName[0] != 0 && id2->gameName[0] != 0 - && strncmp(id1->gameName, id2->gameName, 4) != 0) { + if (id1->gameName[0] != 0 && id2->gameName[0] != 0 && strncmp(id1->gameName, id2->gameName, 4) != 0) { return FALSE; } - if (id1->company[0] == 0 || id2->company[0] == 0 - || strncmp(id1->company, id2->company, 2) != 0) { + if (id1->company[0] == 0 || id2->company[0] == 0 || strncmp(id1->company, id2->company, 2) != 0) { return FALSE; } - if (id1->diskNumber != 0xFF && id2->diskNumber != 0xFF - && id1->diskNumber != id2->diskNumber) { + if (id1->diskNumber != 0xFF && id2->diskNumber != 0xFF && id1->diskNumber != id2->diskNumber) { return FALSE; } - if (id1->gameVersion != 0xFF && id2->gameVersion != 0xFF - && id1->gameVersion != id2->gameVersion) { + if (id1->gameVersion != 0xFF && id2->gameVersion != 0xFF && id1->gameVersion != id2->gameVersion) { return FALSE; } diff --git a/libs/RVL_SDK/src/dvd/dvdqueue.c b/libs/RVL_SDK/src/dvd/dvdqueue.c index b8d5117c..8eb65354 100644 --- a/libs/RVL_SDK/src/dvd/dvdqueue.c +++ b/libs/RVL_SDK/src/dvd/dvdqueue.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -8,7 +8,7 @@ typedef struct Queue { DVDCommandBlock* prev; // 0x04 } Queue; -#define MAX_QUEUE 4 +#define MAX_QUEUE 4 static Queue WaitingQueue[MAX_QUEUE]; @@ -37,7 +37,7 @@ BOOL __DVDPushWaitingQueue(s32 prio, DVDCommandBlock* block) { } static DVDCommandBlock* PopWaitingQueuePrio(s32 prio) { - DVDCommandBlock* tmp, *block; + DVDCommandBlock *tmp, *block; BOOL enabled = OSDisableInterrupts(); block = (DVDCommandBlock*)&WaitingQueue[prio]; @@ -93,8 +93,8 @@ BOOL __DVDCheckWaitingQueue() { DVDCommandBlock* __DVDGetNextWaitingQueue() { int i; - DVDCommandBlock* block; - DVDCommandBlock* next; + DVDCommandBlock* block; + DVDCommandBlock* next; BOOL enabled = OSDisableInterrupts(); @@ -113,8 +113,8 @@ DVDCommandBlock* __DVDGetNextWaitingQueue() { } BOOL __DVDDequeueWaitingQueue(DVDCommandBlock* block) { - DVDCommandBlock* prev; - DVDCommandBlock* next; + DVDCommandBlock* prev; + DVDCommandBlock* next; BOOL enabled = OSDisableInterrupts(); diff --git a/libs/RVL_SDK/src/enc/encconvert.c b/libs/RVL_SDK/src/enc/encconvert.c index 90701263..59676ecb 100644 --- a/libs/RVL_SDK/src/enc/encconvert.c +++ b/libs/RVL_SDK/src/enc/encconvert.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -9,166 +9,168 @@ static ENCResult ENCiConvertToInternalEncoding(ENCContext* context, u16* dst, s3 static ENCResult ENCiConvertFromInternalEncoding(ENCContext* context, void* dst, s32* dstSize, const u16* src, s32* srcSize); struct encoding const encoding_array[] = { - { (0), FALSE, ""}, // none - {sizeof(char), TRUE, "US-ASCII"}, // ASCII - {sizeof(u8), FALSE, "UTF-8"}, // UTF-8 - {sizeof(u16), FALSE, "UTF-16BE"}, // UTF-16 - {sizeof(u32), FALSE, "UTF-32BE"}, // UTF-32 - {sizeof(u8), FALSE, "ISO-8859-1"}, // extASCII - {sizeof(u8), FALSE, "ISO-8859-2"}, // extASCII - {sizeof(u8), FALSE, "ISO-8859-3"}, // extASCII - {sizeof(u8), FALSE, "ISO-8859-7"}, // extASCII - {sizeof(u8), FALSE, "ISO-8859-10"}, // extASCII - {sizeof(u8), FALSE, "ISO-8859-15"}, // extASCII - {sizeof(char), TRUE, "ISO-2022-JP"}, // stateful - {sizeof(u8), FALSE, "Shift_JIS"}, // multi-byte - {sizeof(u8), FALSE, "windows-1252"}, // extASCII - {sizeof(u8), FALSE, "EUC-KR"}, // multi-byte - {sizeof(u8), FALSE, "GB2312"}, // multi-byte - {sizeof(char), TRUE, "UTF-7"}, // stateful - {sizeof(u16), FALSE, "UTF-16"}, // UTF-16 - {sizeof(u16), FALSE, "UTF-16LE"}, // UTF-16 - {sizeof(u8), FALSE, "windows-1250"}, // extASCII - {sizeof(u8), FALSE, "windows-1253"}, // extASCII - {sizeof(u8), FALSE, "macintosh"}, // extASCII - {sizeof(u8), FALSE, "x-mac-greek"}, // extASCII - {sizeof(u8), FALSE, "x-mac-ce"}, // extASCII - {sizeof(u8), FALSE, "IBM850"}, // extASCII - {sizeof(u8), FALSE, "IBM852"}, // extASCII + {(0), FALSE, ""}, // none + {sizeof(char), TRUE, "US-ASCII"}, // ASCII + {sizeof(u8), FALSE, "UTF-8"}, // UTF-8 + {sizeof(u16), FALSE, "UTF-16BE"}, // UTF-16 + {sizeof(u32), FALSE, "UTF-32BE"}, // UTF-32 + {sizeof(u8), FALSE, "ISO-8859-1"}, // extASCII + {sizeof(u8), FALSE, "ISO-8859-2"}, // extASCII + {sizeof(u8), FALSE, "ISO-8859-3"}, // extASCII + {sizeof(u8), FALSE, "ISO-8859-7"}, // extASCII + {sizeof(u8), FALSE, "ISO-8859-10"}, // extASCII + {sizeof(u8), FALSE, "ISO-8859-15"}, // extASCII + {sizeof(char), TRUE, "ISO-2022-JP"}, // stateful + {sizeof(u8), FALSE, "Shift_JIS"}, // multi-byte + {sizeof(u8), FALSE, "windows-1252"}, // extASCII + {sizeof(u8), FALSE, "EUC-KR"}, // multi-byte + {sizeof(u8), FALSE, "GB2312"}, // multi-byte + {sizeof(char), TRUE, "UTF-7"}, // stateful + {sizeof(u16), FALSE, "UTF-16"}, // UTF-16 + {sizeof(u16), FALSE, "UTF-16LE"}, // UTF-16 + {sizeof(u8), FALSE, "windows-1250"}, // extASCII + {sizeof(u8), FALSE, "windows-1253"}, // extASCII + {sizeof(u8), FALSE, "macintosh"}, // extASCII + {sizeof(u8), FALSE, "x-mac-greek"}, // extASCII + {sizeof(u8), FALSE, "x-mac-ce"}, // extASCII + {sizeof(u8), FALSE, "IBM850"}, // extASCII + {sizeof(u8), FALSE, "IBM852"}, // extASCII }; const struct encoding_hash_table_entry encoding_table[] = { // Hash table entries // Hex indices redirect to another entry, decimal entries do not - {"iso885910", ENC_ENCODING_ISO_8859_10, 0}, - {"iso88591windows30latin1", ENC_ENCODING_WINDOWS_1252, 1}, - {"utf16le", ENC_ENCODING_UTF_16LE, 0x41}, // -> "iso88591windows31latin1" - {"utf7", ENC_ENCODING_UTF_7, 3}, - {"utf8", ENC_ENCODING_UTF_8, 4}, - {"ascii", ENC_ENCODING_US_ASCII, 0x00}, // -> "iso885910" - {"iso885915", ENC_ENCODING_ISO_8859_15, 0x74}, // -> "euccn" - {"iso10646ucs2be", ENC_ENCODING_UTF_16BE, 0x3c}, // -> "mskanji " - {"iso646irv1991", ENC_ENCODING_US_ASCII, 8}, - {"iso10646ucs4be", ENC_ENCODING_UTF_32BE, 0x65}, // -> "ksc5601" - {"greek", ENC_ENCODING_ISO_8859_7, 0x06}, // -> "iso885915" - {"ansix341968", ENC_ENCODING_US_ASCII, 0x0c}, // -> "ansix341986" - {"ansix341986", ENC_ENCODING_US_ASCII, 12}, - {"isolatin1", ENC_ENCODING_ISO_8859_1, 13}, - {"iso10646ucsbasic", ENC_ENCODING_UTF_16BE, 0x28}, // -> "isolatin2" - {"isolatin3", ENC_ENCODING_ISO_8859_3, 15}, - {"iso646us", ENC_ENCODING_US_ASCII, 16}, - {"iso10646ucs2le", ENC_ENCODING_UTF_16LE, 17}, - {"isolatin6", ENC_ENCODING_ISO_8859_10, 18}, - {"cp1200", ENC_ENCODING_UTF_16, 19}, - {"isoir6", ENC_ENCODING_US_ASCII, 20}, - {"unicode11utf8", ENC_ENCODING_UTF_8, 0x19}, // -> "unicode20utf8" - {"iso2022jp1", ENC_ENCODING_ISO_2022_JP, 0x60}, // -> "euckr" - {"iso2022jp2", ENC_ENCODING_ISO_2022_JP, 23}, - {"cp1250", ENC_ENCODING_WINDOWS_1250, 24}, - {"unicode20utf8", ENC_ENCODING_UTF_8, 25}, - {"cp1252", ENC_ENCODING_WINDOWS_1252, 26}, - {"cp1253", ENC_ENCODING_WINDOWS_1253, 27}, - {"l1", ENC_ENCODING_ISO_8859_1, 0x7e}, // -> "850" - {"l2", ENC_ENCODING_ISO_8859_2, 29}, - {"l3", ENC_ENCODING_ISO_8859_3, 0x80}, // -> "852" - {"unicode20", ENC_ENCODING_UTF_16BE, 31}, - {"unicode20utf16", ENC_ENCODING_UTF_16BE, 0x6b}, // -> "gb231280" - {"l6", ENC_ENCODING_ISO_8859_10, 0x75}, // -> "iso88592windowslatin2" - {"unicodeascii", ENC_ENCODING_UTF_16BE, 0x34}, // -> "isolatingreek" - {"iso10646", ENC_ENCODING_UTF_16BE, 35}, - {"iso10646unicodelatin1", ENC_ENCODING_UTF_16BE, 36}, - {"ucs4be", ENC_ENCODING_UTF_32BE, 0x2b}, // -> "greek8" - {"unicodelatin1", ENC_ENCODING_UTF_16BE, 38}, - {"ibm819", ENC_ENCODING_ISO_8859_1, 39}, - {"isolatin2", ENC_ENCODING_ISO_8859_2, 0x6a}, // -> "gb2312" - {"isoir101", ENC_ENCODING_ISO_8859_2, 0x35}, // -> "iso885971987" - {"windows949", ENC_ENCODING_EUC_KR, 0x6f}, // -> "iso58gb231280" - {"greek8", ENC_ENCODING_ISO_8859_7, 43}, - {"ecma118", ENC_ENCODING_ISO_8859_7, 0x49}, // -> "windows30latin1" - {"iso885911987", ENC_ENCODING_ISO_8859_1, 0x50}, // -> "windows31latin1" - {"iso885921987", ENC_ENCODING_ISO_8859_2, 0x7a}, // -> "windows31latin2" - {"mac", ENC_ENCODING_MACINTOSH, 47}, - {"iso885931988", ENC_ENCODING_ISO_8859_3, 48}, - {"utf32", ENC_ENCODING_UTF_32BE, 49}, - {"isoir100", ENC_ENCODING_ISO_8859_1, 50}, - {"utf16", ENC_ENCODING_UTF_16, 0x29}, // -> "isoir101" - {"isolating" "reek", ENC_ENCODING_ISO_8859_7, 52}, // Well then maybe it shouldn't be so isolating - {"iso885971987", ENC_ENCODING_ISO_8859_7, 53}, - {"sjis", ENC_ENCODING_SHIFT_JIS, 0x37}, // -> "suneugreek" - {"suneugreek", ENC_ENCODING_ISO_8859_7, 55}, - {"mscp932", ENC_ENCODING_SHIFT_JIS, 56}, - {"macgreek", ENC_ENCODING_X_MAC_GREEK, 57}, - {"isoir126", ENC_ENCODING_ISO_8859_7, 58}, - {"isoir109", ENC_ENCODING_ISO_8859_3, 59}, - {"mskanji" /* + */ " ", ENC_ENCODING_SHIFT_JIS, 60}, // NOTE the trailing space here (ERRATUM?) - {"windows31j", ENC_ENCODING_SHIFT_JIS, 61}, - {"isoir157", ENC_ENCODING_ISO_8859_15, 0x68}, // -> "uhc" - {"macintosh", ENC_ENCODING_MACINTOSH, 0x64}, // -> "isoir149" - {"ucs2be", ENC_ENCODING_UTF_16BE, 64}, - {"iso88591windows31latin1", ENC_ENCODING_WINDOWS_1252, 65}, - {"iso10646ucs2", ENC_ENCODING_UTF_16BE, 0x25}, // -> "ucs4be" - {"unicode11", ENC_ENCODING_UTF_16BE, 0x1f}, // -> "unicode20" - {"iso10646ucs4", ENC_ENCODING_UTF_32BE, 68}, - {"latin1", ENC_ENCODING_ISO_8859_1, 69}, - {"latin2", ENC_ENCODING_ISO_8859_2, 0x51}, // -> "unicode11utf7" - {"latin3", ENC_ENCODING_ISO_8859_3, 0x15}, // -> "unicode11utf8" - {"macroman", ENC_ENCODING_MACINTOSH, 0x23}, // -> "iso10646" - {"windows30latin1", ENC_ENCODING_WINDOWS_1252, 73}, - {"latin6", ENC_ENCODING_ISO_8859_10, 0x5d}, // -> "ucs2le" - {"cp65000", ENC_ENCODING_UTF_7, 75}, - {"windows1250", ENC_ENCODING_WINDOWS_1250, 76}, - {"latin9", ENC_ENCODING_ISO_8859_15, 0x38}, // -> "mscp932" - {"windows1252", ENC_ENCODING_WINDOWS_1252, 0x10}, // -> "iso646us" - {"windows1253", ENC_ENCODING_WINDOWS_1253, 79}, - {"windows31latin1", ENC_ENCODING_WINDOWS_1252, 80}, - {"unicode11utf7", ENC_ENCODING_UTF_7, 0x5b}, // -> "unicode20utf7" - {"ibm850", ENC_ENCODING_IBM850, 0x3d}, // -> "windows31j" - {"elot928", ENC_ENCODING_ISO_8859_7, 83}, - {"ibm852", ENC_ENCODING_IBM852, 84}, - {"ibm367", ENC_ENCODING_US_ASCII, 85}, - {"iso88591", ENC_ENCODING_ISO_8859_1, 86}, - {"iso88592", ENC_ENCODING_ISO_8859_2, 0x27}, // -> "ibm819" - {"iso88593", ENC_ENCODING_ISO_8859_3, 0x14}, // -> "isoir6" - {"iso8859101992", ENC_ENCODING_ISO_8859_15, 89}, - {"chinese", ENC_ENCODING_GB2312, 90}, - {"unicode20utf7", ENC_ENCODING_UTF_7, 91}, - {"iso88597", ENC_ENCODING_ISO_8859_7, 0x0b}, // -> "ansix341968" - {"ucs2le", ENC_ENCODING_UTF_16LE, 93}, - {"shiftjis", ENC_ENCODING_SHIFT_JIS, 94}, - {"pcp852", ENC_ENCODING_IBM852, 95}, - {"euckr", ENC_ENCODING_EUC_KR, 96}, - {"ksc56011987", ENC_ENCODING_EUC_KR, 97}, - {"iso10646j1", ENC_ENCODING_UTF_16BE, 98}, - {"ksc56011989", ENC_ENCODING_EUC_KR, 99}, - {"isoir149", ENC_ENCODING_EUC_KR, 100}, - {"ksc5601", ENC_ENCODING_EUC_KR, 101}, - {"iso2022jp", ENC_ENCODING_ISO_2022_JP, 102}, - {"us", ENC_ENCODING_US_ASCII, 0x22}, // -> "unicodeascii" - {"uhc", ENC_ENCODING_EUC_KR, 104}, - {"cp949", ENC_ENCODING_EUC_KR, 105}, - {"gb2312", ENC_ENCODING_GB2312, 0x6d}, // -> "isoir58" - {"gb231280", ENC_ENCODING_GB2312, 107}, - {"usascii", ENC_ENCODING_US_ASCII, 108}, - {"isoir58", ENC_ENCODING_GB2312, 109}, - {"cp850", ENC_ENCODING_IBM850, 0x24}, // -> "iso10646unicodelatin1" - {"iso58gb231280", ENC_ENCODING_GB2312, 111}, - {"cp852", ENC_ENCODING_IBM852, 112}, - {"cp367", ENC_ENCODING_US_ASCII, 113}, - {"utf8n", ENC_ENCODING_UTF_8, 114}, - {"cp819", ENC_ENCODING_ISO_8859_1, 115}, - {"euccn", ENC_ENCODING_GB2312, 116}, - {"iso88592windowslatin2", ENC_ENCODING_WINDOWS_1250, 117}, - {"macce", ENC_ENCODING_X_MAC_CE, 0x20}, // -> "unicode20utf16" - {"utf32be", ENC_ENCODING_UTF_32BE, 0x69}, // -> "cp949" - {"ibm1200", ENC_ENCODING_UTF_16, 120}, - {"utf16be", ENC_ENCODING_UTF_16BE, 121}, - {"windows31latin2", ENC_ENCODING_WINDOWS_1250, 122}, - {"ucs2", ENC_ENCODING_UTF_16BE, 0x7f}, // -> "pc850multilingual" - {"korean", ENC_ENCODING_EUC_KR, 124}, - {"ucs4", ENC_ENCODING_UTF_32BE, 125}, - {"850", ENC_ENCODING_IBM850, 126}, - {"pc850multilingual", ENC_ENCODING_IBM850, 127}, - {"852", ENC_ENCODING_IBM852, 128}, + {"iso885910", ENC_ENCODING_ISO_8859_10, 0}, + {"iso88591windows30latin1", ENC_ENCODING_WINDOWS_1252, 1}, + {"utf16le", ENC_ENCODING_UTF_16LE, 0x41}, // -> "iso88591windows31latin1" + {"utf7", ENC_ENCODING_UTF_7, 3}, + {"utf8", ENC_ENCODING_UTF_8, 4}, + {"ascii", ENC_ENCODING_US_ASCII, 0x00}, // -> "iso885910" + {"iso885915", ENC_ENCODING_ISO_8859_15, 0x74}, // -> "euccn" + {"iso10646ucs2be", ENC_ENCODING_UTF_16BE, 0x3c}, // -> "mskanji " + {"iso646irv1991", ENC_ENCODING_US_ASCII, 8}, + {"iso10646ucs4be", ENC_ENCODING_UTF_32BE, 0x65}, // -> "ksc5601" + {"greek", ENC_ENCODING_ISO_8859_7, 0x06}, // -> "iso885915" + {"ansix341968", ENC_ENCODING_US_ASCII, 0x0c}, // -> "ansix341986" + {"ansix341986", ENC_ENCODING_US_ASCII, 12}, + {"isolatin1", ENC_ENCODING_ISO_8859_1, 13}, + {"iso10646ucsbasic", ENC_ENCODING_UTF_16BE, 0x28}, // -> "isolatin2" + {"isolatin3", ENC_ENCODING_ISO_8859_3, 15}, + {"iso646us", ENC_ENCODING_US_ASCII, 16}, + {"iso10646ucs2le", ENC_ENCODING_UTF_16LE, 17}, + {"isolatin6", ENC_ENCODING_ISO_8859_10, 18}, + {"cp1200", ENC_ENCODING_UTF_16, 19}, + {"isoir6", ENC_ENCODING_US_ASCII, 20}, + {"unicode11utf8", ENC_ENCODING_UTF_8, 0x19}, // -> "unicode20utf8" + {"iso2022jp1", ENC_ENCODING_ISO_2022_JP, 0x60}, // -> "euckr" + {"iso2022jp2", ENC_ENCODING_ISO_2022_JP, 23}, + {"cp1250", ENC_ENCODING_WINDOWS_1250, 24}, + {"unicode20utf8", ENC_ENCODING_UTF_8, 25}, + {"cp1252", ENC_ENCODING_WINDOWS_1252, 26}, + {"cp1253", ENC_ENCODING_WINDOWS_1253, 27}, + {"l1", ENC_ENCODING_ISO_8859_1, 0x7e}, // -> "850" + {"l2", ENC_ENCODING_ISO_8859_2, 29}, + {"l3", ENC_ENCODING_ISO_8859_3, 0x80}, // -> "852" + {"unicode20", ENC_ENCODING_UTF_16BE, 31}, + {"unicode20utf16", ENC_ENCODING_UTF_16BE, 0x6b}, // -> "gb231280" + {"l6", ENC_ENCODING_ISO_8859_10, 0x75}, // -> "iso88592windowslatin2" + {"unicodeascii", ENC_ENCODING_UTF_16BE, 0x34}, // -> "isolatingreek" + {"iso10646", ENC_ENCODING_UTF_16BE, 35}, + {"iso10646unicodelatin1", ENC_ENCODING_UTF_16BE, 36}, + {"ucs4be", ENC_ENCODING_UTF_32BE, 0x2b}, // -> "greek8" + {"unicodelatin1", ENC_ENCODING_UTF_16BE, 38}, + {"ibm819", ENC_ENCODING_ISO_8859_1, 39}, + {"isolatin2", ENC_ENCODING_ISO_8859_2, 0x6a}, // -> "gb2312" + {"isoir101", ENC_ENCODING_ISO_8859_2, 0x35}, // -> "iso885971987" + {"windows949", ENC_ENCODING_EUC_KR, 0x6f}, // -> "iso58gb231280" + {"greek8", ENC_ENCODING_ISO_8859_7, 43}, + {"ecma118", ENC_ENCODING_ISO_8859_7, 0x49}, // -> "windows30latin1" + {"iso885911987", ENC_ENCODING_ISO_8859_1, 0x50}, // -> "windows31latin1" + {"iso885921987", ENC_ENCODING_ISO_8859_2, 0x7a}, // -> "windows31latin2" + {"mac", ENC_ENCODING_MACINTOSH, 47}, + {"iso885931988", ENC_ENCODING_ISO_8859_3, 48}, + {"utf32", ENC_ENCODING_UTF_32BE, 49}, + {"isoir100", ENC_ENCODING_ISO_8859_1, 50}, + {"utf16", ENC_ENCODING_UTF_16, 0x29}, // -> "isoir101" + {"isolating" + "reek", + ENC_ENCODING_ISO_8859_7, 52}, // Well then maybe it shouldn't be so isolating + {"iso885971987", ENC_ENCODING_ISO_8859_7, 53}, + {"sjis", ENC_ENCODING_SHIFT_JIS, 0x37}, // -> "suneugreek" + {"suneugreek", ENC_ENCODING_ISO_8859_7, 55}, + {"mscp932", ENC_ENCODING_SHIFT_JIS, 56}, + {"macgreek", ENC_ENCODING_X_MAC_GREEK, 57}, + {"isoir126", ENC_ENCODING_ISO_8859_7, 58}, + {"isoir109", ENC_ENCODING_ISO_8859_3, 59}, + {"mskanji" /* + */ " ", ENC_ENCODING_SHIFT_JIS, 60}, // NOTE the trailing space here (ERRATUM?) + {"windows31j", ENC_ENCODING_SHIFT_JIS, 61}, + {"isoir157", ENC_ENCODING_ISO_8859_15, 0x68}, // -> "uhc" + {"macintosh", ENC_ENCODING_MACINTOSH, 0x64}, // -> "isoir149" + {"ucs2be", ENC_ENCODING_UTF_16BE, 64}, + {"iso88591windows31latin1", ENC_ENCODING_WINDOWS_1252, 65}, + {"iso10646ucs2", ENC_ENCODING_UTF_16BE, 0x25}, // -> "ucs4be" + {"unicode11", ENC_ENCODING_UTF_16BE, 0x1f}, // -> "unicode20" + {"iso10646ucs4", ENC_ENCODING_UTF_32BE, 68}, + {"latin1", ENC_ENCODING_ISO_8859_1, 69}, + {"latin2", ENC_ENCODING_ISO_8859_2, 0x51}, // -> "unicode11utf7" + {"latin3", ENC_ENCODING_ISO_8859_3, 0x15}, // -> "unicode11utf8" + {"macroman", ENC_ENCODING_MACINTOSH, 0x23}, // -> "iso10646" + {"windows30latin1", ENC_ENCODING_WINDOWS_1252, 73}, + {"latin6", ENC_ENCODING_ISO_8859_10, 0x5d}, // -> "ucs2le" + {"cp65000", ENC_ENCODING_UTF_7, 75}, + {"windows1250", ENC_ENCODING_WINDOWS_1250, 76}, + {"latin9", ENC_ENCODING_ISO_8859_15, 0x38}, // -> "mscp932" + {"windows1252", ENC_ENCODING_WINDOWS_1252, 0x10}, // -> "iso646us" + {"windows1253", ENC_ENCODING_WINDOWS_1253, 79}, + {"windows31latin1", ENC_ENCODING_WINDOWS_1252, 80}, + {"unicode11utf7", ENC_ENCODING_UTF_7, 0x5b}, // -> "unicode20utf7" + {"ibm850", ENC_ENCODING_IBM850, 0x3d}, // -> "windows31j" + {"elot928", ENC_ENCODING_ISO_8859_7, 83}, + {"ibm852", ENC_ENCODING_IBM852, 84}, + {"ibm367", ENC_ENCODING_US_ASCII, 85}, + {"iso88591", ENC_ENCODING_ISO_8859_1, 86}, + {"iso88592", ENC_ENCODING_ISO_8859_2, 0x27}, // -> "ibm819" + {"iso88593", ENC_ENCODING_ISO_8859_3, 0x14}, // -> "isoir6" + {"iso8859101992", ENC_ENCODING_ISO_8859_15, 89}, + {"chinese", ENC_ENCODING_GB2312, 90}, + {"unicode20utf7", ENC_ENCODING_UTF_7, 91}, + {"iso88597", ENC_ENCODING_ISO_8859_7, 0x0b}, // -> "ansix341968" + {"ucs2le", ENC_ENCODING_UTF_16LE, 93}, + {"shiftjis", ENC_ENCODING_SHIFT_JIS, 94}, + {"pcp852", ENC_ENCODING_IBM852, 95}, + {"euckr", ENC_ENCODING_EUC_KR, 96}, + {"ksc56011987", ENC_ENCODING_EUC_KR, 97}, + {"iso10646j1", ENC_ENCODING_UTF_16BE, 98}, + {"ksc56011989", ENC_ENCODING_EUC_KR, 99}, + {"isoir149", ENC_ENCODING_EUC_KR, 100}, + {"ksc5601", ENC_ENCODING_EUC_KR, 101}, + {"iso2022jp", ENC_ENCODING_ISO_2022_JP, 102}, + {"us", ENC_ENCODING_US_ASCII, 0x22}, // -> "unicodeascii" + {"uhc", ENC_ENCODING_EUC_KR, 104}, + {"cp949", ENC_ENCODING_EUC_KR, 105}, + {"gb2312", ENC_ENCODING_GB2312, 0x6d}, // -> "isoir58" + {"gb231280", ENC_ENCODING_GB2312, 107}, + {"usascii", ENC_ENCODING_US_ASCII, 108}, + {"isoir58", ENC_ENCODING_GB2312, 109}, + {"cp850", ENC_ENCODING_IBM850, 0x24}, // -> "iso10646unicodelatin1" + {"iso58gb231280", ENC_ENCODING_GB2312, 111}, + {"cp852", ENC_ENCODING_IBM852, 112}, + {"cp367", ENC_ENCODING_US_ASCII, 113}, + {"utf8n", ENC_ENCODING_UTF_8, 114}, + {"cp819", ENC_ENCODING_ISO_8859_1, 115}, + {"euccn", ENC_ENCODING_GB2312, 116}, + {"iso88592windowslatin2", ENC_ENCODING_WINDOWS_1250, 117}, + {"macce", ENC_ENCODING_X_MAC_CE, 0x20}, // -> "unicode20utf16" + {"utf32be", ENC_ENCODING_UTF_32BE, 0x69}, // -> "cp949" + {"ibm1200", ENC_ENCODING_UTF_16, 120}, + {"utf16be", ENC_ENCODING_UTF_16BE, 121}, + {"windows31latin2", ENC_ENCODING_WINDOWS_1250, 122}, + {"ucs2", ENC_ENCODING_UTF_16BE, 0x7f}, // -> "pc850multilingual" + {"korean", ENC_ENCODING_EUC_KR, 124}, + {"ucs4", ENC_ENCODING_UTF_32BE, 125}, + {"850", ENC_ENCODING_IBM850, 126}, + {"pc850multilingual", ENC_ENCODING_IBM850, 127}, + {"852", ENC_ENCODING_IBM852, 128}, }; __declspec(weak) BOOL enc_tbl_jp_loaded = TRUE; @@ -192,7 +194,7 @@ ENCResult ENCInitContext(ENCContext* context) { return ENC_OK; } -ENCResult ENCDuplicateContext(ENCContext* dst, ENCContext const *src) { +ENCResult ENCDuplicateContext(ENCContext* dst, ENCContext const* src) { if (dst == NULL || src == NULL) { return ENC_ERR_INVALID_PARAM; } @@ -227,17 +229,13 @@ ENCResult ENCSetExternalEncoding(ENCContext* context, const char* name) { if (context->encoding == ENC_ENCODING_UTF_16BE || context->encoding == ENC_ENCODING_UTF_16) { context->state = ENC_UTF16_STATE_BIG_ENDIAN; - } - else if (context->encoding == ENC_ENCODING_UTF_16LE) { + } else if (context->encoding == ENC_ENCODING_UTF_16LE) { context->state = ENC_UTF16_STATE_LITTLE_ENDIAN; - } - else if (context->encoding == ENC_ENCODING_ISO_2022_JP) { + } else if (context->encoding == ENC_ENCODING_ISO_2022_JP) { context->state = ENC_JIS_STATE_US_ASCII; - } - else if (context->encoding == ENC_ENCODING_UTF_7) { + } else if (context->encoding == ENC_ENCODING_UTF_7) { context->state = ENC_UTF7_STATE_INITIAL; - } - else { + } else { context->state = ENC_STATE_INITIAL; } @@ -252,8 +250,7 @@ ENCResult ENCGetExternalEncoding(ENCContext* context, char* name) { if (context->encoding <= ENC_ENCODING_NONE || context->encoding >= ENC_BAD_MAX_ENCODING) { strncpy(name, encoding_array[ENC_ENCODING_NONE].name, ENCODING_NAME_LENGTH); return ENC_ERR_UNKNOWN_ENCODING; - } - else { + } else { strncpy(name, encoding_array[context->encoding].name, ENCODING_NAME_LENGTH); return ENC_OK; } @@ -274,8 +271,8 @@ ENCResult ENCSetAlternativeCharacter(ENCContext* context, u16 nomap, u16 invalid return ENC_ERR_INVALID_PARAM; } - context->nomap = nomap; - context->invalid = invalid; + context->nomap = nomap; + context->invalid = invalid; return ENC_OK; } @@ -357,8 +354,7 @@ ENCResult ENCConvertToInternalEncoding(ENCContext* context, u16* dst, s32* dstSi if (ret == ENC_ERR_INVALID_FORMAT && context->invalid != L'\uffff') { replacement = context->invalid; - } - else if (ret == ENC_ERR_NO_MAP_RULE && context->nomap != L'\uffff') { + } else if (ret == ENC_ERR_NO_MAP_RULE && context->nomap != L'\uffff') { replacement = context->nomap; } @@ -373,8 +369,7 @@ ENCResult ENCConvertToInternalEncoding(ENCContext* context, u16* dst, s32* dstSi if (dst) { ret = ENCiConvertToInternalEncoding(context, dst + dstCnt, &tmpDstSize, (const u8*)src + srcCnt, &tmpSrcSize); - } - else { + } else { ret = ENCiConvertToInternalEncoding(context, NULL, &tmpDstSize, (const u8*)src + srcCnt, &tmpSrcSize); } } @@ -449,8 +444,7 @@ ENCResult ENCConvertFromInternalEncoding(ENCContext* context, void* dst, s32* ds if (ret == ENC_ERR_INVALID_FORMAT && context->invalid != L'\uffff') { replacement = context->invalid; - } - else if (ret == ENC_ERR_NO_MAP_RULE && context->nomap != L'\uffff') { + } else if (ret == ENC_ERR_NO_MAP_RULE && context->nomap != L'\uffff') { replacement = context->nomap; } @@ -459,8 +453,7 @@ ENCResult ENCConvertFromInternalEncoding(ENCContext* context, void* dst, s32* ds if (dst) { ret = ENCiConvertFromInternalEncoding(context, (u8*)dst + dstCnt, &tmpDstSize, &replacement, &replacementSize); - } - else { + } else { ret = ENCiConvertFromInternalEncoding(context, NULL, &tmpDstSize, &replacement, &replacementSize); } @@ -474,8 +467,7 @@ ENCResult ENCConvertFromInternalEncoding(ENCContext* context, void* dst, s32* ds if (dst) { ret = ENCiConvertFromInternalEncoding(context, (u8*)dst + dstCnt, &tmpDstSize, src + srcCnt, &tmpSrcSize); - } - else { + } else { ret = ENCiConvertFromInternalEncoding(context, NULL, &tmpDstSize, src + srcCnt, &tmpSrcSize); } } @@ -579,7 +571,7 @@ ENCResult ENCIs7BitEncoding(BOOL* is7Bit, const char* encodingName) { if (encoding == ENC_ENCODING_NONE) { return ENC_ERR_UNKNOWN_ENCODING; } - + return ENC_OK; } @@ -591,13 +583,10 @@ static ENCEncoding ENCiGetEncodingTypeFromHashTable(const struct encoding_hash_t s32 cnt = 0; // /^(x-|cs)/i - if (((encodingName[0] == 'x' || encodingName[0] == 'X') - && encodingName[1] == '-') - || ((encodingName[0] == 'c' || encodingName[0] == 'C') - && (encodingName[1] == 's' || encodingName[1] == 'S'))) { - i = 2; // skip them - } - else { + if (((encodingName[0] == 'x' || encodingName[0] == 'X') && encodingName[1] == '-') || + ((encodingName[0] == 'c' || encodingName[0] == 'C') && (encodingName[1] == 's' || encodingName[1] == 'S'))) { + i = 2; // skip them + } else { i = 0; } @@ -614,9 +603,8 @@ static ENCEncoding ENCiGetEncodingTypeFromHashTable(const struct encoding_hash_t if ((cc >= '0' && cc < '9' + 1) || (cc > 'a' - 1 && cc <= 'z')) { stripped[cnt++] = cc; - } - else if (cc > 'A' - 1 && cc <= 'Z') { - stripped[cnt++] = cc + 0x20u; // ascii-tolower + } else if (cc > 'A' - 1 && cc <= 'Z') { + stripped[cnt++] = cc + 0x20u; // ascii-tolower } i++; @@ -628,7 +616,8 @@ static ENCEncoding ENCiGetEncodingTypeFromHashTable(const struct encoding_hash_t { s32 index; - for (index = hash % tableLength; strncmp((char*)stripped, table[index].name, ENCODING_HASH_TABLE_ENTRY_NAME_LENGTH) != 0; index = table[index].nextIndex) { + for (index = hash % tableLength; strncmp((char*)stripped, table[index].name, ENCODING_HASH_TABLE_ENTRY_NAME_LENGTH) != 0; + index = table[index].nextIndex) { if (index == table[index].nextIndex) { return ENC_ENCODING_NONE; } @@ -661,7 +650,7 @@ ENCResult ENCGetNextCharacterWidth(ENCContext* context, const void* src, u32* wi } case ENC_ENCODING_UTF_16BE: { u16 c16; - memcpy(&c16, src, sizeof(c16)); // ? + memcpy(&c16, src, sizeof(c16)); // ? // why are we grabbing it? stripped debug print or something? @@ -699,7 +688,7 @@ ENCResult ENCGetNextCharacterWidth(ENCContext* context, const void* src, u32* wi case ENC_JIS_STATE_JIS_X_0208_1978: case ENC_JIS_STATE_JIS_X_0208_1983: case ENC_JIS_STATE_JIS_X_0212_1990: - case ENC_JIS_STATE_7: { // ? + case ENC_JIS_STATE_7: { // ? *width = sizeof(u16); break; } @@ -714,8 +703,7 @@ ENCResult ENCGetNextCharacterWidth(ENCContext* context, const void* src, u32* wi case ENC_ENCODING_SHIFT_JIS: { if (*(const u8*)src >= 0x81 && *(const u8*)src <= 0xFC) { *width = sizeof(u16); - } - else { + } else { *width = sizeof(u8); } @@ -735,15 +723,14 @@ ENCResult ENCGetNextCharacterWidth(ENCContext* context, const void* src, u32* wi if (context->state == ENC_UTF16_STATE_BIG_ENDIAN) { memcpy(&c16, src, sizeof(c16)); - } - else { // ENC_UTF16_STATE_LITTLE_ENDIAN + } else { // ENC_UTF16_STATE_LITTLE_ENDIAN c16 = ((const u8*)src)[1] << 8 | ((const u8*)src)[0]; } // why is it only the utf16 encodings? why not the other ones? *width = sizeof(u16); - + break; } case ENC_ENCODING_WINDOWS_1250: @@ -760,8 +747,7 @@ ENCResult ENCGetNextCharacterWidth(ENCContext* context, const void* src, u32* wi case ENC_ENCODING_GB2312: { if (*(const u8*)src >= 0x81 && *(const u8*)src <= 0xFE) { *width = sizeof(u16); - } - else { + } else { *width = sizeof(u8); } break; diff --git a/libs/RVL_SDK/src/enc/encunicode.c b/libs/RVL_SDK/src/enc/encunicode.c index 12ab5240..3eda4ad0 100644 --- a/libs/RVL_SDK/src/enc/encunicode.c +++ b/libs/RVL_SDK/src/enc/encunicode.c @@ -1,88 +1,87 @@ -#include #include +#include // WARNING: No double-evaluation protection -#define SWAP_ENDIAN_16(x) (((x) >> 8) & 0x00ff) | (((x) << 8) & 0xff00) +#define SWAP_ENDIAN_16(x) (((x) >> 8) & 0x00ff) | (((x) << 8) & 0xff00) // Unicode #define UTF_IS_DEFINED_CODEPOINT(x) ((x) <= 0x10FFFF) -#define UTF_IS_2_BYTES_IN_UTF8(x) ((x) < 0x0800) -#define UTF_IS_3_BYTES_IN_UTF8(x) ((x) <= 0xFFFF) +#define UTF_IS_2_BYTES_IN_UTF8(x) ((x) < 0x0800) +#define UTF_IS_3_BYTES_IN_UTF8(x) ((x) <= 0xFFFF) // UTF-8 -#define UTF8_BOM_LEN 3 -#define UTF8_BOM_0 0xEF -#define UTF8_BOM_1 0xBB -#define UTF8_BOM_2 0xBF +#define UTF8_BOM_LEN 3 +#define UTF8_BOM_0 0xEF +#define UTF8_BOM_1 0xBB +#define UTF8_BOM_2 0xBF -#define UTF8_IS_CONT(x) ((unsigned)((x) & 0xC0) == 0x80) -#define UTF8_IS_INITIAL_2(x) ((unsigned)((x) & 0xE0) == 0xC0) -#define UTF8_IS_INITIAL_3(x) ((unsigned)((x) & 0xF0) == 0xE0) -#define UTF8_IS_INITIAL_4(x) ((unsigned)((x) & 0xF8) == 0xF0) +#define UTF8_IS_CONT(x) ((unsigned)((x) & 0xC0) == 0x80) +#define UTF8_IS_INITIAL_2(x) ((unsigned)((x) & 0xE0) == 0xC0) +#define UTF8_IS_INITIAL_3(x) ((unsigned)((x) & 0xF0) == 0xE0) +#define UTF8_IS_INITIAL_4(x) ((unsigned)((x) & 0xF8) == 0xF0) -#define UTF8_GET_INITIAL_2(x) ((x) & 0x1F) -#define UTF8_GET_INITIAL_3(x) ((x) & 0x0F) -#define UTF8_GET_INITIAL_4(x) ((x) & 0x07) -#define UTF8_GET_CONT(x) ((x) & 0x3F) +#define UTF8_GET_INITIAL_2(x) ((x) & 0x1F) +#define UTF8_GET_INITIAL_3(x) ((x) & 0x0F) +#define UTF8_GET_INITIAL_4(x) ((x) & 0x07) +#define UTF8_GET_CONT(x) ((x) & 0x3F) -#define UTF8_MAKE_INITIAL_2(x) (0xC0 + ( (x) >> 6 )) -#define UTF8_MAKE_INITIAL_3(x) (0xE0 + ( (x) >> 12 )) -#define UTF8_MAKE_INITIAL_4(x) (0xF0 + ( (x) >> 18 )) -#define UTF8_MAKE_CONT(x, offset_) (0x80 + (((x) >> 6 * (offset_)) & 0x3F)) +#define UTF8_MAKE_INITIAL_2(x) (0xC0 + ((x) >> 6)) +#define UTF8_MAKE_INITIAL_3(x) (0xE0 + ((x) >> 12)) +#define UTF8_MAKE_INITIAL_4(x) (0xF0 + ((x) >> 18)) +#define UTF8_MAKE_CONT(x, offset_) (0x80 + (((x) >> 6 * (offset_)) & 0x3F)) -#define UTF8_CHECK_BOM(stream_, limit_, limited_, cnt_) \ - if ((limit_) >= UTF8_BOM_LEN || !(limited_)) { \ - const u8* bom = *(stream_); \ - if (*bom == UTF8_BOM_0) { \ - ++bom; \ - \ - if (*bom == UTF8_BOM_1) { \ - ++bom; \ - \ - if (*bom == UTF8_BOM_2) { \ - *(stream_) = bom + 1; \ - *(cnt_) += UTF8_BOM_LEN; \ - } \ - } \ - } \ +#define UTF8_CHECK_BOM(stream_, limit_, limited_, cnt_) \ + if ((limit_) >= UTF8_BOM_LEN || !(limited_)) { \ + const u8* bom = *(stream_); \ + if (*bom == UTF8_BOM_0) { \ + ++bom; \ + \ + if (*bom == UTF8_BOM_1) { \ + ++bom; \ + \ + if (*bom == UTF8_BOM_2) { \ + *(stream_) = bom + 1; \ + *(cnt_) += UTF8_BOM_LEN; \ + } \ + } \ + } \ } // UTF-16 -#define UTF16_BOM_LEN 1 -#define UTF16_BE_BOM 0xFEFF -#define UTF16_LE_BOM 0xFFFE +#define UTF16_BOM_LEN 1 +#define UTF16_BE_BOM 0xFEFF +#define UTF16_LE_BOM 0xFFFE -#define UTF16_IS_SURROGATE(x) ((unsigned)((x) & 0xF800) == 0xD800) +#define UTF16_IS_SURROGATE(x) ((unsigned)((x) & 0xF800) == 0xD800) -#define UTF16_GET_HIGH_SURROGATE(x) (((x) - 0xD7C0) << 10) -#define UTF16_GET_LOW_SURROGATE(x) ( (x) & 0x03EF ) +#define UTF16_GET_HIGH_SURROGATE(x) (((x) - 0xD7C0) << 10) +#define UTF16_GET_LOW_SURROGATE(x) ((x) & 0x03EF) -#define UTF16_MAKE_HIGH_SURROGATE(x) (0xD7C0 + ((x) >> 10)) -#define UTF16_MAKE_LOW_SURROGATE(x) (0xDC00 + ((x) & 0x3FF)) +#define UTF16_MAKE_HIGH_SURROGATE(x) (0xD7C0 + ((x) >> 10)) +#define UTF16_MAKE_LOW_SURROGATE(x) (0xDC00 + ((x) & 0x3FF)) // UTF-32 -#define UTF32_BOM_LEN 1 -#define UTF32_BE_BOM 0x0000FEFF -#define UTF32_LE_BOM 0xFFFE0000 +#define UTF32_BOM_LEN 1 +#define UTF32_BE_BOM 0x0000FEFF +#define UTF32_LE_BOM 0xFFFE0000 -#define UTF32_CHECK_BOM(stream_, srcSize_, limit_, limited_, cnt_, dstSize_) \ - if ((limit_) > 0 || !(limited_)) { \ - if (**(stream_) == UTF32_BE_BOM) { \ - ++*(cnt_); \ - ++*(stream_); \ - } \ - else if (**(stream_) == UTF32_LE_BOM) { \ - if (dstSize_) { \ - *(dstSize_) = 0; \ - } \ - \ - *(srcSize_) = 0; \ - return ENC_ERR_INVALID_FORMAT; \ - } \ +#define UTF32_CHECK_BOM(stream_, srcSize_, limit_, limited_, cnt_, dstSize_) \ + if ((limit_) > 0 || !(limited_)) { \ + if (**(stream_) == UTF32_BE_BOM) { \ + ++*(cnt_); \ + ++*(stream_); \ + } else if (**(stream_) == UTF32_LE_BOM) { \ + if (dstSize_) { \ + *(dstSize_) = 0; \ + } \ + \ + *(srcSize_) = 0; \ + return ENC_ERR_INVALID_FORMAT; \ + } \ } static u32 ENCiConvertUtf8To32(const u8* src, int length); @@ -91,16 +90,13 @@ static u32 ENCiConvertUtf16To32(const u16* src, int length); static void ENCiConvertUtf32To16(u16* dst, int length, u32 src); static u8 ENCiGetBase64Value(u8 c); -static u8 base64_array[128] = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3E, 0xFF, 0xFF, 0xFF, 0x3F, - 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, - 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, - 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF -}; +static u8 base64_array[128] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3E, 0xFF, 0xFF, 0xFF, 0x3F, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, + 0x3D, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, + 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, + 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; DEFINE_PUBLIC_ENC_TRAMPOLINE_FROM_UTF16(Ascii) DEFINE_PUBLIC_ENC_TRAMPOLINE_TO_UTF16(Ascii) @@ -149,7 +145,7 @@ ENCResult ENCSetUnicodeBOM8(u8* dst, s32 dstSize) { return ENC_ERR_NO_BUF_LEFT; } - *dst++ = 0xFE; // ERRATUM: The correct byte is 0xEF, not 0xFE + *dst++ = 0xFE; // ERRATUM: The correct byte is 0xEF, not 0xFE *dst++ = UTF8_BOM_1; *dst = UTF8_BOM_2; @@ -158,7 +154,6 @@ ENCResult ENCSetUnicodeBOM8(u8* dst, s32 dstSize) { return ENC_OK; } - ENCResult ENCiConvertStringUnicodeToAscii(u8* dst, s32* dstSize, const u16* src, s32* srcSize, ENCBreakType breakType) { CREATE_STATE_VARIABLES(dstCnt, dstLimit, dstValid, srcCnt, srcLimit, srcLimited) @@ -177,8 +172,7 @@ ENCResult ENCiConvertStringUnicodeToAscii(u8* dst, s32* dstSize, const u16* src, if (IS_ASCII(cur)) { WRITE_CHAR(cur, &dst, &dstCnt, dstValid, &src, &srcCnt); - } - else { + } else { UNSAFE_THROW_AND_QUIT(&ret, ENC_ERR_NO_MAP_RULE); } } @@ -202,8 +196,7 @@ ENCResult ENCiConvertStringAsciiToUnicode(u16* dst, s32* dstSize, const u8* src, if (!IS_ASCII(*src)) { UNSAFE_THROW_AND_QUIT(&ret, ENC_ERR_INVALID_FORMAT); - } - else { + } else { WRITE_CHAR(*src, &dst, &dstCnt, dstValid, &src, &srcCnt); } } @@ -233,22 +226,20 @@ ENCResult ENCiConvertStringUtf32ToUtf16(u16* dst, s32* dstSize, const u32* src, if (!UTF_IS_DEFINED_CODEPOINT(cur)) { UNSAFE_THROW_AND_QUIT(&ret, ENC_ERR_INVALID_FORMAT); } - + if (dstValid) { if (dstLimit - dstCnt < 2) { UNSAFE_THROW_AND_QUIT(&ret, ENC_ERR_NO_BUF_LEFT); } - + ENCiConvertUtf32To16(dst, 2, cur); dst++; } - + dstCnt++; - } - else if (UTF16_IS_SURROGATE(cur)) { + } else if (UTF16_IS_SURROGATE(cur)) { UNSAFE_THROW_AND_QUIT(&ret, ENC_ERR_INVALID_FORMAT); - } - else { + } else { if (dstValid) { *dst = cur; } @@ -281,8 +272,7 @@ ENCResult ENCiConvertStringUtf16ToUtf32(u32* dst, s32* dstSize, const u16* src, if (!UTF16_IS_SURROGATE(cur)) { if (dstValid) *dst = cur; - } - else { + } else { if (srcLimit - srcCnt < 2 && srcLimited) { break; } @@ -317,15 +307,13 @@ ENCResult ENCiConvertStringUtf32ToUtf8(u8* dst, s32* dstSize, const u32* src, s3 UNSAFE_CHECK_DST_SPACE(dstCnt, dstLimit, dstValid, &ret); - UNSAFE_CHECK_BREAK_TYPE(&dst, &dstCnt, dstLimit, dstValid, &src, - &srcCnt, srcLimit, srcLimited, breakType, &ret); + UNSAFE_CHECK_BREAK_TYPE(&dst, &dstCnt, dstLimit, dstValid, &src, &srcCnt, srcLimit, srcLimited, breakType, &ret); if (IS_ASCII(cur)) { if (dstValid) { *dst = cur; } - } - else { + } else { s32 dstMbLen = 0; if (UTF16_IS_SURROGATE(cur) || !UTF_IS_DEFINED_CODEPOINT(cur)) { @@ -334,11 +322,9 @@ ENCResult ENCiConvertStringUtf32ToUtf8(u8* dst, s32* dstSize, const u32* src, s3 if (UTF_IS_2_BYTES_IN_UTF8(cur)) { dstMbLen = 2; - } - else if (UTF_IS_3_BYTES_IN_UTF8(cur)) { + } else if (UTF_IS_3_BYTES_IN_UTF8(cur)) { dstMbLen = 3; - } - else { + } else { dstMbLen = 4; } @@ -383,27 +369,23 @@ ENCResult ENCiConvertStringUtf8ToUtf32(u32* dst, s32* dstSize, const u8* src, s3 if (IS_ASCII(cur)) { c32 = cur; - } - else { + } else { s32 srcMbLen = 0; if (UTF8_IS_INITIAL_2(cur)) { srcMbLen = 2; - } - else if (UTF8_IS_INITIAL_3(cur)) { + } else if (UTF8_IS_INITIAL_3(cur)) { srcMbLen = 3; - } - else if (UTF8_IS_INITIAL_4(cur)) { + } else if (UTF8_IS_INITIAL_4(cur)) { srcMbLen = 4; - } - else { + } else { UNSAFE_THROW_AND_QUIT(&ret, ENC_ERR_INVALID_FORMAT); } - + if (srcLimit - srcCnt < srcMbLen && srcLimited) { break; } - + c32 = ENCiConvertUtf8To32(src, srcMbLen); if (!c32) { UNSAFE_THROW_AND_QUIT(&ret, ENC_ERR_INVALID_FORMAT); @@ -440,20 +422,17 @@ ENCResult ENCiConvertStringUtf16ToUtf8(u8* dst, s32* dstSize, const u16* src, s3 if (IS_ASCII(cur)) { WRITE_CHAR(cur, &dst, &dstCnt, dstValid, &src, &srcCnt); - } - else { + } else { s32 dstMbLen = 0; s32 srcMbLen = 0; if (UTF_IS_2_BYTES_IN_UTF8(cur)) { dstMbLen = 1; srcMbLen = 2; - } - else if (!UTF16_IS_SURROGATE(cur)) { + } else if (!UTF16_IS_SURROGATE(cur)) { dstMbLen = 1; srcMbLen = 3; - } - else { + } else { dstMbLen = 2; srcMbLen = 4; } @@ -469,7 +448,7 @@ ENCResult ENCiConvertStringUtf16ToUtf8(u8* dst, s32* dstSize, const u16* src, s3 { u32 c32 = ENCiConvertUtf16To32(src, dstMbLen); - ENCiConvertUtf32To8(dst, srcMbLen, c32); // NOLINT (it's not) + ENCiConvertUtf32To8(dst, srcMbLen, c32); // NOLINT (it's not) } dst += srcMbLen; @@ -504,24 +483,20 @@ ENCResult ENCiConvertStringUtf8ToUtf16(u16* dst, s32* dstSize, const u8* src, s3 if (IS_ASCII(cur)) { WRITE_CHAR(cur, &dst, &dstCnt, dstValid, &src, &srcCnt); - } - else { + } else { s32 srcMbLen = 0; s32 dstMbLen = 0; if (UTF8_IS_INITIAL_2(cur)) { srcMbLen = 2; dstMbLen = 1; - } - else if (UTF8_IS_INITIAL_3(cur)) { + } else if (UTF8_IS_INITIAL_3(cur)) { srcMbLen = 3; dstMbLen = 1; - } - else if (UTF8_IS_INITIAL_4(cur)) { + } else if (UTF8_IS_INITIAL_4(cur)) { srcMbLen = 4; dstMbLen = 2; - } - else { + } else { UNSAFE_THROW_AND_QUIT(&ret, ENC_ERR_INVALID_FORMAT); } @@ -583,8 +558,8 @@ ENCResult ENCiConvertStringUtf7ToUtf16(u16* dst, s32* dstSize, const u8* src, s3 if (dstCnt >= dstLimit && dstValid && cur != '-') { UNSAFE_THROW_AND_QUIT(&ret, ENC_ERR_NO_BUF_LEFT); } - - if (cur == '-') { // shift out + + if (cur == '-') { // shift out base64Mode = FALSE; src++; @@ -596,23 +571,23 @@ ENCResult ENCiConvertStringUtf7ToUtf16(u16* dst, s32* dstSize, const u8* src, s3 { u32 b64 = ENCiGetBase64Value(cur); - if (b64 > 63) { // in particular, 0xff is the error sentinel + if (b64 > 63) { // in particular, 0xff is the error sentinel UNSAFE_THROW_AND_QUIT(&ret, ENC_ERR_INVALID_FORMAT); } /* Calculations with offset subtract 6 to account for the size of - * the base64 unit that gets shifted - */ + * the base64 unit that gets shifted + */ partialBits |= b64 << (32 - 6 - partialOffset); } if (partialOffset < 16 - 6) { partialOffset += 6; - } - else { + } else { if (dstValid) { /* NOTE: Doubled expressions */ - *dst = partialBits >> 16; dst++; + *dst = partialBits >> 16; + dst++; } partialBits <<= 16; @@ -624,15 +599,14 @@ ENCResult ENCiConvertStringUtf7ToUtf16(u16* dst, s32* dstSize, const u8* src, s3 src++; srcCnt++; - } - else { + } else { u8 cur = *src; if (dstCnt >= dstLimit && dstValid && cur != '+') { UNSAFE_THROW_AND_QUIT(&ret, ENC_ERR_NO_BUF_LEFT); } - if (cur == '+') { // shift in + if (cur == '+') { // shift in base64Mode = TRUE; partialBits = 0x00000000; @@ -653,8 +627,7 @@ ENCResult ENCiConvertStringUtf7ToUtf16(u16* dst, s32* dstSize, const u8* src, s3 if (mbState) { if (base64Mode) { *mbState = ENC_UTF7_STATE_COLLECT(partialBits, partialOffset); - } - else { + } else { *mbState = ENC_UTF7_STATE_INITIAL; } } @@ -682,8 +655,7 @@ ENCResult ENCiConvertStringUtf16ToUtf16(u16* dst, s32* dstSize, const u16* src, srcCnt++; src++; - } - else if (*src == UTF16_LE_BOM) { + } else if (*src == UTF16_LE_BOM) { if (mbState != NULL) { *mbState = ENC_UTF16_STATE_LITTLE_ENDIAN; } @@ -692,8 +664,7 @@ ENCResult ENCiConvertStringUtf16ToUtf16(u16* dst, s32* dstSize, const u16* src, srcCnt++; src++; - } - else { + } else { if (mbState != NULL && *mbState == ENC_UTF16_STATE_LITTLE_ENDIAN) { littleEndian = TRUE; } diff --git a/libs/RVL_SDK/src/enc/encutility.c b/libs/RVL_SDK/src/enc/encutility.c index 92c1e274..d483890a 100644 --- a/libs/RVL_SDK/src/enc/encutility.c +++ b/libs/RVL_SDK/src/enc/encutility.c @@ -1,8 +1,8 @@ -#include #include +#include -#include #include +#include #include @@ -18,23 +18,21 @@ void ENCiRegisterVersion() { } } - -ENCResult ENCiCheckParameters(BOOL dstValid, s32* dstSizeIn, s32* dstSizeOut, BOOL* dstValidOut, BOOL srcValid, s32* srcSizeIn, s32* srcSizeOut, BOOL* srcLimitedOut) { +ENCResult ENCiCheckParameters(BOOL dstValid, s32* dstSizeIn, s32* dstSizeOut, BOOL* dstValidOut, BOOL srcValid, s32* srcSizeIn, s32* srcSizeOut, + BOOL* srcLimitedOut) { ENCResult ret = ENC_OK; ENCiRegisterVersion(); if (srcSizeIn) { *srcSizeOut = *srcSizeIn; - } - else { + } else { *srcSizeOut = ENC_SRC_UNLIMITED; } - if (dstSizeIn){ + if (dstSizeIn) { *dstSizeOut = *dstSizeIn; - } - else { + } else { *dstSizeOut = ENC_DST_INVALID; ret = ENC_ERR_INVALID_PARAM; @@ -50,7 +48,7 @@ ENCResult ENCiCheckParameters(BOOL dstValid, s32* dstSizeIn, s32* dstSizeOut, BO *dstSizeOut = ENC_DST_INVALID; } - if (*srcSizeOut < 0) { // ENC_SRC_UNLIMITED + if (*srcSizeOut < 0) { // ENC_SRC_UNLIMITED *srcLimitedOut = FALSE; } @@ -65,12 +63,10 @@ ENCResult ENCiCheckParameters(BOOL dstValid, s32* dstSizeIn, s32* dstSizeOut, BO int ENCiCheckBreakType(unsigned a, unsigned b) { if (a == '\n') { return sizeof("\n") - 1; - } - else if (a == '\r') { + } else if (a == '\r') { if (b == '\n') { return sizeof("\r\n") - 1; - } - else { + } else { return sizeof("\r") - 1; } } @@ -104,8 +100,7 @@ int ENCiWriteBreakType(void* stream, int width, ENCBreakType breakType, BOOL val break; } } - } - else { + } else { switch (breakType) { case ENC_BR_CRLF: { return sizeof("\r\n") - 1; diff --git a/libs/RVL_SDK/src/es/es.c b/libs/RVL_SDK/src/es/es.c index df1ebfbf..9034e712 100644 --- a/libs/RVL_SDK/src/es/es.c +++ b/libs/RVL_SDK/src/es/es.c @@ -1,16 +1,16 @@ #include -#include #include +#include #include static IOSFd __esFd = -1; #define DECLARE_ES_WORK u8 __esWork[256] ALIGN32 -#define AT_ES_WORK(x) (__esWork + x) +#define AT_ES_WORK(x) (__esWork + x) -#define IS_ALIGNED(x) (((u32)(x) & 31) == 0) +#define IS_ALIGNED(x) (((u32)(x) & 31) == 0) #define IS_ALIGNED64(x) (((u32)(x) & 63) == 0) // Di means something. DVD Interface???? @@ -96,9 +96,9 @@ out: ESError ES_ImportTicket(ESTicket* ticket, void* certs, u32 certSize, void* crls, u32 crlSize, int unknown) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret = ES_ERR_OK; + ESError ret = ES_ERR_OK; if (ticket == NULL || certs == NULL || certSize == 0) { ret = ES_ERR_INVALID; @@ -120,31 +120,31 @@ ESError ES_ImportTicket(ESTicket* ticket, void* certs, u32 certSize, void* crls, vec[1].base = (u8*)certs; vec[1].length = certSize; - + vec[2].base = (u8*)crls; vec[2].length = crlSize; if (unknown == 0) { - ret = IOS_Ioctlv(__esFd, ES_IOCTLV_IMPORT_TICKET, 3, 0 , vec); + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_IMPORT_TICKET, 3, 0, vec); goto out; } - + ret = ES_ERR_INVALID_UNKNOWN; out: return ret; } -ESError ES_ImportBoot(ESTicket* ticket, void* certs, u32 certSize, void* tmd, u32 tmdSize, void* tmdCerts, u32 tmdCertSize, void* crls, u32 crlSize, void* app, u32 appSize) { +ESError ES_ImportBoot(ESTicket* ticket, void* certs, u32 certSize, void* tmd, u32 tmdSize, void* tmdCerts, u32 tmdCertSize, void* crls, u32 crlSize, + void* app, u32 appSize) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret = ES_ERR_OK; + ESError ret = ES_ERR_OK; - if (ticket == NULL || certs == NULL || certSize == 0 - || tmd == NULL || tmdSize == 0 || tmdCerts == NULL || tmdCertSize == 0 - || app == NULL || appSize == 0) { + if (ticket == NULL || certs == NULL || certSize == 0 || tmd == NULL || tmdSize == 0 || tmdCerts == NULL || tmdCertSize == 0 || app == NULL || + appSize == 0) { ret = ES_ERR_INVALID; goto out; } @@ -177,7 +177,7 @@ ESError ES_ImportBoot(ESTicket* ticket, void* certs, u32 certSize, void* tmd, u3 vec[5].base = (u8*)app; vec[5].length = appSize; - ret = IOS_Ioctlv(__esFd, ES_IOCTLV_IMPORT_BOOT, 6, 0 , vec); + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_IMPORT_BOOT, 6, 0, vec); out: return ret; @@ -214,9 +214,9 @@ out: ESError ES_GetDeviceId(ESDeviceId* deviceId) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret; + ESError ret; if (__esFd < 0 || deviceId == NULL) { return ES_ERR_INVALID; @@ -235,10 +235,10 @@ ESError ES_GetDeviceId(ESDeviceId* deviceId) { ESError ES_ImportTitleInit(void* tmd, u32 tmdSize, void* certs, u32 certSize, void* crls, u32 crlSize, int unknown0, int unknown1) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - int* pUnknown = (int*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + int* pUnknown = (int*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (!IS_ALIGNED(tmd) || !IS_ALIGNED(certs) || !IS_ALIGNED(crls)) { return ES_ERR_INVALID; @@ -257,13 +257,13 @@ ESError ES_ImportTitleInit(void* tmd, u32 tmdSize, void* certs, u32 certSize, vo vec[0].base = (u8*)tmd; vec[0].length = tmdSize; - + vec[1].base = (u8*)certs; vec[1].length = certSize; - + vec[2].base = (u8*)crls; vec[2].length = crlSize; - + vec[3].base = (u8*)pUnknown; vec[3].length = sizeof(*pUnknown); @@ -297,11 +297,11 @@ ESError ES_ImportTitleInit(void* tmd, u32 tmdSize, void* certs, u32 certSize, vo ESFd ES_ImportContentBegin(ESTitleId titleId, ESContentId contentId) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - ESContentId* pContentId = (ESContentId*)AT_ES_WORK(0x20); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + ESContentId* pContentId = (ESContentId*)AT_ES_WORK(0x20); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -310,22 +310,22 @@ ESFd ES_ImportContentBegin(ESTitleId titleId, ESContentId contentId) { *pTitleId = titleId; vec[0].base = (u8*)pTitleId; vec[0].length = sizeof(*pTitleId); - + *pContentId = contentId; vec[1].base = (u8*)pContentId; vec[1].length = sizeof(*pContentId); - ret = IOS_Ioctlv(__esFd, ES_IOCTLV_IMPORT_CONTENT_BEGIN, 2, 0 , vec); + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_IMPORT_CONTENT_BEGIN, 2, 0, vec); return ret; } ESError ES_ImportContentData(ESFd fd, void* data, u32 dataSize) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESFd* pFd = (ESFd*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESFd* pFd = (ESFd*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (fd < 0 || data == NULL || dataSize == 0) { return ES_ERR_INVALID; @@ -346,17 +346,17 @@ ESError ES_ImportContentData(ESFd fd, void* data, u32 dataSize) { vec[1].base = (u8*)data; vec[1].length = dataSize; - ret = IOS_Ioctlv(__esFd, ES_IOCTLV_IMPORT_CONTENT_DATA, 2, 0 , vec); + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_IMPORT_CONTENT_DATA, 2, 0, vec); return ret; } ESError ES_ImportContentEnd(ESFd fd) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESFd* pFd = (ESFd*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESFd* pFd = (ESFd*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (fd < 0 || __esFd < 0) { return ES_ERR_INVALID; @@ -366,47 +366,47 @@ ESError ES_ImportContentEnd(ESFd fd) { vec[0].base = (u8*)pFd; vec[0].length = sizeof(*pFd); - ret = IOS_Ioctlv(__esFd, ES_IOCTLV_IMPORT_CONTENT_END, 1, 0 , vec); + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_IMPORT_CONTENT_END, 1, 0, vec); return ret; } ESError ES_ImportTitleDone() { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; } - ret = IOS_Ioctlv(__esFd, ES_IOCTLV_IMPORT_TITLE_DONE, 0, 0 , vec); + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_IMPORT_TITLE_DONE, 0, 0, vec); return ret; } ESError ES_ImportTitleCancel() { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; } - ret = IOS_Ioctlv(__esFd, ES_IOCTLV_IMPORT_TITLE_CANCEL, 0, 0 , vec); + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_IMPORT_TITLE_CANCEL, 0, 0, vec); return ret; } ESError ES_LaunchTitle(ESTitleId titleId, ESTicketView* ticket) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -434,10 +434,10 @@ ESError ES_LaunchTitle(ESTitleId titleId, ESTicketView* ticket) { ESFd ES_OpenContentFile(ESContentId contentId) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESContentId* pContentId = (ESContentId*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESContentId* pContentId = (ESContentId*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -447,18 +447,18 @@ ESFd ES_OpenContentFile(ESContentId contentId) { vec[0].base = (u8*)pContentId; vec[0].length = sizeof(*pContentId); - ret = IOS_Ioctlv(__esFd, ES_IOCTLV_OPEN_CONTENT, 1, 0 , vec); + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_OPEN_CONTENT, 1, 0, vec); return ret; } ESFd ES_OpenTitleContentFile(ESTitleId titleId, ESTicketView* ticketView, ESContentId contentIndex) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - ESContentId* pContentId = (ESContentId*)AT_ES_WORK(0x20); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + ESContentId* pContentId = (ESContentId*)AT_ES_WORK(0x20); - ESError ret; + ESError ret; if (__esFd < 0 || !IS_ALIGNED(ticketView)) { return ES_ERR_INVALID; @@ -475,17 +475,17 @@ ESFd ES_OpenTitleContentFile(ESTitleId titleId, ESTicketView* ticketView, ESCont vec[2].base = (u8*)pContentId; vec[2].length = sizeof(*pContentId); - ret = IOS_Ioctlv(__esFd, ES_IOCTLV_OPEN_TITLE_CONTENT_FILE, 3, 0 , vec); + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_OPEN_TITLE_CONTENT_FILE, 3, 0, vec); return ret; } ESError ES_ReadContentFile(ESFd fd, void* buffer, u32 size) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESFd* cFd = (ESFd*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESFd* cFd = (ESFd*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0 || fd < 0 || buffer == NULL || size == 0) { return ES_ERR_INVALID; @@ -502,19 +502,19 @@ ESError ES_ReadContentFile(ESFd fd, void* buffer, u32 size) { vec[1].base = (u8*)buffer; vec[1].length = size; - ret = IOS_Ioctlv(__esFd, ES_IOCTLV_READ_CONTENT, 1, 1 , vec); + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_READ_CONTENT, 1, 1, vec); return ret; } ESError ES_SeekContentFile(ESFd fd, s32 offset, u32 whence) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - s32* pFd = (s32*)AT_ES_WORK(0x00); - s32* pOffset = (s32*)AT_ES_WORK(0x20); - u32* pWhence = (u32*)AT_ES_WORK(0x40); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + s32* pFd = (s32*)AT_ES_WORK(0x00); + s32* pOffset = (s32*)AT_ES_WORK(0x20); + u32* pWhence = (u32*)AT_ES_WORK(0x40); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -532,17 +532,17 @@ ESError ES_SeekContentFile(ESFd fd, s32 offset, u32 whence) { vec[2].base = (u8*)pWhence; vec[2].length = sizeof(*pWhence); - ret = IOS_Ioctlv(__esFd, ES_IOCTLV_SEEK_CONTENT, 3, 0 , vec); + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_SEEK_CONTENT, 3, 0, vec); return ret; } ESError ES_CloseContentFile(ESFd fd) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - s32* pFd = (s32*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + s32* pFd = (s32*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0 || fd < 0) { return ES_ERR_INVALID; @@ -559,10 +559,10 @@ ESError ES_CloseContentFile(ESFd fd) { ESError ES_ListOwnedTitles(ESTitleId* titleIds, u32* numTitles) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - u32* pNumTitles = (u32*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + u32* pNumTitles = (u32*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0 || numTitles == NULL) { return ES_ERR_INVALID; @@ -581,11 +581,9 @@ ESError ES_ListOwnedTitles(ESTitleId* titleIds, u32* numTitles) { *numTitles = *pNumTitles; } return ret; - } - else if (*numTitles == 0) { + } else if (*numTitles == 0) { return ES_ERR_INVALID; - } - else { + } else { *pNumTitles = *numTitles; vec[0].base = (u8*)pNumTitles; @@ -593,7 +591,7 @@ ESError ES_ListOwnedTitles(ESTitleId* titleIds, u32* numTitles) { vec[1].base = (u8*)titleIds; vec[1].length = *numTitles * sizeof(*titleIds); - + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_LIST_OWNED_TITLES_WITH_COUNT, 1, 1, vec); return ret; } @@ -602,10 +600,10 @@ ESError ES_ListOwnedTitles(ESTitleId* titleIds, u32* numTitles) { ESError ES_ListTitlesOnCard(ESTitleId* titleIds, u32* numTitles) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - u32* pNumTitles = (u32*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + u32* pNumTitles = (u32*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0 || numTitles == NULL) { return ES_ERR_INVALID; @@ -624,11 +622,9 @@ ESError ES_ListTitlesOnCard(ESTitleId* titleIds, u32* numTitles) { *numTitles = *pNumTitles; } return ret; - } - else if (*numTitles == 0) { + } else if (*numTitles == 0) { return ES_ERR_INVALID; - } - else { + } else { *pNumTitles = *numTitles; vec[0].base = (u8*)pNumTitles; @@ -636,7 +632,7 @@ ESError ES_ListTitlesOnCard(ESTitleId* titleIds, u32* numTitles) { vec[1].base = (u8*)titleIds; vec[1].length = *numTitles * sizeof(*titleIds); - + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_LIST_TITLES_ON_CARD_WITH_COUNT, 1, 1, vec); return ret; } @@ -645,11 +641,11 @@ ESError ES_ListTitlesOnCard(ESTitleId* titleIds, u32* numTitles) { ESError ES_ListTitleContentsOnCard(ESTitleId titleId, ESContentId* contentIds, u32* numContents) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - u32* pNumContents = (u32*)AT_ES_WORK(0x20); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + u32* pNumContents = (u32*)AT_ES_WORK(0x20); - ESError ret; + ESError ret; if (__esFd < 0 || numContents == NULL) { return ES_ERR_INVALID; @@ -672,22 +668,20 @@ ESError ES_ListTitleContentsOnCard(ESTitleId titleId, ESContentId* contentIds, u *numContents = *pNumContents; } return ret; - } - else if (*numContents == 0) { + } else if (*numContents == 0) { return ES_ERR_INVALID; - } - else { + } else { *pNumContents = *numContents; vec[0].base = (u8*)pTitleId; vec[0].length = sizeof(*pTitleId); - + vec[1].base = (u8*)pNumContents; vec[1].length = sizeof(*pNumContents); vec[2].base = (u8*)contentIds; vec[2].length = *numContents * sizeof(*contentIds); - + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_LIST_TITLE_CONTENTS_WITH_COUNT, 2, 1, vec); return ret; } @@ -696,10 +690,10 @@ ESError ES_ListTitleContentsOnCard(ESTitleId titleId, ESContentId* contentIds, u ESError ES_ListTmdContentsOnCard(ESTitleMeta* tmd, u32 tmdSize, ESContentId* contentIds, u32* numContents) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - u32* pNumContents = (u32*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + u32* pNumContents = (u32*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0 || tmd == NULL || tmdSize == 0 || tmdSize > sizeof(ESTitleMeta) || numContents == NULL) { return ES_ERR_INVALID; @@ -721,22 +715,20 @@ ESError ES_ListTmdContentsOnCard(ESTitleMeta* tmd, u32 tmdSize, ESContentId* con *numContents = *pNumContents; } return ret; - } - else if (*numContents == 0) { + } else if (*numContents == 0) { return ES_ERR_INVALID; - } - else { + } else { *pNumContents = *numContents; vec[0].base = (u8*)tmd; vec[0].length = tmdSize; - + vec[1].base = (u8*)pNumContents; vec[1].length = sizeof(*pNumContents); vec[2].base = (u8*)contentIds; vec[2].length = *numContents * sizeof(*contentIds); - + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_LIST_TMD_CONTENTS_CARD_WITH_COUNT, 2, 1, vec); return ret; } @@ -745,10 +737,10 @@ ESError ES_ListTmdContentsOnCard(ESTitleMeta* tmd, u32 tmdSize, ESContentId* con ESError ES_ListSharedContents(u32* numContents, ESHash* hashes) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - u32* pNumContents = (u32*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + u32* pNumContents = (u32*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0 || numContents == NULL) { return ES_ERR_INVALID; @@ -767,11 +759,9 @@ ESError ES_ListSharedContents(u32* numContents, ESHash* hashes) { *numContents = *pNumContents; } return ret; - } - else if (*numContents == 0) { + } else if (*numContents == 0) { return ES_ERR_INVALID; - } - else { + } else { *pNumContents = *numContents; vec[0].base = (u8*)pNumContents; @@ -779,20 +769,20 @@ ESError ES_ListSharedContents(u32* numContents, ESHash* hashes) { vec[1].base = (u8*)hashes; vec[1].length = *numContents * sizeof(*hashes); - + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_LIST_SHARED_CONTENTS_WITH_COUNT, 1, 1, vec); return ret; } } -ESError ES_GetTicketViews(ESTitleId titleId, ESTicketView* ticketViewList, u32* numTicketViews) { +ESError ES_GetTicketViews(ESTitleId titleId, ESTicketView* ticketViewList, u32* numTicketViews) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - u32* pNumTicketViews = (u32*)AT_ES_WORK(0x20); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + u32* pNumTicketViews = (u32*)AT_ES_WORK(0x20); - ESError ret; + ESError ret; if (__esFd < 0 || numTicketViews == NULL) { return ES_ERR_INVALID; @@ -815,22 +805,20 @@ ESError ES_GetTicketViews(ESTitleId titleId, ESTicketView* ticketViewList, u32* *numTicketViews = *pNumTicketViews; } return ret; - } - else if (*numTicketViews == 0) { + } else if (*numTicketViews == 0) { return ES_ERR_INVALID; - } - else { + } else { *pNumTicketViews = *numTicketViews; vec[0].base = (u8*)pTitleId; vec[0].length = sizeof(*pTitleId); - + vec[1].base = (u8*)pNumTicketViews; vec[1].length = sizeof(*pNumTicketViews); vec[2].base = (u8*)ticketViewList; vec[2].length = *numTicketViews * sizeof(*ticketViewList); - + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_GET_TICKET_VIEWS_WITH_COUNT, 2, 1, vec); return ret; } @@ -839,11 +827,11 @@ ESError ES_GetTicketViews(ESTitleId titleId, ESTicketView* ticketViewList, u32* ESError ES_GetTmd(ESTitleId titleId, ESTitleMeta* tmd, u32* tmdSize) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - u32* pTmdSize = (u32*)AT_ES_WORK(0x20); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + u32* pTmdSize = (u32*)AT_ES_WORK(0x20); - ESError ret; + ESError ret; if (__esFd < 0 || tmdSize == NULL) { return ES_ERR_INVALID; @@ -866,22 +854,20 @@ ESError ES_GetTmd(ESTitleId titleId, ESTitleMeta* tmd, u32* tmdSize) { *tmdSize = *pTmdSize; } return ret; - } - else if (*tmdSize == 0) { + } else if (*tmdSize == 0) { return ES_ERR_INVALID; - } - else { + } else { *pTmdSize = *tmdSize; vec[0].base = (u8*)pTitleId; vec[0].length = sizeof(*pTitleId); - + vec[1].base = (u8*)pTmdSize; vec[1].length = sizeof(*pTmdSize); vec[2].base = (u8*)tmd; vec[2].length = *tmdSize; - + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_GET_TMD_WITH_SIZE, 2, 1, vec); return ret; } @@ -890,11 +876,11 @@ ESError ES_GetTmd(ESTitleId titleId, ESTitleMeta* tmd, u32* tmdSize) { ESError ES_GetTmdView(ESTitleId titleId, ESTmdView* tmdView, u32* tmdSize) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - u32* pTmdSize = (u32*)AT_ES_WORK(0x20); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + u32* pTmdSize = (u32*)AT_ES_WORK(0x20); - ESError ret; + ESError ret; if (__esFd < 0 || tmdSize == NULL) { return ES_ERR_INVALID; @@ -917,22 +903,20 @@ ESError ES_GetTmdView(ESTitleId titleId, ESTmdView* tmdView, u32* tmdSize) { *tmdSize = *pTmdSize; } return ret; - } - else if (*tmdSize == 0) { + } else if (*tmdSize == 0) { return ES_ERR_INVALID; - } - else { + } else { *pTmdSize = *tmdSize; vec[0].base = (u8*)pTitleId; vec[0].length = sizeof(*pTitleId); - + vec[1].base = (u8*)pTmdSize; vec[1].length = sizeof(*pTmdSize); vec[2].base = (u8*)tmdView; vec[2].length = *tmdSize; - + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_GET_TMDVIEW_WITH_SIZE, 2, 1, vec); return ret; } @@ -941,10 +925,10 @@ ESError ES_GetTmdView(ESTitleId titleId, ESTmdView* tmdView, u32* tmdSize) { ESError ES_DeleteTitleContent(ESTitleId titleId) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -961,11 +945,11 @@ ESError ES_DeleteTitleContent(ESTitleId titleId) { ESError ES_DeleteContent(ESTitleId titleId, ESContentId contentId) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - ESContentId* pContentId = (ESContentId*)AT_ES_WORK(0x20); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + ESContentId* pContentId = (ESContentId*)AT_ES_WORK(0x20); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -986,10 +970,10 @@ ESError ES_DeleteContent(ESTitleId titleId, ESContentId contentId) { ESError ES_DeleteTitle(ESTitleId titleId) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -1006,9 +990,9 @@ ESError ES_DeleteTitle(ESTitleId titleId) { ESError ES_DeleteTicket(ESTicketView* ticket) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -1028,9 +1012,9 @@ ESError ES_DeleteTicket(ESTicketView* ticket) { ESError ES_GetTitleId(ESTitleId* titleId) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret; + ESError ret; if (__esFd < 0 || titleId == NULL) { return ES_ERR_INVALID; @@ -1049,10 +1033,10 @@ ESError ES_GetTitleId(ESTitleId* titleId) { ESError ES_SetUid(ESTitleId titleId) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -1069,9 +1053,9 @@ ESError ES_SetUid(ESTitleId titleId) { ESError ES_GetDeviceCert(void* deviceCert) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret; + ESError ret; if (__esFd < 0 || deviceCert == NULL) { return ES_ERR_INVALID; @@ -1091,10 +1075,10 @@ ESError ES_GetDeviceCert(void* deviceCert) { ESError ES_DiGetTmdView(ESTitleMeta* tmd, u32 tmdSize, ESTmdView* tmdView, u32* tmdViewSize) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - u32* pTmdViewSize = (u32*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + u32* pTmdViewSize = (u32*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0 || tmdSize > sizeof(ESTitleMeta) || tmdViewSize == NULL || (tmd == NULL && tmdSize != 0) || (tmd != NULL && tmdSize == 0)) { return ES_ERR_INVALID; @@ -1116,11 +1100,9 @@ ESError ES_DiGetTmdView(ESTitleMeta* tmd, u32 tmdSize, ESTmdView* tmdView, u32* *tmdViewSize = *pTmdViewSize; } return ret; - } - else if (*tmdViewSize == 0) { + } else if (*tmdViewSize == 0) { return ES_ERR_INVALID; - } - else { + } else { *pTmdViewSize = *tmdViewSize; vec[0].base = (u8*)tmd; @@ -1137,13 +1119,14 @@ ESError ES_DiGetTmdView(ESTitleMeta* tmd, u32 tmdSize, ESTmdView* tmdView, u32* } } -ESError ES_ExportTitleInit(ESTitleId titleId, ESDeviceId deviceId, ESTicketId ticketId, void* certs, u32 certSize, void* crls, u32 crlSize, int unknown, void* ticket, void* tmd, u32 tmdSize) { +ESError ES_ExportTitleInit(ESTitleId titleId, ESDeviceId deviceId, ESTicketId ticketId, void* certs, u32 certSize, void* crls, u32 crlSize, + int unknown, void* ticket, void* tmd, u32 tmdSize) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (!IS_ALIGNED(tmd) || !IS_ALIGNED(ticket) || !IS_ALIGNED(certs) || !IS_ALIGNED(crls)) { return ES_ERR_INVALID; @@ -1180,11 +1163,11 @@ ESError ES_ExportTitleInit(ESTitleId titleId, ESDeviceId deviceId, ESTicketId ti ESError ES_ExportContentBegin(ESTitleId titleId, ESContentId contentId) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - ESContentId* pContentId = (ESContentId*)AT_ES_WORK(0x20); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + ESContentId* pContentId = (ESContentId*)AT_ES_WORK(0x20); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -1205,10 +1188,10 @@ ESError ES_ExportContentBegin(ESTitleId titleId, ESContentId contentId) { ESError ES_ExportContentData(ESFd fd, void* data, u32 dataSize) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESFd* pFd = (ESFd*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESFd* pFd = (ESFd*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (fd < 0 || data == NULL || dataSize == 0) { return ES_ERR_INVALID; @@ -1236,10 +1219,10 @@ ESError ES_ExportContentData(ESFd fd, void* data, u32 dataSize) { ESError ES_ExportContentEnd(ESFd fd) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESFd* pFd = (ESFd*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESFd* pFd = (ESFd*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (fd < 0 || __esFd < 0) { return ES_ERR_INVALID; @@ -1248,7 +1231,7 @@ ESError ES_ExportContentEnd(ESFd fd) { *pFd = fd; vec[0].base = (u8*)pFd; vec[0].length = sizeof(*pFd); - + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_EXPORT_CONTENT_END, 1, 0, vec); return ret; } @@ -1256,9 +1239,9 @@ ESError ES_ExportContentEnd(ESFd fd) { ESError ES_ExportTitleDone() { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -1271,11 +1254,11 @@ ESError ES_ExportTitleDone() { ESError ES_Encrypt(u32 keyNum, u8* iv, u8* input, u32 size, u8* output) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - u32* pKeyNum = (u32*)AT_ES_WORK(0x00); - u32* pSize = (u32*)AT_ES_WORK(0x20); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + u32* pKeyNum = (u32*)AT_ES_WORK(0x00); + u32* pSize = (u32*)AT_ES_WORK(0x20); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -1307,11 +1290,11 @@ ESError ES_Encrypt(u32 keyNum, u8* iv, u8* input, u32 size, u8* output) { ESError ES_Decrypt(u32 keyNum, u8* iv, u8* input, u32 size, u8* output) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - u32* pKeyNum = (u32*)AT_ES_WORK(0x00); - u32* pSize = (u32*)AT_ES_WORK(0x20); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + u32* pKeyNum = (u32*)AT_ES_WORK(0x00); + u32* pSize = (u32*)AT_ES_WORK(0x20); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -1343,9 +1326,9 @@ ESError ES_Decrypt(u32 keyNum, u8* iv, u8* input, u32 size, u8* output) { ESError ES_VerifyCK2() { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -1358,9 +1341,9 @@ ESError ES_VerifyCK2() { ESError ES_GetBoot2Version(u32* bootVersion) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret; + ESError ret; if (__esFd < 0 || bootVersion == NULL) { return ES_ERR_INVALID; @@ -1379,9 +1362,9 @@ ESError ES_GetBoot2Version(u32* bootVersion) { ESError ES_Sign(void* data, u32 length, ESSignature signature, ESCertSignature* sigKeyCert) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret; + ESError ret; if (__esFd < 0 || data == NULL || signature == NULL || sigKeyCert == NULL) { return ES_ERR_INVALID; @@ -1407,9 +1390,9 @@ ESError ES_Sign(void* data, u32 length, ESSignature signature, ESCertSignature* ESError ES_VerifySign(void* data, u32 length, ESSignature signature, void* certs, u32 certSize) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret; + ESError ret; if (__esFd < 0 || data == NULL || signature == NULL || certs == NULL || certSize == 0) { return ES_ERR_INVALID; diff --git a/libs/RVL_SDK/src/esp/esp.c b/libs/RVL_SDK/src/esp/esp.c index 8c25b73d..5d5a9529 100644 --- a/libs/RVL_SDK/src/esp/esp.c +++ b/libs/RVL_SDK/src/esp/esp.c @@ -1,16 +1,16 @@ #include -#include #include +#include #include static IOSFd __esFd = -1; #define DECLARE_ES_WORK u8 __esWork[256] ALIGN32 -#define AT_ES_WORK(x) (__esWork + x) +#define AT_ES_WORK(x) (__esWork + x) -#define IS_ALIGNED(x) (((u32)(x) & 31) == 0) +#define IS_ALIGNED(x) (((u32)(x) & 31) == 0) // Di means something. DVD Interface???? enum { @@ -113,10 +113,10 @@ out: ESError ESP_LaunchTitle(ESTitleId titleId, ESTicketView* ticket) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* tId = (ESTitleId*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* tId = (ESTitleId*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -144,10 +144,10 @@ ESError ESP_LaunchTitle(ESTitleId titleId, ESTicketView* ticket) { ESFd ESP_OpenContentFile(ESContentId contentId) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESContentId* pContentId = (ESContentId*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESContentId* pContentId = (ESContentId*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -157,17 +157,17 @@ ESFd ESP_OpenContentFile(ESContentId contentId) { vec[0].base = (u8*)pContentId; vec[0].length = sizeof(*pContentId); - ret = IOS_Ioctlv(__esFd, ES_IOCTLV_OPEN_CONTENT, 1, 0 , vec); + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_OPEN_CONTENT, 1, 0, vec); return ret; } ESError ESP_ReadContentFile(ESFd fd, void* buffer, u32 size) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESFd* cFd = (ESFd*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESFd* cFd = (ESFd*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0 || fd < 0 || buffer == NULL || size == 0) { return ES_ERR_INVALID; @@ -184,19 +184,19 @@ ESError ESP_ReadContentFile(ESFd fd, void* buffer, u32 size) { vec[1].base = (u8*)buffer; vec[1].length = size; - ret = IOS_Ioctlv(__esFd, ES_IOCTLV_READ_CONTENT, 1, 1 , vec); + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_READ_CONTENT, 1, 1, vec); return ret; } ESError ESP_SeekContentFile(ESFd fd, s32 offset, u32 whence) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - s32* pFd = (s32*)AT_ES_WORK(0x00); - s32* pOffset = (s32*)AT_ES_WORK(0x20); - u32* pWhence = (u32*)AT_ES_WORK(0x40); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + s32* pFd = (s32*)AT_ES_WORK(0x00); + s32* pOffset = (s32*)AT_ES_WORK(0x20); + u32* pWhence = (u32*)AT_ES_WORK(0x40); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -214,17 +214,17 @@ ESError ESP_SeekContentFile(ESFd fd, s32 offset, u32 whence) { vec[2].base = (u8*)pWhence; vec[2].length = sizeof(*pWhence); - ret = IOS_Ioctlv(__esFd, ES_IOCTLV_SEEK_CONTENT, 3, 0 , vec); + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_SEEK_CONTENT, 3, 0, vec); return ret; } ESError ESP_CloseContentFile(ESFd fd) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - s32* pFd = (s32*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + s32* pFd = (s32*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0 || fd < 0) { return ES_ERR_INVALID; @@ -241,11 +241,11 @@ ESError ESP_CloseContentFile(ESFd fd) { ESError ESP_ListTitleContentsOnCard(ESTitleId titleId, ESContentId* contentIds, u32* numContents) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - u32* pNumContents = (u32*)AT_ES_WORK(0x20); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + u32* pNumContents = (u32*)AT_ES_WORK(0x20); - ESError ret; + ESError ret; if (__esFd < 0 || numContents == NULL) { return ES_ERR_INVALID; @@ -268,35 +268,33 @@ ESError ESP_ListTitleContentsOnCard(ESTitleId titleId, ESContentId* contentIds, *numContents = *pNumContents; } return ret; - } - else if (*numContents == 0) { + } else if (*numContents == 0) { return ES_ERR_INVALID; - } - else { + } else { *pNumContents = *numContents; vec[0].base = (u8*)pTitleId; vec[0].length = sizeof(*pTitleId); - + vec[1].base = (u8*)pNumContents; vec[1].length = sizeof(*pNumContents); vec[2].base = (u8*)contentIds; vec[2].length = *numContents * sizeof(*contentIds); - + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_LIST_TITLE_CONTENTS_WITH_COUNT, 2, 1, vec); return ret; } } -ESError ESP_GetTicketViews(ESTitleId titleId, ESTicketView* ticketViewList, u32* numTicketViews) { +ESError ESP_GetTicketViews(ESTitleId titleId, ESTicketView* ticketViewList, u32* numTicketViews) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - u32* pNumTicketViews = (u32*)AT_ES_WORK(0x20); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + u32* pNumTicketViews = (u32*)AT_ES_WORK(0x20); - ESError ret; + ESError ret; if (__esFd < 0 || numTicketViews == NULL) { return ES_ERR_INVALID; @@ -319,22 +317,20 @@ ESError ESP_GetTicketViews(ESTitleId titleId, ESTicketView* ticketViewList, u32 *numTicketViews = *pNumTicketViews; } return ret; - } - else if (*numTicketViews == 0) { + } else if (*numTicketViews == 0) { return ES_ERR_INVALID; - } - else { + } else { *pNumTicketViews = *numTicketViews; vec[0].base = (u8*)pTitleId; vec[0].length = sizeof(*pTitleId); - + vec[1].base = (u8*)pNumTicketViews; vec[1].length = sizeof(*pNumTicketViews); vec[2].base = (u8*)ticketViewList; vec[2].length = *numTicketViews * sizeof(*ticketViewList); - + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_GET_TICKET_VIEWS_WITH_COUNT, 2, 1, vec); return ret; } @@ -343,9 +339,9 @@ ESError ESP_GetTicketViews(ESTitleId titleId, ESTicketView* ticketViewList, u32 ESError ESP_DiGetTicketView(void* ticket, ESTicketView* ticketView) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret; + ESError ret; if (__esFd < 0 || ticketView == NULL) { return ES_ERR_INVALID; @@ -358,8 +354,7 @@ ESError ESP_DiGetTicketView(void* ticket, ESTicketView* ticketView) { vec[0].base = (u8*)ticket; if (ticket == NULL) { vec[0].length = 0; - } - else { + } else { vec[0].length = sizeof(ESTicket); } @@ -373,10 +368,10 @@ ESError ESP_DiGetTicketView(void* ticket, ESTicketView* ticketView) { ESError ESP_DiGetTmd(ESTitleMeta* tmd, u32* tmdSize) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - u32* pTmdSize = (u32*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + u32* pTmdSize = (u32*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0 || tmdSize == NULL) { return ES_ERR_INVALID; @@ -395,11 +390,9 @@ ESError ESP_DiGetTmd(ESTitleMeta* tmd, u32* tmdSize) { *tmdSize = *pTmdSize; } return ret; - } - else if (*tmdSize == 0) { + } else if (*tmdSize == 0) { return ES_ERR_INVALID; - } - else { + } else { *pTmdSize = *tmdSize; vec[0].base = (u8*)pTmdSize; @@ -416,11 +409,11 @@ ESError ESP_DiGetTmd(ESTitleMeta* tmd, u32* tmdSize) { ESError ESP_GetTmdView(ESTitleId titleId, ESTmdView* tmdView, u32* tmdSize) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - u32* pTmdSize = (u32*)AT_ES_WORK(0x20); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + u32* pTmdSize = (u32*)AT_ES_WORK(0x20); - ESError ret; + ESError ret; if (__esFd < 0 || tmdSize == NULL) { return ES_ERR_INVALID; @@ -443,22 +436,20 @@ ESError ESP_GetTmdView(ESTitleId titleId, ESTmdView* tmdView, u32* tmdSize) { *tmdSize = *pTmdSize; } return ret; - } - else if (*tmdSize == 0) { + } else if (*tmdSize == 0) { return ES_ERR_INVALID; - } - else { + } else { *pTmdSize = *tmdSize; vec[0].base = (u8*)pTitleId; vec[0].length = sizeof(*pTitleId); - + vec[1].base = (u8*)pTmdSize; vec[1].length = sizeof(*pTmdSize); vec[2].base = (u8*)tmdView; vec[2].length = *tmdSize; - + ret = IOS_Ioctlv(__esFd, ES_IOCTLV_GET_TMDVIEW_WITH_SIZE, 2, 1, vec); return ret; } @@ -467,10 +458,10 @@ ESError ESP_GetTmdView(ESTitleId titleId, ESTmdView* tmdView, u32* tmdSize) { ESError ESP_GetDataDir(ESTitleId titleId, char* dataDir) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTitleId = (ESTitleId*)AT_ES_WORK(0x00); - ESError ret; + ESError ret; if (__esFd < 0 || dataDir == NULL) { return ES_ERR_INVALID; @@ -483,7 +474,7 @@ ESError ESP_GetDataDir(ESTitleId titleId, char* dataDir) { *pTitleId = titleId; vec[0].base = (u8*)pTitleId; vec[0].length = sizeof(*pTitleId); - + vec[1].base = (u8*)dataDir; vec[1].length = sizeof(*dataDir) * 30; @@ -494,9 +485,9 @@ ESError ESP_GetDataDir(ESTitleId titleId, char* dataDir) { ESError ESP_GetTitleId(ESTitleId* titleId) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESError ret; + ESError ret; if (__esFd < 0 || titleId == NULL) { return ES_ERR_INVALID; @@ -515,11 +506,11 @@ ESError ESP_GetTitleId(ESTitleId* titleId) { ESError ESP_GetConsumption(ESTicketId ticketId, ESLpEntry* limitEntries, u32* numEntries) { DECLARE_ES_WORK; - IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); - ESTitleId* pTicketId = (ESTitleId*)AT_ES_WORK(0x00); - u32* pNumEntries = (u32*)AT_ES_WORK(0x20); + IOSIoVector* vec = (IOSIoVector*)AT_ES_WORK(0xD0); + ESTitleId* pTicketId = (ESTitleId*)AT_ES_WORK(0x00); + u32* pNumEntries = (u32*)AT_ES_WORK(0x20); - ESError ret; + ESError ret; if (__esFd < 0) { return ES_ERR_INVALID; @@ -536,8 +527,7 @@ ESError ESP_GetConsumption(ESTicketId ticketId, ESLpEntry* limitEntries, u32* nu if (limitEntries == NULL) { vec[1].base = NULL; vec[1].length = 0; - } - else { + } else { vec[1].base = (u8*)limitEntries; vec[1].length = *numEntries * sizeof(*limitEntries); *pNumEntries = *numEntries; diff --git a/libs/RVL_SDK/src/euart/euart.c b/libs/RVL_SDK/src/euart/euart.c index dc66b094..1ae9c5fd 100644 --- a/libs/RVL_SDK/src/euart/euart.c +++ b/libs/RVL_SDK/src/euart/euart.c @@ -2,8 +2,8 @@ #include -#include #include +#include static BOOL __EUARTInitialized = FALSE; static u32 __EUARTLastErrorCode = 0; diff --git a/libs/RVL_SDK/src/exi/EXIBios.c b/libs/RVL_SDK/src/exi/EXIBios.c index 07ac8307..208c846a 100644 --- a/libs/RVL_SDK/src/exi/EXIBios.c +++ b/libs/RVL_SDK/src/exi/EXIBios.c @@ -14,10 +14,10 @@ DefineVersion(RVL_SDK, EXI, "Apr 20 2010", "11:19:09"); #define EXI_CHAN_REG(chan, idx) (__EXIRegs[((chan) * (EXI_REG_SIZE >> 2)) + (idx >> 2)]) -static EXIControl Ecb[EXI_CHAN_MAX]; -static u32 IDSerialPort1; +static EXIControl Ecb[EXI_CHAN_MAX]; +static u32 IDSerialPort1; -BOOL __EXIProbe(s32 chan); +BOOL __EXIProbe(s32 chan); static void SetExiInterruptMask(s32 chan, EXIControl* exi) { EXIControl* exi2; @@ -27,24 +27,21 @@ static void SetExiInterruptMask(s32 chan, EXIControl* exi) { case EXI_CHAN_0: if ((exi->exiCallback == 0 && exi2->exiCallback == 0) || HAS_FLAG(exi->state, EXI_STATE_LOCKED)) { __OSMaskInterrupts(OS_INTERRUPTMASK_EXI_0_EXI | OS_INTERRUPTMASK_EXI_2_EXI); - } - else { + } else { __OSUnmaskInterrupts(OS_INTERRUPTMASK_EXI_0_EXI | OS_INTERRUPTMASK_EXI_2_EXI); } break; case EXI_CHAN_1: if (exi->exiCallback == 0 || HAS_FLAG(exi->state, EXI_STATE_LOCKED)) { __OSMaskInterrupts(OS_INTERRUPTMASK_EXI_1_EXI); - } - else { + } else { __OSUnmaskInterrupts(OS_INTERRUPTMASK_EXI_1_EXI); } break; case EXI_CHAN_2: if (__OSGetInterruptHandler(__OS_INTERRUPT_PI_DEBUG) == 0 || HAS_FLAG(exi->state, EXI_STATE_LOCKED)) { __OSMaskInterrupts(OS_INTERRUPTMASK_PI_DEBUG); - } - else { + } else { __OSUnmaskInterrupts(OS_INTERRUPTMASK_PI_DEBUG); } break; @@ -96,15 +93,15 @@ BOOL EXIImm(s32 chan, void* buffer, s32 length, u32 type, EXICallback callback) if (type != EXI_READ) { u32 data = 0; int i; - for(i = 0; i < length; i++) { + for (i = 0; i < length; i++) { data |= ((u8*)buffer)[i] << ((3 - i) * 8); } EXI_CHAN_REG(chan, EXI_DATA) = data; } exi->immBuf = buffer; - exi->immLen = (type != EXI_WRITE) ? length : 0; - EXI_CHAN_REG(chan, EXI_CONTROL) = (type << 2) | (1<immLen = (type != EXI_WRITE) ? length : 0; + EXI_CHAN_REG(chan, EXI_CONTROL) = (type << 2) | (1 << EXI_CONTROL_TSTART) | ((length - 1) << 4); OSRestoreInterrupts(enabled); @@ -151,7 +148,7 @@ BOOL EXIDma(s32 chan, void* buffer, s32 length, u32 type, EXICallback callback) EXI_CHAN_REG(chan, EXI_MEM_ADDRESS) = (u32)buffer & ~0x1F; EXI_CHAN_REG(chan, EXI_LENGTH) = length; - EXI_CHAN_REG(chan, EXI_CONTROL) = (type << 2) | (1<state, EXI_STATE_SELECTED) { - if (!HAS_FLAG(EXI_CHAN_REG(chan, EXI_CONTROL), (1<state, EXI_STATE_SELECTED) { + if (!HAS_FLAG(EXI_CHAN_REG(chan, EXI_CONTROL), (1 << EXI_CONTROL_TSTART))) { + enabled = OSDisableInterrupts(); - if (HAS_FLAG(exi->state, EXI_STATE_SELECTED)) { - CompleteTransfer(chan); + if (HAS_FLAG(exi->state, EXI_STATE_SELECTED)) { + CompleteTransfer(chan); - if (__OSGetDIConfig() != 0xFF || (OSGetConsoleType() & OS_CONSOLE_MASK) == OS_CONSOLE_MASK_TDEV || exi->immLen != 4 - || (EXI_CHAN_REG(chan, EXI_CHAN_PARAM) & (7<immLen != 4 || + (EXI_CHAN_REG(chan, EXI_CHAN_PARAM) & (7 << EXI_CHAN_PARAM_CLK)) || + (EXI_CHAN_REG(chan, EXI_DATA) != 0x1010000 && EXI_CHAN_REG(chan, EXI_DATA) != 0x5070000 && + EXI_CHAN_REG(chan, EXI_DATA) != 0x4220001) || + __OSDeviceCode == (DVD_DEVICE_CODE | 0x0200)) { + result = TRUE; + } } - } - OSRestoreInterrupts(enabled); - break; + OSRestoreInterrupts(enabled); + break; + } } - } return result; } @@ -194,15 +193,15 @@ u32 EXIClearInterrupts(s32 chan, BOOL clearExi, BOOL clearTc, BOOL clearExt) { new &= 0x7F5; if (clearExi) { - SET_FLAG(new, 1<exiCallback = exiCallback; if (chan != EXI_CHAN_2) { SetExiInterruptMask(chan, exi); - } - else { + } else { SetExiInterruptMask(EXI_CHAN_0, &Ecb[0]); } @@ -255,12 +253,12 @@ BOOL __EXIProbe(s32 chan) { chanParam = EXI_CHAN_REG(chan, EXI_CHAN_PARAM); if (!HAS_FLAG(exi->state, EXI_STATE_ATTACHED)) { - if (HAS_FLAG(chanParam, (1<idTime = 0; } - if (HAS_FLAG(chanParam, (1<idTime = 0; result = FALSE; } - } - else if (!HAS_FLAG(chanParam, (1<idTime = 0; result = FALSE; } @@ -287,7 +283,7 @@ BOOL EXIProbe(s32 chan) { EXIControl* exi = &Ecb[chan]; BOOL result; u32 id; - + result = __EXIProbe(chan); if (result && !exi->idTime) { result = EXIGetID(chan, EXI_DEV_EXT, &id) ? TRUE : FALSE; @@ -378,16 +374,16 @@ BOOL EXISelectSD(s32 chan, u32 dev, u32 freq) { exi = &Ecb[chan]; enabled = OSDisableInterrupts(); - if (HAS_FLAG(exi->state, EXI_STATE_SELECTED) || (chan != EXI_CHAN_2 - && ((dev == EXI_DEV_EXT && !HAS_FLAG(exi->state, EXI_STATE_ATTACHED) && !EXIProbe(chan)) || !HAS_FLAG(exi->state, EXI_STATE_LOCKED) - || exi->dev != dev))) { + if (HAS_FLAG(exi->state, EXI_STATE_SELECTED) || + (chan != EXI_CHAN_2 && ((dev == EXI_DEV_EXT && !HAS_FLAG(exi->state, EXI_STATE_ATTACHED) && !EXIProbe(chan)) || + !HAS_FLAG(exi->state, EXI_STATE_LOCKED) || exi->dev != dev))) { OSRestoreInterrupts(enabled); return FALSE; } SET_FLAG(exi->state, EXI_STATE_SELECTED); chanParam = EXI_CHAN_REG(chan, EXI_CHAN_PARAM); - chanParam &= ((1<state, EXI_STATE_SELECTED) || (chan != EXI_CHAN_2 - && ((dev == EXI_DEV_EXT && !HAS_FLAG(exi->state, EXI_STATE_ATTACHED) && !__EXIProbe(chan)) || !HAS_FLAG(exi->state, EXI_STATE_LOCKED) - || exi->dev != dev))) { + if (HAS_FLAG(exi->state, EXI_STATE_SELECTED) || + (chan != EXI_CHAN_2 && ((dev == EXI_DEV_EXT && !HAS_FLAG(exi->state, EXI_STATE_ATTACHED) && !__EXIProbe(chan)) || + !HAS_FLAG(exi->state, EXI_STATE_LOCKED) || exi->dev != dev))) { OSRestoreInterrupts(enabled); return FALSE; } SET_FLAG(exi->state, EXI_STATE_SELECTED); chanParam = EXI_CHAN_REG(chan, EXI_CHAN_PARAM); - chanParam &= ((1<state, EXI_STATE_SELECTED); chanParam = EXI_CHAN_REG(chan, EXI_CHAN_PARAM); - chanParam &= ((1<state, EXI_STATE_SELECTED); chanParam = EXI_CHAN_REG(chan, EXI_CHAN_PARAM); - EXI_CHAN_REG(chan, EXI_CHAN_PARAM) = chanParam & ((1<state, EXI_STATE_ATTACHED)) { switch (chan) { @@ -487,7 +484,7 @@ BOOL EXIDeselect(s32 chan) { OSRestoreInterrupts(enabled); - if ((chan != EXI_CHAN_2) && HAS_FLAG(chanParam, (1<state, EXI_STATE_SELECTED); chanParam = EXI_CHAN_REG(chan, 0); - EXI_CHAN_REG(chan, 0) = chanParam & ((1<> interrupt); + __OSMaskInterrupts((u32)OS_INTERRUPTMASK(0) /*?*/ >> interrupt); EXIClearInterrupts(chan, FALSE, TRUE, FALSE); callback = exi->tcCallback; @@ -568,7 +565,7 @@ static void EXTIntrruptHandler(__OSInterrupt interrupt, OSContext* context) { if (callback) { OSContext exceptionContext; - + OSClearContext(&exceptionContext); OSSetCurrentContext(&exceptionContext); exi->extCallback = NULL; @@ -581,21 +578,21 @@ static void EXTIntrruptHandler(__OSInterrupt interrupt, OSContext* context) { void EXIInit() { u32 id; - while ((EXI_CHAN_REG(EXI_CHAN_0, EXI_CONTROL) & (1<id = *id; exi->idTime = startTime; @@ -767,7 +762,7 @@ BOOL EXIGetID(s32 chan, u32 dev, u32* id) { BOOL EXIGetIDEx(s32 chan, u32 dev, u32* id) { EXIControl* exi = &Ecb[chan]; BOOL err; - u32 cmd; + u32 cmd; err = !EXISelectEx(chan, dev, EXI_FREQ_1MHZ); if (!err) { diff --git a/libs/RVL_SDK/src/exi/EXICommon.c b/libs/RVL_SDK/src/exi/EXICommon.c index 1f48eb35..b94ab793 100644 --- a/libs/RVL_SDK/src/exi/EXICommon.c +++ b/libs/RVL_SDK/src/exi/EXICommon.c @@ -3,15 +3,12 @@ const u32 __EXIFreq = EXI_FREQ_16MHZ; static inline u32 __EXISwap32(u32 val) { - return (val >> 24 & 0x000000FF) - | (val >> 8 & 0x0000FF00) - | (val << 8 & 0x00FF0000) - | (val << 24 & 0xFF000000); + return (val >> 24 & 0x000000FF) | (val >> 8 & 0x0000FF00) | (val << 8 & 0x00FF0000) | (val << 24 & 0xFF000000); } BOOL EXIWriteReg(s32 chan, u32 dev, u32 exiCmd, void* reg, s32 size) { BOOL ret = FALSE; - u32 reg32; + u32 reg32; switch (size) { case 1: { diff --git a/libs/RVL_SDK/src/fs/fs.c b/libs/RVL_SDK/src/fs/fs.c index eaf9ab9a..cbbc397a 100644 --- a/libs/RVL_SDK/src/fs/fs.c +++ b/libs/RVL_SDK/src/fs/fs.c @@ -6,17 +6,17 @@ #include -#include #include +#include -static IOSFd __fsFd = -1; -static u32 __fsInitialized = FALSE; +static IOSFd __fsFd = -1; +static u32 __fsInitialized = FALSE; -static char* __devfs = NULL; +static char* __devfs = NULL; -static IOSHeapId hId; +static IOSHeapId hId; -static s32 _asynCnt = 0; +static s32 _asynCnt = 0; enum { ISFS_CB_STATE_NONE = 0, @@ -28,63 +28,66 @@ enum { }; enum { - ISFS_IOCTL_GET_STATS = 2, - ISFS_IOCTL_CREATE_DIR = 3, - ISFS_IOCTL_READ_DIR = 4, - ISFS_IOCTL_SET_ATTR = 5, - ISFS_IOCTL_GET_ATTR = 6, - ISFS_IOCTL_DELETE_PATH = 7, - ISFS_IOCTL_RENAME_PATH = 8, - ISFS_IOCTL_CREATE_FILE = 9, - ISFS_IOCTL_GET_FILE_STATS = 11, - ISFS_IOCTLV_GET_USAGE = 12, - ISFS_IOCTL_SHUTDOWN_FS = 13 + ISFS_IOCTL_GET_STATS = 2, + ISFS_IOCTL_CREATE_DIR = 3, + ISFS_IOCTL_READ_DIR = 4, + ISFS_IOCTL_SET_ATTR = 5, + ISFS_IOCTL_GET_ATTR = 6, + ISFS_IOCTL_DELETE_PATH = 7, + ISFS_IOCTL_RENAME_PATH = 8, + ISFS_IOCTL_CREATE_FILE = 9, + ISFS_IOCTL_GET_FILE_STATS = 11, + ISFS_IOCTLV_GET_USAGE = 12, + ISFS_IOCTL_SHUTDOWN_FS = 13 }; typedef struct FS_GetAttr { - u32* ownerId; // 0x00 - u16* groupId; // 0x04 - u32* attr; // 0x08 - u32* ownerAcc; // 0x0C - u32* groupAcc; // 0x10 - u32* othersAcc; // 0x14 + u32* ownerId; // 0x00 + u16* groupId; // 0x04 + u32* attr; // 0x08 + u32* ownerAcc; // 0x0C + u32* groupAcc; // 0x10 + u32* othersAcc; // 0x14 } FS_GetAttr; typedef struct FS_GetUsage { - u32* blocks; // 0x00 - u32* iNodes; // 0x04 + u32* blocks; // 0x00 + u32* iNodes; // 0x04 } FS_GetUsage; typedef struct FS_Callback { - u8 ioBuf[0x100] ALIGN32; // 0x00 - ISFSCallback callback; // 0x100 - void* callbackArg; // 0x104 - u32 func; // 0x108 + u8 ioBuf[0x100] ALIGN32; // 0x00 + ISFSCallback callback; // 0x100 + void* callbackArg; // 0x104 + u32 func; // 0x108 union { - ISFSStats* stats; - ISFSFileStats* fstats; + ISFSStats* stats; + ISFSFileStats* fstats; - u32* num; + u32* num; - FS_GetAttr getAttr; - FS_GetUsage getUsage; - } args; // 0x10C + FS_GetAttr getAttr; + FS_GetUsage getUsage; + } args; // 0x10C } FS_Callback; -#define FS_HEAP_BLOCK 16 -#define FS_HEAP_SIZE ((FS_HEAP_BLOCK+1) * OSRoundUp32B(sizeof(FS_Callback))) +#define FS_HEAP_BLOCK 16 +#define FS_HEAP_SIZE ((FS_HEAP_BLOCK + 1) * OSRoundUp32B(sizeof(FS_Callback))) -#define FS_ALLOC(p) iosAllocAligned(hId, sizeof(*p), DEFAULT_ALIGN) -#define FS_FREE(p) if (p != NULL) { iosFree(hId, p); } +#define FS_ALLOC(p) iosAllocAligned(hId, sizeof(*p), DEFAULT_ALIGN) +#define FS_FREE(p) \ + if (p != NULL) { \ + iosFree(hId, p); \ + } ISFSError ISFS_OpenLib() { - ISFSError ret = ISFS_ERROR_OK; + ISFSError ret = ISFS_ERROR_OK; - static void* lo = NULL; - static void* hi = NULL; + static void* lo = NULL; + static void* hi = NULL; - FS_Callback* __fsCtxt = NULL; + FS_Callback* __fsCtxt = NULL; if (!__fsInitialized) { lo = IPCGetBufferLo(); @@ -178,15 +181,15 @@ static IOSError _FSReadDirCb(IOSError result, void* isfsCallbackArg) { static IOSError _FSGetAttrCb(IOSError result, void* isfsCallbackArg) { if (result == IPC_RESULT_OK) { - FS_Callback* _context = (FS_Callback*)isfsCallbackArg; - ISFSPathAttrArgs* pathAttrArgs = (ISFSPathAttrArgs*)OSRoundUp32B(_context->ioBuf + FS_MAX_PATH); - - *_context->args.getAttr.ownerId = pathAttrArgs->ownerId; - *_context->args.getAttr.groupId = pathAttrArgs->groupId; - *_context->args.getAttr.attr = pathAttrArgs->attr; - *_context->args.getAttr.ownerAcc = pathAttrArgs->ownerAccess; - *_context->args.getAttr.groupAcc = pathAttrArgs->groupAccess; - *_context->args.getAttr.othersAcc = pathAttrArgs->othersAccess; + FS_Callback* _context = (FS_Callback*)isfsCallbackArg; + ISFSPathAttrArgs* pathAttrArgs = (ISFSPathAttrArgs*)OSRoundUp32B(_context->ioBuf + FS_MAX_PATH); + + *_context->args.getAttr.ownerId = pathAttrArgs->ownerId; + *_context->args.getAttr.groupId = pathAttrArgs->groupId; + *_context->args.getAttr.attr = pathAttrArgs->attr; + *_context->args.getAttr.ownerAcc = pathAttrArgs->ownerAccess; + *_context->args.getAttr.groupAcc = pathAttrArgs->groupAccess; + *_context->args.getAttr.othersAcc = pathAttrArgs->othersAccess; } return IPC_RESULT_OK; @@ -219,8 +222,8 @@ static IOSError _FSGetFileStatsCb(IOSError result, void* isfsCallbackArg) { } IOSError _isfsFuncCb(IOSError result, void* isfsCallbackArg) { - FS_Callback* _context = (FS_Callback*)isfsCallbackArg; - ISFSError ret = result; + FS_Callback* _context = (FS_Callback*)isfsCallbackArg; + ISFSError ret = result; if (ret >= IPC_RESULT_OK) { switch (_context->func) { @@ -262,8 +265,8 @@ IOSError _isfsFuncCb(IOSError result, void* isfsCallbackArg) { } ISFSError ISFS_GetStats(ISFSStats* stats) { - ISFSError ret = ISFS_ERROR_OK; - FS_Callback* isfsCallbackArg = NULL; + ISFSError ret = ISFS_ERROR_OK; + FS_Callback* isfsCallbackArg = NULL; if (__fsFd < 0 || stats == NULL) { ret = ISFS_ERROR_INVALID; @@ -294,13 +297,12 @@ out: } ISFSError ISFS_CreateDir(const char* dirName, u32 dirAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc) { - ISFSError ret = ISFS_ERROR_OK; - u32 len; + ISFSError ret = ISFS_ERROR_OK; + u32 len; - ISFSPathAttrArgs* pathAttrArgs; + ISFSPathAttrArgs* pathAttrArgs; - FS_Callback* isfsCallbackArg = NULL; - + FS_Callback* isfsCallbackArg = NULL; if (dirName == NULL || __fsFd < 0 || (len = strnlen(dirName, FS_MAX_PATH)) == FS_MAX_PATH) { ret = ISFS_ERROR_INVALID; @@ -315,7 +317,7 @@ ISFSError ISFS_CreateDir(const char* dirName, u32 dirAttr, u32 ownerAcc, u32 gro } pathAttrArgs = (ISFSPathAttrArgs*)isfsCallbackArg->ioBuf; - memcpy(pathAttrArgs->path, dirName, len+1); + memcpy(pathAttrArgs->path, dirName, len + 1); pathAttrArgs->attr = (u8)dirAttr; pathAttrArgs->ownerAccess = (u8)ownerAcc; @@ -333,12 +335,12 @@ out: } ISFSError ISFS_CreateDirAsync(const char* dirName, u32 dirAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc, ISFSCallback callback, void* callbackArg) { - ISFSError ret = ISFS_ERROR_OK; - u32 len; + ISFSError ret = ISFS_ERROR_OK; + u32 len; - ISFSPathAttrArgs* pathAttrArgs; + ISFSPathAttrArgs* pathAttrArgs; - FS_Callback* isfsCallbackArg; + FS_Callback* isfsCallbackArg; if (dirName == NULL || __fsFd < 0 || (len = strnlen(dirName, FS_MAX_PATH)) == FS_MAX_PATH) { ret = ISFS_ERROR_INVALID; @@ -357,7 +359,7 @@ ISFSError ISFS_CreateDirAsync(const char* dirName, u32 dirAttr, u32 ownerAcc, u3 isfsCallbackArg->func = ISFS_CB_STATE_NONE; pathAttrArgs = (ISFSPathAttrArgs*)isfsCallbackArg->ioBuf; - memcpy(pathAttrArgs->path, (void*)dirName, len+1); + memcpy(pathAttrArgs->path, (void*)dirName, len + 1); pathAttrArgs->attr = dirAttr; pathAttrArgs->ownerAccess = ownerAcc; pathAttrArgs->groupAccess = groupAcc; @@ -370,13 +372,13 @@ out: } ISFSError ISFS_ReadDir(const char* dirName, char* nameList, u32* num) { - ISFSError ret = ISFS_ERROR_OK; - u32 len, numInputs, numOutputs, *numPtr; + ISFSError ret = ISFS_ERROR_OK; + u32 len, numInputs, numOutputs, *numPtr; - IOSIoVector* vec = NULL; - char* dnPtr; + IOSIoVector* vec = NULL; + char* dnPtr; - FS_Callback* isfsCallbackArg = NULL; + FS_Callback* isfsCallbackArg = NULL; if (dirName == NULL || num == NULL || __fsFd < 0 || ((u32)nameList & 31) || (len = strnlen(dirName, FS_MAX_PATH)) == FS_MAX_PATH) { ret = ISFS_ERROR_INVALID; @@ -393,7 +395,7 @@ ISFSError ISFS_ReadDir(const char* dirName, char* nameList, u32* num) { // Directory name dnPtr = (char*)OSRoundUp32B((u8*)&vec[4]); - memcpy(dnPtr, dirName, len+1); + memcpy(dnPtr, dirName, len + 1); vec[0].base = (u8*)dnPtr; vec[0].length = FS_MAX_PATH; @@ -408,12 +410,11 @@ ISFSError ISFS_ReadDir(const char* dirName, char* nameList, u32* num) { *numPtr = *num; vec[2].base = (u8*)nameList; - vec[2].length = *num * (FS_MAX_DIR_PATH+1); + vec[2].length = *num * (FS_MAX_DIR_PATH + 1); vec[3].base = (u8*)numPtr; vec[3].length = sizeof(u8*); - } - else { + } else { numInputs = 1; numOutputs = 1; } @@ -434,14 +435,14 @@ out: } ISFSError ISFS_ReadDirAsync(const char* dirName, char* nameList, u32* num, ISFSCallback callback, void* callbackArg) { - ISFSError ret = ISFS_ERROR_OK; - u32 len, numInputs, numOutputs, *numPtr; + ISFSError ret = ISFS_ERROR_OK; + u32 len, numInputs, numOutputs, *numPtr; - FS_Callback* isfsCallbackArg = NULL; + FS_Callback* isfsCallbackArg = NULL; + + IOSIoVector* vec = NULL; + char* dnPtr; - IOSIoVector* vec = NULL; - char* dnPtr; - if (dirName == NULL || num == NULL || __fsFd < 0 || ((u32)nameList & 31) || (len = strnlen(dirName, FS_MAX_PATH)) == FS_MAX_PATH) { ret = ISFS_ERROR_INVALID; goto out; @@ -462,7 +463,7 @@ ISFSError ISFS_ReadDirAsync(const char* dirName, char* nameList, u32* num, ISFSC // Directory name dnPtr = (char*)OSRoundUp32B((u8*)&vec[4]); - memcpy(dnPtr, dirName, len+1); + memcpy(dnPtr, dirName, len + 1); vec[0].base = (u8*)dnPtr; vec[0].length = FS_MAX_PATH; @@ -474,15 +475,14 @@ ISFSError ISFS_ReadDirAsync(const char* dirName, char* nameList, u32* num, ISFSC if (nameList != NULL) { numInputs = 2; numOutputs = 2; - + *numPtr = *num; - + vec[2].base = (u8*)nameList; - vec[2].length = *num * (FS_MAX_DIR_PATH+1); + vec[2].length = *num * (FS_MAX_DIR_PATH + 1); vec[3].base = (u8*)numPtr; vec[3].length = 4; - } - else { + } else { numInputs = 1; numOutputs = 1; } @@ -494,12 +494,12 @@ out: } ISFSError ISFS_SetAttr(const char* fileName, u32 ownerId, u16 groupId, u32 attr, u32 ownerAcc, u32 groupAcc, u32 othersAcc) { - ISFSError ret = ISFS_ERROR_OK; - ISFSPathAttrArgs* pathAttrArgs; + ISFSError ret = ISFS_ERROR_OK; + ISFSPathAttrArgs* pathAttrArgs; - u32 len; + u32 len; - FS_Callback* isfsCallbackArg = NULL; + FS_Callback* isfsCallbackArg = NULL; if (fileName == NULL || __fsFd < 0 || (len = strnlen(fileName, FS_MAX_PATH)) == FS_MAX_PATH) { ret = ISFS_ERROR_INVALID; @@ -512,8 +512,8 @@ ISFSError ISFS_SetAttr(const char* fileName, u32 ownerId, u16 groupId, u32 attr, goto out; } - pathAttrArgs = (ISFSPathAttrArgs*) isfsCallbackArg->ioBuf; - memcpy(pathAttrArgs->path, fileName, len+1); + pathAttrArgs = (ISFSPathAttrArgs*)isfsCallbackArg->ioBuf; + memcpy(pathAttrArgs->path, fileName, len + 1); pathAttrArgs->ownerId = ownerId; pathAttrArgs->groupId = groupId; @@ -532,13 +532,14 @@ out: return ret; } -ISFSError ISFS_SetAttrAsync(const char* fileName, u32 ownerId, u16 groupId, u32 attr, u32 ownerAcc, u32 groupAcc, u32 othersAcc, ISFSCallback callback, void *callbackArg) { - ISFSError ret = ISFS_ERROR_OK; - ISFSPathAttrArgs* pathAttrArgs; +ISFSError ISFS_SetAttrAsync(const char* fileName, u32 ownerId, u16 groupId, u32 attr, u32 ownerAcc, u32 groupAcc, u32 othersAcc, + ISFSCallback callback, void* callbackArg) { + ISFSError ret = ISFS_ERROR_OK; + ISFSPathAttrArgs* pathAttrArgs; - u32 len; + u32 len; - FS_Callback* isfsCallbackArg; + FS_Callback* isfsCallbackArg; if (fileName == NULL || __fsFd < 0 || (len = strnlen(fileName, FS_MAX_PATH)) == FS_MAX_PATH) { ret = ISFS_ERROR_INVALID; @@ -555,8 +556,8 @@ ISFSError ISFS_SetAttrAsync(const char* fileName, u32 ownerId, u16 groupId, u32 isfsCallbackArg->callbackArg = callbackArg; isfsCallbackArg->func = ISFS_CB_STATE_NONE; - pathAttrArgs = (ISFSPathAttrArgs*) isfsCallbackArg->ioBuf; - memcpy(pathAttrArgs->path, fileName, len+1); + pathAttrArgs = (ISFSPathAttrArgs*)isfsCallbackArg->ioBuf; + memcpy(pathAttrArgs->path, fileName, len + 1); pathAttrArgs->ownerId = ownerId; pathAttrArgs->groupId = groupId; @@ -571,16 +572,16 @@ out: } ISFSError ISFS_GetAttr(const char* fileName, u32* ownerId, u16* groupId, u32* attr, u32* ownerAcc, u32* groupAcc, u32* othersAcc) { - ISFSError ret = ISFS_ERROR_OK; - ISFSPathAttrArgs* pathAttrArgs; + ISFSError ret = ISFS_ERROR_OK; + ISFSPathAttrArgs* pathAttrArgs; - u8* ptr; - u32 len; + u8* ptr; + u32 len; FS_Callback* isfsCallbackArg = NULL; - if (fileName == NULL || __fsFd < 0 || (len = strnlen(fileName, FS_MAX_PATH)) == FS_MAX_PATH - || ownerId == NULL || groupId == NULL || attr == NULL || ownerAcc == NULL || groupAcc == NULL || othersAcc == NULL) { + if (fileName == NULL || __fsFd < 0 || (len = strnlen(fileName, FS_MAX_PATH)) == FS_MAX_PATH || ownerId == NULL || groupId == NULL || + attr == NULL || ownerAcc == NULL || groupAcc == NULL || othersAcc == NULL) { ret = ISFS_ERROR_INVALID; goto out; } @@ -592,7 +593,7 @@ ISFSError ISFS_GetAttr(const char* fileName, u32* ownerId, u16* groupId, u32* at } ptr = (u8*)isfsCallbackArg->ioBuf; - memcpy(ptr, fileName, len+1); + memcpy(ptr, fileName, len + 1); pathAttrArgs = (ISFSPathAttrArgs*)OSRoundUp32B(ptr + FS_MAX_PATH); ret = IOS_Ioctl(__fsFd, ISFS_IOCTL_GET_ATTR, ptr, FS_MAX_PATH, pathAttrArgs, sizeof(*pathAttrArgs)); @@ -615,20 +616,21 @@ out: return ret; } -ISFSError ISFS_GetAttrAsync(const char* fileName, u32* ownerId, u16* groupId, u32* attr, u32* ownerAcc, u32* groupAcc, u32* othersAcc, ISFSCallback callback, void* callbackArg) { +ISFSError ISFS_GetAttrAsync(const char* fileName, u32* ownerId, u16* groupId, u32* attr, u32* ownerAcc, u32* groupAcc, u32* othersAcc, + ISFSCallback callback, void* callbackArg) { ISFSError ret = ISFS_ERROR_OK; - FS_Callback *isfsCallbackArg; - ISFSPathAttrArgs *pathAttrArgs; - u8 *ptr; + FS_Callback* isfsCallbackArg; + ISFSPathAttrArgs* pathAttrArgs; + u8* ptr; u32 len; - if (fileName == NULL || __fsFd < 0 || (len = strnlen(fileName, FS_MAX_PATH)) == FS_MAX_PATH - || ownerId == NULL || groupId == NULL || attr == NULL || ownerAcc == NULL || groupAcc == NULL || othersAcc == NULL) { + if (fileName == NULL || __fsFd < 0 || (len = strnlen(fileName, FS_MAX_PATH)) == FS_MAX_PATH || ownerId == NULL || groupId == NULL || + attr == NULL || ownerAcc == NULL || groupAcc == NULL || othersAcc == NULL) { ret = ISFS_ERROR_INVALID; goto out; } - isfsCallbackArg = FS_ALLOC(isfsCallbackArg); + isfsCallbackArg = FS_ALLOC(isfsCallbackArg); if (isfsCallbackArg == NULL) { ret = ISFS_ERROR_BUSY; goto out; @@ -636,7 +638,7 @@ ISFSError ISFS_GetAttrAsync(const char* fileName, u32* ownerId, u16* groupId, u3 isfsCallbackArg->args.getAttr.ownerId = ownerId; isfsCallbackArg->args.getAttr.groupId = groupId; - isfsCallbackArg->args.getAttr.attr = attr; + isfsCallbackArg->args.getAttr.attr = attr; isfsCallbackArg->args.getAttr.ownerAcc = ownerAcc; isfsCallbackArg->args.getAttr.groupAcc = groupAcc; isfsCallbackArg->args.getAttr.othersAcc = othersAcc; @@ -645,7 +647,7 @@ ISFSError ISFS_GetAttrAsync(const char* fileName, u32* ownerId, u16* groupId, u3 isfsCallbackArg->func = ISFS_CB_STATE_GET_ATTR; ptr = (u8*)isfsCallbackArg->ioBuf; - memcpy(ptr, fileName, len+1); + memcpy(ptr, fileName, len + 1); pathAttrArgs = (ISFSPathAttrArgs*)OSRoundUp32B(ptr + FS_MAX_PATH); ret = IOS_IoctlAsync(__fsFd, ISFS_IOCTL_GET_ATTR, ptr, FS_MAX_PATH, pathAttrArgs, sizeof(*pathAttrArgs), _isfsFuncCb, isfsCallbackArg); @@ -654,9 +656,9 @@ out: } ISFSError ISFS_Delete(const char* fileName) { - ISFSError ret = ISFS_ERROR_OK; - u32 len; - FS_Callback* isfsCallbackArg = NULL; + ISFSError ret = ISFS_ERROR_OK; + u32 len; + FS_Callback* isfsCallbackArg = NULL; if (fileName == NULL || __fsFd < 0 || (len = strnlen(fileName, FS_MAX_PATH)) == FS_MAX_PATH) { ret = ISFS_ERROR_INVALID; @@ -669,7 +671,7 @@ ISFSError ISFS_Delete(const char* fileName) { goto out; } - memcpy(isfsCallbackArg->ioBuf, fileName, len+1); + memcpy(isfsCallbackArg->ioBuf, fileName, len + 1); ret = IOS_Ioctl(__fsFd, ISFS_IOCTL_DELETE_PATH, isfsCallbackArg->ioBuf, FS_MAX_PATH, NULL, 0); out: @@ -696,7 +698,7 @@ ISFSError ISFS_DeleteAsync(const char* fileName, ISFSCallback callback, void* ca goto out; } - memcpy(isfsCallbackArg->ioBuf, fileName, len+1); + memcpy(isfsCallbackArg->ioBuf, fileName, len + 1); isfsCallbackArg->callback = callback; isfsCallbackArg->callbackArg = callbackArg; isfsCallbackArg->func = ISFS_CB_STATE_NONE; @@ -707,19 +709,19 @@ out: } ISFSError ISFS_Rename(const char* oldName, const char* newName) { - ISFSError ret = ISFS_ERROR_OK; - ISFSPathsArgs* pathsArgs; + ISFSError ret = ISFS_ERROR_OK; + ISFSPathsArgs* pathsArgs; - u32 oldLen, newLen; + u32 oldLen, newLen; - FS_Callback* isfsCallbackArg = NULL; + FS_Callback* isfsCallbackArg = NULL; - if (oldName == NULL || newName == NULL || __fsFd < 0 - || (oldLen = strnlen(oldName, FS_MAX_PATH)) == FS_MAX_PATH || (newLen = strnlen(newName, FS_MAX_PATH)) == FS_MAX_PATH) { + if (oldName == NULL || newName == NULL || __fsFd < 0 || (oldLen = strnlen(oldName, FS_MAX_PATH)) == FS_MAX_PATH || + (newLen = strnlen(newName, FS_MAX_PATH)) == FS_MAX_PATH) { ret = ISFS_ERROR_INVALID; goto out; } - + isfsCallbackArg = FS_ALLOC(isfsCallbackArg); if (isfsCallbackArg == NULL) { ret = IPC_RESULT_ALLOC_FAILED; @@ -727,8 +729,8 @@ ISFSError ISFS_Rename(const char* oldName, const char* newName) { } pathsArgs = (ISFSPathsArgs*)isfsCallbackArg->ioBuf; - memcpy(pathsArgs->path1, oldName, oldLen+1); - memcpy(pathsArgs->path2, newName, newLen+1); + memcpy(pathsArgs->path1, oldName, oldLen + 1); + memcpy(pathsArgs->path2, newName, newLen + 1); ret = IOS_Ioctl(__fsFd, ISFS_IOCTL_RENAME_PATH, pathsArgs, sizeof(*pathsArgs), NULL, 0); out: @@ -740,19 +742,19 @@ out: } ISFSError ISFS_RenameAsync(const char* oldName, const char* newName, ISFSCallback callback, void* callbackArg) { - ISFSError ret = ISFS_ERROR_OK; - ISFSPathsArgs* pathsArgs; + ISFSError ret = ISFS_ERROR_OK; + ISFSPathsArgs* pathsArgs; - u32 oldLen, newLen; + u32 oldLen, newLen; - FS_Callback* isfsCallbackArg; + FS_Callback* isfsCallbackArg; - if (oldName == NULL || newName == NULL || __fsFd < 0 - || (oldLen = strnlen(oldName, FS_MAX_PATH)) == FS_MAX_PATH || (newLen = strnlen(newName, FS_MAX_PATH)) == FS_MAX_PATH) { + if (oldName == NULL || newName == NULL || __fsFd < 0 || (oldLen = strnlen(oldName, FS_MAX_PATH)) == FS_MAX_PATH || + (newLen = strnlen(newName, FS_MAX_PATH)) == FS_MAX_PATH) { ret = ISFS_ERROR_INVALID; goto out; } - + isfsCallbackArg = FS_ALLOC(isfsCallbackArg); if (isfsCallbackArg == NULL) { ret = ISFS_ERROR_BUSY; @@ -764,8 +766,8 @@ ISFSError ISFS_RenameAsync(const char* oldName, const char* newName, ISFSCallbac isfsCallbackArg->func = ISFS_CB_STATE_NONE; pathsArgs = (ISFSPathsArgs*)isfsCallbackArg->ioBuf; - memcpy(pathsArgs->path1, oldName, oldLen+1); - memcpy(pathsArgs->path2, newName, newLen+1); + memcpy(pathsArgs->path1, oldName, oldLen + 1); + memcpy(pathsArgs->path2, newName, newLen + 1); ret = IOS_IoctlAsync(__fsFd, ISFS_IOCTL_RENAME_PATH, pathsArgs, sizeof(*pathsArgs), NULL, 0, _isfsFuncCb, isfsCallbackArg); out: @@ -773,14 +775,14 @@ out: } ISFSError ISFS_GetUsage(const char* dirName, u32* blocks, u32* iNodes) { - ISFSError ret = ISFS_ERROR_OK; + ISFSError ret = ISFS_ERROR_OK; - u32 len, *blkPtr, *inodePtr; + u32 len, *blkPtr, *inodePtr; - IOSIoVector* vec = NULL; - char* dnPtr; + IOSIoVector* vec = NULL; + char* dnPtr; - FS_Callback* isfsCallbackArg = NULL; + FS_Callback* isfsCallbackArg = NULL; if (dirName == NULL || __fsFd < 0 || blocks == NULL || iNodes == NULL || (len = strnlen(dirName, FS_MAX_PATH)) == FS_MAX_PATH) { ret = ISFS_ERROR_INVALID; @@ -796,7 +798,7 @@ ISFSError ISFS_GetUsage(const char* dirName, u32* blocks, u32* iNodes) { vec = (IOSIoVector*)isfsCallbackArg->ioBuf; dnPtr = (char*)OSRoundUp32B((u8*)&vec[3]); - memcpy(dnPtr, dirName, len+1); + memcpy(dnPtr, dirName, len + 1); vec[0].base = (u8*)dnPtr; vec[0].length = FS_MAX_PATH; @@ -826,12 +828,12 @@ out: } ISFSError ISFS_CreateFile(const char* fileName, u32 fileAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc) { - ISFSError ret = ISFS_ERROR_OK; - ISFSPathAttrArgs* pathAttrArgs; + ISFSError ret = ISFS_ERROR_OK; + ISFSPathAttrArgs* pathAttrArgs; - u32 len; + u32 len; - FS_Callback* isfsCallbackArg = NULL; + FS_Callback* isfsCallbackArg = NULL; if (fileName == NULL || __fsFd < 0 || (len = strnlen(fileName, FS_MAX_PATH)) == FS_MAX_PATH) { ret = ISFS_ERROR_INVALID; @@ -845,7 +847,7 @@ ISFSError ISFS_CreateFile(const char* fileName, u32 fileAttr, u32 ownerAcc, u32 } pathAttrArgs = (ISFSPathAttrArgs*)isfsCallbackArg->ioBuf; - memcpy(pathAttrArgs->path, fileName, len+1); + memcpy(pathAttrArgs->path, fileName, len + 1); pathAttrArgs->attr = fileAttr; pathAttrArgs->ownerAccess = ownerAcc; @@ -862,13 +864,14 @@ out: return ret; } -ISFSError ISFS_CreateFileAsync(const char* fileName, u32 fileAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc, ISFSCallback callback, void* callbackArg) { - ISFSError ret = ISFS_ERROR_OK; - ISFSPathAttrArgs* pathAttrArgs; +ISFSError ISFS_CreateFileAsync(const char* fileName, u32 fileAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc, ISFSCallback callback, + void* callbackArg) { + ISFSError ret = ISFS_ERROR_OK; + ISFSPathAttrArgs* pathAttrArgs; - u32 len; + u32 len; - FS_Callback* isfsCallbackArg; + FS_Callback* isfsCallbackArg; if (fileName == NULL || __fsFd < 0 || (len = strnlen(fileName, FS_MAX_PATH)) == FS_MAX_PATH) { ret = ISFS_ERROR_INVALID; @@ -886,7 +889,7 @@ ISFSError ISFS_CreateFileAsync(const char* fileName, u32 fileAttr, u32 ownerAcc, isfsCallbackArg->func = ISFS_CB_STATE_NONE; pathAttrArgs = (ISFSPathAttrArgs*)isfsCallbackArg->ioBuf; - memcpy(pathAttrArgs->path, fileName, len+1); + memcpy(pathAttrArgs->path, fileName, len + 1); pathAttrArgs->attr = fileAttr; pathAttrArgs->ownerAccess = ownerAcc; pathAttrArgs->groupAccess = groupAcc; @@ -898,9 +901,9 @@ out: } IOSFd ISFS_Open(const char* fileName, u32 access) { - ISFSError ret = ISFS_ERROR_OK; - u32 len; - FS_Callback* isfsCallbackArg = NULL; + ISFSError ret = ISFS_ERROR_OK; + u32 len; + FS_Callback* isfsCallbackArg = NULL; if (fileName == NULL || (len = strnlen(fileName, FS_MAX_PATH)) == FS_MAX_PATH) { ret = ISFS_ERROR_INVALID; @@ -913,8 +916,8 @@ IOSFd ISFS_Open(const char* fileName, u32 access) { goto out; } - memcpy(isfsCallbackArg->ioBuf, fileName, len+1); - + memcpy(isfsCallbackArg->ioBuf, fileName, len + 1); + ret = IOS_Open((const char*)isfsCallbackArg->ioBuf, access); out: if (isfsCallbackArg != NULL) { @@ -925,9 +928,9 @@ out: } IOSFd ISFS_OpenAsync(const char* fileName, u32 access, ISFSCallback callback, void* callbackArg) { - ISFSError ret = ISFS_ERROR_OK; - u32 len; - FS_Callback* isfsCallbackArg; + ISFSError ret = ISFS_ERROR_OK; + u32 len; + FS_Callback* isfsCallbackArg; if (fileName == NULL || (len = strnlen(fileName, FS_MAX_PATH)) == FS_MAX_PATH) { ret = ISFS_ERROR_INVALID; @@ -944,15 +947,15 @@ IOSFd ISFS_OpenAsync(const char* fileName, u32 access, ISFSCallback callback, vo isfsCallbackArg->callbackArg = callbackArg; isfsCallbackArg->func = ISFS_CB_STATE_NONE; - memcpy(isfsCallbackArg->ioBuf, fileName, len+1); + memcpy(isfsCallbackArg->ioBuf, fileName, len + 1); ret = IOS_OpenAsync((const char*)isfsCallbackArg->ioBuf, access, _isfsFuncCb, isfsCallbackArg); out: return ret; } ISFSError ISFS_GetFileStats(IOSFd fd, ISFSFileStats* stats) { - ISFSError ret = ISFS_ERROR_OK; - FS_Callback* isfsCallbackArg = NULL; + ISFSError ret = ISFS_ERROR_OK; + FS_Callback* isfsCallbackArg = NULL; if (stats == NULL || ((u32)stats & 31)) { ret = ISFS_ERROR_INVALID; @@ -982,8 +985,8 @@ out: } ISFSError ISFS_GetFileStatsAsync(IOSFd fd, ISFSFileStats* stats, ISFSCallback callback, void* callbackArg) { - ISFSError ret = ISFS_ERROR_OK; - FS_Callback* isfsCallbackArg; + ISFSError ret = ISFS_ERROR_OK; + FS_Callback* isfsCallbackArg; if (stats == NULL || ((u32)stats & 31)) { ret = ISFS_ERROR_INVALID; @@ -1011,8 +1014,8 @@ ISFSError ISFS_Seek(IOSFd fd, s32 offset, u32 whence) { } ISFSError ISFS_SeekAsync(IOSFd fd, s32 offset, u32 whence, ISFSCallback callback, void* callbackArg) { - ISFSError ret; - FS_Callback* isfsCallbackArg; + ISFSError ret; + FS_Callback* isfsCallbackArg; isfsCallbackArg = FS_ALLOC(isfsCallbackArg); if (isfsCallbackArg == NULL) { @@ -1038,8 +1041,8 @@ ISFSError ISFS_Read(s32 fd, u8* buffer, u32 bufferLen) { } ISFSError ISFS_ReadAsync(IOSFd fd, u8* buffer, u32 size, ISFSCallback callback, void* callbackArg) { - ISFSError ret = ISFS_ERROR_OK; - FS_Callback* isfsCallbackArg; + ISFSError ret = ISFS_ERROR_OK; + FS_Callback* isfsCallbackArg; if (buffer == NULL || ((u32)buffer & 31)) { ret = ISFS_ERROR_INVALID; @@ -1075,8 +1078,8 @@ out: } ISFSError ISFS_WriteAsync(IOSFd fd, const char* buffer, u32 size, ISFSCallback callback, void* callbackArg) { - ISFSError ret = ISFS_ERROR_OK; - FS_Callback* isfsCallbackArg; + ISFSError ret = ISFS_ERROR_OK; + FS_Callback* isfsCallbackArg; if (buffer == NULL || ((u32)buffer & 31)) { ret = ISFS_ERROR_INVALID; @@ -1103,8 +1106,8 @@ ISFSError ISFS_Close(IOSFd fd) { } ISFSError ISFS_CloseAsync(IOSFd fd, ISFSCallback callback, void* callbackArg) { - ISFSError ret; - FS_Callback* isfsCallbackArg; + ISFSError ret; + FS_Callback* isfsCallbackArg; isfsCallbackArg = FS_ALLOC(isfsCallbackArg); @@ -1123,8 +1126,8 @@ out: } ISFSError ISFS_ShutdownAsync(ISFSCallback callback, void* callbackArg) { - ISFSError ret = ISFS_ERROR_OK; - FS_Callback* isfsCallbackArg; + ISFSError ret = ISFS_ERROR_OK; + FS_Callback* isfsCallbackArg; isfsCallbackArg = FS_ALLOC(isfsCallbackArg); diff --git a/libs/RVL_SDK/src/gx/GXAttr.c b/libs/RVL_SDK/src/gx/GXAttr.c index 7dc703a0..c8999f07 100644 --- a/libs/RVL_SDK/src/gx/GXAttr.c +++ b/libs/RVL_SDK/src/gx/GXAttr.c @@ -1,5 +1,5 @@ -#include #include +#include static void __GXXfVtxSpecs() { u32 nTex, nNrm, nCols = 0; @@ -19,23 +19,52 @@ static void __GXXfVtxSpecs() { static inline void SETVCDATTR(GXAttr Attr, GXAttrType Type) { switch (Attr) { - case GX_VA_PNMTXIDX: { SET_REG_FIELD(__GXData->vcdLo, 1, 0, Type); break; } - case GX_VA_TEX0MTXIDX: { SET_REG_FIELD(__GXData->vcdLo, 1, 1, Type); break; } - case GX_VA_TEX1MTXIDX: { SET_REG_FIELD(__GXData->vcdLo, 1, 2, Type); break; } - case GX_VA_TEX2MTXIDX: { SET_REG_FIELD(__GXData->vcdLo, 1, 3, Type); break; } - case GX_VA_TEX3MTXIDX: { SET_REG_FIELD(__GXData->vcdLo, 1, 4, Type); break; } - case GX_VA_TEX4MTXIDX: { SET_REG_FIELD(__GXData->vcdLo, 1, 5, Type); break; } - case GX_VA_TEX5MTXIDX: { SET_REG_FIELD(__GXData->vcdLo, 1, 6, Type); break; } - case GX_VA_TEX6MTXIDX: { SET_REG_FIELD(__GXData->vcdLo, 1, 7, Type); break; } - case GX_VA_TEX7MTXIDX: { SET_REG_FIELD(__GXData->vcdLo, 1, 8, Type); break; } - case GX_VA_POS: { SET_REG_FIELD(__GXData->vcdLo, 2, 9, Type); break; } + case GX_VA_PNMTXIDX: { + SET_REG_FIELD(__GXData->vcdLo, 1, 0, Type); + break; + } + case GX_VA_TEX0MTXIDX: { + SET_REG_FIELD(__GXData->vcdLo, 1, 1, Type); + break; + } + case GX_VA_TEX1MTXIDX: { + SET_REG_FIELD(__GXData->vcdLo, 1, 2, Type); + break; + } + case GX_VA_TEX2MTXIDX: { + SET_REG_FIELD(__GXData->vcdLo, 1, 3, Type); + break; + } + case GX_VA_TEX3MTXIDX: { + SET_REG_FIELD(__GXData->vcdLo, 1, 4, Type); + break; + } + case GX_VA_TEX4MTXIDX: { + SET_REG_FIELD(__GXData->vcdLo, 1, 5, Type); + break; + } + case GX_VA_TEX5MTXIDX: { + SET_REG_FIELD(__GXData->vcdLo, 1, 6, Type); + break; + } + case GX_VA_TEX6MTXIDX: { + SET_REG_FIELD(__GXData->vcdLo, 1, 7, Type); + break; + } + case GX_VA_TEX7MTXIDX: { + SET_REG_FIELD(__GXData->vcdLo, 1, 8, Type); + break; + } + case GX_VA_POS: { + SET_REG_FIELD(__GXData->vcdLo, 2, 9, Type); + break; + } case GX_VA_NRM: { if (Type != GX_NONE) { __GXData->hasNrms = GX_TRUE; __GXData->hasBiNrms = GX_FALSE; __GXData->nrmType = Type; - } - else { + } else { __GXData->hasNrms = GX_FALSE; } break; @@ -45,22 +74,51 @@ static inline void SETVCDATTR(GXAttr Attr, GXAttrType Type) { __GXData->hasBiNrms = GX_TRUE; __GXData->hasNrms = GX_FALSE; __GXData->nrmType = Type; - } - else { + } else { __GXData->hasBiNrms = GX_FALSE; } break; } - case GX_VA_CLR0: { SET_REG_FIELD(__GXData->vcdLo, 2, 13, Type); break; } - case GX_VA_CLR1: { SET_REG_FIELD(__GXData->vcdLo, 2, 15, Type); break; } - case GX_VA_TEX0: { SET_REG_FIELD(__GXData->vcdHi, 2, 0, Type); break; } - case GX_VA_TEX1: { SET_REG_FIELD(__GXData->vcdHi, 2, 2, Type); break; } - case GX_VA_TEX2: { SET_REG_FIELD(__GXData->vcdHi, 2, 4, Type); break; } - case GX_VA_TEX3: { SET_REG_FIELD(__GXData->vcdHi, 2, 6, Type); break; } - case GX_VA_TEX4: { SET_REG_FIELD(__GXData->vcdHi, 2, 8, Type); break; } - case GX_VA_TEX5: { SET_REG_FIELD(__GXData->vcdHi, 2, 10, Type); break; } - case GX_VA_TEX6: { SET_REG_FIELD(__GXData->vcdHi, 2, 12, Type); break; } - case GX_VA_TEX7: { SET_REG_FIELD(__GXData->vcdHi, 2, 14, Type); break; } + case GX_VA_CLR0: { + SET_REG_FIELD(__GXData->vcdLo, 2, 13, Type); + break; + } + case GX_VA_CLR1: { + SET_REG_FIELD(__GXData->vcdLo, 2, 15, Type); + break; + } + case GX_VA_TEX0: { + SET_REG_FIELD(__GXData->vcdHi, 2, 0, Type); + break; + } + case GX_VA_TEX1: { + SET_REG_FIELD(__GXData->vcdHi, 2, 2, Type); + break; + } + case GX_VA_TEX2: { + SET_REG_FIELD(__GXData->vcdHi, 2, 4, Type); + break; + } + case GX_VA_TEX3: { + SET_REG_FIELD(__GXData->vcdHi, 2, 6, Type); + break; + } + case GX_VA_TEX4: { + SET_REG_FIELD(__GXData->vcdHi, 2, 8, Type); + break; + } + case GX_VA_TEX5: { + SET_REG_FIELD(__GXData->vcdHi, 2, 10, Type); + break; + } + case GX_VA_TEX6: { + SET_REG_FIELD(__GXData->vcdHi, 2, 12, Type); + break; + } + case GX_VA_TEX7: { + SET_REG_FIELD(__GXData->vcdHi, 2, 14, Type); + break; + } } } @@ -69,8 +127,7 @@ void GXSetVtxDesc(GXAttr attr, GXAttrType type) { if (__GXData->hasNrms || __GXData->hasBiNrms) { SET_REG_FIELD(__GXData->vcdLo, 2, 11, __GXData->nrmType); - } - else { + } else { SET_REG_FIELD(__GXData->vcdLo, 2, 11, 0); } @@ -85,9 +142,9 @@ void __GXSetVCD() { } void __GXCalculateVLim() { - static u8 tbl1[] = { 0, 4, 1, 2 }; - static u8 tbl2[] = { 0, 8, 1, 2 }; - static u8 tbl3[] = { 0, 12, 1, 2 }; + static u8 tbl1[] = {0, 4, 1, 2}; + static u8 tbl2[] = {0, 8, 1, 2}; + static u8 tbl3[] = {0, 12, 1, 2}; GXCompCnt nc = GX_POS_XY; @@ -102,7 +159,7 @@ void __GXCalculateVLim() { va = __GXData->vatA[0]; nc = GET_REG_FIELD(va, 1, 9); - vlm = GET_REG_FIELD(vl, 1, 0); + vlm = GET_REG_FIELD(vl, 1, 0); vlm += (u8)GET_REG_FIELD(vl, 1, 1); vlm += (u8)GET_REG_FIELD(vl, 1, 2); vlm += (u8)GET_REG_FIELD(vl, 1, 3); @@ -112,11 +169,10 @@ void __GXCalculateVLim() { vlm += (u8)GET_REG_FIELD(vl, 1, 7); vlm += (u8)GET_REG_FIELD(vl, 1, 8); vlm += tbl3[(u8)GET_REG_FIELD(vl, 2, 9)]; - + if (nc == 1) { b = 3; - } - else { + } else { b = 1; } @@ -163,8 +219,7 @@ static inline void SETVAT(u32* va, u32* vb, u32* vc, GXAttr attr, GXCompCnt cnt, if (cnt == GX_NRM_NBT3) { SET_REG_FIELD(*va, 1, 9, 1); SET_REG_FIELD(*va, 1, 31, 1); - } - else { + } else { SET_REG_FIELD(*va, 1, 9, cnt); SET_REG_FIELD(*va, 1, 31, 0); } @@ -266,7 +321,7 @@ void GXSetVtxAttrFmtv(GXVtxFmt vtxfmt, const GXVtxAttrFmtList* list) { void __GXSetVAT() { s32 i; u32 dirty = __GXData->dirtyVAT; - + i = 0; do { if (dirty & 1) { @@ -312,20 +367,66 @@ void GXSetTexCoordGen2(GXTexCoordID dst_coord, GXTexGenType func, GXTexGenSrc sr form = 0; row = 5; switch (src_param) { - case GX_TG_POS: { row = 0; form = 1; break; } - case GX_TG_NRM: { row = 1; form = 1; break; } - case GX_TG_BINRM: { row = 3; form = 1; break; } - case GX_TG_TANGENT: { row = 4; form = 1; break; } - case GX_TG_COLOR0: { row = 2; break; } - case GX_TG_COLOR1: { row = 2; break; } - case GX_TG_TEX0: { row = 5; break; } - case GX_TG_TEX1: { row = 6; break; } - case GX_TG_TEX2: { row = 7; break; } - case GX_TG_TEX3: { row = 8; break; } - case GX_TG_TEX4: { row = 9; break; } - case GX_TG_TEX5: { row = 10; break; } - case GX_TG_TEX6: { row = 11; break; } - case GX_TG_TEX7: { row = 12; break; } + case GX_TG_POS: { + row = 0; + form = 1; + break; + } + case GX_TG_NRM: { + row = 1; + form = 1; + break; + } + case GX_TG_BINRM: { + row = 3; + form = 1; + break; + } + case GX_TG_TANGENT: { + row = 4; + form = 1; + break; + } + case GX_TG_COLOR0: { + row = 2; + break; + } + case GX_TG_COLOR1: { + row = 2; + break; + } + case GX_TG_TEX0: { + row = 5; + break; + } + case GX_TG_TEX1: { + row = 6; + break; + } + case GX_TG_TEX2: { + row = 7; + break; + } + case GX_TG_TEX3: { + row = 8; + break; + } + case GX_TG_TEX4: { + row = 9; + break; + } + case GX_TG_TEX5: { + row = 10; + break; + } + case GX_TG_TEX6: { + row = 11; + break; + } + case GX_TG_TEX7: { + row = 12; + break; + } default: { break; } @@ -367,8 +468,7 @@ void GXSetTexCoordGen2(GXTexCoordID dst_coord, GXTexGenType func, GXTexGenSrc sr SET_REG_FIELD(reg, 1, 2, form); if (src_param == GX_TG_COLOR0) { SET_REG_FIELD(reg, 3, 4, 2); - } - else { + } else { SET_REG_FIELD(reg, 3, 4, 3); } SET_REG_FIELD(reg, 5, 7, 2); @@ -385,18 +485,42 @@ void GXSetTexCoordGen2(GXTexCoordID dst_coord, GXTexGenType func, GXTexGenSrc sr reg = 0; SET_REG_FIELD(reg, 6, 0, pt_texmtx - 64); SET_REG_FIELD(reg, 1, 8, normalize); - + __GXData->texGenCtrl2[dst_coord] = reg; switch (dst_coord) { - case GX_TEXCOORD0: { SET_REG_FIELD(__GXData->matIdxA, 6, 6, mtx); break; } - case GX_TEXCOORD1: { SET_REG_FIELD(__GXData->matIdxA, 6, 12, mtx); break; } - case GX_TEXCOORD2: { SET_REG_FIELD(__GXData->matIdxA, 6, 18, mtx); break; } - case GX_TEXCOORD3: { SET_REG_FIELD(__GXData->matIdxA, 6, 24, mtx); break; } - case GX_TEXCOORD4: { SET_REG_FIELD(__GXData->matIdxB, 6, 0, mtx); break; } - case GX_TEXCOORD5: { SET_REG_FIELD(__GXData->matIdxB, 6, 6, mtx); break; } - case GX_TEXCOORD6: { SET_REG_FIELD(__GXData->matIdxB, 6, 12, mtx); break; } - default: { SET_REG_FIELD(__GXData->matIdxB, 6, 18, mtx); break; } + case GX_TEXCOORD0: { + SET_REG_FIELD(__GXData->matIdxA, 6, 6, mtx); + break; + } + case GX_TEXCOORD1: { + SET_REG_FIELD(__GXData->matIdxA, 6, 12, mtx); + break; + } + case GX_TEXCOORD2: { + SET_REG_FIELD(__GXData->matIdxA, 6, 18, mtx); + break; + } + case GX_TEXCOORD3: { + SET_REG_FIELD(__GXData->matIdxA, 6, 24, mtx); + break; + } + case GX_TEXCOORD4: { + SET_REG_FIELD(__GXData->matIdxB, 6, 0, mtx); + break; + } + case GX_TEXCOORD5: { + SET_REG_FIELD(__GXData->matIdxB, 6, 6, mtx); + break; + } + case GX_TEXCOORD6: { + SET_REG_FIELD(__GXData->matIdxB, 6, 12, mtx); + break; + } + default: { + SET_REG_FIELD(__GXData->matIdxB, 6, 18, mtx); + break; + } } mtxIdAttr = (GXAttr)(GX_VA_TEX0MTXIDX + (dst_coord - GX_TEXCOORD0)); diff --git a/libs/RVL_SDK/src/gx/GXBump.c b/libs/RVL_SDK/src/gx/GXBump.c index fcd6df11..8a3c0998 100644 --- a/libs/RVL_SDK/src/gx/GXBump.c +++ b/libs/RVL_SDK/src/gx/GXBump.c @@ -1,19 +1,21 @@ #include #include -#include #include +#include #include #include -#define GX_WRITE_SOME_REG5(a, b) { \ - GX_WRITE_U8(a); \ - GX_WRITE_U32(b); \ -} +#define GX_WRITE_SOME_REG5(a, b) \ + { \ + GX_WRITE_U8(a); \ + GX_WRITE_U32(b); \ + } -void GXSetTevIndirect(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXIndTexFormat format, GXIndTexBiasSel bias_sel, GXIndTexMtxID matrix_sel, GXIndTexWrap wrap_s, GXIndTexWrap wrap_t, GXBool add_prev, GXBool utc_lod, GXIndTexAlphaSel alpha_sel) NO_INLINE { +void GXSetTevIndirect(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXIndTexFormat format, GXIndTexBiasSel bias_sel, GXIndTexMtxID matrix_sel, + GXIndTexWrap wrap_s, GXIndTexWrap wrap_t, GXBool add_prev, GXBool utc_lod, GXIndTexAlphaSel alpha_sel) NO_INLINE { u32 reg = 0; SET_REG_FIELD(reg, 2, 0, ind_stage); @@ -181,7 +183,8 @@ void GXSetTevDirect(GXTevStageID tev_stage) { GXSetTevIndirect(tev_stage, GX_INDTEXSTAGE0, GX_ITF_8, GX_ITB_NONE, GX_ITM_OFF, GX_ITW_OFF, GX_ITW_OFF, GX_FALSE, GX_FALSE, GX_ITBA_OFF); } -void __GXUpdateBPMask() {} +void __GXUpdateBPMask() { +} void __GXSetIndirectMask(u32 mask) { SET_REG_FIELD(__GXData->bpMask, 8, ~0xFF, mask); diff --git a/libs/RVL_SDK/src/gx/GXDisplayList.c b/libs/RVL_SDK/src/gx/GXDisplayList.c index 4f93a98d..aafcca6f 100644 --- a/libs/RVL_SDK/src/gx/GXDisplayList.c +++ b/libs/RVL_SDK/src/gx/GXDisplayList.c @@ -2,8 +2,8 @@ #include #include -#include #include +#include #include @@ -11,9 +11,9 @@ #include -static GXFifoObj DisplayListFifo; -static GXData __savedGXdata; -static GXFifoObj OldCPUFifo; +static GXFifoObj DisplayListFifo; +static GXData __savedGXdata; +static GXFifoObj OldCPUFifo; void GXBeginDisplayList(void* list, u32 size) { __GXFifoObj* impl = (__GXFifoObj*)&DisplayListFifo; diff --git a/libs/RVL_SDK/src/gx/GXFifo.c b/libs/RVL_SDK/src/gx/GXFifo.c index 0c6f2f9d..8cbe692a 100644 --- a/libs/RVL_SDK/src/gx/GXFifo.c +++ b/libs/RVL_SDK/src/gx/GXFifo.c @@ -1,23 +1,23 @@ -#include #include +#include -#include #include +#include #include -static GXBool CPGPLinked; +static GXBool CPGPLinked; -static OSThread* __GXCurrentThread; -static BOOL GXOverflowSuspendInProgress; +static OSThread* __GXCurrentThread; +static BOOL GXOverflowSuspendInProgress; -static GXBreakPtCallback BreakPointCB; +static GXBreakPtCallback BreakPointCB; __GXFifoObj CPUFifo; __GXFifoObj GPFifo; -void* __GXCurrentBP; -u32 __GXOverflowCount; +void* __GXCurrentBP; +u32 __GXOverflowCount; static GXBool GPFifoReady; static GXBool CPUFifoReady; @@ -92,7 +92,7 @@ void GXCPInterruptHandler(__OSInterrupt interrupt, OSContext* context) { } } -void GXInitFifoBase(GXFifoObj *fifo, void *base, u32 size) { +void GXInitFifoBase(GXFifoObj* fifo, void* base, u32 size) { __GXFifoObj* realFifo = (__GXFifoObj*)fifo; realFifo->base = base; @@ -100,7 +100,7 @@ void GXInitFifoBase(GXFifoObj *fifo, void *base, u32 size) { realFifo->size = size; realFifo->count = 0; - GXInitFifoLimits(fifo, size - (16 * 1024), OSRoundDown32B(size/2)); + GXInitFifoLimits(fifo, size - (16 * 1024), OSRoundDown32B(size / 2)); GXInitFifoPtrs(fifo, base, base); } @@ -152,7 +152,7 @@ GXBool CPGPLinkCheck() { return GX_TRUE; } - + range1 = (s32)((u8*)CPUFifo.top - (u8*)GPFifo.base); range2 = (s32)((u8*)GPFifo.top - (u8*)CPUFifo.base); overlap = ((range1 > 0) && (range2 > 0) || (range1 < 0 && (range2 < 0))); @@ -187,7 +187,7 @@ void GXSetCPUFifo(GXFifoObj* fifo) { CPUFifo.bind_gp = GX_TRUE; reg = 0; - + GX_SET_PI_REG(3, (u32)CPUFifo.base & 0x3FFFFFFF); GX_SET_PI_REG(4, (u32)CPUFifo.top & 0x3FFFFFFF); @@ -198,8 +198,7 @@ void GXSetCPUFifo(GXFifoObj* fifo) { __GXWriteFifoIntReset(GX_TRUE, GX_TRUE); __GXWriteFifoIntEnable(GX_TRUE, GX_FALSE); __GXFifoLink(GX_TRUE); - } - else { + } else { CPUFifo.bind_gp = GX_FALSE; if (CPGPLinked) { @@ -207,7 +206,7 @@ void GXSetCPUFifo(GXFifoObj* fifo) { CPGPLinked = GX_FALSE; } - __GXWriteFifoIntEnable (GX_FALSE, GX_FALSE); + __GXWriteFifoIntEnable(GX_FALSE, GX_FALSE); reg = 0; @@ -239,7 +238,7 @@ void GXSetGPFifo(GXFifoObj* fifo) { OSRestoreInterrupts(enabled); return; } - + GPFifo = *realFifo; GPFifoReady = GX_TRUE; GPFifo.bind_gp = GX_TRUE; @@ -266,8 +265,7 @@ void GXSetGPFifo(GXFifoObj* fifo) { GPFifo.bind_cpu = GX_TRUE; __GXWriteFifoIntEnable(1, 0); __GXFifoLink(1); - } - else { + } else { CPGPLinked = GX_FALSE; GPFifo.bind_cpu = GX_FALSE; __GXWriteFifoIntEnable(0, 0); @@ -285,17 +283,19 @@ void GXSetGPFifo(GXFifoObj* fifo) { OSRestoreInterrupts(enabled); } -#define SOME_MACRO1(fifo) { \ - u32 temp = GX_GET_CP_REG(29) << 16; \ - temp |= GX_GET_CP_REG(28); \ - fifo.rdPtr = OSPhysicalToCached(temp); \ -} +#define SOME_MACRO1(fifo) \ + { \ + u32 temp = GX_GET_CP_REG(29) << 16; \ + temp |= GX_GET_CP_REG(28); \ + fifo.rdPtr = OSPhysicalToCached(temp); \ + } -#define SOME_MACRO2(fifo) { \ - u32 temp = GX_GET_CP_REG(25) << 16; \ - temp |= GX_GET_CP_REG(24); \ - fifo.count = temp; \ -} +#define SOME_MACRO2(fifo) \ + { \ + u32 temp = GX_GET_CP_REG(25) << 16; \ + temp |= GX_GET_CP_REG(24); \ + fifo.count = temp; \ + } static void __GXSaveFifoCPStat() { u32 cpStatus; @@ -308,7 +308,7 @@ static void __GXSaveFifoCPStat() { static void __GXSaveFifoPIStat() { u32 reg = GX_GET_PI_REG(5); CPUFifo.wrPtr = OSPhysicalToCached(reg & 0x1FFFFFE0); - CPUFifo.wrap = (reg & 0x20000000) ? GX_TRUE : GX_FALSE; + CPUFifo.wrap = (reg & 0x20000000) ? GX_TRUE : GX_FALSE; } static void __GXSaveFifo() { @@ -327,9 +327,8 @@ static void __GXSaveFifo() { CPUFifo.count = GPFifo.count; GPFifo.wrPtr = CPUFifo.wrPtr; GPFifo.wrap = CPUFifo.wrap; - } - else if (CPUFifoReady) { - CPUFifo.count = (s32)CPUFifo.wrPtr - (s32)CPUFifo.rdPtr; + } else if (CPUFifoReady) { + CPUFifo.count = (s32)CPUFifo.wrPtr - (s32)CPUFifo.rdPtr; if (CPUFifo.count < 0) { CPUFifo.count += CPUFifo.size; } @@ -344,14 +343,14 @@ GXBool __GXIsGPFifoReady() { void GXGetGPStatus(GXBool* overhi, GXBool* underlow, GXBool* readIdle, GXBool* cmdIdle, GXBool* brkpt) { __GXData->cpStatus = GX_GET_CP_REG(0); - *overhi = GET_REG_FIELD(__GXData->cpStatus, 1, 0); + *overhi = GET_REG_FIELD(__GXData->cpStatus, 1, 0); *underlow = (int)GET_REG_FIELD(__GXData->cpStatus, 1, 1); *readIdle = (int)GET_REG_FIELD(__GXData->cpStatus, 1, 2); - *cmdIdle = (int)GET_REG_FIELD(__GXData->cpStatus, 1, 3); - *brkpt = (int)GET_REG_FIELD(__GXData->cpStatus, 1, 4); + *cmdIdle = (int)GET_REG_FIELD(__GXData->cpStatus, 1, 3); + *brkpt = (int)GET_REG_FIELD(__GXData->cpStatus, 1, 4); } -GXBool GXGetCPUFifo(GXFifoObj *fifo) { +GXBool GXGetCPUFifo(GXFifoObj* fifo) { __GXFifoObj* realFifo = (__GXFifoObj*)fifo; if (!CPUFifoReady) { return GX_FALSE; @@ -375,7 +374,7 @@ u32 GXGetFifoCount(const GXFifoObj* fifo) { } GXBool GXGetFifoWrap(const GXFifoObj* fifo) { - __GXFifoObj* realFifo = (__GXFifoObj*) fifo; + __GXFifoObj* realFifo = (__GXFifoObj*)fifo; return realFifo->wrap; } @@ -399,7 +398,7 @@ void __GXFifoInit() { memset(&GPFifo, 0, sizeof(__GXFifoObj)); CPUFifoReady = GX_FALSE; - GPFifoReady = GX_FALSE; + GPFifoReady = GX_FALSE; } void __GXCleanGPFifo() { @@ -417,9 +416,9 @@ void __GXCleanGPFifo() { GX_SET_CP_REG(24, GPFifo.count); GX_SET_CP_REG(26, (u32)GPFifo.wrPtr & 0x3FFFFFFF); GX_SET_CP_REG(28, (u32)GPFifo.rdPtr & 0x3FFFFFFF); - GX_SET_CP_REG(25, GPFifo.count>>16); - GX_SET_CP_REG(27, ((u32)GPFifo.wrPtr & 0x3FFFFFFF)>>16); - GX_SET_CP_REG(29, ((u32)GPFifo.rdPtr & 0x3FFFFFFF)>>16); + GX_SET_CP_REG(25, GPFifo.count >> 16); + GX_SET_CP_REG(27, ((u32)GPFifo.wrPtr & 0x3FFFFFFF) >> 16); + GX_SET_CP_REG(29, ((u32)GPFifo.rdPtr & 0x3FFFFFFF) >> 16); PPCSync(); diff --git a/libs/RVL_SDK/src/gx/GXFrameBuf.c b/libs/RVL_SDK/src/gx/GXFrameBuf.c index c6a8c31d..4ca3b695 100644 --- a/libs/RVL_SDK/src/gx/GXFrameBuf.c +++ b/libs/RVL_SDK/src/gx/GXFrameBuf.c @@ -1,51 +1,47 @@ #include #include -#include #include +#include #include #include GXRenderModeObj GXNtsc480IntDf = { - 0, 640, 480, 480, 40, 0, 640, 480, 1, 0, 0, { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }, { 8, 8, 10, 12, 10, 8, 8 } -}; + 0, 640, 480, 480, 40, 0, 640, 480, 1, 0, 0, {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, {8, 8, 10, 12, 10, 8, 8}}; GXRenderModeObj GXMpal480IntDf = { - 8, 640, 480, 480, 40, 0, 640, 480, 1, 0, 0, { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }, { 8, 8, 10, 12, 10, 8, 8 } -}; + 8, 640, 480, 480, 40, 0, 640, 480, 1, 0, 0, {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, {8, 8, 10, 12, 10, 8, 8}}; GXRenderModeObj GXPal528IntDf = { - 4, 640, 528, 528, 40, 23, 640, 528, 1, 0, 0, { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }, { 8, 8, 10, 12, 10, 8, 8 } -}; + 4, 640, 528, 528, 40, 23, 640, 528, 1, 0, 0, {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, {8, 8, 10, 12, 10, 8, 8}}; GXRenderModeObj GXEurgb60Hz480IntDf = { - 20, 640, 480, 480, 40, 0, 640, 480, 1, 0, 0, { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }, { 8, 8, 10, 12, 10, 8, 8 } -}; + 20, 640, 480, 480, 40, 0, 640, 480, 1, 0, 0, {6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, {8, 8, 10, 12, 10, 8, 8}}; void GXSetDispCopySrc(u16 left, u16 top, u16 wd, u16 ht) { __GXData->cpDispSrc = 0; - SET_REG_FIELD(__GXData->cpDispSrc, 10, 0, left); + SET_REG_FIELD(__GXData->cpDispSrc, 10, 0, left); SET_REG_FIELD(__GXData->cpDispSrc, 10, 10, top); - SET_REG_FIELD(__GXData->cpDispSrc, 8, 24, 0x49); + SET_REG_FIELD(__GXData->cpDispSrc, 8, 24, 0x49); __GXData->cpDispSize = 0; - SET_REG_FIELD(__GXData->cpDispSize, 10, 0, wd - 1); + SET_REG_FIELD(__GXData->cpDispSize, 10, 0, wd - 1); SET_REG_FIELD(__GXData->cpDispSize, 10, 10, ht - 1); - SET_REG_FIELD(__GXData->cpDispSize, 8, 24, 0x4A); + SET_REG_FIELD(__GXData->cpDispSize, 8, 24, 0x4A); } void GXSetTexCopySrc(u16 left, u16 top, u16 wd, u16 ht) { __GXData->cpTexSrc = 0; - SET_REG_FIELD(__GXData->cpTexSrc, 10, 0, left); + SET_REG_FIELD(__GXData->cpTexSrc, 10, 0, left); SET_REG_FIELD(__GXData->cpTexSrc, 10, 10, top); - SET_REG_FIELD(__GXData->cpTexSrc, 8, 24, 0x49); + SET_REG_FIELD(__GXData->cpTexSrc, 8, 24, 0x49); __GXData->cpTexSize = 0; - SET_REG_FIELD(__GXData->cpTexSize, 10, 0, wd - 1); + SET_REG_FIELD(__GXData->cpTexSize, 10, 0, wd - 1); SET_REG_FIELD(__GXData->cpTexSize, 10, 10, ht - 1); - SET_REG_FIELD(__GXData->cpTexSize, 8, 24, 0x4A); + SET_REG_FIELD(__GXData->cpTexSize, 8, 24, 0x4A); } void GXSetDispCopyDst(u16 wd, u16 ht) { @@ -53,8 +49,8 @@ void GXSetDispCopyDst(u16 wd, u16 ht) { stride = (int)wd * 2; __GXData->cpDispStride = 0; - SET_REG_FIELD(__GXData->cpDispStride, 10, 0, (stride >> 5) ); - SET_REG_FIELD(__GXData->cpDispStride, 8, 24, 0x4D); + SET_REG_FIELD(__GXData->cpDispStride, 10, 0, (stride >> 5)); + SET_REG_FIELD(__GXData->cpDispStride, 8, 24, 0x4D); } void GXSetTexCopyDst(u16 wd, u16 ht, GXTexFmt fmt, GXBool mipmap) { @@ -94,8 +90,8 @@ void GXSetTexCopyDst(u16 wd, u16 ht, GXTexFmt fmt, GXBool mipmap) { __GetImageTileCount(fmt, wd, ht, &rowTiles, &colTiles, &cmpTiles); __GXData->cpTexStride = 0; - SET_REG_FIELD(__GXData->cpTexStride, 10, 0, rowTiles * cmpTiles); - SET_REG_FIELD(__GXData->cpTexStride, 8, 24, 0x4D); + SET_REG_FIELD(__GXData->cpTexStride, 10, 0, rowTiles * cmpTiles); + SET_REG_FIELD(__GXData->cpTexStride, 8, 24, 0x4D); SET_REG_FIELD(__GXData->cpTex, 1, 9, mipmap); SET_REG_FIELD(__GXData->cpTex, 3, 4, peTexFmt); } @@ -178,7 +174,7 @@ u32 GXSetDispCopyYScale(f32 vscale) { u32 ht; u32 reg; - iScale = (u32) (256.0f / vscale) & 0x1FF; + iScale = (u32)(256.0f / vscale) & 0x1FF; enable = (iScale != 256); reg = 0; @@ -220,42 +216,41 @@ void GXSetCopyFilter(GXBool aa, const u8 sample_pattern[12][2], GXBool vf, const if (aa != 0) { msLoc[0] = 0; - SET_REG_FIELD(msLoc[0], 4, 0, sample_pattern[0][0]); - SET_REG_FIELD(msLoc[0], 4, 4, sample_pattern[0][1]); - SET_REG_FIELD(msLoc[0], 4, 8, sample_pattern[1][0]); + SET_REG_FIELD(msLoc[0], 4, 0, sample_pattern[0][0]); + SET_REG_FIELD(msLoc[0], 4, 4, sample_pattern[0][1]); + SET_REG_FIELD(msLoc[0], 4, 8, sample_pattern[1][0]); SET_REG_FIELD(msLoc[0], 4, 12, sample_pattern[1][1]); SET_REG_FIELD(msLoc[0], 4, 16, sample_pattern[2][0]); SET_REG_FIELD(msLoc[0], 4, 20, sample_pattern[2][1]); SET_REG_FIELD(msLoc[0], 8, 24, 1); msLoc[1] = 0; - SET_REG_FIELD(msLoc[1], 4, 0, sample_pattern[3][0]); - SET_REG_FIELD(msLoc[1], 4, 4, sample_pattern[3][1]); - SET_REG_FIELD(msLoc[1], 4, 8, sample_pattern[4][0]); + SET_REG_FIELD(msLoc[1], 4, 0, sample_pattern[3][0]); + SET_REG_FIELD(msLoc[1], 4, 4, sample_pattern[3][1]); + SET_REG_FIELD(msLoc[1], 4, 8, sample_pattern[4][0]); SET_REG_FIELD(msLoc[1], 4, 12, sample_pattern[4][1]); SET_REG_FIELD(msLoc[1], 4, 16, sample_pattern[5][0]); SET_REG_FIELD(msLoc[1], 4, 20, sample_pattern[5][1]); SET_REG_FIELD(msLoc[1], 8, 24, 2); msLoc[2] = 0; - SET_REG_FIELD(msLoc[2], 4, 0, sample_pattern[6][0]); - SET_REG_FIELD(msLoc[2], 4, 4, sample_pattern[6][1]); - SET_REG_FIELD(msLoc[2], 4, 8, sample_pattern[7][0]); + SET_REG_FIELD(msLoc[2], 4, 0, sample_pattern[6][0]); + SET_REG_FIELD(msLoc[2], 4, 4, sample_pattern[6][1]); + SET_REG_FIELD(msLoc[2], 4, 8, sample_pattern[7][0]); SET_REG_FIELD(msLoc[2], 4, 12, sample_pattern[7][1]); SET_REG_FIELD(msLoc[2], 4, 16, sample_pattern[8][0]); SET_REG_FIELD(msLoc[2], 4, 20, sample_pattern[8][1]); SET_REG_FIELD(msLoc[2], 8, 24, 3); msLoc[3] = 0; - SET_REG_FIELD(msLoc[3], 4, 0, sample_pattern[9][0]); - SET_REG_FIELD(msLoc[3], 4, 4, sample_pattern[9][1]); - SET_REG_FIELD(msLoc[3], 4, 8, sample_pattern[10][0]); + SET_REG_FIELD(msLoc[3], 4, 0, sample_pattern[9][0]); + SET_REG_FIELD(msLoc[3], 4, 4, sample_pattern[9][1]); + SET_REG_FIELD(msLoc[3], 4, 8, sample_pattern[10][0]); SET_REG_FIELD(msLoc[3], 4, 12, sample_pattern[10][1]); SET_REG_FIELD(msLoc[3], 4, 16, sample_pattern[11][0]); SET_REG_FIELD(msLoc[3], 4, 20, sample_pattern[11][1]); SET_REG_FIELD(msLoc[3], 8, 24, 4); - } - else { + } else { msLoc[0] = 0x01666666; msLoc[1] = 0x02666666; msLoc[2] = 0x03666666; @@ -273,22 +268,21 @@ void GXSetCopyFilter(GXBool aa, const u8 sample_pattern[12][2], GXBool vf, const SET_REG_FIELD(coeff1, 8, 24, 0x54); if (vf != 0) { - SET_REG_FIELD(coeff0, 6, 0, vfilter[0]); - SET_REG_FIELD(coeff0, 6, 6, vfilter[1]); + SET_REG_FIELD(coeff0, 6, 0, vfilter[0]); + SET_REG_FIELD(coeff0, 6, 6, vfilter[1]); SET_REG_FIELD(coeff0, 6, 12, vfilter[2]); SET_REG_FIELD(coeff0, 6, 18, vfilter[3]); - SET_REG_FIELD(coeff1, 6, 0, vfilter[4]); - SET_REG_FIELD(coeff1, 6, 6, vfilter[5]); + SET_REG_FIELD(coeff1, 6, 0, vfilter[4]); + SET_REG_FIELD(coeff1, 6, 6, vfilter[5]); SET_REG_FIELD(coeff1, 6, 12, vfilter[6]); - } - else { - SET_REG_FIELD(coeff0, 6, 0, 0); - SET_REG_FIELD(coeff0, 6, 6, 0); + } else { + SET_REG_FIELD(coeff0, 6, 0, 0); + SET_REG_FIELD(coeff0, 6, 6, 0); SET_REG_FIELD(coeff0, 6, 12, 21); SET_REG_FIELD(coeff0, 6, 18, 22); - SET_REG_FIELD(coeff1, 6, 0, 21); - SET_REG_FIELD(coeff1, 6, 6, 0); - SET_REG_FIELD(coeff1, 6, 12, 0); + SET_REG_FIELD(coeff1, 6, 0, 21); + SET_REG_FIELD(coeff1, 6, 6, 0); + SET_REG_FIELD(coeff1, 6, 12, 0); } GX_WRITE_RAS_REG(coeff0); @@ -381,7 +375,7 @@ void GXCopyTex(void* dest, GXBool clear) { SET_REG_FIELD(tempPeCtrl, 3, 0, 3); } - if ((clear || ((u32) (tempPeCtrl & 7) == 3)) && ((u32) ((tempPeCtrl >> 6) & 1) == 1)) { + if ((clear || ((u32)(tempPeCtrl & 7) == 3)) && ((u32)((tempPeCtrl >> 6) & 1) == 1)) { changePeCtrl = 1; SET_REG_FIELD(tempPeCtrl, 1, 6, 0); } diff --git a/libs/RVL_SDK/src/gx/GXGeometry.c b/libs/RVL_SDK/src/gx/GXGeometry.c index f0b0ce65..dc188946 100644 --- a/libs/RVL_SDK/src/gx/GXGeometry.c +++ b/libs/RVL_SDK/src/gx/GXGeometry.c @@ -1,8 +1,8 @@ #include #include -#include #include +#include #include @@ -15,7 +15,7 @@ inline void __GXSetAmbMat(u32 amState) { if (amState & 0x100) { GX_WRITE_XF_REG(0x100A, __GXData->ambColor[0]); } - + if (amState & 0x200) { GX_WRITE_XF_REG(0x100B, __GXData->ambColor[1]); } @@ -23,7 +23,7 @@ inline void __GXSetAmbMat(u32 amState) { if (amState & 0x400) { GX_WRITE_XF_REG(0x100C, __GXData->matColor[0]); } - + if (amState & 0x800) { GX_WRITE_XF_REG(0x100D, __GXData->matColor[1]); } @@ -104,14 +104,14 @@ void __GXSetDirtyState() { if (dStateLocal) { __GXSetAmbMat(dStateLocal); } - - dStateLocal = dState & (0x01000000|0x0000F000); + + dStateLocal = dState & (0x01000000 | 0x0000F000); if (dStateLocal) { __GXSetLightChan(dStateLocal); } - dStateLocal = dState & (0x02000000|0x00FF0000); + dStateLocal = dState & (0x02000000 | 0x00FF0000); if (dStateLocal) { __GXSetTexGen(dStateLocal); @@ -131,7 +131,7 @@ void __GXSetDirtyState() { dStateLocal = dState & 0x8000000; if (dStateLocal) { __GXSetProjection(); - } + } __GXData->bpSentNot = GX_TRUE; } @@ -187,7 +187,7 @@ void GXEnableTexOffsets(GXTexCoordID coord, u8 line_enable, u8 point_enable) { } void GXSetCullMode(GXCullMode mode) { - GXCullMode hwMode = (GXCullMode)(((mode & 0x1)<<1) | ((mode & 0x2)>>1)); + GXCullMode hwMode = (GXCullMode)(((mode & 0x1) << 1) | ((mode & 0x2) >> 1)); SET_REG_FIELD(__GXData->genMode, 2, 14, hwMode); __GXData->dirtyState |= 4; diff --git a/libs/RVL_SDK/src/gx/GXInit.c b/libs/RVL_SDK/src/gx/GXInit.c index 0293904c..eab27c21 100644 --- a/libs/RVL_SDK/src/gx/GXInit.c +++ b/libs/RVL_SDK/src/gx/GXInit.c @@ -1,8 +1,8 @@ -#include #include +#include -#include #include +#include #include @@ -29,8 +29,7 @@ void* __cpReg; void* __piReg; static u16 DefaultTexData[] ALIGN32 = { - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, }; static GXVtxAttrFmtList GXDefaultVATList[] = { @@ -52,11 +51,9 @@ static GXVtxAttrFmtList GXDefaultVATList[] = { static f32 GXDefaultProjData[] = {1.0f, 0.0f, 1.0f, 0.0f, -1.0f, -2.0f, 0.0f}; static u32 GXTexRegionAddrTable[] = { - 0x00000, 0x10000, 0x20000, 0x30000, 0x40000, 0x50000, 0x60000, 0x70000, 0x08000, 0x18000, - 0x28000, 0x38000, 0x48000, 0x58000, 0x68000, 0x78000, 0x00000, 0x90000, 0x20000, 0xB0000, - 0x40000, 0x98000, 0x60000, 0xB8000, 0x80000, 0x10000, 0xA0000, 0x30000, 0x88000, 0x50000, - 0xA8000, 0x70000, 0x00000, 0x90000, 0x20000, 0xB0000, 0x40000, 0x90000, 0x60000, 0xB0000, - 0x80000, 0x10000, 0xA0000, 0x30000, 0x80000, 0x50000, 0xA0000, 0x70000, + 0x00000, 0x10000, 0x20000, 0x30000, 0x40000, 0x50000, 0x60000, 0x70000, 0x08000, 0x18000, 0x28000, 0x38000, 0x48000, 0x58000, 0x68000, 0x78000, + 0x00000, 0x90000, 0x20000, 0xB0000, 0x40000, 0x98000, 0x60000, 0xB8000, 0x80000, 0x10000, 0xA0000, 0x30000, 0x88000, 0x50000, 0xA8000, 0x70000, + 0x00000, 0x90000, 0x20000, 0xB0000, 0x40000, 0x90000, 0x60000, 0xB0000, 0x80000, 0x10000, 0xA0000, 0x30000, 0x80000, 0x50000, 0xA0000, 0x70000, }; static BOOL __GXShutdown(BOOL final, u32 event); @@ -78,7 +75,7 @@ static void DisableWriteGatherPipe() { PPCMthid2(hid2); } -static GXTexRegion*__GXDefaultTexRegionCallback(const GXTexObj* t_obj, GXTexMapID id) { +static GXTexRegion* __GXDefaultTexRegionCallback(const GXTexObj* t_obj, GXTexMapID id) { GXTexFmt fmt; u8 mm; @@ -139,8 +136,7 @@ static BOOL __GXShutdown(BOOL final, u32 event) { time = timeNew; return FALSE; } - } - else { + } else { GXSetBreakPtCallback(NULL); GXSetDrawSyncCallback(NULL); GXSetDrawDoneCallback(NULL); @@ -223,7 +219,7 @@ GXFifoObj* GXInit(void* base, u32 size) { __GXData->abtWaitPECopy = 1; __GXData->tcsManEnab = FALSE; __GXData->tevTcEnab = FALSE; - + GXSetMisc(GX_MT_XF_FLUSH, 0); __piReg = OSPhysicalToUncached(0xC003000); @@ -296,12 +292,12 @@ GXFifoObj* GXInit(void* base, u32 size) { __GXInitRevisionBits(); for (i = 0; i < 8; i++) { - GXInitTexCacheRegion(&__GXData->TexRegions0[i], GX_FALSE, GXTexRegionAddrTable[i], - GX_TEXCACHE_32K, GXTexRegionAddrTable[i + 8], GX_TEXCACHE_32K); - GXInitTexCacheRegion(&__GXData->TexRegions1[i], GX_FALSE, GXTexRegionAddrTable[i + 16], - GX_TEXCACHE_32K, GXTexRegionAddrTable[i + 24], GX_TEXCACHE_32K); - GXInitTexCacheRegion(&__GXData->TexRegions2[i], GX_TRUE, GXTexRegionAddrTable[i + 32], - GX_TEXCACHE_32K, GXTexRegionAddrTable[i + 40], GX_TEXCACHE_32K); + GXInitTexCacheRegion(&__GXData->TexRegions0[i], GX_FALSE, GXTexRegionAddrTable[i], GX_TEXCACHE_32K, GXTexRegionAddrTable[i + 8], + GX_TEXCACHE_32K); + GXInitTexCacheRegion(&__GXData->TexRegions1[i], GX_FALSE, GXTexRegionAddrTable[i + 16], GX_TEXCACHE_32K, GXTexRegionAddrTable[i + 24], + GX_TEXCACHE_32K); + GXInitTexCacheRegion(&__GXData->TexRegions2[i], GX_TRUE, GXTexRegionAddrTable[i + 32], GX_TEXCACHE_32K, GXTexRegionAddrTable[i + 40], + GX_TEXCACHE_32K); } for (i = 0; i < 16; i++) { @@ -321,10 +317,10 @@ GXFifoObj* GXInit(void* base, u32 size) { GX_WRITE_U8(0x8); GX_WRITE_U8(0x20); GX_WRITE_U32(__GXData->perfSel); - + reg = 0; GX_WRITE_XF_REG(0x1006, reg); - + reg = 0x23000000; GX_WRITE_RAS_REG(reg); @@ -343,9 +339,9 @@ GXFifoObj* GXInit(void* base, u32 size) { } void __GXInitGX() { - GXRenderModeObj* rmode; - GXTexObj tex_obj; - Mtx identity_mtx; + GXRenderModeObj* rmode; + GXTexObj tex_obj; + Mtx identity_mtx; GXColor clear = {64, 64, 64, 255}; GXColor black = {0, 0, 0, 0}; @@ -507,8 +503,7 @@ void __GXInitGX() { GXSetDstAlpha(GX_DISABLE, 0); GXSetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR); GXSetFieldMask(GX_ENABLE, GX_ENABLE); - GXSetFieldMode(rmode->field_rendering, - ((rmode->viHeight == 2 * rmode->xfbHeight) ? GX_ENABLE : GX_DISABLE)); + GXSetFieldMode(rmode->field_rendering, ((rmode->viHeight == 2 * rmode->xfbHeight) ? GX_ENABLE : GX_DISABLE)); GXSetDispCopySrc(0, 0, rmode->fbWidth, rmode->efbHeight); GXSetDispCopyDst(rmode->fbWidth, rmode->efbHeight); diff --git a/libs/RVL_SDK/src/gx/GXLight.c b/libs/RVL_SDK/src/gx/GXLight.c index b18a96b8..916a4f68 100644 --- a/libs/RVL_SDK/src/gx/GXLight.c +++ b/libs/RVL_SDK/src/gx/GXLight.c @@ -1,8 +1,9 @@ #include #include -#include #include +#include + #include @@ -14,6 +15,7 @@ inline void PushLight(const register GXLightObj* lt_obj, register void* dest) { register u32 zero, color; register f32 a0_a1, a2_k0, k1_k2; register f32 px_py, pz_dx, dy_dz; + // clang-format off #ifdef __MWERKS__ asm volatile { lwz color, 12(lt_obj) @@ -38,6 +40,7 @@ inline void PushLight(const register GXLightObj* lt_obj, register void* dest) { psq_st dy_dz, 0(dest), 0, 0 } #endif + // clang-format on } void GXInitLightPos(GXLightObj* lt_obj, f32 x, f32 y, f32 z) { @@ -190,7 +193,7 @@ void GXSetChanCtrl(GXChannelID chan, GXBool enable, GXColorSrc amb_src, GXColorS SET_REG_FIELD(reg, 1, 1, enable); SET_REG_FIELD(reg, 1, 0, mat_src); SET_REG_FIELD(reg, 1, 6, amb_src); - + SET_REG_FIELD(reg, 2, 7, (attn_fn == GX_AF_SPEC) ? GX_DF_NONE : diff_fn); SET_REG_FIELD(reg, 1, 9, (attn_fn != GX_AF_NONE)); SET_REG_FIELD(reg, 1, 10, (attn_fn != GX_AF_SPEC)); @@ -203,12 +206,11 @@ void GXSetChanCtrl(GXChannelID chan, GXBool enable, GXColorSrc amb_src, GXColorS if (chan == GX_COLOR0A0) { __GXData->chanCtrl[GX_ALPHA0] = reg; - __GXData->dirtyState |= (1<<12); - __GXData->dirtyState |= (1<<14); - } - else if (chan == GX_COLOR1A1) { + __GXData->dirtyState |= (1 << 12); + __GXData->dirtyState |= (1 << 14); + } else if (chan == GX_COLOR1A1) { __GXData->chanCtrl[GX_ALPHA1] = reg; - __GXData->dirtyState |= (1<<13); - __GXData->dirtyState |= (1<<15); + __GXData->dirtyState |= (1 << 13); + __GXData->dirtyState |= (1 << 15); } } diff --git a/libs/RVL_SDK/src/gx/GXMisc.c b/libs/RVL_SDK/src/gx/GXMisc.c index 48bbe111..de1ac3d0 100644 --- a/libs/RVL_SDK/src/gx/GXMisc.c +++ b/libs/RVL_SDK/src/gx/GXMisc.c @@ -1,20 +1,20 @@ #include #include -#include #include +#include + #include #include -static GXDrawSyncCallback TokenCB; -static GXDrawDoneCallback DrawDoneCB; +static GXDrawSyncCallback TokenCB; +static GXDrawDoneCallback DrawDoneCB; -static u8 DrawDone; - -static OSThreadQueue FinishQueue; +static u8 DrawDone; +static OSThreadQueue FinishQueue; void GXSetMisc(GXMiscToken token, u32 val) { switch (token) { @@ -49,7 +49,7 @@ void GXFlush() { if (__GXData->dirtyState) { __GXSetDirtyState(); } - + GX_WRITE_U32(0); GX_WRITE_U32(0); GX_WRITE_U32(0); @@ -63,7 +63,8 @@ void GXFlush() { } void GXResetWriteGatherPipe() { - while (PPCMfwpar() & WPAR_BNE) {} + while (PPCMfwpar() & WPAR_BNE) { + } PPCMtwpar(OSUncachedToPhysical((void*)GXFIFO_ADDR)); } diff --git a/libs/RVL_SDK/src/gx/GXPerf.c b/libs/RVL_SDK/src/gx/GXPerf.c index 32adff5c..1dac7afe 100644 --- a/libs/RVL_SDK/src/gx/GXPerf.c +++ b/libs/RVL_SDK/src/gx/GXPerf.c @@ -2,8 +2,8 @@ #include #include -#include #include +#include #include @@ -117,40 +117,176 @@ void GXSetGPMetric(GXPerf0 perf0, GXPerf1 perf1) { reg = 0x273; GX_WRITE_XF_REG(0x1006, reg); break; - case GX_PERF0_CLIP_VTX: { reg = 0x14A; GX_WRITE_XF_REG(0x1006, reg); break; } - case GX_PERF0_CLIP_CLKS: { reg = 0x16B; GX_WRITE_XF_REG(0x1006, reg); break; } - case GX_PERF0_XF_WAIT_IN: { reg = 0x84; GX_WRITE_XF_REG(0x1006, reg); break; } - case GX_PERF0_XF_WAIT_OUT: { reg = 0xC6; GX_WRITE_XF_REG(0x1006, reg); break; } - case GX_PERF0_XF_XFRM_CLKS: { reg = 0x210; GX_WRITE_XF_REG(0x1006, reg); break; } - case GX_PERF0_XF_LIT_CLKS: { reg = 0x252; GX_WRITE_XF_REG(0x1006, reg); break; } - case GX_PERF0_XF_BOT_CLKS: { reg = 0x231; GX_WRITE_XF_REG(0x1006, reg); break; } - case GX_PERF0_XF_REGLD_CLKS: { reg = 0x1AD; GX_WRITE_XF_REG(0x1006, reg); break; } - case GX_PERF0_XF_REGRD_CLKS: { reg = 0x1CE; GX_WRITE_XF_REG(0x1006, reg); break; } - case GX_PERF0_CLOCKS: { reg = 0x21; GX_WRITE_XF_REG(0x1006, reg); break; } - case GX_PERF0_CLIP_RATIO: { reg = 0x153; GX_WRITE_XF_REG(0x1006, reg); break; } - case GX_PERF0_TRIANGLES: { reg = 0x2300AE7F; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_CULLED: { reg = 0x23008E7F; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_PASSED: { reg = 0x23009E7F; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_SCISSORED: { reg = 0x23001E7F; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_0TEX: { reg = 0x2300AC3F; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_1TEX: { reg = 0x2300AC7F; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_2TEX: { reg = 0x2300ACBF; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_3TEX: { reg = 0x2300ACFF; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_4TEX: { reg = 0x2300AD3F; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_5TEX: { reg = 0x2300AD7F; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_6TEX: { reg = 0x2300ADBF; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_7TEX: { reg = 0x2300ADFF; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_8TEX: { reg = 0x2300AE3F; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_0CLR: { reg = 0x2300A27F; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_1CLR: { reg = 0x2300A67F; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_TRIANGLES_2CLR: { reg = 0x2300AA7F; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_QUAD_0CVG: { reg = 0x2402C0C6; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_QUAD_NON0CVG: { reg = 0x2402C16B; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_QUAD_1CVG: { reg = 0x2402C0E7; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_QUAD_2CVG: { reg = 0x2402C108; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_QUAD_3CVG: { reg = 0x2402C129; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_QUAD_4CVG: { reg = 0x2402C14A; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF0_AVG_QUAD_CNT: { reg = 0x2402C1AD; GX_WRITE_RAS_REG(reg); break; } + case GX_PERF0_CLIP_VTX: { + reg = 0x14A; + GX_WRITE_XF_REG(0x1006, reg); + break; + } + case GX_PERF0_CLIP_CLKS: { + reg = 0x16B; + GX_WRITE_XF_REG(0x1006, reg); + break; + } + case GX_PERF0_XF_WAIT_IN: { + reg = 0x84; + GX_WRITE_XF_REG(0x1006, reg); + break; + } + case GX_PERF0_XF_WAIT_OUT: { + reg = 0xC6; + GX_WRITE_XF_REG(0x1006, reg); + break; + } + case GX_PERF0_XF_XFRM_CLKS: { + reg = 0x210; + GX_WRITE_XF_REG(0x1006, reg); + break; + } + case GX_PERF0_XF_LIT_CLKS: { + reg = 0x252; + GX_WRITE_XF_REG(0x1006, reg); + break; + } + case GX_PERF0_XF_BOT_CLKS: { + reg = 0x231; + GX_WRITE_XF_REG(0x1006, reg); + break; + } + case GX_PERF0_XF_REGLD_CLKS: { + reg = 0x1AD; + GX_WRITE_XF_REG(0x1006, reg); + break; + } + case GX_PERF0_XF_REGRD_CLKS: { + reg = 0x1CE; + GX_WRITE_XF_REG(0x1006, reg); + break; + } + case GX_PERF0_CLOCKS: { + reg = 0x21; + GX_WRITE_XF_REG(0x1006, reg); + break; + } + case GX_PERF0_CLIP_RATIO: { + reg = 0x153; + GX_WRITE_XF_REG(0x1006, reg); + break; + } + case GX_PERF0_TRIANGLES: { + reg = 0x2300AE7F; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_CULLED: { + reg = 0x23008E7F; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_PASSED: { + reg = 0x23009E7F; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_SCISSORED: { + reg = 0x23001E7F; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_0TEX: { + reg = 0x2300AC3F; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_1TEX: { + reg = 0x2300AC7F; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_2TEX: { + reg = 0x2300ACBF; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_3TEX: { + reg = 0x2300ACFF; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_4TEX: { + reg = 0x2300AD3F; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_5TEX: { + reg = 0x2300AD7F; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_6TEX: { + reg = 0x2300ADBF; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_7TEX: { + reg = 0x2300ADFF; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_8TEX: { + reg = 0x2300AE3F; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_0CLR: { + reg = 0x2300A27F; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_1CLR: { + reg = 0x2300A67F; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_TRIANGLES_2CLR: { + reg = 0x2300AA7F; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_QUAD_0CVG: { + reg = 0x2402C0C6; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_QUAD_NON0CVG: { + reg = 0x2402C16B; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_QUAD_1CVG: { + reg = 0x2402C0E7; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_QUAD_2CVG: { + reg = 0x2402C108; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_QUAD_3CVG: { + reg = 0x2402C129; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_QUAD_4CVG: { + reg = 0x2402C14A; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF0_AVG_QUAD_CNT: { + reg = 0x2402C1AD; + GX_WRITE_RAS_REG(reg); + break; + } case GX_PERF0_NONE: default: { break; @@ -159,28 +295,116 @@ void GXSetGPMetric(GXPerf0 perf0, GXPerf1 perf1) { __GXData->perf1 = perf1; switch (__GXData->perf1) { - case GX_PERF1_TEXELS: { reg = 0x67000042; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF1_TX_IDLE: { reg = 0x67000084; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF1_TX_REGS: { reg = 0x67000063; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF1_TX_MEMSTALL: { reg = 0x67000129; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF1_TC_MISS: { reg = 0x67000252; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF1_CLOCKS: { reg = 0x67000021; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF1_TC_CHECK1_2: { reg = 0x6700014B; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF1_TC_CHECK3_4: { reg = 0x6700018D; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF1_TC_CHECK5_6: { reg = 0x670001CF; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF1_TC_CHECK7_8: { reg = 0x67000211; GX_WRITE_RAS_REG(reg); break; } - case GX_PERF1_VC_ELEMQ_FULL: { SET_REG_FIELD(__GXData->perfSel, 4, 4, 2); GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); break; } - case GX_PERF1_VC_MISSQ_FULL: { SET_REG_FIELD(__GXData->perfSel, 4, 4, 3); GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); break; } - case GX_PERF1_VC_MEMREQ_FULL: { SET_REG_FIELD(__GXData->perfSel, 4, 4, 4); GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); break; } - case GX_PERF1_VC_STATUS7: { SET_REG_FIELD(__GXData->perfSel, 4, 4, 5); GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); break; } - case GX_PERF1_VC_MISSREP_FULL: { SET_REG_FIELD(__GXData->perfSel, 4, 4, 6); GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); break; } - case GX_PERF1_VC_STREAMBUF_LOW: { SET_REG_FIELD(__GXData->perfSel, 4, 4, 7); GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); break; } - case GX_PERF1_VC_ALL_STALLS: { SET_REG_FIELD(__GXData->perfSel, 4, 4, 9); GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); break; } - case GX_PERF1_VERTICES: { SET_REG_FIELD(__GXData->perfSel, 4, 4, 8); GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); break; } - case GX_PERF1_FIFO_REQ: { reg = 2; GX_SET_CP_REG(3, reg); break; } - case GX_PERF1_CALL_REQ: { reg = 3; GX_SET_CP_REG(3, reg); break; } - case GX_PERF1_VC_MISS_REQ: { reg = 4; GX_SET_CP_REG(3, reg); break; } - case GX_PERF1_CP_ALL_REQ: { reg = 5; GX_SET_CP_REG(3, reg); break; } + case GX_PERF1_TEXELS: { + reg = 0x67000042; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF1_TX_IDLE: { + reg = 0x67000084; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF1_TX_REGS: { + reg = 0x67000063; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF1_TX_MEMSTALL: { + reg = 0x67000129; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF1_TC_MISS: { + reg = 0x67000252; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF1_CLOCKS: { + reg = 0x67000021; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF1_TC_CHECK1_2: { + reg = 0x6700014B; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF1_TC_CHECK3_4: { + reg = 0x6700018D; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF1_TC_CHECK5_6: { + reg = 0x670001CF; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF1_TC_CHECK7_8: { + reg = 0x67000211; + GX_WRITE_RAS_REG(reg); + break; + } + case GX_PERF1_VC_ELEMQ_FULL: { + SET_REG_FIELD(__GXData->perfSel, 4, 4, 2); + GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); + break; + } + case GX_PERF1_VC_MISSQ_FULL: { + SET_REG_FIELD(__GXData->perfSel, 4, 4, 3); + GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); + break; + } + case GX_PERF1_VC_MEMREQ_FULL: { + SET_REG_FIELD(__GXData->perfSel, 4, 4, 4); + GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); + break; + } + case GX_PERF1_VC_STATUS7: { + SET_REG_FIELD(__GXData->perfSel, 4, 4, 5); + GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); + break; + } + case GX_PERF1_VC_MISSREP_FULL: { + SET_REG_FIELD(__GXData->perfSel, 4, 4, 6); + GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); + break; + } + case GX_PERF1_VC_STREAMBUF_LOW: { + SET_REG_FIELD(__GXData->perfSel, 4, 4, 7); + GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); + break; + } + case GX_PERF1_VC_ALL_STALLS: { + SET_REG_FIELD(__GXData->perfSel, 4, 4, 9); + GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); + break; + } + case GX_PERF1_VERTICES: { + SET_REG_FIELD(__GXData->perfSel, 4, 4, 8); + GX_WRITE_SOME_REG4(8, 0x20, __GXData->perfSel, -12); + break; + } + case GX_PERF1_FIFO_REQ: { + reg = 2; + GX_SET_CP_REG(3, reg); + break; + } + case GX_PERF1_CALL_REQ: { + reg = 3; + GX_SET_CP_REG(3, reg); + break; + } + case GX_PERF1_VC_MISS_REQ: { + reg = 4; + GX_SET_CP_REG(3, reg); + break; + } + case GX_PERF1_CP_ALL_REQ: { + reg = 5; + GX_SET_CP_REG(3, reg); + break; + } case GX_PERF1_NONE: default: { break; diff --git a/libs/RVL_SDK/src/gx/GXPixel.c b/libs/RVL_SDK/src/gx/GXPixel.c index 09765e76..ef5cb09e 100644 --- a/libs/RVL_SDK/src/gx/GXPixel.c +++ b/libs/RVL_SDK/src/gx/GXPixel.c @@ -1,8 +1,8 @@ #include #include -#include #include +#include #include @@ -27,25 +27,22 @@ void GXSetFog(GXFogType type, f32 startz, f32 endz, f32 nearz, f32 farz, GXColor fsel = type & 7; proj = (type >> 3) & 1; - + if (proj) { if (farz == nearz || endz == startz) { a = 0.0f; c = 0.0f; - } - else { + } else { A = (1.0f / (endz - startz)); a = A * (farz - nearz); c = A * (startz - nearz); } - } - else { + } else { if (farz == nearz || endz == startz) { A = 0.0f; B = 0.5f; C = 0.0f; - } - else { + } else { A = (farz * nearz) / ((farz - nearz) * (endz - startz)); B = farz / (farz - nearz); C = startz / (endz - startz); @@ -62,7 +59,7 @@ void GXSetFog(GXFogType type, f32 startz, f32 endz, f32 nearz, f32 farz, GXColor B_expn--; } - a = A / (f32) (1 << (B_expn + 1)); + a = A / (f32)(1 << (B_expn + 1)); b_m = 8.388638e6f * B_mant; b_s = B_expn + 1; c = C; @@ -74,8 +71,8 @@ void GXSetFog(GXFogType type, f32 startz, f32 endz, f32 nearz, f32 farz, GXColor SET_REG_FIELD(fog2, 8, 24, 0xF0); } - a_hex = *(u32 *)&a; - c_hex = *(u32 *)&c; + a_hex = *(u32*)&a; + c_hex = *(u32*)&c; SET_REG_FIELD(fog0, 11, 0, (a_hex >> 12) & 0x7FF); SET_REG_FIELD(fog0, 8, 11, (a_hex >> 23) & 0xFF); @@ -103,7 +100,7 @@ void GXSetFog(GXFogType type, f32 startz, f32 endz, f32 nearz, f32 farz, GXColor __GXData->bpSentNot = GX_FALSE; } -void GXSetFogRangeAdj(GXBool enable, u16 center, const GXFogAdjTable *table) { +void GXSetFogRangeAdj(GXBool enable, u16 center, const GXFogAdjTable* table) { u32 i; u32 range_adj; u32 range_c; @@ -189,7 +186,7 @@ void GXSetZCompLoc(GXBool before_tex) { void GXSetPixelFmt(GXPixelFmt pix_fmt, GXZFmt16 z_fmt) { u32 oldPeCtrl; u8 aa; - static u32 p2f[8] = { 0, 1, 2, 3, 4, 4, 4, 5 }; + static u32 p2f[8] = {0, 1, 2, 3, 4, 4, 4, 5}; oldPeCtrl = __GXData->peCtrl; SET_REG_FIELD(__GXData->peCtrl, 3, 0, p2f[pix_fmt]); diff --git a/libs/RVL_SDK/src/gx/GXTev.c b/libs/RVL_SDK/src/gx/GXTev.c index 5a9b939a..c620077b 100644 --- a/libs/RVL_SDK/src/gx/GXTev.c +++ b/libs/RVL_SDK/src/gx/GXTev.c @@ -1,8 +1,8 @@ #include #include -#include #include +#include #include @@ -48,8 +48,7 @@ void GXSetTevOp(GXTevStageID id, GXTevMode mode) { if (id == GX_TEVSTAGE0) { ctmp = (u32*)TEVCOpTableST0 + mode; atmp = (u32*)TEVAOpTableST0 + mode; - } - else { + } else { ctmp = (u32*)TEVCOpTableST1 + mode; atmp = (u32*)TEVAOpTableST1 + mode; } @@ -72,9 +71,9 @@ void GXSetTevColorIn(GXTevStageID stage, GXTevColorArg a, GXTevColorArg b, GXTev tevReg = __GXData->tevc[stage]; SET_REG_FIELD(tevReg, 4, 12, a); - SET_REG_FIELD(tevReg, 4, 8, b); - SET_REG_FIELD(tevReg, 4, 4, c); - SET_REG_FIELD(tevReg, 4, 0, d); + SET_REG_FIELD(tevReg, 4, 8, b); + SET_REG_FIELD(tevReg, 4, 4, c); + SET_REG_FIELD(tevReg, 4, 0, d); GX_WRITE_RAS_REG(tevReg); __GXData->tevc[stage] = tevReg; @@ -87,8 +86,8 @@ void GXSetTevAlphaIn(GXTevStageID stage, GXTevAlphaArg a, GXTevAlphaArg b, GXTev tevReg = __GXData->teva[stage]; SET_REG_FIELD(tevReg, 3, 13, a); SET_REG_FIELD(tevReg, 3, 10, b); - SET_REG_FIELD(tevReg, 3, 7, c); - SET_REG_FIELD(tevReg, 3, 4, d); + SET_REG_FIELD(tevReg, 3, 7, c); + SET_REG_FIELD(tevReg, 3, 4, d); GX_WRITE_RAS_REG(tevReg); __GXData->teva[stage] = tevReg; @@ -103,8 +102,7 @@ void GXSetTevColorOp(GXTevStageID stage, GXTevOp op, GXTevBias bias, GXTevScale if (op <= 1) { SET_REG_FIELD(tevReg, 2, 20, scale); SET_REG_FIELD(tevReg, 2, 16, bias); - } - else { + } else { SET_REG_FIELD(tevReg, 2, 20, (op >> 1) & 3); SET_REG_FIELD(tevReg, 2, 16, 3); } @@ -124,8 +122,7 @@ void GXSetTevAlphaOp(GXTevStageID stage, GXTevOp op, GXTevBias bias, GXTevScale if (op <= 1) { SET_REG_FIELD(tevReg, 2, 20, scale); SET_REG_FIELD(tevReg, 2, 16, bias); - } - else { + } else { SET_REG_FIELD(tevReg, 2, 20, (op >> 1) & 3); SET_REG_FIELD(tevReg, 2, 16, 3); } @@ -170,7 +167,7 @@ void GXSetTevColorS10(GXTevRegID id, GXColorS10 color) { sBA = *((u32*)&color + 1); regRA = (0xE0 + id * 2) << 24; - SET_REG_FIELD(regRA, 11, 0, (sRG >> 16) & 0x7FF); + SET_REG_FIELD(regRA, 11, 0, (sRG >> 16) & 0x7FF); SET_REG_FIELD(regRA, 11, 12, sBA & 0x7FF); regBG = (0xE1 + id * 2) << 24; @@ -213,8 +210,7 @@ void GXSetTevKColorSel(GXTevStageID stage, GXTevKColorSel sel) { Kreg = &__GXData->tevKsel[stage >> 1]; if (stage & 1) { SET_REG_FIELD(*Kreg, 5, 14, sel); - } - else { + } else { SET_REG_FIELD(*Kreg, 5, 4, sel); } @@ -228,8 +224,7 @@ void GXSetTevKAlphaSel(GXTevStageID stage, GXTevKAlphaSel sel) { Kreg = &__GXData->tevKsel[stage >> 1]; if (stage & 1) { SET_REG_FIELD(*Kreg, 5, 19, sel); - } - else { + } else { SET_REG_FIELD(*Kreg, 5, 9, sel); } @@ -323,7 +318,7 @@ void GXSetTevOrder(GXTevStageID stage, GXTexCoordID coord, GXTexMapID map, GXCha u32* ptref; u32 tmap; u32 tcoord; - static int c2r[] = { 0, 1, 0, 1, 0, 1, 7, 5, 6 }; + static int c2r[] = {0, 1, 0, 1, 0, 1, 7, 5, 6}; ptref = &__GXData->tref[stage / 2]; __GXData->texmapId[stage] = map; @@ -334,8 +329,7 @@ void GXSetTevOrder(GXTevStageID stage, GXTexCoordID coord, GXTexMapID map, GXCha if (coord >= GX_MAX_TEXCOORD) { tcoord = GX_TEXCOORD0; __GXData->tevTcEnab = __GXData->tevTcEnab & ~(1 << stage); - } - else { + } else { tcoord = coord; __GXData->tevTcEnab = __GXData->tevTcEnab | (1 << stage); } @@ -345,8 +339,7 @@ void GXSetTevOrder(GXTevStageID stage, GXTexCoordID coord, GXTexMapID map, GXCha SET_REG_FIELD(*ptref, 3, 15, tcoord); SET_REG_FIELD(*ptref, 3, 19, (color == GX_COLOR_NULL) ? 7 : c2r[color]); SET_REG_FIELD(*ptref, 1, 18, (map != GX_TEXMAP_NULL && !(map & GX_TEX_DISABLE))); - } - else { + } else { SET_REG_FIELD(*ptref, 3, 0, tmap); SET_REG_FIELD(*ptref, 3, 3, tcoord); SET_REG_FIELD(*ptref, 3, 7, (color == GX_COLOR_NULL) ? 7 : c2r[color]); diff --git a/libs/RVL_SDK/src/gx/GXTexture.c b/libs/RVL_SDK/src/gx/GXTexture.c index 9088570f..8659ce9a 100644 --- a/libs/RVL_SDK/src/gx/GXTexture.c +++ b/libs/RVL_SDK/src/gx/GXTexture.c @@ -1,8 +1,8 @@ #include #include -#include #include +#include #include @@ -10,15 +10,15 @@ #include -static u8 GXTexMode0Ids[8] = { 0x80, 0x81, 0x82, 0x83, 0xA0, 0xA1, 0xA2, 0xA3 }; -static u8 GXTexMode1Ids[8] = { 0x84, 0x85, 0x86, 0x87, 0xA4, 0xA5, 0xA6, 0xA7 }; -static u8 GXTexImage0Ids[8] = { 0x88, 0x89, 0x8A, 0x8B, 0xA8, 0xA9, 0xAA, 0xAB }; -static u8 GXTexImage1Ids[8] = { 0x8C, 0x8D, 0x8E, 0x8F, 0xAC, 0xAD, 0xAE, 0xAF }; -static u8 GXTexImage2Ids[8] = { 0x90, 0x91, 0x92, 0x93, 0xB0, 0xB1, 0xB2, 0xB3 }; -static u8 GXTexImage3Ids[8] = { 0x94, 0x95, 0x96, 0x97, 0xB4, 0xB5, 0xB6, 0xB7 }; -static u8 GXTexTlutIds[8] = { 0x98, 0x99, 0x9A, 0x9B, 0xB8, 0xB9, 0xBA, 0xBB }; +static u8 GXTexMode0Ids[8] = {0x80, 0x81, 0x82, 0x83, 0xA0, 0xA1, 0xA2, 0xA3}; +static u8 GXTexMode1Ids[8] = {0x84, 0x85, 0x86, 0x87, 0xA4, 0xA5, 0xA6, 0xA7}; +static u8 GXTexImage0Ids[8] = {0x88, 0x89, 0x8A, 0x8B, 0xA8, 0xA9, 0xAA, 0xAB}; +static u8 GXTexImage1Ids[8] = {0x8C, 0x8D, 0x8E, 0x8F, 0xAC, 0xAD, 0xAE, 0xAF}; +static u8 GXTexImage2Ids[8] = {0x90, 0x91, 0x92, 0x93, 0xB0, 0xB1, 0xB2, 0xB3}; +static u8 GXTexImage3Ids[8] = {0x94, 0x95, 0x96, 0x97, 0xB4, 0xB5, 0xB6, 0xB7}; +static u8 GXTexTlutIds[8] = {0x98, 0x99, 0x9A, 0x9B, 0xB8, 0xB9, 0xBA, 0xBB}; -static u8 GX2HWFiltConv[6] = { 0x00, 0x04, 0x01, 0x05, 0x02, 0x06 }; +static u8 GX2HWFiltConv[6] = {0x00, 0x04, 0x01, 0x05, 0x02, 0x06}; static void __GXGetTexTileShift(GXTexFmt fmt, u32* rowTileS, u32* colTileS) { switch (fmt) { @@ -41,10 +41,10 @@ static void __GXGetTexTileShift(GXTexFmt fmt, u32* rowTileS, u32* colTileS) { case GX_CTF_G8: case GX_CTF_B8: case GX_CTF_Z8M: { - case GX_CTF_Z8L: - *rowTileS = 3; - *colTileS = 2; - break; + case GX_CTF_Z8L: + *rowTileS = 3; + *colTileS = 2; + break; } case GX_TF_IA8: case GX_TF_RGB565: @@ -80,8 +80,7 @@ u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, GXBool mipmap, u8 max_ __GXGetTexTileShift(format, &tileShiftX, &tileShiftY); if (format == GX_TF_RGBA8 || format == GX_TF_Z24X8) { tileBytes = 64; - } - else { + } else { tileBytes = 32; } @@ -100,8 +99,7 @@ u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, GXBool mipmap, u8 max_ width = (width > 1) ? width >> 1 : 1; height = (height > 1) ? height >> 1 : 1; } - } - else { + } else { nx = (width + (1 << tileShiftX) - 1) >> tileShiftX; ny = (height + (1 << tileShiftY) - 1) >> tileShiftY; bufferSize = nx * ny * tileBytes; @@ -126,7 +124,8 @@ void __GetImageTileCount(GXTexFmt fmt, u16 wd, u16 ht, u32* rowTiles, u32* colTi *cmpTiles = (fmt == GX_TF_RGBA8 || fmt == GX_TF_Z24X8) ? 2 : 1; } -void GXInitTexObj(const GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t, GXBool mipmap) { +void GXInitTexObj(const GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t, + GXBool mipmap) { u32 imageBase; u32 maxLOD; u16 rowT, colT; @@ -144,23 +143,19 @@ void GXInitTexObj(const GXTexObj* obj, void* image_ptr, u16 width, u16 height, G if (format == 8 || format == 9 || format == 10) { SET_REG_FIELD(t->mode0, 3, 5, 5); - } - else { + } else { SET_REG_FIELD(t->mode0, 3, 5, 6); } - if (width > height) { maxLOD = 31 - __cntlzw(width); - } - else { + } else { maxLOD = 31 - __cntlzw(height); } - + lmax = 16.0f * maxLOD; SET_REG_FIELD(t->mode1, 8, 8, lmax); - } - else { + } else { SET_REG_FIELD(t->mode0, 3, 5, 4); } @@ -222,7 +217,8 @@ void GXInitTexObj(const GXTexObj* obj, void* image_ptr, u16 width, u16 height, G t->flags |= 2; } -void GXInitTexObjCI(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXCITexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t, GXBool mipmap, u32 tlut_name) { +void GXInitTexObjCI(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXCITexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t, + GXBool mipmap, u32 tlut_name) { __GXTexObjInt* t = (__GXTexObjInt*)obj; GXInitTexObj(obj, image_ptr, width, height, format, wrap_s, wrap_t, mipmap); @@ -230,15 +226,15 @@ void GXInitTexObjCI(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXCIT t->tlutName = tlut_name; } -void GXInitTexObjLOD(GXTexObj* obj, GXTexFilter min_filt, GXTexFilter mag_filt, f32 min_lod, f32 max_lod, f32 lod_bias, u8 bias_clamp, u8 do_edge_lod, GXAnisotropy max_aniso) { +void GXInitTexObjLOD(GXTexObj* obj, GXTexFilter min_filt, GXTexFilter mag_filt, f32 min_lod, f32 max_lod, f32 lod_bias, u8 bias_clamp, u8 do_edge_lod, + GXAnisotropy max_aniso) { u8 lbias; u8 lmin, lmax; __GXTexObjInt* t = (__GXTexObjInt*)obj; if (lod_bias < -4.0f) { lod_bias = -4.0f; - } - else if (lod_bias >= 4.0f) { + } else if (lod_bias >= 4.0f) { lod_bias = 3.99f; } @@ -254,16 +250,14 @@ void GXInitTexObjLOD(GXTexObj* obj, GXTexFilter min_filt, GXTexFilter mag_filt, if (min_lod < 0.0f) { min_lod = 0.0f; - } - else if (min_lod > 10.0f) { + } else if (min_lod > 10.0f) { min_lod = 10.0f; } lmin = 16.0f * min_lod; if (max_lod < 0.0f) { max_lod = 0.0f; - } - else if (max_lod > 10.0f) { + } else if (max_lod > 10.0f) { max_lod = 10.0f; } lmax = 16.0f * max_lod; @@ -291,60 +285,60 @@ void GXInitTexObjUserData(const GXTexObj* obj, void* user_data) { } void* GXGetTexObjUserData(const GXTexObj* obj) { - const __GXTexObjInt* t = (const __GXTexObjInt *)obj; + const __GXTexObjInt* t = (const __GXTexObjInt*)obj; return t->userData; } void* GXGetTexObjData(const GXTexObj* to) { - const __GXTexObjInt* t = (const __GXTexObjInt *)to; + const __GXTexObjInt* t = (const __GXTexObjInt*)to; return (void*)(GET_REG_FIELD(t->image3, 21, 0) << 5); } u16 GXGetTexObjWidth(const GXTexObj* to) { - const __GXTexObjInt* t = (const __GXTexObjInt *)to; + const __GXTexObjInt* t = (const __GXTexObjInt*)to; return (u32)GET_REG_FIELD(t->image0, 10, 0) + 1; } u16 GXGetTexObjHeight(const GXTexObj* to) { - const __GXTexObjInt* t = (const __GXTexObjInt *)to; + const __GXTexObjInt* t = (const __GXTexObjInt*)to; return (u32)GET_REG_FIELD(t->image0, 10, 10) + 1; } GXTexFmt GXGetTexObjFmt(const GXTexObj* to) { - const __GXTexObjInt* t = (const __GXTexObjInt *)to; + const __GXTexObjInt* t = (const __GXTexObjInt*)to; return t->fmt; } GXTexWrapMode GXGetTexObjWrapS(const GXTexObj* to) { - const __GXTexObjInt* t = (const __GXTexObjInt *)to; + const __GXTexObjInt* t = (const __GXTexObjInt*)to; return GET_REG_FIELD(t->mode0, 2, 0); } GXTexWrapMode GXGetTexObjWrapT(const GXTexObj* to) { - const __GXTexObjInt* t = (const __GXTexObjInt *)to; + const __GXTexObjInt* t = (const __GXTexObjInt*)to; return GET_REG_FIELD(t->mode0, 2, 2); } GXBool GXGetTexObjMipMap(const GXTexObj* to) { - const __GXTexObjInt* t = (const __GXTexObjInt *)to; + const __GXTexObjInt* t = (const __GXTexObjInt*)to; return (t->flags & 1) == 1; } -void GXLoadTexObjPreLoaded(const GXTexObj *obj, const GXTexRegion *region, GXTexMapID id) { +void GXLoadTexObjPreLoaded(const GXTexObj* obj, const GXTexRegion* region, GXTexMapID id) { __GXTlutRegionInt* tlr; u32 m0, m1; u32 img0, img1, img2, img3; __GXTexObjInt* t = (__GXTexObjInt*)obj; - __GXTexRegionInt* r = (__GXTexRegionInt *)region; + __GXTexRegionInt* r = (__GXTexRegionInt*)region; m0 = t->mode0; m1 = t->mode1; @@ -388,7 +382,7 @@ void GXLoadTexObj(const GXTexObj* obj, GXTexMapID id) { } void GXInitTlutObj(const GXTlutObj* tlut_obj, void* lut, GXTlutFmt fmt, u16 n_entries) { - __GXTlutObjInt* t = (__GXTlutObjInt *)tlut_obj; + __GXTlutObjInt* t = (__GXTlutObjInt*)tlut_obj; t->tlut = 0; SET_REG_FIELD(t->tlut, 2, 10, fmt); @@ -400,9 +394,9 @@ void GXInitTlutObj(const GXTlutObj* tlut_obj, void* lut, GXTlutFmt fmt, u16 n_en void GXLoadTlut(const GXTlutObj* tlut_obj, u32 tlut_name) { __GXTlutRegionInt* r; u32 tlut_offset; - __GXTlutObjInt* t = (__GXTlutObjInt *)tlut_obj; + __GXTlutObjInt* t = (__GXTlutObjInt*)tlut_obj; - r = (__GXTlutRegionInt *)__GXData->tlutRegionCallback(tlut_name); + r = (__GXTlutRegionInt*)__GXData->tlutRegionCallback(tlut_name); __GXFlushTextureState(); GX_WRITE_RAS_REG(t->loadTlut0); @@ -473,7 +467,7 @@ void GXInitTexCacheRegion(GXTexRegion* region, u8 is_32b_mipmap, u32 tmem_even, } void GXInitTlutRegion(GXTlutRegion* region, u32 tmem_addr, GXTlutSize tlut_size) { - __GXTlutRegionInt* t = (__GXTlutRegionInt *)region; + __GXTlutRegionInt* t = (__GXTlutRegionInt*)region; t->loadTlut1 = 0; tmem_addr -= 0x80000; @@ -575,8 +569,7 @@ void __GXSetSUTexRegs() { tmap = map & 0xFFFFFEFF; if (i & 1) { coord = GET_REG_FIELD(*ptref, 3, 15); - } - else { + } else { coord = GET_REG_FIELD(*ptref, 3, 3); } if ((tmap != 0xFF) && !(__GXData->tcsManEnab & (1 << coord)) && (__GXData->tevTcEnab & (1 << i))) { diff --git a/libs/RVL_SDK/src/gx/GXTransform.c b/libs/RVL_SDK/src/gx/GXTransform.c index eadd5f14..6ea7181d 100644 --- a/libs/RVL_SDK/src/gx/GXTransform.c +++ b/libs/RVL_SDK/src/gx/GXTransform.c @@ -2,8 +2,8 @@ #include #include -#include #include +#include #include @@ -14,6 +14,7 @@ static void WriteProjPS(const register f32 proj[6], register volatile void* dest) { register f32 p01, p23, p45; + // clang-format off #ifdef __MWERKS__ asm volatile { psq_l p01, 0(proj), 0, 0 @@ -24,11 +25,13 @@ static void WriteProjPS(const register f32 proj[6], register volatile void* dest psq_st p45, 0(dest), 0, 0 } #endif // __MWERKS__ + // clang-format on } inline void Copy6Floats(const register f32* dst, register const f32* src) { register f32 ps_0, ps_1, ps_2; + // clang-format off #ifdef __MWERKS__ asm volatile { psq_l ps_0, 0(src), 0, 0 @@ -39,6 +42,7 @@ inline void Copy6Floats(const register f32* dst, register const f32* src) { psq_st ps_2, 16(dst), 0, 0 } #endif // __MWERKS__ + // clang-format on } static void WriteMTXPS4x3(const register f32 mtx[3][4], register volatile f32* dest) { @@ -49,6 +53,7 @@ static void WriteMTXPS4x3(const register f32 mtx[3][4], register volatile f32* d register f32 a20_a21; register f32 a22_a23; + // clang-format off #ifdef __MWERKS__ asm volatile { psq_l a00_a01, 0x00(mtx), 0, 0 @@ -65,6 +70,7 @@ static void WriteMTXPS4x3(const register f32 mtx[3][4], register volatile f32* d psq_st a22_a23, 0(dest), 0, 0 } #endif // __MWERKS__ + // clang-format on } static void WriteMTXPS3x3from3x4(register f32 mtx[3][4], register volatile f32* dest) { @@ -75,6 +81,7 @@ static void WriteMTXPS3x3from3x4(register f32 mtx[3][4], register volatile f32* register f32 a20_a21; register f32 a22_a23; + // clang-format off #ifdef __MWERKS__ asm volatile { psq_l a00_a01, 0x00(mtx), 0, 0 @@ -91,6 +98,7 @@ static void WriteMTXPS3x3from3x4(register f32 mtx[3][4], register volatile f32* stfs a22_a23, 0(dest) } #endif // __MWERKS__ + // clang-format on } static void WriteMTXPS4x2(const register f32 mtx[2][4], register volatile f32* dest) { @@ -99,6 +107,7 @@ static void WriteMTXPS4x2(const register f32 mtx[2][4], register volatile f32* d register f32 a10_a11; register f32 a12_a13; + // clang-format off #ifdef __MWERKS__ asm volatile { psq_l a00_a01, 0x00(mtx), 0, 0 @@ -111,6 +120,7 @@ static void WriteMTXPS4x2(const register f32 mtx[2][4], register volatile f32* d psq_st a12_a13, 0(dest), 0, 0 } #endif // __MWERKS__ + // clang-format on } void __GXSetProjection() { @@ -132,8 +142,7 @@ void GXSetProjection(const Mtx44 mtx, GXProjectionType type) { if (type == GX_ORTHOGRAPHIC) { __GXData->projMtx[1] = mtx[0][3]; __GXData->projMtx[3] = mtx[1][3]; - } - else { + } else { __GXData->projMtx[1] = mtx[0][2]; __GXData->projMtx[3] = mtx[1][2]; } @@ -141,7 +150,6 @@ void GXSetProjection(const Mtx44 mtx, GXProjectionType type) { __GXData->dirtyState |= 0x8000000; } - void GXSetProjectionv(const f32* ptr) { __GXData->projType = ptr[0] == 0.0f ? GX_PERSPECTIVE : GX_ORTHOGRAPHIC; Copy6Floats(__GXData->projMtx, &ptr[1]); @@ -192,8 +200,7 @@ void GXLoadTexMtxImm(const f32 mtx[][4], u32 id, GXTexMtxType type) { if (id >= GX_PTTEXMTX0) { addr = (id - GX_PTTEXMTX0) * 4 + 0x500; - } - else { + } else { addr = id * 4; } count = (type == GX_MTX2x4) ? 8 : 12; @@ -204,8 +211,7 @@ void GXLoadTexMtxImm(const f32 mtx[][4], u32 id, GXTexMtxType type) { if (type == GX_MTX3x4) { WriteMTXPS4x3(mtx, &GXWGFifo.f32); - } - else { + } else { WriteMTXPS4x2(mtx, &GXWGFifo.f32); } } @@ -249,7 +255,7 @@ void GXSetViewportJitter(f32 left, f32 top, f32 wd, f32 ht, f32 nearz, f32 farz, __GXData->vpHt = ht; __GXData->vpNearz = nearz; __GXData->vpFarz = farz; - + __GXData->dirtyState |= 0x10000000; } @@ -337,8 +343,7 @@ void __GXSetMatrixIndex(GXAttr matIdxAttr) NO_INLINE { if (matIdxAttr < GX_VA_TEX4MTXIDX) { GX_WRITE_SOME_REG4(8, 0x30, __GXData->matIdxA, -12); GX_WRITE_XF_REG(0x1018, __GXData->matIdxA); - } - else { + } else { GX_WRITE_SOME_REG4(8, 0x40, __GXData->matIdxB, -12); GX_WRITE_XF_REG(0x1019, __GXData->matIdxB); } diff --git a/libs/RVL_SDK/src/ipc/ipcMain.c b/libs/RVL_SDK/src/ipc/ipcMain.c index da8e2f81..a3c10fe6 100644 --- a/libs/RVL_SDK/src/ipc/ipcMain.c +++ b/libs/RVL_SDK/src/ipc/ipcMain.c @@ -4,13 +4,13 @@ #include -static void* IPCBufferHi; -static void* IPCBufferLo; +static void* IPCBufferHi; +static void* IPCBufferLo; -static void* IPCCurrentBufferHi; -static void* IPCCurrentBufferLo; +static void* IPCCurrentBufferHi; +static void* IPCCurrentBufferLo; -static u8 Initialized; +static u8 Initialized; void IPCInit() { if (Initialized) { diff --git a/libs/RVL_SDK/src/ipc/ipcProfile.c b/libs/RVL_SDK/src/ipc/ipcProfile.c index 5f46c585..624f23a3 100644 --- a/libs/RVL_SDK/src/ipc/ipcProfile.c +++ b/libs/RVL_SDK/src/ipc/ipcProfile.c @@ -13,7 +13,7 @@ static u32 IpcReqPtrArray[MAX_REQUEST]; static void AddReqInfo(void* ptr, s32 fd); static void DelReqInfo(void* ptr, s32 fd); -DECOMP_FORCE_ACTIVE(ipcProfile_c, IpcFdArray); // Force `IpcFdArray` to be first +DECOMP_FORCE_ACTIVE(ipcProfile_c, IpcFdArray); // Force `IpcFdArray` to be first void IPCiProfInit() { u32 i; @@ -27,7 +27,7 @@ void IPCiProfInit() { } } -void IPCiProfQueueReq(void *req, s32 fd) { +void IPCiProfQueueReq(void* req, s32 fd) { ++IpcNumPendingReqs; ++IpcNumUnIssuedReqs; AddReqInfo(req, fd); diff --git a/libs/RVL_SDK/src/ipc/ipcclt.c b/libs/RVL_SDK/src/ipc/ipcclt.c index cf05fc16..8ea931df 100644 --- a/libs/RVL_SDK/src/ipc/ipcclt.c +++ b/libs/RVL_SDK/src/ipc/ipcclt.c @@ -4,23 +4,25 @@ #include -#include #include +#include + -#include #include +#include + #define DIFFERENTIATE(a, b) ((a) < (b)) ? ((u32)0xFFFFFFFF - (b) + (a) + 1) : ((a) - (b)) -#define IPC_CLT_HEAP_SIZE 0x1000 +#define IPC_CLT_HEAP_SIZE 0x1000 -static IOSResponseRequest __responses; +static IOSResponseRequest __responses; static s32 __mailboxAck = 1; -static u32 __relnchFl = 0; +static u32 __relnchFl = 0; -static IOSRpcRequest* __relnchRpc = NULL; -static IOSRpcRequest* __relnchRpcSave = NULL; +static IOSRpcRequest* __relnchRpc = NULL; +static IOSRpcRequest* __relnchRpcSave = NULL; u8 __rpcBuf[OSRoundUp32B(sizeof(IOSRpcRequest))] ALIGN32; @@ -62,14 +64,14 @@ static inline void __ipcSendRequest() { __responses.rcount++; __mailboxAck--; - IPC_WRITE_REG(HW_IPC_PPCCTRL, (IPC_READ_REG(HW_IPC_PPCCTRL) & ((1<<5) | (1<<4)) | (1<<0))); + IPC_WRITE_REG(HW_IPC_PPCCTRL, (IPC_READ_REG(HW_IPC_PPCCTRL) & ((1 << 5) | (1 << 4)) | (1 << 0))); } void IpcReplyHandler(__OSInterrupt interrupt, OSContext* context) { - OSContext exceptionContext; + OSContext exceptionContext; IOSResourceRequest* req; - IOSRpcRequest* rep; - u32 addr; + IOSRpcRequest* rep; + u32 addr; addr = IPC_READ_REG(HW_IPC_ARMMSG); @@ -78,8 +80,8 @@ void IpcReplyHandler(__OSInterrupt interrupt, OSContext* context) { } rep = (IOSRpcRequest*)OSPhysicalToCached(addr); - IPC_WRITE_REG(HW_IPC_PPCCTRL, (IPC_READ_REG(HW_IPC_PPCCTRL) & ((1<<5) | (1<<4)) | (1<<2))); - ACR_WRITE_REG32(HW_PPCIRQFLAG, (1<<30)); + IPC_WRITE_REG(HW_IPC_PPCCTRL, (IPC_READ_REG(HW_IPC_PPCCTRL) & ((1 << 5) | (1 << 4)) | (1 << 2))); + ACR_WRITE_REG32(HW_PPCIRQFLAG, (1 << 30)); req = &rep->request; DCInvalidateRange(req, sizeof(*req)); @@ -107,7 +109,7 @@ void IpcReplyHandler(__OSInterrupt interrupt, OSContext* context) { IOSResourceIoctlv* v = &req->args.ioctlv; req->args.ioctlv.vector = (req->args.ioctlv.vector) ? (IOSIoVector*)OSPhysicalToCached((u32)req->args.ioctlv.vector) : NULL; - DCInvalidateRange(&v->vector[0], (req->args.ioctlv.readCount + req->args.ioctlv.writeCount)* sizeof(IOSIoVector)); + DCInvalidateRange(&v->vector[0], (req->args.ioctlv.readCount + req->args.ioctlv.writeCount) * sizeof(IOSIoVector)); for (i = 0; i < (req->args.ioctlv.readCount + req->args.ioctlv.writeCount); i++) { v->vector[i].base = (v->vector[i].base) ? (u8*)OSPhysicalToCached((u32)v->vector[i].base) : NULL; @@ -139,12 +141,11 @@ void IpcReplyHandler(__OSInterrupt interrupt, OSContext* context) { OSSetCurrentContext(context); ipcFree(rep); - } - else { + } else { OSWakeupThread(&rep->thread_queue); } - IPC_WRITE_REG(HW_IPC_PPCCTRL, (IPC_READ_REG(HW_IPC_PPCCTRL) & ((1<<5) | (1<<4))) | (1<<3)); + IPC_WRITE_REG(HW_IPC_PPCCTRL, (IPC_READ_REG(HW_IPC_PPCCTRL) & ((1 << 5) | (1 << 4))) | (1 << 3)); IPCiProfReply(req, (s32)req->handle); err: @@ -152,8 +153,8 @@ err: } static void IpcAckHandler(__OSInterrupt interrupt, OSContext* context) { - IPC_WRITE_REG(HW_IPC_PPCCTRL, (IPC_READ_REG(HW_IPC_PPCCTRL) & ((1<<5) | (1<<4))) | (1<<1)); - ACR_WRITE_REG32(HW_PPCIRQFLAG, (1<<30)); + IPC_WRITE_REG(HW_IPC_PPCCTRL, (IPC_READ_REG(HW_IPC_PPCCTRL) & ((1 << 5) | (1 << 4))) | (1 << 1)); + ACR_WRITE_REG32(HW_PPCIRQFLAG, (1 << 30)); if (__mailboxAck < 1) { __mailboxAck++; @@ -167,7 +168,7 @@ static void IpcAckHandler(__OSInterrupt interrupt, OSContext* context) { __relnchFl = 0; OSWakeupThread(&__relnchRpc->thread_queue); - IPC_WRITE_REG(HW_IPC_PPCCTRL, (IPC_READ_REG(HW_IPC_PPCCTRL) & ((1<<5) | (1<<4))) | (1<<3)); + IPC_WRITE_REG(HW_IPC_PPCCTRL, (IPC_READ_REG(HW_IPC_PPCCTRL) & ((1 << 5) | (1 << 4))) | (1 << 3)); } __ipcSendRequest(); @@ -175,20 +176,20 @@ static void IpcAckHandler(__OSInterrupt interrupt, OSContext* context) { } void IPCInterruptHandler(__OSInterrupt interrupt, OSContext* context) { - if ((IPC_READ_REG(HW_IPC_PPCCTRL) & ((1<<4) | (1<<2))) == ((1<<4) | (1<<2))) { + if ((IPC_READ_REG(HW_IPC_PPCCTRL) & ((1 << 4) | (1 << 2))) == ((1 << 4) | (1 << 2))) { IpcReplyHandler(interrupt, context); } - - if ((IPC_READ_REG(HW_IPC_PPCCTRL) & ((1<<5) | (1<<1))) == ((1<<5) | (1<<1))) { + + if ((IPC_READ_REG(HW_IPC_PPCCTRL) & ((1 << 5) | (1 << 1))) == ((1 << 5) | (1 << 1))) { IpcAckHandler(interrupt, context); } } IOSError IPCCltInit() { - static u32 initialized = FALSE; - IOSError ret = IPC_RESULT_OK; - void* bufferLo; - u32 i; + static u32 initialized = FALSE; + IOSError ret = IPC_RESULT_OK; + void* bufferLo; + u32 i; if (initialized) { goto out; @@ -198,7 +199,7 @@ IOSError IPCCltInit() { IPCInit(); - i = IPC_CLT_HEAP_SIZE<<1; + i = IPC_CLT_HEAP_SIZE << 1; bufferLo = IPCGetBufferLo(); if ((void*)((u8*)bufferLo + i) > IPCGetBufferHi()) { @@ -212,7 +213,7 @@ IOSError IPCCltInit() { __OSSetInterruptHandler(__OS_INTERRUPT_PI_ACR, IPCInterruptHandler); __OSUnmaskInterrupts(OS_INTERRUPTMASK_PI_ACR); - IPC_WRITE_REG(HW_IPC_PPCCTRL, ((1<<5) | (1<<4) | (1<<3))); + IPC_WRITE_REG(HW_IPC_PPCCTRL, ((1 << 5) | (1 << 4) | (1 << 3))); IPCiProfInit(); out: @@ -220,9 +221,9 @@ out: } IOSError IPCCltReInit() { - u32 i; - IOSError ret = IPC_RESULT_OK; - void* bufferLo; + u32 i; + IOSError ret = IPC_RESULT_OK; + void* bufferLo; i = IPC_CLT_HEAP_SIZE; bufferLo = IPCGetBufferLo(); @@ -248,8 +249,7 @@ static inline IOSError __ipcQueueRequest(IOSResourceRequest* req) { if (DIFFERENTIATE(__responses.wcount, __responses.rcount) >= ARRAY_LENGTH(__responses.buf)) { ret = IPL_RESULT_FULLQUEUE; - } - else { + } else { __responses.buf[__responses.wptr] = req; __responses.wptr = (__responses.wptr + 1) % ARRAY_LENGTH(__responses.buf); __responses.wcount++; @@ -260,7 +260,7 @@ static inline IOSError __ipcQueueRequest(IOSResourceRequest* req) { } static inline IOSError __ios_Open(IOSRpcRequest* rpc, const char* path, u32 flags) { - IOSError ret = IPC_RESULT_OK; + IOSError ret = IPC_RESULT_OK; IOSResourceRequest* req; if (!rpc) { @@ -269,7 +269,7 @@ static inline IOSError __ios_Open(IOSRpcRequest* rpc, const char* path, u32 flag } req = &rpc->request; - DCFlushRange((void*)path, strnlen(path, 64)+1); + DCFlushRange((void*)path, strnlen(path, 64) + 1); req->args.open.path = (u8*)OSCachedToPhysical(path); req->args.open.flags = flags; @@ -278,16 +278,16 @@ error: } static inline IOSError __ios_Ipc1(IOSFd fd, u32 cmd, IOSIpcCb callback, void* callbackArg, IOSRpcRequest** rpc) { - IOSError ret = IPC_RESULT_OK; + IOSError ret = IPC_RESULT_OK; IOSResourceRequest* req; if (rpc == 0) { ret = IPC_RESULT_INVALID; goto error; } - + *rpc = (IOSRpcRequest*)ipcAllocReq(); - + if (*rpc == 0) { ret = IPC_RESULT_ALLOC_FAILED; goto error; @@ -305,14 +305,13 @@ error: } static IOSError __ios_Ipc2(IOSRpcRequest* rpc, IOSIpcCb callback) { - IOSError ret = IPC_RESULT_OK; - u32 inten; + IOSError ret = IPC_RESULT_OK; + u32 inten; IOSResourceRequest* req; if (rpc == NULL) { ret = IPC_RESULT_INVALID; - } - else { + } else { req = &rpc->request; if (!callback) { @@ -329,8 +328,7 @@ static IOSError __ios_Ipc2(IOSRpcRequest* rpc, IOSIpcCb callback) { if (callback) { ipcFree(rpc); } - } - else { + } else { if (__mailboxAck > 0) { __ipcSendRequest(); } @@ -355,8 +353,8 @@ static IOSError __ios_Ipc2(IOSRpcRequest* rpc, IOSIpcCb callback) { } IOSError IOS_OpenAsync(const char* pPath, u32 flags, IOSIpcCb callback, void* callback_arg) { - IOSRpcRequest* rpc; - IOSError ret = IPC_RESULT_OK; + IOSRpcRequest* rpc; + IOSError ret = IPC_RESULT_OK; ret = __ios_Ipc1(0, IPC_REQ_OPEN, callback, callback_arg, &rpc); @@ -376,21 +374,21 @@ error: } IOSError IOS_Open(const char* path, u32 flags) { - IOSRpcRequest* rpc; - IOSError ret = IPC_RESULT_OK; + IOSRpcRequest* rpc; + IOSError ret = IPC_RESULT_OK; ret = __ios_Ipc1(0, IPC_REQ_OPEN, NULL, NULL, &rpc); - + if (ret != IPC_RESULT_OK) { goto error; } ret = __ios_Open(rpc, path, flags); - + if (ret != IPC_RESULT_OK) { goto error; } - + ret = __ios_Ipc2(rpc, NULL); error: @@ -398,8 +396,8 @@ error: } IOSError IOS_CloseAsync(IOSFd fd, IOSIpcCb callback, void* callbackArg) { - IOSRpcRequest* rpc; - IOSError ret = IPC_RESULT_OK; + IOSRpcRequest* rpc; + IOSError ret = IPC_RESULT_OK; ret = __ios_Ipc1(fd, IPC_REQ_CLOSE, callback, callbackArg, &rpc); @@ -411,8 +409,8 @@ IOSError IOS_CloseAsync(IOSFd fd, IOSIpcCb callback, void* callbackArg) { } IOSError IOS_Close(IOSFd fd) { - IOSRpcRequest* rpc; - IOSError ret = IPC_RESULT_OK; + IOSRpcRequest* rpc; + IOSError ret = IPC_RESULT_OK; ret = __ios_Ipc1(fd, IPC_REQ_CLOSE, NULL, NULL, &rpc); @@ -425,7 +423,7 @@ IOSError IOS_Close(IOSFd fd) { static IOSError __ios_Read(IOSRpcRequest* rpc, void* buf, u32 len) { IOSResourceRequest* req; - IOSError ret = IPC_RESULT_OK; + IOSError ret = IPC_RESULT_OK; if (!rpc) { ret = IPC_RESULT_INVALID; @@ -443,8 +441,8 @@ error: } IOSError IOS_ReadAsync(IOSFd fd, void* buf, u32 len, IOSIpcCb callback, void* callbackArg) { - IOSRpcRequest* rpc; - IOSError ret = IPC_RESULT_OK; + IOSRpcRequest* rpc; + IOSError ret = IPC_RESULT_OK; ret = __ios_Ipc1(fd, IPC_REQ_READ, callback, callbackArg, &rpc); @@ -465,8 +463,8 @@ error: } IOSError IOS_Read(IOSFd fd, void* buf, u32 len) { - IOSRpcRequest* rpc; - IOSError ret = IPC_RESULT_OK; + IOSRpcRequest* rpc; + IOSError ret = IPC_RESULT_OK; ret = __ios_Ipc1(fd, IPC_REQ_READ, NULL, NULL, &rpc); @@ -488,7 +486,7 @@ error: static IOSError __ios_Write(IOSRpcRequest* rpc, void* buf, u32 len) { IOSResourceRequest* req; - IOSError ret = IPC_RESULT_OK; + IOSError ret = IPC_RESULT_OK; if (!rpc) { ret = IPC_RESULT_INVALID; @@ -505,8 +503,8 @@ error: } IOSError IOS_WriteAsync(IOSFd fd, void* buf, u32 len, IOSIpcCb callback, void* callbackArg) { - IOSRpcRequest* rpc; - IOSError ret = IPC_RESULT_OK; + IOSRpcRequest* rpc; + IOSError ret = IPC_RESULT_OK; ret = __ios_Ipc1(fd, IPC_REQ_WRITE, callback, callbackArg, &rpc); @@ -527,8 +525,8 @@ error: } IOSError IOS_Write(IOSFd fd, void* buf, u32 len) { - IOSRpcRequest* rpc; - IOSError ret = IPC_RESULT_OK; + IOSRpcRequest* rpc; + IOSError ret = IPC_RESULT_OK; ret = __ios_Ipc1(fd, IPC_REQ_WRITE, NULL, NULL, &rpc); @@ -550,7 +548,7 @@ error: static IOSError __ios_Seek(IOSRpcRequest* rpc, s32 offset, u32 whence) { IOSResourceRequest* req; - IOSError ret = IPC_RESULT_OK; + IOSError ret = IPC_RESULT_OK; if (!rpc) { ret = IPC_RESULT_INVALID; @@ -566,8 +564,8 @@ error: } IOSError IOS_SeekAsync(IOSFd fd, s32 offset, u32 whence, IOSIpcCb callback, void* callbackArg) { - IOSRpcRequest* rpc; - IOSError ret = IPC_RESULT_OK; + IOSRpcRequest* rpc; + IOSError ret = IPC_RESULT_OK; ret = __ios_Ipc1(fd, IPC_REQ_SEEK, callback, callbackArg, &rpc); @@ -588,8 +586,8 @@ error: } IOSError IOS_Seek(IOSFd fd, s32 offset, u32 whence) { - IOSRpcRequest* rpc; - IOSError ret = IPC_RESULT_OK; + IOSRpcRequest* rpc; + IOSError ret = IPC_RESULT_OK; ret = __ios_Ipc1(fd, IPC_REQ_SEEK, NULL, NULL, &rpc); @@ -611,7 +609,7 @@ error: static IOSError __ios_Ioctl(IOSRpcRequest* rpc, s32 cmd, void* input, u32 inputLen, void* output, u32 outputLen) { IOSResourceRequest* req; - IOSError ret = IPC_RESULT_OK; + IOSError ret = IPC_RESULT_OK; if (!rpc) { ret = IPC_RESULT_INVALID; @@ -625,7 +623,7 @@ static IOSError __ios_Ioctl(IOSRpcRequest* rpc, s32 cmd, void* input, u32 inputL req->args.ioctl.outLen = outputLen; req->args.ioctl.inPtr = (input) ? (u8*)OSCachedToPhysical(input) : 0; req->args.ioctl.inLen = inputLen; - + DCFlushRange(input, inputLen); DCFlushRange(output, outputLen); @@ -634,8 +632,8 @@ error: } IOSError IOS_IoctlAsync(IOSFd fd, s32 cmd, void* input, u32 inputLen, void* output, u32 outputLen, IOSIpcCb callback, void* callbackArg) { - IOSRpcRequest* rpc; - IOSError ret = IPC_RESULT_OK; + IOSRpcRequest* rpc; + IOSError ret = IPC_RESULT_OK; ret = __ios_Ipc1(fd, IPC_REQ_IOCTL, callback, callbackArg, &rpc); @@ -656,8 +654,8 @@ err: } IOSError IOS_Ioctl(IOSFd fd, s32 cmd, void* input, u32 inputLen, void* output, u32 outputLen) { - IOSRpcRequest* rpc; - IOSError ret = IPC_RESULT_OK; + IOSRpcRequest* rpc; + IOSError ret = IPC_RESULT_OK; ret = __ios_Ipc1(fd, IPC_REQ_IOCTL, NULL, NULL, &rpc); @@ -677,11 +675,10 @@ error: return ret; } - static IOSError __ios_Ioctlv(IOSRpcRequest* rpc, s32 cmd, u32 readCount, u32 writeCount, IOSIoVector* vect) { IOSResourceRequest* req; - IOSResourceIoctlv* v; - IOSError ret = IPC_RESULT_OK; + IOSResourceIoctlv* v; + IOSError ret = IPC_RESULT_OK; u32 i, j; @@ -708,7 +705,7 @@ static IOSError __ios_Ioctlv(IOSRpcRequest* rpc, s32 cmd, u32 readCount, u32 wri v->vector[i].base = (v->vector[i].base) ? (u8*)OSCachedToPhysical(v->vector[i].base) : 0; } - DCFlushRange(&v->vector[0], (v->readCount + v->writeCount)* sizeof(IOSIoVector)); + DCFlushRange(&v->vector[0], (v->readCount + v->writeCount) * sizeof(IOSIoVector)); req->args.ioctlv.vector = (vect) ? (IOSIoVector*)OSCachedToPhysical(vect) : 0; err: @@ -716,8 +713,8 @@ err: } IOSError IOS_IoctlvAsync(IOSFd fd, s32 cmd, u32 readCount, u32 writeCount, IOSIoVector* vect, IOSIpcCb callback, void* callbackArg) { - IOSRpcRequest* rpc; - IOSError ret = IPC_RESULT_OK; + IOSRpcRequest* rpc; + IOSError ret = IPC_RESULT_OK; ret = __ios_Ipc1(fd, IPC_REQ_IOCTLV, callback, callbackArg, &rpc); @@ -738,8 +735,8 @@ err: } IOSError IOS_Ioctlv(IOSFd fd, s32 cmd, u32 readCount, u32 writeCount, IOSIoVector* vect) { - IOSRpcRequest* rpc; - IOSError ret = IPC_RESULT_OK; + IOSRpcRequest* rpc; + IOSError ret = IPC_RESULT_OK; ret = __ios_Ipc1(fd, IPC_REQ_IOCTLV, NULL, NULL, &rpc); @@ -760,11 +757,11 @@ err: } IOSError IOS_IoctlvReboot(IOSFd fd, s32 cmd, u32 readCount, u32 writeCount, IOSIoVector* vect) { - IOSError ret = IPC_RESULT_OK; - u32 inten; + IOSError ret = IPC_RESULT_OK; + u32 inten; IOSResourceRequest* req; - IOSRpcRequest* rpc; + IOSRpcRequest* rpc; inten = OSDisableInterrupts(); @@ -787,7 +784,7 @@ IOSError IOS_IoctlvReboot(IOSFd fd, s32 cmd, u32 readCount, u32 writeCount, IOSI rpc->relaunch_flag = TRUE; ret = __ios_Ioctlv(rpc, cmd, readCount, writeCount, vect); - + if (ret != IPC_RESULT_OK) { goto err; } diff --git a/libs/RVL_SDK/src/ipc/memory.c b/libs/RVL_SDK/src/ipc/memory.c index 1ee2beb5..a38bc743 100644 --- a/libs/RVL_SDK/src/ipc/memory.c +++ b/libs/RVL_SDK/src/ipc/memory.c @@ -1,32 +1,32 @@ -#include #include +#include #include typedef struct IOSChunk IOSChunk; struct IOSChunk { - u32 status; // 0x00 - u32 size; // 0x04 - IOSChunk* prevFree; // 0x08 - IOSChunk* nextFree; // 0x0C + u32 status; // 0x00 + u32 size; // 0x04 + IOSChunk* prevFree; // 0x08 + IOSChunk* nextFree; // 0x0C }; typedef struct IOSHeap { - void* base; // 0x00 - u32 owner; // 0x04 - u32 size; // 0x08 - IOSChunk* freeList; // 0x0C + void* base; // 0x00 + u32 owner; // 0x04 + u32 size; // 0x08 + IOSChunk* freeList; // 0x0C } IOSHeap; -#define MAX_HEAPS 8 +#define MAX_HEAPS 8 static IOSHeap __heaps[MAX_HEAPS]; -IOSHeapId iosCreateHeap(void *ptr, u32 size) { - IOSError ret = IPC_RESULT_INVALID; - u32 mask; - s32 i; - IOSHeap* h; +IOSHeapId iosCreateHeap(void* ptr, u32 size) { + IOSError ret = IPC_RESULT_INVALID; + u32 mask; + s32 i; + IOSHeap* h; mask = OSDisableInterrupts(); @@ -62,7 +62,7 @@ finish: IOSError iosDestroyHeap(IOSHeapId id) { IOSError ret = IPC_RESULT_ACCESS; - IOSHeap *h; + IOSHeap* h; int enabled = OSDisableInterrupts(); @@ -76,7 +76,7 @@ IOSError iosDestroyHeap(IOSHeapId id) { ret = IPC_RESULT_ACCESS; goto finish; } - + h->base = 0; h->size = 0; h->owner = 0; @@ -90,7 +90,7 @@ finish: return ret; } -static void __iosCoalesceChunk(IOSChunk *p) { +static void __iosCoalesceChunk(IOSChunk* p) { if (p && ((u32)p->nextFree == ((u32)p + p->size + sizeof(IOSChunk)))) { IOSChunk* next = p->nextFree; p->nextFree = next->nextFree; @@ -104,11 +104,11 @@ static void __iosCoalesceChunk(IOSChunk *p) { } static void* __iosAlloc(IOSHeapId id, u32 size, u32 alignment) { - u32 mask; - IOSChunk* p; - IOSChunk* best; - IOSHeap* h; - void* ret = NULL; + u32 mask; + IOSChunk* p; + IOSChunk* best; + IOSHeap* h; + void* ret = NULL; mask = OSDisableInterrupts(); @@ -119,7 +119,7 @@ static void* __iosAlloc(IOSHeapId id, u32 size, u32 alignment) { if (!alignment || (alignment & (alignment - 1))) { goto finish; } - + if (alignment < DEFAULT_ALIGN) { alignment = DEFAULT_ALIGN; } @@ -142,8 +142,7 @@ static void* __iosAlloc(IOSHeapId id, u32 size, u32 alignment) { if ((p->size == size) && !extra) { best = p; break; - } - else if ((p->size >= (size + extra)) && (!best || (p->size < best->size))) { + } else if ((p->size >= (size + extra)) && (!best || (p->size < best->size))) { best = p; } @@ -157,7 +156,7 @@ static void* __iosAlloc(IOSHeapId id, u32 size, u32 alignment) { u32 extra = (alignment - (ptr & (alignment - 1))) & (alignment - 1); if (p->size > (size + extra + sizeof(IOSChunk))) { - IOSChunk *n = (IOSChunk *)((u8 *)p + size + extra + sizeof(IOSChunk)); + IOSChunk* n = (IOSChunk*)((u8*)p + size + extra + sizeof(IOSChunk)); n->status = IPC_HEAP_CHUNK_FREE; n->size = p->size - size - extra - sizeof(IOSChunk); n->nextFree = p->nextFree; @@ -174,8 +173,7 @@ static void* __iosAlloc(IOSHeapId id, u32 size, u32 alignment) { if (p->prevFree) { p->prevFree->nextFree = p->nextFree; - } - else { + } else { h->freeList = p->nextFree; } @@ -187,7 +185,7 @@ static void* __iosAlloc(IOSHeapId id, u32 size, u32 alignment) { ret = (u8*)p + extra + sizeof(IOSChunk); if (extra) { - IOSChunk* n = (IOSChunk*)ret-1; + IOSChunk* n = (IOSChunk*)ret - 1; n->status = IPC_HEAP_CHUNK_FORALIGN; n->prevFree = p; } @@ -207,11 +205,11 @@ void* iosAllocAligned(IOSHeapId id, u32 size, u32 alignment) { } IOSError iosFree(IOSHeapId id, void* ptr) { - u32 mask; - IOSChunk* p; - IOSHeap* h; - IOSError ret = IPC_RESULT_INVALID; - IOSChunk* prev; + u32 mask; + IOSChunk* p; + IOSHeap* h; + IOSError ret = IPC_RESULT_INVALID; + IOSChunk* prev; mask = OSDisableInterrupts(); @@ -258,8 +256,7 @@ IOSError iosFree(IOSHeapId id, void* ptr) { if (p->nextFree) { p->nextFree->prevFree = p; } - } - else { + } else { p->nextFree = h->freeList; h->freeList = p; p->prevFree = NULL; diff --git a/libs/RVL_SDK/src/mem/mem_expHeap.c b/libs/RVL_SDK/src/mem/mem_expHeap.c index 3cf894b6..2203953b 100644 --- a/libs/RVL_SDK/src/mem/mem_expHeap.c +++ b/libs/RVL_SDK/src/mem/mem_expHeap.c @@ -1,8 +1,8 @@ #include #include -#include #include +#include #include @@ -70,15 +70,13 @@ static inline MEMiExpHeapMBlockHead* RemoveMBlock_(MEMiExpBlockList* list, MEMiE if (prev) { prev->link.next = next; - } - else { + } else { list->head = next; } if (next) { next->link.prev = prev; - } - else { + } else { list->tail = prev; } @@ -92,8 +90,7 @@ static inline MEMiExpHeapMBlockHead* InsertMBlock_(MEMiExpBlockList* list, MEMiE if (prev) { next = prev->link.next; prev->link.next = block; - } - else { + } else { next = list->head; list->head = block; } @@ -101,8 +98,7 @@ static inline MEMiExpHeapMBlockHead* InsertMBlock_(MEMiExpBlockList* list, MEMiE block->link.next = next; if (next) { next->link.prev = block; - } - else { + } else { list->tail = block; } @@ -119,7 +115,7 @@ static inline MEMiExpHeapMBlockHead* InitMBlock_(Region* region, u16 signature) block->signature = signature; block->attribute.val = 0; block->blockSize = GetOffsetFromPtr(GetMemPtrForMBlock_(block), region->end); - + block->link.prev = NULL; block->link.next = NULL; @@ -166,15 +162,13 @@ static void* AllocUsedBlockFromFreeBlock_(MEMiExpHeapHead* ext, MEMiExpHeapMBloc if (GetOffsetFromPtr(region0.start, region0.end) < 0x14) { region0.end = region0.start; - } - else { + } else { prev = InsertMBlock_(&ext->freeBlocks, InitFreeMBlock_(®ion0), prev); } if (GetOffsetFromPtr(region1.start, region1.end) < 0x14) { region1.start = region1.end; - } - else { + } else { InsertMBlock_(&ext->freeBlocks, InitFreeMBlock_(®ion1), prev); } @@ -327,8 +321,7 @@ void* MEMAllocFromExpHeapEx(MEMHeapHandle heap, u32 size, int align) { LockHeap(heap); if (align >= 0) { block = AllocFromHead_(heap, size, align); - } - else { + } else { block = AllocFromTail_(heap, size, -align); } UnlockHeap(heap); @@ -358,8 +351,7 @@ u32 MEMResizeForMBlockExpHeap(MEMHeapHandle heap, void* block, u32 size) { if (!search || size > head->blockSize + search->blockSize + sizeof(MEMiExpHeapMBlockHead)) { UnlockHeap(heap); return 0; - } - else { + } else { Region region; MEMiExpHeapMBlockHead* prev; void* start; @@ -381,8 +373,7 @@ u32 MEMResizeForMBlockExpHeap(MEMHeapHandle heap, void* block, u32 size) { FillAllocMemory(heap, start, GetOffsetFromPtr(start, region.start)); } - } - else { + } else { Region region; u32 origSize = head->blockSize; @@ -462,7 +453,7 @@ u32 MEMGetAllocatableSizeForExpHeapEx(MEMHeapHandle heap, int align) { return maxSize; } -void MEMVisitAllocatedForExpHeap(MEMHeapHandle heap, void (*visitor)(void* , MEMHeapHandle , u32), u32 param) { +void MEMVisitAllocatedForExpHeap(MEMHeapHandle heap, void (*visitor)(void*, MEMHeapHandle, u32), u32 param) { MEMiExpHeapMBlockHead* block; LockHeap(heap); @@ -487,11 +478,9 @@ u32 MEMAdjustExpHeap(MEMHeapHandle heap) { block = ext->freeBlocks.tail; if (!block) { newSize = 0; - } - else if (AddU32ToPtr(GetMemPtrForMBlock_(block), block->blockSize) != heap->heapEnd) { + } else if (AddU32ToPtr(GetMemPtrForMBlock_(block), block->blockSize) != heap->heapEnd) { newSize = 0; - } - else { + } else { RemoveMBlock_(&ext->freeBlocks, block); heap->heapEnd = SubU32ToPtr(heap->heapEnd, block->blockSize + sizeof(MEMiExpHeapMBlockHead)); newSize = GetOffsetFromPtr(heap, heap->heapEnd); diff --git a/libs/RVL_SDK/src/mem/mem_frameHeap.c b/libs/RVL_SDK/src/mem/mem_frameHeap.c index 8880d8ba..c5db436f 100644 --- a/libs/RVL_SDK/src/mem/mem_frameHeap.c +++ b/libs/RVL_SDK/src/mem/mem_frameHeap.c @@ -1,8 +1,8 @@ #include #include -#include #include +#include #include @@ -76,8 +76,7 @@ void* MEMAllocFromFrmHeapEx(MEMHeapHandle heap, u32 size, int align) { if (align >= 0) { memory = AllocFromHead_(frmHeap, size, align); - } - else { + } else { memory = AllocFromTail_(frmHeap, size, -align); } @@ -102,7 +101,7 @@ void MEMFreeToFrmHeap(MEMHeapHandle heap, int mode) { } frmHeap->tail = heap->heapEnd; } - + UnlockHeap(heap); } @@ -111,7 +110,7 @@ u32 MEMGetAllocatableSizeForFrmHeapEx(MEMHeapHandle heap, int align) { u32 size; MEMiFrmHeapHead* frmHeap; void* block; - + align = abs(align); enabled = OSDisableInterrupts(); frmHeap = (MEMiFrmHeapHead*)AddU32ToPtr(heap, sizeof(MEMiHeapHead)); @@ -171,8 +170,8 @@ int MEMFreeByStateToFrmHeap(MEMHeapHandle heap, u32 tag) { if (tag != 0) for (; state; state = state->prevState) - if (state->tag == tag) - break; + if (state->tag == tag) + break; if (!state) { ret = FALSE; @@ -201,8 +200,7 @@ u32 MEMAdjustFrmHeap(MEMHeapHandle heap) { if (GetOffsetFromPtr(frm->tail, heap->heapEnd) != 0) { newSize = 0; - } - else { + } else { heap->heapEnd = frm->head; frm->tail = frm->head; newSize = GetOffsetFromPtr(heap, frm->head); diff --git a/libs/RVL_SDK/src/mem/mem_heapCommon.c b/libs/RVL_SDK/src/mem/mem_heapCommon.c index 4f4f27de..6233de10 100644 --- a/libs/RVL_SDK/src/mem/mem_heapCommon.c +++ b/libs/RVL_SDK/src/mem/mem_heapCommon.c @@ -1,12 +1,12 @@ -#include #include +#include #include -static BOOL sRootListInitialized = FALSE; +static BOOL sRootListInitialized = FALSE; -static MEMList sRootList; -static OSMutex sRootMutex; +static MEMList sRootList; +static OSMutex sRootMutex; static MEMHeapHandle FindContainHeap_(MEMList* list, const void* memBlock) { MEMHeapHandle heap = NULL; diff --git a/libs/RVL_SDK/src/mem/mem_list.c b/libs/RVL_SDK/src/mem/mem_list.c index 2b4b5245..1baab870 100644 --- a/libs/RVL_SDK/src/mem/mem_list.c +++ b/libs/RVL_SDK/src/mem/mem_list.c @@ -25,8 +25,7 @@ void MEMAppendListObject(MEMList* list, void* object) { if (list->head == NULL) { SetFirstObject_(list, object); - } - else { + } else { node = GET_NODE(list, object); node->prev = list->tail; node->next = NULL; @@ -44,15 +43,13 @@ void MEMRemoveListObject(MEMList* list, void* object) { if (node->prev == NULL) { list->head = node->next; - } - else { + } else { GET_NODE(list, node->prev)->next = node->next; } if (node->next == NULL) { list->tail = node->prev; - } - else { + } else { GET_NODE(list, node->next)->prev = node->prev; } diff --git a/libs/RVL_SDK/src/mem/mem_unitHeap.c b/libs/RVL_SDK/src/mem/mem_unitHeap.c index 823906e2..16411240 100644 --- a/libs/RVL_SDK/src/mem/mem_unitHeap.c +++ b/libs/RVL_SDK/src/mem/mem_unitHeap.c @@ -14,7 +14,7 @@ MEMHeapHandle MEMCreateUnitHeapEx(void* start, u32 heapSize, u32 memBlockSize, i void* heapEnd = PTR_ROUNDDOWN(AddU32ToPtr(start, heapSize), 4); void* heapStart; - + if (ComparePtr(heap, heapEnd) > 0) return NULL; diff --git a/libs/RVL_SDK/src/mtx/mtx.c b/libs/RVL_SDK/src/mtx/mtx.c index 8a87c954..ddda6262 100644 --- a/libs/RVL_SDK/src/mtx/mtx.c +++ b/libs/RVL_SDK/src/mtx/mtx.c @@ -2,6 +2,8 @@ #include +// clang-format off + static f32 Unit01[2] = { 0.0f, 1.0f @@ -677,3 +679,5 @@ void C_MTXLookAt(Mtx m, const Point3d* camPos, const Vec* camUp, const Point3d* m[2][2] = vLook.z; m[2][3] = -((camPos->z * vLook.z) + ((camPos->x * vLook.x) + (camPos->y * vLook.y))); } + +// clang-format on diff --git a/libs/RVL_SDK/src/mtx/mtx44.c b/libs/RVL_SDK/src/mtx/mtx44.c index cb95a7a2..292b3286 100644 --- a/libs/RVL_SDK/src/mtx/mtx44.c +++ b/libs/RVL_SDK/src/mtx/mtx44.c @@ -2,6 +2,8 @@ #include +// clang-format off + void C_MTXFrustum(Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f) { f32 tmp; @@ -76,3 +78,5 @@ void C_MTXOrtho(Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f) { m[3][2] = 0; m[3][3] = 1; } + +// clang-format on diff --git a/libs/RVL_SDK/src/mtx/mtxvec.c b/libs/RVL_SDK/src/mtx/mtxvec.c index 72bcab1e..09190ff7 100644 --- a/libs/RVL_SDK/src/mtx/mtxvec.c +++ b/libs/RVL_SDK/src/mtx/mtxvec.c @@ -1,5 +1,7 @@ #include +// clang-format off + void C_MTXMultVec(const Mtx m, const Vec* src, Vec* dst) { Vec vTmp; @@ -35,3 +37,5 @@ asm void PSMTXMultVec(const register Mtx m, const register Vec* src, register Ve psq_st f6, Vec.z(dst), 1, 0 blr } + +// clang-format on diff --git a/libs/RVL_SDK/src/mtx/vec.c b/libs/RVL_SDK/src/mtx/vec.c index 12bd864b..22f222e8 100644 --- a/libs/RVL_SDK/src/mtx/vec.c +++ b/libs/RVL_SDK/src/mtx/vec.c @@ -1,5 +1,7 @@ -#include #include +#include + +// clang-format off void C_VECNormalize(const Vec* src, Vec* unit) { f32 mag; @@ -69,3 +71,5 @@ asm void PSVECCrossProduct(const register Vec* a, const register Vec* b, registe ps_neg f10, f10 psq_st f10, Vec.y(axb), 0, 0 } + +// clang-format on diff --git a/libs/RVL_SDK/src/nand/NANDCheck.c b/libs/RVL_SDK/src/nand/NANDCheck.c index ec5ec90b..a8acfadb 100644 --- a/libs/RVL_SDK/src/nand/NANDCheck.c +++ b/libs/RVL_SDK/src/nand/NANDCheck.c @@ -1,11 +1,11 @@ -#include #include +#include #include #include -static const char *USER_DIR_LIST[] = { +static const char* USER_DIR_LIST[] = { "/meta", "/ticket", "/title/00010000", @@ -32,11 +32,9 @@ s32 nandCalcUsage(u32* usedBlocks, u32* usedINodes, const char** list) { if (ret == ISFS_ERROR_OK) { *usedBlocks += block; *usedINodes += node; - } - else if (ret == ISFS_ERROR_NOEXISTS) { + } else if (ret == ISFS_ERROR_NOEXISTS) { ret = ISFS_ERROR_OK; - } - else { + } else { break; } @@ -57,8 +55,7 @@ s32 NANDSecretGetUserAvailableArea(u32* freeUserBlocks, u32* freeUserINodes) { ISFSError ret = nandCalcUserUsage(&usedUserBlocks, &usedUserINodes); if (ret != ISFS_ERROR_OK) { return nandConvertErrorCode(ret); - } - else { + } else { u32 blocksResult = NAND_MAX_USER_BLOCKS < usedUserBlocks ? 0 : NAND_MAX_USER_BLOCKS - usedUserBlocks; u32 blocksINodes = NAND_MAX_USER_INODES < usedUserINodes ? 0 : NAND_MAX_USER_INODES - usedUserINodes; *freeUserBlocks = blocksResult; diff --git a/libs/RVL_SDK/src/nand/NANDCore.c b/libs/RVL_SDK/src/nand/NANDCore.c index 26f0d8f5..4cfe2b35 100644 --- a/libs/RVL_SDK/src/nand/NANDCore.c +++ b/libs/RVL_SDK/src/nand/NANDCore.c @@ -1,45 +1,44 @@ -#include #include +#include -#include #include +#include #include -#include #include +#include #include +#include #include #include -#include SDKDefineVersion(NAND, "Apr 20 2010", "11:21:16"); enum { - STATE_NOT_INITIALIZED = 0, - STATE_WORKING, + STATE_NOT_INITIALIZED = 0, + STATE_WORKING, STATE_INITIALIZED }; static int s_libState = STATE_NOT_INITIALIZED; -static char s_currentDir[NAND_MAX_PATH] = "/" ALIGN32; -static char s_homeDir[NAND_MAX_PATH] ALIGN32; +static char s_currentDir[NAND_MAX_PATH] = "/" ALIGN32; +static char s_homeDir[NAND_MAX_PATH] ALIGN32; static BOOL nandOnShutdown(BOOL final, u32 event); static void nandShutdownCallback(ISFSError result, void* arg); static void nandChangeDirCallback(ISFSError result, void* arg); -static OSShutdownFunctionInfo s_shutdownFuncInfo = { nandOnShutdown, 0xFF, NULL, NULL }; +static OSShutdownFunctionInfo s_shutdownFuncInfo = {nandOnShutdown, 0xFF, NULL, NULL}; static BOOL nandIsRelativePath(const char* path) { if (path[0] == '/') { return FALSE; - } - else { + } else { return TRUE; } } @@ -48,18 +47,16 @@ void nandRemoveTailToken(char* newPath, const char* oldPath) { if (oldPath[0] == '/' && oldPath[1] == '\0') { newPath[0] = '/'; newPath[1] = '\0'; - } - else { + } else { int i = 0; - for (i = strlen(oldPath)-1; i >= 0; i--) { + for (i = strlen(oldPath) - 1; i >= 0; i--) { if (oldPath[i] == '/') { if (i != 0) { strncpy(newPath, oldPath, i); newPath[i] = '\0'; break; - } - else { + } else { newPath[0] = '/'; newPath[1] = '\0'; break; @@ -77,16 +74,14 @@ void nandGetHeadToken(char* token, char* newPath, const char* oldPath) { strncpy(token, oldPath, i); token[i] = '\0'; - if (oldPath[i+1] == '\0') { + if (oldPath[i + 1] == '\0') { newPath[0] = '\0'; - } - else { - strcpy(newPath, oldPath + i+1); + } else { + strcpy(newPath, oldPath + i + 1); } break; - } - else if (oldPath[i] == '\0') { + } else if (oldPath[i] == '\0') { strncpy(token, oldPath, i); token[i] = '\0'; newPath[0] = '\0'; @@ -98,17 +93,16 @@ void nandGetHeadToken(char* token, char* newPath, const char* oldPath) { void nandGetRelativeName(char* name, const char* path) { if (strcmp("/", path) == 0) { strcpy(name, ""); - } - else { + } else { int i = 0; - for (i = strlen(path)-1; i >= 0; i--) { + for (i = strlen(path) - 1; i >= 0; i--) { if (path[i] == '/') { break; } } - strcpy(name, path + i+1); + strcpy(name, path + i + 1); } } @@ -125,24 +119,20 @@ void nandConvertPath(char* absPath, const char* wd, const char* relPath) { if (strcmp(token, ".") == 0) { nandConvertPath(absPath, wd, newRelPath); - } - else if (strcmp(token, "..") == 0) { + } else if (strcmp(token, "..") == 0) { char new_wd[128]; nandRemoveTailToken(new_wd, wd); nandConvertPath(absPath, new_wd, newRelPath); - } - else if (token[0] != '\0') { + } else if (token[0] != '\0') { char new_wd[128]; if (strcmp(wd, "/") == 0) { sprintf(new_wd, "/%s", token); - } - else { + } else { sprintf(new_wd, "%s/%s", wd, token); } nandConvertPath(absPath, new_wd, newRelPath); - } - else { + } else { strcpy(absPath, wd); } } @@ -150,8 +140,7 @@ void nandConvertPath(char* absPath, const char* wd, const char* relPath) { BOOL nandIsPrivatePath(const char* path) { if (strncmp(path, "/shared2", 8) == 0) { return TRUE; - } - else { + } else { return FALSE; } } @@ -159,8 +148,7 @@ BOOL nandIsPrivatePath(const char* path) { BOOL nandIsUnderPrivatePath(const char* path) { if ((strncmp(path, "/shared2/", 9) == 0) && (path[9] != '\0')) { return TRUE; - } - else { + } else { return FALSE; } } @@ -168,60 +156,101 @@ BOOL nandIsUnderPrivatePath(const char* path) { BOOL nandIsInitialized() { if (s_libState == STATE_INITIALIZED) { return TRUE; - } - else { + } else { return FALSE; } } -void nandReportErrorCode(ISFSError result) {} +void nandReportErrorCode(ISFSError result) { +} s32 nandConvertErrorCode(ISFSError result) { int errorMap[] = { // FS codes - ISFS_ERROR_OK, NAND_RESULT_OK, - ISFS_ERROR_ACCESS, NAND_RESULT_ACCESS, - ISFS_ERROR_CORRUPT, NAND_RESULT_CORRUPT, - ISFS_ERROR_ECC_CRIT, NAND_RESULT_ECC_CRIT, - ISFS_ERROR_EXISTS, NAND_RESULT_EXISTS, - ISFS_ERROR_AUTHENTICATION, NAND_RESULT_AUTHENTICATION, - ISFS_ERROR_INVALID, NAND_RESULT_INVALID, - ISFS_ERROR_MAXBLOCKS, NAND_RESULT_MAXBLOCKS, - ISFS_ERROR_MAXFD, NAND_RESULT_MAXFD, - ISFS_ERROR_MAXFILES, NAND_RESULT_MAXFILES, - ISFS_ERROR_MAXDEPTH, NAND_RESULT_MAXDEPTH, - ISFS_ERROR_NOEXISTS, NAND_RESULT_NOEXISTS, - ISFS_ERROR_NOTEMPTY, NAND_RESULT_NOTEMPTY, - ISFS_ERROR_NOTREADY, NAND_RESULT_UNKNOWN, - ISFS_ERROR_OPENFD, NAND_RESULT_OPENFD, - ISFS_ERROR_UNKNOWN, NAND_RESULT_UNKNOWN, - ISFS_ERROR_BUSY, NAND_RESULT_BUSY, - ISFS_ERROR_SHUTDOWN, NAND_RESULT_FATAL_ERROR, + ISFS_ERROR_OK, + NAND_RESULT_OK, + ISFS_ERROR_ACCESS, + NAND_RESULT_ACCESS, + ISFS_ERROR_CORRUPT, + NAND_RESULT_CORRUPT, + ISFS_ERROR_ECC_CRIT, + NAND_RESULT_ECC_CRIT, + ISFS_ERROR_EXISTS, + NAND_RESULT_EXISTS, + ISFS_ERROR_AUTHENTICATION, + NAND_RESULT_AUTHENTICATION, + ISFS_ERROR_INVALID, + NAND_RESULT_INVALID, + ISFS_ERROR_MAXBLOCKS, + NAND_RESULT_MAXBLOCKS, + ISFS_ERROR_MAXFD, + NAND_RESULT_MAXFD, + ISFS_ERROR_MAXFILES, + NAND_RESULT_MAXFILES, + ISFS_ERROR_MAXDEPTH, + NAND_RESULT_MAXDEPTH, + ISFS_ERROR_NOEXISTS, + NAND_RESULT_NOEXISTS, + ISFS_ERROR_NOTEMPTY, + NAND_RESULT_NOTEMPTY, + ISFS_ERROR_NOTREADY, + NAND_RESULT_UNKNOWN, + ISFS_ERROR_OPENFD, + NAND_RESULT_OPENFD, + ISFS_ERROR_UNKNOWN, + NAND_RESULT_UNKNOWN, + ISFS_ERROR_BUSY, + NAND_RESULT_BUSY, + ISFS_ERROR_SHUTDOWN, + NAND_RESULT_FATAL_ERROR, // IPC codes - IPC_RESULT_ACCESS, NAND_RESULT_ACCESS, - IPC_RESULT_EXISTS, NAND_RESULT_EXISTS, - IPC_RESULT_INTR, NAND_RESULT_UNKNOWN, - IPC_RESULT_INVALID, NAND_RESULT_INVALID, - IPC_RESULT_MAX, NAND_RESULT_UNKNOWN, - IPC_RESULT_NOEXISTS, NAND_RESULT_NOEXISTS, - IPC_RESULT_EMPTYQUEUE, NAND_RESULT_UNKNOWN, - IPL_RESULT_FULLQUEUE, NAND_RESULT_BUSY, - IPC_RESULT_UNKNOWN, NAND_RESULT_UNKNOWN, - IPC_RESULT_NOTREADY, NAND_RESULT_UNKNOWN, - IPC_RESULT_ECC, NAND_RESULT_UNKNOWN, - IPC_RESULT_ECC_CRIT, NAND_RESULT_ECC_CRIT, - IPC_RESULT_BADBLOCK, NAND_RESULT_UNKNOWN, - IPC_RESULT_INVALID_OBJTYPE, NAND_RESULT_UNKNOWN, - IPC_RESULT_INVALID_RNG, NAND_RESULT_UNKNOWN, - IPC_RESULT_INVALID_FLAG, NAND_RESULT_UNKNOWN, - IPC_RESULT_INVALID_FORMAT, NAND_RESULT_UNKNOWN, - IPC_RESULT_INVALID_VERSION, NAND_RESULT_UNKNOWN, - IPC_RESULT_INVALID_SIGNATURE, NAND_RESULT_UNKNOWN, - IPC_RESULT_VERIFY_FAILED, NAND_RESULT_UNKNOWN, - IPC_RESULT_INTERNAL_FAILURE, NAND_RESULT_UNKNOWN, - IPC_RESULT_ALLOC_FAILED, NAND_RESULT_ALLOC_FAILED, - IPC_RESULT_INVALID_SIZE, NAND_RESULT_UNKNOWN, + IPC_RESULT_ACCESS, + NAND_RESULT_ACCESS, + IPC_RESULT_EXISTS, + NAND_RESULT_EXISTS, + IPC_RESULT_INTR, + NAND_RESULT_UNKNOWN, + IPC_RESULT_INVALID, + NAND_RESULT_INVALID, + IPC_RESULT_MAX, + NAND_RESULT_UNKNOWN, + IPC_RESULT_NOEXISTS, + NAND_RESULT_NOEXISTS, + IPC_RESULT_EMPTYQUEUE, + NAND_RESULT_UNKNOWN, + IPL_RESULT_FULLQUEUE, + NAND_RESULT_BUSY, + IPC_RESULT_UNKNOWN, + NAND_RESULT_UNKNOWN, + IPC_RESULT_NOTREADY, + NAND_RESULT_UNKNOWN, + IPC_RESULT_ECC, + NAND_RESULT_UNKNOWN, + IPC_RESULT_ECC_CRIT, + NAND_RESULT_ECC_CRIT, + IPC_RESULT_BADBLOCK, + NAND_RESULT_UNKNOWN, + IPC_RESULT_INVALID_OBJTYPE, + NAND_RESULT_UNKNOWN, + IPC_RESULT_INVALID_RNG, + NAND_RESULT_UNKNOWN, + IPC_RESULT_INVALID_FLAG, + NAND_RESULT_UNKNOWN, + IPC_RESULT_INVALID_FORMAT, + NAND_RESULT_UNKNOWN, + IPC_RESULT_INVALID_VERSION, + NAND_RESULT_UNKNOWN, + IPC_RESULT_INVALID_SIGNATURE, + NAND_RESULT_UNKNOWN, + IPC_RESULT_VERIFY_FAILED, + NAND_RESULT_UNKNOWN, + IPC_RESULT_INTERNAL_FAILURE, + NAND_RESULT_UNKNOWN, + IPC_RESULT_ALLOC_FAILED, + NAND_RESULT_ALLOC_FAILED, + IPC_RESULT_INVALID_SIZE, + NAND_RESULT_UNKNOWN, }; int i = 0; @@ -232,19 +261,20 @@ s32 nandConvertErrorCode(ISFSError result) { for (; i < ARRAY_LENGTH(errorMap); i += 2) { if (errorMap[i] == result) { - if (result == ISFS_ERROR_ECC_CRIT || result == ISFS_ERROR_AUTHENTICATION || result == ISFS_ERROR_UNKNOWN - || result == IPC_RESULT_UNKNOWN || result == IPC_RESULT_ECC_CRIT) { + if (result == ISFS_ERROR_ECC_CRIT || result == ISFS_ERROR_AUTHENTICATION || result == ISFS_ERROR_UNKNOWN || + result == IPC_RESULT_UNKNOWN || result == IPC_RESULT_ECC_CRIT) { char buf[128] ALIGN64; sprintf(buf, "ISFS error code: %d", result); NANDLoggingAddMessageAsync(NULL, buf); } nandReportErrorCode(result); - return errorMap[i+1]; + return errorMap[i + 1]; } } - OSReport("CAUTION! Unexpected error code [%d] was found.\n", result); { + OSReport("CAUTION! Unexpected error code [%d] was found.\n", result); + { char buf[128] ALIGN64; sprintf(buf, "ISFS unexpected error code: %d", result); NANDLoggingAddMessageAsync(NULL, buf); @@ -258,18 +288,16 @@ s32 nandConvertErrorCode(ISFSError result) { void nandGenerateAbsPath(char* absPath, const char* path) { if (strlen(path) == 0) { strcpy(absPath, ""); - } - else if (nandIsRelativePath(path)) { + } else if (nandIsRelativePath(path)) { nandConvertPath(absPath, s_currentDir, path); - } - else { + } else { u32 len = -1; strcpy(absPath, path); - + len = strlen(absPath); if (len > 0) { - if (absPath[len-1] == '/' && len-1 != 0) { - absPath[len-1] = '\0'; + if (absPath[len - 1] == '/' && len - 1 != 0) { + absPath[len - 1] = '\0'; } } } @@ -285,8 +313,7 @@ void nandGetParentDirectory(char* parentDir, const char* absPath) { if (i == 0) { strcpy(parentDir, "/"); - } - else { + } else { strncpy(parentDir, absPath, i); parentDir[i] = '\0'; } @@ -298,19 +325,17 @@ s32 NANDInit() { if (s_libState == STATE_WORKING) { OSRestoreInterrupts(enabled); return NAND_RESULT_BUSY; - } - else if (s_libState == STATE_INITIALIZED) { + } else if (s_libState == STATE_INITIALIZED) { OSRestoreInterrupts(enabled); return NAND_RESULT_OK; - } - else { + } else { ISFSError result = ISFS_ERROR_UNKNOWN; s_libState = STATE_WORKING; OSRestoreInterrupts(enabled); result = ISFS_OpenLib(); if (result == ISFS_ERROR_OK) { - ESTitleId id; + ESTitleId id; s32 ret = ESP_InitLib(); @@ -341,10 +366,9 @@ s32 NANDInit() { OSRegisterVersion(GetVersion(NAND)); return NAND_RESULT_OK; - } - else { + } else { enabled = OSDisableInterrupts(); - + s_libState = STATE_NOT_INITIALIZED; OSRestoreInterrupts(enabled); @@ -357,9 +381,9 @@ s32 NANDInit() { static BOOL nandOnShutdown(BOOL final, u32 event) { if (!final) { if (event == OS_SHUTDOWN_STANDBY) { - vBOOL flag = FALSE; + vBOOL flag = FALSE; - OSTime t = OSGetTime(); + OSTime t = OSGetTime(); ISFS_ShutdownAsync(nandShutdownCallback, (void*)&flag); @@ -370,8 +394,7 @@ static BOOL nandOnShutdown(BOOL final, u32 event) { } } return TRUE; - } - else { + } else { return TRUE; } } @@ -385,21 +408,18 @@ static ISFSError nandChangeDir(const char* path, NANDCommandBlock* block, BOOL i nandGenerateAbsPath(block->absPath, path); if (!hasPrivateAccess && nandIsPrivatePath(block->absPath)) { return ISFS_ERROR_ACCESS; - } - else { + } else { return ISFS_ReadDirAsync(block->absPath, NULL, &block->num, nandChangeDirCallback, block); } - } - else { + } else { u32 num = 0; - + char absPath[NAND_MAX_PATH] = ""; - + nandGenerateAbsPath(absPath, path); if (!hasPrivateAccess && nandIsPrivatePath(absPath)) { return ISFS_ERROR_ACCESS; - } - else { + } else { ISFSError err = ISFS_ReadDir(absPath, NULL, &num); if (err == ISFS_ERROR_OK) { BOOL enabled = OSDisableInterrupts(); @@ -470,30 +490,26 @@ static ISFSError nandGetType(const char* path, u8* type, NANDCommandBlock* block nandGenerateAbsPath(block->absPath, path); if (!hasPrivateAccess && nandIsUnderPrivatePath(block->absPath)) { return ISFS_ERROR_ACCESS; - } - else { + } else { block->type = type; return ISFS_ReadDirAsync(block->absPath, NULL, &block->num, nandGetTypeCallback, block); return ISFS_ReadDirAsync(block->absPath, NULL, &block->num, nandGetTypeCallback, block); } - } - else { + } else { char absPath[NAND_MAX_PATH] = ""; nandGenerateAbsPath(absPath, path); if (!hasPrivateAccess && nandIsUnderPrivatePath(absPath)) { return ISFS_ERROR_ACCESS; - } - else { - u32 dummy = 0; - ISFSError err = ISFS_ReadDir(absPath, NULL, &dummy); + } else { + u32 dummy = 0; + ISFSError err = ISFS_ReadDir(absPath, NULL, &dummy); if (err == ISFS_ERROR_OK || err == ISFS_ERROR_ACCESS) { *type = NAND_TYPE_DIR; err = ISFS_ERROR_OK; - } - else if (err == ISFS_ERROR_INVALID) { + } else if (err == ISFS_ERROR_INVALID) { *type = NAND_TYPE_FILE; err = ISFS_ERROR_OK; } @@ -534,8 +550,7 @@ static void nandGetTypeCallback(ISFSError result, void* arg) { if (result == ISFS_ERROR_OK || result == ISFS_ERROR_ACCESS) { *block->type = NAND_TYPE_DIR; result = ISFS_ERROR_OK; - } - else if (result == ISFS_ERROR_INVALID) { + } else if (result == ISFS_ERROR_INVALID) { *block->type = NAND_TYPE_FILE; result = ISFS_ERROR_OK; } diff --git a/libs/RVL_SDK/src/nand/NANDLogging.c b/libs/RVL_SDK/src/nand/NANDLogging.c index afa96014..45c870a9 100644 --- a/libs/RVL_SDK/src/nand/NANDLogging.c +++ b/libs/RVL_SDK/src/nand/NANDLogging.c @@ -1,47 +1,50 @@ -#include #include +#include #include #include -#include #include #include +#include -#define LINE_MAX_EACH 256 -#define LINE_MAX 64 -#define TOTAL_STR_SIZE (LINE_MAX * LINE_MAX_EACH) -#define TOTAL_SIZE (TOTAL_STR_SIZE * (int)sizeof(char)) +#define LINE_MAX_EACH 256 +#define LINE_MAX 64 +#define TOTAL_STR_SIZE (LINE_MAX * LINE_MAX_EACH) +#define TOTAL_SIZE (TOTAL_STR_SIZE * (int)sizeof(char)) -static IOSFd s_fd = -255; +static IOSFd s_fd = -255; -static int s_stage; -static char s_message[LINE_MAX_EACH] ATTRIBUTE_ALIGN(LINE_MAX); +static int s_stage; +static char s_message[LINE_MAX_EACH] ATTRIBUTE_ALIGN(LINE_MAX); static NANDLoggingCallback s_callback = NULL; -#define CALLBACK_FUNC(b) if (s_callback) s_callback(b) +#define CALLBACK_FUNC(b) \ + if (s_callback) \ + s_callback(b) static void asyncRoutine(ISFSError result, void* arg); static void PrepareLine(char* line, int count, const char* msg) { - int result; - char titleID[64]; - OSCalendarTime time; + int result; + char titleID[64]; + OSCalendarTime time; // Setup line - memset(line, ' ', LINE_MAX_EACH-2); + memset(line, ' ', LINE_MAX_EACH - 2); // Get time OSTicksToCalendarTime(OSGetTime(), &time); // Grab the title ID - strncpy(titleID, nandGetHomeDir() + 7, 16+1); + strncpy(titleID, nandGetHomeDir() + 7, 16 + 1); titleID[8] = '-'; - titleID[16+1] = '\0'; + titleID[16 + 1] = '\0'; // Create entry - result = snprintf(line, LINE_MAX_EACH, "%d %04d/%02d/%02d %02d:%02d:%02d %s %s", count % 63+1, time.year, time.mon+1, time.mday, time.hour, time.min, time.sec, titleID, msg); + result = snprintf(line, LINE_MAX_EACH, "%d %04d/%02d/%02d %02d:%02d:%02d %s %s", count % 63 + 1, time.year, time.mon + 1, time.mday, time.hour, + time.min, time.sec, titleID, msg); // Did if (result < LINE_MAX_EACH) { @@ -49,14 +52,14 @@ static void PrepareLine(char* line, int count, const char* msg) { } // Add new line (in CRLF) - line[LINE_MAX_EACH-2] = '\r'; - line[LINE_MAX_EACH-1] = '\n'; + line[LINE_MAX_EACH - 2] = '\r'; + line[LINE_MAX_EACH - 1] = '\n'; } BOOL NANDLoggingPrepareFile(u8* workBuf) { - ISFSError ret; - IOSFd fd; - u32 leftOut = 0; + ISFSError ret; + IOSFd fd; + u32 leftOut = 0; int i; @@ -65,11 +68,9 @@ BOOL NANDLoggingPrepareFile(u8* workBuf) { if (ret == ISFS_ERROR_OK || ret == ISFS_ERROR_ACCESS) { OSReport("Caution! Path of logfile is a directory!"); return FALSE; - } - else if (ret == ISFS_ERROR_INVALID) { + } else if (ret == ISFS_ERROR_INVALID) { return TRUE; - } - else if (ret != ISFS_ERROR_NOEXISTS) { + } else if (ret != ISFS_ERROR_NOEXISTS) { OSReport("Caution! ISFS_ReadDir() failed.\n"); return FALSE; } @@ -89,9 +90,9 @@ BOOL NANDLoggingPrepareFile(u8* workBuf) { // Fill it all in with spaces memset(workBuf, ' ', TOTAL_SIZE); PrepareLine((char*)workBuf, 0, "Created log file."); - for (i = 0; i < LINE_MAX; i++){ - workBuf[(i+1) * LINE_MAX_EACH-2] = '\r'; - workBuf[(i+1) * LINE_MAX_EACH-1] = '\n'; + for (i = 0; i < LINE_MAX; i++) { + workBuf[(i + 1) * LINE_MAX_EACH - 2] = '\r'; + workBuf[(i + 1) * LINE_MAX_EACH - 1] = '\n'; } ret = ISFS_Write(fd, (char*)workBuf, TOTAL_SIZE); if (ret != TOTAL_SIZE) { @@ -128,14 +129,11 @@ BOOL reserveFileDescriptor() { if (s_fd == -255) { s_fd = -254; busy_flag = FALSE; - } - else if (s_fd == -254) { + } else if (s_fd == -254) { busy_flag = TRUE; - } - else if (s_fd >= 0) { + } else if (s_fd >= 0) { busy_flag = TRUE; - } - else { + } else { busy_flag = TRUE; } @@ -150,7 +148,7 @@ BOOL NANDLoggingAddMessageAsync(NANDLoggingCallback callback, const char* fmt, . if (!reserveFileDescriptor()) { return FALSE; - } + } // Add message va_start(ap, fmt); @@ -164,14 +162,13 @@ BOOL NANDLoggingAddMessageAsync(NANDLoggingCallback callback, const char* fmt, . if (ret == ISFS_ERROR_OK) { return TRUE; - } - else { + } else { return FALSE; } } static void asyncRoutine(ISFSError result, void* arg) { - ISFSError ret; + ISFSError ret; static char s_rBuf[LINE_MAX_EACH] ATTRIBUTE_ALIGN(LINE_MAX); static char s_wBuf[LINE_MAX_EACH] ATTRIBUTE_ALIGN(LINE_MAX); @@ -185,40 +182,34 @@ static void asyncRoutine(ISFSError result, void* arg) { if (ret != ISFS_ERROR_OK) { CALLBACK_FUNC(FALSE); } - } - else { + } else { CALLBACK_FUNC(FALSE); } - } - else if (s_stage == 3) { + } else if (s_stage == 3) { if (result == ISFS_ERROR_OK) { ret = ISFS_ReadAsync(s_fd, (u8*)s_rBuf, LINE_MAX_EACH, asyncRoutine, NULL); if (ret != ISFS_ERROR_OK) { CALLBACK_FUNC(FALSE); } - } - else { + } else { CALLBACK_FUNC(FALSE); } - } - else if (s_stage == 4) { + } else if (s_stage == 4) { if (result == LINE_MAX_EACH) { ret = ISFS_SeekAsync(s_fd, 0, ISFS_SEEK_BEG, asyncRoutine, NULL); if (ret != ISFS_ERROR_OK) { CALLBACK_FUNC(FALSE); } - } - else { + } else { CALLBACK_FUNC(FALSE); } - } - else if (s_stage == 5) { + } else if (s_stage == 5) { if (result == ISFS_ERROR_OK) { int count = 0; s_rBuf[255] = '\0'; - + count = atoi(s_rBuf); PrepareLine(s_wBuf, count, s_message); @@ -227,12 +218,10 @@ static void asyncRoutine(ISFSError result, void* arg) { if (ret != ISFS_ERROR_OK) { CALLBACK_FUNC(FALSE); } - } - else { + } else { CALLBACK_FUNC(FALSE); } - } - else if (s_stage == 6) { + } else if (s_stage == 6) { if (result == LINE_MAX_EACH) { int count = atoi(s_rBuf); ret = ISFS_SeekAsync(s_fd, count * LINE_MAX_EACH, ISFS_SEEK_BEG, asyncRoutine, NULL); @@ -240,40 +229,33 @@ static void asyncRoutine(ISFSError result, void* arg) { if (ret != ISFS_ERROR_OK) { CALLBACK_FUNC(FALSE); } - } - else { + } else { CALLBACK_FUNC(FALSE); } - } - else if (s_stage == 7) { + } else if (s_stage == 7) { int count = atoi(s_rBuf); if (result == count * LINE_MAX_EACH) { ret = ISFS_WriteAsync(s_fd, s_wBuf, LINE_MAX_EACH, asyncRoutine, NULL); if (ret != ISFS_ERROR_OK) { CALLBACK_FUNC(FALSE); } - } - else { + } else { CALLBACK_FUNC(FALSE); } - } - else if (s_stage == 8) { + } else if (s_stage == 8) { if (result == LINE_MAX_EACH) { ret = ISFS_CloseAsync(s_fd, asyncRoutine, NULL); if (ret != ISFS_ERROR_OK) { CALLBACK_FUNC(FALSE); } - } - else { + } else { CALLBACK_FUNC(FALSE); } - } - else if (s_stage == 9) { + } else if (s_stage == 9) { if (result == ISFS_ERROR_OK) { s_fd = -255; CALLBACK_FUNC(TRUE); - } - else { + } else { CALLBACK_FUNC(FALSE); } } diff --git a/libs/RVL_SDK/src/nand/NANDOpenClose.c b/libs/RVL_SDK/src/nand/NANDOpenClose.c index 6ca68534..73e47cff 100644 --- a/libs/RVL_SDK/src/nand/NANDOpenClose.c +++ b/libs/RVL_SDK/src/nand/NANDOpenClose.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -38,11 +38,12 @@ static s32 nandSafeClose(NANDFileInfo* info, BOOL isSimple); static s32 nandSafeCloseAsync(NANDFileInfo* info, NANDCallback callback, NANDCommandBlock* block, BOOL isSimple); static s32 nandSafeOpen(const char* path, NANDFileInfo* info, u8 accType, void* buffer, u32 length, BOOL hasPrivateAccess, BOOL isSimple); -static s32 nandSafeOpenAsync(const char* path, NANDFileInfo*, u8 accType, void* buffer, u32 length, NANDCallback callback, NANDCommandBlock* block, BOOL hasPrivateAccess, BOOL isSimple); +static s32 nandSafeOpenAsync(const char* path, NANDFileInfo*, u8 accType, void* buffer, u32 length, NANDCallback callback, NANDCommandBlock* block, + BOOL hasPrivateAccess, BOOL isSimple); static u32 nandGetUniqueNumber() { - static u32 s_counter = 0; - BOOL enabled = OSDisableInterrupts(); + static u32 s_counter = 0; + BOOL enabled = OSDisableInterrupts(); u32 ret = s_counter++; @@ -51,16 +52,15 @@ static u32 nandGetUniqueNumber() { } static IOSFd nandOpen(const char* path, u8 accType, NANDCommandBlock* block, BOOL isAsync, BOOL hasPrivateAccess) { - IOSFd fd = ISFS_ERROR_UNKNOWN; - char absPath[NAND_MAX_PATH] = ""; - u32 access = 0; + IOSFd fd = ISFS_ERROR_UNKNOWN; + char absPath[NAND_MAX_PATH] = ""; + u32 access = 0; nandGenerateAbsPath(absPath, path); if (!hasPrivateAccess && nandIsPrivatePath(absPath)) { return ISFS_ERROR_ACCESS; - } - else { + } else { switch (accType) { case NAND_ACCESS_RW: { access = NAND_ACCESS_RW; @@ -81,8 +81,7 @@ static IOSFd nandOpen(const char* path, u8 accType, NANDCommandBlock* block, BOO if (isAsync) { fd = ISFS_OpenAsync(absPath, access, nandOpenCallback, block); - } - else { + } else { fd = ISFS_Open(absPath, access); } @@ -103,8 +102,7 @@ s32 NANDOpen(const char* path, NANDFileInfo* info, u8 accType) { info->fileDescriptor = fd; info->mark = 1; return NAND_RESULT_OK; - } - else { + } else { return nandConvertErrorCode(fd); } } @@ -122,8 +120,7 @@ s32 NANDPrivateOpen(const char* path, NANDFileInfo* info, u8 accType) { info->fileDescriptor = fd; info->mark = 1; return NAND_RESULT_OK; - } - else { + } else { return nandConvertErrorCode(fd); } } @@ -160,8 +157,7 @@ static void nandOpenCallback(ISFSError result, void* arg) { ((NANDFileInfo*)block->fileInfo)->stage = 2; ((NANDFileInfo*)block->fileInfo)->mark = 1; block->callback(NAND_RESULT_OK, block); - } - else { + } else { block->callback(nandConvertErrorCode(result), block); } } @@ -207,8 +203,7 @@ static ISFSError nandCopy(IOSFd dest, IOSFd src, void* buffer, u32 length) { size = ISFS_Read(src, buffer, length); if (size == 0) { return 0; - } - else if (size < ISFS_ERROR_OK) { + } else if (size < ISFS_ERROR_OK) { return size; } @@ -232,12 +227,12 @@ s32 NANDPrivateSafeOpen(const char* path, NANDFileInfo* info, u8 accType, void* } static s32 nandSafeOpen(const char* path, NANDFileInfo* info, u8 accType, void* buffer, u32 length, BOOL hasPrivateAccess, BOOL isSimple) { - u32 ownerId; - u16 groupId; - u32 attr; + u32 ownerId; + u16 groupId; + u32 attr; + + u32 ownerAcc, groupAcc, othersAcc; - u32 ownerAcc, groupAcc, othersAcc; - if (!nandIsInitialized()) { return NAND_RESULT_FATAL_ERROR; } @@ -261,19 +256,16 @@ static s32 nandSafeOpen(const char* path, NANDFileInfo* info, u8 accType, void* if (!isSimple) { info->mark = 3; - } - else { + } else { info->mark = 5; } return NAND_RESULT_OK; - } - else { + } else { return nandConvertErrorCode(fd); } - } - else if (accType == NAND_ACCESS_WRITE || accType == NAND_ACCESS_RW) { - char filename[FS_MAX_DIR_PATH+1] = ""; + } else if (accType == NAND_ACCESS_WRITE || accType == NAND_ACCESS_RW) { + char filename[FS_MAX_DIR_PATH + 1] = ""; char tmpDir[FS_MAX_PATH]; ISFSError ret = ISFS_ERROR_UNKNOWN; @@ -306,14 +298,12 @@ static s32 nandSafeOpen(const char* path, NANDFileInfo* info, u8 accType, void* return nandConvertErrorCode(ret); } info->stage = 3; - } nandGetRelativeName(filename, info->origPath); if (!isSimple) { sprintf(info->tmpPath, "%s/%08x/%s", "/tmp/sys", uniqueNum, filename); - } - else { + } else { sprintf(info->tmpPath, "%s/%s", "/tmp/sys", filename); } @@ -325,11 +315,10 @@ static s32 nandSafeOpen(const char* path, NANDFileInfo* info, u8 accType, void* if (accType == NAND_ACCESS_WRITE) { info->fileDescriptor = ISFS_Open(info->tmpPath, ISFS_ACCESS_WRITE); - } - else if (accType == NAND_ACCESS_RW) { + } else if (accType == NAND_ACCESS_RW) { info->fileDescriptor = ISFS_Open(info->tmpPath, ISFS_ACCESS_RW); } - + if (info->fileDescriptor < 0) { return nandConvertErrorCode(info->fileDescriptor); } @@ -343,22 +332,19 @@ static s32 nandSafeOpen(const char* path, NANDFileInfo* info, u8 accType, void* ret = ISFS_Seek(info->fileDescriptor, 0, IPC_SEEK_BEG); if (ret == 0) { ret = ISFS_ERROR_OK; - } - else { + } else { return nandConvertErrorCode(ret); } if (ret == ISFS_ERROR_OK) { if (isSimple) { info->mark = 5; - } - else { + } else { info->mark = 3; } } return nandConvertErrorCode(ret); - } - else { + } else { return NAND_RESULT_INVALID; } } @@ -385,14 +371,12 @@ s32 nandSafeClose(NANDFileInfo* info, BOOL isSimple) { info->stage = 7; if (!isSimple) { info->mark = 4; - } - else { + } else { info->mark = 6; } } return nandConvertErrorCode(err); - } - else if (info->accType == NAND_ACCESS_WRITE || info->accType == NAND_ACCESS_RW) { + } else if (info->accType == NAND_ACCESS_WRITE || info->accType == NAND_ACCESS_RW) { err = ISFS_Close(info->fileDescriptor); if (err != ISFS_ERROR_OK) { return nandConvertErrorCode(err); @@ -418,24 +402,24 @@ s32 nandSafeClose(NANDFileInfo* info, BOOL isSimple) { info->stage = 9; info->mark = 4; } - } - else { + } else { info->mark = 6; } return nandConvertErrorCode(err); - } - else { + } else { OSReport("Illegal NANDFileInfo.\n"); return NAND_RESULT_FATAL_ERROR; } } -s32 NANDPrivateSafeOpenAsync(const char* path, NANDFileInfo* info, u8 accType, void* buffer, u32 length, NANDCallback callback, NANDCommandBlock* block) { +s32 NANDPrivateSafeOpenAsync(const char* path, NANDFileInfo* info, u8 accType, void* buffer, u32 length, NANDCallback callback, + NANDCommandBlock* block) { return nandSafeOpenAsync(path, info, accType, buffer, length, callback, block, TRUE, FALSE); } -s32 nandSafeOpenAsync(const char* path, NANDFileInfo* info, u8 accType, void* buffer, u32 length, NANDCallback callback, NANDCommandBlock* block, BOOL hasPrivateAccess, BOOL isSimple) { +s32 nandSafeOpenAsync(const char* path, NANDFileInfo* info, u8 accType, void* buffer, u32 length, NANDCallback callback, NANDCommandBlock* block, + BOOL hasPrivateAccess, BOOL isSimple) { if (!nandIsInitialized()) { return NAND_RESULT_FATAL_ERROR; } @@ -443,7 +427,7 @@ s32 nandSafeOpenAsync(const char* path, NANDFileInfo* info, u8 accType, void* bu if (isSimple && (length & 0x3FFF) != 0) { return NAND_RESULT_INVALID; } - + info->accType = accType; info->stage = 0; block->simpleFlag = isSimple; @@ -461,12 +445,10 @@ s32 nandSafeOpenAsync(const char* path, NANDFileInfo* info, u8 accType, void* bu if (fd == ISFS_ERROR_OK) { return NAND_RESULT_OK; - } - else { + } else { return nandConvertErrorCode(fd); } - } - else if (accType == ISFS_ACCESS_WRITE || accType == ISFS_ACCESS_RW) { + } else if (accType == ISFS_ACCESS_WRITE || accType == ISFS_ACCESS_RW) { ISFSError ret = ISFS_ERROR_UNKNOWN; block->fileInfo = info; block->callback = callback; @@ -474,15 +456,13 @@ s32 nandSafeOpenAsync(const char* path, NANDFileInfo* info, u8 accType, void* bu block->copyBuf = buffer; block->bufLength = length; ret = ISFS_CreateDirAsync("/tmp/sys", 0, ISFS_ACCESS_RW, ISFS_ACCESS_RW, ISFS_ACCESS_RW, nandSafeOpenCallback, block); - + if (ret == ISFS_ERROR_OK) { return NAND_RESULT_OK; - } - else { + } else { return nandConvertErrorCode(ret); } - } - else { + } else { return NAND_RESULT_INVALID; } } @@ -505,80 +485,66 @@ void nandSafeOpenCallback(ISFSError result, void* arg) { if (block->state == NAND_STATE_OPEN_FILE && block->simpleFlag) { block->state += (NAND_STATE_CREATE_TEMP - NAND_STATE_OPEN_FILE); - } - else { + } else { ++block->state; } if (block->state == NAND_STATE_GET_ATTR) { - ret = ISFS_GetAttrAsync(info->origPath, &block->ownerId, &block->groupId, &block->attr, &block->ownerAcc, &block->groupAcc, &block->othersAcc, nandSafeOpenCallback, arg); - } - else if (block->state == NAND_STATE_OPEN_FILE) { + ret = ISFS_GetAttrAsync(info->origPath, &block->ownerId, &block->groupId, &block->attr, &block->ownerAcc, &block->groupAcc, + &block->othersAcc, nandSafeOpenCallback, arg); + } else if (block->state == NAND_STATE_OPEN_FILE) { ret = ISFS_OpenAsync(info->origPath, ISFS_ACCESS_READ, nandSafeOpenCallback, arg); - } - else if (block->state == NAND_STATE_CREATE_TEMP_DIR) { + } else if (block->state == NAND_STATE_CREATE_TEMP_DIR) { char tmpDir[NAND_MAX_PATH]; block->uniqueNo = nandGetUniqueNumber(); sprintf(tmpDir, "%s/%08x", "/tmp/sys", block->uniqueNo); ret = ISFS_CreateDirAsync(tmpDir, 0, ISFS_ACCESS_RW, ISFS_ACCESS_NONE, ISFS_ACCESS_NONE, nandSafeOpenCallback, arg); - } - else if (block->state == NAND_STATE_CREATE_TEMP) { + } else if (block->state == NAND_STATE_CREATE_TEMP) { char filename[13]; nandGetRelativeName(filename, info->origPath); if (!block->simpleFlag) { info->stage = NAND_STATE_CREATE_TEMP_DIR; sprintf(info->tmpPath, "%s/%08x/%s", "/tmp/sys", block->uniqueNo, filename); - } - else { + } else { sprintf(info->tmpPath, "%s/%s", "/tmp/sys", filename); } ret = ISFS_CreateFileAsync(info->tmpPath, block->attr, block->ownerAcc, block->groupAcc, block->othersAcc, nandSafeOpenCallback, arg); - } - else if (block->state == NAND_STATE_OPEN_TEMP_FILE) { + } else if (block->state == NAND_STATE_OPEN_TEMP_FILE) { info->stage = NAND_STATE_CREATE_TEMP; if (info->accType == ISFS_ACCESS_WRITE) { ret = ISFS_OpenAsync(info->tmpPath, ISFS_ACCESS_WRITE, nandSafeOpenCallback, arg); - } - else if (info->accType == ISFS_ACCESS_RW) { + } else if (info->accType == ISFS_ACCESS_RW) { ret = ISFS_OpenAsync(info->tmpPath, ISFS_ACCESS_RW, nandSafeOpenCallback, arg); - } - else { + } else { ret = ISFS_ERROR_UNKNOWN; } - } - else if (block->state == NAND_STATE_READ_FILE) { + } else if (block->state == NAND_STATE_READ_FILE) { info->fileDescriptor = result; info->stage = 5; block->state = NAND_STATE_READ_FILE_2; ret = ISFS_ReadAsync(info->origFd, block->copyBuf, block->bufLength, nandSafeOpenCallback, arg); - } - else if (block->state == NAND_STATE_READ_FILE_2) { + } else if (block->state == NAND_STATE_READ_FILE_2) { ret = ISFS_ReadAsync(info->origFd, block->copyBuf, block->bufLength, nandSafeOpenCallback, arg); - } - else if (block->state == NAND_STATE_WRITE_FILE) { + } else if (block->state == NAND_STATE_WRITE_FILE) { if (result > 0) { block->state = NAND_STATE_READ_FILE; ret = ISFS_WriteAsync(info->fileDescriptor, block->copyBuf, (u32)result, nandSafeOpenCallback, arg); - } - else if (result == ISFS_ERROR_OK) { + } else if (result == ISFS_ERROR_OK) { ret = ISFS_SeekAsync(info->fileDescriptor, 0, 0, nandSafeOpenCallback, arg); } - } - else if (block->state == NAND_STATE_9) { + } else if (block->state == NAND_STATE_9) { if (result == ISFS_ERROR_OK) { if (!block->simpleFlag) { info->mark = 3; - } - else { + } else { info->mark = 5; } block->callback(nandConvertErrorCode(ISFS_ERROR_OK), block); - } - else { + } else { block->callback(nandConvertErrorCode(result), block); } @@ -588,8 +554,7 @@ void nandSafeOpenCallback(ISFSError result, void* arg) { if (ret != ISFS_ERROR_OK) { block->callback(nandConvertErrorCode(ret), block); } - } - else { + } else { block->callback(nandConvertErrorCode(result), block); } } @@ -603,14 +568,12 @@ void nandReadOpenCallback(ISFSError result, void* arg) { if (!block->simpleFlag) { ((NANDFileInfo*)block->fileInfo)->mark = 3; - } - else { + } else { ((NANDFileInfo*)block->fileInfo)->mark = 5; } block->callback(NAND_RESULT_OK, block); - } - else { + } else { block->callback(nandConvertErrorCode(result), block); } } @@ -636,14 +599,12 @@ s32 nandSafeCloseAsync(NANDFileInfo* info, NANDCallback callback, NANDCommandBlo block->fileInfo = info; block->callback = callback; err = ISFS_CloseAsync(info->fileDescriptor, nandReadCloseCallback, block); - } - else if (info->accType == ISFS_ACCESS_WRITE || info->accType == ISFS_ACCESS_RW) { + } else if (info->accType == ISFS_ACCESS_WRITE || info->accType == ISFS_ACCESS_RW) { block->fileInfo = info; block->callback = callback; block->state = NAND_STATE_10; err = ISFS_CloseAsync(info->fileDescriptor, nandSafeCloseCallback, block); - } - else { + } else { err = ISFS_ERROR_INVALID; } @@ -663,25 +624,21 @@ void nandSafeCloseCallback(ISFSError result, void* arg) { if ((block->state == NAND_STATE_12) && block->simpleFlag) { block->state += (NAND_STATE_14 - NAND_STATE_12); - } - else { + } else { ++block->state; } if (block->state == NAND_STATE_11) { info->stage = NAND_STATE_READ_FILE; ret = ISFS_CloseAsync(info->origFd, nandSafeCloseCallback, arg); - } - else if (block->state == NAND_STATE_12) { + } else if (block->state == NAND_STATE_12) { info->stage = NAND_STATE_READ_FILE_2; ret = ISFS_RenameAsync(info->tmpPath, info->origPath, nandSafeCloseCallback, arg); - } - else if (block->state == NAND_STATE_13) { + } else if (block->state == NAND_STATE_13) { char tmpdir[NAND_MAX_PATH] = ""; nandGetParentDirectory(tmpdir, info->tmpPath); ret = ISFS_DeleteAsync(tmpdir, nandSafeCloseCallback, arg); - } - else if (block->state == NAND_STATE_14) { + } else if (block->state == NAND_STATE_14) { if (!block->simpleFlag) { info->stage = 9; } @@ -694,8 +651,7 @@ void nandSafeCloseCallback(ISFSError result, void* arg) { if (ret != ISFS_ERROR_OK) { block->callback(nandConvertErrorCode(ret), block); } - } - else { + } else { block->callback(nandConvertErrorCode(result), block); } } @@ -707,7 +663,7 @@ static void nandReadCloseCallback(ISFSError result, void* arg) { ((NANDFileInfo*)block->fileInfo)->stage = 7; ((NANDFileInfo*)block->fileInfo)->mark = 4; } - + block->callback(nandConvertErrorCode(result), block); } @@ -718,7 +674,7 @@ static void nandCloseCallback(ISFSError result, void* arg) { ((NANDFileInfo*)block->fileInfo)->stage = 7; ((NANDFileInfo*)block->fileInfo)->mark = 2; } - + block->callback(nandConvertErrorCode(result), block); } diff --git a/libs/RVL_SDK/src/nand/NANDSecret.c b/libs/RVL_SDK/src/nand/NANDSecret.c index f9ba37f5..1251b236 100644 --- a/libs/RVL_SDK/src/nand/NANDSecret.c +++ b/libs/RVL_SDK/src/nand/NANDSecret.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -8,8 +8,7 @@ s32 NANDSecretGetUsage(const char* path, u32* usedBlocks, u32* usedINodes) { if (!nandIsInitialized()) { return NAND_RESULT_FATAL_ERROR; - } - else { + } else { char absPath[NAND_MAX_PATH] = ""; nandGenerateAbsPath(absPath, path); return nandConvertErrorCode(ISFS_GetUsage(absPath, usedBlocks, usedINodes)); @@ -26,22 +25,24 @@ s32 NANDSecretGetFileSystemStatus(NANDFileSystemStatus* status) { result = ISFS_GetStats(&isfsStatus); if (result == ISFS_ERROR_OK) { - status->blockSize = isfsStatus.blockSize; - status->freeBlocks = isfsStatus.freeBlocks; - status->usedBlocks = isfsStatus.usedBlocks; - status->badBlocks = isfsStatus.badBlocks; - status->reservedBlocks = isfsStatus.reservedBlocks; - status->freeInodes = isfsStatus.freeInodes; - status->usedInodes = isfsStatus.usedInodes; + status->blockSize = isfsStatus.blockSize; + status->freeBlocks = isfsStatus.freeBlocks; + status->usedBlocks = isfsStatus.usedBlocks; + status->badBlocks = isfsStatus.badBlocks; + status->reservedBlocks = isfsStatus.reservedBlocks; + status->freeInodes = isfsStatus.freeInodes; + status->usedInodes = isfsStatus.usedInodes; } return nandConvertErrorCode(result); } -s32 NANDSecretGetSystemAvailableArea(const NANDFileSystemStatus* status, u32 usedSystemBlocks, u32 usedSystemINodes, u32* freeSystemBlocks, u32* freeSystemINode) { +s32 NANDSecretGetSystemAvailableArea(const NANDFileSystemStatus* status, u32 usedSystemBlocks, u32 usedSystemINodes, u32* freeSystemBlocks, + u32* freeSystemINode) { if (usedSystemBlocks <= NAND_MAX_USER_BLOCKS && usedSystemINodes <= NAND_MAX_USER_INODES) { if (freeSystemBlocks != NULL) { - *freeSystemBlocks = (NAND_MAX_SYSTEM_BLOCKS) - (status->badBlocks + status->reservedBlocks + NAND_CRITICAL_BLOCKS) - (status->usedBlocks - usedSystemBlocks); + *freeSystemBlocks = (NAND_MAX_SYSTEM_BLOCKS) - (status->badBlocks + status->reservedBlocks + NAND_CRITICAL_BLOCKS) - + (status->usedBlocks - usedSystemBlocks); } if (freeSystemINode != NULL) { *freeSystemINode = (NAND_MAX_SYSTEM_INODES) - (status->usedInodes - usedSystemINodes); diff --git a/libs/RVL_SDK/src/nand/nand.c b/libs/RVL_SDK/src/nand/nand.c index 16a75e2b..41c0c651 100644 --- a/libs/RVL_SDK/src/nand/nand.c +++ b/libs/RVL_SDK/src/nand/nand.c @@ -1,12 +1,12 @@ -#include #include +#include #include #include -#include #include +#include static BOOL nandInspectPermission(u8 perm); static void nandSplitPerm(u8 perm, u32* owner, u32* group, u32* others); @@ -14,24 +14,21 @@ static void nandSplitPerm(u8 perm, u32* owner, u32* group, u32* others); static void nandGetStatusCallback(ISFSError result, void* arg); static ISFSError nandCreate(const char* path, u8 perm, u8 attr, NANDCommandBlock* block, BOOL isAsync, BOOL hasPrivateAccess) { - char absPath[NAND_MAX_PATH] = ""; - u32 owner = 0, group = 0, others = 0; + char absPath[NAND_MAX_PATH] = ""; + u32 owner = 0, group = 0, others = 0; nandGenerateAbsPath(absPath, path); if (!hasPrivateAccess && nandIsPrivatePath(absPath)) { return ISFS_ERROR_ACCESS; - } - else if (!nandInspectPermission(perm)) { + } else if (!nandInspectPermission(perm)) { return ISFS_ERROR_INVALID; - } - else { + } else { nandSplitPerm(perm, &owner, &group, &others); if (isAsync) { return ISFS_CreateFileAsync(absPath, attr, owner, group, others, nandCallback, block); - } - else { + } else { return ISFS_CreateFile(absPath, attr, owner, group, others); } } @@ -65,12 +62,10 @@ static ISFSError nandDelete(const char* path, NANDCommandBlock* block, BOOL isAs if (!hasPrivateAccess && nandIsPrivatePath(absPath)) { return ISFS_ERROR_ACCESS; - } - else { + } else { if (isAsync) { return ISFS_DeleteAsync(absPath, nandCallback, block); - } - else { + } else { return ISFS_Delete(absPath); } } @@ -151,8 +146,7 @@ static ISFSError nandSeek(IOSFd fd, s32 offset, s32 whence, NANDCommandBlock* bl if (isAsync) { return ISFS_SeekAsync(fd, offset, where, nandCallback, block); - } - else { + } else { return ISFS_Seek(fd, offset, where); } } @@ -178,12 +172,10 @@ static ISFSError nandReadDir(const char* path, char* nameList, u32* num, NANDCom nandGenerateAbsPath(absPath, path); if (!hasPrivateAccess && nandIsPrivatePath(absPath)) { return ISFS_ERROR_ACCESS; - } - else { + } else { if (isAsync) { return ISFS_ReadDirAsync(absPath, nameList, num, nandCallback, block); - } - else { + } else { return ISFS_ReadDir(absPath, nameList, num); } } @@ -196,7 +188,6 @@ s32 NANDReadDir(const char* path, char* nameList, u32* num) { return nandConvertErrorCode(nandReadDir(path, nameList, num, NULL, FALSE, FALSE)); } - s32 NANDPrivateReadDir(const char* path, char* nameList, u32* num) { if (!nandIsInitialized()) { return NAND_RESULT_FATAL_ERROR; @@ -210,18 +201,15 @@ static ISFSError nandCreateDir(const char* path, u8 perm, u8 attr, NANDCommandBl nandGenerateAbsPath(absPath, path); if (!hasPrivateAccess && nandIsPrivatePath(absPath)) { return ISFS_ERROR_ACCESS; - } - else if (!nandInspectPermission(perm)) { + } else if (!nandInspectPermission(perm)) { return ISFS_ERROR_INVALID; - } - else { + } else { u32 owner = 0, group = 0, others = 0; nandSplitPerm(perm, &owner, &group, &others); if (isAsync) { return ISFS_CreateDirAsync(absPath, attr, owner, group, others, nandCallback, block); - } - else { + } else { return ISFS_CreateDir(absPath, attr, owner, group, others); } } @@ -250,29 +238,26 @@ s32 NANDPrivateCreateDirAsync(const char* path, u8 perm, u8 attr, NANDCallback c } static ISFSError nandMove(const char* path, const char* destDir, NANDCommandBlock* block, BOOL isAsync, BOOL hasPrivateAccess) { - char absOldPath[NAND_MAX_PATH] = ""; - char absNewPath[NAND_MAX_PATH] = ""; - char relativeName[NAND_MAX_DIR_PATH+1] = ""; + char absOldPath[NAND_MAX_PATH] = ""; + char absNewPath[NAND_MAX_PATH] = ""; + char relativeName[NAND_MAX_DIR_PATH + 1] = ""; nandGenerateAbsPath(absOldPath, path); nandGetRelativeName(relativeName, absOldPath); nandGenerateAbsPath(absNewPath, destDir); if (strcmp(absNewPath, "/") == 0) { sprintf(absNewPath, "/%s", relativeName); - } - else { + } else { strcat(absNewPath, "/"); strcat(absNewPath, relativeName); } if (!hasPrivateAccess && (nandIsPrivatePath(absOldPath) || nandIsPrivatePath(absNewPath))) { return ISFS_ERROR_ACCESS; - } - else { + } else { if (isAsync) { return ISFS_RenameAsync(absOldPath, absNewPath, nandCallback, block); - } - else { + } else { return ISFS_Rename(absOldPath, absNewPath); } } @@ -286,8 +271,8 @@ s32 NANDPrivateMove(const char* path, const char* destDir) { } static ISFSError nandGetFileStatus(IOSFd fd, u32* length, u32* pos) { - ISFSFileStats isfsStats ALIGN32; - ISFSError ret = ISFS_GetFileStats(fd, &isfsStats); + ISFSFileStats isfsStats ALIGN32; + ISFSError ret = ISFS_GetFileStats(fd, &isfsStats); if (ret == ISFS_ERROR_OK) { if (length) { @@ -316,8 +301,8 @@ s32 NANDTell(NANDFileInfo* info, u32* pos) { } static void nandGetFileStatusAsyncCallback(ISFSError result, void* arg) { - NANDCommandBlock* block = (NANDCommandBlock*)arg; - ISFSFileStats* isfsStats = (ISFSFileStats *)OSRoundUp32B((u32)block->absPath); + NANDCommandBlock* block = (NANDCommandBlock*)arg; + ISFSFileStats* isfsStats = (ISFSFileStats*)OSRoundUp32B((u32)block->absPath); if (result == ISFS_ERROR_OK) { if (block->length) { @@ -332,8 +317,8 @@ static void nandGetFileStatusAsyncCallback(ISFSError result, void* arg) { } static ISFSError nandGetFileStatusAsync(IOSFd fd, NANDCommandBlock* block) { - ISFSError result = ISFS_ERROR_UNKNOWN; - ISFSFileStats* isfsStats = (ISFSFileStats*)OSRoundUp32B((u32)block->absPath); + ISFSError result = ISFS_ERROR_UNKNOWN; + ISFSFileStats* isfsStats = (ISFSFileStats*)OSRoundUp32B((u32)block->absPath); return ISFS_GetFileStatsAsync(fd, isfsStats, nandGetFileStatusAsyncCallback, block); } @@ -401,18 +386,17 @@ static void nandSplitPerm(u8 perm, u32* owner, u32* group, u32* others) { } } -static ISFSError nandGetStatus(const char* path, NANDStatus *status, NANDCommandBlock* block, BOOL isAsync, BOOL hasPrivateAccess) { +static ISFSError nandGetStatus(const char* path, NANDStatus* status, NANDCommandBlock* block, BOOL isAsync, BOOL hasPrivateAccess) { char absPath[NAND_MAX_PATH] = ""; nandGenerateAbsPath(absPath, path); if (!hasPrivateAccess && nandIsUnderPrivatePath(absPath)) { return ISFS_ERROR_ACCESS; - } - else { + } else { if (isAsync) { - return ISFS_GetAttrAsync(absPath, &status->ownerId, &status->groupId, &block->attr, &block->ownerAcc, &block->groupAcc, &block->othersAcc, nandGetStatusCallback, block); - } - else { + return ISFS_GetAttrAsync(absPath, &status->ownerId, &status->groupId, &block->attr, &block->ownerAcc, &block->groupAcc, &block->othersAcc, + nandGetStatusCallback, block); + } else { u32 attr = 0; u32 owner = 0, group = 0, others = 0; ISFSError result = ISFS_GetAttr(absPath, &status->ownerId, &status->groupId, &attr, &owner, &group, &others); @@ -428,21 +412,21 @@ static ISFSError nandGetStatus(const char* path, NANDStatus *status, NANDCommand static void nandGetStatusCallback(ISFSError result, void* arg) { NANDCommandBlock* block = (NANDCommandBlock*)arg; if (result == ISFS_ERROR_OK) { - NANDStatus *status = (NANDStatus*)block->status; + NANDStatus* status = (NANDStatus*)block->status; status->attribute = block->attr; nandComposePerm(&status->permission, block->ownerAcc, block->groupAcc, block->othersAcc); } block->callback(nandConvertErrorCode(result), block); } -s32 NANDGetStatus(const char* path, NANDStatus *status) { +s32 NANDGetStatus(const char* path, NANDStatus* status) { if (!nandIsInitialized()) { return NAND_RESULT_FATAL_ERROR; } return nandConvertErrorCode(nandGetStatus(path, status, NULL, FALSE, FALSE)); } -s32 NANDPrivateGetStatus(const char* path, NANDStatus *status) { +s32 NANDPrivateGetStatus(const char* path, NANDStatus* status) { if (!nandIsInitialized()) { return NAND_RESULT_FATAL_ERROR; } @@ -459,22 +443,19 @@ s32 NANDPrivateGetStatusAsync(const char* path, NANDStatus* status, NANDCallback } static ISFSError nandSetStatus(const char* path, const NANDStatus* status, NANDCommandBlock* block, BOOL isAsync, BOOL hasPrivateAccess) { - char absPath[NAND_MAX_PATH]=""; + char absPath[NAND_MAX_PATH] = ""; nandGenerateAbsPath(absPath, path); if (!hasPrivateAccess && nandIsPrivatePath(absPath)) { return ISFS_ERROR_ACCESS; - } - else if (!nandInspectPermission(status->permission)) { + } else if (!nandInspectPermission(status->permission)) { return ISFS_ERROR_INVALID; - } - else { + } else { u32 owner = 0, group = 0, others = 0; nandSplitPerm(status->permission, &owner, &group, &others); if (isAsync) { return ISFS_SetAttrAsync(absPath, status->ownerId, status->groupId, (u8)(status->attribute), owner, group, others, nandCallback, block); - } - else { + } else { return ISFS_SetAttr(absPath, status->ownerId, status->groupId, (u8)(status->attribute), owner, group, others); } } @@ -487,7 +468,6 @@ s32 NANDSetStatus(const char* path, NANDStatus* status) { return nandConvertErrorCode(nandSetStatus(path, status, NULL, FALSE, FALSE)); } - s32 NANDPrivateSetStatus(const char* path, NANDStatus* status) { if (!nandIsInitialized()) { return NAND_RESULT_FATAL_ERROR; @@ -506,8 +486,7 @@ void* NANDGetUserData(NANDCommandBlock* block) { static BOOL nandInspectPermission(u8 perm) { if (perm & NAND_PERM_USER_READ) { return TRUE; - } - else { + } else { return FALSE; } } diff --git a/libs/RVL_SDK/src/os/OS.c b/libs/RVL_SDK/src/os/OS.c index 467bb7cc..21a649e4 100644 --- a/libs/RVL_SDK/src/os/OS.c +++ b/libs/RVL_SDK/src/os/OS.c @@ -1,13 +1,15 @@ #include +#include #include #include -#include + #include -#include #include +#include + #include @@ -28,38 +30,37 @@ SDKDefineVersion(OS, "Apr 20 2010", "11:20:43"); - /* Linker generated */ -extern u8 __ArenaHi[]; -extern u8 __ArenaLo[]; +extern u8 __ArenaHi[]; +extern u8 __ArenaLo[]; -OSExecParams __OSRebootParams; +OSExecParams __OSRebootParams; -OSTime __OSStartTime; +OSTime __OSStartTime; -static OSBootInfo* volatile BootInfo; +static OSBootInfo* volatile BootInfo; -static u32* BI2DebugFlag; -static u32 BI2DebugFlagHolder; +static u32* BI2DebugFlag; +static u32 BI2DebugFlagHolder; -static char GameNameBuffer[4+1]; +static char GameNameBuffer[4 + 1]; -static f64 ZeroF; -static f32 ZeroPS[2]; +static f64 ZeroF; +static f32 ZeroPS[2]; -static DVDDriveInfo DriveInfo; -static DVDCommandBlock DriveBlock; +static DVDDriveInfo DriveInfo; +static DVDCommandBlock DriveBlock; -__OSExceptionHandler* OSExceptionTable; +__OSExceptionHandler* OSExceptionTable; -extern u32 __PADSpec; +extern u32 __PADSpec; -extern u32 __DVDLongFileNameFlag; +extern u32 __DVDLongFileNameFlag; -static BOOL AreWeInitialized; +static BOOL AreWeInitialized; -BOOL __OSIsGcam; -BOOL __OSInNandBoot, __OSInIPL; +BOOL __OSIsGcam; +BOOL __OSInNandBoot, __OSInIPL; void __OSEVStart(); void __OSEVEnd(); @@ -78,10 +79,11 @@ void __OSDBJUMPEND(); void OSDefaultExceptionHandler(u8 type, register OSContext* context); -#define OSArenaSize() ((u32)OSGetArenaHi() - (u32)OSGetArenaLo()) -#define OSMEM2ArenaSize() ((u32)OSGetMEM2ArenaHi() - (u32)OSGetMEM2ArenaLo()) +#define OSArenaSize() ((u32)OSGetArenaHi() - (u32)OSGetArenaLo()) +#define OSMEM2ArenaSize() ((u32)OSGetMEM2ArenaHi() - (u32)OSGetMEM2ArenaLo()) asm void __OSFPRInit() { + // clang-format off #ifdef __MWERKS__ nofralloc @@ -168,6 +170,7 @@ skipPairedSingleInit: blr #endif // __MWERKS__ + // clang-format on } u32 __OSGetHollywoodRev() { @@ -270,40 +273,35 @@ u32 OSGetConsoleType() { case HOLLYWOOD_ES_1_0: { if (gddrSize == 0x4000000) { return OS_CONSOLE_RVL_PP_0; - } - else { + } else { return OS_CONSOLE_NDEV_1_0; } } case HOLLYWOOD_ES_1_1: if (gddrSize == 0x4000000) { return OS_CONSOLE_RVL_PP_1; - } - else { + } else { return OS_CONSOLE_NDEV_1_1; } case HOLLYWOOD_ES_1_2: if (gddrSize == 0x4000000) { return OS_CONSOLE_RVL_PP_2_1; - } - else { + } else { return OS_CONSOLE_NDEV_1_2; } case HOLLYWOOD_ES_2_0: if (gddrSize == 0x4000000) { return OS_CONSOLE_RVL_PP_2_2; - } - else { + } else { return OS_CONSOLE_NDEV_2_0; } case HOLLYWOOD_ES_2_1: if (gddrSize == 0x4000000) { return OS_CONSOLE_RETAIL; - } - else { + } else { return OS_CONSOLE_NDEV_2_1; } } @@ -311,8 +309,7 @@ u32 OSGetConsoleType() { if (hwRev > HOLLYWOOD_ES_2_1) { if (gddrSize == 0x4000000) { return OS_CONSOLE_RETAIL; - } - else { + } else { return OS_CONSOLE_NDEV_2_1; } } @@ -320,7 +317,7 @@ u32 OSGetConsoleType() { return BootInfo->consoleType; } -static void MemClear(void *base, u32 size) { +static void MemClear(void* base, u32 size) { void* lastBase = (size > 0x40000) ? (void*)((u32)base + (size - 0x40000)) : base; DCZeroRange(base, size); DCFlushRange(lastBase, 0x40000); @@ -329,19 +326,16 @@ static void MemClear(void *base, u32 size) { static void ClearArena() NO_INLINE { if (!((OSGetResetCode() >> 31) & 1)) { MemClear(OSGetArenaLo(), OSArenaSize()); - } - else { + } else { if (__OSRebootParams.regionStart == NULL || !OSIsMEM1Region(__OSRebootParams.regionStart)) { MemClear(OSGetArenaLo(), OSArenaSize()); - } - else { + } else { if (OSGetArenaLo() < __OSRebootParams.regionStart) { if (OSGetArenaHi() <= __OSRebootParams.regionStart) { MemClear(OSGetArenaLo(), OSArenaSize()); - } - else { + } else { MemClear(OSGetArenaLo(), (u32)__OSRebootParams.regionStart - (u32)OSGetArenaLo()); - + if (OSGetArenaHi() > __OSRebootParams.regionEnd) { MemClear(__OSRebootParams.regionEnd, (u32)OSGetArenaHi() - (u32)__OSRebootParams.regionEnd); } @@ -354,17 +348,14 @@ static void ClearArena() NO_INLINE { static void ClearMEM2Arena() NO_INLINE { if (!((OSGetResetCode() >> 31) & 1)) { MemClear(OSGetMEM2ArenaLo(), OSMEM2ArenaSize()); - } - else { + } else { if (__OSRebootParams.regionStart == NULL || !OSIsMEM2Region(__OSRebootParams.regionStart)) { MemClear(OSGetMEM2ArenaLo(), OSMEM2ArenaSize()); - } - else { + } else { if (OSGetMEM2ArenaLo() < __OSRebootParams.regionStart) { if (OSGetMEM2ArenaHi() <= __OSRebootParams.regionStart) { MemClear(OSGetMEM2ArenaLo(), OSMEM2ArenaSize()); - } - else { + } else { MemClear(OSGetMEM2ArenaLo(), (u32)__OSRebootParams.regionStart - (u32)OSGetMEM2ArenaLo()); if (OSGetMEM2ArenaHi() > __OSRebootParams.regionEnd) { @@ -376,14 +367,14 @@ static void ClearMEM2Arena() NO_INLINE { } } -void InquiryCallback(s32 res, DVDCommandBlock *block) { +void InquiryCallback(s32 res, DVDCommandBlock* block) { switch (block->state) { case DVD_STATE_IDLE: { __OSDeviceCode = DriveInfo.deviceCode | DVD_DEVICE_CODE; break; } default: { - __OSDeviceCode = (1<<0); + __OSDeviceCode = (1 << 0); break; } } @@ -463,7 +454,7 @@ static void ReportOSInfo() { break; } case OS_CONSOLE_TDEV_EMU: { - OSReport("TDEV-based emulation HW%d\n", (consoleType & ~OS_CONSOLE_MASK/*???*/) - 3); + OSReport("TDEV-based emulation HW%d\n", (consoleType & ~OS_CONSOLE_MASK /*???*/) - 3); break; } default: { @@ -475,7 +466,7 @@ static void ReportOSInfo() { // Print IOS revision __OSGetIOSRev(&ios); OSReport("Firmware : %d.%d.%d ", ios.major, ios.minor, ios.micro); - OSReport("(%d/%d/%d)\n", ios.month, ios.date, ios.year); + OSReport("(%d/%d/%d)\n", ios.month, ios.date, ios.year); // Print total available memory sysMemSize = (OSGetConsoleSimulatedMem1Size() + OSGetConsoleSimulatedMem2Size()); @@ -550,7 +541,7 @@ void OSInit() { PPCMtpmc2(0); PPCMtpmc3(0); PPCMtpmc4(0); - + // HID 4 PPCMthid4(HID4_H4A | HID4_SBE | HID4_PS1_CTL | (1 << 23) /*hmmm*/ | HID4_L2_CCFI); @@ -570,10 +561,9 @@ void OSInit() { BI2DebugFlag = (u32*)((u32)bi2StartAddr + BI2_OFFSET_DEBUGFLAG); __PADSpec = *(u32*)((u32)bi2StartAddr + BI2_OFFSET_PADSPEC); - *(u8*)OSPhysicalToCached(OS_ADDR_BI2_DEBUG_FLAG) = *BI2DebugFlag; - *(u8*)OSPhysicalToCached(OS_ADDR_BI2_PAD_SPEC) = __PADSpec; - } - else { + *(u8*)OSPhysicalToCached(OS_ADDR_BI2_DEBUG_FLAG) = *BI2DebugFlag; + *(u8*)OSPhysicalToCached(OS_ADDR_BI2_PAD_SPEC) = __PADSpec; + } else { if (((OSBootInfo*)OSPhysicalToCached(OS_ADDR_BOOT_INFO))->arenaHi != NULL) { BI2DebugFlagHolder = *(u8*)OSPhysicalToCached(OS_ADDR_BI2_DEBUG_FLAG); BI2DebugFlag = &BI2DebugFlagHolder; @@ -593,8 +583,7 @@ void OSInit() { if (BootInfo->arenaLo == NULL && BI2DebugFlag && *BI2DebugFlag < 2) { arenaAddr = (void*)OSRoundUp32B(_stack_addr); } - } - else { + } else { arenaAddr = (void*)0x80004000; } } @@ -619,8 +608,7 @@ void OSInit() { if (BI2DebugFlag && *BI2DebugFlag < 2) { arenaAddr = (void*)OSRoundUp32B(_stack_addr); } - } - else { + } else { if ((u32)arenaAddr >= 0x90000000 && (u32)arenaAddr < 0x90000800) { arenaAddr = (void*)0x90000800; } @@ -674,7 +662,8 @@ void OSInit() { SCInit(); - while (SCCheckStatus() == 1) {} + while (SCCheckStatus() == 1) { + } __OSInitNet(); } @@ -684,9 +673,8 @@ void OSInit() { DVDInit(); if (__OSIsGcam) { - __OSDeviceCode = (u16)(DVD_DEVICE_CODE | (1<<12)); - } - else if (!__OSDeviceCode) { + __OSDeviceCode = (u16)(DVD_DEVICE_CODE | (1 << 12)); + } else if (!__OSDeviceCode) { DCInvalidateRange(&DriveInfo, sizeof(DriveInfo)); DVDInquiryAsync(&DriveBlock, &DriveInfo, InquiryCallback); } @@ -702,32 +690,16 @@ void OSInit() { } } -static u32 __OSExceptionLocations[] = { - 0x100, - 0x200, - 0x300, - 0x400, - 0x500, - 0x600, - 0x700, - 0x800, - 0x900, - 0xC00, - 0xD00, - 0xF00, - 0x1300, - 0x1400, - 0x1700 -}; +static u32 __OSExceptionLocations[] = {0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700, 0x800, 0x900, 0xC00, 0xD00, 0xF00, 0x1300, 0x1400, 0x1700}; void OSExceptionInit() { __OSException excep; - u32* opCodeAddr = (u32*)__OSEVSetNumber; - u32 oldOpCode = *opCodeAddr; + u32* opCodeAddr = (u32*)__OSEVSetNumber; + u32 oldOpCode = *opCodeAddr; - u8* handlerStart = (u8*)__OSEVStart; - u32 handlerSize = __OSEVSize; + u8* handlerStart = (u8*)__OSEVStart; + u32 handlerSize = __OSEVSize; void* destAddr = (void*)OSPhysicalToCached(OS_ADDR_DB_INTEGRATOR_HOOK); @@ -750,8 +722,7 @@ void OSExceptionInit() { if (__DBIsExceptionMarked(excep)) { DBPrintf(">>> OSINIT: exception %d vectored to debugger\n", excep); memcpy((void*)__DBVECTOR, (void*)__OSDBJUMPSTART, __OSDBJUMPSIZE); - } - else { + } else { u32* ops = (u32*)__DBVECTOR; int cb; @@ -779,6 +750,7 @@ void OSExceptionInit() { } static asm void __OSDBIntegrator() { + // clang-format off #ifdef __MWERKS__ nofralloc @@ -797,15 +769,18 @@ entry __OSDBINTSTART blr entry __OSDBINTEND #endif // __MWERKS__ + // clang-format ob } static asm void __OSDBJump() { + // clang-format off #ifdef __MWERKS__ nofralloc entry __OSDBJUMPSTART bla OS_ADDR_DB_INTEGRATOR_HOOK entry __OSDBJUMPEND #endif // __MWERKS__ + // clang-format on } __OSExceptionHandler __OSSetExceptionHandler(__OSException ex, __OSExceptionHandler handler) { @@ -820,6 +795,7 @@ __OSExceptionHandler __OSGetExceptionHandler(__OSException ex) { } static asm void OSExceptionVector() { + // clang-format off #ifdef __MWERKS__ nofralloc entry __OSEVStart @@ -874,9 +850,11 @@ recover: entry __OSEVEnd nop #endif // __MWERKS__ + // clang-format on } asm void OSDefaultExceptionHandler(u8 type, register OSContext* context) { + // clang-format off #ifdef __MWERKS__ nofralloc @@ -906,6 +884,7 @@ asm void OSDefaultExceptionHandler(u8 type, register OSContext* context) { stwu r1, -8(r1) b __OSUnhandledException #endif // __MWERKS__ + // clang-format on } void __OSPSInit() { @@ -913,6 +892,7 @@ void __OSPSInit() { ICFlashInvalidate(); __sync(); + // clang-format off #ifdef __MWERKS__ asm { li r3, 0 @@ -926,13 +906,14 @@ void __OSPSInit() { mtspr GQR7, r3 } #endif // __MWERKS__ + // clang-format on } u32 __OSGetDIConfig() { return DI_READ_REG(DI_CONFIG) & 0b11111111; } -void OSRegisterVersion(const char *id) { +void OSRegisterVersion(const char* id) { OSReport("%s\n", id); } @@ -943,8 +924,7 @@ const char* OSGetAppGamename() { if (__OSInIPL) { appNameSrc = AppGameNameForSysMenu; - } - else if ((*appNameSrc < '0') || ('9' < *appNameSrc && *appNameSrc < 'A') || ('Z' < *appNameSrc)) { + } else if ((*appNameSrc < '0') || ('9' < *appNameSrc && *appNameSrc < 'A') || ('Z' < *appNameSrc)) { appNameSrc = (char*)OSPhysicalToCached(OS_ADDR_CURRENT_APP_NAME); } diff --git a/libs/RVL_SDK/src/os/OSAlarm.c b/libs/RVL_SDK/src/os/OSAlarm.c index 1c47f8ef..49abfe0c 100644 --- a/libs/RVL_SDK/src/os/OSAlarm.c +++ b/libs/RVL_SDK/src/os/OSAlarm.c @@ -1,5 +1,6 @@ -#include #include +#include + #include @@ -16,11 +17,9 @@ static void SetTimer(const OSAlarm* alarm) { if (timeLeft < 0) { PPCMtdec(0); - } - else if (timeLeft < 0x80000000) { + } else if (timeLeft < 0x80000000) { PPCMtdec(timeLeft); - } - else { + } else { PPCMtdec(0x7FFFFFFF); } } @@ -70,8 +69,7 @@ static void InsertAlarm(OSAlarm* alarm, OSTime end, OSAlarmHandler handler) { prev = alarm->prev; if (prev != NULL) { prev->next = alarm; - } - else { + } else { AlarmQueue.head = alarm; SetTimer(alarm); } @@ -86,8 +84,7 @@ static void InsertAlarm(OSAlarm* alarm, OSTime end, OSAlarmHandler handler) { if (prev != NULL) { prev->next = alarm; - } - else { + } else { AlarmQueue.tail = alarm; AlarmQueue.head = alarm; SetTimer(alarm); @@ -126,15 +123,13 @@ void OSCancelAlarm(OSAlarm* alarm) { next = alarm->next; if (next == NULL) { AlarmQueue.tail = alarm->prev; - } - else { + } else { next->prev = alarm->prev; } if (alarm->prev != NULL) { alarm->prev->next = next; - } - else { + } else { AlarmQueue.head = next; if (next != NULL) { SetTimer(next); @@ -169,8 +164,7 @@ static void DecrementerExceptionCallback(__OSException type, OSContext* context) AlarmQueue.head = next; if (next == NULL) { AlarmQueue.tail = NULL; - } - else { + } else { next->prev = NULL; } @@ -199,6 +193,7 @@ static void DecrementerExceptionCallback(__OSException type, OSContext* context) } static asm void DecrementerExceptionHandler(register __OSException exception, register OSContext* context) { + // clang-format off #ifdef __MWERKS__ nofralloc @@ -225,6 +220,7 @@ static asm void DecrementerExceptionHandler(register __OSException exception, re stwu r1, -0x08(r1) b DecrementerExceptionCallback #endif // __MWERKS__ + // clang-format on } void OSSetAlarmTag(OSAlarm* alarm, u32 tag) { diff --git a/libs/RVL_SDK/src/os/OSAlloc.c b/libs/RVL_SDK/src/os/OSAlloc.c index 0a5a489f..649ee2de 100644 --- a/libs/RVL_SDK/src/os/OSAlloc.c +++ b/libs/RVL_SDK/src/os/OSAlloc.c @@ -2,23 +2,23 @@ typedef struct HeapCell HeapCell; struct HeapCell { - HeapCell* prev; // 0x00 - HeapCell* next; // 0x04 - s32 size; // 0x08 + HeapCell* prev; // 0x00 + HeapCell* next; // 0x04 + s32 size; // 0x08 }; typedef struct HeapDesc { - s32 size; // 0x00 - HeapCell* free; // 0x04 - HeapCell* allocated; // 0x08 + s32 size; // 0x00 + HeapCell* free; // 0x04 + HeapCell* allocated; // 0x08 } HeapDesc; -static HeapDesc* HeapArray; -static int NumHeaps; +static HeapDesc* HeapArray; +static int NumHeaps; -static void *ArenaStart, *ArenaEnd; +static void *ArenaStart, *ArenaEnd; -volatile OSHeapHandle __OSCurrHeap = -1; +volatile OSHeapHandle __OSCurrHeap = -1; #define MAX_LEFT_SIZE 64 @@ -40,8 +40,7 @@ static HeapCell* DLExtract(HeapCell* list, HeapCell* cell) { if (cell->prev == NULL) { return cell->next; - } - else { + } else { cell->prev->next = cell->next; return list; } @@ -72,7 +71,7 @@ static HeapCell* DLInsert(HeapCell* list, HeapCell* cell) { } } } - + if (prev != NULL) { prev->next = cell; if ((u8*)prev + prev->size == (u8*)cell) { @@ -84,8 +83,7 @@ static HeapCell* DLInsert(HeapCell* list, HeapCell* cell) { } } return list; - } - else { + } else { return cell; } } @@ -114,8 +112,7 @@ void* OSAllocFromHeap(OSHeapHandle heap, u32 size) { if (leftSize < (u32)MAX_LEFT_SIZE) { desc->free = DLExtract(desc->free, cell); - } - else { + } else { cell->size = size; newCell = (HeapCell*)((u8*)cell + size); newCell->size = leftSize; @@ -128,8 +125,7 @@ void* OSAllocFromHeap(OSHeapHandle heap, u32 size) { if (newCell->prev != NULL) { newCell->prev->next = newCell; - } - else { + } else { desc->free = newCell; } } @@ -138,7 +134,7 @@ void* OSAllocFromHeap(OSHeapHandle heap, u32 size) { return (void*)((u8*)cell + DEFAULT_ALIGN); } -void OSFreeToHeap(OSHeapHandle heap, void *ptr) { +void OSFreeToHeap(OSHeapHandle heap, void* ptr) { HeapDesc* desc; HeapCell* cell; @@ -180,7 +176,7 @@ void* OSInitAlloc(void* arenaStart, void* arenaEnd, int maxHeaps) { return arenaStart; } -int OSCreateHeap(void *start, void *end) { +int OSCreateHeap(void* start, void* end) { OSHeapHandle heap; HeapDesc* desc; HeapCell* cell; diff --git a/libs/RVL_SDK/src/os/OSArena.c b/libs/RVL_SDK/src/os/OSArena.c index 8558c801..7bdc1a94 100644 --- a/libs/RVL_SDK/src/os/OSArena.c +++ b/libs/RVL_SDK/src/os/OSArena.c @@ -1,26 +1,50 @@ #include -void* __OSArenaLo = (void*)-1; -void* __OSArenaHi = NULL; +void* __OSArenaLo = (void*)-1; +void* __OSArenaHi = NULL; -static void* s_mem2ArenaLo = (void*)-1; -static void* s_mem2ArenaHi = NULL; +static void* s_mem2ArenaLo = (void*)-1; +static void* s_mem2ArenaHi = NULL; -void* OSGetMEM1ArenaHi() { return __OSArenaHi; } -void* OSGetMEM2ArenaHi() { return s_mem2ArenaHi; } -void* OSGetArenaHi() { return OSGetMEM1ArenaHi(); } +void* OSGetMEM1ArenaHi() { + return __OSArenaHi; +} +void* OSGetMEM2ArenaHi() { + return s_mem2ArenaHi; +} +void* OSGetArenaHi() { + return OSGetMEM1ArenaHi(); +} -void* OSGetMEM1ArenaLo() { return __OSArenaLo; } -void* OSGetMEM2ArenaLo() { return s_mem2ArenaLo; } -void* OSGetArenaLo() { return OSGetMEM1ArenaLo(); } +void* OSGetMEM1ArenaLo() { + return __OSArenaLo; +} +void* OSGetMEM2ArenaLo() { + return s_mem2ArenaLo; +} +void* OSGetArenaLo() { + return OSGetMEM1ArenaLo(); +} -void OSSetMEM1ArenaHi(void* hi) { __OSArenaHi = hi; } -void OSSetMEM2ArenaHi(void* hi) { s_mem2ArenaHi = hi; } -void OSSetArenaHi(void* hi) { OSSetMEM1ArenaHi(hi); } +void OSSetMEM1ArenaHi(void* hi) { + __OSArenaHi = hi; +} +void OSSetMEM2ArenaHi(void* hi) { + s_mem2ArenaHi = hi; +} +void OSSetArenaHi(void* hi) { + OSSetMEM1ArenaHi(hi); +} -void OSSetMEM1ArenaLo(void* lo) { __OSArenaLo = lo; } -void OSSetMEM2ArenaLo(void* lo) { s_mem2ArenaLo = lo; } -void OSSetArenaLo(void* lo) { OSSetMEM1ArenaLo(lo); } +void OSSetMEM1ArenaLo(void* lo) { + __OSArenaLo = lo; +} +void OSSetMEM2ArenaLo(void* lo) { + s_mem2ArenaLo = lo; +} +void OSSetArenaLo(void* lo) { + OSSetMEM1ArenaLo(lo); +} void* OSAllocFromMEM1ArenaLo(u32 size, u32 align) { u8* begin = PTR_ROUNDUP(OSGetMEM1ArenaLo(), align); diff --git a/libs/RVL_SDK/src/os/OSAudioSystem.c b/libs/RVL_SDK/src/os/OSAudioSystem.c index 997e6a13..aaac0402 100644 --- a/libs/RVL_SDK/src/os/OSAudioSystem.c +++ b/libs/RVL_SDK/src/os/OSAudioSystem.c @@ -6,107 +6,70 @@ #include #include "DSPInitCode.inc" -#define DSP_INIT_CODE_ADDR 0x01000000 -#define DSP_INIT_CODE_SIZE 0x80 +#define DSP_INIT_CODE_ADDR 0x01000000 +#define DSP_INIT_CODE_SIZE 0x80 extern BOOL __OSInIPL; static void waitMicroSec(int us) { OSTick t = OSGetTick(); - while (OSTicksToMicroseconds(OSGetTick() - t) < us); + while (OSTicksToMicroseconds(OSGetTick() - t) < us) + ; } void __AIClockInit(BOOL compatB) { u32 reg; reg = ACRIOP_READ_REG32(HW_COMPAT); - CLEAR_FLAG(reg, (1<<8)); - SET_FLAG(reg, (compatB<<8)); - CLEAR_FLAG(reg, (1<<7)); + CLEAR_FLAG(reg, (1 << 8)); + SET_FLAG(reg, (compatB << 8)); + CLEAR_FLAG(reg, (1 << 7)); ACRIOP_WRITE_REG32(HW_COMPAT, reg); reg = ACRIOP_READ_REG32(HW_PLLAIEXT); - CLEAR_FLAG(reg, (1< #include +#include + #include #include +// clang-format off + static asm void __OSLoadFPUContext(u32 dummy, register OSContext* fpucontext) { #ifdef __MWERKS__ nofralloc @@ -475,6 +478,8 @@ asm void OSInitContext(register OSContext* context, register u32 pc, register u3 #endif // __MWERKS__ } +// clang-format on + void OSDumpContext(OSContext* context) { u32 i; u32* sp; @@ -482,8 +487,7 @@ void OSDumpContext(OSContext* context) { OSReport("------------------------- Context 0x%08x -------------------------\n", context); for (i = 0; i < 16; i++) { - OSReport("r%-2d = 0x%08x (%14d) r%-2d = 0x%08x (%14d)\n", i, - context->gpr[i], context->gpr[i], i + 16, context->gpr[i + 16], + OSReport("r%-2d = 0x%08x (%14d) r%-2d = 0x%08x (%14d)\n", i, context->gpr[i], context->gpr[i], i + 16, context->gpr[i + 16], context->gpr[i + 16]); } @@ -497,9 +501,9 @@ void OSDumpContext(OSContext* context) { if (context->state & OS_CONTEXT_STATE_FPSAVED) { BOOL enabled = OSDisableInterrupts(); - - OSContext* currCtx = OSGetCurrentContext(); - OSContext temp; + + OSContext* currCtx = OSGetCurrentContext(); + OSContext temp; OSClearContext(&temp); OSSetCurrentContext(&temp); @@ -511,7 +515,7 @@ void OSDumpContext(OSContext* context) { OSReport("\n\nPSFs----------\n"); for (i = 0; i < 32; i += 2) { - OSReport("ps%d \t= 0x%x \t ps%d \t= 0x%x\n", i, (u32)context->psf[i], i+1, (u32)context->psf[i + 1]); + OSReport("ps%d \t= 0x%x \t ps%d \t= 0x%x\n", i, (u32)context->psf[i], i + 1, (u32)context->psf[i + 1]); } OSClearContext(&temp); @@ -525,6 +529,8 @@ void OSDumpContext(OSContext* context) { } } +// clang-format off + static asm void OSSwitchFPUContext(register u8 err, register OSContext* context) { #ifdef __MWERKS__ nofralloc @@ -661,3 +667,5 @@ _return: blr #endif // __MWERKS__ } + +// clang-format on diff --git a/libs/RVL_SDK/src/os/OSError.c b/libs/RVL_SDK/src/os/OSError.c index de7f3418..50005742 100644 --- a/libs/RVL_SDK/src/os/OSError.c +++ b/libs/RVL_SDK/src/os/OSError.c @@ -1,5 +1,6 @@ -#include #include +#include + #include @@ -8,9 +9,9 @@ #include -OSErrorHandler __OSErrorTable[OS_EXCEPTION_MAX]; +OSErrorHandler __OSErrorTable[OS_EXCEPTION_MAX]; -u32 __OSFpscrEnableBits = FPSCR_ENABLE; +u32 __OSFpscrEnableBits = FPSCR_ENABLE; void OSReport(const char* msg, ...) { va_list marker; @@ -49,7 +50,7 @@ OSErrorHandler OSSetErrorHandler(OSError error, OSErrorHandler handler) { BOOL enabled = OSDisableInterrupts(); u32 msr, fpscr; - + int i; oldHandler = __OSErrorTable[error]; @@ -72,28 +73,24 @@ OSErrorHandler OSSetErrorHandler(OSError error, OSErrorHandler handler) { thread->context.fpscr = FPSCR_NI; } SET_FLAG(thread->context.fpscr, OS_FPSCR_ENABLE); - CLEAR_FLAG(thread->context.fpscr, FPSCR_VXVC | FPSCR_VXIMZ | FPSCR_VXZDZ | FPSCR_VXIDI | FPSCR_VXISI | - FPSCR_VXSNAN | FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI | FPSCR_XX | - FPSCR_ZX | FPSCR_UX | FPSCR_OX | FPSCR_FX | FPSCR_FI); + CLEAR_FLAG(thread->context.fpscr, FPSCR_VXVC | FPSCR_VXIMZ | FPSCR_VXZDZ | FPSCR_VXIDI | FPSCR_VXISI | FPSCR_VXSNAN | FPSCR_VXSOFT | + FPSCR_VXSQRT | FPSCR_VXCVI | FPSCR_XX | FPSCR_ZX | FPSCR_UX | FPSCR_OX | FPSCR_FX | FPSCR_FI); } SET_FLAG(fpscr, __OSFpscrEnableBits & FPSCR_ENABLE); SET_FLAG(msr, MSR_FE0 | MSR_FE1); - } - else { + } else { for (thread = __OSActiveThreadQueue.head; thread; thread = thread->linkActive.next) { - CLEAR_FLAG(thread->context.srr1, MSR_FE0 | MSR_FE1); + CLEAR_FLAG(thread->context.srr1, MSR_FE0 | MSR_FE1); CLEAR_FLAG(thread->context.fpscr, FPSCR_ENABLE); - CLEAR_FLAG(thread->context.fpscr, FPSCR_VXVC | FPSCR_VXIMZ | FPSCR_VXZDZ | FPSCR_VXIDI | FPSCR_VXISI | - FPSCR_VXSNAN | FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI | FPSCR_XX | - FPSCR_ZX | FPSCR_UX | FPSCR_OX | FPSCR_FX | FPSCR_FI); + CLEAR_FLAG(thread->context.fpscr, FPSCR_VXVC | FPSCR_VXIMZ | FPSCR_VXZDZ | FPSCR_VXIDI | FPSCR_VXISI | FPSCR_VXSNAN | FPSCR_VXSOFT | + FPSCR_VXSQRT | FPSCR_VXCVI | FPSCR_XX | FPSCR_ZX | FPSCR_UX | FPSCR_OX | FPSCR_FX | FPSCR_FI); } CLEAR_FLAG(fpscr, FPSCR_ENABLE); CLEAR_FLAG(msr, MSR_FE0 | MSR_FE1); } - CLEAR_FLAG(fpscr, FPSCR_VXVC | FPSCR_VXIMZ | FPSCR_VXZDZ | FPSCR_VXIDI | FPSCR_VXISI | - FPSCR_VXSNAN | FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI | FPSCR_XX | - FPSCR_ZX | FPSCR_UX | FPSCR_OX | FPSCR_FX | FPSCR_FI); + CLEAR_FLAG(fpscr, FPSCR_VXVC | FPSCR_VXIMZ | FPSCR_VXZDZ | FPSCR_VXIDI | FPSCR_VXISI | FPSCR_VXSNAN | FPSCR_VXSOFT | FPSCR_VXSQRT | + FPSCR_VXCVI | FPSCR_XX | FPSCR_ZX | FPSCR_UX | FPSCR_OX | FPSCR_FX | FPSCR_FI); PPCMtfpscr(fpscr); PPCMtmsr(msr); @@ -112,8 +109,7 @@ void __OSUnhandledException(__OSException exception, OSContext* context, u32 dsi if (!HAS_FLAG(context->srr1, MSR_RI)) { OSReport("Non-recoverable Exception %d", exception); - } - else { + } else { if (exception == OS_EXCEPTION_PROGRAM && (context->srr1 & SRR1_L2DP_BIT) && __OSErrorTable[OS_EXCEPTION_FLOATING_POINT_EXCEPTION] != NULL) { exception = OS_EXCEPTION_FLOATING_POINT_EXCEPTION; @@ -125,9 +121,8 @@ void __OSUnhandledException(__OSException exception, OSContext* context, u32 dsi } fpscr = PPCMffpscr(); - CLEAR_FLAG(fpscr, FPSCR_VXVC | FPSCR_VXIMZ | FPSCR_VXZDZ | FPSCR_VXIDI | FPSCR_VXISI | - FPSCR_VXSNAN | FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI | FPSCR_XX | - FPSCR_ZX | FPSCR_UX | FPSCR_OX | FPSCR_FX | FPSCR_FI); + CLEAR_FLAG(fpscr, FPSCR_VXVC | FPSCR_VXIMZ | FPSCR_VXZDZ | FPSCR_VXIDI | FPSCR_VXISI | FPSCR_VXSNAN | FPSCR_VXSOFT | FPSCR_VXSQRT | + FPSCR_VXCVI | FPSCR_XX | FPSCR_ZX | FPSCR_UX | FPSCR_OX | FPSCR_FX | FPSCR_FI); PPCMtfpscr(fpscr); PPCMtmsr(msr); @@ -138,13 +133,11 @@ void __OSUnhandledException(__OSException exception, OSContext* context, u32 dsi CLEAR_FLAG(context->srr1, MSR_FP); __OSFPUContext = NULL; - CLEAR_FLAG(context->fpscr, FPSCR_VXVC | FPSCR_VXIMZ | FPSCR_VXZDZ | FPSCR_VXIDI | FPSCR_VXISI | - FPSCR_VXSNAN | FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI | FPSCR_XX | - FPSCR_ZX | FPSCR_UX | FPSCR_OX | FPSCR_FX | FPSCR_FI); + CLEAR_FLAG(context->fpscr, FPSCR_VXVC | FPSCR_VXIMZ | FPSCR_VXZDZ | FPSCR_VXIDI | FPSCR_VXISI | FPSCR_VXSNAN | FPSCR_VXSOFT | + FPSCR_VXSQRT | FPSCR_VXCVI | FPSCR_XX | FPSCR_ZX | FPSCR_UX | FPSCR_OX | FPSCR_FX | FPSCR_FI); OSEnableScheduler(); __OSReschedule(); - } - else { + } else { CLEAR_FLAG(context->srr1, MSR_FP); __OSFPUContext = NULL; } @@ -191,7 +184,7 @@ void __OSUnhandledException(__OSException exception, OSContext* context, u32 dsi OSReport("\n"); OSReport("AI DMA Address = 0x%04x%04x\n", DSP_READ_REG(DSP_DMA_START_ADDR_H), DSP_READ_REG(DSP_DMA_START_ADDR_L)); OSReport("ARAM DMA Address = 0x%04x%04x\n", DSP_READ_REG(DSP_AR_DMA_MMADDR_H), DSP_READ_REG(DSP_AR_DMA_MMADDR_L)); - OSReport("DI DMA Address = 0x%08x\n", DI_READ_REG(DI_DMA_MEM_ADDRESS)); + OSReport("DI DMA Address = 0x%08x\n", DI_READ_REG(DI_DMA_MEM_ADDRESS)); break; } } diff --git a/libs/RVL_SDK/src/os/OSExec.c b/libs/RVL_SDK/src/os/OSExec.c index 43f38616..44da55b7 100644 --- a/libs/RVL_SDK/src/os/OSExec.c +++ b/libs/RVL_SDK/src/os/OSExec.c @@ -1,19 +1,22 @@ +#include #include #include -#include + #include -#include #include +#include + #include #include #include -#include #include +#include + /* some string pooling (the first one is used but is just pooled first...)*/ DECOMP_FORCE_ACTIVE(OSExec_c, "\nOSExec(): Failed to exec %d in %d\n"); @@ -22,11 +25,11 @@ DECOMP_FORCE_ACTIVE(OSExec_c, "\nOSExec(): The specified game doesn't exist in t extern BOOL __OSInIPL; extern BOOL __OSInNandBoot; -BOOL __OSInReboot; +BOOL __OSInReboot; #define BI2_ROUND(x, a) (((x) & ~((a) - 1))) -BOOL PackArgs(void *addr, int argc, char** argv) { +BOOL PackArgs(void* addr, int argc, char** argv) { int argCount; u8* bootInfo2; u8* argPtr; @@ -36,10 +39,9 @@ BOOL PackArgs(void *addr, int argc, char** argv) { if (argc == 0) { *(u32*)&bootInfo2[BI2_OFFSET_ARGOFFSET] = 0; - } - else { + } else { argCount = argc; - argPtr = bootInfo2 + BI2_OFFSET_ARGS; // Arguments are located after BI2 + argPtr = bootInfo2 + BI2_OFFSET_ARGS; // Arguments are located after BI2 // For each argument while (--argc >= 0) { @@ -70,20 +72,19 @@ BOOL PackArgs(void *addr, int argc, char** argv) { return TRUE; } -void __OSGetExecParams(OSExecParams *params) { +void __OSGetExecParams(OSExecParams* params) { if ((u32)__OSExecParamsAddr >= OS_BASE_CACHED) { memcpy(params, __OSExecParamsAddr, sizeof(OSExecParams)); - } - else { + } else { params->valid = FALSE; } } BOOL __OSCheckCompanyCode(ESTitleId titleId, BOOL diskApp) { NANDStatus status; - char homePath[NAND_MAX_PATH+1]; - char dataPath[NAND_MAX_PATH+1]; - u16 curGroupId, launchGroupId; + char homePath[NAND_MAX_PATH + 1]; + char dataPath[NAND_MAX_PATH + 1]; + u16 curGroupId, launchGroupId; int ret = NAND_RESULT_OK; @@ -111,8 +112,7 @@ BOOL __OSCheckCompanyCode(ESTitleId titleId, BOOL diskApp) { // Get group ID from disc DVDDiskID* diskId = DVDGetCurrentDiskID(); launchGroupId = *(u16*)diskId->company; - } - else { + } else { // Get group ID from title's data folder sprintf(dataPath, "/title/%08x/%08x/data", NANDTitleIdHi(titleId), NANDTitleIdLo(titleId)); ret = NANDGetStatus(dataPath, &status); @@ -132,18 +132,17 @@ BOOL __OSCheckTmdCountryCode(ESTmdView* tmd) { if (country == ES_REGION_ALL) { // Do not bother checking if its region free return TRUE; - } - else { + } else { // Check if region matches the system region return country == SCGetProductGameRegion() ? TRUE : FALSE; } } int __OSGetValidTicketIndex(ESTicketView* ticketViewList, u32 numTickets) { - int ret, i; - int bestIdx = 0; + int ret, i; + int bestIdx = 0; BOOL permanent = FALSE; - u32 maxBit = 0, maxTime = 0; + u32 maxBit = 0, maxTime = 0; // Check if there are any tickets if (ticketViewList == NULL) { @@ -160,8 +159,7 @@ int __OSGetValidTicketIndex(ESTicketView* ticketViewList, u32 numTickets) { if (ret > 0) { ret = ES_ERR_OK; continue; - } - else if (ret != ES_ERR_OK) { + } else if (ret != ES_ERR_OK) { return ret; } @@ -177,7 +175,8 @@ int __OSGetValidTicketIndex(ESTicketView* ticketViewList, u32 numTickets) { accessMask = (u16)((ticketViewList[i].accessMask[1] << 8) | ticketViewList[i].accessMask[0]); for (j = 0; j < 16; j++) { - if (accessMask & (1 << j)) bits++; + if (accessMask & (1 << j)) + bits++; } if (bits > maxBit) { @@ -258,13 +257,14 @@ void __OSLaunchTitle(ESTitleId titleId) { } // Lock up - while (TRUE) {} + while (TRUE) { + } } inline BOOL __OSCheckTmdSysVersion(ESTmdView* tmd) { ESTitleId systemId = 0x0000000100000003; - char syspath[NAND_MAX_PATH+1] ALIGN32; + char syspath[NAND_MAX_PATH + 1] ALIGN32; int ret = ES_ERR_OK; u32 numTicket = 0, numContent = 0; @@ -286,26 +286,25 @@ inline BOOL __OSCheckTmdSysVersion(ESTmdView* tmd) { static BOOL __OSCheckTmdDriveSpinFlag(ESTmdView* tmd) { if (tmd->head.reserved.driveSpin & 1) { return TRUE; - } - else { + } else { return FALSE; } } void LaunchCommon(ESTitleId titleId, u32 launchArg, const char** argv, BOOL launchCheck) { - OSStateFlags state; - OSNandbootInfo *info; - u8* bi2; - int argLen; + OSStateFlags state; + OSNandbootInfo* info; + u8* bi2; + int argLen; - char titleIdString[20]; - char** argvToPass; + char titleIdString[20]; + char** argvToPass; int i; - ESTitleId title ALIGN32; - ESTmdView* tmd = NULL; - u32 tmdCount = 0; + ESTitleId title ALIGN32; + ESTmdView* tmd = NULL; + u32 tmdCount = 0; int ret = ES_ERR_OK; @@ -364,11 +363,11 @@ void LaunchCommon(ESTitleId titleId, u32 launchArg, const char** argv, BOOL laun sprintf(titleIdString, "%016llx", titleId); // Setup launch arguments - + argLen = 0; if (argv) { while (argv[argLen]) - argLen++; + argLen++; } argvToPass = OSAllocFromMEM1ArenaLo((++argLen + 1) * sizeof(char*), 1); @@ -377,13 +376,12 @@ void LaunchCommon(ESTitleId titleId, u32 launchArg, const char** argv, BOOL laun for (i = 1; i < argLen; i++) { argvToPass[i] = (char*)argv[i - 1]; } - + PackArgs(bi2, argLen, argvToPass); if (__OSInIPL) { title = EXEC_SYSTEM_MENU_ID; - } - else { + } else { ret = ESP_InitLib(); if (ret != ES_ERR_OK) { OSReport("\nOSExec(): Failed to exec %d in %d\n", ret, 1712); @@ -403,8 +401,7 @@ void LaunchCommon(ESTitleId titleId, u32 launchArg, const char** argv, BOOL laun info->prevAppType = OSGetAppType(); if (titleId == EXEC_SYSTEM_MENU_ID) { info->returnValue = OS_NANDBOOT_RETURN_MENU; - } - else { + } else { info->returnValue = OS_NANDBOOT_RETURN_GAME; } info->argValue = launchArg; @@ -421,7 +418,7 @@ void LaunchCommon(ESTitleId titleId, u32 launchArg, const char** argv, BOOL laun } __OSWriteStateFlags(&state); } - + OSDisableScheduler(); __OSShutdownDevices(OS_SHUTDOWN_LAUNCH); OSEnableScheduler(); @@ -432,17 +429,18 @@ void LaunchCommon(ESTitleId titleId, u32 launchArg, const char** argv, BOOL laun __OSLaunchMenu(); } -#define __COPY_VA_ARGS_TO_ARRAY(arg0, argv) { \ - va_list list; \ - char* argPtr; \ - int i; \ - argv = OSAllocFromMEM1ArenaLo(sizeof(*argv), 0x1000); \ - va_start(list, arg0); \ - for (i = 0, argPtr = (char*)arg0; (argv[i++] = argPtr) != NULL;) { \ - argPtr = va_arg(list, char*); \ - } \ - va_end(list); \ -} +#define __COPY_VA_ARGS_TO_ARRAY(arg0, argv) \ + { \ + va_list list; \ + char* argPtr; \ + int i; \ + argv = OSAllocFromMEM1ArenaLo(sizeof(*argv), 0x1000); \ + va_start(list, arg0); \ + for (i = 0, argPtr = (char*)arg0; (argv[i++] = argPtr) != NULL;) { \ + argPtr = va_arg(list, char*); \ + } \ + va_end(list); \ + } // "System" as in system menu void __OSLaunchTitlevForSystem(ESTitleId titleId, u32 launchCode, const char** argv) { @@ -454,8 +452,7 @@ void __OSLaunchTitlevForSystem(ESTitleId titleId, u32 launchCode, const char** a // If we are in the system menu (but NOT in a nandloader) if (__OSInIPL && !__OSInNandBoot) { LaunchCommon(titleId, launchCode, argv, FALSE); - } - else { + } else { OSReport("__OSLaunchTitlevForSystem(): only system can call this function\n"); __OSReturnToMenuForError(); } @@ -463,7 +460,7 @@ void __OSLaunchTitlevForSystem(ESTitleId titleId, u32 launchCode, const char** a void __OSLaunchTitlelForSystem(ESTitleId titleId, u32 launchCode, const char* arg0, ...) { char** argv; - + __OSUnRegisterStateEvent(); OSSetArenaLo(EXEC_WORK_ARENA_LO); @@ -474,21 +471,20 @@ void __OSLaunchTitlelForSystem(ESTitleId titleId, u32 launchCode, const char* ar // If we are in the system menu (but NOT in a nandloader) if (__OSInIPL && !__OSInNandBoot) { LaunchCommon(titleId, launchCode, (const char**)argv, FALSE); - } - else { + } else { OSReport("__OSLaunchTitlelForSystem(): only system can call this function\n"); __OSReturnToMenuForError(); } } -void __OSReturnToMenul(u32 launchArg, const char *arg0, ...) { +void __OSReturnToMenul(u32 launchArg, const char* arg0, ...) { char** argv; __OSUnRegisterStateEvent(); OSSetArenaLo(EXEC_WORK_ARENA_LO); OSSetArenaHi(EXEC_WORK_ARENA_HI); - + __COPY_VA_ARGS_TO_ARRAY(arg0, argv); LaunchCommon(EXEC_SYSTEM_MENU_ID, launchArg, (const char**)argv, FALSE); diff --git a/libs/RVL_SDK/src/os/OSFont.c b/libs/RVL_SDK/src/os/OSFont.c index 519a46b1..501182d6 100644 --- a/libs/RVL_SDK/src/os/OSFont.c +++ b/libs/RVL_SDK/src/os/OSFont.c @@ -1,5 +1,6 @@ -#include #include +#include + #include @@ -11,198 +12,86 @@ static char* ParseStringS(u16 encode, const char* string, OSFontHeader** pfont, static char* ParseStringW(u16 encode, const char* string, OSFontHeader** pfont, int* pfontCode); static u16 HankakuToCode[] = { - 0x20C, 0x20D, 0x20E, 0x20F, 0x210, 0x211, 0x212, 0x213, - 0x214, 0x215, 0x216, 0x217, 0x218, 0x219, 0x21A, 0x21B, - 0x21C, 0x21D, 0x21E, 0x21F, 0x220, 0x221, 0x222, 0x223, - 0x224, 0x225, 0x226, 0x227, 0x228, 0x229, 0x22A, 0x22B, - 0x22C, 0x22D, 0x22E, 0x22F, 0x230, 0x231, 0x232, 0x233, - 0x234, 0x235, 0x236, 0x237, 0x238, 0x239, 0x23A, 0x23B, - 0x23C, 0x23D, 0x23E, 0x23F, 0x240, 0x241, 0x242, 0x243, - 0x244, 0x245, 0x246, 0x247, 0x248, 0x249, 0x24A, 0x24B, - 0x24C, 0x24D, 0x24E, 0x24F, 0x250, 0x251, 0x252, 0x253, - 0x254, 0x255, 0x256, 0x257, 0x258, 0x259, 0x25A, 0x25B, - 0x25C, 0x25D, 0x25E, 0x25F, 0x260, 0x261, 0x262, 0x263, - 0x264, 0x265, 0x266, 0x267, 0x268, 0x269, 0x26A, 0x20C, - 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, - 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, - 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, - 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, - 0x20C, 0x26B, 0x26C, 0x26D, 0x26E, 0x26F, 0x270, 0x271, - 0x272, 0x273, 0x274, 0x275, 0x276, 0x277, 0x278, 0x279, - 0x27A, 0x27B, 0x27C, 0x27D, 0x27E, 0x27F, 0x280, 0x281, - 0x282, 0x283, 0x284, 0x285, 0x286, 0x287, 0x288, 0x289, - 0x28A, 0x28B, 0x28C, 0x28D, 0x28E, 0x28F, 0x290, 0x291, - 0x292, 0x293, 0x294, 0x295, 0x296, 0x297, 0x298, 0x299, - 0x29A, 0x29B, 0x29C, 0x29D, 0x29E, 0x29F, 0x2A0, 0x2A1, - 0x2A2, 0x2A3, 0x2A4, 0x2A5, 0x2A6, 0x2A7, 0x2A8, 0x2A9, + 0x20C, 0x20D, 0x20E, 0x20F, 0x210, 0x211, 0x212, 0x213, 0x214, 0x215, 0x216, 0x217, 0x218, 0x219, 0x21A, 0x21B, 0x21C, 0x21D, 0x21E, 0x21F, + 0x220, 0x221, 0x222, 0x223, 0x224, 0x225, 0x226, 0x227, 0x228, 0x229, 0x22A, 0x22B, 0x22C, 0x22D, 0x22E, 0x22F, 0x230, 0x231, 0x232, 0x233, + 0x234, 0x235, 0x236, 0x237, 0x238, 0x239, 0x23A, 0x23B, 0x23C, 0x23D, 0x23E, 0x23F, 0x240, 0x241, 0x242, 0x243, 0x244, 0x245, 0x246, 0x247, + 0x248, 0x249, 0x24A, 0x24B, 0x24C, 0x24D, 0x24E, 0x24F, 0x250, 0x251, 0x252, 0x253, 0x254, 0x255, 0x256, 0x257, 0x258, 0x259, 0x25A, 0x25B, + 0x25C, 0x25D, 0x25E, 0x25F, 0x260, 0x261, 0x262, 0x263, 0x264, 0x265, 0x266, 0x267, 0x268, 0x269, 0x26A, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, + 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, + 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x20C, 0x26B, 0x26C, 0x26D, 0x26E, 0x26F, 0x270, 0x271, 0x272, 0x273, 0x274, 0x275, + 0x276, 0x277, 0x278, 0x279, 0x27A, 0x27B, 0x27C, 0x27D, 0x27E, 0x27F, 0x280, 0x281, 0x282, 0x283, 0x284, 0x285, 0x286, 0x287, 0x288, 0x289, + 0x28A, 0x28B, 0x28C, 0x28D, 0x28E, 0x28F, 0x290, 0x291, 0x292, 0x293, 0x294, 0x295, 0x296, 0x297, 0x298, 0x299, 0x29A, 0x29B, 0x29C, 0x29D, + 0x29E, 0x29F, 0x2A0, 0x2A1, 0x2A2, 0x2A3, 0x2A4, 0x2A5, 0x2A6, 0x2A7, 0x2A8, 0x2A9, }; static u16 Zenkaku2Code[] = { - 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x008, 0x009, 0x00A, 0x00B, 0x00C, 0x00D, 0x00E, 0x00F, - 0x010, 0x011, 0x012, 0x013, 0x014, 0x015, 0x016, 0x017, - 0x018, 0x019, 0x01A, 0x01B, 0x01C, 0x01D, 0x01E, 0x01F, - 0x020, 0x021, 0x022, 0x023, 0x024, 0x025, 0x026, 0x027, - 0x028, 0x029, 0x02A, 0x02B, 0x02C, 0x02D, 0x02E, 0x02F, - 0x030, 0x031, 0x032, 0x033, 0x034, 0x035, 0x036, 0x037, - 0x038, 0x039, 0x03A, 0x03B, 0x03C, 0x03D, 0x03E, - 0x03F, 0x040, 0x041, 0x042, 0x043, 0x044, 0x045, 0x046, - 0x047, 0x048, 0x049, 0x04A, 0x04B, 0x04C, 0x04D, 0x04E, - 0x04F, 0x050, 0x051, 0x052, 0x053, 0x054, 0x055, 0x056, - 0x057, 0x058, 0x059, 0x05A, 0x05B, 0x05C, 0x05D, 0x05E, - 0x05F, 0x060, 0x061, 0x062, 0x063, 0x064, 0x065, 0x066, - 0x067, 0x068, 0x069, 0x06A, 0x06B, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x06C, 0x06D, 0x06E, 0x06F, 0x070, 0x071, 0x072, 0x073, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x074, 0x075, 0x076, 0x077, 0x078, 0x079, 0x07A, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x07B, 0x07C, 0x07D, 0x07E, 0x07F, 0x080, - 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087, 0x088, - 0x089, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x08A, 0x08B, 0x08C, 0x08D, 0x08E, 0x08F, 0x090, 0x091, - 0x000, 0x000, 0x000, 0x000, 0x092, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x093, - 0x094, 0x095, 0x096, 0x097, 0x098, 0x099, 0x09A, 0x09B, - 0x09C, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x09D, 0x09E, 0x09F, 0x0A0, 0x0A1, 0x0A2, 0x0A3, 0x0A4, - 0x0A5, 0x0A6, 0x0A7, 0x0A8, 0x0A9, 0x0AA, 0x0AB, 0x0AC, - 0x0AD, 0x0AE, 0x0AF, 0x0B0, 0x0B1, 0x0B2, 0x0B3, 0x0B4, - 0x0B5, 0x0B6, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x0B7, 0x0B8, 0x0B9, 0x0BA, 0x0BB, 0x0BC, 0x0BD, - 0x0BE, 0x0BF, 0x0C0, 0x0C1, 0x0C2, 0x0C3, 0x0C4, 0x0C5, - 0x0C6, 0x0C7, 0x0C8, 0x0C9, 0x0CA, 0x0CB, 0x0CC, 0x0CD, - 0x0CE, 0x0CF, 0x0D0, 0x000, 0x000, 0x000, 0x000, 0x0D1, - 0x0D2, 0x0D3, 0x0D4, 0x0D5, 0x0D6, 0x0D7, 0x0D8, 0x0D9, - 0x0DA, 0x0DB, 0x0DC, 0x0DD, 0x0DE, 0x0DF, 0x0E0, 0x0E1, - 0x0E2, 0x0E3, 0x0E4, 0x0E5, 0x0E6, 0x0E7, 0x0E8, 0x0E9, - 0x0EA, 0x0EB, 0x0EC, 0x0ED, 0x0EE, 0x0EF, 0x0F0, 0x0F1, - 0x0F2, 0x0F3, 0x0F4, 0x0F5, 0x0F6, 0x0F7, 0x0F8, 0x0F9, - 0x0FA, 0x0FB, 0x0FC, 0x0FD, 0x0FE, 0x0FF, 0x100, 0x101, - 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, 0x108, 0x109, - 0x10A, 0x10B, 0x10C, 0x10D, 0x10E, 0x10F, 0x110, 0x111, - 0x112, 0x113, 0x114, 0x115, 0x116, 0x117, 0x118, 0x119, - 0x11A, 0x11B, 0x11C, 0x11D, 0x11E, 0x11F, 0x120, 0x121, - 0x122, 0x123, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, - 0x124, 0x125, 0x126, 0x127, 0x128, 0x129, 0x12A, 0x12B, - 0x12C, 0x12D, 0x12E, 0x12F, 0x130, 0x131, 0x132, 0x133, - 0x134, 0x135, 0x136, 0x137, 0x138, 0x139, 0x13A, 0x13B, - 0x13C, 0x13D, 0x13E, 0x13F, 0x140, 0x141, 0x142, 0x143, - 0x144, 0x145, 0x146, 0x147, 0x148, 0x149, 0x14A, 0x14B, - 0x14C, 0x14D, 0x14E, 0x14F, 0x150, 0x151, 0x152, 0x153, - 0x154, 0x155, 0x156, 0x157, 0x158, 0x159, 0x15A, 0x15B, - 0x15C, 0x15D, 0x15E, 0x15F, 0x160, 0x161, 0x162, - 0x163, 0x164, 0x165, 0x166, 0x167, 0x168, 0x169, 0x16A, - 0x16B, 0x16C, 0x16D, 0x16E, 0x16F, 0x170, 0x171, 0x172, - 0x173, 0x174, 0x175, 0x176, 0x177, 0x178, 0x179, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x17A, - 0x17B, 0x17C, 0x17D, 0x17E, 0x17F, 0x180, 0x181, 0x182, - 0x183, 0x184, 0x185, 0x186, 0x187, 0x188, 0x189, 0x18A, - 0x18B, 0x18C, 0x18D, 0x18E, 0x18F, 0x190, 0x191, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x192, - 0x193, 0x194, 0x195, 0x196, 0x197, 0x198, 0x199, 0x19A, - 0x19B, 0x19C, 0x19D, 0x19E, 0x19F, 0x1A0, 0x1A1, 0x1A2, - 0x1A3, 0x1A4, 0x1A5, 0x1A6, 0x1A7, 0x1A8, 0x1A9, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, - 0x1AA, 0x1AB, 0x1AC, 0x1AD, 0x1AE, 0x1AF, 0x1B0, 0x1B1, - 0x1B2, 0x1B3, 0x1B4, 0x1B5, 0x1B6, 0x1B7, 0x1B8, 0x1B9, - 0x1BA, 0x1BB, 0x1BC, 0x1BD, 0x1BE, 0x1BF, 0x1C0, 0x1C1, - 0x1C2, 0x1C3, 0x1C4, 0x1C5, 0x1C6, 0x1C7, 0x1C8, 0x1C9, - 0x1CA, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x1CB, 0x1CC, 0x1CD, 0x1CE, 0x1CF, 0x1D0, 0x1D1, 0x1D2, - 0x1D3, 0x1D4, 0x1D5, 0x1D6, 0x1D7, 0x1D8, 0x1D9, - 0x1DA, 0x1DB, 0x1DC, 0x1DD, 0x1DE, 0x1DF, 0x1E0, 0x1E1, - 0x1E2, 0x1E3, 0x1E4, 0x1E5, 0x1E6, 0x1E7, 0x1E8, 0x1E9, - 0x1EA, 0x1EB, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x1EC, - 0x1ED, 0x1EE, 0x1EF, 0x1F0, 0x1F1, 0x1F2, 0x1F3, 0x1F4, - 0x1F5, 0x1F6, 0x1F7, 0x1F8, 0x1F9, 0x1FA, 0x1FB, 0x1FC, - 0x1FD, 0x1FE, 0x1FF, 0x200, 0x201, 0x202, 0x203, 0x204, - 0x205, 0x206, 0x207, 0x208, 0x209, 0x20A, 0x20B, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x20C, - 0x20D, 0x20E, 0x20F, 0x210, 0x211, 0x212, 0x213, 0x214, - 0x215, 0x216, 0x217, 0x218, 0x219, 0x21A, 0x21B, 0x21C, - 0x21D, 0x21E, 0x21F, 0x220, 0x221, 0x222, 0x223, 0x224, - 0x225, 0x226, 0x227, 0x228, 0x229, 0x22A, 0x22B, 0x22C, - 0x22D, 0x22E, 0x22F, 0x230, 0x231, 0x232, 0x233, 0x234, - 0x235, 0x236, 0x237, 0x238, 0x239, 0x23A, 0x23B, 0x23C, - 0x23D, 0x23E, 0x23F, 0x240, 0x241, 0x242, 0x243, 0x244, - 0x245, 0x246, 0x247, 0x248, 0x249, 0x24A, 0x24B, - 0x24C, 0x24D, 0x24E, 0x24F, 0x250, 0x251, 0x252, 0x253, - 0x254, 0x255, 0x256, 0x257, 0x258, 0x259, 0x25A, 0x25B, - 0x25C, 0x25D, 0x25E, 0x25F, 0x260, 0x261, 0x262, 0x263, - 0x264, 0x265, 0x266, 0x267, 0x268, 0x269, 0x26A, 0x26B, - 0x26C, 0x26D, 0x26E, 0x26F, 0x270, 0x271, 0x272, 0x273, - 0x274, 0x275, 0x276, 0x277, 0x278, 0x279, 0x27A, 0x27B, - 0x27C, 0x27D, 0x27E, 0x27F, 0x280, 0x281, 0x282, 0x283, - 0x284, 0x285, 0x286, 0x287, 0x288, 0x289, 0x28A, 0x28B, - 0x28C, 0x28D, 0x28E, 0x28F, 0x290, 0x291, 0x292, 0x293, - 0x294, 0x295, 0x296, 0x297, 0x298, 0x299, 0x29A, 0x29B, - 0x29C, 0x29D, 0x29E, 0x29F, 0x2A0, 0x2A1, 0x2A2, 0x2A3, - 0x2A4, 0x2A5, 0x2A6, 0x2A7, 0x2A8, 0x2A9, 0x2AA, 0x2AB, - 0x2AC, 0x2AD, 0x2AE, 0x2AF, 0x2B0, 0x2B1, 0x2B2, 0x2B3, - 0x2B4, 0x2B5, 0x2B6, 0x2B7, 0x2B8, 0x2B9, 0x2BA, 0x2BB, - 0x2BC, 0x2BD, 0x2BE, 0x2BF, 0x2C0, 0x2C1, 0x2C2, 0x2C3, - 0x2C4, 0x2C5, 0x2C6, 0x2C7, 0x2C8, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, - 0x2C9, 0x2CA, 0x2CB, 0x2CC, 0x2CD, 0x2CE, 0x2CF, 0x2D0, - 0x2D1, 0x2D2, 0x2D3, 0x2D4, 0x2D5, 0x2D6, 0x2D7, 0x2D8, - 0x2D9, 0x2DA, 0x2DB, 0x2DC, 0x2DD, 0x2DE, 0x2DF, 0x2E0, - 0x2E1, 0x2E2, 0x2E3, 0x2E4, 0x2E5, 0x2E6, 0x000, 0x2E7, - 0x2E8, 0x2E9, 0x2EA, 0x2EB, 0x2EC, 0x2ED, 0x2EE, 0x2EF, - 0x2F0, 0x2F1, 0x2F2, 0x2F3, 0x2F4, 0x2F5, 0x2F6, 0x2F7, - 0x2F8, 0x2F9, 0x2FA, 0x2FB, 0x2FC, 0x2FD, 0x000, 0x000, - 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x2FE, - 0x2FF, 0x300, 0x301, 0x302, 0x303, 0x304, 0x305, 0x306, - 0x307, 0x308, 0x309, 0x30A, 0x30B, 0x30C, 0x30D, 0x30E, - 0x30F, 0x310, 0x311, 0x312, 0x313, 0x314, 0x315, 0x316, - 0x317, 0x318, 0x319, 0x31A, 0x31B, 0x000 -}; + 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x008, 0x009, 0x00A, 0x00B, 0x00C, 0x00D, 0x00E, 0x00F, 0x010, 0x011, 0x012, 0x013, 0x014, + 0x015, 0x016, 0x017, 0x018, 0x019, 0x01A, 0x01B, 0x01C, 0x01D, 0x01E, 0x01F, 0x020, 0x021, 0x022, 0x023, 0x024, 0x025, 0x026, 0x027, 0x028, 0x029, + 0x02A, 0x02B, 0x02C, 0x02D, 0x02E, 0x02F, 0x030, 0x031, 0x032, 0x033, 0x034, 0x035, 0x036, 0x037, 0x038, 0x039, 0x03A, 0x03B, 0x03C, 0x03D, 0x03E, + 0x03F, 0x040, 0x041, 0x042, 0x043, 0x044, 0x045, 0x046, 0x047, 0x048, 0x049, 0x04A, 0x04B, 0x04C, 0x04D, 0x04E, 0x04F, 0x050, 0x051, 0x052, 0x053, + 0x054, 0x055, 0x056, 0x057, 0x058, 0x059, 0x05A, 0x05B, 0x05C, 0x05D, 0x05E, 0x05F, 0x060, 0x061, 0x062, 0x063, 0x064, 0x065, 0x066, 0x067, 0x068, + 0x069, 0x06A, 0x06B, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x06C, 0x06D, 0x06E, 0x06F, 0x070, 0x071, 0x072, + 0x073, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x074, 0x075, 0x076, 0x077, 0x078, 0x079, 0x07A, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x07B, 0x07C, 0x07D, 0x07E, 0x07F, 0x080, 0x081, 0x082, 0x083, 0x084, 0x085, 0x086, 0x087, 0x088, 0x089, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x08A, 0x08B, 0x08C, 0x08D, 0x08E, 0x08F, 0x090, 0x091, 0x000, 0x000, 0x000, 0x000, 0x092, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x093, 0x094, 0x095, 0x096, 0x097, 0x098, 0x099, + 0x09A, 0x09B, 0x09C, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x09D, 0x09E, 0x09F, 0x0A0, 0x0A1, 0x0A2, 0x0A3, 0x0A4, 0x0A5, 0x0A6, 0x0A7, + 0x0A8, 0x0A9, 0x0AA, 0x0AB, 0x0AC, 0x0AD, 0x0AE, 0x0AF, 0x0B0, 0x0B1, 0x0B2, 0x0B3, 0x0B4, 0x0B5, 0x0B6, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x0B7, 0x0B8, 0x0B9, 0x0BA, 0x0BB, 0x0BC, 0x0BD, 0x0BE, 0x0BF, 0x0C0, 0x0C1, 0x0C2, 0x0C3, 0x0C4, 0x0C5, 0x0C6, 0x0C7, 0x0C8, 0x0C9, 0x0CA, 0x0CB, + 0x0CC, 0x0CD, 0x0CE, 0x0CF, 0x0D0, 0x000, 0x000, 0x000, 0x000, 0x0D1, 0x0D2, 0x0D3, 0x0D4, 0x0D5, 0x0D6, 0x0D7, 0x0D8, 0x0D9, 0x0DA, 0x0DB, 0x0DC, + 0x0DD, 0x0DE, 0x0DF, 0x0E0, 0x0E1, 0x0E2, 0x0E3, 0x0E4, 0x0E5, 0x0E6, 0x0E7, 0x0E8, 0x0E9, 0x0EA, 0x0EB, 0x0EC, 0x0ED, 0x0EE, 0x0EF, 0x0F0, 0x0F1, + 0x0F2, 0x0F3, 0x0F4, 0x0F5, 0x0F6, 0x0F7, 0x0F8, 0x0F9, 0x0FA, 0x0FB, 0x0FC, 0x0FD, 0x0FE, 0x0FF, 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, + 0x107, 0x108, 0x109, 0x10A, 0x10B, 0x10C, 0x10D, 0x10E, 0x10F, 0x110, 0x111, 0x112, 0x113, 0x114, 0x115, 0x116, 0x117, 0x118, 0x119, 0x11A, 0x11B, + 0x11C, 0x11D, 0x11E, 0x11F, 0x120, 0x121, 0x122, 0x123, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x124, 0x125, + 0x126, 0x127, 0x128, 0x129, 0x12A, 0x12B, 0x12C, 0x12D, 0x12E, 0x12F, 0x130, 0x131, 0x132, 0x133, 0x134, 0x135, 0x136, 0x137, 0x138, 0x139, 0x13A, + 0x13B, 0x13C, 0x13D, 0x13E, 0x13F, 0x140, 0x141, 0x142, 0x143, 0x144, 0x145, 0x146, 0x147, 0x148, 0x149, 0x14A, 0x14B, 0x14C, 0x14D, 0x14E, 0x14F, + 0x150, 0x151, 0x152, 0x153, 0x154, 0x155, 0x156, 0x157, 0x158, 0x159, 0x15A, 0x15B, 0x15C, 0x15D, 0x15E, 0x15F, 0x160, 0x161, 0x162, 0x163, 0x164, + 0x165, 0x166, 0x167, 0x168, 0x169, 0x16A, 0x16B, 0x16C, 0x16D, 0x16E, 0x16F, 0x170, 0x171, 0x172, 0x173, 0x174, 0x175, 0x176, 0x177, 0x178, 0x179, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x17A, 0x17B, 0x17C, 0x17D, 0x17E, 0x17F, 0x180, 0x181, 0x182, 0x183, 0x184, 0x185, 0x186, + 0x187, 0x188, 0x189, 0x18A, 0x18B, 0x18C, 0x18D, 0x18E, 0x18F, 0x190, 0x191, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x192, 0x193, + 0x194, 0x195, 0x196, 0x197, 0x198, 0x199, 0x19A, 0x19B, 0x19C, 0x19D, 0x19E, 0x19F, 0x1A0, 0x1A1, 0x1A2, 0x1A3, 0x1A4, 0x1A5, 0x1A6, 0x1A7, 0x1A8, + 0x1A9, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x1AA, 0x1AB, 0x1AC, + 0x1AD, 0x1AE, 0x1AF, 0x1B0, 0x1B1, 0x1B2, 0x1B3, 0x1B4, 0x1B5, 0x1B6, 0x1B7, 0x1B8, 0x1B9, 0x1BA, 0x1BB, 0x1BC, 0x1BD, 0x1BE, 0x1BF, 0x1C0, 0x1C1, + 0x1C2, 0x1C3, 0x1C4, 0x1C5, 0x1C6, 0x1C7, 0x1C8, 0x1C9, 0x1CA, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x1CB, 0x1CC, 0x1CD, 0x1CE, 0x1CF, 0x1D0, 0x1D1, 0x1D2, 0x1D3, 0x1D4, 0x1D5, 0x1D6, 0x1D7, 0x1D8, 0x1D9, 0x1DA, 0x1DB, 0x1DC, + 0x1DD, 0x1DE, 0x1DF, 0x1E0, 0x1E1, 0x1E2, 0x1E3, 0x1E4, 0x1E5, 0x1E6, 0x1E7, 0x1E8, 0x1E9, 0x1EA, 0x1EB, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x1EC, 0x1ED, 0x1EE, 0x1EF, 0x1F0, 0x1F1, 0x1F2, 0x1F3, 0x1F4, 0x1F5, 0x1F6, 0x1F7, 0x1F8, 0x1F9, + 0x1FA, 0x1FB, 0x1FC, 0x1FD, 0x1FE, 0x1FF, 0x200, 0x201, 0x202, 0x203, 0x204, 0x205, 0x206, 0x207, 0x208, 0x209, 0x20A, 0x20B, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x20C, 0x20D, 0x20E, 0x20F, 0x210, + 0x211, 0x212, 0x213, 0x214, 0x215, 0x216, 0x217, 0x218, 0x219, 0x21A, 0x21B, 0x21C, 0x21D, 0x21E, 0x21F, 0x220, 0x221, 0x222, 0x223, 0x224, 0x225, + 0x226, 0x227, 0x228, 0x229, 0x22A, 0x22B, 0x22C, 0x22D, 0x22E, 0x22F, 0x230, 0x231, 0x232, 0x233, 0x234, 0x235, 0x236, 0x237, 0x238, 0x239, 0x23A, + 0x23B, 0x23C, 0x23D, 0x23E, 0x23F, 0x240, 0x241, 0x242, 0x243, 0x244, 0x245, 0x246, 0x247, 0x248, 0x249, 0x24A, 0x24B, 0x24C, 0x24D, 0x24E, 0x24F, + 0x250, 0x251, 0x252, 0x253, 0x254, 0x255, 0x256, 0x257, 0x258, 0x259, 0x25A, 0x25B, 0x25C, 0x25D, 0x25E, 0x25F, 0x260, 0x261, 0x262, 0x263, 0x264, + 0x265, 0x266, 0x267, 0x268, 0x269, 0x26A, 0x26B, 0x26C, 0x26D, 0x26E, 0x26F, 0x270, 0x271, 0x272, 0x273, 0x274, 0x275, 0x276, 0x277, 0x278, 0x279, + 0x27A, 0x27B, 0x27C, 0x27D, 0x27E, 0x27F, 0x280, 0x281, 0x282, 0x283, 0x284, 0x285, 0x286, 0x287, 0x288, 0x289, 0x28A, 0x28B, 0x28C, 0x28D, 0x28E, + 0x28F, 0x290, 0x291, 0x292, 0x293, 0x294, 0x295, 0x296, 0x297, 0x298, 0x299, 0x29A, 0x29B, 0x29C, 0x29D, 0x29E, 0x29F, 0x2A0, 0x2A1, 0x2A2, 0x2A3, + 0x2A4, 0x2A5, 0x2A6, 0x2A7, 0x2A8, 0x2A9, 0x2AA, 0x2AB, 0x2AC, 0x2AD, 0x2AE, 0x2AF, 0x2B0, 0x2B1, 0x2B2, 0x2B3, 0x2B4, 0x2B5, 0x2B6, 0x2B7, 0x2B8, + 0x2B9, 0x2BA, 0x2BB, 0x2BC, 0x2BD, 0x2BE, 0x2BF, 0x2C0, 0x2C1, 0x2C2, 0x2C3, 0x2C4, 0x2C5, 0x2C6, 0x2C7, 0x2C8, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, + 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x2C9, 0x2CA, 0x2CB, 0x2CC, 0x2CD, 0x2CE, + 0x2CF, 0x2D0, 0x2D1, 0x2D2, 0x2D3, 0x2D4, 0x2D5, 0x2D6, 0x2D7, 0x2D8, 0x2D9, 0x2DA, 0x2DB, 0x2DC, 0x2DD, 0x2DE, 0x2DF, 0x2E0, 0x2E1, 0x2E2, 0x2E3, + 0x2E4, 0x2E5, 0x2E6, 0x000, 0x2E7, 0x2E8, 0x2E9, 0x2EA, 0x2EB, 0x2EC, 0x2ED, 0x2EE, 0x2EF, 0x2F0, 0x2F1, 0x2F2, 0x2F3, 0x2F4, 0x2F5, 0x2F6, 0x2F7, + 0x2F8, 0x2F9, 0x2FA, 0x2FB, 0x2FC, 0x2FD, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x2FE, 0x2FF, 0x300, 0x301, 0x302, 0x303, 0x304, + 0x305, 0x306, 0x307, 0x308, 0x309, 0x30A, 0x30B, 0x30C, 0x30D, 0x30E, 0x30F, 0x310, 0x311, 0x312, 0x313, 0x314, 0x315, 0x316, 0x317, 0x318, 0x319, + 0x31A, 0x31B, 0x000}; -static OSFontHeader* FontDataAnsi; -static OSFontHeader* FontDataSjis; -static u16 FontEncode = 0xFFFF; +static OSFontHeader* FontDataAnsi; +static OSFontHeader* FontDataSjis; +static u16 FontEncode = 0xFFFF; -static int FixedPitch; +static int FixedPitch; -static ParseStringCallback ParseString; +static ParseStringCallback ParseString; static BOOL IsSjisLeadByte(u8 c) { return (0x81 <= c && c <= 0x9F) || (0xE0 <= c && c <= 0xFC); @@ -235,7 +124,7 @@ static int GetFontCode(u16 encode, u16 code) { } if (code >= 0x8140 && code < 0x879E) { - int i = ((code >> 8) - 0x81) * 188; + int i = ((code >> 8) - 0x81) * 188; int j = (code & 0xFF); if (!IsSjisTrailByte(j)) { @@ -249,8 +138,7 @@ static int GetFontCode(u16 encode, u16 code) { return Zenkaku2Code[i + j]; } - } - else if (code > 0x20 && code <= 0xFF) { + } else if (code > 0x20 && code <= 0xFF) { return code - 0x20; } @@ -301,8 +189,7 @@ static void Decode(u8* src, u8* dst) { count = linkOfs >> 12; if (count == 0) { count = src[chunksOfs++] + 0x12; - } - else { + } else { count += 2; } @@ -369,7 +256,8 @@ static void ReadROM(u8* buf, int length, int offset) { len = (length <= 0x100) ? length : 0x100; length -= len; - while (!__OSReadROM(buf, len, offset)) {} + while (!__OSReadROM(buf, len, offset)) { + } offset += len; buf += len; @@ -381,8 +269,7 @@ u32 ReadFont(void* img, u16 encode, void* fontData) { if (encode == OS_FONT_ENCODE_SJIS) { ReadROM(img, OS_FONT_ROM_SIZE_SJIS, OS_FONT_ROM_OFFSET_SJIS); - } - else { + } else { ReadROM(img, OS_FONT_ROM_SIZE_ANSI, OS_FONT_ROM_OFFSET_ANSI); } @@ -404,7 +291,7 @@ u32 ReadFont(void* img, u16 encode, void* fontData) { fontCode = GetFontCode(encode, 0x54); sheet = fontCode / (font->sheetColumn * font->sheetRow); - numChars = fontCode - (sheet * (font->sheetColumn * font->sheetRow)); + numChars = fontCode - (sheet * (font->sheetColumn * font->sheetRow)); row = numChars / font->sheetColumn; column = numChars - (row * font->sheetColumn); row *= font->cellHeight; @@ -464,7 +351,7 @@ u32 OSLoadFont(OSFontHeader* fontData, void* tmp) { return size; } -static char* ParseStringS(u16 encode, const char* string, OSFontHeader **pfont, int *pfontCode) { +static char* ParseStringS(u16 encode, const char* string, OSFontHeader** pfont, int* pfontCode) { OSFontHeader* font; u16 code = 0; @@ -520,8 +407,8 @@ static char* ParseStringW(u16 encode, const char* string, OSFontHeader** pfont, break; } ++string; - if (IsSjisLeadByte((u8) code) && IsSjisTrailByte((u8)*string)) { - code = (u16) ((code << 8) | (u8)*string++); + if (IsSjisLeadByte((u8)code) && IsSjisTrailByte((u8)*string)) { + code = (u16)((code << 8) | (u8)*string++); } break; } @@ -557,7 +444,7 @@ static char* ParseStringW(u16 encode, const char* string, OSFontHeader** pfont, *pfont = font; *pfontCode = GetFontCode(encode, code); - + return (char*)string; } @@ -581,9 +468,9 @@ char* OSGetFontTexel(const char* string, void* image, s32 pos, s32 stride, s32* encode = OSGetFontEncode(); string = ParseString(encode, (char*)string, &font, &fontCode); colorIndex = &font->col.r; - + sheet = fontCode / (font->sheetColumn * font->sheetRow); - numChars = fontCode - (sheet * (font->sheetColumn * font->sheetRow)); + numChars = fontCode - (sheet * (font->sheetColumn * font->sheetRow)); row = numChars / font->sheetColumn; column = numChars - (row * font->sheetColumn); @@ -598,7 +485,7 @@ char* OSGetFontTexel(const char* string, void* image, s32 pos, s32 stride, s32* for (x = 0; x < font->cellWidth; x++) { src = imageSrc + (((font->sheetWidth / 8) * 32) / 2) * ((row + y) / 8); src += ((column + x) / 8) * 16; - src += ((row + y) % 8) * 2; + src += ((row + y) % 8) * 2; src += ((column + x) % 8) / 4; offsetSrc = (column + x) % 4; @@ -613,7 +500,7 @@ char* OSGetFontTexel(const char* string, void* image, s32 pos, s32 stride, s32* *dst |= (u8)(colorIndex[*src >> (6 - (offsetSrc * 2)) & 3] & ((offsetDst != 0) ? 0x0F : 0xF0)); } } - + if (width != 0) { *width = ((u8*)font + font->widthTable)[fontCode]; } diff --git a/libs/RVL_SDK/src/os/OSInterrupt.c b/libs/RVL_SDK/src/os/OSInterrupt.c index 77ce8526..8b86acf0 100644 --- a/libs/RVL_SDK/src/os/OSInterrupt.c +++ b/libs/RVL_SDK/src/os/OSInterrupt.c @@ -1,5 +1,6 @@ -#include #include +#include + #include @@ -10,11 +11,11 @@ #include #include -static __OSInterruptHandler* InterruptHandlerTable; +static __OSInterruptHandler* InterruptHandlerTable; -volatile OSTime __OSLastInterruptTime; -volatile __OSInterrupt __OSLastInterrupt; -volatile u32 __OSLastInterruptSrr0; +volatile OSTime __OSLastInterruptTime; +volatile __OSInterrupt __OSLastInterrupt; +volatile u32 __OSLastInterruptSrr0; static OSInterruptMask InterruptPrioTable[] = { OS_INTERRUPTMASK_PI_ERROR, @@ -25,8 +26,8 @@ static OSInterruptMask InterruptPrioTable[] = { OS_INTERRUPTMASK_PI_ACR, OS_INTERRUPTMASK_PI_PE, OS_INTERRUPTMASK_PI_HSP, - OS_INTERRUPTMASK_DSP_ARAM | OS_INTERRUPTMASK_DSP_DSP | OS_INTERRUPTMASK_AI | - OS_INTERRUPTMASK_EXI | OS_INTERRUPTMASK_PI_SI | OS_INTERRUPTMASK_PI_DI, + OS_INTERRUPTMASK_DSP_ARAM | OS_INTERRUPTMASK_DSP_DSP | OS_INTERRUPTMASK_AI | OS_INTERRUPTMASK_EXI | OS_INTERRUPTMASK_PI_SI | + OS_INTERRUPTMASK_PI_DI, OS_INTERRUPTMASK_DSP_AI, OS_INTERRUPTMASK_PI_CP, OS_INTERRUPTMASK_INVALID, @@ -37,6 +38,7 @@ void __RAS_OSDisableInterrupts_begin(); void __RAS_OSDisableInterrupts_end(); asm BOOL OSDisableInterrupts() { + // clang-format off #ifdef __MWERKS__ nofralloc entry __RAS_OSDisableInterrupts_begin @@ -47,9 +49,11 @@ entry __RAS_OSDisableInterrupts_end rlwinm r3, r3, 17, 31, 31 blr #endif // __MWERKS__ + // clang-format on } asm BOOL OSEnableInterrupts() { + // clang-format off #ifdef __MWERKS__ nofralloc @@ -59,9 +63,11 @@ asm BOOL OSEnableInterrupts() { rlwinm r3, r3, 17, 31, 31 blr #endif // __MWERKS__ + // clang-format on } -asm BOOL OSRestoreInterrupts(register BOOL level) { +asm BOOL OSRestoreInterrupts(register BOOL level){ +// clang-format off #ifdef __MWERKS__ nofralloc @@ -77,6 +83,7 @@ _restore: rlwinm r3, r4, 17, 31, 31 blr #endif // __MWERKS__ + // clang-format on } __OSInterruptHandler __OSSetInterruptHandler(__OSInterrupt interrupt, __OSInterruptHandler handler) { @@ -94,10 +101,10 @@ void __OSInterruptInit() { InterruptHandlerTable = (void*)OSPhysicalToCached(OS_ADDR_INTERRUPT_TABLE); memset(InterruptHandlerTable, 0, __OS_INTERRUPT_MAX * sizeof(__OSInterruptHandler)); - *(u32*)OSPhysicalToCached(OS_ADDR_PREVIOUS_INTERRUPT) = 0; - *(u32*)OSPhysicalToCached(OS_ADDR_CURRENT_INTERRUPT) = 0; + *(u32*)OSPhysicalToCached(OS_ADDR_PREVIOUS_INTERRUPT) = 0; + *(u32*)OSPhysicalToCached(OS_ADDR_CURRENT_INTERRUPT) = 0; - PI_WRITE_REG(PI_INTERRUPT_MASK, (1< #include +#include void __OSModuleInit() { __OSModuleInfoList.tail = NULL; diff --git a/libs/RVL_SDK/src/os/OSMemory.c b/libs/RVL_SDK/src/os/OSMemory.c index c751a132..af2cf90b 100644 --- a/libs/RVL_SDK/src/os/OSMemory.c +++ b/libs/RVL_SDK/src/os/OSMemory.c @@ -1,12 +1,15 @@ -#include #include +#include #include static BOOL OnShutdown(BOOL final, u32 event); static OSShutdownFunctionInfo ShutdownFunctionInfo = { - OnShutdown, 0x7F, NULL, NULL, + OnShutdown, + 0x7F, + NULL, + NULL, }; u32 OSGetPhysicalMem1Size() { @@ -34,7 +37,7 @@ static BOOL OnShutdown(BOOL final, u32 event) { return TRUE; } -void MEMIntrruptHandler(__OSInterrupt interrupt, OSContext *context) { +void MEMIntrruptHandler(__OSInterrupt interrupt, OSContext* context) { u32 addr, cause; cause = MEM_READ_REG(MEM_INT_STAT); addr = (((u32)(MEM_READ_REG(MEM_INT_ADDRH) & 0b0000001111111111) << 16) | MEM_READ_REG(MEM_INT_ADDRL)); @@ -48,7 +51,7 @@ void MEMIntrruptHandler(__OSInterrupt interrupt, OSContext *context) { __OSUnhandledException(OS_EXCEPTION_MEMORY_PROTECTION, context, cause, addr); } -void OSProtectRange(u32 chan, void *addr, u32 nBytes, u32 control) { +void OSProtectRange(u32 chan, void* addr, u32 nBytes, u32 control) { BOOL enabled; u32 start, end; u16 reg; @@ -67,7 +70,7 @@ void OSProtectRange(u32 chan, void *addr, u32 nBytes, u32 control) { __OSMaskInterrupts(0x80000000 /* OS_INTERRUPTMASK_MEM_0 */ >> (chan)); MEM_WRITE_REG(MEM_MARR0_START + 4 * chan, (start >> 10)); - __MEMRegs[(MEM_MARR0_END>>1) + 2 * chan] = (end >> 10); // todo: make it use MEM_WRITE_REG + __MEMRegs[(MEM_MARR0_END >> 1) + 2 * chan] = (end >> 10); // todo: make it use MEM_WRITE_REG reg = MEM_READ_REG(MEM_MARR_CONTROL); reg &= ~(3 << 2 * chan); @@ -81,6 +84,8 @@ void OSProtectRange(u32 chan, void *addr, u32 nBytes, u32 control) { OSRestoreInterrupts(enabled); } +// clang-format off + static asm void ConfigMEM1_24MB() { #ifdef __MWERKS__ nofralloc @@ -595,6 +600,8 @@ static asm void RealMode(register u32 addr) { #endif // __MWERKS__ } +// clang-format on + static void BATConfig() { u32 size1, size2, prot; @@ -609,13 +616,12 @@ static void BATConfig() { if (size1 < OSGetPhysicalMem1Size() && size1 == 0x01800000) { DCInvalidateRange((void*)0x81800000, 0x01800000); - MEM_WRITE_REG(MEM_CONFIG, (1<<1)); + MEM_WRITE_REG(MEM_CONFIG, (1 << 1)); } if (size1 <= 0x01800000) { RealMode((u32)ConfigMEM1_24MB); - } - else if (size1 <= 0x03000000) { + } else if (size1 <= 0x03000000) { RealMode((u32)ConfigMEM1_48MB); } @@ -625,19 +631,15 @@ static void BATConfig() { if (size2 <= 0x04000000) { if (prot <= 0x93400000) { RealMode((u32)ConfigMEM2_52MB); - } - else if (prot <= 0x93800000) { + } else if (prot <= 0x93800000) { RealMode((u32)ConfigMEM2_56MB); - } - else { + } else { RealMode((u32)ConfigMEM2_64MB); } - } - else if (size2 <= 0x08000000) { + } else if (size2 <= 0x08000000) { if (prot <= 0x97000000) { RealMode((u32)ConfigMEM2_112MB); - } - else { + } else { RealMode((u32)ConfigMEM2_128MB); } } diff --git a/libs/RVL_SDK/src/os/OSMessage.c b/libs/RVL_SDK/src/os/OSMessage.c index 61f25923..69e3cf7f 100644 --- a/libs/RVL_SDK/src/os/OSMessage.c +++ b/libs/RVL_SDK/src/os/OSMessage.c @@ -44,9 +44,9 @@ BOOL OSReceiveMessage(OSMessageQueue* queue, OSMessage* msg, s32 flags) { OSSleepThread(&queue->queueReceive); } if (msg != NULL) { - *(u32*)msg = ((u32*)queue->msgArray)[queue->firstIndex]; + *(u32*)msg = ((u32*)queue->msgArray)[queue->firstIndex]; } - + queue->firstIndex = (queue->firstIndex + 1) % queue->msgCount; queue->usedCount--; OSWakeupThread(&queue->queueSend); diff --git a/libs/RVL_SDK/src/os/OSMutex.c b/libs/RVL_SDK/src/os/OSMutex.c index 76a6ec78..cec575be 100644 --- a/libs/RVL_SDK/src/os/OSMutex.c +++ b/libs/RVL_SDK/src/os/OSMutex.c @@ -1,46 +1,46 @@ -#include #include +#include -#define ENQUEUE_MUTEX(mutex, queue, link) { \ - OSMutex* __prev = (queue)->tail; \ - if (__prev == NULL) { \ - (queue)->head = (mutex); \ - } \ - else { \ - __prev->link.next = (mutex); \ - } \ - (mutex)->link.prev = __prev; \ - (mutex)->link.next = NULL; \ - (queue)->tail = (mutex); \ -} -#define DEQUEUE_MUTEX(mutex, queue, link) { \ - OSMutex* __next = (mutex)->link.next; \ - OSMutex* __prev = (mutex)->link.prev; \ - if (__next == NULL) { \ - (queue)->tail = __prev; \ - } \ - else { \ - __next->link.prev = __prev; \ - } \ - if (__prev == NULL) { \ - (queue)->head = __next; \ - } \ - else { \ - __prev->link.next = __next; \ - } \ -} +#define ENQUEUE_MUTEX(mutex, queue, link) \ + { \ + OSMutex* __prev = (queue)->tail; \ + if (__prev == NULL) { \ + (queue)->head = (mutex); \ + } else { \ + __prev->link.next = (mutex); \ + } \ + (mutex)->link.prev = __prev; \ + (mutex)->link.next = NULL; \ + (queue)->tail = (mutex); \ + } -#define DEQUEUE_HEAD(mutex, queue, link) { \ - OSMutex* __next = mutex->link.next; \ - if (__next == NULL) { \ - (queue)->tail = NULL; \ - } \ - else { \ - __next->link.prev = NULL; \ - } \ - (queue)->head = __next; \ -} +#define DEQUEUE_MUTEX(mutex, queue, link) \ + { \ + OSMutex* __next = (mutex)->link.next; \ + OSMutex* __prev = (mutex)->link.prev; \ + if (__next == NULL) { \ + (queue)->tail = __prev; \ + } else { \ + __next->link.prev = __prev; \ + } \ + if (__prev == NULL) { \ + (queue)->head = __next; \ + } else { \ + __prev->link.next = __next; \ + } \ + } + +#define DEQUEUE_HEAD(mutex, queue, link) \ + { \ + OSMutex* __next = mutex->link.next; \ + if (__next == NULL) { \ + (queue)->tail = NULL; \ + } else { \ + __next->link.prev = NULL; \ + } \ + (queue)->head = __next; \ + } static int IsMember(OSMutexQueue* queue, OSMutex* mutex); @@ -65,12 +65,10 @@ void OSLockMutex(OSMutex* mutex) { mutex->count++; ENQUEUE_MUTEX(mutex, ¤tThread->queueMutex, link); break; - } - else if (ownerThread == currentThread) { + } else if (ownerThread == currentThread) { mutex->count++; break; - } - else { + } else { currentThread->mutex = mutex; __OSPromoteThread(mutex->thread, currentThread->priority); OSSleepThread(&mutex->queue); @@ -120,12 +118,10 @@ BOOL OSTryLockMutex(OSMutex* mutex) { mutex->count++; ENQUEUE_MUTEX(mutex, ¤tThread->queueMutex, link); locked = TRUE; - } - else if (mutex->thread == currentThread) { + } else if (mutex->thread == currentThread) { mutex->count++; locked = TRUE; - } - else { + } else { locked = FALSE; } OSRestoreInterrupts(enabled); @@ -192,13 +188,13 @@ BOOL __OSCheckMutex(OSMutex* mutex) { while (thread) { if (thread->link.next != NULL && (thread != thread->link.next->link.prev)) { return FALSE; - } + } if (thread->link.prev != NULL && (thread != thread->link.prev->link.next)) { return FALSE; - } + } if (thread->state != 4) { return FALSE; - } + } if (thread->priority < priority) { return FALSE; } @@ -209,8 +205,7 @@ BOOL __OSCheckMutex(OSMutex* mutex) { if (mutex->count <= 0) { return FALSE; } - } - else if (mutex->count != 0) { + } else if (mutex->count != 0) { return FALSE; } return TRUE; diff --git a/libs/RVL_SDK/src/os/OSNandbootInfo.c b/libs/RVL_SDK/src/os/OSNandbootInfo.c index cee1218e..334e2bcd 100644 --- a/libs/RVL_SDK/src/os/OSNandbootInfo.c +++ b/libs/RVL_SDK/src/os/OSNandbootInfo.c @@ -1,22 +1,22 @@ -#include #include +#include -#include #include +#include #include static u32 checkSum(OSNandbootInfo* info) { u32* ptr; u32 i, sum; - + ptr = (u32*)&info->argsOff; sum = 0; for (i = 0; i < OS_NANDBOOT_CHECKSUM_SIZE / sizeof(u32); i++) { sum = sum + *ptr; ptr++; } - + return sum; } @@ -27,15 +27,13 @@ BOOL __OSCreateNandbootInfo() { result = NANDPrivateGetStatus("/shared2/sys/NANDBOOTINFO", &status); if (result == NAND_RESULT_OK && status.permission == NAND_PERM_ALL_RW) { return TRUE; - } - else if (result == NAND_RESULT_OK && status.permission != NAND_PERM_ALL_RW) { + } else if (result == NAND_RESULT_OK && status.permission != NAND_PERM_ALL_RW) { result = NANDPrivateDelete("/shared2/sys/NANDBOOTINFO"); if (result != NAND_RESULT_OK) { return FALSE; } - } - else if (result != NAND_RESULT_NOEXISTS) { + } else if (result != NAND_RESULT_NOEXISTS) { return FALSE; } @@ -53,7 +51,7 @@ BOOL __OSWriteNandbootInfo(OSNandbootInfo* info) { s32 result; info->checkSum = checkSum(info); result = NANDPrivateOpen("/shared2/sys/NANDBOOTINFO", &fileInfo, NAND_ACCESS_WRITE); - + if (result == NAND_RESULT_OK) { result = NANDWrite(&fileInfo, info, sizeof(OSNandbootInfo)); @@ -66,8 +64,7 @@ BOOL __OSWriteNandbootInfo(OSNandbootInfo* info) { if (result != NAND_RESULT_OK) { return FALSE; } - } - else { + } else { return FALSE; } @@ -82,13 +79,11 @@ BOOL __OSReadNandbootInfo(OSNandbootInfo* info) { if (result == NAND_RESULT_OK) { result = NANDRead(&fileInfo, info, sizeof(OSNandbootInfo)); NANDClose(&fileInfo); - if (result != sizeof(OSNandbootInfo)) - { - memset(info, 0,sizeof(OSNandbootInfo)); + if (result != sizeof(OSNandbootInfo)) { + memset(info, 0, sizeof(OSNandbootInfo)); return FALSE; } - } - else { + } else { memset(info, 0, sizeof(OSNandbootInfo)); return FALSE; } diff --git a/libs/RVL_SDK/src/os/OSNet.c b/libs/RVL_SDK/src/os/OSNet.c index 3a227df8..9c9a946d 100644 --- a/libs/RVL_SDK/src/os/OSNet.c +++ b/libs/RVL_SDK/src/os/OSNet.c @@ -1,8 +1,8 @@ -#include #include +#include -#include #include +#include void __OSInitNet() { NWC24Err ret; @@ -43,6 +43,6 @@ DECOMP_FORCE_ACTIVE(OSNet_c, "/dev/net/kd/request"); DECOMP_FORCE_ACTIVE(OSNet_c, "NWC24SuspendScheduler"); DECOMP_FORCE_ACTIVE(OSNet_c, "NWC24ResumeScheduler"); DECOMP_FORCE_ACTIVE(OSNet_c, "NWC24iRequestShutdown"); -DECOMP_FORCE_ACTIVE(OSNet_c, "NWC24Shutdown_: Give up!\n"); // Give up! +DECOMP_FORCE_ACTIVE(OSNet_c, "NWC24Shutdown_: Give up!\n"); // Give up! DECOMP_FORCE_ACTIVE(OSNet_c, "NWC24iSetRtcCounter_"); DECOMP_FORCE_ACTIVE(OSNet_c, "/dev/net/kd/time"); diff --git a/libs/RVL_SDK/src/os/OSPlayRecord.c b/libs/RVL_SDK/src/os/OSPlayRecord.c index 371498dc..9ebcbd34 100644 --- a/libs/RVL_SDK/src/os/OSPlayRecord.c +++ b/libs/RVL_SDK/src/os/OSPlayRecord.c @@ -1,31 +1,31 @@ -#include #include +#include #include #include -static OSPlayRecord PlayRecord ALIGN32; -static NANDFileInfo FileInfo; +static OSPlayRecord PlayRecord ALIGN32; +static NANDFileInfo FileInfo; static NANDCommandBlock Block; -static OSAlarm PlayRecordAlarm; +static OSAlarm PlayRecordAlarm; DECOMP_FORCE_ACTIVE(OSPlayRecord_c, PlayRecord); -static BOOL PlayRecordGet = FALSE; -static s32 PlayRecordState = OS_RECORD_STATE_STOPPED; -static BOOL PlayRecordError = FALSE; +static BOOL PlayRecordGet = FALSE; +static s32 PlayRecordState = OS_RECORD_STATE_STOPPED; +static BOOL PlayRecordError = FALSE; -static vBOOL PlayRecordTerminate = FALSE; -static vBOOL PlayRecordTerminated = FALSE; +static vBOOL PlayRecordTerminate = FALSE; +static vBOOL PlayRecordTerminated = FALSE; -static BOOL PlayRecordRetry = FALSE; +static BOOL PlayRecordRetry = FALSE; -static OSTime PlayRecordLastCloseTime; -static s32 PlayRecordLastError = NAND_RESULT_OK; +static OSTime PlayRecordLastCloseTime; +static s32 PlayRecordLastError = NAND_RESULT_OK; // bullcrap -#define PLAY_RECORD_TICK(x) ((OSTime)(x)*(OSTime)OSSecondsToTicks(1)) +#define PLAY_RECORD_TICK(x) ((OSTime)(x) * (OSTime)OSSecondsToTicks(1)) static u32 RecordCheckSum(OSPlayRecord* record) { u32* ptr = (u32*)record->titleName; @@ -50,7 +50,7 @@ void __OSCreatePlayRecord(wchar_t* titleName, char* gameCode, char* makerCode) { PlayRecord.playStartTime = OSGetTime(); PlayRecord.playTime = PlayRecord.playStartTime; - + memset(PlayRecord.padding, 0, sizeof(PlayRecord.padding)); PlayRecord.checkSum = RecordCheckSum(&PlayRecord); @@ -59,7 +59,7 @@ void __OSCreatePlayRecord(wchar_t* titleName, char* gameCode, char* makerCode) { if (ret == NAND_RESULT_OK || ret == NAND_RESULT_EXISTS) { ret = NANDOpen(OS_RECORD_NAND_PATH, &recFile, NAND_ACCESS_WRITE); - + if (ret == NAND_RESULT_OK) { NANDWrite(&recFile, &PlayRecord, sizeof(PlayRecord)); NANDClose(&recFile); @@ -67,7 +67,7 @@ void __OSCreatePlayRecord(wchar_t* titleName, char* gameCode, char* makerCode) { } } -BOOL __OSReadPlayRecord(OSPlayRecord *record) { +BOOL __OSReadPlayRecord(OSPlayRecord* record) { NANDFileInfo fileInfo; s32 result; @@ -78,8 +78,7 @@ BOOL __OSReadPlayRecord(OSPlayRecord *record) { if (result != sizeof(OSPlayRecord)) { return FALSE; } - } - else { + } else { return FALSE; } @@ -120,17 +119,14 @@ static void PlayRecordCallback(s32 result, NANDCommandBlock* block) { OSCreateAlarm(&PlayRecordAlarm); OSSetAlarm(&PlayRecordAlarm, PLAY_RECORD_TICK(1), PlayRecordAlarmCallback); return; - } - else if (result == NAND_RESULT_OK) { + } else if (result == NAND_RESULT_OK) { if (!PlayRecordGet) { PlayRecordState = OS_RECORD_STATE_READ; - } - else { + } else { PlayRecordState = OS_RECORD_STATE_SET_ALARM; } break; - } - else { + } else { PlayRecordError = TRUE; PlayRecordState = OS_RECORD_STATE_CLOSED; return; @@ -141,8 +137,7 @@ static void PlayRecordCallback(s32 result, NANDCommandBlock* block) { PlayRecordGet = TRUE; PlayRecordLastCloseTime = PlayRecord.playTime; PlayRecordState = OS_RECORD_STATE_SEEK; - } - else { + } else { PlayRecordError = TRUE; PlayRecordState = OS_RECORD_STATE_CLOSE; } @@ -151,8 +146,7 @@ static void PlayRecordCallback(s32 result, NANDCommandBlock* block) { case OS_RECORD_STATE_SEEK: { if (result == NAND_RESULT_OK) { PlayRecordState = OS_RECORD_STATE_SET_ALARM; - } - else { + } else { PlayRecordError = TRUE; PlayRecordState = OS_RECORD_STATE_CLOSE; } @@ -166,12 +160,10 @@ static void PlayRecordCallback(s32 result, NANDCommandBlock* block) { if (result == sizeof(OSPlayRecord)) { if (OSGetTime() - PlayRecordLastCloseTime > PLAY_RECORD_TICK(300)) { PlayRecordState = OS_RECORD_STATE_CLOSE; - } - else { + } else { PlayRecordState = OS_RECORD_STATE_SEEK; } - } - else { + } else { PlayRecordError = TRUE; PlayRecordState = OS_RECORD_STATE_CLOSE; } @@ -181,14 +173,12 @@ static void PlayRecordCallback(s32 result, NANDCommandBlock* block) { if (PlayRecordError) { PlayRecordState = OS_RECORD_STATE_CLOSED; return; - } - else { + } else { if (result == NAND_RESULT_OK) { PlayRecordLastCloseTime = PlayRecord.playTime; PlayRecordState = OS_RECORD_STATE_OPEN; break; - } - else { + } else { PlayRecordState = OS_RECORD_STATE_CLOSED; PlayRecordError = TRUE; return; @@ -240,8 +230,7 @@ static void PlayRecordCallback(s32 result, NANDCommandBlock* block) { OSCreateAlarm(&PlayRecordAlarm); OSSetAlarm(&PlayRecordAlarm, PLAY_RECORD_TICK(1), PlayRecordAlarmCallback); PlayRecordRetry = TRUE; - } - else { + } else { PlayRecordError = TRUE; switch (PlayRecordState) { case OS_RECORD_STATE_READ: @@ -267,7 +256,7 @@ static void PlayRecordCallback(s32 result, NANDCommandBlock* block) { PlayRecordLastError = ret; } -void __OSStartPlayRecord() { +void __OSStartPlayRecord() { if (NANDInit() == NAND_RESULT_OK) { PlayRecordGet = FALSE; PlayRecordState = OS_RECORD_STATE_STARTED; @@ -285,27 +274,22 @@ void __OSStopPlayRecord() { BOOL enabled = OSDisableInterrupts(); PlayRecordTerminate = TRUE; - - if (PlayRecordState == OS_RECORD_STATE_CLOSED - || PlayRecordState == OS_RECORD_STATE_STARTED - || PlayRecordState == OS_RECORD_STATE_STOPPED - || PlayRecordState == OS_RECORD_STATE_TIMEOUT) { + + if (PlayRecordState == OS_RECORD_STATE_CLOSED || PlayRecordState == OS_RECORD_STATE_STARTED || PlayRecordState == OS_RECORD_STATE_STOPPED || + PlayRecordState == OS_RECORD_STATE_TIMEOUT) { OSRestoreInterrupts(enabled); - } - else if (PlayRecordState == OS_RECORD_STATE_SET_ALARM) { + } else if (PlayRecordState == OS_RECORD_STATE_SET_ALARM) { OSCancelAlarm(&PlayRecordAlarm); OSRestoreInterrupts(enabled); PlayRecord.playTime = OSGetTime(); PlayRecord.checkSum = RecordCheckSum(&PlayRecord); NANDWrite(&FileInfo, &PlayRecord, sizeof(PlayRecord)); NANDClose(&FileInfo); - } - else { + } else { if (PlayRecordRetry) { OSCancelAlarm(&PlayRecordAlarm); OSRestoreInterrupts(enabled); - } - else { + } else { OSRestoreInterrupts(enabled); start = OSGetTime(); while (TRUE) { @@ -339,6 +323,6 @@ void __OSStopPlayRecord() { } } } - + PlayRecordState = OS_RECORD_STATE_STOPPED; } diff --git a/libs/RVL_SDK/src/os/OSPlayTime.c b/libs/RVL_SDK/src/os/OSPlayTime.c index d8791e33..ac600d6c 100644 --- a/libs/RVL_SDK/src/os/OSPlayTime.c +++ b/libs/RVL_SDK/src/os/OSPlayTime.c @@ -1,11 +1,11 @@ -#include #include +#include -#include #include +#include -#include #include +#include #include @@ -14,34 +14,34 @@ #include typedef struct __OSExpireAIFadeStruct { - s16 aiBuffer[2][288]; // 0x00 - s32 aiIndex; // 0x480 - s16* aiSrcIndex; // 0x484 + s16 aiBuffer[2][288]; // 0x00 + s32 aiIndex; // 0x480 + s16* aiSrcIndex; // 0x484 - u32 frames; // 0x488 + u32 frames; // 0x488 - s16 auxL; // 0x48C - s16 auxR; // 0x48E + s16 auxL; // 0x48C + s16 auxR; // 0x48E - AIDCallback gameAIDCallback; // 0x490 + AIDCallback gameAIDCallback; // 0x490 } __OSExpireAIFadeStruct; -OSAlarm __OSExpireAlarm; -OSTime __OSExpireTime; -OSThread* __OSExpireThread; -BOOL __OSExpireSetExpiredFlag; +OSAlarm __OSExpireAlarm; +OSTime __OSExpireTime; +OSThread* __OSExpireThread; +BOOL __OSExpireSetExpiredFlag; __OSExpireAIFadeStruct* __OSExpireAIFade = NULL; -void __OSPlayTimeRebootCallback(OSAlarm* alarm, OSContext* context); -void* __OSPlayTimeRebootThread(void* args); +void __OSPlayTimeRebootCallback(OSAlarm* alarm, OSContext* context); +void* __OSPlayTimeRebootThread(void* args); void __OSPlayTimeRebootCallback(OSAlarm* alarm, OSContext* context) { void* arenaHi; u32 memSize; OSThread* thread; void* stack; - + for (thread = __OSActiveThreadQueue.head; thread; thread = thread->linkActive.next) { OSSuspendThread(thread); } @@ -50,9 +50,9 @@ void __OSPlayTimeRebootCallback(OSAlarm* alarm, OSContext* context) { arenaHi = *(void**)OSPhysicalToCached(OS_ADDR_AVAILABLE_MEM2_END); arenaHi = (void*)((u32)arenaHi - memSize); - thread = (OSThread*)arenaHi; + thread = (OSThread*)arenaHi; arenaHi = (void*)((u32)arenaHi + OSRoundUp32B(sizeof(OSThread))); - stack = arenaHi; + stack = arenaHi; if (!OSCreateThread(thread, __OSPlayTimeRebootThread, NULL, (void*)((u32)stack + 0x1000), 0x1000, 0, 0)) { __OSHotResetForError(); @@ -140,12 +140,10 @@ BOOL __OSWriteExpiredFlag() { ret = NANDWrite(&nInfo, titleId, sizeof(titleId)); if (ret < NAND_RESULT_OK) { goto close; - } - else if (ret != (int)sizeof(titleId)) { + } else if (ret != (int)sizeof(titleId)) { ret = NAND_RESULT_INVALID; goto close; - } - else { + } else { ret = NAND_RESULT_OK; } @@ -182,7 +180,7 @@ void* __OSPlayTimeRebootThread(void* args) { fadeShift = 7; } - VIWaitForRetrace(); + VIWaitForRetrace(); __OSSetVIForceDimming(TRUE, fadeShift, fadeShift); } @@ -218,13 +216,12 @@ void __OSPlayTimeAlarmExpired(OSAlarm* alarm, OSContext* context) { } OSCreateAlarm(&__OSExpireAlarm); - OSSetAlarm(&__OSExpireAlarm, OSSecondsToTicks((OSTime)240), __OSPlayTimeRebootCallback); - + OSSetAlarm(&__OSExpireAlarm, OSSecondsToTicks((OSTime)240), __OSPlayTimeRebootCallback); + while (__OSExpireThread->suspend > 0) { OSResumeThread(__OSExpireThread); } - } - else { + } else { for (thread = __OSActiveThreadQueue.head; thread; thread = thread->linkActive.next) { OSSuspendThread(thread); } @@ -233,9 +230,9 @@ void __OSPlayTimeAlarmExpired(OSAlarm* alarm, OSContext* context) { arenaHi = *(void**)OSPhysicalToCached(OS_ADDR_AVAILABLE_MEM2_END); arenaHi = (void*)((u32)arenaHi - memSize); - thread = (OSThread*)arenaHi; + thread = (OSThread*)arenaHi; arenaHi = (void*)((u32)arenaHi + OSRoundUp32B(sizeof(OSThread))); - stack = arenaHi; + stack = arenaHi; if (!OSCreateThread(thread, __OSPlayTimeRebootThread, NULL, (void*)((u32)stack + 0x1000), 0x1000, 0, 0)) { __OSHotResetForError(); @@ -247,7 +244,7 @@ void __OSPlayTimeAlarmExpired(OSAlarm* alarm, OSContext* context) { s32 __OSPlayTimeGetConsumption(ESTicketView* ticket, ESLpEntry* lpEntry, u32* entries) { s32 ret = ESP_GetConsumption(ticket->ticketId, NULL, entries); - + if (ret > ES_ERR_OK) { goto getout; } @@ -258,8 +255,8 @@ s32 __OSPlayTimeGetConsumption(ESTicketView* ticket, ESLpEntry* lpEntry, u32* en } if (*entries != 0) { - ret = ESP_GetConsumption(ticket->ticketId, lpEntry, entries); - + ret = ESP_GetConsumption(ticket->ticketId, lpEntry, entries); + if (ret != ES_ERR_OK) { ret = ret; return ret; @@ -274,8 +271,8 @@ s32 __OSGetPlayTime(ESTicketView* ticket, OSPlayTimeType* type, u32* playTime) { s32 ret; u32 i, numEntries = 0, seenOther = 0; - ESTicketView ticketAligned ALIGN32; - ESLpEntry lpEntry[ES_LIMIT_MAX] ALIGN32; + ESTicketView ticketAligned ALIGN32; + ESLpEntry lpEntry[ES_LIMIT_MAX] ALIGN32; if ((u32)ticket & 31) { memcpy(&ticketAligned, ticket, sizeof(ESTicketView)); @@ -290,7 +287,7 @@ s32 __OSGetPlayTime(ESTicketView* ticket, OSPlayTimeType* type, u32* playTime) { for (i = 0; i < ES_LIMIT_MAX; i++) { if (ticket->limits[i].code == OS_PLAYTIME_TIME_LIMIT) { *type = OS_PLAYTIME_TIME_LIMIT; - + if (numEntries == 0) { *playTime = ticket->limits[i].limit; goto getout; @@ -301,8 +298,7 @@ s32 __OSGetPlayTime(ESTicketView* ticket, OSPlayTimeType* type, u32* playTime) { } *playTime = ticket->limits[i].limit - lpEntry[i].limit; goto getout; - } - else if (ticket->limits[i].code != OS_PLAYTIME_PERMANENT) { + } else if (ticket->limits[i].code != OS_PLAYTIME_PERMANENT) { seenOther = i + 1; } } @@ -310,19 +306,17 @@ s32 __OSGetPlayTime(ESTicketView* ticket, OSPlayTimeType* type, u32* playTime) { if (!seenOther) { *type = OS_PLAYTIME_PERMANENT; *playTime = 0xFFFFFFFF; - } - else { + } else { seenOther--; if (ticket->limits[seenOther].code == OS_PLAYTIME_LAUNCH_LIMIT) { *type = OS_PLAYTIME_LAUNCH_LIMIT; *playTime = ticket->limits[seenOther].limit; - + if (numEntries > 0) { *playTime -= lpEntry[seenOther].limit; } - } - else { + } else { *type = OS_PLAYTIME_UNKNOWN; } } @@ -378,8 +372,7 @@ void __OSInitPlayTime() { if (type == OS_PLAYTIME_PERMANENT) { goto out; - } - else if (type == OS_PLAYTIME_TIME_LIMIT) { + } else if (type == OS_PLAYTIME_TIME_LIMIT) { OSAssertMsg(limit != 0, "Expired", 775); OSCreateAlarm(&__OSExpireAlarm); diff --git a/libs/RVL_SDK/src/os/OSReset.c b/libs/RVL_SDK/src/os/OSReset.c index 674b17be..c927996d 100644 --- a/libs/RVL_SDK/src/os/OSReset.c +++ b/libs/RVL_SDK/src/os/OSReset.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -8,62 +8,59 @@ #include -static OSShutdownFunctionQueue ShutdownFunctionQueue; -vBOOL __OSIsReturnToIdle; +static OSShutdownFunctionQueue ShutdownFunctionQueue; +vBOOL __OSIsReturnToIdle; -#define ENQUEUE_INFO(info, queue) { \ - OSShutdownFunctionInfo* __prev = (queue)->tail; \ - if (__prev == 0) { \ - (queue)->head = (info); \ - } \ - else { \ - __prev->next = (info); \ - } \ - (info)->prev = __prev; \ - (info)->next = 0; \ - (queue)->tail = (info); \ -} +#define ENQUEUE_INFO(info, queue) \ + { \ + OSShutdownFunctionInfo* __prev = (queue)->tail; \ + if (__prev == 0) { \ + (queue)->head = (info); \ + } else { \ + __prev->next = (info); \ + } \ + (info)->prev = __prev; \ + (info)->next = 0; \ + (queue)->tail = (info); \ + } -#define DEQUEUE_INFO(info, queue) { \ - OSShutdownFunctionInfo* __next = (info)->next; \ - OSShutdownFunctionInfo* __prev = (info)->prev; \ - if (__next == 0) { \ - (queue)->tail = __prev; \ - } \ - else { \ - __next->prev = __prev; \ - } \ - if (__prev == 0) { \ - (queue)->head = __next; \ - } \ - else { \ - __prev->next = __next; \ - } \ -} +#define DEQUEUE_INFO(info, queue) \ + { \ + OSShutdownFunctionInfo* __next = (info)->next; \ + OSShutdownFunctionInfo* __prev = (info)->prev; \ + if (__next == 0) { \ + (queue)->tail = __prev; \ + } else { \ + __next->prev = __prev; \ + } \ + if (__prev == 0) { \ + (queue)->head = __next; \ + } else { \ + __prev->next = __next; \ + } \ + } -#define ENQUEUE_INFO_PRIO(info, queue) { \ - OSShutdownFunctionInfo* __prev; \ - OSShutdownFunctionInfo* __next; \ - for (__next = (queue)->head; __next \ - && (__next->priority <= (info)->priority); \ - __next = __next->next) ; \ - \ - if (__next == 0) { \ - ENQUEUE_INFO(info, queue); \ - } \ - else { \ - (info)->next = __next; \ - __prev = __next->prev; \ - __next->prev = (info); \ - (info)->prev = __prev; \ - if (__prev == 0) { \ - (queue)->head = (info); \ - } \ - else { \ - __prev->next = (info); \ - } \ - } \ -} +#define ENQUEUE_INFO_PRIO(info, queue) \ + { \ + OSShutdownFunctionInfo* __prev; \ + OSShutdownFunctionInfo* __next; \ + for (__next = (queue)->head; __next && (__next->priority <= (info)->priority); __next = __next->next) \ + ; \ + \ + if (__next == 0) { \ + ENQUEUE_INFO(info, queue); \ + } else { \ + (info)->next = __next; \ + __prev = __next->prev; \ + __next->prev = (info); \ + (info)->prev = __prev; \ + if (__prev == 0) { \ + (queue)->head = (info); \ + } else { \ + __prev->next = (info); \ + } \ + } \ + } // They're used but pooled first. DECOMP_FORCE_ACTIVE(OSReset_c, "OSReset.c"); @@ -124,7 +121,7 @@ BOOL __OSCallShutdownFunctions(BOOL final, u32 event) { void __OSShutdownDevices(u32 event) { BOOL rc, disableRecalibration, doRecal; - switch(event) { + switch (event) { case 0: case OS_SHUTDOWN_RETURN_MENU: case OS_SHUTDOWN_LAUNCH: { @@ -147,8 +144,10 @@ void __OSShutdownDevices(u32 event) { disableRecalibration = __PADDisableRecalibration(TRUE); } - while (!__OSCallShutdownFunctions(FALSE, event)) {} - while (!__OSSyncSram()) {} + while (!__OSCallShutdownFunctions(FALSE, event)) { + } + while (!__OSSyncSram()) { + } OSDisableInterrupts(); rc = __OSCallShutdownFunctions(TRUE, event); @@ -167,15 +166,13 @@ u8 __OSGetDiscState(u8 out) { if (__DVDGetCoverStatus() != DVD_COVER_CLOSED) { return 3; - } - else if (out == 1) { + } else if (out == 1) { if (!__OSGetRTCFlags(&flags) || flags == 0) { goto status_1; } status_2: return 2; - } - else { + } else { goto status_2; status_1: return 1; @@ -222,13 +219,12 @@ void OSReturnToSetting(u8 setting) { __OSReturnToMenul(LAUNCH_ARG_SETTING, url, NULL); } - void __OSReturnToMenuForError() { - OSStateFlags state; + OSStateFlags state; __OSReadStateFlags(&state); state.discState = OS_STATE_FLAGS_DISC_CHANGED; - state.shutdownType = OS_STATE_FLAGS_SHUTDOWN_RETURN_MENU; + state.shutdownType = OS_STATE_FLAGS_SHUTDOWN_RETURN_MENU; __OSClearRTCFlags(); __OSWriteStateFlags(&state); @@ -252,9 +248,8 @@ void __OSHotResetForError() { u32 OSGetResetCode() { u32 code; if (__OSRebootParams.valid) { - code = ((1<<31) | __OSRebootParams.restartCode); - } - else { + code = ((1 << 31) | __OSRebootParams.restartCode); + } else { code = (PI_READ_REG(PI_RESET_REQUEST) & 0xFFFFFFF8) >> 3; } return code; diff --git a/libs/RVL_SDK/src/os/OSRtc.c b/libs/RVL_SDK/src/os/OSRtc.c index 00204431..55e0aa60 100644 --- a/libs/RVL_SDK/src/os/OSRtc.c +++ b/libs/RVL_SDK/src/os/OSRtc.c @@ -1,11 +1,11 @@ -#include #include +#include #include static SramControl Scb ALIGN32; -u16 OSGetGbsMode(); +u16 OSGetGbsMode(); void OSSetGbsMode(u16 mode); static BOOL GetRTC(u32* rtc) { @@ -39,7 +39,7 @@ BOOL __OSGetRTC(u32* rtc) { u32 t1; int i; - for(i = 0; i < 16; i++) { + for (i = 0; i < 16; i++) { err = 0; err |= !GetRTC(&t0); err |= !GetRTC(&t1); @@ -198,7 +198,7 @@ BOOL UnlockSram(BOOL commit, u32 offset) { } Scb.sync = WriteSram(Scb.sram + Scb.offset, Scb.offset, 64 - Scb.offset); - + if (Scb.sync) { Scb.offset = 64; } @@ -209,7 +209,6 @@ BOOL UnlockSram(BOOL commit, u32 offset) { return Scb.sync; } - BOOL __OSUnlockSram(BOOL commit) { return UnlockSram(commit, 0); } @@ -396,8 +395,7 @@ void OSSetEuRgb60Mode(u32 mode) { sram = __OSLockSram(); if (mode == (sram->ntd & 0x40)) { __OSUnlockSram(FALSE); - } - else { + } else { sram->ntd &= ~0x40; sram->ntd |= mode; __OSUnlockSram(TRUE); @@ -420,8 +418,7 @@ void OSSetWirelessID(s32 chan, u16 id) { if (sram->wirelessPadID[chan] != id) { sram->wirelessPadID[chan] = id; __OSUnlockSramEx(TRUE); - } - else { + } else { __OSUnlockSramEx(FALSE); } } @@ -465,7 +462,7 @@ BOOL __OSClearRTCFlags() { EXIUnlock(EXI_CHAN_0); return FALSE; } - + cmd = 0xA1000800; err = FALSE; err |= !EXIImm(EXI_CHAN_0, &cmd, sizeof(u32), EXI_WRITE, NULL); diff --git a/libs/RVL_SDK/src/os/OSStateFlags.c b/libs/RVL_SDK/src/os/OSStateFlags.c index fdc3d5e1..e423f5ca 100644 --- a/libs/RVL_SDK/src/os/OSStateFlags.c +++ b/libs/RVL_SDK/src/os/OSStateFlags.c @@ -1,14 +1,14 @@ -#include #include +#include #include #include -static OSStateFlags StateFlags ALIGN32; +static OSStateFlags StateFlags ALIGN32; static u32 checkSum(OSStateFlags* flags) { - u32 *ptr, i, sum; + u32 *ptr, i, sum; ptr = (u32*)&flags->lastAppType; sum = 0; @@ -28,8 +28,7 @@ BOOL __OSCreateStateFlags() { ret = NANDGetStatus(OS_STATE_FLAGS_NAND_PATH, &status); if (ret == NAND_RESULT_OK) { return TRUE; - } - else if (ret == NAND_RESULT_NOEXISTS) { + } else if (ret == NAND_RESULT_NOEXISTS) { return NANDCreate(OS_STATE_FLAGS_NAND_PATH, NAND_PERM_ALL_RW, 0) == NAND_RESULT_OK ? TRUE : FALSE; } return FALSE; @@ -57,8 +56,7 @@ BOOL __OSWriteStateFlags(OSStateFlags* flags) { if (ret != NAND_RESULT_OK) { return FALSE; } - } - else { + } else { return FALSE; } @@ -80,8 +78,7 @@ BOOL __OSReadStateFlags(OSStateFlags* flags) { memset(flags, 0, sizeof(StateFlags)); return FALSE; } - } - else { + } else { memset(flags, 0, sizeof(OSStateFlags)); return FALSE; } diff --git a/libs/RVL_SDK/src/os/OSStateTM.c b/libs/RVL_SDK/src/os/OSStateTM.c index 7c157f08..3c29b4fd 100644 --- a/libs/RVL_SDK/src/os/OSStateTM.c +++ b/libs/RVL_SDK/src/os/OSStateTM.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -9,35 +9,35 @@ #include enum { - STM_IOCTL_REG_STM_EVENT = 0x1000, - STM_IOCTL_HOT_RESET = 0x2001, - STM_IOCTL_SHUTDOWN_TO_SBY = 0x2003, - STM_IOCTL_SHUTDOWN_TO_IDL = 0x2004, - STM_IOCTL_UNREG_STM_EVENT = 0x3002, - STM_IOCTL_SET_VI_DIM = 0x5001, + STM_IOCTL_REG_STM_EVENT = 0x1000, + STM_IOCTL_HOT_RESET = 0x2001, + STM_IOCTL_SHUTDOWN_TO_SBY = 0x2003, + STM_IOCTL_SHUTDOWN_TO_IDL = 0x2004, + STM_IOCTL_UNREG_STM_EVENT = 0x3002, + STM_IOCTL_SET_VI_DIM = 0x5001, STM_IOCTL_SET_IDLE_LED_MODE = 0x6002, }; -u32 StmVdOutBuf[8] ALIGN32; -u32 StmVdInBuf[8] ALIGN32; +u32 StmVdOutBuf[8] ALIGN32; +u32 StmVdInBuf[8] ALIGN32; -u32 StmImOutBuf[8] ALIGN32; -u32 StmImInBuf[8] ALIGN32; +u32 StmImOutBuf[8] ALIGN32; +u32 StmImInBuf[8] ALIGN32; -u32 StmEhOutBuf[8] ALIGN32; -u32 StmEhInBuf[8] ALIGN32; +u32 StmEhOutBuf[8] ALIGN32; +u32 StmEhInBuf[8] ALIGN32; -OSResetCallback ResetCallback; -OSPowerCallback PowerCallback; +OSResetCallback ResetCallback; +OSPowerCallback PowerCallback; -BOOL StmVdInUse; -BOOL StmEhRegistered; +BOOL StmVdInUse; +BOOL StmEhRegistered; -int StmEhDesc, StmImDesc; +int StmEhDesc, StmImDesc; -BOOL StmReady; +BOOL StmReady; -BOOL ResetDown; +BOOL ResetDown; void __OSDefaultResetCallback(); void __OSDefaultPowerCallback(); @@ -49,17 +49,18 @@ static void LockUp() { OSDisableInterrupts(); ICFlashInvalidate(); - while (TRUE) {} + while (TRUE) { + } } void __OSRegisterStateEvent() { BOOL enabled; enabled = OSDisableInterrupts(); - if (IOS_IoctlAsync(StmEhDesc, STM_IOCTL_REG_STM_EVENT, StmEhInBuf, sizeof(StmEhInBuf), StmEhOutBuf, sizeof(StmEhOutBuf), __OSStateEventHandler, NULL) == IPC_RESULT_OK) { + if (IOS_IoctlAsync(StmEhDesc, STM_IOCTL_REG_STM_EVENT, StmEhInBuf, sizeof(StmEhInBuf), StmEhOutBuf, sizeof(StmEhOutBuf), __OSStateEventHandler, + NULL) == IPC_RESULT_OK) { StmEhRegistered = TRUE; - } - else { + } else { StmEhRegistered = FALSE; } @@ -67,7 +68,7 @@ void __OSRegisterStateEvent() { } BOOL __OSGetResetButtonStateRaw() { - return (!(PI_READ_REG(PI_INTERRUPT_CAUSE) & (1< #include +#include #include asm void SystemCallVector() { + // clang-format off #ifdef __MWERKS__ entry __OSSystemCallVectorStart nofralloc @@ -17,6 +18,7 @@ entry __OSSystemCallVectorStart entry __OSSystemCallVectorEnd nop #endif // __MWERKS__ + // clang-format on } void __OSInitSystemCall() { diff --git a/libs/RVL_SDK/src/os/OSThread.c b/libs/RVL_SDK/src/os/OSThread.c index fa475282..71b3e2c7 100644 --- a/libs/RVL_SDK/src/os/OSThread.c +++ b/libs/RVL_SDK/src/os/OSThread.c @@ -1,96 +1,93 @@ #include -#include #include +#include #include /* Macros for dequeueing and enqueueing thread */ -#define ENQUEUE_THREAD(thread, queue, link) { \ - OSThread* __prev = (queue)->tail; \ - if (__prev == NULL) { \ - (queue)->head = (thread); \ - } \ - else { \ - __prev->link.next = (thread); \ - } \ - (thread)->link.prev = __prev; \ - (thread)->link.next = NULL; \ - (queue)->tail = (thread); \ -} +#define ENQUEUE_THREAD(thread, queue, link) \ + { \ + OSThread* __prev = (queue)->tail; \ + if (__prev == NULL) { \ + (queue)->head = (thread); \ + } else { \ + __prev->link.next = (thread); \ + } \ + (thread)->link.prev = __prev; \ + (thread)->link.next = NULL; \ + (queue)->tail = (thread); \ + } -#define DEQUEUE_THREAD(thread, queue, link) { \ - OSThread* __next = (thread)->link.next; \ - OSThread* __prev = (thread)->link.prev; \ - if (__next == NULL) { \ - (queue)->tail = __prev; \ - } \ - else { \ - __next->link.prev = __prev; \ - } \ - if (__prev == NULL) { \ - (queue)->head = __next; \ - } \ - else { \ - __prev->link.next = __next; \ - } \ -} +#define DEQUEUE_THREAD(thread, queue, link) \ + { \ + OSThread* __next = (thread)->link.next; \ + OSThread* __prev = (thread)->link.prev; \ + if (__next == NULL) { \ + (queue)->tail = __prev; \ + } else { \ + __next->link.prev = __prev; \ + } \ + if (__prev == NULL) { \ + (queue)->head = __next; \ + } else { \ + __prev->link.next = __next; \ + } \ + } -#define ENQUEUE_THREAD_PRIO(thread, queue, link) { \ - OSThread* __prev; \ - OSThread* __next; \ - for(__next = (queue)->head; __next \ - && (__next->priority <= (thread)->priority); \ - __next = __next->link.next) ; \ - \ - if (__next == NULL) { \ - ENQUEUE_THREAD(thread, queue, link); \ - } \ - else { \ - (thread)->link.next = __next; \ - __prev = __next->link.prev; \ - __next->link.prev = (thread); \ - (thread)->link.prev = __prev; \ - if (__prev == NULL) { \ - (queue)->head = (thread); \ - } \ - else { \ - __prev->link.next = (thread); \ - } \ - } \ -} +#define ENQUEUE_THREAD_PRIO(thread, queue, link) \ + { \ + OSThread* __prev; \ + OSThread* __next; \ + for (__next = (queue)->head; __next && (__next->priority <= (thread)->priority); __next = __next->link.next) \ + ; \ + \ + if (__next == NULL) { \ + ENQUEUE_THREAD(thread, queue, link); \ + } else { \ + (thread)->link.next = __next; \ + __prev = __next->link.prev; \ + __next->link.prev = (thread); \ + (thread)->link.prev = __prev; \ + if (__prev == NULL) { \ + (queue)->head = (thread); \ + } else { \ + __prev->link.next = (thread); \ + } \ + } \ + } -#define DEQUEUE_HEAD(thread, queue, link) { \ - OSThread* __next = thread->link.next; \ - if (__next == NULL) { \ - (queue)->tail = NULL; \ - } \ - else { \ - __next->link.prev = NULL; \ - } \ - (queue)->head = __next; \ -} +#define DEQUEUE_HEAD(thread, queue, link) \ + { \ + OSThread* __next = thread->link.next; \ + if (__next == NULL) { \ + (queue)->tail = NULL; \ + } else { \ + __next->link.prev = NULL; \ + } \ + (queue)->head = __next; \ + } /* Exactly named `IsSuspended` for assert */ -#define IsSuspended(suspend) (suspend > 0) +#define IsSuspended(suspend) (suspend > 0) -#define OS_THREAD_STACK_MAGIC 0xDEADBABE +#define OS_THREAD_STACK_MAGIC 0xDEADBABE /* Run queue */ -static vu32 RunQueueBits; -static OSThreadQueue RunQueue[OS_PRIORITY_MAX + 1]; -static vBOOL RunQueueHint; -static vs32 Reschedule; - +static vu32 RunQueueBits; +static OSThreadQueue RunQueue[OS_PRIORITY_MAX + 1]; +static vBOOL RunQueueHint; +static vs32 Reschedule; + /* Idle and default stuff */ -static OSThread IdleThread; -static OSThread DefaultThread; -static OSContext IdleContext; +static OSThread IdleThread; +static OSThread DefaultThread; +static OSContext IdleContext; /* Auto generated by linker. */ -extern u8 _stack_addr[]; -extern u8 _stack_end[]; +extern u8 _stack_addr[]; +extern u8 _stack_end[]; /* Queue initialization */ @@ -116,7 +113,8 @@ void OSSetCurrentThread(OSThread* thread); /* Switch thread callback */ -static void DefaultSwitchThreadCallback(OSThread* from, OSThread* to) {} +static void DefaultSwitchThreadCallback(OSThread* from, OSThread* to) { +} static OSSwitchThreadCallback SwitchThreadCallback = DefaultSwitchThreadCallback; OSSwitchThreadCallback OSSetSwitchThreadCallback(OSSwitchThreadCallback callback) { @@ -205,7 +203,7 @@ void __OSSwitchThread(OSThread* thread) { OSLoadContext(&thread->context); } -BOOL OSIsThreadSuspended(OSThread *thread) { +BOOL OSIsThreadSuspended(OSThread* thread) { return (IsSuspended(thread->suspend)) ? TRUE : FALSE; } @@ -244,14 +242,14 @@ s32 OSEnableScheduler() { return count; } -static void SetRun(OSThread *thread) { +static void SetRun(OSThread* thread) { thread->queue = &RunQueue[thread->priority]; ENQUEUE_THREAD(thread, thread->queue, link); RunQueueBits |= 1 << (OS_PRIORITY_MAX - thread->priority); RunQueueHint = TRUE; } -static void UnsetRun(OSThread *thread) NO_INLINE { +static void UnsetRun(OSThread* thread) NO_INLINE { OSThreadQueue* queue; queue = thread->queue; DEQUEUE_THREAD(thread, queue, link); @@ -261,7 +259,7 @@ static void UnsetRun(OSThread *thread) NO_INLINE { thread->queue = NULL; } -OSPriority __OSGetEffectivePriority(OSThread *thread) { +OSPriority __OSGetEffectivePriority(OSThread* thread) { OSPriority priority; OSMutex* mutex; OSThread* blocked; @@ -275,7 +273,7 @@ OSPriority __OSGetEffectivePriority(OSThread *thread) { return priority; } -OSThread* SetEffectivePriority(OSThread *thread, OSPriority priority) { +OSThread* SetEffectivePriority(OSThread* thread, OSPriority priority) { switch (thread->state) { case OS_THREAD_STATE_READY: { UnsetRun(thread); @@ -320,7 +318,7 @@ static void UpdatePriority(OSThread* thread) { } while (thread); } -void __OSPromoteThread(OSThread *thread, OSPriority priority) { +void __OSPromoteThread(OSThread* thread, OSPriority priority) { do { if (IsSuspended(thread->suspend) || thread->priority <= priority) { break; @@ -368,7 +366,8 @@ OSThread* SelectThread(BOOL yield) { OSSetCurrentContext(&IdleContext); do { OSEnableInterrupts(); - while (RunQueueBits == 0) {} + while (RunQueueBits == 0) { + } OSDisableInterrupts(); } while (RunQueueBits == 0); OSClearContext(&IdleContext); @@ -391,7 +390,6 @@ OSThread* SelectThread(BOOL yield) { return nextThread; } - void __OSReschedule() { if (RunQueueHint) { SelectThread(FALSE); @@ -470,8 +468,7 @@ void OSExitThread(void* val) { if (currentThread->attr & OS_THREAD_ATTR_DETACH) { DEQUEUE_THREAD(currentThread, &__OSActiveThreadQueue, linkActive); currentThread->state = OS_THREAD_STATE_UNINITIALIZED; - } - else { + } else { currentThread->state = OS_THREAD_STATE_DEAD; currentThread->value = val; } @@ -518,8 +515,7 @@ void OSCancelThread(OSThread* thread) { if (thread->attr & OS_THREAD_ATTR_DETACH) { DEQUEUE_THREAD(thread, &__OSActiveThreadQueue, linkActive); thread->state = OS_THREAD_STATE_UNINITIALIZED; - } - else { + } else { thread->state = OS_THREAD_STATE_DEAD; } @@ -570,7 +566,7 @@ void OSDetachThread(OSThread* thread) { s32 OSResumeThread(OSThread* thread) { BOOL enabled; - s32 suspendCount; + s32 suspendCount; enabled = OSDisableInterrupts(); @@ -578,8 +574,7 @@ s32 OSResumeThread(OSThread* thread) { if (thread->suspend < 0) { thread->suspend = 0; - } - else if (thread->suspend == 0) { + } else if (thread->suspend == 0) { switch (thread->state) { case OS_THREAD_STATE_READY: { thread->priority = __OSGetEffectivePriority(thread); @@ -609,7 +604,7 @@ s32 OSResumeThread(OSThread* thread) { s32 OSSuspendThread(OSThread* thread) { BOOL enabled; - s32 suspendCount; + s32 suspendCount; enabled = OSDisableInterrupts(); suspendCount = thread->suspend++; @@ -733,12 +728,13 @@ static BOOL IsMember(OSThreadQueue* queue, OSThread* thread) { return FALSE; } -#define OS_ACTIVE_THREAD_ASSERT(exp, line) { \ - if (!(exp)) { \ - OSReport("OSCheckActiveThreads: Failed "#exp" in %d\n", line); \ - OSHalt("", line); \ - } \ -} +#define OS_ACTIVE_THREAD_ASSERT(exp, line) \ + { \ + if (!(exp)) { \ + OSReport("OSCheckActiveThreads: Failed " #exp " in %d\n", line); \ + OSHalt("", line); \ + } \ + } s32 OSCheckActiveThreads() { OSThread* thread; @@ -748,11 +744,11 @@ s32 OSCheckActiveThreads() { BOOL enabled = OSDisableInterrupts(); + // clang-format off for (prio = OS_PRIORITY_MIN; prio <= OS_PRIORITY_MAX; prio++) { if (RunQueueBits & (1 << (OS_PRIORITY_MAX - prio))) { OS_ACTIVE_THREAD_ASSERT(RunQueue[prio].head != NULL && RunQueue[prio].tail != NULL, 1513); - } - else { + } else { OS_ACTIVE_THREAD_ASSERT(RunQueue[prio].head == NULL && RunQueue[prio].tail == NULL, 1518); } OS_ACTIVE_THREAD_ASSERT(CheckThreadQueue(&RunQueue[prio]), 1520); @@ -794,8 +790,7 @@ s32 OSCheckActiveThreads() { OS_ACTIVE_THREAD_ASSERT(IsMember(thread->queue, thread), 1564); if (!IsSuspended(thread->suspend)) { OS_ACTIVE_THREAD_ASSERT(thread->priority == __OSGetEffectivePriority(thread), 1567); - } - else { + } else { OS_ACTIVE_THREAD_ASSERT(thread->priority == 32, 1571); } OS_ACTIVE_THREAD_ASSERT(!__OSCheckDeadLock(thread), 1573); @@ -815,6 +810,8 @@ s32 OSCheckActiveThreads() { OS_ACTIVE_THREAD_ASSERT(__OSCheckMutexes(thread), 1588); } + // clang-format on + OSRestoreInterrupts(enabled); return threadId; } @@ -834,7 +831,7 @@ void* OSGetThreadSpecific(s32 index) { return NULL; } -static void SleepAlarmHandler(OSAlarm *alarm, OSContext *context) { +static void SleepAlarmHandler(OSAlarm* alarm, OSContext* context) { OSResumeThread((OSThread*)OSGetAlarmUserData(alarm)); } @@ -863,4 +860,4 @@ void OSSleepTicks(OSTime tick) { OSRestoreInterrupts(enabled); } -DECOMP_FORCE_ACTIVE(OSThread_c, IdleThread); // IdleThread is unused but linked anyway. +DECOMP_FORCE_ACTIVE(OSThread_c, IdleThread); // IdleThread is unused but linked anyway. diff --git a/libs/RVL_SDK/src/os/OSTime.c b/libs/RVL_SDK/src/os/OSTime.c index f7c7e1bd..2c16bbe6 100644 --- a/libs/RVL_SDK/src/os/OSTime.c +++ b/libs/RVL_SDK/src/os/OSTime.c @@ -1,18 +1,20 @@ -#include #include +#include #include -#define MICROSEC_MAX 1000 -#define MILLISEC_MAX 1000 -#define MONTH_MAX 12 -#define WEEK_DAY_MAX 7 -#define YEAR_DAY_MAX 365 +#define MICROSEC_MAX 1000 +#define MILLISEC_MAX 1000 +#define MONTH_MAX 12 +#define WEEK_DAY_MAX 7 +#define YEAR_DAY_MAX 365 -#define SECS_IN_MIN 60 -#define SECS_IN_HOUR (SECS_IN_MIN * 60) -#define SECS_IN_DAY (SECS_IN_HOUR * 24) -#define SECS_IN_YEAR (SECS_IN_DAY * 365) +#define SECS_IN_MIN 60 +#define SECS_IN_HOUR (SECS_IN_MIN * 60) +#define SECS_IN_DAY (SECS_IN_HOUR * 24) +#define SECS_IN_YEAR (SECS_IN_DAY * 365) + +// clang-format off static int YearDays[MONTH_MAX] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; static int LeapYearDays[MONTH_MAX] = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}; @@ -56,9 +58,11 @@ asm static void __SetTime(OSTime time) { #endif // __MWERKS__ } +// clang-format on + void __OSSetTime(OSTime time) { OSTime* systemTime = &__OSSystemTime; - BOOL enabled = OSDisableInterrupts(); + BOOL enabled = OSDisableInterrupts(); *systemTime += OSGetTime() - time; __SetTime(time); @@ -68,18 +72,18 @@ void __OSSetTime(OSTime time) { OSTime __OSGetSystemTime() { OSTime* systemTime = &__OSSystemTime; - BOOL enabled = OSDisableInterrupts(); + BOOL enabled = OSDisableInterrupts(); - OSTime result = OSGetTime() + *systemTime; + OSTime result = OSGetTime() + *systemTime; OSRestoreInterrupts(enabled); return result; } OSTime __OSTimeToSystemTime(OSTime time) { OSTime* systemTime = &__OSSystemTime; - BOOL enabled = OSDisableInterrupts(); + BOOL enabled = OSDisableInterrupts(); - OSTime result = *systemTime + time; + OSTime result = *systemTime + time; OSRestoreInterrupts(enabled); return result; } @@ -97,16 +101,17 @@ static int GetLeapDays(int year) { if (year < 1) { return 0; } - return (year + 3) / 4 - (year - 1) / 100 + (year - 1) / 400; + return (year + 3) / 4 - (year - 1) / 100 + (year - 1) / 400; } -static void GetDates(s32 days, OSCalendarTime *pTime) NO_INLINE { +static void GetDates(s32 days, OSCalendarTime* pTime) NO_INLINE { int year, dayCount, month; int* monthArr; pTime->wday = (days + 6) % 7; - for (year = days / YEAR_DAY_MAX; days < (dayCount = GetLeapDays(year) + YEAR_DAY_MAX * year); --year); + for (year = days / YEAR_DAY_MAX; days < (dayCount = GetLeapDays(year) + YEAR_DAY_MAX * year); --year) + ; days -= dayCount; pTime->year = year; @@ -114,16 +119,17 @@ static void GetDates(s32 days, OSCalendarTime *pTime) NO_INLINE { monthArr = IsLeapYear(year) ? LeapYearDays : YearDays; - for (month = MONTH_MAX; days < monthArr[--month];) {} + for (month = MONTH_MAX; days < monthArr[--month];) { + } pTime->mon = month; pTime->mday = days - monthArr[month] + 1; } -void OSTicksToCalendarTime(OSTime ticks, OSCalendarTime *pTime) { - int numDays; - int numSecs; - OSTime ticksAfter; +void OSTicksToCalendarTime(OSTime ticks, OSCalendarTime* pTime) { + int numDays; + int numSecs; + OSTime ticksAfter; ticksAfter = ticks % OSSecondsToTicks(1); @@ -151,10 +157,10 @@ void OSTicksToCalendarTime(OSTime ticks, OSCalendarTime *pTime) { } OSTime OSCalendarTimeToTicks(OSCalendarTime* pTime) { - OSTime secs; - int ov_mon; - int mon; - int year; + OSTime secs; + int ov_mon; + int mon; + int year; ov_mon = pTime->mon / MONTH_MAX; mon = pTime->mon - (ov_mon * MONTH_MAX); @@ -166,11 +172,8 @@ OSTime OSCalendarTimeToTicks(OSCalendarTime* pTime) { year = pTime->year + ov_mon; - secs = (OSTime)SECS_IN_YEAR * year + - (OSTime)SECS_IN_DAY * (GetLeapDays(year) + GetYearDays(year, mon) + pTime->mday - 1) + - (OSTime)SECS_IN_HOUR * pTime->hour + - (OSTime)SECS_IN_MIN * pTime->min + - pTime->sec - (OSTime)0xEB1E1BF80; + secs = (OSTime)SECS_IN_YEAR * year + (OSTime)SECS_IN_DAY * (GetLeapDays(year) + GetYearDays(year, mon) + pTime->mday - 1) + + (OSTime)SECS_IN_HOUR * pTime->hour + (OSTime)SECS_IN_MIN * pTime->min + pTime->sec - (OSTime)0xEB1E1BF80; return OSSecondsToTicks(secs) + OSMillisecondsToTicks((OSTime)pTime->msec) + OSMicrosecondsToTicks((OSTime)pTime->usec); } diff --git a/libs/RVL_SDK/src/os/OSUtf.c b/libs/RVL_SDK/src/os/OSUtf.c index 280a5786..a83010df 100644 --- a/libs/RVL_SDK/src/os/OSUtf.c +++ b/libs/RVL_SDK/src/os/OSUtf.c @@ -1,12 +1,8 @@ #include static u16 UcsAnsiTable[32] = { - 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, - 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, - 0x0152, 0x0000, 0x017D, 0x0000, 0x0000, 0x2018, - 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, - 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, - 0x017E, 0x0178, + 0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x017D, 0x0000, + 0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x017E, 0x0178, }; char* OSUTF8to32(const char* utf8, u32* utf32) { @@ -22,20 +18,16 @@ char* OSUTF8to32(const char* utf8, u32* utf32) { if ((u32)(c & 0x80) == 0) { u = c; len = 0; - } - else if ((u32)(c & 0xE0) == 0xC0) { + } else if ((u32)(c & 0xE0) == 0xC0) { u = c & 0x1F; len = 1; - } - else if ((u32)(c & 0xF0) == 0xE0) { + } else if ((u32)(c & 0xF0) == 0xE0) { u = c & 0xF; len = 2; - } - else if ((u32)(c & 0xF8) == 0xF0) { + } else if ((u32)(c & 0xF8) == 0xF0) { u = c & 7; len = 3; - } - else { + } else { return NULL; } @@ -53,13 +45,11 @@ char* OSUTF8to32(const char* utf8, u32* utf32) { if (len != 0) { return NULL; } - } - else if (u <= 0x7FF) { + } else if (u <= 0x7FF) { if (len != 1) { return NULL; } - } - else if (u <= 0xFFFF) { + } else if (u <= 0xFFFF) { if (len != 2) { return NULL; } @@ -85,19 +75,16 @@ u16* OSUTF16to32(const u16* utf16, u32* utf32) { if (w1 < 0xD800 || 0xDFFF < w1) { u = w1; - } - else if (w1 <= 0xDBFF) { + } else if (w1 <= 0xDBFF) { w2 = *utf16++; if (0xDC00 <= w2 && w2 <= 0xDFFF) { u = ((w1 & 0x03FF) << 10) | (w2 & 0x03FF); u += 0x10000; - } - else { + } else { return NULL; } - } - else { + } else { return NULL; } diff --git a/libs/RVL_SDK/src/os/__ppc_eabi_init.cpp b/libs/RVL_SDK/src/os/__ppc_eabi_init.cpp index 21f3625d..6a1f070c 100644 --- a/libs/RVL_SDK/src/os/__ppc_eabi_init.cpp +++ b/libs/RVL_SDK/src/os/__ppc_eabi_init.cpp @@ -24,13 +24,14 @@ extern void exit(); typedef void (*VoidPTR)(); #pragma section code_type ".ctors$00" -__declspec(section ".ctors$00") extern VoidPTR _ctors[]; +__declspec(section ".ctors$00") extern VoidPTR _ctors[]; #pragma section code_type ".dtors$00" -__declspec(section ".dtors$00") extern VoidPTR _dtors[]; +__declspec(section ".dtors$00") extern VoidPTR _dtors[]; #pragma section code_type ".init" asm void __init_hardware() { + // clang-format off #ifdef __MWERKS__ nofralloc @@ -48,9 +49,11 @@ asm void __init_hardware() { mtlr r31 blr #endif + // clang-format on } asm void __flush_cache(void* pAddress, unsigned int size) { + // clang-format off #ifdef __MWERKS__ lis r5, 0xFFFF ori r5, r5, 0xFFF1 @@ -74,11 +77,13 @@ loop: blr #endif + // clang-format on } #pragma section code_type ".text" asm void __init_user() { + // clang-format off #ifdef __MWERKS__ fralloc @@ -87,17 +92,18 @@ asm void __init_user() { frfree blr #endif + // clang-format on } static void __init_cpp() { - VoidPTR *ctor; + VoidPTR* ctor; for (ctor = _ctors; *ctor != 0; ctor++) { (*ctor)(); } } static void __fini_cpp() { - VoidPTR *dtor; + VoidPTR* dtor; for (dtor = _dtors; *dtor != 0; dtor++) { (*dtor)(); } diff --git a/libs/RVL_SDK/src/os/time.dolphin.c b/libs/RVL_SDK/src/os/time.dolphin.c index 59eea920..9e82404b 100644 --- a/libs/RVL_SDK/src/os/time.dolphin.c +++ b/libs/RVL_SDK/src/os/time.dolphin.c @@ -1,5 +1,5 @@ -#include #include +#include OSTime __get_clock() { return __OSGetSystemTime(); diff --git a/libs/RVL_SDK/src/pad/Pad.c b/libs/RVL_SDK/src/pad/Pad.c index 76fbcb19..029aa1ab 100644 --- a/libs/RVL_SDK/src/pad/Pad.c +++ b/libs/RVL_SDK/src/pad/Pad.c @@ -1,36 +1,21 @@ #include -#include #include +#include #include #include -#include #include +#include #include SDKDefineVersion(PAD, "Apr 20 2010", "11:20:52"); -#define PAD_ALL \ - ( \ - PAD_BUTTON_LEFT | \ - PAD_BUTTON_RIGHT | \ - PAD_BUTTON_DOWN | \ - PAD_BUTTON_UP | \ - PAD_TRIGGER_Z | \ - PAD_TRIGGER_R | \ - PAD_TRIGGER_L | \ - PAD_BUTTON_A | \ - PAD_BUTTON_B | \ - PAD_BUTTON_X | \ - PAD_BUTTON_Y | \ - PAD_BUTTON_MENU | \ - 0x2000 | \ - 0x0080 \ - ) - +#define PAD_ALL \ + (PAD_BUTTON_LEFT | PAD_BUTTON_RIGHT | PAD_BUTTON_DOWN | PAD_BUTTON_UP | PAD_TRIGGER_Z | PAD_TRIGGER_R | PAD_TRIGGER_L | PAD_BUTTON_A | \ + PAD_BUTTON_B | PAD_BUTTON_X | PAD_BUTTON_Y | PAD_BUTTON_MENU | 0x2000 | 0x0080) static BOOL OnShutdown(BOOL final, u32 code); @@ -57,8 +42,8 @@ static u32 CheckingBits; static u32 PendingBits; static u32 BarrelBits; -static u32 Type[PAD_MAX_CONTROLLER]; -static PADStatus Origin[PAD_MAX_CONTROLLER]; +static u32 Type[PAD_MAX_CONTROLLER]; +static PADStatus Origin[PAD_MAX_CONTROLLER]; u32 __PADSpec; @@ -66,15 +51,15 @@ static void PADTypeAndStatusCallback(s32 chan, u32 type); static void DoReset(); static void PADEnable(s32 chan); static void PADDisable(s32 chan); -static void PADProbeCallback(s32 chan, u32 error, OSContext *context); +static void PADProbeCallback(s32 chan, u32 error, OSContext* context); static void UpdateOrigin(s32 chan); -static void PADOriginCallback(s32 chan, u32 error, OSContext *context); +static void PADOriginCallback(s32 chan, u32 error, OSContext* context); static void PADReceiveCheckCallback(s32 chan, u32 error); -static void SPEC0_MakeStatus(s32 chan, PADStatus *status, u32 data[2]); -static void SPEC1_MakeStatus(s32 chan, PADStatus *status, u32 data[2]); -static s8 ClampS8(s8 var, s8 org); -static u8 ClampU8(u8 var, u8 org); -static void SPEC2_MakeStatus(s32 chan, PADStatus *status, u32 data[2]); +static void SPEC0_MakeStatus(s32 chan, PADStatus* status, u32 data[2]); +static void SPEC1_MakeStatus(s32 chan, PADStatus* status, u32 data[2]); +static s8 ClampS8(s8 var, s8 org); +static u8 ClampU8(u8 var, u8 org); +static void SPEC2_MakeStatus(s32 chan, PADStatus* status, u32 data[2]); typedef void (*SPECCallback)(s32, PADStatus*, u32*); static SPECCallback MakeStatus = SPEC2_MakeStatus; @@ -120,7 +105,7 @@ static void DoReset() { if (ResettingChan != 32) { chanBit = (PAD_CHAN0_BIT >> ResettingChan); ResettingBits &= ~chanBit; - + memset(&Origin[ResettingChan], 0, sizeof(PADStatus)); SIGetTypeAsync(ResettingChan, PADTypeAndStatusCallback); } @@ -242,16 +227,13 @@ static void PADTypeAndStatusCallback(s32 chan, u32 type) { if (!(type & SI_GC_WIRELESS) || (type & SI_WIRELESS_IR)) { if (recalibrate) { rc = SITransfer(ResettingChan, &CmdCalibrate, 3, &Origin[ResettingChan], 10, PADOriginCallback, 0); - } - else { + } else { rc = SITransfer(ResettingChan, &CmdReadOrigin, 1, &Origin[ResettingChan], 10, PADOriginCallback, 0); } - } - else if ((type & SI_WIRELESS_FIX_ID) && (type & SI_WIRELESS_CONT_MASK) == SI_WIRELESS_CONT && !(type & SI_WIRELESS_LITE)) { + } else if ((type & SI_WIRELESS_FIX_ID) && (type & SI_WIRELESS_CONT_MASK) == SI_WIRELESS_CONT && !(type & SI_WIRELESS_LITE)) { if (type & SI_WIRELESS_RECEIVED) { rc = SITransfer(ResettingChan, &CmdReadOrigin, 1, &Origin[ResettingChan], 10, PADOriginCallback, 0); - } - else { + } else { rc = SITransfer(ResettingChan, &CmdProbeDevice[ResettingChan], 3, &Origin[ResettingChan], 8, PADProbeCallback, 0); } } @@ -276,14 +258,11 @@ static void PADReceiveCheckCallback(s32 chan, u32 type) { WaitingBits &= ~chanBit; CheckingBits &= ~chanBit; - if (!(error & - (SI_ERROR_UNDER_RUN | SI_ERROR_OVER_RUN | SI_ERROR_NO_RESPONSE | SI_ERROR_COLLISION)) && - (type & SI_GC_WIRELESS) && (type & SI_WIRELESS_FIX_ID) && (type & SI_WIRELESS_RECEIVED) && - !(type & SI_WIRELESS_IR) && (type & SI_WIRELESS_CONT_MASK) == SI_WIRELESS_CONT && - !(type & SI_WIRELESS_LITE)) { + if (!(error & (SI_ERROR_UNDER_RUN | SI_ERROR_OVER_RUN | SI_ERROR_NO_RESPONSE | SI_ERROR_COLLISION)) && (type & SI_GC_WIRELESS) && + (type & SI_WIRELESS_FIX_ID) && (type & SI_WIRELESS_RECEIVED) && !(type & SI_WIRELESS_IR) && + (type & SI_WIRELESS_CONT_MASK) == SI_WIRELESS_CONT && !(type & SI_WIRELESS_LITE)) { SITransfer(chan, &CmdReadOrigin, 1, &Origin[chan], 10, PADOriginUpdateCallback, 0); - } - else { + } else { PADDisable(chan); } } @@ -347,7 +326,7 @@ BOOL PADInit() { if (Initialized) { return 1; } - + OSRegisterVersion(GetVersion(PAD)); if (__PADSpec) @@ -357,11 +336,8 @@ BOOL PADInit() { if (__PADFixBits != 0) { OSTime time = OSGetTime(); - __OSWirelessPadFixMode = (u16)((((time) & 0xffff) + - ((time >> 16) & 0xffff) + - ((time >> 32) & 0xffff) + - ((time >> 48) & 0xffff)) & 0x3fff); - + __OSWirelessPadFixMode = (u16)((((time) & 0xffff) + ((time >> 16) & 0xffff) + ((time >> 32) & 0xffff) + ((time >> 48) & 0xffff)) & 0x3fff); + RecalibrateBits = PAD_CHAN0_BIT | PAD_CHAN1_BIT | PAD_CHAN2_BIT | PAD_CHAN3_BIT; } @@ -418,20 +394,16 @@ u32 PADRead(PADStatus* status) { PADReset(0); status->err = PAD_ERR_NOT_READY; memset(status, 0, offsetof(PADStatus, err)); - } - else if ((ResettingBits & chanBit) || ResettingChan == chan) { + } else if ((ResettingBits & chanBit) || ResettingChan == chan) { status->err = PAD_ERR_NOT_READY; memset(status, 0, offsetof(PADStatus, err)); - } - else if (!(EnabledBits & chanBit)) { + } else if (!(EnabledBits & chanBit)) { status->err = PAD_ERR_NO_CONTROLLER; memset(status, 0, offsetof(PADStatus, err)); - } - else if (SIIsChanBusy(chan)) { + } else if (SIIsChanBusy(chan)) { status->err = PAD_ERR_TRANSFER; memset(status, 0, offsetof(PADStatus, err)); - } - else { + } else { sr = SIGetStatus(chan); if (sr & SI_ERROR_NO_RESPONSE) { SIGetResponse(chan, data); @@ -444,42 +416,37 @@ u32 PADRead(PADStatus* status) { CheckingBits |= chanBit; SIGetTypeAsync(chan, PADReceiveCheckCallback); } - } - else { + } else { PADDisable(chan); status->err = PAD_ERR_NO_CONTROLLER; memset(status, 0, offsetof(PADStatus, err)); } - } - else { + } else { if (!(SIGetType(chan) & SI_GC_NOMOTOR)) { motor |= chanBit; } - + if (!SIGetResponse(chan, &data)) { status->err = PAD_ERR_TRANSFER; memset(status, 0, offsetof(PADStatus, err)); - } - else if (data[0] & 0x80000000) { + } else if (data[0] & 0x80000000) { status->err = PAD_ERR_TRANSFER; memset(status, 0, offsetof(PADStatus, err)); - } - else { + } else { MakeStatus(chan, status, data); - + // Check and clear PAD_ORIGIN bit if (status->button & 0x2000) { status->err = PAD_ERR_TRANSFER; memset(status, 0, offsetof(PADStatus, err)); - + // Get origin. It is okay if the following transfer fails // since the PAD_ORIGIN bit remains until the read origin // command complete. SITransfer(chan, &CmdReadOrigin, 1, &Origin[chan], 10, PADOriginUpdateCallback, 0); - } - else { + } else { status->err = PAD_ERR_NONE; - + // Clear PAD_INTERFERE bit status->button &= ~0x0080; } @@ -566,8 +533,7 @@ static s8 ClampS8(s8 var, s8 org) { if (var < min) { var = min; } - } - else if (org < 0) { + } else if (org < 0) { s8 max = (s8)(127 + org); if (max < var) { var = max; @@ -583,7 +549,7 @@ static u8 ClampU8(u8 var, u8 org) { return var -= org; } -#define SQ(x) ((x)*(x)) +#define SQ(x) ((x) * (x)) static void SPEC2_MakeStatus(s32 chan, PADStatus* status, u32 data[2]) { PADStatus* origin; static PADStatus pre_status[PAD_MAX_CONTROLLER]; @@ -664,36 +630,31 @@ static void SPEC2_MakeStatus(s32 chan, PADStatus* status, u32 data[2]) { status->substickX = 0; status->substickY = 0; return; - } - else { + } else { BarrelBits &= ~(PAD_CHAN0_BIT >> chan); } origin = &Origin[chan]; - status->stickX = ClampS8(status->stickX, origin->stickX); - status->stickY = ClampS8(status->stickY, origin->stickY); + status->stickX = ClampS8(status->stickX, origin->stickX); + status->stickY = ClampS8(status->stickY, origin->stickY); - status->substickX = ClampS8(status->substickX, origin->substickX); - status->substickY = ClampS8(status->substickY, origin->substickY); + status->substickX = ClampS8(status->substickX, origin->substickX); + status->substickY = ClampS8(status->substickY, origin->substickY); - status->triggerLeft = ClampU8(status->triggerLeft, origin->triggerLeft); - status->triggerRight = ClampU8(status->triggerRight, origin->triggerRight); + status->triggerLeft = ClampU8(status->triggerLeft, origin->triggerLeft); + status->triggerRight = ClampU8(status->triggerRight, origin->triggerRight); - if (__abs(SQ(status->stickX) - SQ(pre_status[chan].stickX)) >= 9 - || __abs(SQ(status->stickY) - SQ(pre_status[chan].stickY)) >= 9 - || __abs(SQ(status->substickX) - SQ(pre_status[chan].substickX)) >= 9 - || __abs(SQ(status->substickY) - SQ(pre_status[chan].substickY)) >= 9 - || __abs(SQ(status->triggerLeft) - SQ(pre_status[chan].triggerLeft)) >= 9 - || __abs(SQ(status->triggerRight) - SQ(pre_status[chan].triggerRight)) >= 9 - || status->button != pre_status[chan].button) { + if (__abs(SQ(status->stickX) - SQ(pre_status[chan].stickX)) >= 9 || __abs(SQ(status->stickY) - SQ(pre_status[chan].stickY)) >= 9 || + __abs(SQ(status->substickX) - SQ(pre_status[chan].substickX)) >= 9 || __abs(SQ(status->substickY) - SQ(pre_status[chan].substickY)) >= 9 || + __abs(SQ(status->triggerLeft) - SQ(pre_status[chan].triggerLeft)) >= 9 || + __abs(SQ(status->triggerRight) - SQ(pre_status[chan].triggerRight)) >= 9 || status->button != pre_status[chan].button) { __VIResetSIIdle(); } memcpy(&pre_status[chan], status, sizeof(PADStatus)); } - BOOL PADSync() { return ResettingBits == 0 && (s32)ResettingChan == 32 && !SIBusy(); } @@ -715,8 +676,7 @@ static BOOL OnShutdown(BOOL final, u32 code) { return FALSE; } return sync; - } - else { + } else { recalibrated = FALSE; } @@ -742,8 +702,7 @@ PADSamplingCallback PADSetSamplingCallback(PADSamplingCallback callback) { SamplingCallback = callback; if (callback) { SIRegisterPollingHandler(SamplingHandler); - } - else { + } else { SIUnregisterPollingHandler(SamplingHandler); } diff --git a/libs/RVL_SDK/src/rso/RSOLink.c b/libs/RVL_SDK/src/rso/RSOLink.c index 97e92186..19c6206d 100644 --- a/libs/RVL_SDK/src/rso/RSOLink.c +++ b/libs/RVL_SDK/src/rso/RSOLink.c @@ -1,37 +1,37 @@ -#include #include +#include #include -RSOObjectList __RSOObjectInfoList; +RSOObjectList __RSOObjectInfoList; -#define JUMP_CODE_INST_COUNT 6 -#define JUMP_CODE_SIZE (sizeof(u32) * JUMP_CODE_INST_COUNT) +#define JUMP_CODE_INST_COUNT 6 +#define JUMP_CODE_SIZE (sizeof(u32) * JUMP_CODE_INST_COUNT) enum RSOSection { - RSO_SECTION_NONE = 0, // --- + RSO_SECTION_NONE = 0, // --- - RSO_SECTION_INIT = 1, // .init - RSO_SECTION_TEXT = 2, // .text - RSO_SECTION_CTORS = 3, // .ctors - RSO_SECTION_DTORS = 4, // .dtors - RSO_SECTION_RODATA = 5, // .rodata - RSO_SECTION_DATA = 6, // .data - RSO_SECTION_BSS = 7, // .bss - RSO_SECTION_SDATA = 8, // .sdata - RSO_SECTION_SDATA2 = 9, // .sdata2 - RSO_SECTION_EMB_SDATA0 = 10, // .PPC.EMB.sdata0 - RSO_SECTION_SBSS = 11, // .sbss - RSO_SECTION_SBSS2 = 12, // .sbss2 - RSO_SECTION_EMB_SBSS0 = 13, // .PPC.EMB.sbss0 + RSO_SECTION_INIT = 1, // .init + RSO_SECTION_TEXT = 2, // .text + RSO_SECTION_CTORS = 3, // .ctors + RSO_SECTION_DTORS = 4, // .dtors + RSO_SECTION_RODATA = 5, // .rodata + RSO_SECTION_DATA = 6, // .data + RSO_SECTION_BSS = 7, // .bss + RSO_SECTION_SDATA = 8, // .sdata + RSO_SECTION_SDATA2 = 9, // .sdata2 + RSO_SECTION_EMB_SDATA0 = 10, // .PPC.EMB.sdata0 + RSO_SECTION_SBSS = 11, // .sbss + RSO_SECTION_SBSS2 = 12, // .sbss2 + RSO_SECTION_EMB_SBSS0 = 13, // .PPC.EMB.sbss0 - RSO_SECTION_EXTABINDEX = 241, // extabindex + RSO_SECTION_EXTABINDEX = 241, // extabindex }; typedef struct RSORel { - u32 offset; // 0x00 - u32 info; // 0x04 - u32 addend; // 0x08 + u32 offset; // 0x00 + u32 info; // 0x04 + u32 addend; // 0x08 } RSORel; extern char _f_sbss2[]; @@ -44,82 +44,86 @@ extern char _f_rodata[]; extern char _f_text[]; extern char _f_init[]; -#define ELF32_R_SYM(val) ((val) >> 8) -#define ELF32_R_TYPE(val) ((val) & 0xff) +#define ELF32_R_SYM(val) ((val) >> 8) +#define ELF32_R_TYPE(val) ((val) & 0xff) #define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff)) -#define R_PPC_NONE 0 -#define R_PPC_ADDR32 1 -#define R_PPC_ADDR24 2 -#define R_PPC_ADDR16 3 -#define R_PPC_ADDR16_LO 4 -#define R_PPC_ADDR16_HI 5 -#define R_PPC_ADDR16_HA 6 -#define R_PPC_ADDR14 7 -#define R_PPC_ADDR14_BRTAKEN 8 -#define R_PPC_ADDR14_BRNTAKEN 9 -#define R_PPC_REL24 10 -#define R_PPC_REL14 11 -#define R_PPC_REL14_BRTAKEN 12 -#define R_PPC_REL14_BRNTAKEN 13 +#define R_PPC_NONE 0 +#define R_PPC_ADDR32 1 +#define R_PPC_ADDR24 2 +#define R_PPC_ADDR16 3 +#define R_PPC_ADDR16_LO 4 +#define R_PPC_ADDR16_HI 5 +#define R_PPC_ADDR16_HA 6 +#define R_PPC_ADDR14 7 +#define R_PPC_ADDR14_BRTAKEN 8 +#define R_PPC_ADDR14_BRNTAKEN 9 +#define R_PPC_REL24 10 +#define R_PPC_REL14 11 +#define R_PPC_REL14_BRTAKEN 12 +#define R_PPC_REL14_BRNTAKEN 13 -#define R_PPC_EMB_SDA21 109 +#define R_PPC_EMB_SDA21 109 -#define BIND_POINTER(target_, base_) * (u32*)&(target_) += (u32)(base_); -#define UNBIND_POINTER(target_, base_) * (u32*)&(target_) -= (u32)(base_); +#define BIND_POINTER(target_, base_) *(u32*)&(target_) += (u32)(base_); +#define UNBIND_POINTER(target_, base_) *(u32*)&(target_) -= (u32)(base_); -struct mtsi { char _[12]; RSOSectionInfo* at_0x0c; }; +struct mtsi { + char _[12]; + RSOSectionInfo* at_0x0c; +}; #define MODULE_TO_SECTION_INFO(module_) (((struct mtsi*)(module_))->at_0x0c) -#define ADD_LINK_TO_LIST_TAIL(list_, link_) { \ - RSOObjectInfo* __prev = (list_)->tail; \ - \ - if (__prev == NULL) { \ - (list_)->head = (link_); \ - } \ - else { \ - __prev->link.next = (link_); \ - } \ - \ - (link_)->link.prev = __prev; \ - (link_)->link.next = NULL; \ - \ - (list_)->tail = (link_); \ +#define ADD_LINK_TO_LIST_TAIL(list_, link_) \ + { \ + RSOObjectInfo* __prev = (list_)->tail; \ + \ + if (__prev == NULL) { \ + (list_)->head = (link_); \ + } else { \ + __prev->link.next = (link_); \ + } \ + \ + (link_)->link.prev = __prev; \ + (link_)->link.next = NULL; \ + \ + (list_)->tail = (link_); \ } -#define REMOVE_LINK_FROM_LIST(list_, link_) { \ - RSOObjectInfo* __next = (link_)->link.next; \ - RSOObjectInfo* __prev = (link_)->link.prev; \ - \ - if (__next == NULL) { \ - (list_)->tail = __prev; \ - } \ - else { \ - __next->link.prev = __prev; \ - } \ - \ - if (__prev == NULL) { \ - (list_)->head = __next; \ - } \ - else { \ - __prev->link.next = __next; \ - } \ +#define REMOVE_LINK_FROM_LIST(list_, link_) \ + { \ + RSOObjectInfo* __next = (link_)->link.next; \ + RSOObjectInfo* __prev = (link_)->link.prev; \ + \ + if (__next == NULL) { \ + (list_)->tail = __prev; \ + } else { \ + __next->link.prev = __prev; \ + } \ + \ + if (__prev == NULL) { \ + (list_)->head = __next; \ + } else { \ + __prev->link.next = __next; \ + } \ } -#define MAKE_RELOC_ADDR24(base_, reloc_) (((base_) & ~0x03fffffc) | ((reloc_) & 0x03fffffc)) -#define MAKE_RELOC_ADDR16(base_, reloc_) ((reloc_) & 0xffff) +#define MAKE_RELOC_ADDR24(base_, reloc_) (((base_) & ~0x03fffffc) | ((reloc_) & 0x03fffffc)) +#define MAKE_RELOC_ADDR16(base_, reloc_) ((reloc_) & 0xffff) #define MAKE_RELOC_ADDR16_LO(base_, reloc_) ((reloc_) & 0xffff) #define MAKE_RELOC_ADDR16_HI(base_, reloc_) (((reloc_) >> 16) & 0xffff) #define MAKE_RELOC_ADDR16_HA(base_, reloc_) ((((reloc_) >> 16) + ((reloc_) & 0x8000 ? 1 : 0)) & 0xffff) -#define MAKE_RELOC_ADDR14(base_, reloc_) (((base_) & ~0x0000fffc) | ((reloc_) & 0x0000fffc)) -#define MAKE_RELOC_REL24(base_, reloc_) (((base_) & ~0x03fffffc) | ((reloc_) & 0x03fffffc)) -#define MAKE_RELOC_REL14(base_, reloc_) (((base_) & ~0x0000fffc) | ((reloc_) & 0x0000fffc)) +#define MAKE_RELOC_ADDR14(base_, reloc_) (((base_) & ~0x0000fffc) | ((reloc_) & 0x0000fffc)) +#define MAKE_RELOC_REL24(base_, reloc_) (((base_) & ~0x03fffffc) | ((reloc_) & 0x03fffffc)) +#define MAKE_RELOC_REL14(base_, reloc_) (((base_) & ~0x0000fffc) | ((reloc_) & 0x0000fffc)) -#define MAKE_RELOC_EMB_SDA21_REG(hi_, reg_) (((hi_) & ~0x1f) | (reg_)) -#define MAKE_RELOC_EMB_SDA21_ADDR(lo_, addr_) ((addr_) & 0xffff) +#define MAKE_RELOC_EMB_SDA21_REG(hi_, reg_) (((hi_) & ~0x1f) | (reg_)) +#define MAKE_RELOC_EMB_SDA21_ADDR(lo_, addr_) ((addr_) & 0xffff) -void RSONotifyLink(RSOObjectHeader* moduleHeader) NO_INLINE {} -void RSONotifyUnlink(RSOObjectHeader* moduleHeader) NO_INLINE {} +void RSONotifyLink(RSOObjectHeader* moduleHeader) NO_INLINE { +} +void RSONotifyUnlink(RSOObjectHeader* moduleHeader) NO_INLINE { +} BOOL LocateObject(void* newModule, void* bss, RSOFixedLevel i_fixed_level); @@ -158,8 +162,7 @@ BOOL LocateObject(void* newModule, void* bss, RSOFixedLevel i_fixed_level) { if (si->offset) { BIND_POINTER(si->offset, moduleHeader); - } - else if (si->size) { + } else if (si->size) { moduleHeader->bssSection = i; si->offset = (u32)bss; } @@ -355,8 +358,7 @@ BOOL RSOUnLocateObject(void* oldModule) { if (i == moduleHeader->bssSection) { moduleHeader->bssSection = 0; si->offset = 0; - } - else if (si->offset) { + } else if (si->offset) { UNBIND_POINTER(si->offset, moduleHeader); } } @@ -440,7 +442,7 @@ RSOHash RSOGetHash(const char* symbolname) { RSOHash g; while (*symbolname) { - h = (h << 4) +* symbolname++; + h = (h << 4) + *symbolname++; g = h & 0xf0000000; if (g) { h ^= g >> 24; @@ -555,20 +557,16 @@ static int FindExportIndex(RSOObjectHeader* rso, const char* name) { if (a_hash > a_expTab->hash) { if (a_top == i) { a_idx = a_last; - } - else { + } else { a_top = i; } - } - else if (a_hash < a_expTab->hash) { + } else if (a_hash < a_expTab->hash) { if (a_top == i) { a_idx = a_top; - } - else { + } else { a_last = i; } - } - else { + } else { a_idx = i; } } @@ -593,8 +591,7 @@ static int FindExportIndex(RSOObjectHeader* rso, const char* name) { if (strcmp(name, expName) == 0) { return i; } - } - else { + } else { i = a_last + 1; } } @@ -608,8 +605,7 @@ static int FindExportIndex(RSOObjectHeader* rso, const char* name) { if (strcmp(name, expName) == 0) { return i; } - } - else { + } else { return -1; } } @@ -766,7 +762,7 @@ static void RSORelocateSmallDataSection(RSOObjectHeader* rsoImp, int impIndex, R switch (expTab->section) { case RSO_SECTION_SDATA: case RSO_SECTION_SBSS: { - *p = MAKE_RELOC_EMB_SDA21_REG(*p, 13); // r13 (SysV PPC ABI) + *p = MAKE_RELOC_EMB_SDA21_REG(*p, 13); // r13 (SysV PPC ABI) baseTab = RSOFindExportSymbol(rsoExp, "_SDA_BASE_"); if (baseTab == NULL) { @@ -779,7 +775,7 @@ static void RSORelocateSmallDataSection(RSOObjectHeader* rsoImp, int impIndex, R } case RSO_SECTION_SDATA2: case RSO_SECTION_SBSS2: { - *p = MAKE_RELOC_EMB_SDA21_REG(*p, 2); // r2 (PPC EABI) + *p = MAKE_RELOC_EMB_SDA21_REG(*p, 2); // r2 (PPC EABI) baseTab = RSOFindExportSymbol(rsoExp, "_SDA2_BASE_"); if (baseTab == NULL) { @@ -792,7 +788,7 @@ static void RSORelocateSmallDataSection(RSOObjectHeader* rsoImp, int impIndex, R } case RSO_SECTION_EMB_SDATA0: case RSO_SECTION_EMB_SBSS0: { - *p = MAKE_RELOC_EMB_SDA21_REG(*p, 0); // (rA|0) (PPC EABI) + *p = MAKE_RELOC_EMB_SDA21_REG(*p, 0); // (rA|0) (PPC EABI) base = 0; break; } diff --git a/libs/RVL_SDK/src/sc/scapi.c b/libs/RVL_SDK/src/sc/scapi.c index 9ebeb636..429aa6cf 100644 --- a/libs/RVL_SDK/src/sc/scapi.c +++ b/libs/RVL_SDK/src/sc/scapi.c @@ -1,13 +1,13 @@ -#include #include +#include #include #include -static SCSimpleAddress TempSimpleAddress; +static SCSimpleAddress TempSimpleAddress; -#define MASK(x) (0xFF<<(x)) +#define MASK(x) (0xFF << (x)) u8 SCGetAspectRatio() { u8 item; @@ -15,8 +15,7 @@ u8 SCGetAspectRatio() { if (!SCFindU8Item(&item, SC_ITEM_ID_IPL_ASPECT_RATIO)) { // Default value item = SC_ASPECT_RATIO_4x3; - } - else { + } else { if (item != SC_ASPECT_RATIO_16x9) { item = SC_ASPECT_RATIO_4x3; } @@ -35,12 +34,10 @@ s8 SCGetDisplayOffsetH() { if (!SCFindS8Item(&item, SC_ITEM_ID_IPL_DISPLAY_OFFSET_H)) { // Default value item = 0; - } - else { + } else { if (item < -32) { item = -32; - } - else if (item > 32) { + } else if (item > 32) { item = 32; } } @@ -58,8 +55,7 @@ u8 SCGetEuRgb60Mode() { if (!SCFindU8Item(&item, SC_ITEM_ID_IPL_EURGB60_MODE)) { // Default value item = SC_EURGB60_MODE_OFF; - } - else { + } else { if (item != SC_EURGB60_MODE_ON) { item = SC_EURGB60_MODE_OFF; } @@ -87,12 +83,10 @@ u8 SCGetLanguage() { // Default value if (SCGetProductArea() == SC_LANG_JAPANESE) { item = SC_LANG_JAPANESE; - } - else { + } else { item = SC_LANG_ENGLISH; } - } - else { + } else { if (item > SC_LANG_KOREAN) { item = SC_LANG_ENGLISH; } @@ -119,8 +113,7 @@ u8 SCGetProgressiveMode() { if (!SCFindU8Item(&item, SC_ITEM_ID_IPL_PROGRESSIVE_MODE)) { // Default value item = SC_PROGRESSIVE_MODE_OFF; - } - else { + } else { if (item != SC_PROGRESSIVE_MODE_ON) { item = SC_PROGRESSIVE_MODE_OFF; } @@ -139,8 +132,7 @@ u8 SCGetScreenSaverMode() { if (!SCFindU8Item(&item, SC_ITEM_ID_IPL_SCREEN_SAVER_MODE)) { // Default value item = SC_SCREEN_SAVER_MODE_ON; - } - else { + } else { if (item != SC_SCREEN_SAVER_MODE_ON) { item = SC_SCREEN_SAVER_MODE_OFF; } @@ -159,8 +151,7 @@ u8 SCGetSoundMode() { if (!SCFindU8Item(&item, SC_ITEM_ID_IPL_SOUND_MODE)) { // Default value item = SC_SOUND_MODE_STEREO; - } - else { + } else { if (item != SC_SOUND_MODE_MONO && item != SC_SOUND_MODE_STEREO && item != SC_SOUND_MODE_SURROUND) { item = SC_SOUND_MODE_STEREO; } @@ -210,12 +201,10 @@ u32 SCGetBtDpdSensibility() { if (!SCFindU32Item(&item, SC_ITEM_ID_BT_DPD_SENSIBILITY)) { // Default value item = 2; - } - else { + } else { if (item < 1) { item = 1; - } - else if (item > 5) { + } else if (item > 5) { item = 5; } } @@ -248,8 +237,7 @@ u8 SCGetWpadMotorMode() { if (!SCFindU8Item(&item, SC_ITEM_ID_BT_MOTOR_MODE)) { // Default value item = SC_WPAD_MOTOR_MODE_ON; - } - else { + } else { if (item != SC_SCREEN_SAVER_MODE_ON) { item = SC_SCREEN_SAVER_MODE_OFF; } @@ -268,8 +256,7 @@ u8 SCGetWpadSensorBarPosition() { if (!SCFindU8Item(&item, SC_ITEM_ID_BT_SENSOR_BAR_POSITION)) { // Default value item = SC_WPAD_SENSOR_BAR_POSITION_BOTTOM; - } - else { + } else { if (item != SC_WPAD_SENSOR_BAR_POSITION_TOP) { item = SC_WPAD_SENSOR_BAR_POSITION_BOTTOM; } @@ -288,8 +275,7 @@ u8 SCGetWpadSpeakerVolume() { if (!SCFindU8Item(&item, SC_ITEM_ID_BT_SPEAKER_VOLUME)) { // Default value item = 89; - } - else { + } else { if (item > 127) { item = 127; } @@ -321,10 +307,9 @@ BOOL SCGetSimpleAddressData(SCSimpleAddress* address) { BOOL enabled; u32 id; - if (SCFindByteArrayItem(address, sizeof(*address), SC_ITEM_ID_IPL_SIMPLE_ADDRESS) - && address->id != 0xFFFFFFFF - && (address->id & MASK(SC_SIMPLE_ADDRESS_ID_COUNTRY)) != 0 && (address->id & MASK(SC_SIMPLE_ADDRESS_ID_COUNTRY)) != 0xFF000000 - && (address->id & MASK(SC_SIMPLE_ADDRESS_ID_REGION)) != 0xFF0000) { + if (SCFindByteArrayItem(address, sizeof(*address), SC_ITEM_ID_IPL_SIMPLE_ADDRESS) && address->id != 0xFFFFFFFF && + (address->id & MASK(SC_SIMPLE_ADDRESS_ID_COUNTRY)) != 0 && (address->id & MASK(SC_SIMPLE_ADDRESS_ID_COUNTRY)) != 0xFF000000 && + (address->id & MASK(SC_SIMPLE_ADDRESS_ID_REGION)) != 0xFF0000) { enabled = OSDisableInterrupts(); id = address->id; @@ -335,8 +320,7 @@ BOOL SCGetSimpleAddressData(SCSimpleAddress* address) { OSRestoreInterrupts(enabled); return TRUE; - } - else { + } else { return FALSE; } } @@ -396,8 +380,7 @@ u8 SCGetUpdateType() { if (!SCFindU8Item(&item, SC_ITEM_ID_IPL_UPDATE_TYPE)) { // Default value item = SC_UPDATE_TYPE_NONE; - } - else { + } else { if (item != SC_UPDATE_TYPE_DISC && item != SC_UPDATE_TYPE_NETWORK) { item = SC_UPDATE_TYPE_NONE; } @@ -458,14 +441,9 @@ BOOL SCSetInstalledChannelAppCount(u32 count) { return SCReplaceU32Item(count, SC_ITEM_ID_IPL_INSTALLED_CHANNEL_APP_COUNT); } -#define TITLE_TYPE(x) ((u32)(x>>32)) +#define TITLE_TYPE(x) ((u32)(x >> 32)) -#define IS_VALID_TEMP_TYPE(tId) \ - ((tId) == 0x00010001 \ - || (tId) == 0x00010003 \ - || (tId) == 0x00010004 \ - || (tId) == 0x00010006 \ - || (tId) == 0x00010007) +#define IS_VALID_TEMP_TYPE(tId) ((tId) == 0x00010001 || (tId) == 0x00010003 || (tId) == 0x00010004 || (tId) == 0x00010006 || (tId) == 0x00010007) u64 SCGetTmpTitleID() { u64 item; diff --git a/libs/RVL_SDK/src/sc/scapi_prdinfo.c b/libs/RVL_SDK/src/sc/scapi_prdinfo.c index aed4f510..c0793651 100644 --- a/libs/RVL_SDK/src/sc/scapi_prdinfo.c +++ b/libs/RVL_SDK/src/sc/scapi_prdinfo.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -8,51 +8,36 @@ #define XOR_PRDINFO_KEY 0x73B5DBFA typedef struct SCAreaAndID { - s8 area; // 0x00 - char name[4]; // 0x01 + s8 area; // 0x00 + char name[4]; // 0x01 } SCAreaAndID; -static SCAreaAndID ProductAreaAndStringTbl[] = { - {SC_PRODUCT_AREA_JPN, "JPN"}, - {SC_PRODUCT_AREA_USA, "USA"}, - {SC_PRODUCT_AREA_EUR, "EUR"}, - {SC_PRODUCT_AREA_AUS, "AUS"}, - {SC_PRODUCT_AREA_BRA, "BRA"}, - {SC_PRODUCT_AREA_TWN, "TWN"}, - {SC_PRODUCT_AREA_TWN, "ROC"}, - {SC_PRODUCT_AREA_KOR, "KOR"}, - {SC_PRODUCT_AREA_HKG, "HKG"}, - {SC_PRODUCT_AREA_ASI, "ASI"}, - {SC_PRODUCT_AREA_LTN, "LTN"}, - {SC_PRODUCT_AREA_SAF, "SAF"}, - {SC_PRODUCT_AREA_CHN, "CHN"}, - {SC_PRODUCT_AREA_UNKNOWN, ""} -}; +static SCAreaAndID ProductAreaAndStringTbl[] = {{SC_PRODUCT_AREA_JPN, "JPN"}, {SC_PRODUCT_AREA_USA, "USA"}, {SC_PRODUCT_AREA_EUR, "EUR"}, + {SC_PRODUCT_AREA_AUS, "AUS"}, {SC_PRODUCT_AREA_BRA, "BRA"}, {SC_PRODUCT_AREA_TWN, "TWN"}, + {SC_PRODUCT_AREA_TWN, "ROC"}, {SC_PRODUCT_AREA_KOR, "KOR"}, {SC_PRODUCT_AREA_HKG, "HKG"}, + {SC_PRODUCT_AREA_ASI, "ASI"}, {SC_PRODUCT_AREA_LTN, "LTN"}, {SC_PRODUCT_AREA_SAF, "SAF"}, + {SC_PRODUCT_AREA_CHN, "CHN"}, {SC_PRODUCT_AREA_UNKNOWN, ""}}; typedef struct SCVideoModeAndID { - s8 videoMode; // 0x00 - char name[5]; // 0x01 + s8 videoMode; // 0x00 + char name[5]; // 0x01 } SCVideoModeAndID; static SCVideoModeAndID ProductVideoModeAndStringTbl[] = { - {SC_PRODUCT_VIDEO_NTSC, "NTSC"}, - {SC_PRODUCT_VIDEO_PAL, "PAL"}, - {SC_PRODUCT_VIDEO_MPAL, "MPAL"}, - {SC_PRODUCT_VIDEO_UNKNOWN, ""}, + {SC_PRODUCT_VIDEO_NTSC, "NTSC"}, + {SC_PRODUCT_VIDEO_PAL, "PAL"}, + {SC_PRODUCT_VIDEO_MPAL, "MPAL"}, + {SC_PRODUCT_VIDEO_UNKNOWN, ""}, }; typedef struct SCGameRegionAndID { - s8 gameRegion; // 0x00 - char name[3]; // 0x01 + s8 gameRegion; // 0x00 + char name[3]; // 0x01 } SCGameRegionAndID; static SCGameRegionAndID ProductGameRegionAndStringTbl[] = { - {SC_PRODUCT_GAME_REGION_JP, "JP"}, - {SC_PRODUCT_GAME_REGION_US, "US"}, - {SC_PRODUCT_GAME_REGION_EU, "EU"}, - {SC_PRODUCT_GAME_REGION_KR, "KR"}, - {SC_PRODUCT_GAME_REGION_CN, "CN"}, - {SC_PRODUCT_GAME_REGION_UNKNOWN, ""}, + {SC_PRODUCT_GAME_REGION_JP, "JP"}, {SC_PRODUCT_GAME_REGION_US, "US"}, {SC_PRODUCT_GAME_REGION_EU, "EU"}, + {SC_PRODUCT_GAME_REGION_KR, "KR"}, {SC_PRODUCT_GAME_REGION_CN, "CN"}, {SC_PRODUCT_GAME_REGION_UNKNOWN, ""}, }; BOOL __SCF1(const char* type, char* buf, u32 sz) { @@ -76,8 +61,7 @@ BOOL __SCF1(const char* type, char* buf, u32 sz) { if (((ptext ^ type[typeOfs]) & 0xDF) == 0) { typeOfs++; - } - else { + } else { typeOfs = 0; } } diff --git a/libs/RVL_SDK/src/sc/scsystem.c b/libs/RVL_SDK/src/sc/scsystem.c index a473605b..a75c626f 100644 --- a/libs/RVL_SDK/src/sc/scsystem.c +++ b/libs/RVL_SDK/src/sc/scsystem.c @@ -1,13 +1,13 @@ -#include #include +#include #include -#include #include +#include -#include #include +#include #include @@ -43,72 +43,72 @@ typedef enum { } NandCallbackState; typedef struct SCNameAndID { - char* name; - SCItemID id; + char* name; + SCItemID id; } SCNameAndID; SCNameAndID NameAndIDTbl[SC_ITEM_ID_MAX] = { - "IPL.CB", SC_ITEM_ID_IPL_COUNTER_BIAS, - "IPL.AR", SC_ITEM_ID_IPL_ASPECT_RATIO, - "IPL.ARN", SC_ITEM_ID_IPL_AUTORUN_MODE, - "IPL.CD", SC_ITEM_ID_IPL_CONFIG_DONE, - "IPL.CD2", SC_ITEM_ID_IPL_CONFIG_DONE2, - "IPL.DH", SC_ITEM_ID_IPL_DISPLAY_OFFSET_H, - "IPL.E60", SC_ITEM_ID_IPL_EURGB60_MODE, - "IPL.EULA", SC_ITEM_ID_IPL_EULA, - "IPL.FRC", SC_ITEM_ID_IPL_FREE_CHANNEL_APP_COUNT, - "IPL.IDL", SC_ITEM_ID_IPL_IDLE_MODE, - "IPL.INC", SC_ITEM_ID_IPL_INSTALLED_CHANNEL_APP_COUNT, - "IPL.LNG", SC_ITEM_ID_IPL_LANGUAGE, - "IPL.NIK", SC_ITEM_ID_IPL_OWNER_NICKNAME, - "IPL.PC", SC_ITEM_ID_IPL_PARENTAL_CONTROL, - "IPL.PGS", SC_ITEM_ID_IPL_PROGRESSIVE_MODE, - "IPL.SSV", SC_ITEM_ID_IPL_SCREEN_SAVER_MODE, - "IPL.SADR", SC_ITEM_ID_IPL_SIMPLE_ADDRESS, - "IPL.SND", SC_ITEM_ID_IPL_SOUND_MODE, - "IPL.UPT", SC_ITEM_ID_IPL_UPDATE_TYPE, - "NET.CNF", SC_ITEM_ID_NET_CONFIG, - "NET.CTPC", SC_ITEM_ID_NET_CONTENT_RESTRICTIONS, - "NET.PROF", SC_ITEM_ID_NET_PROFILE, - "NET.WCPC", SC_ITEM_ID_NET_WC_RESTRICTION, - "NET.WCFG", SC_ITEM_ID_NET_WC_FLAGS, - "DEV.BTM", SC_ITEM_ID_DEV_BOOT_MODE, - "DEV.VIM", SC_ITEM_ID_DEV_VIDEO_MODE, - "DEV.CTC", SC_ITEM_ID_DEV_COUNTRY_CODE, - "DEV.DSM", SC_ITEM_ID_DEV_DRIVESAVING_MODE, - "BT.DINF", SC_ITEM_ID_BT_DEVICE_INFO, - "BT.CDIF", SC_ITEM_ID_BT_CMPDEV_INFO, - "BT.SENS", SC_ITEM_ID_BT_DPD_SENSIBILITY, - "BT.SPKV", SC_ITEM_ID_BT_SPEAKER_VOLUME, - "BT.MOT", SC_ITEM_ID_BT_MOTOR_MODE, - "BT.BAR", SC_ITEM_ID_BT_SENSOR_BAR_POSITION, - "DVD.CNF", SC_ITEM_ID_DVD_CONFIG, - "WWW.RST", SC_ITEM_ID_WWW_RESTRICTION, - "MPLS.MOVIE", SC_ITEM_ID_MOTION_PLUS_MOVIE, - "IPL.TID", SC_ITEM_ID_TEMP_TITLE_ID, + "IPL.CB", SC_ITEM_ID_IPL_COUNTER_BIAS, + "IPL.AR", SC_ITEM_ID_IPL_ASPECT_RATIO, + "IPL.ARN", SC_ITEM_ID_IPL_AUTORUN_MODE, + "IPL.CD", SC_ITEM_ID_IPL_CONFIG_DONE, + "IPL.CD2", SC_ITEM_ID_IPL_CONFIG_DONE2, + "IPL.DH", SC_ITEM_ID_IPL_DISPLAY_OFFSET_H, + "IPL.E60", SC_ITEM_ID_IPL_EURGB60_MODE, + "IPL.EULA", SC_ITEM_ID_IPL_EULA, + "IPL.FRC", SC_ITEM_ID_IPL_FREE_CHANNEL_APP_COUNT, + "IPL.IDL", SC_ITEM_ID_IPL_IDLE_MODE, + "IPL.INC", SC_ITEM_ID_IPL_INSTALLED_CHANNEL_APP_COUNT, + "IPL.LNG", SC_ITEM_ID_IPL_LANGUAGE, + "IPL.NIK", SC_ITEM_ID_IPL_OWNER_NICKNAME, + "IPL.PC", SC_ITEM_ID_IPL_PARENTAL_CONTROL, + "IPL.PGS", SC_ITEM_ID_IPL_PROGRESSIVE_MODE, + "IPL.SSV", SC_ITEM_ID_IPL_SCREEN_SAVER_MODE, + "IPL.SADR", SC_ITEM_ID_IPL_SIMPLE_ADDRESS, + "IPL.SND", SC_ITEM_ID_IPL_SOUND_MODE, + "IPL.UPT", SC_ITEM_ID_IPL_UPDATE_TYPE, + "NET.CNF", SC_ITEM_ID_NET_CONFIG, + "NET.CTPC", SC_ITEM_ID_NET_CONTENT_RESTRICTIONS, + "NET.PROF", SC_ITEM_ID_NET_PROFILE, + "NET.WCPC", SC_ITEM_ID_NET_WC_RESTRICTION, + "NET.WCFG", SC_ITEM_ID_NET_WC_FLAGS, + "DEV.BTM", SC_ITEM_ID_DEV_BOOT_MODE, + "DEV.VIM", SC_ITEM_ID_DEV_VIDEO_MODE, + "DEV.CTC", SC_ITEM_ID_DEV_COUNTRY_CODE, + "DEV.DSM", SC_ITEM_ID_DEV_DRIVESAVING_MODE, + "BT.DINF", SC_ITEM_ID_BT_DEVICE_INFO, + "BT.CDIF", SC_ITEM_ID_BT_CMPDEV_INFO, + "BT.SENS", SC_ITEM_ID_BT_DPD_SENSIBILITY, + "BT.SPKV", SC_ITEM_ID_BT_SPEAKER_VOLUME, + "BT.MOT", SC_ITEM_ID_BT_MOTOR_MODE, + "BT.BAR", SC_ITEM_ID_BT_SENSOR_BAR_POSITION, + "DVD.CNF", SC_ITEM_ID_DVD_CONFIG, + "WWW.RST", SC_ITEM_ID_WWW_RESTRICTION, + "MPLS.MOVIE", SC_ITEM_ID_MOTION_PLUS_MOVIE, + "IPL.TID", SC_ITEM_ID_TEMP_TITLE_ID, }; -static SCControl Control; -static u8 ConfBuf[SC_CONF_MAX_SIZE] ALIGN32; -static u8 ConfBufForFlush[SC_CONF_MAX_SIZE] ALIGN32; +static SCControl Control; +static u8 ConfBuf[SC_CONF_MAX_SIZE] ALIGN32; +static u8 ConfBufForFlush[SC_CONF_MAX_SIZE] ALIGN32; -static const char ConfDirName[] = "/shared2/sys"; -static const char ConfFileName[] = "/shared2/sys/SYSCONF"; -static const char ProductInfoFileName[] = "/title/00000001/00000002/data/setting.txt"; +static const char ConfDirName[] = "/shared2/sys"; +static const char ConfFileName[] = "/shared2/sys/SYSCONF"; +static const char ProductInfoFileName[] = "/title/00000001/00000002/data/setting.txt"; -static u8 BgJobStatus = SC_STATUS_OK; +static u8 BgJobStatus = SC_STATUS_OK; -static u32 ItemRestSize = 0; -static u32 ItemNumTotal = 0; -static u32 ItemIDMaxPlus1 = 0; -static u32 ItemIDOffsetTblOffset = 0; +static u32 ItemRestSize = 0; +static u32 ItemNumTotal = 0; +static u32 ItemIDMaxPlus1 = 0; +static u32 ItemIDOffsetTblOffset = 0; -static u8 IsDevKit = FALSE; -static u8 DirtyFlag = FALSE; -static u8 Initialized = FALSE; +static u8 IsDevKit = FALSE; +static u8 DirtyFlag = FALSE; +static u8 Initialized = FALSE; static void SetBgJobStatus(SCStatus status); -static s32 SCReloadConfFileAsync(u8* buf, u32 size, SCAsyncCallback callback); +static s32 SCReloadConfFileAsync(u8* buf, u32 size, SCAsyncCallback callback); static void OpenCallbackFromReload(s32 result, NANDCommandBlock* block); static void ReadCallbackFromReload(s32 result, NANDCommandBlock* block); static void CloseCallbackFromReload(s32 result, NANDCommandBlock* block); @@ -143,9 +143,7 @@ void SCInit() { IsDevKit = TRUE; } - if (NANDInit() != NAND_RESULT_OK || - SCReloadConfFileAsync(__SCGetConfBuf(), __SCGetConfBufSize(), NULL) != NAND_RESULT_OK) { - + if (NANDInit() != NAND_RESULT_OK || SCReloadConfFileAsync(__SCGetConfBuf(), __SCGetConfBufSize(), NULL) != NAND_RESULT_OK) { SetBgJobStatus(SC_STATUS_FATAL); } } @@ -174,8 +172,7 @@ u32 SCCheckStatus() { __SCClearDirtyFlag(); OSRestoreInterrupts(enabled); - } - else { + } else { enabled = OSDisableInterrupts(); ClearConfBuf(Control.fileBuffers[SC_CONF_FILE_SYSTEM]); @@ -186,8 +183,7 @@ u32 SCCheckStatus() { status = SC_STATUS_OK; SetBgJobStatus(SC_STATUS_OK); - } - else { + } else { OSRestoreInterrupts(enabled); } @@ -227,8 +223,8 @@ static s32 SCReloadConfFileAsync(u8* buf, u32 size, SCAsyncCallback callback) { Control.isFileOpen = FALSE; - return NANDPrivateOpenAsync(Control.filePaths[Control.openFileType], &Control.fileInfo, NAND_ACCESS_READ, - OpenCallbackFromReload, &Control.commandBlock); + return NANDPrivateOpenAsync(Control.filePaths[Control.openFileType], &Control.fileInfo, NAND_ACCESS_READ, OpenCallbackFromReload, + &Control.commandBlock); } static void OpenCallbackFromReload(s32 result, NANDCommandBlock* block) { @@ -236,7 +232,7 @@ static void OpenCallbackFromReload(s32 result, NANDCommandBlock* block) { Control.isFileOpen = TRUE; if (NANDReadAsync(&Control.fileInfo, Control.fileBuffers[Control.openFileType], Control.bufferSizes[Control.openFileType], - ReadCallbackFromReload, &Control.commandBlock) == NAND_RESULT_OK) { + ReadCallbackFromReload, &Control.commandBlock) == NAND_RESULT_OK) { return; } } @@ -260,8 +256,7 @@ static void ReadCallbackFromReload(s32 result, NANDCommandBlock* block) { static void CloseCallbackFromReload(s32 result, NANDCommandBlock* block) { if (result == NAND_RESULT_OK) { FinishFromReload(); - } - else { + } else { ErrorFromReload(result); } } @@ -275,8 +270,8 @@ _openFile: if (Control.openFileType < SC_CONF_FILE_MAX) { Control.isFileOpen = FALSE; - if (NANDPrivateOpenAsync(Control.filePaths[Control.openFileType], &Control.fileInfo, NAND_ACCESS_READ, - OpenCallbackFromReload, &Control.commandBlock) == NAND_RESULT_OK) { + if (NANDPrivateOpenAsync(Control.filePaths[Control.openFileType], &Control.fileInfo, NAND_ACCESS_READ, OpenCallbackFromReload, + &Control.commandBlock) == NAND_RESULT_OK) { return; } @@ -315,8 +310,7 @@ static void ErrorFromReload(s32 result) { Control.fileSizes[Control.openFileType] = 0; - if (!Control.isFileOpen || - NANDCloseAsync(&Control.fileInfo, CloseCallbackFromReloadError, &Control.commandBlock) != NAND_RESULT_OK) { + if (!Control.isFileOpen || NANDCloseAsync(&Control.fileInfo, CloseCallbackFromReloadError, &Control.commandBlock) != NAND_RESULT_OK) { FinishFromReload(); } } @@ -448,10 +442,7 @@ static SCStatus ParseConfBuf(u8* conf, u32 size) { // Build lookup table - for (tblEnd = &tblIter[ItemIDMaxPlus1]; - tblIter < tblEnd && (itName = tblIter->name) != (void*)NULL; - tblIter++) { - + for (tblEnd = &tblIter[ItemIDMaxPlus1]; tblIter < tblEnd && (itName = tblIter->name) != (void*)NULL; tblIter++) { u32 itNameLen = strlen(itName); for (i = 0; i < numItems; i++) { @@ -543,8 +534,7 @@ static BOOL UnpackItem(const SCConfItem* raw, SCItem* item) { if (type == SC_ITEM_SMALLARRAY || type == SC_ITEM_BIGARRAY) { item->arrayType = SC_ITEM_SMALLARRAY; - } - else { + } else { item->primType = type; memcpy(item, item->data, item->dataLen); } @@ -630,15 +620,13 @@ static void DeleteItemByID(SCItemID id) { if (it < itemOfs) { // After deleted item *it -= sizeof(u16); - } - else { + } else { // Before deleted item *it -= itemSize; } } - memmove(conf + *itemOfs, conf + itemSize + *itemOfs, - itemsEndOfs - (*itemOfs + itemSize)); + memmove(conf + *itemOfs, conf + itemSize + *itemOfs, itemsEndOfs - (*itemOfs + itemSize)); memset(conf + (itemsEndOfs - itemSize), 0, itemSize); @@ -652,8 +640,7 @@ static void DeleteItemByID(SCItemID id) { // After deleted slot if (confLut[-i] > itemOfsOfs) { confLut[-i] -= sizeof(u16); - } - else { + } else { confLut[-i] = 0; } } @@ -727,8 +714,7 @@ static BOOL CreateItemByID(SCItemID id, u8 primType, const void* src, u32 len) { if (len > SC_SMALLARRAY_MAX + 1) { itemSize += 2; primType = SC_ITEM_BIGARRAY; - } - else { + } else { itemSize += 1; } break; @@ -766,8 +752,7 @@ static BOOL CreateItemByID(SCItemID id, u8 primType, const void* src, u32 len) { itemsEndOfs = *confItemsEnd; // Make room for new item - memmove(confItemsBegin[0] + sizeof(u16) + conf, confItemsBegin[0] + conf, - itemsEndOfs - confItemsBegin[0]); + memmove(confItemsBegin[0] + sizeof(u16) + conf, confItemsBegin[0] + conf, itemsEndOfs - confItemsBegin[0]); // Adjust offsets ofsIter = confItemsBegin; @@ -784,8 +769,7 @@ static BOOL CreateItemByID(SCItemID id, u8 primType, const void* src, u32 len) { if (primType == SC_ITEM_SMALLARRAY) { *newItem++ = len - 1; - } - else if (primType == SC_ITEM_BIGARRAY) { + } else if (primType == SC_ITEM_BIGARRAY) { *newItem++ = (len - 1) >> 8 & 0xFF; *newItem++ = (len - 1) >> 0 & 0xFF; } @@ -816,8 +800,7 @@ BOOL SCFindByteArrayItem(void* dst, u32 len, SCItemID id) { success = FALSE; enabled = OSDisableInterrupts(); - if (dst != ((void*)NULL) && FindItemByID(id, &item) && - item.arrayType != 0 && item.dataLen == len) { + if (dst != ((void*)NULL) && FindItemByID(id, &item) && item.arrayType != 0 && item.dataLen == len) { memcpy(dst, item.data, len); success = TRUE; } @@ -845,8 +828,7 @@ BOOL SCReplaceByteArrayItem(const void* src, u32 len, SCItemID id) { success = TRUE; goto _exit; - } - else { + } else { DeleteItemByID(id); } } @@ -894,8 +876,7 @@ static BOOL SCReplaceIntegerItem(const void* src, SCItemID id, u8 primType) NO_I success = TRUE; goto _exit; - } - else { + } else { DeleteItemByID(id); } } @@ -929,8 +910,7 @@ BOOL SCFindBoolItem(BOOL* dst, SCItemID id) { if (SCFindIntegerItem(&dstVal, id, SC_ITEM_BOOL)) { *dst = dstVal ? TRUE : FALSE; return TRUE; - } - else { + } else { return FALSE; } } @@ -1008,22 +988,18 @@ void SCFlushAsync(SCFlushCallback callback) { if (!__SCIsDirty()) { OSRestoreInterrupts(enabled); FinishFromFlush(); - } - else { + } else { __SCClearDirtyFlag(); memcpy(ConfBufForFlush, __SCGetConfBuf(), __SCGetConfBufSize()); OSRestoreInterrupts(enabled); ctrl->nandCbState = NAND_CB_STATE_GET_STATUS; - if (NANDPrivateGetTypeAsync(ConfFileName, &ctrl->fileType, - MyNandCallback, &ctrl->commandBlock) != - NAND_RESULT_OK) { + if (NANDPrivateGetTypeAsync(ConfFileName, &ctrl->fileType, MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { ErrorFromFlush(); } } - } - else { + } else { if (callback != 0) { callback(status == SC_STATUS_BUSY ? status : SC_STATUS_FATAL); } @@ -1040,26 +1016,22 @@ static void MyNandCallback(s32 result, NANDCommandBlock* block) { if (result == NAND_RESULT_OK && ctrl->fileType == NAND_TYPE_FILE) { ctrl->nandCbState = NAND_CB_STATE_DELETE; - if (NANDPrivateGetStatusAsync(ConfFileName, &ctrl->fileAttr, - MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { + if (NANDPrivateGetStatusAsync(ConfFileName, &ctrl->fileAttr, MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { goto _error; } - } - else { + } else { goto _case_1_lbl; } return; } case NAND_CB_STATE_DELETE: { - if (result == NAND_RESULT_OK && - ctrl->fileAttr.permission == NAND_PERM_ALL_RW) { + if (result == NAND_RESULT_OK && ctrl->fileAttr.permission == NAND_PERM_ALL_RW) { goto _case_5_lbl; } _case_1_lbl: ctrl->nandCbState = NAND_CB_STATE_GET_TYPE; - if (NANDPrivateDeleteAsync(ConfFileName, - MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { + if (NANDPrivateDeleteAsync(ConfFileName, MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { goto _error; } return; @@ -1067,8 +1039,7 @@ static void MyNandCallback(s32 result, NANDCommandBlock* block) { case NAND_CB_STATE_GET_TYPE: { ctrl->nandCbState = NAND_CB_STATE_CREATE_DIR; - if (NANDPrivateGetTypeAsync(ConfDirName, &ctrl->fileType, - MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { + if (NANDPrivateGetTypeAsync(ConfDirName, &ctrl->fileType, MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { goto _error; } return; @@ -1080,8 +1051,7 @@ static void MyNandCallback(s32 result, NANDCommandBlock* block) { ctrl->nandCbState = NAND_CB_STATE_CREATE_FILE; - if (NANDPrivateCreateDirAsync(ConfDirName, NAND_PERM_ALL_RW, 0, - MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { + if (NANDPrivateCreateDirAsync(ConfDirName, NAND_PERM_ALL_RW, 0, MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { goto _error; } return; @@ -1089,8 +1059,7 @@ static void MyNandCallback(s32 result, NANDCommandBlock* block) { case NAND_CB_STATE_CREATE_FILE: { _case_4_lbl: ctrl->nandCbState = NAND_CB_STATE_OPEN_FILE; - if (NANDPrivateCreateAsync(ConfFileName, NAND_PERM_ALL_RW, 0, - MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { + if (NANDPrivateCreateAsync(ConfFileName, NAND_PERM_ALL_RW, 0, MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { goto _error; } return; @@ -1098,8 +1067,7 @@ static void MyNandCallback(s32 result, NANDCommandBlock* block) { case NAND_CB_STATE_OPEN_FILE: { _case_5_lbl: ctrl->nandCbState = NAND_CB_STATE_WRITE_FILE; - if (NANDPrivateOpenAsync(ConfFileName, &ctrl->fileInfo, NAND_ACCESS_WRITE, - MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { + if (NANDPrivateOpenAsync(ConfFileName, &ctrl->fileInfo, NAND_ACCESS_WRITE, MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { goto _error; } return; @@ -1112,8 +1080,7 @@ static void MyNandCallback(s32 result, NANDCommandBlock* block) { ctrl->isFileOpen = TRUE; ctrl->nandCbState = NAND_CB_STATE_CLOSE_FILE; - if (NANDWriteAsync(&ctrl->fileInfo, ConfBufForFlush, ctrl->flushSize, - MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { + if (NANDWriteAsync(&ctrl->fileInfo, ConfBufForFlush, ctrl->flushSize, MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { goto _error; } return; @@ -1126,8 +1093,7 @@ static void MyNandCallback(s32 result, NANDCommandBlock* block) { ctrl->isFileOpen = FALSE; ctrl->nandCbState = NAND_CB_STATE_ERROR_CHECK; - if (NANDCloseAsync(&ctrl->fileInfo, - MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { + if (NANDCloseAsync(&ctrl->fileInfo, MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) { goto _error; } return; @@ -1182,8 +1148,7 @@ static void ErrorFromFlush() { if (ctrl->isFileOpen) { ctrl->nandCbState = NAND_CB_STATE_FINISH; - if (NANDCloseAsync(&ctrl->fileInfo, - MyNandCallback, &ctrl->commandBlock) == NAND_RESULT_OK) { + if (NANDCloseAsync(&ctrl->fileInfo, MyNandCallback, &ctrl->commandBlock) == NAND_RESULT_OK) { return; } } diff --git a/libs/RVL_SDK/src/scutil/idToIsoA2.c b/libs/RVL_SDK/src/scutil/idToIsoA2.c index 4ae0bee9..2961854a 100644 --- a/libs/RVL_SDK/src/scutil/idToIsoA2.c +++ b/libs/RVL_SDK/src/scutil/idToIsoA2.c @@ -1,184 +1,14 @@ #include char* countryIdToISOA2[] = { - NULL, - "JP", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "AI", - "AG", - "AR", - "AW", - "BS", - "BB", - "BZ", - "BO", - "BR", - "VG", - "CA", - "KY", - "CL", - "CO", - "CR", - "DM", - "DO", - "EC", - "SV", - "GF", - "GD", - "GP", - "GT", - "GY", - "HT", - "HN", - "JM", - "MQ", - "MX", - "MS", - "AN", - "NI", - "PA", - "PY", - "PE", - "KN", - "LC", - "VC", - "SR", - "TT", - "TC", - "US", - "UY", - "VI", - "VE", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "AL", - "AU", - "AT", - "BE", - "BA", - "BW", - "BG", - "HR", - "CY", - "CZ", - "DK", - "EE", - "FI", - "FR", - "DE", - "GR", - "HU", - "IS", - "IE", - "IT", - "LV", - "LS", - "LI", - "LT", - "LU", - "MK", - "MT", - "ME", - "MZ", - "NA", - "NL", - "NZ", - "NO", - "PL", - "PT", - "RO", - "RU", - "RS", - "SK", - "SI", - "ZA", - "ES", - "SZ", - "SE", - "CH", - "TR", - "GB", - "ZM", - "ZW", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "TW", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "KR", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "HK", - "MO", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "ID", - "SG", - "TH", - "PH", - "MY", - NULL, - NULL, - NULL, - "CN", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - "AE", - "IN", - "EG", - "OM", - "QA", - "KW", - "SA", - "SY", - "BH", - "JO", + NULL, "JP", NULL, NULL, NULL, NULL, NULL, NULL, "AI", "AG", "AR", "AW", "BS", "BB", "BZ", "BO", "BR", "VG", "CA", "KY", "CL", "CO", "CR", + "DM", "DO", "EC", "SV", "GF", "GD", "GP", "GT", "GY", "HT", "HN", "JM", "MQ", "MX", "MS", "AN", "NI", "PA", "PY", "PE", "KN", "LC", "VC", + "SR", "TT", "TC", "US", "UY", "VI", "VE", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "AL", "AU", "AT", "BE", "BA", + "BW", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IS", "IE", "IT", "LV", "LS", "LI", "LT", "LU", "MK", "MT", "ME", + "MZ", "NA", "NL", "NZ", "NO", "PL", "PT", "RO", "RU", "RS", "SK", "SI", "ZA", "ES", "SZ", "SE", "CH", "TR", "GB", "ZM", "ZW", NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "TW", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "KR", NULL, + NULL, NULL, NULL, NULL, NULL, NULL, "HK", "MO", NULL, NULL, NULL, NULL, NULL, NULL, "ID", "SG", "TH", "PH", "MY", NULL, NULL, NULL, "CN", + NULL, NULL, NULL, NULL, NULL, NULL, NULL, "AE", "IN", "EG", "OM", "QA", "KW", "SA", "SY", "BH", "JO", }; char* SCUTILGetISOCountryCodeA2() { diff --git a/libs/RVL_SDK/src/sdi/sdi_api.c b/libs/RVL_SDK/src/sdi/sdi_api.c index 669e0208..86c4898d 100644 --- a/libs/RVL_SDK/src/sdi/sdi_api.c +++ b/libs/RVL_SDK/src/sdi/sdi_api.c @@ -7,9 +7,9 @@ #include -#define SD_SLOT_0_PATH "/dev/sdio/slot0" -#define SD_SLOT_1_PATH "/dev/sdio/slot1" -#define SD_SLOT_W_PATH "/dev/sdio/slotw" +#define SD_SLOT_0_PATH "/dev/sdio/slot0" +#define SD_SLOT_1_PATH "/dev/sdio/slot1" +#define SD_SLOT_W_PATH "/dev/sdio/slotw" #define SD_SLOT_PATH_LENGTH 32 @@ -17,45 +17,47 @@ typedef void (*SDCallbackFunc)(s32, void*); #define SD_CMD_SIZE 0x24 -u32 __sdCardStatus = 0; -u32 __sdReq = 0; +u32 __sdCardStatus = 0; +u32 __sdReq = 0; -u32* __sdCmdBuffer = NULL; +u32* __sdCmdBuffer = NULL; -u32* __sdResp = NULL; -u32* __sdResp2 = NULL; +u32* __sdResp = NULL; +u32* __sdResp2 = NULL; -u32* __sdReg = NULL; +u32* __sdReg = NULL; -IOSIoVector* __sdVect = NULL; +IOSIoVector* __sdVect = NULL; -IOSHeapId __sdHeapId = -1; +IOSHeapId __sdHeapId = -1; -char __sdPaths[SD_MAX_SLOTS][OSRoundUp32B(SD_SLOT_PATH_LENGTH)] ALIGN32; -OSMutex __reqMutex; +char __sdPaths[SD_MAX_SLOTS][OSRoundUp32B(SD_SLOT_PATH_LENGTH)] ALIGN32; +OSMutex __reqMutex; typedef struct __sdCbArg { - SDCallbackFunc cb; // 0x00 - void* cbArg; // 0x04 - ISD_Device* dev; // 0x08 - u32 unk_0x0C; - u32 unk_0x10; - u32* resp; // 0x14 - u8* unk_0x18; + SDCallbackFunc cb; // 0x00 + void* cbArg; // 0x04 + ISD_Device* dev; // 0x08 + u32 unk_0x0C; + u32 unk_0x10; + u32* resp; // 0x14 + u8* unk_0x18; } __sdCbArg; enum { SD_IOCTL_2 = 2, }; -static IOSFd sduOpenFD(u32 slot); +static IOSFd sduOpenFD(u32 slot); -static IOSError sduCommandv(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg, u32 buffer, u32 blockCount, u32 sectorSize, u32 param_9, u32* resp, void* cb, void* cbArg); -static ISD_Error sduCommand(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg, u32 buffer, u32 blockCount, u32 sectorSize, u32 param_9, u32* resp, void* cb, void* cbArg); +static IOSError sduCommandv(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg, u32 buffer, u32 blockCount, u32 sectorSize, u32 param_9, u32* resp, + void* cb, void* cbArg); +static ISD_Error sduCommand(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg, u32 buffer, u32 blockCount, u32 sectorSize, u32 param_9, u32* resp, + void* cb, void* cbArg); -static ISD_Error sduDatabuswidth(ISD_Device* dev, u32 buswidth); -static ISD_Error sduGetSCR(ISD_Device* dev, u32* data) NO_INLINE; -static ISD_Error sduGetOCR(ISD_Device* dev, u32* data); +static ISD_Error sduDatabuswidth(ISD_Device* dev, u32 buswidth); +static ISD_Error sduGetSCR(ISD_Device* dev, u32* data) NO_INLINE; +static ISD_Error sduGetOCR(ISD_Device* dev, u32* data); IOSError __sdCb(s32 result, void* arg) { __sdCbArg* data = (__sdCbArg*)arg; @@ -65,8 +67,7 @@ IOSError __sdCb(s32 result, void* arg) { if (result != 0) { OSReport(" +++ SD RESET Failed: %d +++\n", result); data->dev->unk_0x10 = 0; - } - else { + } else { if (data->dev != NULL) { data->dev->unk_0x10 = *data->resp; __sdCardStatus = 0x10000; @@ -128,16 +129,14 @@ ISD_Error ISD_GetDeviceStatus(ISD_Device* dev, u32* param_2) { if (__sdReq != 0) { OSUnlockMutex(&__reqMutex); - } - else { + } else { __sdReq = 1; OSUnlockMutex(&__reqMutex); ret = IOS_Ioctl(dev->fd, 11, NULL, 0, __sdCmdBuffer, 4); if (ret != IPC_RESULT_OK) { __sdReq = 0; - } - else { + } else { *param_2 = *__sdCmdBuffer; __sdReq = 0; } @@ -147,7 +146,8 @@ ISD_Error ISD_GetDeviceStatus(ISD_Device* dev, u32* param_2) { return ret; } -static IOSError sduCommandv(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg, u32 buffer, u32 blockCount, u32 sectorSize, u32 param_9, u32* resp, void* cb, void* cbArg) { +static IOSError sduCommandv(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg, u32 buffer, u32 blockCount, u32 sectorSize, u32 param_9, u32* resp, + void* cb, void* cbArg) { IOSError ret; u32 readCount, writeCount; u32* sdCmd; @@ -155,8 +155,7 @@ static IOSError sduCommandv(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg, if (param_9 != 0) { readCount = 2; writeCount = 1; - } - else { + } else { readCount = 1; writeCount = 2; } @@ -164,8 +163,7 @@ static IOSError sduCommandv(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg, sdCmd = iosAlloc(__sdHeapId, OSRoundUp32B(SD_CMD_SIZE)); if (sdCmd == NULL) { ret = IPC_RESULT_ALLOC_FAILED; - } - else { + } else { sdCmd[0] = cmd; sdCmd[1] = cmdType; sdCmd[2] = respType; @@ -186,18 +184,16 @@ static IOSError sduCommandv(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg, __sdCbArg* data = iosAlloc(__sdHeapId, sizeof(__sdCbArg)); if (data == NULL) { ret = IPC_RESULT_ALLOC_FAILED; - } - else { + } else { data->cb = cb; data->cbArg = cbArg; data->resp = resp; data->unk_0x0C = cmd; data->unk_0x18 = (u8*)sdCmd; - ret = IOS_IoctlvAsync(fd, 7, readCount, writeCount, __sdVect, __sdCb, data); + ret = IOS_IoctlvAsync(fd, 7, readCount, writeCount, __sdVect, __sdCb, data); } - } - else { + } else { ret = IOS_Ioctlv(fd, 7, readCount, writeCount, __sdVect); if (ret == IPC_RESULT_OK && resp != NULL) { resp[0] = __sdResp[0]; @@ -206,21 +202,21 @@ static IOSError sduCommandv(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg, } if ((cb == NULL || ret != IPC_RESULT_OK) && sdCmd != NULL) { - iosFree(__sdHeapId,sdCmd); + iosFree(__sdHeapId, sdCmd); } return ret; } -static ISD_Error sduCommand(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg, u32 buffer, u32 blockCount, u32 sectorSize, u32 param_9, u32* resp, void* cb, void* cbArg) { +static ISD_Error sduCommand(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg, u32 buffer, u32 blockCount, u32 sectorSize, u32 param_9, u32* resp, + void* cb, void* cbArg) { ISD_Error ret; u32* sdCmd; sdCmd = iosAlloc(__sdHeapId, ROUNDUP(SD_CMD_SIZE, 64)); if (sdCmd == NULL) { ret = IPC_RESULT_ALLOC_FAILED; - } - else { + } else { sdCmd[0] = cmd; sdCmd[1] = cmdType; sdCmd[2] = respType; @@ -235,8 +231,7 @@ static ISD_Error sduCommand(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg, __sdCbArg* data = iosAlloc(__sdHeapId, sizeof(__sdCbArg)); if (data == NULL) { ret = IPC_RESULT_ALLOC_FAILED; - } - else { + } else { data->cb = cb; data->cbArg = cbArg; data->resp = resp; @@ -249,23 +244,20 @@ static ISD_Error sduCommand(s32 fd, u32 cmd, u32 cmdType, u32 respType, u32 arg, ret = SD_ERROR_FATAL; } } - } - else { - ret = IOS_Ioctl(fd, 7, sdCmd, 0x24, __sdResp, 0x10); + } else { + ret = IOS_Ioctl(fd, 7, sdCmd, 0x24, __sdResp, 0x10); if (ret != IPC_RESULT_OK) { if (cmd == 7) { ret = SD_ERROR_SUCCESS; } - } - else { + } else { resp[0] = __sdResp[0]; resp[1] = __sdResp[1]; resp[2] = __sdResp[2]; resp[3] = __sdResp[3]; } } - } - else { + } else { ret = SD_ERROR_FATAL; } } @@ -328,20 +320,17 @@ ISD_Error ISD_ProbeCard(u32 slot) { if (__sdHeapId < 0) { ret = SD_ERROR_FATAL; - } - else { + } else { ret = ISD_MountCard(slot, &pDev); if (ret >= IPC_RESULT_OK) { ret = ISD_GetDeviceStatus(pDev, &status); if (ret < IPC_RESULT_OK) { ISD_UnmountCard(pDev); - } - else { + } else { if ((status & 0x10000) || ((ISD_ResetDevice(pDev) >= 0) && (ISD_GetDeviceStatus(pDev, &status) >= 0) && (status & 0x10000))) { ISD_UnmountCard(pDev); ret = SD_ERROR_SUCCESS; - } - else { + } else { ISD_UnmountCard(pDev); ret = SD_ERROR_01000006; } @@ -360,7 +349,7 @@ ISD_Error ISD_MountCard(u32 slot, ISD_Device** dev) { goto out; } - if (slot >= SD_MAX_SLOTS+1) { + if (slot >= SD_MAX_SLOTS + 1) { return IPC_RESULT_INVALID; } @@ -410,8 +399,7 @@ ISD_Error sduDatabuswidth(ISD_Device* dev, u32 buswidth) { if (cmdArg != 0) { hcReg |= 2; - } - else { + } else { hcReg &= ~0x02; } @@ -457,7 +445,7 @@ ISD_Error ISD_ReadCardRegister(ISD_Device* dev, u32 cmd, u32* cmdResp, u32 cmdRe OSUnlockMutex(&__reqMutex); if (dev->unk_0x24 == 1) { - u32 resp[4]; + u32 resp[4]; ret = sduCommand(dev->fd, 7, 3, 2, 0, 0, 0, 0, 0, resp, NULL, NULL); @@ -472,21 +460,21 @@ ISD_Error ISD_ReadCardRegister(ISD_Device* dev, u32 cmd, u32* cmdResp, u32 cmdRe if (ret != IPC_RESULT_OK) { goto out; } - } - + } + if (cmdResp == NULL || cmdRespSize == 0) { ret = -4; __sdReq = 0; goto out; } - + switch (cmd) { case 10: case 9: { break; } case 51: { - ret = sduGetSCR(dev, cmdResp); + ret = sduGetSCR(dev, cmdResp); __sdReq = 0; goto out; } @@ -505,8 +493,8 @@ ISD_Error ISD_ReadCardRegister(ISD_Device* dev, u32 cmd, u32* cmdResp, u32 cmdRe return -4; } } - - ret = sduCommand(dev->fd, cmd, 3, 3, cmdArg, 0,0, 0, 0, cmdResp, NULL, NULL); + + ret = sduCommand(dev->fd, cmd, 3, 3, cmdArg, 0, 0, 0, 0, cmdResp, NULL, NULL); __sdReq = 0; @@ -520,7 +508,7 @@ static ISD_Error sduGetSCR(ISD_Device* dev, u32* data) { if (data != NULL) { sduCommand(dev->fd, 0x10, 3, 1, 4, 0, 0, 0, 0, resp, NULL, NULL); - ret = sduCommand(dev->fd, 55, 3 , 1, dev->unk_0x10, 0, 0, 0, 0, resp, NULL, NULL); + ret = sduCommand(dev->fd, 55, 3, 1, dev->unk_0x10, 0, 0, 0, 0, resp, NULL, NULL); if (ret != 0) { return ret; } @@ -562,8 +550,7 @@ ISD_Error ISD_GetCardSize(ISD_Device* dev, u32* param_2, u32* param_3, u32* para out0 = 0x80; out2 = (((resp[1] >> 8) & 0x3FFFFF) + 1) * 512; out1 = ((((resp[1] >> 8) & 0x3FFFFF) + 1) * 8) & 0x01FFFFF8; - } - else { + } else { u32 tmp = (((resp[2] >> 8) & 0xF) >= 9 ? ((resp[2] >> 8) & 0xF) : 9); tmp = tmp <= 11 ? tmp : 11; diff --git a/libs/RVL_SDK/src/si/SIBios.c b/libs/RVL_SDK/src/si/SIBios.c index 5d0ddb72..0a5ce463 100644 --- a/libs/RVL_SDK/src/si/SIBios.c +++ b/libs/RVL_SDK/src/si/SIBios.c @@ -2,8 +2,8 @@ #include -#include #include +#include #include @@ -11,41 +11,30 @@ SDKDefineVersion(SI, "Apr 20 2010", "11:20:53"); -static SIControl Si = { - SI_CHAN_BAD, - 0, - 0, - NULL, - NULL -}; +static SIControl Si = {SI_CHAN_BAD, 0, 0, NULL, NULL}; -static u32 CompleteTransfer(); +static u32 CompleteTransfer(); static void SITransferNext(s32 chan); static void SIInterruptHandler(__OSInterrupt interrupt, OSContext* context); -static int __SITransfer(s32 chan, void* output, u32 outputBytes, void* input, u32 inputBytes, SICallback callback); +static int __SITransfer(s32 chan, void* output, u32 outputBytes, void* input, u32 inputBytes, SICallback callback); static void AlarmHandler(OSAlarm* alarm, OSContext* context); static void GetTypeCallback(s32 chan, u32 error, OSContext* context); -static int SIGetResponseRaw(s32 chan); +static int SIGetResponseRaw(s32 chan); -static SIPacket Packet[SI_CHAN_MAX]; -static OSAlarm Alarm[SI_CHAN_MAX]; +static SIPacket Packet[SI_CHAN_MAX]; +static OSAlarm Alarm[SI_CHAN_MAX]; -static u32 Type[SI_CHAN_MAX] = { - SI_ERROR_NO_RESPONSE, - SI_ERROR_NO_RESPONSE, - SI_ERROR_NO_RESPONSE, - SI_ERROR_NO_RESPONSE -}; -static OSTime TypeTime[SI_CHAN_MAX]; -static SITypeCallback TypeCallback[SI_CHAN_MAX][SI_TYPE_MAX]; +static u32 Type[SI_CHAN_MAX] = {SI_ERROR_NO_RESPONSE, SI_ERROR_NO_RESPONSE, SI_ERROR_NO_RESPONSE, SI_ERROR_NO_RESPONSE}; +static OSTime TypeTime[SI_CHAN_MAX]; +static SITypeCallback TypeCallback[SI_CHAN_MAX][SI_TYPE_MAX]; -static OSTime XferTime[SI_CHAN_MAX]; +static OSTime XferTime[SI_CHAN_MAX]; static __OSInterruptHandler RDSTHandler[SI_CHAN_MAX]; -static BOOL InputBufferValid[SI_CHAN_MAX]; -static u32 InputBuffer[SI_CHAN_MAX][2]; -static vu32 InputBufferVcount[SI_CHAN_MAX]; +static BOOL InputBufferValid[SI_CHAN_MAX]; +static u32 InputBuffer[SI_CHAN_MAX][2]; +static vu32 InputBufferVcount[SI_CHAN_MAX]; u32 __PADFixBits; @@ -61,8 +50,8 @@ static void SIClearTCInterrupt() { u32 reg; reg = SI_READ_REG(SI_CONTROL_STATUS); - reg |= (1<>2)]; + *((u32*)input)++ = __SIRegs[i + (SI_IO_BUFFER >> 2)]; } - + rLen = Si.inputBytes & 3; if (rLen != 0) { - temp = __SIRegs[i+(SI_IO_BUFFER>>2)]; + temp = __SIRegs[i + (SI_IO_BUFFER >> 2)]; for (i = 0; i < rLen; i++) { *(input++) = temp >> ((3 - i) * 8); } } - if (SI_READ_REG(SI_CONTROL_STATUS) & (1<>= (3 - Si.chan) * 8; sr &= 0xF; if ((sr & 8) != 0 && (Type[Si.chan] & 0x80) == 0) { @@ -102,8 +91,7 @@ static u32 CompleteTransfer() { if (sr == 0) { sr = 4; } - } - else { + } else { TypeTime[Si.chan] = __OSGetSystemTime(); sr = 0; } @@ -124,7 +112,8 @@ static void SIInterruptHandler(__OSInterrupt interrupt, OSContext* context) { u32 x; reg = SI_READ_REG(SI_CONTROL_STATUS); - if ((reg & ((1<> 16; @@ -205,20 +195,19 @@ static BOOL SIEnablePollingInterrupt(BOOL enable) { enabled = OSDisableInterrupts(); reg = SI_READ_REG(SI_CONTROL_STATUS); - rc = ((reg & (1<> (chan * 8)); SI_WRITE_REG(SI_STATUS, sr); - + Si.chan = chan; Si.callback = callback; Si.inputBytes = inputBytes; @@ -318,9 +308,9 @@ static int __SITransfer(s32 chan, void* output, u32 outputBytes, void* input, u3 rLen = ROUNDUP(outputBytes, 4) / 4; for (i = 0; i < rLen; i++) { - __SIRegs[i + (SI_0_BUTTON_2_BUFFER<<2)] = ((u32*)output)[i]; + __SIRegs[i + (SI_0_BUTTON_2_BUFFER << 2)] = ((u32*)output)[i]; } - + comcsr.val = SI_READ_REG(SI_CONTROL_STATUS); comcsr.f.tcint = 1; comcsr.f.tcintmsk = callback ? 1 : 0; @@ -355,11 +345,11 @@ u32 SIGetStatus(s32 chan) { } void SISetCommand(s32 chan, u32 command) { - __SIRegs[chan * (SI_1_OUT_BUFFER>>2)] = command; + __SIRegs[chan * (SI_1_OUT_BUFFER >> 2)] = command; } void SITransferCommands() { - SI_WRITE_REG(SI_STATUS, (1<> 24; en = poll & 0xF0; poll &= ((en >> 4) | 0x03FFFFF0); poll &= 0xFC0000FF; - + Si.poll &= ~(en >> 4); Si.poll |= poll; poll = Si.poll; @@ -424,8 +414,8 @@ static BOOL SIGetResponseRaw(s32 chan) { sr = SIGetStatus(chan); if (sr & 0x20) { - InputBuffer[chan][0] = __SIRegs[(SI_BUTTON_BUFFER>>2) + chan * (SI_BUFFER_SIZE>>2)]; - InputBuffer[chan][1] = __SIRegs[(SI_BUTTON_2_BUFFER>>2) + chan * (SI_BUFFER_SIZE>>2)]; + InputBuffer[chan][0] = __SIRegs[(SI_BUTTON_BUFFER >> 2) + chan * (SI_BUFFER_SIZE >> 2)]; + InputBuffer[chan][1] = __SIRegs[(SI_BUTTON_2_BUFFER >> 2) + chan * (SI_BUFFER_SIZE >> 2)]; InputBufferValid[chan] = TRUE; return TRUE; } @@ -441,7 +431,7 @@ BOOL SIGetResponse(s32 chan, void* data) { SIGetResponseRaw(chan); rc = InputBufferValid[chan]; InputBufferValid[chan] = FALSE; - + if (rc) { ((u32*)data)[0] = InputBuffer[chan][0]; ((u32*)data)[1] = InputBuffer[chan][1]; @@ -482,16 +472,14 @@ BOOL SITransfer(s32 chan, void* output, u32 outputBytes, void* input, u32 inputB now = __OSGetSystemTime(); if (delay == 0) { fire = now; - } - else { + } else { fire = delay + XferTime[chan]; } if (now < fire) { delay = fire - now; OSSetAlarm(&Alarm[chan], delay, AlarmHandler); - } - else if (__SITransfer(chan, output, outputBytes, input, inputBytes, callback)) { + } else if (__SITransfer(chan, output, outputBytes, input, inputBytes, callback)) { OSRestoreInterrupts(enabled); return TRUE; } @@ -513,7 +501,7 @@ static void CallTypeAndStatusCallback(s32 chan, u32 type) { for (i = 0; i < SI_CHAN_MAX; i++) { callback = TypeCallback[chan][i]; - + if (callback != 0) { TypeCallback[chan][i] = 0; callback(chan, type); @@ -539,12 +527,11 @@ static void GetTypeCallback(s32 chan, u32 error, OSContext* context) { if ((error & 0xF) != 0 || (type & 0x18000000) != 0x08000000 || (type & 0x80000000) == 0 || (type & 0x04000000) != 0) { OSSetWirelessID(chan, 0); CallTypeAndStatusCallback(chan, Type[chan]); - } - else { + } else { static u32 cmdFixDevice[SI_CHAN_MAX]; id = OSGetWirelessID(chan) << 8; - + if (fix != 0 && (id & 0x100000) != 0) { cmdFixDevice[chan] = 0x4E000000 | (id & 0xCFFF00) | 0x100000; Type[chan] = SI_ERROR_BUSY; @@ -565,8 +552,7 @@ static void GetTypeCallback(s32 chan, u32 error, OSContext* context) { SITransfer(chan, &cmdFixDevice[chan], 3, &Type[chan], 3, &GetTypeCallback, 0); return; } - } - else { + } else { if ((type & 0x40000000) != 0) { id = type & 0xCFFF00; id |= 0x100000; @@ -602,8 +588,7 @@ u32 SIGetType(s32 chan) { } type = Type[chan] = SI_ERROR_BUSY; - } - else { + } else { if (diff <= OSMillisecondsToTicks(50) && type != 8) { OSRestoreInterrupts(enabled); return type; @@ -611,8 +596,7 @@ u32 SIGetType(s32 chan) { if (diff <= OSMillisecondsToTicks(75)) { Type[chan] = SI_ERROR_BUSY; - } - else { + } else { type = Type[chan] = SI_ERROR_BUSY; } } @@ -643,8 +627,7 @@ u32 SIGetTypeAsync(s32 chan, SITypeCallback callback) { } } - } - else { + } else { callback(chan, type); } diff --git a/libs/RVL_SDK/src/si/SISamplingRate.c b/libs/RVL_SDK/src/si/SISamplingRate.c index 46b04f1a..77b72cb3 100644 --- a/libs/RVL_SDK/src/si/SISamplingRate.c +++ b/libs/RVL_SDK/src/si/SISamplingRate.c @@ -8,38 +8,18 @@ static u32 SamplingRate = 0; typedef struct XY { - u16 line; // 0x00 - u8 count; // 0x04 + u16 line; // 0x00 + u8 count; // 0x04 } XY; static XY XYNTSC[12] = { - {0x00F6, 0x02}, - {0x000E, 0x13}, - {0x001E, 0x09}, - {0x002C, 0x06}, - {0x0034, 0x05}, - {0x0041, 0x04}, - {0x0057, 0x03}, - {0x0057, 0x03}, - {0x0057, 0x03}, - {0x0083, 0x02}, - {0x0083, 0x02}, - {0x0083, 0x02}, + {0x00F6, 0x02}, {0x000E, 0x13}, {0x001E, 0x09}, {0x002C, 0x06}, {0x0034, 0x05}, {0x0041, 0x04}, + {0x0057, 0x03}, {0x0057, 0x03}, {0x0057, 0x03}, {0x0083, 0x02}, {0x0083, 0x02}, {0x0083, 0x02}, }; static XY XYPAL[12] = { - {0x0128, 0x02}, - {0x000F, 0x15}, - {0x001D, 0x0B}, - {0x002D, 0x07}, - {0x0034, 0x06}, - {0x003F, 0x05}, - {0x004E, 0x04}, - {0x0068, 0x03}, - {0x0068, 0x03}, - {0x0068, 0x03}, - {0x0068, 0x03}, - {0x009C, 0x02}, + {0x0128, 0x02}, {0x000F, 0x15}, {0x001D, 0x0B}, {0x002D, 0x07}, {0x0034, 0x06}, {0x003F, 0x05}, + {0x004E, 0x04}, {0x0068, 0x03}, {0x0068, 0x03}, {0x0068, 0x03}, {0x0068, 0x03}, {0x009C, 0x02}, }; void SISetSamplingRate(u32 msec) { diff --git a/libs/RVL_SDK/src/tpl/TPL.c b/libs/RVL_SDK/src/tpl/TPL.c index 7b556488..b129f9c2 100644 --- a/libs/RVL_SDK/src/tpl/TPL.c +++ b/libs/RVL_SDK/src/tpl/TPL.c @@ -1,6 +1,6 @@ -#include -#include #include +#include +#include void TPLBind(TPLPalette* pal) { u16 i; @@ -12,7 +12,7 @@ void TPLBind(TPLPalette* pal) { for (i = 0; i < pal->numDescriptors; i++) { if (pal->descriptorArray[i].textureHeader) { pal->descriptorArray[i].textureHeader = (TPLHeader*)(((u32)(pal->descriptorArray[i].textureHeader)) + ((u32)pal)); - + if (!pal->descriptorArray[i].textureHeader->unpacked) { pal->descriptorArray[i].textureHeader->data = (char*)((u32)(pal->descriptorArray[i].textureHeader->data) + (u32)pal); pal->descriptorArray[i].textureHeader->unpacked = 1; @@ -37,7 +37,10 @@ TPLDescriptor* TPLGet(TPLPalette* pal, u32 id) { void TPLGetGXTexObjFromPalette(TPLPalette* pal, GXTexObj* texObj, u32 id) { TPLDescriptor* descriptor = TPLGet(pal, id); GXBool hasMipMap = descriptor->textureHeader->minLOD == descriptor->textureHeader->maxLOD ? GX_FALSE : GX_TRUE; - - GXInitTexObj(texObj, descriptor->textureHeader->data, descriptor->textureHeader->width, descriptor->textureHeader->height, descriptor->textureHeader->format, descriptor->textureHeader->wrapS, descriptor->textureHeader->wrapT, hasMipMap); - GXInitTexObjLOD(texObj, descriptor->textureHeader->minFilter,descriptor->textureHeader->magFilter, descriptor->textureHeader->minLOD,descriptor->textureHeader->maxLOD, descriptor->textureHeader->LODBias, GX_FALSE, descriptor->textureHeader->edgeLODEnable, GX_ANISO_1); + + GXInitTexObj(texObj, descriptor->textureHeader->data, descriptor->textureHeader->width, descriptor->textureHeader->height, + descriptor->textureHeader->format, descriptor->textureHeader->wrapS, descriptor->textureHeader->wrapT, hasMipMap); + GXInitTexObjLOD(texObj, descriptor->textureHeader->minFilter, descriptor->textureHeader->magFilter, descriptor->textureHeader->minLOD, + descriptor->textureHeader->maxLOD, descriptor->textureHeader->LODBias, GX_FALSE, descriptor->textureHeader->edgeLODEnable, + GX_ANISO_1); } diff --git a/libs/RVL_SDK/src/usb/usb.c b/libs/RVL_SDK/src/usb/usb.c index 8b166d88..c1137473 100644 --- a/libs/RVL_SDK/src/usb/usb.c +++ b/libs/RVL_SDK/src/usb/usb.c @@ -2,15 +2,15 @@ #include -#include #include +#include #include #include -#include #include +#include #define USB_HEAP_SIZE 0x4000 @@ -33,25 +33,25 @@ typedef enum { } USBIoctl; typedef struct USBMsg { - void* buffer; // 0x00 - u16 length; // 0x04 + void* buffer; // 0x00 + u16 length; // 0x04 } USBMsg; typedef struct USBCommandBlock { - USBCallback callback; // 0x00 - USBIsoCallback isoCallback; // 0x04 - void* callbackArg; // 0x08 - void* unkIsoArg; // 0x0C + USBCallback callback; // 0x00 + USBIsoCallback isoCallback; // 0x04 + void* callbackArg; // 0x08 + void* unkIsoArg; // 0x0C - char unk_0x10[0x4]; + char unk_0x10[0x4]; - void* clean[USB_NCLEAN_MAX]; // 0x14 - u32 nclean; // 0x34 - char unk_0x38[0x40 - 0x38]; + void* clean[USB_NCLEAN_MAX]; // 0x14 + u32 nclean; // 0x34 + char unk_0x38[0x40 - 0x38]; union { - char path[FS_MAX_PATH]; - USBMsg msg; - }; // 0x40 + char path[FS_MAX_PATH]; + USBMsg msg; + }; // 0x40 } USBCommandBlock; static s32 hId = -1; @@ -157,14 +157,10 @@ static s32 _intrBlkCtrlIsoCb(s32 result, void* arg) { USB_LOG("_intrBlkCtrlIsoCb returned: %d\n", result); USB_LOG("_intrBlkCtrlIsoCb: nclean = %d\n", block->nclean); - if (block->nclean != USB_NCLEAN_CTRLMSG - && block->nclean != USB_NCLEAN_BULKMSG - && block->nclean != USB_NCLEAN_CLOSEDEVICE - && block->nclean != USB_NCLEAN_4 - && block->nclean != USB_NCLEAN_2) { + if (block->nclean != USB_NCLEAN_CTRLMSG && block->nclean != USB_NCLEAN_BULKMSG && block->nclean != USB_NCLEAN_CLOSEDEVICE && + block->nclean != USB_NCLEAN_4 && block->nclean != USB_NCLEAN_2) { USB_ERR("__intrBlkCtrlIsoCb: got invalid nclean\n"); - } - else { + } else { for (i = 0; i < block->nclean; i++) { USB_LOG("Freeing clean[%d] = %x\n", i, block->clean[i]); IOSFree(block->clean[i]); @@ -176,8 +172,7 @@ static s32 _intrBlkCtrlIsoCb(s32 result, void* arg) { if (block->callback != NULL) { block->callback(result, block->callbackArg); - } - else if (block->isoCallback != NULL) { + } else if (block->isoCallback != NULL) { USB_LOG("calling iso callback\n"); block->isoCallback(result, block->unkIsoArg, block->callbackArg); } @@ -235,7 +230,7 @@ IOSError IUSB_CloseDeviceAsync(s32 fd, USBCallback callback, void* callbackArg) result = IPC_RESULT_ALLOC_FAILED; goto end; } - + memset(block, 0, sizeof(USBCommandBlock)); block->callback = callback; @@ -353,7 +348,8 @@ IOSError IUSB_WriteBlkMsgAsync(s32 fd, u32 endpoint, u32 length, const void* buf return __IntrBlkMsgInt(fd, endpoint, length, (void*)buffer, USB_IOCTLV_BLKMSG, callback, callbackArg, TRUE); } -static IOSError __CtrlMsgInt(s32 fd, u8 requestType, u8 request, u16 value, u16 index, u16 length, void* buffer, USBCallback callback, void* callbackArg, u8 async) { +static IOSError __CtrlMsgInt(s32 fd, u8 requestType, u8 request, u16 value, u16 index, u16 length, void* buffer, USBCallback callback, + void* callbackArg, u8 async) { IOSError result; IOSIoVector* vectors; u8* requestTypeWork; @@ -378,8 +374,7 @@ static IOSError __CtrlMsgInt(s32 fd, u8 requestType, u8 request, u16 value, u16 indexWork = (u16*)IOSAlloc(DEFAULT_ALIGN); lengthWork = (u16*)IOSAlloc(DEFAULT_ALIGN); - if (requestTypeWork == NULL || requestWork == NULL || unkWork == NULL || - valueWork == NULL || indexWork == NULL || lengthWork == NULL || + if (requestTypeWork == NULL || requestWork == NULL || unkWork == NULL || valueWork == NULL || indexWork == NULL || lengthWork == NULL || vectors == NULL) { USB_ERR("Ctrl Msg: Not enough memory\n"); result = IPC_RESULT_ALLOC_FAILED; @@ -484,7 +479,8 @@ end_async: return result; } -IOSError IUSB_WriteCtrlMsgAsync(s32 fd, u8 requestType, u8 request, u16 value, u16 index, u16 length, void* buffer, USBCallback callback, void* callbackArg) { +IOSError IUSB_WriteCtrlMsgAsync(s32 fd, u8 requestType, u8 request, u16 value, u16 index, u16 length, void* buffer, USBCallback callback, + void* callbackArg) { DCFlushRange(buffer, length); return __CtrlMsgInt(fd, requestType, request, value, index, length, buffer, callback, callbackArg, TRUE); } diff --git a/libs/RVL_SDK/src/usbcmn/puh_ker_mem.c b/libs/RVL_SDK/src/usbcmn/puh_ker_mem.c index 3c6281a2..71a3493c 100644 --- a/libs/RVL_SDK/src/usbcmn/puh_ker_mem.c +++ b/libs/RVL_SDK/src/usbcmn/puh_ker_mem.c @@ -5,8 +5,7 @@ void* uhf_ker_get_memory_block(void* heap, u32 size, int align) { if (heap == NULL || size == 0) { return NULL; - } - else { + } else { return MEMAllocFromExpHeapEx((MEMHeapHandle)heap, size, align); } } @@ -14,8 +13,7 @@ void* uhf_ker_get_memory_block(void* heap, u32 size, int align) { s32 uhf_ker_release_memory_block(void* heap, void* block) { if (heap == NULL || block == NULL) { return -1; - } - else { + } else { MEMFreeToExpHeap((MEMHeapHandle)heap, block); return 0; } diff --git a/libs/RVL_SDK/src/usbcmn/puh_ker_msg.c b/libs/RVL_SDK/src/usbcmn/puh_ker_msg.c index bb9ee2ca..82d12b9f 100644 --- a/libs/RVL_SDK/src/usbcmn/puh_ker_msg.c +++ b/libs/RVL_SDK/src/usbcmn/puh_ker_msg.c @@ -7,9 +7,9 @@ static struct { struct { OSMessageQueue* queue; // 0x00 - void* unk_0x04; - } entries[MAX_PUH_SEM]; // 0x00 - void* unk_0x14; + void* unk_0x04; + } entries[MAX_PUH_SEM]; // 0x00 + void* unk_0x14; } st_uhs_ker_msg_mng; s32 uhf_ker_send_message(int index, void* message) { @@ -21,9 +21,9 @@ s32 uhf_ker_send_message(int index, void* message) { return -5; } - if (st_uhs_ker_msg_mng.entries[index-1].queue == NULL) { + if (st_uhs_ker_msg_mng.entries[index - 1].queue == NULL) { return -12; } - return OSSendMessage(st_uhs_ker_msg_mng.entries[index-1].queue, message, 0) ? 0 : -20; + return OSSendMessage(st_uhs_ker_msg_mng.entries[index - 1].queue, message, 0) ? 0 : -20; } diff --git a/libs/RVL_SDK/src/usbcmn/puh_ker_sem.c b/libs/RVL_SDK/src/usbcmn/puh_ker_sem.c index b452411e..2223afa9 100644 --- a/libs/RVL_SDK/src/usbcmn/puh_ker_sem.c +++ b/libs/RVL_SDK/src/usbcmn/puh_ker_sem.c @@ -6,24 +6,23 @@ static struct { struct { - OSSemaphore* sem; // 0x00 - u32 unk_0x04; - u32 unk_0x08; - } entries[MAX_PUH_SEM]; // 0x00 - u32 unk_0x90; - OSSemaphore* unk_0x94; - u8 unk_0x98[0x0C]; + OSSemaphore* sem; // 0x00 + u32 unk_0x04; + u32 unk_0x08; + } entries[MAX_PUH_SEM]; // 0x00 + u32 unk_0x90; + OSSemaphore* unk_0x94; + u8 unk_0x98[0x0C]; } st_uhs_ker_sem_mng; -static OSSemaphore st_uhf_ker_sem[MAX_PUH_SEM]; +static OSSemaphore st_uhf_ker_sem[MAX_PUH_SEM]; -static s32 st_uhs_ker_sem_status; +static s32 st_uhs_ker_sem_status; static int uhf_ker_sem_inline_0() { if (st_uhs_ker_sem_status != 1 || st_uhs_ker_sem_mng.unk_0x94 == 0) { return -1; - } - else { + } else { OSWaitSemaphore(st_uhs_ker_sem_mng.unk_0x94); return 0; } @@ -92,14 +91,14 @@ s32 uhf_ker_delete_sem(int sem) { return -5; } - if (st_uhs_ker_sem_mng.entries[sem-1].sem == NULL) { + if (st_uhs_ker_sem_mng.entries[sem - 1].sem == NULL) { uhf_ker_sem_inline_1(); return -5; } - st_uhs_ker_sem_mng.entries[sem-1].sem = NULL; - st_uhs_ker_sem_mng.entries[sem-1].unk_0x04 = 0; - st_uhs_ker_sem_mng.entries[sem-1].unk_0x08 = 0; + st_uhs_ker_sem_mng.entries[sem - 1].sem = NULL; + st_uhs_ker_sem_mng.entries[sem - 1].unk_0x04 = 0; + st_uhs_ker_sem_mng.entries[sem - 1].unk_0x08 = 0; st_uhs_ker_sem_mng.unk_0x90--; uhf_ker_sem_inline_1(); @@ -112,11 +111,11 @@ s32 uhf_ker_get_sem(int sem) { return -5; } - if (st_uhs_ker_sem_mng.entries[sem-1].sem == NULL) { + if (st_uhs_ker_sem_mng.entries[sem - 1].sem == NULL) { return -5; } - OSWaitSemaphore(st_uhs_ker_sem_mng.entries[sem-1].sem); + OSWaitSemaphore(st_uhs_ker_sem_mng.entries[sem - 1].sem); return 0; } diff --git a/libs/RVL_SDK/src/usbcmn/puh_ker_tsk.c b/libs/RVL_SDK/src/usbcmn/puh_ker_tsk.c index 777bd7ce..103e450f 100644 --- a/libs/RVL_SDK/src/usbcmn/puh_ker_tsk.c +++ b/libs/RVL_SDK/src/usbcmn/puh_ker_tsk.c @@ -6,9 +6,9 @@ static struct { struct { - OSThread* unk_0x00; - u8 unk_0x04[0x33C]; - } entries[MAX_PUH_TSK]; // 0x00 + OSThread* unk_0x00; + u8 unk_0x04[0x33C]; + } entries[MAX_PUH_TSK]; // 0x00 u32 unk_0x680; u32 unk_0x684; u32 unk_0x688; @@ -24,9 +24,9 @@ s32 uhf_ker_set_priority(int tsk, int priority) { return -5; } - if (st_uhs_ker_tsk_mng.entries[tsk-1].unk_0x00 == NULL) { + if (st_uhs_ker_tsk_mng.entries[tsk - 1].unk_0x00 == NULL) { return -1; } - return OSSetThreadPriority(st_uhs_ker_tsk_mng.entries[tsk-1].unk_0x00, priority) ? 0 : -20; + return OSSetThreadPriority(st_uhs_ker_tsk_mng.entries[tsk - 1].unk_0x00, priority) ? 0 : -20; } diff --git a/libs/RVL_SDK/src/usbkbd/usb_kbd.c b/libs/RVL_SDK/src/usbkbd/usb_kbd.c index add3324e..9c7068fd 100644 --- a/libs/RVL_SDK/src/usbkbd/usb_kbd.c +++ b/libs/RVL_SDK/src/usbkbd/usb_kbd.c @@ -17,24 +17,24 @@ enum { }; typedef struct _usbKbdAsyncMem { - u32 state; // 0x00 - void* kbd; // 0x04 - char modifiers; // 0x08 - u8 unk_0x09; - u8 keys[6]; // 0x0A + u32 state; // 0x00 + void* kbd; // 0x04 + char modifiers; // 0x08 + u8 unk_0x09; + u8 keys[6]; // 0x0A } usbKbdAsyncMem; -static s32 usbKbdFd; +static s32 usbKbdFd; static USBKBDAttachCallback usbKbdAttachCb; static USBKBDDetachCallback usbKbdDetachCb; -static USBKBDEventCallback usbKbdEventCb; +static USBKBDEventCallback usbKbdEventCb; -static u32 usbKbdIosResult; -static u8 usbKbdIosResultMem[OSRoundUp32B(sizeof(usbKbdAsyncMem))]; +static u32 usbKbdIosResult; +static u8 usbKbdIosResultMem[OSRoundUp32B(sizeof(usbKbdAsyncMem))]; -static BOOL usbKbdInitialized = FALSE; -static BOOL usbKbdAsyncReady = FALSE; +static BOOL usbKbdInitialized = FALSE; +static BOOL usbKbdAsyncReady = FALSE; static IOSError usbKbdCallbackHandler(s32 result, void* arg) { usbKbdAsyncMem* data = (usbKbdAsyncMem*)arg; @@ -62,7 +62,8 @@ static IOSError usbKbdCallbackHandler(s32 result, void* arg) { } // Loop back - IOS_IoctlAsync(usbKbdFd, USB_KBD_IOCTL_INIT_CALLBACK, NULL, 0, (void*)usbKbdIosResult, sizeof(usbKbdAsyncMem), usbKbdCallbackHandler, (void*)usbKbdIosResult); + IOS_IoctlAsync(usbKbdFd, USB_KBD_IOCTL_INIT_CALLBACK, NULL, 0, (void*)usbKbdIosResult, sizeof(usbKbdAsyncMem), usbKbdCallbackHandler, + (void*)usbKbdIosResult); return IPC_RESULT_OK; } @@ -83,12 +84,12 @@ USBKBDErr USBKBDInitialize(USBKBDAttachCallback attachCb, USBKBDDetachCallback d usbKbdIosResult = (u32)usbKbdIosResultMem; if (!usbKbdAsyncReady) { - if (IOS_IoctlAsync(usbKbdFd, USB_KBD_IOCTL_INIT_CALLBACK, NULL, 0, usbKbdIosResultMem, sizeof(usbKbdAsyncMem), usbKbdCallbackHandler, usbKbdIosResultMem) != IPC_RESULT_OK) { + if (IOS_IoctlAsync(usbKbdFd, USB_KBD_IOCTL_INIT_CALLBACK, NULL, 0, usbKbdIosResultMem, sizeof(usbKbdAsyncMem), usbKbdCallbackHandler, + usbKbdIosResultMem) != IPC_RESULT_OK) { return USB_KBD_ERR_FAIL_ASYNC_INIT; } usbKbdAsyncReady = TRUE; - } - else { + } else { return USB_KBD_ERR_OK; } @@ -129,8 +130,7 @@ USBKBDErr USBKBDRegisterEventCallback(USBKBDEventCallback cb) { if (usbKbdInitialized) { usbKbdEventCb = cb; return USB_KBD_ERR_OK; - } - else { + } else { return USB_KBD_ERR_NOT_INIT; } } diff --git a/libs/RVL_SDK/src/wenc/wenc.c b/libs/RVL_SDK/src/wenc/wenc.c index 2878672e..96d9f81b 100644 --- a/libs/RVL_SDK/src/wenc/wenc.c +++ b/libs/RVL_SDK/src/wenc/wenc.c @@ -1,23 +1,21 @@ #include -#include #include +#include typedef struct { - s32 nXN; // 0x00 - s32 nDL; // 0x04 - s32 nQN; // 0x08 - s32 nDN; // 0x0C - s32 nDLH; // 0x10 - s32 nDLQ; // 0x14 + s32 nXN; // 0x00 + s32 nDL; // 0x04 + s32 nQN; // 0x08 + s32 nDN; // 0x0C + s32 nDLH; // 0x10 + s32 nDLQ; // 0x14 u8 padding[8]; // 0x18 } WENCBlock; s32 WENCGetEncodeData(WENCInfo* info, u32 flag, const s16* pbyPcmData, s32 nSampleNum, u8* pbyAdpcmData) { - const f64 dTable[] = {0.89843750, 0.89843750, 0.89843750, 0.89843750, - 1.19921875, 1.59765625, - 2.00000000, 2.39843750}; + const f64 dTable[] = {0.89843750, 0.89843750, 0.89843750, 0.89843750, 1.19921875, 1.59765625, 2.00000000, 2.39843750}; u8 by; u8* pDst; @@ -55,8 +53,7 @@ s32 WENCGetEncodeData(WENCInfo* info, u32 flag, const s16* pbyPcmData, s32 nSamp nDN = 0; nDLH = 0; nDLQ = 0; - } - else { + } else { nXN = block->nXN; nDL = block->nDL; nQN = block->nQN; diff --git a/libs/RVL_SDK/src/wpad/WPAD.c b/libs/RVL_SDK/src/wpad/WPAD.c index 14baf443..4159ddf2 100644 --- a/libs/RVL_SDK/src/wpad/WPAD.c +++ b/libs/RVL_SDK/src/wpad/WPAD.c @@ -1,12 +1,12 @@ #include -#include #include +#include #include -#include #include +#include #include @@ -30,42 +30,42 @@ SDKDefineVersion(WPAD, "Apr 20 2010", "11:20:55"); -WPADCB _wpd[WPAD_MAX_CONTROLLERS]; +WPADCB _wpd[WPAD_MAX_CONTROLLERS]; WPADCB* _wpdcb[WPAD_MAX_CONTROLLERS]; -u8 __WPADiManageHandlerStack[0x1000] ALIGN32; +u8 __WPADiManageHandlerStack[0x1000] ALIGN32; -s8 _dev_handle_index[WUD_MAX_DEV_ENTRY]; +s8 _dev_handle_index[WUD_MAX_DEV_ENTRY]; OSAlarm _managerAlarm; -u8 _sleepTime; -u8 _dpdSensitivity; -u8 _sensorBarPos; -u32 _rumble; -u8 _speakerVolume; -u8 _scFlush; -u8 _gametype; +u8 _sleepTime; +u8 _dpdSensitivity; +u8 _sensorBarPos; +u32 _rumble; +u8 _speakerVolume; +u8 _scFlush; +u8 _gametype; const char* _gamecode; -u8 _chan_active_state[WPAD_MAX_CONTROLLERS]; +u8 _chan_active_state[WPAD_MAX_CONTROLLERS]; -static u8 _scSetting; -static u8 _shutdown; -static s8 _afhChannel; +static u8 _scSetting; +static u8 _shutdown; +static s8 _afhChannel; static BOOL _initialized; -static int _recFlag = -1; -static int _recCnt; +static int _recFlag = -1; +static int _recCnt; static BOOL _startup; -static u8 _rumbleCnt[WPAD_MAX_CONTROLLERS]; -static u8 _extCnt[WPAD_MAX_CONTROLLERS]; -static u16 _afhCnt; -static u8 _checkCnt; -static u16 _senseCnt; -static u8 _regShutdown; +static u8 _rumbleCnt[WPAD_MAX_CONTROLLERS]; +static u8 _extCnt[WPAD_MAX_CONTROLLERS]; +static u16 _afhCnt; +static u8 _checkCnt; +static u16 _senseCnt; +static u8 _regShutdown; -static u16 __WPAD_acc_diff_count_threshold = 6; -static u16 __WPAD_dpd_diff_count_threshold = 4; -static u16 __WPAD_acc_hyst_count_threshold = 30; -static u16 __WPAD_dpd_hyst_count_threshold = 30; +static u16 __WPAD_acc_diff_count_threshold = 6; +static u16 __WPAD_dpd_diff_count_threshold = 4; +static u16 __WPAD_acc_hyst_count_threshold = 30; +static u16 __WPAD_dpd_hyst_count_threshold = 30; static void WPADiConnCallback(WUDDevInfo* devInfo, u8 open); static void WPADiRecvCallback(UINT8 devHandle, UINT8* pReport, UINT16 len); @@ -109,8 +109,7 @@ static BOOL OnShutdown(BOOL final, u32 event) { if (WUDIsBusy()) { WUDStopSyncSimple(); result = FALSE; - } - else { + } else { switch (event) { case OS_SHUTDOWN_FATAL: { DEBUGPrint("Deregister allocators because of fatal error.\n"); @@ -125,8 +124,7 @@ static BOOL OnShutdown(BOOL final, u32 event) { case OS_SHUTDOWN_RETURN_MENU: { if (__OSIsReturnToIdle) { __WPADShutdown(); - } - else { + } else { __WPADReconnect(TRUE); } result = FALSE; @@ -145,19 +143,15 @@ static BOOL OnShutdown(BOOL final, u32 event) { } } } - } - else if (status == WUD_LIB_STATUS_5) { + } else if (status == WUD_LIB_STATUS_5) { WPADStopSimpleSync(); result = FALSE; - } - else if (status == WUD_LIB_STATUS_4 || status == WUD_LIB_STATUS_1 || status == WUD_LIB_STATUS_2) { + } else if (status == WUD_LIB_STATUS_4 || status == WUD_LIB_STATUS_1 || status == WUD_LIB_STATUS_2) { result = FALSE; - } - else if (status == WUD_LIB_STATUS_0) { + } else if (status == WUD_LIB_STATUS_0) { result = TRUE; } - } - else { + } else { result = TRUE; } @@ -184,12 +178,10 @@ static s32 WPADiSendData(s32 chan, WPADCommand command) { if (statusReqBusy) { status = WPAD_ERR_COMMUNICATION_ERROR; - } - else { + } else { __SendData(chan, command); } - } - else if (status != WPAD_ERR_COMMUNICATION_ERROR && status == WPAD_ERR_TRANSFER) { + } else if (status != WPAD_ERR_COMMUNICATION_ERROR && status == WPAD_ERR_TRANSFER) { enabled = OSDisableInterrupts(); p->status = WPAD_ERR_OK; OSRestoreInterrupts(enabled); @@ -200,8 +192,7 @@ static s32 WPADiSendData(s32 chan, WPADCommand command) { if (!p->unk_0x910) { p->lastReportSendTime = __OSGetSystemTime(); WPADiDisconnect(chan, FALSE); - } - else { + } else { enabled = OSDisableInterrupts(); p->status = WPAD_ERR_TRANSFER; OSRestoreInterrupts(enabled); @@ -214,7 +205,7 @@ static s32 WPADiSendData(s32 chan, WPADCommand command) { static void WPADiRadioSensitivity(s32 chan) { WPADCB* p = _wpdcb[chan]; - u32 two = 2; // some define? + u32 two = 2; // some define? u16 a; a = p->radioSensitivity * 9; @@ -229,8 +220,7 @@ static void WPADiRadioSensitivity(s32 chan) { if (a > 85) { p->radioQuality = WPAD_RADIO_QUALITY_GOOD; p->radioQualityOkMs = 0; - } - else if (a > 80) { + } else if (a > 80) { p->radioQualityOkMs++; if (p->radioQualityOkMs >= 20) { @@ -238,12 +228,10 @@ static void WPADiRadioSensitivity(s32 chan) { p->radioQualityOkMs = 0; } } - } - else if (a < 75) { + } else if (a < 75) { p->radioQuality = WPAD_RADIO_QUALITY_BAD; p->radioQualityOkMs = 0; - } - else if (a < 80) { + } else if (a < 80) { p->radioQualityOkMs++; if (p->radioQualityOkMs >= 1) { @@ -270,113 +258,94 @@ static BOOL IsControllerDataChanged(WPADCB* p, void* pLhs, void* pRhs) { u8 changed; int i; -#define CALC_ANALOG_NOISE_ACC(CHANGED) \ - if (CHANGED) { \ - p->filterDiffAcc++; \ - \ - if (p->filterDiffAcc > __WPAD_acc_diff_count_threshold) { \ - p->filterDiffAcc = 0; \ - p->filterSameAcc = 0; \ - changed |= TRUE; \ - } \ - \ - } \ - else { \ - p->filterSameAcc = \ - (p->filterSameAcc + 1) % __WPAD_acc_hyst_count_threshold; \ - \ - if (p->filterSameAcc == __WPAD_acc_hyst_count_threshold - 1 && \ - p->filterDiffAcc > 0) { \ - \ - p->filterDiffAcc--; \ - } \ +#define CALC_ANALOG_NOISE_ACC(CHANGED) \ + if (CHANGED) { \ + p->filterDiffAcc++; \ + \ + if (p->filterDiffAcc > __WPAD_acc_diff_count_threshold) { \ + p->filterDiffAcc = 0; \ + p->filterSameAcc = 0; \ + changed |= TRUE; \ + } \ + \ + } else { \ + p->filterSameAcc = (p->filterSameAcc + 1) % __WPAD_acc_hyst_count_threshold; \ + \ + if (p->filterSameAcc == __WPAD_acc_hyst_count_threshold - 1 && p->filterDiffAcc > 0) { \ + p->filterDiffAcc--; \ + } \ } -#define CALC_ANALOG_NOISE_DPD(CHANGED) \ - if (CHANGED) { \ - p->filterDiffDpd++; \ - \ - if (p->filterDiffDpd > __WPAD_dpd_diff_count_threshold) { \ - p->filterDiffDpd = 0; \ - changed |= TRUE; \ - } \ - \ - } \ - else { \ - p->filterSameDpd = \ - (p->filterSameDpd + 1) % __WPAD_dpd_hyst_count_threshold; \ - \ - if (p->filterSameDpd == __WPAD_dpd_hyst_count_threshold - 1 && \ - p->filterDiffDpd > 0) { \ - \ - p->filterDiffDpd--; \ - } \ +#define CALC_ANALOG_NOISE_DPD(CHANGED) \ + if (CHANGED) { \ + p->filterDiffDpd++; \ + \ + if (p->filterDiffDpd > __WPAD_dpd_diff_count_threshold) { \ + p->filterDiffDpd = 0; \ + changed |= TRUE; \ + } \ + \ + } else { \ + p->filterSameDpd = (p->filterSameDpd + 1) % __WPAD_dpd_hyst_count_threshold; \ + \ + if (p->filterSameDpd == __WPAD_dpd_hyst_count_threshold - 1 && p->filterDiffDpd > 0) { \ + p->filterDiffDpd--; \ + } \ } -#define CALC_ANALOG_NOISE_EXT(CHANGED) \ - if (CHANGED) { \ - p->filterDiffExt++; \ - \ - if (p->filterDiffExt > __WPAD_acc_diff_count_threshold) { \ - p->filterDiffExt = 0; \ - p->filterSameExt = 0; \ - changed |= TRUE; \ - } \ - \ - } \ - else { \ - p->filterSameExt = \ - (p->filterSameExt + 1) % __WPAD_acc_hyst_count_threshold; \ - \ - if (p->filterSameExt == __WPAD_acc_hyst_count_threshold - 1 && \ - p->filterDiffExt > 0) { \ - \ - p->filterDiffExt--; \ - } \ +#define CALC_ANALOG_NOISE_EXT(CHANGED) \ + if (CHANGED) { \ + p->filterDiffExt++; \ + \ + if (p->filterDiffExt > __WPAD_acc_diff_count_threshold) { \ + p->filterDiffExt = 0; \ + p->filterSameExt = 0; \ + changed |= TRUE; \ + } \ + \ + } else { \ + p->filterSameExt = (p->filterSameExt + 1) % __WPAD_acc_hyst_count_threshold; \ + \ + if (p->filterSameExt == __WPAD_acc_hyst_count_threshold - 1 && p->filterDiffExt > 0) { \ + p->filterDiffExt--; \ + } \ } if (p->dataFormat == WPAD_FMT_CORE_BTN || p->dataFormat == WPAD_FMT_CORE_BTN_ACC || p->dataFormat == WPAD_FMT_CORE_BTN_ACC_DPD) { changed = IsButtonChanged(pLhsCR->button, pRhsCR->button); if (pLhsCR->err == WPAD_ERR_OK && pRhsCR->err == WPAD_ERR_OK) { - CALC_ANALOG_NOISE_ACC(IsAnalogChanged(pLhsCR->accX, pRhsCR->accX, 12) | - IsAnalogChanged(pLhsCR->accY, pRhsCR->accY, 12) | - IsAnalogChanged(pLhsCR->accZ, pRhsCR->accZ, 12)); + CALC_ANALOG_NOISE_ACC(IsAnalogChanged(pLhsCR->accX, pRhsCR->accX, 12) | IsAnalogChanged(pLhsCR->accY, pRhsCR->accY, 12) | + IsAnalogChanged(pLhsCR->accZ, pRhsCR->accZ, 12)); for (i = 0; i < WPAD_MAX_DPD_OBJECTS; i++) { CALC_ANALOG_NOISE_DPD(IsAnalogChanged(pLhsCR->obj[i].x, pRhsCR->obj[i].x, 2) | - IsAnalogChanged(pLhsCR->obj[i].y, pRhsCR->obj[i].y, 2)); + IsAnalogChanged(pLhsCR->obj[i].y, pRhsCR->obj[i].y, 2)); } } - } - else if (p->dataFormat == WPAD_FMT_FS_BTN || p->dataFormat == WPAD_FMT_FS_BTN_ACC || p->dataFormat == WPAD_FMT_FS_BTN_ACC_DPD) { - + } else if (p->dataFormat == WPAD_FMT_FS_BTN || p->dataFormat == WPAD_FMT_FS_BTN_ACC || p->dataFormat == WPAD_FMT_FS_BTN_ACC_DPD) { WPADFSStatus* pLhsFS = (WPADFSStatus*)pLhs; WPADFSStatus* pRhsFS = (WPADFSStatus*)pRhs; changed = IsButtonChanged(pLhsFS->button, pRhsFS->button); if (pLhsFS->err == WPAD_ERR_OK && pRhsFS->err == WPAD_ERR_OK) { - CALC_ANALOG_NOISE_ACC(IsAnalogChanged(pLhsFS->accX, pRhsFS->accX, 12) | - IsAnalogChanged(pLhsFS->accY, pRhsFS->accY, 12) | - IsAnalogChanged(pLhsFS->accZ, pRhsFS->accZ, 12)); + CALC_ANALOG_NOISE_ACC(IsAnalogChanged(pLhsFS->accX, pRhsFS->accX, 12) | IsAnalogChanged(pLhsFS->accY, pRhsFS->accY, 12) | + IsAnalogChanged(pLhsFS->accZ, pRhsFS->accZ, 12)); for (i = 0; i < WPAD_MAX_DPD_OBJECTS; i++) { CALC_ANALOG_NOISE_DPD(IsAnalogChanged(pLhsFS->obj[i].x, pRhsFS->obj[i].x, 2) | - IsAnalogChanged(pLhsFS->obj[i].y, pRhsFS->obj[i].y, 2)); + IsAnalogChanged(pLhsFS->obj[i].y, pRhsFS->obj[i].y, 2)); } - CALC_ANALOG_NOISE_EXT(IsAnalogChanged(pLhsFS->fsAccX, pRhsFS->fsAccX, 12) | - IsAnalogChanged(pLhsFS->fsAccY, pRhsFS->fsAccY, 12) | - IsAnalogChanged(pLhsFS->fsAccZ, pRhsFS->fsAccZ, 12)); + CALC_ANALOG_NOISE_EXT(IsAnalogChanged(pLhsFS->fsAccX, pRhsFS->fsAccX, 12) | IsAnalogChanged(pLhsFS->fsAccY, pRhsFS->fsAccY, 12) | + IsAnalogChanged(pLhsFS->fsAccZ, pRhsFS->fsAccZ, 12)); changed |= IsAnalogChanged(pLhsFS->fsStickX, pRhsFS->fsStickX, 1); changed |= IsAnalogChanged(pLhsFS->fsStickY, pRhsFS->fsStickY, 1); } - } - else { + } else { if (p->dataFormat == WPAD_FMT_CLASSIC_BTN || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC_DPD) { - WPADCLStatus* pLhsCL = (WPADCLStatus*)pLhs; WPADCLStatus* pRhsCL = (WPADCLStatus*)pRhs; @@ -407,44 +376,35 @@ static BOOL IsControllerDataChanged(WPADCB* p, void* pLhs, void* pRhs) { changed = IsButtonChanged(pLhsCL->button, pRhsCL->button); if (pLhsCL->err == WPAD_ERR_OK && pRhsCL->err == WPAD_ERR_OK) { - CALC_ANALOG_NOISE_ACC(IsAnalogChanged(pLhsCL->accX, pRhsCL->accX, 12) | - IsAnalogChanged(pLhsCL->accY, pRhsCL->accY, 12) | - IsAnalogChanged(pLhsCL->accZ, pRhsCL->accZ, 12)); + CALC_ANALOG_NOISE_ACC(IsAnalogChanged(pLhsCL->accX, pRhsCL->accX, 12) | IsAnalogChanged(pLhsCL->accY, pRhsCL->accY, 12) | + IsAnalogChanged(pLhsCL->accZ, pRhsCL->accZ, 12)); for (i = 0; i < WPAD_MAX_DPD_OBJECTS; i++) { CALC_ANALOG_NOISE_DPD(IsAnalogChanged(pLhsCL->obj[i].x, pRhsCL->obj[i].x, 2) | - IsAnalogChanged(pLhsCL->obj[i].y, pRhsCL->obj[i].y, 2)); + IsAnalogChanged(pLhsCL->obj[i].y, pRhsCL->obj[i].y, 2)); } changed |= IsButtonChanged(pLhsCL->clButton, pRhsCL->clButton); - changed |= IsAnalogChanged(pLhsCL->clLStickX / leftStickDiv, - pRhsCL->clLStickX / leftStickDiv, 1); - changed |= IsAnalogChanged(pLhsCL->clLStickY / leftStickDiv, - pRhsCL->clLStickY / leftStickDiv, 1); + changed |= IsAnalogChanged(pLhsCL->clLStickX / leftStickDiv, pRhsCL->clLStickX / leftStickDiv, 1); + changed |= IsAnalogChanged(pLhsCL->clLStickY / leftStickDiv, pRhsCL->clLStickY / leftStickDiv, 1); - changed |= IsAnalogChanged(pLhsCL->clRStickX / rightStickDiv, - pRhsCL->clRStickX / rightStickDiv, 1); - changed |= IsAnalogChanged(pLhsCL->clRStickY / rightStickDiv, - pRhsCL->clRStickY / rightStickDiv, 1); + changed |= IsAnalogChanged(pLhsCL->clRStickX / rightStickDiv, pRhsCL->clRStickX / rightStickDiv, 1); + changed |= IsAnalogChanged(pLhsCL->clRStickY / rightStickDiv, pRhsCL->clRStickY / rightStickDiv, 1); - changed |= IsAnalogChanged(pLhsCL->clTriggerL / triggerDiv, - pRhsCL->clTriggerL / triggerDiv, 1); - changed |= IsAnalogChanged(pLhsCL->clTriggerR / triggerDiv, - pRhsCL->clTriggerR / triggerDiv, 1); + changed |= IsAnalogChanged(pLhsCL->clTriggerL / triggerDiv, pRhsCL->clTriggerL / triggerDiv, 1); + changed |= IsAnalogChanged(pLhsCL->clTriggerR / triggerDiv, pRhsCL->clTriggerR / triggerDiv, 1); } - } - else { + } else { changed = IsButtonChanged(pLhsCR->button, pRhsCR->button); if (pLhsCR->err == WPAD_ERR_OK && pRhsCR->err == WPAD_ERR_OK) { - CALC_ANALOG_NOISE_ACC(IsAnalogChanged(pLhsCR->accX, pRhsCR->accX, 12) | - IsAnalogChanged(pLhsCR->accY, pRhsCR->accY, 12) | - IsAnalogChanged(pLhsCR->accZ, pRhsCR->accZ, 12)); + CALC_ANALOG_NOISE_ACC(IsAnalogChanged(pLhsCR->accX, pRhsCR->accX, 12) | IsAnalogChanged(pLhsCR->accY, pRhsCR->accY, 12) | + IsAnalogChanged(pLhsCR->accZ, pRhsCR->accZ, 12)); for (i = 0; i < WPAD_MAX_DPD_OBJECTS; i++) { CALC_ANALOG_NOISE_DPD(IsAnalogChanged(pLhsCR->obj[i].x, pRhsCR->obj[i].x, 2) | - IsAnalogChanged(pLhsCR->obj[i].y, pRhsCR->obj[i].y, 2)); + IsAnalogChanged(pLhsCR->obj[i].y, pRhsCR->obj[i].y, 2)); } } } @@ -468,12 +428,10 @@ static void CheckButtonCombination(s32 chan) { if ((p->dataFormat == WPAD_FMT_FS_BTN || p->dataFormat == WPAD_FMT_FS_BTN_ACC || p->dataFormat == WPAD_FMT_FS_BTN_ACC_DPD) && (pStatus->button == (WPAD_BUTTON_A | WPAD_BUTTON_B | WPAD_BUTTON_PLUS | WPAD_BUTTON_MINUS))) { - pressed = 1; } if ((p->dataFormat == WPAD_FMT_CLASSIC_BTN || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC_DPD)) { - WPADCLStatus* pStatusCL = (WPADCLStatus*)pStatus; if (pStatus->button == (WPAD_BUTTON_A | WPAD_BUTTON_B | WPAD_BUTTON_PLUS | WPAD_BUTTON_MINUS)) { @@ -482,16 +440,14 @@ static void CheckButtonCombination(s32 chan) { if (pStatus->err != WPAD_ERR_OK) { pressed = 0; - } - else if (pStatusCL->clButton == (WPAD_BUTTON_CL_A | WPAD_BUTTON_CL_B | WPAD_BUTTON_CL_PLUS | WPAD_BUTTON_CL_MINUS)) { + } else if (pStatusCL->clButton == (WPAD_BUTTON_CL_A | WPAD_BUTTON_CL_B | WPAD_BUTTON_CL_PLUS | WPAD_BUTTON_CL_MINUS)) { pressed = 1; } } if (pressed < 0) { p->comboHeld = 0; - } - else { + } else { p->comboHeld += pressed; } @@ -537,8 +493,7 @@ static void WPADiCheckContInputs(s32 chan) { if (changed) { screenSaver = TRUE; p->lastControllerDataUpdate = __OSGetSystemTime(); - } - else if (_sleepTime != 0) { + } else if (_sleepTime != 0) { s32 time = OSTicksToSeconds(__OSGetSystemTime() - p->lastControllerDataUpdate); if (time > _sleepTime * 60) { WPADiDisconnect(chan, TRUE); @@ -555,7 +510,6 @@ static BOOL WPADiProcessExtCommand(s32 chan) { if (p->used) { if (WPADiGetCommand(&p->extCmdQueue, &command)) { if (command.reportID == RPTID_SET_DATA_REPORT_MODE || p->wpInfo.attach) { - if (WPADiSendData(chan, command) == WPAD_ERR_OK) { WPADiPopCommand(&p->extCmdQueue); return TRUE; @@ -573,7 +527,6 @@ static BOOL WPADiProcessCommand(s32 chan, BOOL prevSuccess) { if (p->used) { if (WPADiGetCommand(&p->stdCmdQueue, &command) && WPADiSendData(chan, command) == WPAD_ERR_OK) { - WPADiPopCommand(&p->stdCmdQueue); return TRUE; } @@ -632,15 +585,13 @@ static void WPADiAfh() { } } - static void WPADiRumbleMotor(s32 chan, BOOL prevSuccess) { WPADCommand command; if (prevSuccess == TRUE || __GetCmdNumber(&_wpdcb[chan]->stdCmdQueue) > 0) { _wpdcb[chan]->motorBusy = FALSE; - } - else if (_rumbleCnt[chan] == 5) { + } else if (_rumbleCnt[chan] == 5) { _wpdcb[chan]->motorBusy = FALSE; command.reportID = RPTID_SET_RUMBLE; @@ -675,7 +626,7 @@ static void WPADiManageHandler(OSAlarm* pAlarm, OSContext* pContext) { WUDSetHidConnCallback(WPADiConnCallback); WUDSetHidRecvCallback(WPADiRecvCallback); - + _recCnt = 50; } @@ -732,9 +683,7 @@ static void WPADiManageHandler(OSAlarm* pAlarm, OSContext* pContext) { } static void WPADiManageHandler0(OSAlarm* pAlarm, OSContext* pContext) { - OSSwitchFiberEx((u32)pAlarm, (u32)pContext, 0, 0, WPADiManageHandler, - __WPADiManageHandlerStack + - sizeof(__WPADiManageHandlerStack)); + OSSwitchFiberEx((u32)pAlarm, (u32)pContext, 0, 0, WPADiManageHandler, __WPADiManageHandlerStack + sizeof(__WPADiManageHandlerStack)); } static void __ClearControlBlock(s32 chan) { @@ -914,8 +863,7 @@ void __WPADShutdown() { WUDSetVisibility(FALSE, FALSE); - for (i = WUD_MAX_DEV_ENTRY_FOR_STD + WPAD_CHAN0; - i < WUD_MAX_DEV_ENTRY_FOR_STD + WPAD_MAX_CONTROLLERS; i++) { + for (i = WUD_MAX_DEV_ENTRY_FOR_STD + WPAD_CHAN0; i < WUD_MAX_DEV_ENTRY_FOR_STD + WPAD_MAX_CONTROLLERS; i++) { memset(&_scArray.devices[i], 0, sizeof(SCBtDeviceInfo)); } @@ -1000,8 +948,7 @@ void WPADGetAddress(s32 chan, BD_ADDR_PTR pAddr) { if (pDevAddr != NULL) { WUD_BDCPY(pAddr, pDevAddr); - } - else { + } else { memset(pAddr, 0, BD_ADDR_LEN); } } @@ -1026,8 +973,7 @@ static void setupCallback(s32 chan, s32 status) { if (p->connectCB != NULL) { p->connectCB(chan, status); } - } - else { + } else { WPADiDisconnect(chan, FALSE); } } @@ -1068,8 +1014,7 @@ static void firmwareCheckCallback(s32 chan, s32 status) { DEBUGPrint(" ==>this error means that the firmware is for NDEV %s\n", p->configIndex != 0 ? "2.0" : "2.1 or later"); - WPADiSendSetReportType(&p->stdCmdQueue, WPAD_FMT_CORE_BTN, p->unk_0x98E, - &abortConnCallback); + WPADiSendSetReportType(&p->stdCmdQueue, WPAD_FMT_CORE_BTN, p->unk_0x98E, &abortConnCallback); WPADiSendDPDCSB(&p->stdCmdQueue, FALSE, &abortConnCallback); WPADiSendSetPort(&p->stdCmdQueue, port, &abortConnCallback); @@ -1135,8 +1080,7 @@ static void WPADiConnCallback(WUDDevInfo* devInfo, u8 open) { if (WUD_DEV_NAME_IS_CNT(devInfo->conf.devName)) { p->devType = WPAD_DEV_CORE; - } - else { + } else { p->devType = WPAD_DEV_FUTURE; } p->devHandle = devHandle; @@ -1150,8 +1094,7 @@ static void WPADiConnCallback(WUDDevInfo* devInfo, u8 open) { WPADiSendReadData(&p->stdCmdQueue, p->wmReadDataBuf, 1, WM_ADDR_MEM_1770, firmwareCheckCallback); __SetScreenSaverFlag(TRUE); - } - else { + } else { DEBUGPrint("connection is closed\n"); chan = _dev_handle_index[devHandle]; @@ -1163,8 +1106,7 @@ static void WPADiConnCallback(WUDDevInfo* devInfo, u8 open) { if (p->cmdBlkCB != NULL) { p->cmdBlkCB(chan, WPAD_ERR_NO_CONTROLLER); - } - else if (_wmb[chan].unk_0x10 != NULL) { + } else if (_wmb[chan].unk_0x10 != NULL) { _wmb[chan].unk_0x10(chan, WPAD_ERR_NO_CONTROLLER); } @@ -1192,8 +1134,7 @@ static void WPADiConnCallback(WUDDevInfo* devInfo, u8 open) { if (p->connectCB != NULL) { p->connectCB(chan, WPAD_ERR_NO_CONTROLLER); } - } - else { + } else { DEBUGPrint("WARNING: disconnection for device handle not assigned to channel.\n"); } } @@ -1210,8 +1151,7 @@ static void WPADiRecvCallback(UINT8 devHandle, UINT8* pReport, UINT16 len) { if (result != 0) { DEBUGPrint("HID Parser reports: %d\n", result); } - } - else { + } else { DEBUGPrint("WPADiRecvCallback(): Unknown channel %d\n", port); } } @@ -1280,8 +1220,7 @@ static void WPADiDisconnect(s32 chan, BOOL sleep) { OSRestoreInterrupts(enabled); WPADControlLed(chan, 0, DisconnectCallback); - } - else { + } else { BD_ADDR addr; WPADGetAddress(chan, addr); @@ -1315,8 +1254,7 @@ s32 WPADProbe(s32 chan, u32* pDevType) { if (status != WPAD_ERR_NO_CONTROLLER) { if (p->devType == WPAD_DEV_NOT_FOUND) { status = WPAD_ERR_NO_CONTROLLER; - } - else if (!p->handshakeFinished) { + } else if (!p->handshakeFinished) { status = WPAD_ERR_COMMUNICATION_ERROR; } } @@ -1413,16 +1351,14 @@ s32 WPADSetDataFormat(s32 chan, u32 format) { if (currFormat != format) { if (!WPADiSendSetReportType(&p->stdCmdQueue, format, p->unk_0x98E, NULL)) { status = WPAD_ERR_COMMUNICATION_ERROR; - } - else { + } else { enabled = OSDisableInterrupts(); p->dataFormat = format; OSRestoreInterrupts(enabled); status = WPAD_ERR_OK; } - } - else { + } else { status = WPAD_ERR_OK; } @@ -1509,8 +1445,7 @@ void WPADControlMotor(s32 chan, u32 command) { return; } - if (command == WPAD_MOTOR_STOP && p->motorRunning == FALSE || - command == WPAD_MOTOR_RUMBLE && p->motorRunning == TRUE) { + if (command == WPAD_MOTOR_STOP && p->motorRunning == FALSE || command == WPAD_MOTOR_RUMBLE && p->motorRunning == TRUE) { OSRestoreInterrupts(enabled); return; } @@ -1552,8 +1487,7 @@ s32 WPADControlLed(s32 chan, u8 flags, WPADCallback pCallback) { if (status != WPAD_ERR_NO_CONTROLLER) { if (!handshake) { status = WPAD_ERR_COMMUNICATION_ERROR; - } - else { + } else { success = WPADiSendSetPort(&p->stdCmdQueue, flags, pCallback); status = success ? 0 : WPAD_ERR_COMMUNICATION_ERROR; } @@ -1586,8 +1520,7 @@ BOOL WPADSaveConfig(WPADSaveCallback pCallback) { if (success) { SCFlushAsync(pCallback); - } - else if (pCallback != NULL) { + } else if (pCallback != NULL) { pCallback(SC_STATUS_FATAL); } @@ -1606,16 +1539,14 @@ void WPADRead(s32 chan, WPADStatus* pStatus) { if (p->dataFormat == WPAD_FMT_CORE_BTN || p->dataFormat == WPAD_FMT_CORE_BTN_ACC || p->dataFormat == WPAD_FMT_CORE_BTN_ACC_DPD) { memcpy(pStatus, pRxStatus, sizeof(WPADStatus)); - } - else if (p->dataFormat == WPAD_FMT_FS_BTN || p->dataFormat == WPAD_FMT_FS_BTN_ACC || p->dataFormat == WPAD_FMT_FS_BTN_ACC_DPD) { + } else if (p->dataFormat == WPAD_FMT_FS_BTN || p->dataFormat == WPAD_FMT_FS_BTN_ACC || p->dataFormat == WPAD_FMT_FS_BTN_ACC_DPD) { memcpy(pStatus, pRxStatus, sizeof(WPADFSStatus)); - } - else if (p->dataFormat == WPAD_FMT_CLASSIC_BTN || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC_DPD) { + } else if (p->dataFormat == WPAD_FMT_CLASSIC_BTN || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC || + p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC_DPD) { memcpy(pStatus, pRxStatus, sizeof(WPADCLStatus)); - } - else { + } else { memcpy(pStatus, pRxStatus, sizeof(WPADStatusEx)); } @@ -1629,15 +1560,13 @@ void WPADRead(s32 chan, WPADStatus* pStatus) { default: { if (p->dataFormat == WPAD_FMT_CORE_BTN || p->dataFormat == WPAD_FMT_CORE_BTN_ACC || p->dataFormat == WPAD_FMT_CORE_BTN_ACC_DPD) { memset(pStatus, 0, sizeof(WPADStatus)); - } - else if (p->dataFormat == WPAD_FMT_FS_BTN || p->dataFormat == WPAD_FMT_FS_BTN_ACC || p->dataFormat == WPAD_FMT_FS_BTN_ACC_DPD) { + } else if (p->dataFormat == WPAD_FMT_FS_BTN || p->dataFormat == WPAD_FMT_FS_BTN_ACC || p->dataFormat == WPAD_FMT_FS_BTN_ACC_DPD) { memset(pStatus, 0, sizeof(WPADFSStatus)); - } - else if (p->dataFormat == WPAD_FMT_CLASSIC_BTN || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC_DPD) { + } else if (p->dataFormat == WPAD_FMT_CLASSIC_BTN || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC || + p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC_DPD) { memset(pStatus, 0, sizeof(WPADCLStatus)); - } - else { + } else { memset(pStatus, 0, sizeof(WPADStatusEx)); } @@ -1665,14 +1594,11 @@ void WPADSetAutoSamplingBuf(s32 chan, void* pBuffer, u32 len) { if (p->dataFormat == WPAD_FMT_CORE_BTN || p->dataFormat == WPAD_FMT_CORE_BTN_ACC || p->dataFormat == WPAD_FMT_CORE_BTN_ACC_DPD) { fmtSize = sizeof(WPADStatus); - } - else if (p->dataFormat == WPAD_FMT_FS_BTN || p->dataFormat == WPAD_FMT_FS_BTN_ACC || p->dataFormat == WPAD_FMT_FS_BTN_ACC_DPD) { + } else if (p->dataFormat == WPAD_FMT_FS_BTN || p->dataFormat == WPAD_FMT_FS_BTN_ACC || p->dataFormat == WPAD_FMT_FS_BTN_ACC_DPD) { fmtSize = sizeof(WPADFSStatus); - } - else if (p->dataFormat == WPAD_FMT_CLASSIC_BTN || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC_DPD) { + } else if (p->dataFormat == WPAD_FMT_CLASSIC_BTN || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC_DPD) { fmtSize = sizeof(WPADCLStatus); - } - else { + } else { fmtSize = sizeof(WPADStatusEx); } @@ -1755,14 +1681,12 @@ void WPADiCopyOut(s32 chan) { if (p->dataFormat == WPAD_FMT_CORE_BTN || p->dataFormat == WPAD_FMT_CORE_BTN_ACC || p->dataFormat == WPAD_FMT_CORE_BTN_ACC_DPD) { memcpy(&p->samplingBuf[p->samplingBufIndex], pStatus, sizeof(WPADStatus)); - } - else if (p->dataFormat == WPAD_FMT_FS_BTN || p->dataFormat == WPAD_FMT_FS_BTN_ACC || p->dataFormat == WPAD_FMT_FS_BTN_ACC_DPD) { + } else if (p->dataFormat == WPAD_FMT_FS_BTN || p->dataFormat == WPAD_FMT_FS_BTN_ACC || p->dataFormat == WPAD_FMT_FS_BTN_ACC_DPD) { memcpy(&p->samplingBufFS[p->samplingBufIndex], pStatus, !pStatus->err ? sizeof(WPADFSStatus) : sizeof(WPADStatus)); - } - else if (p->dataFormat == WPAD_FMT_CLASSIC_BTN || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC_DPD) { + } else if (p->dataFormat == WPAD_FMT_CLASSIC_BTN || p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC || + p->dataFormat == WPAD_FMT_CLASSIC_BTN_ACC_DPD) { memcpy(&p->samplingBufCL[p->samplingBufIndex], pStatus, !pStatus->err ? sizeof(WPADCLStatus) : sizeof(WPADStatus)); - } - else { + } else { memcpy(&p->samplingBufEx[p->samplingBufIndex], pStatus, !pStatus->err ? sizeof(WPADStatusEx) : sizeof(WPADStatus)); } } @@ -1792,11 +1716,14 @@ s32 WPADControlSpeaker(s32 chan, u32 command, WPADCallback pCallback) { BOOL handshake; s32 status; - u8 config[SPK_CONFIG_SIZE] = {0x00, - 0x00, // 4-bit ADPCM - 0xD0, 0x07, // 3000Hz (little-endian) - WPAD_MAX_SPEAKER_VOLUME / 2 + 1, // Default volume - 0x0C, 0x0E // ??? + u8 config[SPK_CONFIG_SIZE] = { + 0x00, + 0x00, // 4-bit ADPCM + 0xD0, + 0x07, // 3000Hz (little-endian) + WPAD_MAX_SPEAKER_VOLUME / 2 + 1, // Default volume + 0x0C, + 0x0E // ??? }; p = _wpdcb[chan]; @@ -1821,8 +1748,7 @@ s32 WPADControlSpeaker(s32 chan, u32 command, WPADCallback pCallback) { if (command == WPAD_SPEAKER_OFF) { if (!spkEnable) { status = WPAD_ERR_OK; - } - else { + } else { enabled = OSDisableInterrupts(); if (__CanPushCmdQueue(&p->stdCmdQueue, 5)) { @@ -1842,70 +1768,64 @@ s32 WPADControlSpeaker(s32 chan, u32 command, WPADCallback pCallback) { status = WPAD_ERR_COMMUNICATION_ERROR; OSRestoreInterrupts(enabled); } - } - else { + } else { switch (command) { - case WPAD_SPEAKER_ON: - case WPAD_SPEAKER_UNK5: { - enabled = OSDisableInterrupts(); + case WPAD_SPEAKER_ON: + case WPAD_SPEAKER_UNK5: { + enabled = OSDisableInterrupts(); - if (__CanPushCmdQueue(&p->stdCmdQueue, 7)) { - WPADiSendEnableSpeaker(&p->stdCmdQueue, TRUE, NULL); - WPADiSendMuteSpeaker(&p->stdCmdQueue, TRUE, NULL); + if (__CanPushCmdQueue(&p->stdCmdQueue, 7)) { + WPADiSendEnableSpeaker(&p->stdCmdQueue, TRUE, NULL); + WPADiSendMuteSpeaker(&p->stdCmdQueue, TRUE, NULL); - WPADiSendWriteDataCmd(&p->stdCmdQueue, 0x01, WM_REG_SPEAKER_09, - NULL); - // Sends 0x80 instead of 0x08? - WPADiSendWriteDataCmd(&p->stdCmdQueue, 0x80, WM_REG_SPEAKER_01, - NULL); + WPADiSendWriteDataCmd(&p->stdCmdQueue, 0x01, WM_REG_SPEAKER_09, NULL); + // Sends 0x80 instead of 0x08? + WPADiSendWriteDataCmd(&p->stdCmdQueue, 0x80, WM_REG_SPEAKER_01, NULL); - config[4] = _speakerVolume; + config[4] = _speakerVolume; - WPADiSendWriteData(&p->stdCmdQueue, &config, SPK_CONFIG_SIZE, - WM_REG_SPEAKER_01, NULL); + WPADiSendWriteData(&p->stdCmdQueue, &config, SPK_CONFIG_SIZE, WM_REG_SPEAKER_01, NULL); - WPADiSendMuteSpeaker(&p->stdCmdQueue, FALSE, NULL); + WPADiSendMuteSpeaker(&p->stdCmdQueue, FALSE, NULL); - WPADiSendGetContStat(&p->stdCmdQueue, NULL, pCallback); + WPADiSendGetContStat(&p->stdCmdQueue, NULL, pCallback); + + OSRestoreInterrupts(enabled); + return WPAD_ERR_OK; + } + + status = WPAD_ERR_COMMUNICATION_ERROR; OSRestoreInterrupts(enabled); + break; + } + + case WPAD_SPEAKER_MUTE: { + if (!WPADiSendMuteSpeaker(&p->stdCmdQueue, TRUE, pCallback)) { + status = WPAD_ERR_COMMUNICATION_ERROR; + break; + } + return WPAD_ERR_OK; } - status = WPAD_ERR_COMMUNICATION_ERROR; + case WPAD_SPEAKER_UNMUTE: { + if (!WPADiSendMuteSpeaker(&p->stdCmdQueue, FALSE, pCallback)) { + status = WPAD_ERR_COMMUNICATION_ERROR; + break; + } - OSRestoreInterrupts(enabled); - break; - } - - case WPAD_SPEAKER_MUTE: { - if (!WPADiSendMuteSpeaker(&p->stdCmdQueue, TRUE, pCallback)) { - status = WPAD_ERR_COMMUNICATION_ERROR; - break; + return WPAD_ERR_OK; } - return WPAD_ERR_OK; - } + case WPAD_SPEAKER_PLAY: { + if (!WPADiSendWriteDataCmd(&p->stdCmdQueue, 0x01, WM_REG_SPEAKER_08, pCallback)) { + status = WPAD_ERR_COMMUNICATION_ERROR; + break; + } - case WPAD_SPEAKER_UNMUTE: { - if (!WPADiSendMuteSpeaker(&p->stdCmdQueue, FALSE, pCallback)) { - status = WPAD_ERR_COMMUNICATION_ERROR; - break; + return WPAD_ERR_OK; } - - return WPAD_ERR_OK; - } - - case WPAD_SPEAKER_PLAY: { - if (!WPADiSendWriteDataCmd(&p->stdCmdQueue, 0x01, WM_REG_SPEAKER_08, - pCallback)) { - - status = WPAD_ERR_COMMUNICATION_ERROR; - break; - } - - return WPAD_ERR_OK; - } } } @@ -1960,10 +1880,8 @@ static BOOL IsBusyStream(s32 chan) { OSRestoreInterrupts(enabled); - if (radioQuality != WPAD_RADIO_QUALITY_GOOD || btmBufferStatus > 3 || - bufferStatus == 10 || bufferStatus >= linkNumber * 2 + 2 || + if (radioQuality != WPAD_RADIO_QUALITY_GOOD || btmBufferStatus > 3 || bufferStatus == 10 || bufferStatus >= linkNumber * 2 + 2 || devType == WPAD_DEV_UNKNOWN || queueSize >= 21 || audioFrames >= 1) { - return TRUE; } else { return FALSE; @@ -1982,7 +1900,6 @@ BOOL WPADCanSendStreamData(s32 chan) { OSRestoreInterrupts(enabled); if (status == WPAD_ERR_NO_CONTROLLER || !handshake || IsBusyStream(chan)) { - return FALSE; } else { return TRUE; @@ -2081,21 +1998,13 @@ s32 WPADControlDpd(s32 chan, u32 command, WPADCallback pCallback) { u8 pendingCmd; s32 status; - static const u8 cfg1[WPAD_MAX_DPD_SENS][DPD_CONFIG1_SIZE] = { - {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0x64, 0x00, 254}, - {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0x96, 0x00, 180}, - {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0xAA, 0x00, 100}, - {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0xC8, 0x00, 54}, - {0x07, 0x00, 0x00, 0x71, 0x01, 0x00, 0x72, 0x00, 32} - }; + static const u8 cfg1[WPAD_MAX_DPD_SENS][DPD_CONFIG1_SIZE] = {{0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0x64, 0x00, 254}, + {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0x96, 0x00, 180}, + {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0xAA, 0x00, 100}, + {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0xC8, 0x00, 54}, + {0x07, 0x00, 0x00, 0x71, 0x01, 0x00, 0x72, 0x00, 32}}; - static const u8 cfg2[WPAD_MAX_DPD_SENS][DPD_CONFIG2_SIZE] = { - {0xFD, 0x05}, - {0xB3, 0x04}, - {0x63, 0x03}, - {0x35, 0x03}, - {0x1F, 0x03} - }; + static const u8 cfg2[WPAD_MAX_DPD_SENS][DPD_CONFIG2_SIZE] = {{0xFD, 0x05}, {0xB3, 0x04}, {0x63, 0x03}, {0x35, 0x03}, {0x1F, 0x03}}; enabled = OSDisableInterrupts(); @@ -2149,18 +2058,12 @@ s32 WPADControlDpd(s32 chan, u32 command, WPADCallback pCallback) { WPADiSendWriteDataCmd(&p->stdCmdQueue, 0x01, WM_REG_DPD_30, NULL); - WPADiSendWriteData(&p->stdCmdQueue, cfg1[_dpdSensitivity - 1], - DPD_CONFIG1_SIZE, WM_REG_DPD_CONFIG_BLOCK_1, - NULL); + WPADiSendWriteData(&p->stdCmdQueue, cfg1[_dpdSensitivity - 1], DPD_CONFIG1_SIZE, WM_REG_DPD_CONFIG_BLOCK_1, NULL); - WPADiSendWriteData(&p->stdCmdQueue, cfg2[_dpdSensitivity - 1], - DPD_CONFIG2_SIZE, WM_REG_DPD_CONFIG_BLOCK_2, - NULL); + WPADiSendWriteData(&p->stdCmdQueue, cfg2[_dpdSensitivity - 1], DPD_CONFIG2_SIZE, WM_REG_DPD_CONFIG_BLOCK_2, NULL); - WPADiSendWriteDataCmd(&p->stdCmdQueue, command, - WM_REG_DPD_DATA_FORMAT, NULL); - WPADiSendWriteDataCmd(&p->stdCmdQueue, 0x08, WM_REG_DPD_30, - &__dpdCb); + WPADiSendWriteDataCmd(&p->stdCmdQueue, command, WM_REG_DPD_DATA_FORMAT, NULL); + WPADiSendWriteDataCmd(&p->stdCmdQueue, 0x08, WM_REG_DPD_30, &__dpdCb); WPADiSendGetContStat(&p->stdCmdQueue, NULL, pCallback); @@ -2248,7 +2151,7 @@ static void __SendData(s32 chan, WPADCommand command) { p->statusReqBusy = TRUE; break; } - case 0xFF: { // wat + case 0xFF: { // wat u32 time; memcpy(&time, command.dataBuf, sizeof(u32)); p->lastReportSendTime = __OSGetSystemTime() + time; @@ -2281,8 +2184,7 @@ static void __SendData(s32 chan, WPADCommand command) { if (rumble) { pRptData[RPT_OUT_FLAGS] |= (1 << RPT_OUT_FLAG_RUMBLE); - } - else { + } else { pRptData[RPT_OUT_FLAGS] &= ~(1 << RPT_OUT_FLAG_RUMBLE); } @@ -2308,7 +2210,7 @@ BOOL WPADiSendSetReportType(WPADCommandQueue* pQueue, s32 format, BOOL unk, WPAD command.reportID = RPTID_SET_DATA_REPORT_MODE; command.dataLength = RPT12_SIZE; - command.dataBuf[RPT12_CONT_REPORT] = unk ? 0 : 4; // Always continuous reporting + command.dataBuf[RPT12_CONT_REPORT] = unk ? 0 : 4; // Always continuous reporting command.cmdCB = pCallback; switch (format) { @@ -2481,8 +2383,7 @@ BOOL __CanPushCmdQueue(const WPADCommandQueue* pQueue, s8 num) { if ((u32)(queueSize + num) <= pQueue->capacity - 1) { return TRUE; - } - else { + } else { return FALSE; } } diff --git a/libs/RVL_SDK/src/wpad/WPADEncrypt.c b/libs/RVL_SDK/src/wpad/WPADEncrypt.c index 9231393e..5eb08279 100644 --- a/libs/RVL_SDK/src/wpad/WPADEncrypt.c +++ b/libs/RVL_SDK/src/wpad/WPADEncrypt.c @@ -1,802 +1,211 @@ -#include #include +#include + #include -static u8 base[] = { - 0xa8, 0x77, 0xa6, 0xe0, 0xf7, 0x43, - 0x5a, 0x35, 0x85, 0xe2, 0x72, 0x97, - 0x8f, 0xb7, 0x1a, 0x62, 0x87, 0x38, - 0x0d, 0x67, 0xc7, 0xbe, 0x4f, 0x3e, - 0x20, 0x76, 0x37, 0x8f, 0x68, 0xb7, - 0xa9, 0x26, 0x3f, 0x2b, 0x10, 0xe3, - 0x30, 0x7e, 0x90, 0x0e, 0x85, 0x0a -}; +static u8 base[] = {0xa8, 0x77, 0xa6, 0xe0, 0xf7, 0x43, 0x5a, 0x35, 0x85, 0xe2, 0x72, 0x97, 0x8f, 0xb7, 0x1a, 0x62, 0x87, 0x38, 0x0d, 0x67, 0xc7, + 0xbe, 0x4f, 0x3e, 0x20, 0x76, 0x37, 0x8f, 0x68, 0xb7, 0xa9, 0x26, 0x3f, 0x2b, 0x10, 0xe3, 0x30, 0x7e, 0x90, 0x0e, 0x85, 0x0a}; static u8 tb[] = { - 0x70, 0x51, 0x03, 0x86, 0x40, 0x0d, - 0x4f, 0xeb, 0x3e, 0xcc, 0xd1, 0x87, - 0x35, 0xbd, 0xf5, 0x0b, 0x5e, 0xd0, - 0xf8, 0xf2, 0xd5, 0xe2, 0x6c, 0x31, - 0x0c, 0xad, 0xfc, 0x21, 0xc3, 0x78, - 0xc1, 0x06, 0xc2, 0x4c, 0x55, 0xe6, - 0x4a, 0x34, 0x48, 0x11, 0x1e, 0xda, - 0xe7, 0x1a, 0x84, 0xa0, 0x96, 0xa7, - 0xe3, 0x7f, 0xaf, 0x63, 0x9c, 0xfa, - 0x23, 0x5b, 0x79, 0xc8, 0x9e, 0xba, - 0xb2, 0xc9, 0x22, 0x12, 0x4b, 0xb3, - 0xa1, 0xb6, 0x32, 0x49, 0xa2, 0xe1, - 0x89, 0x39, 0x10, 0x66, 0xc5, 0x07, - 0x8f, 0x54, 0xea, 0x91, 0xca, 0x3f, - 0xf9, 0x19, 0xf0, 0xd7, 0x46, 0xbc, - 0x28, 0x1b, 0x61, 0xe8, 0x2f, 0x6a, - 0xae, 0x9d, 0xf6, 0x4e, 0x09, 0x14, - 0x77, 0x4d, 0xdb, 0x1f, 0x2e, 0x7b, - 0x7c, 0xf1, 0x43, 0xa3, 0x00, 0xb8, - 0x13, 0x8c, 0x85, 0xb9, 0x29, 0x75, - 0x88, 0xfd, 0xd2, 0x56, 0x1c, 0x50, - 0x97, 0x41, 0xe5, 0x3b, 0x60, 0xb5, - 0xc0, 0x64, 0xee, 0x98, 0xd6, 0x2d, - 0x25, 0xa4, 0xaa, 0xcd, 0x7d, 0xa8, - 0x83, 0xc6, 0xab, 0xbe, 0x44, 0x99, - 0x26, 0x3c, 0xce, 0x9f, 0xbf, 0xd3, - 0xcb, 0x76, 0x7a, 0x7e, 0x82, 0x01, - 0x8a, 0x9a, 0x80, 0x1d, 0x0e, 0xb0, - 0x5c, 0xd4, 0x38, 0x62, 0xf4, 0x30, - 0xe0, 0x8e, 0x53, 0xb7, 0x02, 0x57, - 0xac, 0xa6, 0x52, 0x0a, 0x6d, 0x92, - 0x65, 0x17, 0x24, 0x33, 0x45, 0x72, - 0x74, 0xb1, 0xb4, 0xf7, 0x5d, 0xed, - 0x2c, 0xff, 0x47, 0x37, 0x5a, 0x90, - 0xbb, 0xdf, 0x2a, 0x16, 0x59, 0x95, - 0xd9, 0xc4, 0x27, 0x67, 0x73, 0xc7, - 0x68, 0xfe, 0xa5, 0xdd, 0x6b, 0x5f, - 0x93, 0xd8, 0xec, 0x05, 0x3a, 0x8d, - 0x6e, 0xfb, 0x3d, 0xa9, 0x69, 0x36, - 0xf3, 0x94, 0xde, 0xef, 0x15, 0x6f, - 0x8b, 0x9b, 0x08, 0x0f, 0xdc, 0x81, - 0x18, 0x20, 0x04, 0xe4, 0x71, 0xcf, - 0xe9, 0x2b, 0x42, 0x58, 0x01, 0xa0, - 0xa9, 0x62, 0xd6, 0x3f, 0x85, 0xa7, - 0xb6, 0xd4, 0xfa, 0x15, 0x66, 0x17, - 0x09, 0xbd, 0x5d, 0x14, 0x34, 0x26, - 0x59, 0x72, 0x91, 0x54, 0x06, 0x4f, - 0xf8, 0xb0, 0x5b, 0x74, 0x93, 0x99, - 0x8c, 0xf2, 0x45, 0xcd, 0xea, 0x4e, - 0xad, 0x10, 0x4a, 0xe5, 0xca, 0xee, - 0xdf, 0xc6, 0x6f, 0x9f, 0x88, 0x8e, - 0x02, 0xcc, 0x08, 0xa8, 0x77, 0x94, - 0x6d, 0x21, 0xb1, 0x28, 0xe4, 0x39, - 0x79, 0x96, 0x60, 0x71, 0x81, 0x16, - 0x2e, 0xe6, 0x78, 0xb9, 0xc4, 0x46, - 0x9a, 0x42, 0xae, 0xb7, 0x7c, 0x43, - 0xb3, 0x22, 0x1a, 0x86, 0xc2, 0x32, - 0x3d, 0x2d, 0x9c, 0xd2, 0x29, 0xe9, - 0x63, 0x9b, 0xd1, 0x31, 0x38, 0x5e, - 0x1e, 0x36, 0x41, 0xbb, 0x03, 0x18, - 0x2b, 0x3e, 0xbf, 0x68, 0x61, 0xfc, - 0x52, 0xc0, 0xde, 0xe0, 0x0a, 0x58, - 0x13, 0x5a, 0x00, 0xbe, 0x1c, 0x90, - 0x0e, 0x53, 0x12, 0xfd, 0xe2, 0x6e, - 0xba, 0xce, 0x24, 0x27, 0x44, 0x7f, - 0x87, 0xa3, 0xa1, 0xd5, 0x50, 0x40, - 0xe3, 0xf9, 0x83, 0xf7, 0xc7, 0xa2, - 0x35, 0xc8, 0xdb, 0x19, 0xab, 0x2f, - 0x11, 0x25, 0xed, 0x33, 0x9e, 0x55, - 0xe1, 0x48, 0xaf, 0x73, 0x84, 0xda, - 0x2a, 0xaa, 0x51, 0xeb, 0x9d, 0x95, - 0xb2, 0xcb, 0xe7, 0x70, 0x80, 0xfe, - 0x4c, 0x65, 0x04, 0xef, 0xc5, 0xf1, - 0xc3, 0x3a, 0xb4, 0xf5, 0x5f, 0x23, - 0x89, 0xdd, 0x30, 0xa5, 0x8b, 0xd3, - 0xf6, 0xdc, 0x4d, 0x64, 0xd7, 0xf0, - 0x8f, 0xec, 0x56, 0x37, 0x5c, 0xa4, - 0x0d, 0x07, 0x76, 0x8a, 0x2c, 0x0b, - 0xb5, 0xd8, 0xc1, 0x1f, 0xe8, 0x3b, - 0xf4, 0x4b, 0x1b, 0x47, 0x6c, 0x49, - 0x67, 0x7b, 0x92, 0xcf, 0x75, 0x7e, - 0x20, 0xd9, 0x7d, 0x3c, 0x97, 0x7a, - 0xd0, 0x05, 0x6b, 0x0f, 0x1d, 0xfb, - 0x82, 0x98, 0x57, 0x8d, 0xf3, 0x6a, - 0xbc, 0xac, 0xc9, 0xa6, 0xff, 0xb8, - 0x69, 0x0c, 0x4c, 0x4d, 0x72, 0x07, - 0x5a, 0x49, 0x33, 0x8d, 0xa2, 0xab, - 0x46, 0x3d, 0x63, 0x0d, 0xa0, 0x97, - 0xff, 0xf0, 0xf5, 0xfa, 0xc0, 0xe9, - 0xdb, 0x62, 0xe4, 0xe1, 0x74, 0x43, - 0xdc, 0x86, 0x18, 0x29, 0x37, 0xf4, - 0x06, 0xe2, 0xed, 0x6f, 0x90, 0x48, - 0x1e, 0x2d, 0x1d, 0xea, 0x73, 0x94, - 0x54, 0xdf, 0x25, 0xf6, 0x47, 0x27, - 0xd9, 0x11, 0x77, 0xc9, 0x84, 0x1c, - 0x5b, 0x5c, 0x51, 0x81, 0xa6, 0x22, - 0x3e, 0x24, 0x96, 0xc8, 0x8a, 0xec, - 0x82, 0x7c, 0x09, 0xb8, 0x45, 0x4a, - 0x57, 0xbb, 0x2f, 0x50, 0x75, 0x8e, - 0x61, 0x70, 0x8c, 0x6c, 0xaf, 0xd0, - 0xfd, 0xb4, 0x1b, 0xae, 0xde, 0xfe, - 0x3b, 0xb5, 0x36, 0xbd, 0x55, 0x01, - 0x0e, 0x9c, 0x41, 0x56, 0x5f, 0xb3, - 0x26, 0x03, 0x83, 0xba, 0x13, 0x4b, - 0xca, 0xc5, 0x0a, 0xf8, 0x60, 0xa5, - 0xb9, 0xc7, 0xc3, 0x98, 0x32, 0xfb, - 0x12, 0xf9, 0xa7, 0x92, 0xaa, 0x68, - 0xf3, 0x78, 0x7e, 0x05, 0x20, 0x21, - 0x02, 0xe8, 0xbf, 0xf2, 0xb0, 0x59, - 0x8f, 0xd2, 0xcb, 0x87, 0x65, 0x15, - 0xf1, 0x1a, 0xb2, 0x30, 0xad, 0xee, - 0x58, 0xa3, 0x8b, 0x66, 0x1f, 0x2c, - 0xd7, 0x5d, 0x19, 0x85, 0xa8, 0xe6, - 0xd3, 0x6b, 0xa1, 0x0c, 0x91, 0x93, - 0x6a, 0x5e, 0x0b, 0x79, 0xe3, 0xdd, - 0x00, 0x4f, 0x3c, 0x89, 0x6e, 0x71, - 0x69, 0xa9, 0xac, 0x40, 0xe5, 0x99, - 0x28, 0xc6, 0x31, 0x4e, 0x7a, 0xcd, - 0x08, 0x9e, 0x7d, 0xef, 0x17, 0xfc, - 0x88, 0xd8, 0xa4, 0x6d, 0x44, 0x95, - 0xd1, 0xb7, 0xd4, 0x9b, 0xbe, 0x2a, - 0x34, 0x64, 0x2b, 0xcf, 0x2e, 0xeb, - 0x38, 0xce, 0x23, 0xe0, 0x3a, 0x3f, - 0xf7, 0x7b, 0x9f, 0x10, 0x53, 0xbc, - 0x52, 0x67, 0x16, 0xe7, 0x80, 0x76, - 0x04, 0xc4, 0xb6, 0xc1, 0xc2, 0x7f, - 0x9a, 0xda, 0xd5, 0x39, 0x42, 0x14, - 0x9d, 0xb1, 0x0f, 0x35, 0xd6, 0xcc, - 0xb9, 0xda, 0x38, 0x0c, 0xa2, 0x9c, - 0x09, 0x1f, 0x06, 0xb1, 0xb6, 0xfd, - 0x1a, 0x69, 0x23, 0x30, 0xc4, 0xde, - 0x01, 0xd1, 0xf4, 0x58, 0x29, 0x37, - 0x1c, 0x7d, 0xd5, 0xbf, 0xff, 0xbd, - 0xc8, 0xc9, 0xcf, 0x65, 0xbe, 0x7b, - 0x78, 0x97, 0x98, 0x67, 0x08, 0xb3, - 0x26, 0x57, 0xf7, 0xfa, 0x40, 0xad, - 0x8e, 0x75, 0xa6, 0x7c, 0xdb, 0x91, - 0x8b, 0x51, 0x99, 0xd4, 0x17, 0x7a, - 0x90, 0x8d, 0xce, 0x63, 0xcb, 0x4e, - 0xa0, 0xab, 0x18, 0x3a, 0x5b, 0x50, - 0x7f, 0x21, 0x74, 0xc1, 0xbb, 0xb8, - 0xb7, 0xba, 0x0b, 0x35, 0x95, 0x31, - 0x59, 0x9a, 0x4d, 0x04, 0x07, 0x1e, - 0x5a, 0x76, 0x13, 0xf3, 0x71, 0x83, - 0xf0, 0x86, 0x03, 0xa8, 0x39, 0x42, - 0xaa, 0x28, 0xe6, 0xe4, 0xd8, 0x5d, - 0xd3, 0xd0, 0x6e, 0x6f, 0x96, 0xfb, - 0x5e, 0xbc, 0x56, 0xc2, 0x5f, 0x85, - 0x9b, 0xe7, 0xaf, 0xd2, 0x3b, 0x84, - 0x6a, 0xa7, 0x53, 0xc5, 0x44, 0x49, - 0xa5, 0xf9, 0x36, 0x72, 0x3d, 0x2c, - 0xd9, 0x1b, 0xa1, 0xf5, 0x4f, 0x93, - 0x9d, 0x68, 0x47, 0x41, 0x16, 0xca, - 0x2a, 0x4c, 0xa3, 0x87, 0xd6, 0xe5, - 0x19, 0x2e, 0x77, 0x15, 0x6d, 0x70, - 0xc0, 0xdf, 0xb2, 0x00, 0x46, 0xed, - 0xc6, 0x6c, 0x43, 0x60, 0x92, 0x2d, - 0xa9, 0x22, 0x45, 0x8f, 0x34, 0x55, - 0xae, 0xa4, 0x0a, 0x66, 0x32, 0xe0, - 0xdc, 0x02, 0xac, 0xe8, 0x20, 0x8c, - 0x89, 0x62, 0x4a, 0xfe, 0xee, 0xc3, - 0xe3, 0x3c, 0xf1, 0x79, 0x05, 0xe9, - 0xf6, 0x27, 0x33, 0xcc, 0xf2, 0x9e, - 0x11, 0x81, 0x7e, 0x80, 0x10, 0x8a, - 0x82, 0x9f, 0x48, 0x0d, 0xd7, 0xb4, - 0xfc, 0x2f, 0xb5, 0xc7, 0xdd, 0x88, - 0x14, 0x6b, 0x2b, 0x54, 0xea, 0x1d, - 0x94, 0x5c, 0xb0, 0xef, 0x12, 0x24, - 0xcd, 0xeb, 0xe1, 0xe2, 0x64, 0x73, - 0x3f, 0x0e, 0x52, 0x61, 0x25, 0x3e, - 0xf8, 0x0f, 0x4b, 0xec, 0xc0, 0x00, - 0x30, 0xf6, 0x02, 0x49, 0x3d, 0x10, - 0x6e, 0x20, 0xc9, 0xa6, 0x2f, 0xfe, - 0x2c, 0x2b, 0x75, 0x2e, 0x45, 0x26, - 0xab, 0x48, 0xa9, 0x80, 0xfc, 0x04, - 0xcc, 0xd3, 0xb5, 0xba, 0xa3, 0x38, - 0x31, 0x7d, 0x01, 0xd9, 0xa7, 0x7b, - 0x96, 0xb6, 0x63, 0x69, 0x4e, 0xf7, - 0xde, 0xe0, 0x78, 0xca, 0x50, 0xaa, - 0x41, 0x91, 0x65, 0x88, 0xe4, 0x21, - 0x85, 0xda, 0x3a, 0x27, 0xbe, 0x1c, - 0x3e, 0x42, 0x5e, 0x17, 0x52, 0x7f, - 0x1f, 0x89, 0x24, 0x6f, 0x8f, 0x5c, - 0x67, 0x74, 0x0e, 0x12, 0x87, 0x8d, - 0xe9, 0x34, 0xed, 0x73, 0xc4, 0xf8, - 0x61, 0x5b, 0x05, 0xdf, 0x59, 0x4c, - 0x97, 0x79, 0x83, 0x18, 0xa4, 0x55, - 0x95, 0xeb, 0xbd, 0x53, 0xf5, 0xf1, - 0x57, 0x66, 0x46, 0x9f, 0xb2, 0x81, - 0x09, 0x51, 0x86, 0x22, 0x16, 0xdd, - 0x23, 0x93, 0x76, 0x29, 0xc2, 0xd7, - 0x1d, 0xd4, 0xbf, 0x36, 0x3f, 0xea, - 0x4b, 0x11, 0x32, 0xb9, 0x62, 0x54, - 0x60, 0xd6, 0x6d, 0x43, 0x9a, 0x0d, - 0x92, 0x9c, 0xb0, 0xef, 0x58, 0x6c, - 0x9d, 0x77, 0x2d, 0x70, 0xfa, 0xf3, - 0xb3, 0x0b, 0xe2, 0x40, 0x7e, 0xf4, - 0x8a, 0xe5, 0x8c, 0x3c, 0x56, 0x71, - 0xd1, 0x64, 0xe1, 0x82, 0x0a, 0xcb, - 0x13, 0x15, 0x90, 0xec, 0x03, 0x99, - 0xaf, 0x14, 0x5d, 0x0f, 0x33, 0x4a, - 0x94, 0xa5, 0xa8, 0x35, 0x1b, 0xe3, - 0x6a, 0xc6, 0x28, 0xff, 0x4d, 0xe7, - 0x25, 0x84, 0xac, 0x08, 0xae, 0xc5, - 0xa2, 0x2a, 0xb8, 0x37, 0x0c, 0x7a, - 0xa0, 0xc3, 0xce, 0xad, 0x06, 0x1a, - 0x9e, 0x8b, 0xfb, 0xd5, 0xf0, 0xc1, - 0x1e, 0xd0,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- 0x23, 0x48, 0x92, 0xcf, 0x62, 0xa8, - 0x99, 0xf8, 0xd0, 0x2e, 0x85, 0x61, - 0x43, 0xc8, 0xbd, 0xf0, 0x05, 0x93, - 0xca, 0x4e, 0xf1, 0x7d, 0x30, 0xfd, - 0xc4, 0x69, 0x66, 0x2f, 0x08, 0xb1, - 0x52, 0xf9, 0x21, 0xe6, 0x7a, 0x2b, - 0xdd, 0x39, 0x84, 0xff, 0xc0, 0x91, - 0xd6, 0x37, 0xd4, 0x7f, 0x2d, 0x9b, - 0x5d, 0xa1, 0x3b, 0x6e, 0xb5, 0xc5, - 0x46, 0x04, 0xf5, 0x90, 0xee, 0x7e, - 0x83, 0x1c, 0x03, 0x56, 0xb6, 0xaa, - 0x00, 0x17, 0x01, 0x35, 0x55, 0x79, - 0x0b, 0x12, 0xbb, 0x1a, 0x31, 0xe7, - 0x02, 0x28, 0x16, 0xc1, 0xf6, 0xa2, - 0xdb, 0x18, 0x9c, 0x89, 0x68, 0x38, - 0x97, 0xab, 0xc7, 0x2a, 0xd7, 0x3a, - 0xf2, 0xc6, 0x24, 0x4c, 0xb0, 0x58, - 0xa0, 0x22, 0x5e, 0x9d, 0xd9, 0xa7, - 0xe9, 0xae, 0xaf, 0x8c, 0x95, 0x9f, - 0x28, 0xb7, 0x20, 0xd7, 0xb0, 0x30, - 0xc3, 0x09, 0x19, 0xc0, 0x67, 0xd6, - 0x00, 0x3c, 0x7e, 0xe7, 0xe9, 0xf4, - 0x08, 0x5a, 0xf8, 0xb8, 0x2e, 0x05, - 0xa6, 0x25, 0x9e, 0x5c, 0xd8, 0x15, - 0x0d, 0xe1, 0xf6, 0x11, 0x54, 0x6b, - 0xcd, 0x21, 0x46, 0x66, 0x5e, 0x84, - 0xad, 0x06, 0x38, 0x29, 0x44, 0xc5, - 0xa2, 0xce, 0xf1, 0xaa, 0xc1, 0x40, - 0x71, 0x86, 0xb5, 0xef, 0xfc, 0x36, - 0xa8, 0xcb, 0x0a, 0x48, 0x27, 0x45, - 0x64, 0xa3, 0xaf, 0x8c, 0xb2, 0xc6, - 0x9f, 0x07, 0x89, 0xdc, 0x17, 0xd3, - 0x49, 0x79, 0xfb, 0xfe, 0x1d, 0xd0, - 0xb9, 0x88, 0x43, 0x52, 0xbc, 0x01, - 0x78, 0x2b, 0x7d, 0x94, 0xc7, 0x0e, - 0xde, 0xa5, 0xd5, 0x9b, 0xcc, 0xf7, - 0x61, 0x7a, 0xc2, 0x74, 0x81, 0x39, - 0x03, 0xab, 0x96, 0xa0, 0x37, 0xbd, - 0x2d, 0x72, 0x75, 0x3f, 0xc9, 0xd4, - 0x8e, 0x6f, 0xf9, 0x8d, 0xed, 0x62, - 0xdb, 0x1c, 0xdf, 0x04, 0xac, 0x1b, - 0x6c, 0x14, 0x4b, 0x63, 0xf0, 0xbf, - 0xb4, 0x82, 0xec, 0x7b, 0x1a, 0x59, - 0x92, 0xd2, 0x10, 0x60, 0xb6, 0x3d, - 0x5f, 0xe6, 0x80, 0x6e, 0x70, 0xc4, - 0xf2, 0x35, 0xd9, 0x7c, 0xee, 0xe5, - 0x41, 0xa4, 0x5b, 0x50, 0xdd, 0xbb, - 0x4c, 0xf3, 0x1f, 0x9d, 0x5d, 0x57, - 0x55, 0x51, 0x97, 0xe3, 0x58, 0x42, - 0x4d, 0x9c, 0x73, 0xba, 0xc8, 0x77, - 0x31, 0x69, 0x26, 0xae, 0xea, 0x8a, - 0xda, 0x22, 0xb3, 0x87, 0x56, 0xfa, - 0x93, 0x0b, 0x34, 0x16, 0x33, 0xe8, - 0xe4, 0x53, 0xbe, 0xa9, 0xb1, 0x3a, - 0x3e, 0xf5, 0x90, 0x6a, 0xcf, 0x3b, - 0x12, 0xfd, 0x8f, 0x9a, 0xa7, 0x47, - 0x91, 0x99, 0xeb, 0x0f, 0x24, 0xff, - 0x23, 0x18, 0x85, 0x4e, 0x7f, 0x0c, - 0xe0, 0xa1, 0xe2, 0xd1, 0x2c, 0x2a, - 0x4a, 0x02, 0x4f, 0x1e, 0x95, 0x68, - 0x8b, 0x98, 0x83, 0x6d, 0x76, 0xca, - 0x65, 0x32, 0x13, 0x2f, 0xc3, 0x82, - 0x9a, 0xa4, 0xba, 0x81, 0x60, 0x37, - 0x34, 0x35, 0xfc, 0x80, 0xa8, 0x51, - 0x65, 0x67, 0xed, 0x30, 0x5f, 0x10, - 0xd3, 0x4a, 0x27, 0x2f, 0x13, 0xb9, - 0x2a, 0xd2, 0xcc, 0xe1, 0xef, 0xae, - 0xeb, 0xbe, 0xf4, 0xbd, 0xcf, 0x43, - 0xb3, 0xc5, 0x88, 0x84, 0xb7, 0xdd, - 0x39, 0x40, 0xce, 0x48, 0x6d, 0x9b, - 0x72, 0x61, 0x7e, 0xe7, 0xa1, 0x4e, - 0x53, 0x2e, 0x77, 0x3b, 0xe2, 0xc9, - 0x36, 0x22, 0x1b, 0x6e, 0x73, 0xb1, - 0x03, 0xb2, 0x4c, 0x87, 0xa9, 0xd4, - 0x4d, 0x0f, 0xd8, 0x15, 0x6c, 0xaa, - 0x18, 0xf6, 0x49, 0x57, 0x5d, 0xfb, - 0x7a, 0x14, 0x94, 0x63, 0xa0, 0x11, - 0xb0, 0x9e, 0xde, 0x05, 0x46, 0xc8, - 0xee, 0x47, 0xdb, 0xdc, 0x24, 0x89, - 0x9c, 0x91, 0x97, 0x29, 0xe9, 0x7b, - 0xc1, 0x07, 0x1e, 0xb8, 0xfd, 0xfe, - 0xac, 0xc6, 0x62, 0x98, 0x4f, 0xf1, - 0x79, 0xe0, 0xe8, 0x6b, 0x78, 0x56, - 0xb6, 0x8d, 0x04, 0x50, 0x86, 0xca, - 0x6f, 0x20, 0xe6, 0xea, 0xe5, 0x76, - 0x17, 0x1c, 0x74, 0x7f, 0xbc, 0x0d, - 0x2c, 0x85, 0xf7, 0x66, 0x96, 0xe4, - 0x8b, 0x75, 0x3f, 0x4b, 0xd9, 0x38, - 0xaf, 0x7c, 0xda, 0x0b, 0x83, 0x2d, - 0x31, 0x32, 0xa2, 0xf5, 0x1d, 0x59, - 0x41, 0x45, 0xbf, 0x3c, 0x1f, 0xf8, - 0xf9, 0x8a, 0xd0, 0x16, 0x25, 0x69, - 0x12, 0x99, 0x9d, 0x21, 0x95, 0xab, - 0x01, 0xa6, 0xd7, 0xb5, 0xc0, 0x7d, - 0xff, 0x58, 0x0e, 0x3a, 0x92, 0xd1, - 0x55, 0xe3, 0x08, 0x9f, 0xd6, 0x3e, - 0x52, 0x8e, 0xfa, 0xa3, 0xc7, 0x02, - 0xcd, 0xdf, 0x8f, 0x64, 0x19, 0x8c, - 0xf3, 0xa7, 0x0c, 0x5e, 0x0a, 0x6a, - 0x09, 0xf0, 0x93, 0x5b, 0x42, 0xc2, - 0x06, 0x23, 0xec, 0x71, 0xad, 0xb4, - 0xcb, 0xbb, 0x70, 0x28, 0xd5, 0x1a, - 0x5c, 0x33, 0x68, 0x5a, 0x00, 0x44, - 0x90, 0xa5, 0xc4, 0x26, 0x3d, 0x2b, - 0xf2, 0x54, 0x96, 0xad, 0xda, 0x1f, - 0xed, 0x33, 0xe1, 0x81, 0x69, 0x08, - 0x0d, 0x0a, 0xdb, 0x35, 0x77, 0x9a, - 0x64, 0xd1, 0xfc, 0x78, 0xaa, 0x1b, - 0xd0, 0x67, 0xa0, 0xdd, 0xfa, 0x6c, - 0x63, 0x71, 0x05, 0x84, 0x17, 0x6a, - 0x89, 0x4f, 0x66, 0x7f, 0xc6, 0x50, - 0x55, 0x92, 0x6f, 0xbd, 0xe7, 0xd2, - 0x40, 0x72, 0x8d, 0xbb, 0xec, 0x06, - 0x42, 0x8a, 0xe4, 0x88, 0x9d, 0x7e, - 0x7a, 0x82, 0x27, 0x13, 0x41, 0x1a, - 0xaf, 0xc8, 0xa4, 0x76, 0xb4, 0xc2, - 0xfe, 0x6d, 0x1c, 0xd9, 0x61, 0x30, - 0xb3, 0x7c, 0xea, 0xf7, 0x29, 0x0f, - 0xf2, 0x3b, 0x51, 0xc1, 0xde, 0x5f, - 0xe5, 0x2a, 0x2f, 0x99, 0x0b, 0x5d, - 0xa3, 0x2b, 0x4a, 0xab, 0x95, 0xa5, - 0xd3, 0x58, 0x56, 0xee, 0x28, 0x31, - 0x00, 0xcc, 0x15, 0x46, 0xca, 0xe6, - 0x86, 0x38, 0x3c, 0x65, 0xf5, 0xe3, - 0x9f, 0xd6, 0x5b, 0x09, 0x49, 0x83, - 0x70, 0x2d, 0x53, 0xa9, 0x7d, 0xe2, - 0xc4, 0xac, 0x8e, 0x5e, 0xb8, 0x25, - 0xf4, 0xb9, 0x57, 0xf3, 0xf1, 0x68, - 0x47, 0xb2, 0xa2, 0x59, 0x20, 0xce, - 0x34, 0x79, 0x5c, 0x90, 0x0e, 0x1e, - 0xbe, 0xd5, 0x22, 0x23, 0xb1, 0xc9, - 0x18, 0x62, 0x16, 0x2e, 0x91, 0x3e, - 0x07, 0x8f, 0xd8, 0x3f, 0x93, 0x3d, - 0xd4, 0x9b, 0xdf, 0x85, 0x21, 0xfb, - 0x11, 0x74, 0x97, 0xc7, 0xd7, 0xdc, - 0x4c, 0x19, 0x45, 0x98, 0xe9, 0x43, - 0x02, 0x4b, 0xbc, 0xc3, 0x04, 0x9c, - 0x6b, 0xf0, 0x75, 0x52, 0xa7, 0x26, - 0xf6, 0xc5, 0xba, 0xcf, 0xb0, 0xb7, - 0xae, 0x5a, 0xa1, 0xbf, 0x03, 0x8b, - 0x80, 0x12, 0x6e, 0x0c, 0xeb, 0xf9, - 0xc0, 0x44, 0x24, 0xef, 0x10, 0xf8, - 0xa8, 0x8c, 0xe8, 0x7b, 0xff, 0x9e, - 0x2c, 0xcd, 0x60, 0x36, 0x87, 0xb5, - 0x94, 0xa6, 0x54, 0x73, 0x3a, 0x14, - 0x4e, 0x01, 0x1d, 0xb6, 0xfd, 0x37, - 0x48, 0x4d, 0x39, 0xcb, 0xe0, 0x32 -}; + 0x70, 0x51, 0x03, 0x86, 0x40, 0x0d, 0x4f, 0xeb, 0x3e, 0xcc, 0xd1, 0x87, 0x35, 0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, 0x2e, 0x91, 0x3e, 0x07, 0x8f, 0xd8, 0x3f, 0x93, 0x3d, 0xd4, 0x9b, 0xdf, 0x85, 0x21, 0xfb, 0x11, 0x74, 0x97, 0xc7, 0xd7, 0xdc, + 0x4c, 0x19, 0x45, 0x98, 0xe9, 0x43, 0x02, 0x4b, 0xbc, 0xc3, 0x04, 0x9c, 0x6b, 0xf0, 0x75, 0x52, 0xa7, 0x26, 0xf6, 0xc5, 0xba, 0xcf, 0xb0, 0xb7, + 0xae, 0x5a, 0xa1, 0xbf, 0x03, 0x8b, 0x80, 0x12, 0x6e, 0x0c, 0xeb, 0xf9, 0xc0, 0x44, 0x24, 0xef, 0x10, 0xf8, 0xa8, 0x8c, 0xe8, 0x7b, 0xff, 0x9e, + 0x2c, 0xcd, 0x60, 0x36, 0x87, 0xb5, 0x94, 0xa6, 0x54, 0x73, 0x3a, 0x14, 0x4e, 0x01, 0x1d, 0xb6, 0xfd, 0x37, 0x48, 0x4d, 0x39, 0xcb, 0xe0, 0x32}; // WPADiCreateKeyFor3rd -static u8 base3[] = { - 0x54, 0x29, 0x28, 0x4e, 0x0f, 0xfc, - 0xa4, 0x6c, 0x87, 0x50, 0x49, 0x3c, - 0xf2, 0xb4, 0xb1, 0xf9, 0xc3, 0x58, - 0x2e, 0x83, 0x5f, 0x71, 0x8a, 0x9b, - 0x82, 0xca, 0xc2, 0xbe, 0xba, 0x75, - 0x91, 0x60, 0x78, 0xa8, 0x2a, 0x4c, - 0x25, 0x5b, 0x8b, 0xb0, 0xda, 0xaf -}; +static u8 base3[] = {0x54, 0x29, 0x28, 0x4e, 0x0f, 0xfc, 0xa4, 0x6c, 0x87, 0x50, 0x49, 0x3c, 0xf2, 0xb4, 0xb1, 0xf9, 0xc3, 0x58, 0x2e, 0x83, 0x5f, + 0x71, 0x8a, 0x9b, 0x82, 0xca, 0xc2, 0xbe, 0xba, 0x75, 0x91, 0x60, 0x78, 0xa8, 0x2a, 0x4c, 0x25, 0x5b, 0x8b, 0xb0, 0xda, 0xaf}; static u8 tb3[] = { - 0xa4, 0x38, 0x33, 0x69, 0xd4, 0xf5, - 0x6a, 0xa8, 0xd7, 0xec, 0x74, 0xa6, - 0x7b, 0xc7, 0x3c, 0x41, 0xb7, 0x21, - 0x98, 0x4a, 0x8d, 0xc8, 0x28, 0xf3, - 0xf8, 0x32, 0x91, 0xab, 0xad, 0x34, - 0x86, 0x30, 0x4c, 0xbc, 0xff, 0xce, - 0x14, 0x1e, 0x2e, 0xf9, 0x31, 0x59, - 0x85, 0x87, 0xfc, 0xc2, 0xfd, 0x3e, - 0xbb, 0x56, 0x88, 0x8b, 0xbf, 0x47, - 0x61, 0x92, 0xb1, 0x94, 0x7a, 0x51, - 0x9c, 0x8f, 0xb0, 0x49, 0x9b, 0xb9, - 0x05, 0x36, 0x10, 0x3b, 0xd5, 0xd3, - 0x0c, 0x96, 0xcb, 0x79, 0x60, 0x4e, - 0xa2, 0xb5, 0xd1, 0xee, 0x17, 0xba, - 0x1f, 0x09, 0x78, 0x93, 0xb4, 0x35, - 0x3a, 0x9d, 0x1d, 0x39, 0xc9, 0x3f, - 0x7c, 0x2f, 0xca, 0x0b, 0x37, 0xe6, - 0x1b, 0xd0, 0x67, 0xd9, 0x18, 0x84, - 0xe1, 0x42, 0x5a, 0x7e, 0xb8, 0x97, - 0xdf, 0x54, 0x70, 0x03, 0x6e, 0xdb, - 0x63, 0xae, 0x55, 0x5d, 0xc4, 0x4b, - 0x89, 0xcc, 0x13, 0xb3, 0x90, 0xf6, - 0xe9, 0xb2, 0xa3, 0xbe, 0x2d, 0x19, - 0x73, 0x23, 0x20, 0x7f, 0x40, 0x02, - 0x9e, 0xc3, 0x6b, 0x1a, 0x52, 0xda, - 0x29, 0x80, 0x0d, 0x5f, 0xd6, 0x8e, - 0x0e, 0x22, 0xe3, 0x6d, 0xdc, 0x58, - 0x75, 0xe0, 0x01, 0x0a, 0x26, 0x50, - 0x08, 0xa9, 0xfe, 0x4d, 0x15, 0xf7, - 0x6c, 0xcf, 0x4f, 0xf0, 0x64, 0x5e, - 0xc6, 0x68, 0x8a, 0xac, 0xde, 0xb6, - 0x48, 0x66, 0xed, 0x6f, 0x71, 0x45, - 0x3d, 0xeb, 0x9f, 0x04, 0x25, 0x5c, - 0xbd, 0x65, 0xdd, 0x53, 0xcd, 0x24, - 0xef, 0x72, 0xe8, 0x9a, 0xe7, 0x16, - 0xc1, 0x00, 0x77, 0x2c, 0x7d, 0xa5, - 0x2a, 0x44, 0x62, 0x27, 0xf4, 0xc0, - 0x07, 0x1c, 0x5b, 0x99, 0x82, 0x57, - 0x06, 0xfa, 0xfb, 0x12, 0xaf, 0xa7, - 0xd2, 0xaa, 0x2b, 0x8c, 0xf2, 0xd8, - 0x83, 0xa0, 0x76, 0x11, 0xc5, 0x43, - 0x81, 0x46, 0xe5, 0xf1, 0xea, 0x95, - 0xe2, 0xe4, 0x0f, 0xa1, 0x2b, 0xd2, - 0xa5, 0x8e, 0x26, 0x09, 0x0f, 0xf7, - 0x45, 0x5b, 0x3c, 0xfd, 0x8c, 0x72, - 0x22, 0xbf, 0xca, 0xda, 0xe7, 0xaf, - 0x16, 0xb2, 0x5e, 0x8a, 0x6f, 0x94, - 0xb7, 0xd6, 0x1c, 0xb1, 0x29, 0x4c, - 0xb5, 0x43, 0x18, 0x9c, 0x31, 0xce, - 0xb6, 0x84, 0x71, 0x60, 0x7f, 0x2a, - 0x6e, 0x35, 0xf8, 0xa6, 0x54, 0xea, - 0x74, 0x88, 0xac, 0x03, 0x19, 0x1b, - 0x3d, 0x79, 0xfc, 0xee, 0x42, 0x9f, - 0x93, 0xdb, 0x80, 0xad, 0x8b, 0x15, - 0x41, 0x5d, 0x48, 0xcd, 0x7c, 0xa3, - 0x2c, 0x32, 0x1f, 0x63, 0xd1, 0xed, - 0x4f, 0x04, 0x66, 0x1e, 0x46, 0x9b, - 0xbb, 0x38, 0x06, 0x7e, 0x95, 0xc8, - 0x5f, 0x4a, 0x51, 0x6b, 0x97, 0xbe, - 0x2e, 0x98, 0xbd, 0xec, 0x0e, 0x05, - 0x0a, 0xa0, 0x01, 0x52, 0x85, 0xc0, - 0xd8, 0x3b, 0xfe, 0x12, 0x64, 0xe1, - 0xf3, 0x24, 0x4b, 0xf5, 0x49, 0x7a, - 0xe4, 0x4e, 0x34, 0x25, 0x08, 0x53, - 0x1a, 0xe3, 0xef, 0x86, 0xdf, 0xf1, - 0x91, 0xeb, 0xc6, 0xd9, 0xd3, 0x83, - 0x14, 0x1d, 0xb0, 0xa7, 0x0b, 0x10, - 0x40, 0x89, 0xb4, 0xd4, 0x3a, 0x02, - 0x0c, 0xdd, 0x2f, 0x5a, 0x56, 0x28, - 0xae, 0x2d, 0x55, 0xf6, 0xc1, 0xd5, - 0xa8, 0x44, 0xcf, 0x58, 0x9d, 0xb3, - 0x23, 0xc5, 0xa4, 0x3e, 0x7d, 0x30, - 0x13, 0x6a, 0x61, 0xd0, 0xf0, 0x3f, - 0x67, 0xcb, 0x0d, 0xff, 0x92, 0x68, - 0xe0, 0x81, 0x69, 0x62, 0xab, 0x75, - 0x59, 0x11, 0xf2, 0xc9, 0x07, 0xe9, - 0xc7, 0xa1, 0xc2, 0x78, 0x33, 0x17, - 0x6c, 0xf9, 0xc4, 0xb8, 0xb9, 0xdc, - 0x27, 0x90, 0xbc, 0xfb, 0x70, 0xaa, - 0xe8, 0x96, 0x73, 0x39, 0xf4, 0xc3, - 0x77, 0x87, 0xde, 0x00, 0xa2, 0x9a, - 0xe2, 0x7b, 0xfa, 0x36, 0x65, 0x6d, - 0x20, 0xd7, 0x57, 0x5c, 0x37, 0x8f, - 0x4d, 0x9e, 0x47, 0xa9, 0xe5, 0xcc, - 0x99, 0x8d, 0x76, 0x50, 0xba, 0xe6, - 0x82, 0x21, 0xb0, 0x0d, 0xeb, 0x75, - 0x6d, 0x22, 0xce, 0xe7, 0x63, 0x2c, - 0xde, 0xe2, 0xf5, 0x45, 0xba, 0x44, - 0x95, 0x1f, 0xe5, 0x39, 0xd7, 0xa5, - 0xb5, 0x8d, 0x07, 0x93, 0xfd, 0xbc, - 0x62, 0x7e, 0x89, 0xb3, 0x48, 0x59, - 0x7f, 0xd3, 0xbe, 0xd0, 0xf2, 0x36, - 0x53, 0x9f, 0xe6, 0xb1, 0x82, 0xc0, - 0x94, 0xb8, 0x2f, 0x03, 0x24, 0x3c, - 0x00, 0x0a, 0x42, 0x65, 0xe8, 0x5c, - 0x96, 0xd5, 0xa9, 0x90, 0xb9, 0x85, - 0xe9, 0xea, 0x0e, 0x16, 0x7b, 0x84, - 0x29, 0x4e, 0x5e, 0x87, 0x9d, 0x35, - 0x06, 0x86, 0xe1, 0xe0, 0xe3, 0xec, - 0xef, 0xc8, 0x52, 0x5f, 0x64, 0xe4, - 0x46, 0x30, 0x5a, 0xcd, 0xed, 0xd1, - 0x51, 0x81, 0x0c, 0x3a, 0x66, 0xfe, - 0x04, 0x67, 0x1e, 0xd6, 0xf7, 0x8c, - 0xbd, 0x33, 0xb2, 0x91, 0xd4, 0xa8, - 0x4a, 0x14, 0x0b, 0x79, 0x58, 0x88, - 0xb6, 0xc1, 0x19, 0x56, 0xf8, 0x27, - 0xac, 0x23, 0x99, 0xb4, 0xc3, 0x12, - 0xf3, 0x20, 0x78, 0x34, 0x49, 0xdc, - 0xd8, 0x05, 0xbb, 0x55, 0x8a, 0x71, - 0x11, 0x21, 0xc7, 0xdb, 0xf1, 0x9b, - 0xf6, 0x9e, 0x17, 0xf9, 0xfa, 0xfb, - 0xa7, 0x60, 0x8e, 0x6e, 0x8b, 0xca, - 0x15, 0xab, 0xdd, 0x3d, 0xa6, 0xc6, - 0x80, 0xc2, 0xda, 0x4c, 0x1d, 0x4f, - 0x5d, 0x92, 0x69, 0x98, 0xa2, 0x32, - 0x9c, 0x2b, 0x6a, 0x41, 0x1a, 0x6c, - 0xa3, 0xc5, 0x72, 0xaa, 0xcc, 0x6b, - 0x10, 0x5b, 0x4d, 0x57, 0x28, 0x68, - 0xee, 0x09, 0x40, 0xf0, 0xad, 0x26, - 0x2e, 0x2d, 0x9a, 0xa0, 0x7a, 0xcb, - 0x74, 0x3e, 0x1b, 0x70, 0xfc, 0x43, - 0xc4, 0x77, 0x08, 0xb7, 0xcf, 0x1c, - 0x7d, 0x18, 0x0f, 0x13, 0x25, 0xbf, - 0x61, 0x01, 0x37, 0xae, 0xd2, 0x2a, - 0x7c, 0x97, 0xaf, 0x3f, 0x50, 0xdf, - 0x6f, 0xa1, 0xa4, 0xff, 0x38, 0xc9, - 0x83, 0x8f, 0x54, 0x73, 0x02, 0x47, - 0xd9, 0x31, 0x76, 0x3b, 0x4b, 0xf4, - 0x9c, 0x49, 0xc7, 0xb6, 0x14, 0x21, - 0x5f, 0x52, 0xf3, 0xb7, 0xd5, 0xf2, - 0x95, 0xa0, 0x25, 0x54, 0xd9, 0xe7, - 0xb0, 0xbf, 0x69, 0x13, 0x78, 0xf0, - 0x33, 0xe0, 0x8c, 0x94, 0xdb, 0xe6, - 0xa7, 0xb5, 0xec, 0xc2, 0x63, 0xe3, - 0x18, 0xb9, 0x4b, 0x74, 0xe5, 0x01, - 0x8e, 0xb1, 0x27, 0x35, 0xb4, 0x3d, - 0x26, 0x48, 0x1f, 0xfa, 0xbb, 0x90, - 0xd3, 0x98, 0xdf, 0xa4, 0x37, 0x67, - 0x5d, 0x80, 0xd2, 0x62, 0xe1, 0x6f, - 0x96, 0x2d, 0xa8, 0x6a, 0x97, 0x30, - 0x89, 0xea, 0x3a, 0xbe, 0x22, 0x19, - 0x41, 0xac, 0x79, 0xf1, 0x85, 0xee, - 0x70, 0xc0, 0x0a, 0x1b, 0x7f, 0xc1, - 0xd0, 0xa6, 0xf4, 0x16, 0xfc, 0xba, - 0x4e, 0x4a, 0xc9, 0x12, 0x8a, 0x1a, - 0x9d, 0xc5, 0x38, 0xd4, 0xde, 0xad, - 0xc4, 0x43, 0x03, 0xb3, 0xf7, 0xa9, - 0x59, 0x6d, 0xa3, 0x20, 0x36, 0x4d, - 0x86, 0x5b, 0xae, 0x61, 0x17, 0xa5, - 0x93, 0xdc, 0x50, 0x2c, 0xef, 0x2a, - 0x68, 0x75, 0x7a, 0x8b, 0xd6, 0xfb, - 0x00, 0x9e, 0x2e, 0x02, 0xcd, 0xed, - 0x47, 0xab, 0x82, 0xbd, 0x71, 0x11, - 0xb2, 0x66, 0x5e, 0x3c, 0x7c, 0x08, - 0x6e, 0xf6, 0x09, 0x45, 0x3f, 0x5a, - 0x0f, 0x84, 0xcc, 0xdd, 0x73, 0x0d, - 0xf8, 0x92, 0xe8, 0x0b, 0xe9, 0xcf, - 0x4f, 0x1c, 0xda, 0x10, 0x0e, 0x9f, - 0xa2, 0x58, 0xff, 0x40, 0x87, 0x77, - 0x2f, 0x60, 0x4c, 0xc3, 0x28, 0x88, - 0x15, 0x81, 0x06, 0x56, 0xd1, 0x55, - 0x8d, 0x9b, 0x57, 0x83, 0x65, 0x91, - 0x34, 0xce, 0x53, 0x42, 0x04, 0x0c, - 0x46, 0x7d, 0x07, 0x29, 0xfe, 0x24, - 0x2b, 0x6c, 0x05, 0x32, 0xcb, 0x72, - 0x1e, 0x7e, 0xaa, 0xe4, 0x99, 0x6b, - 0xe2, 0xa1, 0xd8, 0x1d, 0x3e, 0xc6, - 0xc8, 0x5c, 0x8f, 0xd7, 0x64, 0x39, - 0xb8, 0x44, 0x23, 0x31, 0x7b, 0x51, - 0xca, 0x3b, 0xf5, 0xf9, 0xfd, 0x76, - 0xeb, 0x9a, 0xaf, 0xbc, 0x94, 0xc5, - 0x26, 0x3f, 0xf6, 0xf8, 0x93, 0x6e, - 0x73, 0x84, 0x82, 0xe7, 0x54, 0x2c, - 0x57, 0xaa, 0x46, 0x6d, 0x7a, 0x7e, - 0xf7, 0xe6, 0x9a, 0x9f, 0xd6, 0xed, - 0xe1, 0xf0, 0xf5, 0x67, 0xde, 0xf4, - 0xd1, 0x41, 0xfc, 0x4a, 0x53, 0xc8, - 0x4d, 0x30, 0x4e, 0x36, 0x40, 0x31, - 0x8d, 0x98, 0x0c, 0xa2, 0xc0, 0xea, - 0x6c, 0x0a, 0x18, 0x58, 0x8f, 0xee, - 0x00, 0x62, 0x83, 0xe2, 0x0d, 0x5b, - 0x8b, 0xc7, 0xd7, 0x04, 0x90, 0xa1, - 0xe9, 0xcd, 0x16, 0x15, 0x56, 0x78, - 0x92, 0x77, 0xd5, 0x12, 0xe3, 0xce, - 0x19, 0xbe, 0x34, 0x50, 0x51, 0x4b, - 0x32, 0xc1, 0x06, 0x07, 0x37, 0x35, - 0x60, 0xac, 0xad, 0x2b, 0x27, 0xeb, - 0x08, 0x9b, 0xdb, 0x7b, 0x4f, 0x03, - 0x79, 0x11, 0x17, 0xd3, 0xf1, 0xd9, - 0xa6, 0x66, 0xf3, 0xcf, 0x72, 0x99, - 0x3a, 0xca, 0x3d, 0x0b, 0x89, 0x47, - 0x24, 0xdf, 0x65, 0x14, 0x38, 0x61, - 0xc2, 0x6f, 0x13, 0xaf, 0x91, 0x3e, - 0x2a, 0x33, 0xda, 0xe0, 0xa5, 0x3b, - 0x1b, 0x1d, 0xa0, 0x22, 0x6a, 0xc4, - 0x95, 0xfa, 0xb6, 0xb2, 0x69, 0x9c, - 0xf2, 0x80, 0x44, 0x21, 0xef, 0x9d, - 0xa7, 0xcb, 0xa9, 0x96, 0x1e, 0x43, - 0x76, 0x8a, 0x7f, 0x3c, 0xd0, 0xa8, - 0x59, 0x20, 0xdc, 0x81, 0xc9, 0xcc, - 0x97, 0xa4, 0xbc, 0xbd, 0x7d, 0xab, - 0xa3, 0xb4, 0x52, 0xe4, 0xb0, 0x8c, - 0xb9, 0x2f, 0x9e, 0xb7, 0x4c, 0xe8, - 0x45, 0x63, 0x09, 0x64, 0x5d, 0x88, - 0xd2, 0x1c, 0x74, 0x87, 0x48, 0x5e, - 0x55, 0x6b, 0xb3, 0xec, 0x39, 0x05, - 0x2d, 0x28, 0x10, 0xb1, 0xc6, 0xfe, - 0x70, 0x29, 0x5a, 0xfb, 0x49, 0x23, - 0xdd, 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0x25, - 0xea, 0xfc, 0xef, 0x8a, 0xa7, 0x10, - 0xbc, 0xf5, 0xa0, 0x21, 0x44, 0x57, - 0x02, 0xd2, 0x2f, 0x63, 0x3d, 0xd5, - 0x79, 0x9c, 0x05, 0xf2, 0xe4, 0xcf, - 0x29, 0xf1, 0x53, 0x0e, 0x7a, 0xb1, - 0x14, 0x12, 0xf9, 0xf7, 0x11, 0x8b, - 0x36, 0xa6, 0xb6, 0xd6, 0xa1, 0x18, - 0x39, 0xec, 0x04, 0xc1, 0xe8, 0x8d, - 0x28, 0x99, 0x73, 0x90, 0x70, 0xd3, - 0x1d, 0x8f, 0xcb, 0xf8, 0xf0, 0xb9, - 0xde, 0x77, 0x92, 0x32, 0xe7, 0xee, - 0x85, 0x33, 0x13, 0xa8, 0x9a, 0x3f, - 0xc8, 0xe1, 0x80, 0x9b, 0x06, 0x23, - 0x37, 0x09, 0xd1, 0xff, 0xac, 0x81, - 0x94, 0x64, 0xaf, 0x4a, 0x46, 0x7d, - 0x16, 0xc3, 0x55, 0x47, 0xca, 0xd9, - 0x0f, 0x1c, 0x6a, 0x74, 0xdc, 0x49, - 0x83, 0xc5, 0xb8, 0x5c, 0x93, 0x62, - 0xdc, 0x2f, 0xd4, 0xf0, 0x86, 0x18, - 0xb1, 0x8c, 0x4f, 0xb9, 0xd5, 0x97, - 0x1b, 0x43, 0x4c, 0x1d, 0xea, 0x5b, - 0xc3, 0x11, 0x82, 0xfc, 0xa2, 0x4a, - 0xa0, 0x7f, 0x47, 0xaf, 0xa3, 0x0a, - 0x59, 0xad, 0xe5, 0x06, 0x2a, 0x4e, - 0x6e, 0xe3, 0x40, 0xdb, 0x53, 0x83, - 0x49, 0xb4, 0xba, 0x71, 0x95, 0x9b, - 0x51, 0xb3, 0xac, 0xd1, 0xae, 0xc4, - 0xcf, 0x4b, 0x4d, 0x69, 0x16, 0xec, - 0x0b, 0xa5, 0x91, 0x73, 0x07, 0x3b, - 0x19, 0x84, 0xc2, 0x6d, 0x8d, 0xb2, - 0xbd, 0x25, 0x48, 0x96, 0xc5, 0x20, - 0x1a, 0xa1, 0x8b, 0xc6, 0xe1, 0x3f, - 0x28, 0xa7, 0xe7, 0x12, 0x76, 0xb0, - 0x1c, 0x8e, 0xd0, 0x45, 0x90, 0xca, - 0x98, 0xd6, 0xa6, 0x36, 0x32, 0x72, - 0x8a, 0xa8, 0x0d, 0x3a, 0x9f, 0x37, - 0x3c, 0x89, 0xdd, 0x67, 0x22, 0x81, - 0xe9, 0x15, 0x41, 0x42, 0xf5, 0x2e, - 0x66, 0xd2, 0x61, 0x80, 0x0f, 0x54, - 0x93, 0xaa, 0xed, 0x5d, 0xe4, 0x7d, - 0x30, 0xc9, 0x3d, 0xe0, 0xe2, 0x26, - 0xf2, 0x08, 0xa9, 0x63, 0x24, 0x2d, - 0x8f, 0x79, 0x9c, 0xda, 0xbf, 0x55, - 0x62, 0x5c, 0x00, 0xb6, 0x27, 0x6a, - 0x0e, 0x92, 0x01, 0xd7, 0xff, 0xeb, - 0x1f, 0x74, 0x14, 0x99, 0xf7, 0x44, - 0x87, 0x33, 0x6c, 0x94, 0x13, 0x50, - 0x75, 0x68, 0x10, 0x17, 0xbb, 0x2c, - 0x6b, 0x04, 0xdf, 0xbc, 0x35, 0x6f, - 0xb7, 0xf1, 0x57, 0xc1, 0xe6, 0x7c, - 0xb8, 0x77, 0x65, 0x3e, 0x5f, 0xd3, - 0x64, 0xcb, 0x02, 0x1e, 0x38, 0xab, - 0x88, 0x60, 0x5e, 0x9d, 0xbe, 0xc8, - 0xa4, 0xd8, 0x52, 0x7b, 0x29, 0xf4, - 0x05, 0x70, 0xce, 0x78, 0x85, 0x39, - 0x23, 0xf3, 0x34, 0x58, 0x9e, 0xfb, - 0x31, 0xcc, 0x46, 0xef, 0x9a, 0x5a, - 0xfe, 0x7a, 0x56, 0xfd, 0xee, 0xde, - 0x0c, 0xf9, 0xcd, 0xc0, 0x2b, 0xd9, - 0xb5, 0x09, 0xf6, 0xc7, 0x21, 0xfa, - 0xf8, 0x03, 0xe8, 0x7e, 0x9f, 0xbd, - 0x79, 0x91, 0xcc, 0x78, 0x7f, 0xd5, - 0x1b, 0xee, 0xbb, 0xb7, 0xdc, 0xed, - 0x6d, 0x9b, 0xef, 0x58, 0xfb, 0x5d, - 0x67, 0x69, 0x1f, 0x4e, 0xaf, 0x62, - 0x4b, 0xb8, 0xa8, 0xae, 0x08, 0x60, - 0x8c, 0xad, 0x24, 0xa1, 0x48, 0x2f, - 0x8a, 0x00, 0x90, 0xb1, 0x53, 0x07, - 0x26, 0x12, 0x72, 0x9d, 0x56, 0x1c, - 0x51, 0x34, 0x46, 0x2e, 0x81, 0xcf, - 0xb3, 0xf3, 0x37, 0xf1, 0xfa, 0x3c, - 0xba, 0x06, 0x54, 0x85, 0x14, 0x59, - 0x36, 0x5e, 0xa5, 0x55, 0x0c, 0x52, - 0x89, 0xcb, 0x97, 0xe2, 0x3b, 0x11, - 0xbe, 0xd9, 0x1d, 0xfc, 0x13, 0x7d, - 0xa0, 0x05, 0x41, 0xc3, 0xc5, 0xfd, - 0x76, 0x33, 0x82, 0xcd, 0x88, 0x16, - 0x1a, 0x29, 0x87, 0x1e, 0x40, 0x6f, - 0xe8, 0x03, 0x3a, 0x50, 0xa6, 0xe4, - 0xf4, 0x4f, 0xd6, 0x98, 0x39, 0x71, - 0xd0, 0xf2, 0xf0, 0x3e, 0xea, 0x8d, - 0x2c, 0xa2, 0xa9, 0x57, 0x0b, 0x8b, - 0x0d, 0xaa, 0xe9, 0x31, 0xc2, 0x35, - 0x5c, 0xd1, 0x38, 0xff, 0x01, 0xa7, - 0xec, 0x80, 0xf9, 0x23, 0xdf, 0x30, - 0xeb, 0x2a, 0xb0, 0x17, 0xd2, 0x19, - 0x6e, 0xda, 0x25, 0x9e, 0xb6, 0x4c, - 0xc6, 0x93, 0xdb, 0x75, 0x6b, 0x3f, - 0x15, 0x73, 0xfe, 0x3d, 0x65, 0x66, - 0xb5, 0x7a, 0x9a, 0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, 0x2a, 0x41, 0x01, 0x24, 0x80, - 0x19, 0x65, 0x4d, 0x9d, 0x9c, 0xe8, - 0x13, 0xa2, 0xc0, 0xc5, 0xfe, 0x6b, - 0xce, 0x50, 0xf8, 0x04, 0x48, 0xa8, - 0x06, 0x16, 0xbe, 0x67, 0xba, 0xea, - 0xc6, 0x0f, 0xd7, 0x74, 0x85, 0xb6, - 0xd8, 0x0e, 0x4c, 0x93, 0x15, 0xbd, - 0xe6, 0x78, 0x03, 0x05, 0x32, 0xf7, - 0x34, 0xe4, 0xad, 0x30, 0x98, 0xa1, - 0x27, 0x9e, 0xf6, 0x43, 0x64, 0x3c, - 0x49, 0xbc, 0xf0, 0x99, 0xdd, 0x12, - 0xd1, 0xc9, 0x5d, 0x7c, 0x22, 0x75, - 0x1f, 0x28, 0x2f, 0x09, 0xc2, 0x84, - 0x6d, 0xfa, 0x23, 0x3f, 0x7d, 0x91, - 0x89, 0x82, 0x86, 0x58, 0xdf, 0x76, - 0xe9, 0xaa, 0xdb, 0xac, 0x2b, 0xf5, - 0x90, 0x42, 0x20, 0xe1, 0xa0, 0xed, - 0xd4, 0x52, 0x10, 0xef, 0x3e, 0xe3, - 0x1c, 0xda, 0x96, 0xb0, 0x72, 0x38, - 0x9f, 0x7a, 0x1b, 0xde, 0x02, 0xa6, - 0x4e, 0x97, 0x33, 0x36, 0x6e, 0xe0, - 0xc8, 0x4f, 0xfc, 0x37, 0x71, 0xec, - 0x94, 0x00, 0x95, 0xd0, 0xa7, 0xcb, - 0xf1, 0x70, 0xa9, 0x8b, 0x40, 0xf2, - 0x4b, 0x46, 0x45, 0xee, 0x51, 0x8d, - 0xcc, 0x6c, 0xca, 0xeb, 0x7f, 0x68, - 0x07, 0xae, 0x5e, 0x57, 0x08, 0xe7 -}; + 0xa4, 0x38, 0x33, 0x69, 0xd4, 0xf5, 0x6a, 0xa8, 0xd7, 0xec, 0x74, 0xa6, 0x7b, 0xc7, 0x3c, 0x41, 0xb7, 0x21, 0x98, 0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, 0x2f, 0x09, 0xc2, 0x84, 0x6d, 0xfa, 0x23, 0x3f, 0x7d, 0x91, 0x89, 0x82, 0x86, 0x58, 0xdf, 0x76, + 0xe9, 0xaa, 0xdb, 0xac, 0x2b, 0xf5, 0x90, 0x42, 0x20, 0xe1, 0xa0, 0xed, 0xd4, 0x52, 0x10, 0xef, 0x3e, 0xe3, 0x1c, 0xda, 0x96, 0xb0, 0x72, 0x38, + 0x9f, 0x7a, 0x1b, 0xde, 0x02, 0xa6, 0x4e, 0x97, 0x33, 0x36, 0x6e, 0xe0, 0xc8, 0x4f, 0xfc, 0x37, 0x71, 0xec, 0x94, 0x00, 0x95, 0xd0, 0xa7, 0xcb, + 0xf1, 0x70, 0xa9, 0x8b, 0x40, 0xf2, 0x4b, 0x46, 0x45, 0xee, 0x51, 0x8d, 0xcc, 0x6c, 0xca, 0xeb, 0x7f, 0x68, 0x07, 0xae, 0x5e, 0x57, 0x08, 0xe7}; static u8 SEED; static u8 NUM_A; @@ -825,7 +234,7 @@ static u8 rol(u8 x, u8 shift) { void WPADiCreateKey(s32 chan) { BOOL intrStatus; - WPADCB *p = _wpdcb[chan]; + WPADCB* p = _wpdcb[chan]; u8 numRand; u8 num; @@ -849,11 +258,12 @@ void WPADiCreateKey(s32 chan) { DEBUGPrint("ans : %d %d %d %d %d %d\n", base[num], base[num + 1], base[num + 2], base[num + 3], base[num + 4], base[num + 5]); DEBUGPrint("rand: %d %d %d %d %d %d %d %d %d %d\n", key1[0], key1[1], key1[2], key1[3], key1[4], key1[5], key1[6], key1[7], key1[8], key1[9]); - DEBUGPrint("t0 : %d %d %d %d %d %d %d %d %d %d\n", tb[key1[0]], tb[key1[1]], tb[key1[2]], tb[key1[3]], tb[key1[4]], tb[key1[5]], tb[key1[6]], tb[key1[7]], tb[key1[8]], tb[key1[9]]); + DEBUGPrint("t0 : %d %d %d %d %d %d %d %d %d %d\n", tb[key1[0]], tb[key1[1]], tb[key1[2]], tb[key1[3]], tb[key1[4]], tb[key1[5]], tb[key1[6]], + tb[key1[7]], tb[key1[8]], tb[key1[9]]); intrStatus = OSDisableInterrupts(); - key2[0] = ror(base[num] ^ tb[key1[5]], tb[key1[2]]) - tb[key1[9]] ^ tb[key1[4]]; + key2[0] = ror(base[num] ^ tb[key1[5]], tb[key1[2]]) - tb[key1[9]] ^ tb[key1[4]]; key2[1] = ror(base[num + 1] ^ tb[key1[1]], tb[key1[0]]) - tb[key1[5]] ^ tb[key1[7]]; key2[2] = ror(base[num + 2] ^ tb[key1[6]], tb[key1[8]]) - tb[key1[2]] ^ tb[key1[0]]; key2[3] = ror(base[num + 3] ^ tb[key1[4]], tb[key1[7]]) - tb[key1[3]] ^ tb[key1[2]]; @@ -882,8 +292,10 @@ void WPADiCreateKey(s32 chan) { xorTable[6] = tb[key1[3] + ((numRand + 1) << 8)] ^ tb[key1[5] + ((numRand + 2) << 8)]; xorTable[7] = tb[key1[2] + ((numRand + 1) << 8)] ^ tb[key1[6] + ((numRand + 2) << 8)]; - DEBUGPrint("ft : %d %d %d %d %d %d %d %d\n", addTable[0], addTable[1], addTable[2], addTable[3], addTable[4], addTable[5], addTable[6], addTable[7]); - DEBUGPrint("sb : %d %d %d %d %d %d %d %d\n", xorTable[0], xorTable[1], xorTable[2], xorTable[3], xorTable[4], xorTable[5], xorTable[6], xorTable[7]); + DEBUGPrint("ft : %d %d %d %d %d %d %d %d\n", addTable[0], addTable[1], addTable[2], addTable[3], addTable[4], addTable[5], addTable[6], + addTable[7]); + DEBUGPrint("sb : %d %d %d %d %d %d %d %d\n", xorTable[0], xorTable[1], xorTable[2], xorTable[3], xorTable[4], xorTable[5], xorTable[6], + xorTable[7]); for (i = 0; i < (int)ARRAY_LENGTH(key1); i++) { p->encryptionKey[i] = key1[(ARRAY_LENGTH(key1) - 1) - i]; @@ -901,7 +313,7 @@ void WPADiCreateKey(s32 chan) { void WPADiCreateKeyFor3rd(s32 chan) { BOOL intrStatus; - WPADCB *p = _wpdcb[chan]; + WPADCB* p = _wpdcb[chan]; u8 numRand; u8 num; @@ -925,11 +337,12 @@ void WPADiCreateKeyFor3rd(s32 chan) { DEBUGPrint("ans : %d %d %d %d %d %d\n", base3[num], base3[num + 1], base3[num + 2], base3[num + 3], base3[num + 4], base3[num + 5]); DEBUGPrint("rand: %d %d %d %d %d %d %d %d %d %d\n", key1[0], key1[1], key1[2], key1[3], key1[4], key1[5], key1[6], key1[7], key1[8], key1[9]); - DEBUGPrint("t0 : %d %d %d %d %d %d %d %d %d %d\n", tb3[key1[0]], tb3[key1[1]], tb3[key1[2]], tb3[key1[3]], tb3[key1[4]], tb3[key1[5]], tb3[key1[6]], tb3[key1[7]], tb3[key1[8]], tb3[key1[9]]); + DEBUGPrint("t0 : %d %d %d %d %d %d %d %d %d %d\n", tb3[key1[0]], tb3[key1[1]], tb3[key1[2]], tb3[key1[3]], tb3[key1[4]], tb3[key1[5]], + tb3[key1[6]], tb3[key1[7]], tb3[key1[8]], tb3[key1[9]]); intrStatus = OSDisableInterrupts(); - key2[0] = rol(base3[num] ^ tb3[key1[0]], tb3[key1[1]]) + tb3[key1[6]] ^ tb3[key1[7]]; + key2[0] = rol(base3[num] ^ tb3[key1[0]], tb3[key1[1]]) + tb3[key1[6]] ^ tb3[key1[7]]; key2[1] = rol(base3[num + 1] ^ tb3[key1[4]], tb3[key1[2]]) + tb3[key1[3]] ^ tb3[key1[1]]; key2[2] = rol(base3[num + 2] ^ tb3[key1[2]], tb3[key1[8]]) + tb3[key1[4]] ^ tb3[key1[5]]; key2[3] = rol(base3[num + 3] ^ tb3[key1[6]], tb3[key1[9]]) + tb3[key1[7]] ^ tb3[key1[0]]; @@ -958,8 +371,10 @@ void WPADiCreateKeyFor3rd(s32 chan) { xorTable[6] = tb3[key1[3] + ((numRand + 1) << 8)] ^ tb3[key1[5] + ((numRand + 2) << 8)]; xorTable[7] = tb3[key1[2] + ((numRand + 1) << 8)] ^ tb3[key1[6] + ((numRand + 2) << 8)]; - DEBUGPrint("ft : %d %d %d %d %d %d %d %d\n", addTable[0], addTable[1], addTable[2], addTable[3], addTable[4], addTable[5], addTable[6], addTable[7]); - DEBUGPrint("sb : %d %d %d %d %d %d %d %d\n", xorTable[0], xorTable[1], xorTable[2], xorTable[3], xorTable[4], xorTable[5], xorTable[6], xorTable[7]); + DEBUGPrint("ft : %d %d %d %d %d %d %d %d\n", addTable[0], addTable[1], addTable[2], addTable[3], addTable[4], addTable[5], addTable[6], + addTable[7]); + DEBUGPrint("sb : %d %d %d %d %d %d %d %d\n", xorTable[0], xorTable[1], xorTable[2], xorTable[3], xorTable[4], xorTable[5], xorTable[6], + xorTable[7]); for (i = 0; i < (int)ARRAY_LENGTH(key1); i++) { p->encryptionKey[i] = key1[(ARRAY_LENGTH(key1) - 1) - i]; diff --git a/libs/RVL_SDK/src/wpad/WPADMem.c b/libs/RVL_SDK/src/wpad/WPADMem.c index 2da5ad91..a7d6d265 100644 --- a/libs/RVL_SDK/src/wpad/WPADMem.c +++ b/libs/RVL_SDK/src/wpad/WPADMem.c @@ -1,4 +1,4 @@ -#include #include +#include WPADMemBlock _wmb[WPAD_MAX_CONTROLLERS]; diff --git a/libs/RVL_SDK/src/wud/WUD.c b/libs/RVL_SDK/src/wud/WUD.c index 46e61ce5..6ea203ea 100644 --- a/libs/RVL_SDK/src/wud/WUD.c +++ b/libs/RVL_SDK/src/wud/WUD.c @@ -1,8 +1,8 @@ #include +#include #include #include -#include #include #include #include @@ -16,8 +16,8 @@ extern u8 _scFlush; #define DEBUGPrint WUD_DEBUGPrint -#define BT_VSC_NINTENDO_INSTALL_PATCH 0xFC4F -#define BT_VSC_NINTENDO_WRITE_PATCH 0xFC4C +#define BT_VSC_NINTENDO_INSTALL_PATCH 0xFC4F +#define BT_VSC_NINTENDO_WRITE_PATCH 0xFC4C void WUDSecurityCallback(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* pData); void WUDSearchCallback(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* pData); @@ -33,161 +33,161 @@ static void WUDiRemovePatch(); static void WUDiWritePatch(); static void WUDiInstallPatch(); -WUDCB _wcb; -WUDDevInfo _work; +WUDCB _wcb; +WUDDevInfo _work; static WUDDiscResp _discResp; SCBtDeviceInfoArray _scArray; SCBtCmpDevInfoArray _spArray; -u8 __WUDHandlerStack[0x1000] ALIGN32; +u8 __WUDHandlerStack[0x1000] ALIGN32; BD_ADDR_PTR _dev_handle_to_bda[WUD_MAX_DEV_ENTRY]; -u16 _dev_handle_queue_size[WUD_MAX_DEV_ENTRY]; -u16 _dev_handle_notack_num[WUD_MAX_DEV_ENTRY]; +u16 _dev_handle_queue_size[WUD_MAX_DEV_ENTRY]; +u16 _dev_handle_notack_num[WUD_MAX_DEV_ENTRY]; static BOOL _initialized = FALSE; -static u8 __bte_trace_level = BT_TRACE_LEVEL_NONE; +static u8 __bte_trace_level = BT_TRACE_LEVEL_NONE; static BOOL _wudReadNand = FALSE; -static u8 _discNumResps; -static s8 _discRssi; -static u8 _wudTarget; +static u8 _discNumResps; +static s8 _discRssi; +static u8 _wudTarget; static u8 descriptor[] = { - 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) - 0x09, 0x05, // Usage (Game Pad) + 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) + 0x09, 0x05, // Usage (Game Pad) - 0xA1, 0x01, // Collection (Application) + 0xA1, 0x01, // Collection (Application) - 0x85, 0x10, // Report ID (16) - 0x15, 0x00, // Logical Minimum (0) - 0x26, 0xFF, 0x00, // Logical Maximum (255) - 0x75, 0x08, // Report Size (8) - 0x95, 0x01, // Report Count (1) - 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00) - 0x09, 0x01, // Usage (0x01) - 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x85, 0x10, // Report ID (16) + 0x15, 0x00, // Logical Minimum (0) + 0x26, 0xFF, 0x00, // Logical Maximum (255) + 0x75, 0x08, // Report Size (8) + 0x95, 0x01, // Report Count (1) + 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00) + 0x09, 0x01, // Usage (0x01) + 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) - 0x85, 0x11, // Report ID (17) - 0x95, 0x01, // Report Count (1) - 0x09, 0x01, // Usage (0x01) - 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x85, 0x11, // Report ID (17) + 0x95, 0x01, // Report Count (1) + 0x09, 0x01, // Usage (0x01) + 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) - 0x85, 0x12, // Report ID (18) - 0x95, 0x02, // Report Count (2) - 0x09, 0x01, // Usage (0x01) - 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x85, 0x12, // Report ID (18) + 0x95, 0x02, // Report Count (2) + 0x09, 0x01, // Usage (0x01) + 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) - 0x85, 0x13, // Report ID (19) - 0x95, 0x01, // Report Count (1) - 0x09, 0x01, // Usage (0x01) - 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x85, 0x13, // Report ID (19) + 0x95, 0x01, // Report Count (1) + 0x09, 0x01, // Usage (0x01) + 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) - 0x85, 0x14, // Report ID (20) - 0x95, 0x01, // Report Count (1) - 0x09, 0x01, // Usage (0x01) - 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x85, 0x14, // Report ID (20) + 0x95, 0x01, // Report Count (1) + 0x09, 0x01, // Usage (0x01) + 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) - 0x85, 0x15, // Report ID (21) - 0x95, 0x01, // Report Count (1) - 0x09, 0x01, // Usage (0x01) - 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x85, 0x15, // Report ID (21) + 0x95, 0x01, // Report Count (1) + 0x09, 0x01, // Usage (0x01) + 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) - 0x85, 0x16, // Report ID (22) - 0x95, 0x15, // Report Count (21) - 0x09, 0x01, // Usage (0x01) - 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x85, 0x16, // Report ID (22) + 0x95, 0x15, // Report Count (21) + 0x09, 0x01, // Usage (0x01) + 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) - 0x85, 0x17, // Report ID (23) - 0x95, 0x06, // Report Count (6) - 0x09, 0x01, // Usage (0x01) - 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x85, 0x17, // Report ID (23) + 0x95, 0x06, // Report Count (6) + 0x09, 0x01, // Usage (0x01) + 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) - 0x85, 0x18, // Report ID (24) - 0x95, 0x15, // Report Count (21) - 0x09, 0x01, // Usage (0x01) - 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x85, 0x18, // Report ID (24) + 0x95, 0x15, // Report Count (21) + 0x09, 0x01, // Usage (0x01) + 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) - 0x85, 0x19, // Report ID (25) - 0x95, 0x01, // Report Count (1) - 0x09, 0x01, // Usage (0x01) - 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x85, 0x19, // Report ID (25) + 0x95, 0x01, // Report Count (1) + 0x09, 0x01, // Usage (0x01) + 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) - 0x85, 0x1A, // Report ID (26) - 0x95, 0x01, // Report Count (1) - 0x09, 0x01, // Usage (0x01) - 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) + 0x85, 0x1A, // Report ID (26) + 0x95, 0x01, // Report Count (1) + 0x09, 0x01, // Usage (0x01) + 0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) - 0x85, 0x20, // Report ID (32) - 0x95, 0x06, // Report Count (6) - 0x09, 0x01, // Usage (0x01) - 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x85, 0x20, // Report ID (32) + 0x95, 0x06, // Report Count (6) + 0x09, 0x01, // Usage (0x01) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - 0x85, 0x21, // Report ID (33) - 0x95, 0x15, // Report Count (21) - 0x09, 0x01, // Usage (0x01) - 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x85, 0x21, // Report ID (33) + 0x95, 0x15, // Report Count (21) + 0x09, 0x01, // Usage (0x01) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - 0x85, 0x22, // Report ID (34) - 0x95, 0x04, // Report Count (4) - 0x09, 0x01, // Usage (0x01) - 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x85, 0x22, // Report ID (34) + 0x95, 0x04, // Report Count (4) + 0x09, 0x01, // Usage (0x01) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - 0x85, 0x30, // Report ID (48) - 0x95, 0x02, // Report Count (2) - 0x09, 0x01, // Usage (0x01) - 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x85, 0x30, // Report ID (48) + 0x95, 0x02, // Report Count (2) + 0x09, 0x01, // Usage (0x01) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - 0x85, 0x31, // Report ID (49) - 0x95, 0x05, // Report Count (5) - 0x09, 0x01, // Usage (0x01) - 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x85, 0x31, // Report ID (49) + 0x95, 0x05, // Report Count (5) + 0x09, 0x01, // Usage (0x01) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - 0x85, 0x32, // Report ID (50) - 0x95, 0x0A, // Report Count (10) - 0x09, 0x01, // Usage (0x01) - 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x85, 0x32, // Report ID (50) + 0x95, 0x0A, // Report Count (10) + 0x09, 0x01, // Usage (0x01) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - 0x85, 0x33, // Report ID (51) - 0x95, 0x11, // Report Count (17) - 0x09, 0x01, // Usage (0x01) - 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x85, 0x33, // Report ID (51) + 0x95, 0x11, // Report Count (17) + 0x09, 0x01, // Usage (0x01) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - 0x85, 0x34, // Report ID (52) - 0x95, 0x15, // Report Count (21) - 0x09, 0x01, // Usage (0x01) - 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x85, 0x34, // Report ID (52) + 0x95, 0x15, // Report Count (21) + 0x09, 0x01, // Usage (0x01) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - 0x85, 0x35, // Report ID (53) - 0x95, 0x15, // Report Count (21) - 0x09, 0x01, // Usage (0x01) - 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x85, 0x35, // Report ID (53) + 0x95, 0x15, // Report Count (21) + 0x09, 0x01, // Usage (0x01) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - 0x85, 0x36, // Report ID (54) - 0x95, 0x15, // Report Count (21) - 0x09, 0x01, // Usage (0x01) - 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x85, 0x36, // Report ID (54) + 0x95, 0x15, // Report Count (21) + 0x09, 0x01, // Usage (0x01) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - 0x85, 0x37, // Report ID (55) - 0x95, 0x15, // Report Count (21) - 0x09, 0x01, // Usage (0x01) - 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x85, 0x37, // Report ID (55) + 0x95, 0x15, // Report Count (21) + 0x09, 0x01, // Usage (0x01) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - 0x85, 0x3D, // Report ID (61) - 0x95, 0x15, // Report Count (21) - 0x09, 0x01, // Usage (0x01) - 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x85, 0x3D, // Report ID (61) + 0x95, 0x15, // Report Count (21) + 0x09, 0x01, // Usage (0x01) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - 0x85, 0x3E, // Report ID (62) - 0x95, 0x15, // Report Count (21) - 0x09, 0x01, // Usage (0x01) - 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x85, 0x3E, // Report ID (62) + 0x95, 0x15, // Report Count (21) + 0x09, 0x01, // Usage (0x01) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - 0x85, 0x3F, // Report ID (63) - 0x95, 0x15, // Report Count (21) - 0x09, 0x01, // Usage (0x01) - 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) + 0x85, 0x3F, // Report ID (63) + 0x95, 0x15, // Report Count (21) + 0x09, 0x01, // Usage (0x01) + 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) - 0xC0, // End Collection + 0xC0, // End Collection }; void* App_MEMalloc(u32 size) { @@ -224,13 +224,11 @@ static void SyncFlushCallback(SCStatus status) { if (status == SC_STATUS_OK) { p->syncState = WUD_STATE_SYNC_COMPLETE; - } - else { + } else { p->syncState = WUD_STATE_SYNC_ERROR; } } - static void DeleteFlushCallback(SCStatus status) { WUDCB* p = &_wcb; @@ -242,8 +240,7 @@ static void DeleteFlushCallback(SCStatus status) { if (status == SC_STATUS_OK) { p->deleteState = WUD_STATE_DELETE_DONE; - } - else { + } else { p->deleteState = WUD_STATE_DELETE_DONE; } } @@ -280,7 +277,6 @@ static u8 WUDiWaitForIncomingConnection() { return nextState; } - static u8 WUDiIsSyncDisabled() { WUDCB* p = &_wcb; int i; @@ -292,8 +288,7 @@ static u8 WUDiIsSyncDisabled() { return WUD_STATE_SYNC_DONE; } - if (WUDiGetLinkNum() == WUD_MAX_CHANNELS && - WUDiGetConnNumber() == WUD_MAX_CHANNELS) { + if (WUDiGetLinkNum() == WUD_MAX_CHANNELS && WUDiGetConnNumber() == WUD_MAX_CHANNELS) { return WUD_STATE_SYNC_DONE; } @@ -327,12 +322,10 @@ static u8 WUDiStartSearch() { if (p->syncSkipChecks) { dm_inq.duration = 5 - 2; - } - else if (p->syncType == WUD_SYNC_TYPE_STANDARD) { + } else if (p->syncType == WUD_SYNC_TYPE_STANDARD) { dm_inq.duration = WUDiGetLinkNum() == WUD_MAX_CHANNELS - 1 ? 10 : 5; dm_inq.duration -= p->syncLoopNum; - } - else { + } else { dm_inq.duration = WUDiGetLinkNum() == WUD_MAX_CHANNELS - 1 ? 10 - 2 : 5 - 2; } @@ -342,11 +335,8 @@ static u8 WUDiStartSearch() { return WUD_STATE_SYNC_WAIT_FOR_SEARCH_RESULT; } - static u8 WUDiWaitForSearchResult() { - if (WUDiGetLinkNum() == WUD_MAX_CHANNELS && - WUDiGetConnNumber() == WUD_MAX_CHANNELS) { - + if (WUDiGetLinkNum() == WUD_MAX_CHANNELS && WUDiGetConnNumber() == WUD_MAX_CHANNELS) { DEBUGPrint("Cancel searching because 4 connections exist.\n"); BTA_DmSearchCancel(); @@ -379,7 +369,6 @@ static u8 WUDiNextStepBySearchResult() { return nextState; } - static u8 WUDiCheckDeviceDataBase() { WUDDevInfo* pInfo; WUDSyncState nextState = WUD_STATE_SYNC_PREPARE_FOR_UNKNOWN_DEVICE; @@ -408,8 +397,7 @@ static u8 WUDiExistedDevice() { WUDiMoveBottomStdDevInfoPtr(pWork); WUDiRemoveDevice(pWork->devAddr); return WUD_STATE_SYNC_PREPARE_FOR_UNKNOWN_DEVICE; - } - else { + } else { pWork->UNK_0x5B = 4; } @@ -500,8 +488,7 @@ static u8 WUDiSaveDeviceToNand() { if (!SCSetBtDeviceInfoArray(&_scArray)) { nextState = WUD_STATE_SYNC_STORED_DEV_INFO_TO_NAND; - } - else { + } else { nextState = WUD_STATE_SYNC_SC_FLUSH; } @@ -557,7 +544,7 @@ static u8 WUDiVirginStandardSync() { } pInfo = WUDiGetNewDevInfo(); - + if (!pInfo) { return WUD_STATE_SYNC_ERROR; } @@ -630,15 +617,13 @@ static u8 WUDiStoredLinkKey() { DEBUGPrint("write stored link key\n"); - DEBUGPrint("addr : %02x:%02x:%02x:%02x:%02x:%02x\n", - pInfo->devAddr[0], pInfo->devAddr[1], pInfo->devAddr[2], - pInfo->devAddr[3], pInfo->devAddr[4], pInfo->devAddr[5]); + DEBUGPrint("addr : %02x:%02x:%02x:%02x:%02x:%02x\n", pInfo->devAddr[0], pInfo->devAddr[1], pInfo->devAddr[2], pInfo->devAddr[3], + pInfo->devAddr[4], pInfo->devAddr[5]); - DEBUGPrint("key : %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pInfo->linkKey[0], pInfo->linkKey[1], pInfo->linkKey[2], pInfo->linkKey[3], - pInfo->linkKey[4], pInfo->linkKey[5], pInfo->linkKey[6], pInfo->linkKey[7], - pInfo->linkKey[8], pInfo->linkKey[9], pInfo->linkKey[10], pInfo->linkKey[11], - pInfo->linkKey[12], pInfo->linkKey[13], pInfo->linkKey[14], pInfo->linkKey[15]); + DEBUGPrint("key : %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", pInfo->linkKey[0], pInfo->linkKey[1], + pInfo->linkKey[2], pInfo->linkKey[3], pInfo->linkKey[4], pInfo->linkKey[5], pInfo->linkKey[6], pInfo->linkKey[7], pInfo->linkKey[8], + pInfo->linkKey[9], pInfo->linkKey[10], pInfo->linkKey[11], pInfo->linkKey[12], pInfo->linkKey[13], pInfo->linkKey[14], + pInfo->linkKey[15]); p->linkKeyState = WUD_STATE_LINK_KEY_WRITING; @@ -707,9 +692,8 @@ static u8 WUDiSyncDone() { return WUD_STATE_SYNC_START; } -static WUDSyncState WUDiSyncWaitForStartSearch() -{ - WUDCB *p = &_wcb; +static WUDSyncState WUDiSyncWaitForStartSearch() { + WUDCB* p = &_wcb; if (!p->syncLoopNum) { return WUD_STATE_SYNC_DONE; @@ -721,8 +705,7 @@ static WUDSyncState WUDiSyncWaitForStartSearch() if (--p->waitStartSearchFrames < 0) { return WUD_STATE_SYNC_START_SEARCH; - } - else { + } else { return WUD_STATE_SYNC_WAIT_FOR_START_SEARCH; } } @@ -910,8 +893,7 @@ static void WUDiCleanUp() { if (success) { p->deleteState = WUD_STATE_DELETE_6; SCFlushAsync(DeleteFlushCallback); - } - else { + } else { p->deleteState = WUD_STATE_DELETE_DONE; } } @@ -1062,13 +1044,13 @@ static WUDInitState WUDiWaitSCSetup() { static BOOL WUDiDeviceExists(u8* addr) { int i; - + for (i = 0; i < _scArray.numRegist; i++) { if (WUD_BDCMP(_scArray.devices[i].addr, addr) == 0) { return TRUE; } } - + return FALSE; } @@ -1130,9 +1112,8 @@ static WUDInitState WUDiGetRegisteredDevice() { pInfo->hhAttrMask = 0x8074; pInfo->appID = 3; - DEBUGPrint("addr : %02x:%02x:%02x:%02x:%02x:%02x\n", - pInfo->devAddr[0], pInfo->devAddr[1], pInfo->devAddr[2], - pInfo->devAddr[3], pInfo->devAddr[4], pInfo->devAddr[5]); + DEBUGPrint("addr : %02x:%02x:%02x:%02x:%02x:%02x\n", pInfo->devAddr[0], pInfo->devAddr[1], pInfo->devAddr[2], pInfo->devAddr[3], + pInfo->devAddr[4], pInfo->devAddr[5]); DEBUGPrint("name : %s\n", pInfo->conf.devName); a++; @@ -1145,7 +1126,7 @@ static WUDInitState WUDiGetRegisteredDevice() { _scArray.numRegist = a; - for (i = WUD_MAX_DEV_ENTRY_FOR_SMP-1; i >= 0; i--) { + for (i = WUD_MAX_DEV_ENTRY_FOR_SMP - 1; i >= 0; i--) { if (arrayNum == 0) { break; } @@ -1177,9 +1158,8 @@ static WUDInitState WUDiGetRegisteredDevice() { pInfo->appID = 3; } - WUD_DEBUGPrint("addr : %02x:%02x:%02x:%02x:%02x:%02x\n", - pInfo->devAddr[0], pInfo->devAddr[1], pInfo->devAddr[2], - pInfo->devAddr[3], pInfo->devAddr[4], pInfo->devAddr[5]); + WUD_DEBUGPrint("addr : %02x:%02x:%02x:%02x:%02x:%02x\n", pInfo->devAddr[0], pInfo->devAddr[1], pInfo->devAddr[2], pInfo->devAddr[3], + pInfo->devAddr[4], pInfo->devAddr[5]); WUD_DEBUGPrint("name : %s\n", pInfo->conf.devName); WUDiMoveTopSmpDevInfoPtr(pInfo); @@ -1246,8 +1226,7 @@ static void WUDiContMapTableFlush() { if (result) { p->shutdownState = WUD_STATE_SHUTDOWN_FLUSH_SETTINGS; SCFlushAsync(ShutFlushCallback); - } - else { + } else { p->shutdownState = WUD_STATE_SHUTDOWN_DONE; } } @@ -1371,7 +1350,6 @@ BOOL WUDInit() { return TRUE; } - void WUDRegisterAllocator(WUDAllocFunc pAllocFunc, WUDFreeFunc pFreeFunc) { WUDCB* p = &_wcb; BOOL enabled; @@ -1423,8 +1401,7 @@ void WUDShutdown(BOOL saveSmp) { } _spArray.numRegist = WUDiGetDevSmpNumber(); - } - else { + } else { _spArray.numRegist = 0; } @@ -1465,8 +1442,7 @@ void WUDSetSniffMode(BD_ADDR addr, s32 interval) { if (interval > 0) { block.mode = BTM_PM_MD_SNIFF; - } - else { + } else { block.mode = BTM_PM_MD_ACTIVE; } @@ -1697,8 +1673,7 @@ BOOL WUDSetDisableChannel(s8 afhChannel) { if (!afhChannel) { first = 0xFF; last = 0xFF; - } - else { + } else { first = (afhChannel + 1) * 5 - 14; last = (afhChannel + 1) * 5 + 14; @@ -1784,70 +1759,28 @@ void reset_again() { BTM_DeviceReset(WUDiModuleRebootCallback); } -static u8 patch_binary[] = { - 0x70, 0x99, 0x08, 0x00, // address (little-endian) - 0xB4, 0x00, 0x00, 0x00, // size (little-endian) +static u8 patch_binary[] = {0x70, 0x99, 0x08, 0x00, // address (little-endian) + 0xB4, 0x00, 0x00, 0x00, // size (little-endian) - // patch data - 0x88, 0x43, 0xD1, 0x07, - 0x09, 0x0C, 0x08, 0x43, - 0xA0, 0x62, 0x19, 0x23, - 0xDB, 0x01, 0x33, 0x80, - 0x7C, 0xF7, 0x88, 0xF8, - 0x28, 0x76, 0x80, 0xF7, - 0x17, 0xFF, 0x43, 0x78, - 0xEB, 0x70, 0x19, 0x23, - 0xDB, 0x01, 0x33, 0x87, - 0x7C, 0xF7, 0xBC, 0xFB, - 0x0B, 0x60, 0xA3, 0x7B, - 0x01, 0x49, 0x0B, 0x60, - 0x90, 0xF7, 0x96, 0xFB, - 0xD8, 0x1D, 0x08, 0x00, - 0x00, 0xF0, 0x04, 0xF8, - 0x00, 0x23, 0x79, 0xF7, - 0xE3, 0xFA, 0x00, 0x00, - 0x00, 0xB5, 0x00, 0x23, - 0x11, 0x49, 0x0B, 0x60, - 0x1D, 0x21, 0xC9, 0x03, - 0x0B, 0x60, 0x7D, 0x20, - 0x80, 0x01, 0x01, 0x38, - 0xFD, 0xD1, 0x0E, 0x4B, - 0x0E, 0x4A, 0x13, 0x60, - 0x47, 0x20, 0x00, 0x21, - 0x96, 0xF7, 0x96, 0xFF, - 0x46, 0x20, 0x00, 0x21, - 0x96, 0xF7, 0x92, 0xFF, - 0x0A, 0x4A, 0x13, 0x68, - 0x0A, 0x48, 0x03, 0x40, - 0x13, 0x60, 0x0A, 0x4A, - 0x13, 0x68, 0x0A, 0x48, - 0x03, 0x40, 0x13, 0x60, - 0x09, 0x4A, 0x13, 0x68, - 0x09, 0x48, 0x03, 0x40, - 0x13, 0x60, 0x00, 0xBD, - 0x24, 0x80, 0x0E, 0x00, - 0x81, 0x03, 0x0F, 0xFE, - 0x5C, 0x00, 0x0F, 0x00, - 0x60, 0xFC, 0x0E, 0x00, - 0xFE, 0xFF, 0x00, 0x00, - 0xFC, 0xFC, 0x0E, 0x00, - 0xFF, 0x9F, 0x00, 0x00, - 0x30, 0xFC, 0x0E, 0x00, - 0x7F, 0xFF, 0x00, 0x00 -}; + // patch data + 0x88, 0x43, 0xD1, 0x07, 0x09, 0x0C, 0x08, 0x43, 0xA0, 0x62, 0x19, 0x23, 0xDB, 0x01, 0x33, 0x80, 0x7C, 0xF7, 0x88, 0xF8, + 0x28, 0x76, 0x80, 0xF7, 0x17, 0xFF, 0x43, 0x78, 0xEB, 0x70, 0x19, 0x23, 0xDB, 0x01, 0x33, 0x87, 0x7C, 0xF7, 0xBC, 0xFB, + 0x0B, 0x60, 0xA3, 0x7B, 0x01, 0x49, 0x0B, 0x60, 0x90, 0xF7, 0x96, 0xFB, 0xD8, 0x1D, 0x08, 0x00, 0x00, 0xF0, 0x04, 0xF8, + 0x00, 0x23, 0x79, 0xF7, 0xE3, 0xFA, 0x00, 0x00, 0x00, 0xB5, 0x00, 0x23, 0x11, 0x49, 0x0B, 0x60, 0x1D, 0x21, 0xC9, 0x03, + 0x0B, 0x60, 0x7D, 0x20, 0x80, 0x01, 0x01, 0x38, 0xFD, 0xD1, 0x0E, 0x4B, 0x0E, 0x4A, 0x13, 0x60, 0x47, 0x20, 0x00, 0x21, + 0x96, 0xF7, 0x96, 0xFF, 0x46, 0x20, 0x00, 0x21, 0x96, 0xF7, 0x92, 0xFF, 0x0A, 0x4A, 0x13, 0x68, 0x0A, 0x48, 0x03, 0x40, + 0x13, 0x60, 0x0A, 0x4A, 0x13, 0x68, 0x0A, 0x48, 0x03, 0x40, 0x13, 0x60, 0x09, 0x4A, 0x13, 0x68, 0x09, 0x48, 0x03, 0x40, + 0x13, 0x60, 0x00, 0xBD, 0x24, 0x80, 0x0E, 0x00, 0x81, 0x03, 0x0F, 0xFE, 0x5C, 0x00, 0x0F, 0x00, 0x60, 0xFC, 0x0E, 0x00, + 0xFE, 0xFF, 0x00, 0x00, 0xFC, 0xFC, 0x0E, 0x00, 0xFF, 0x9F, 0x00, 0x00, 0x30, 0xFC, 0x0E, 0x00, 0x7F, 0xFF, 0x00, 0x00}; -static WUDPatchList patch_install = { - 7, - { - {0x20, 0xBC, 0x65, 0x01, 0x00, 0x84, 0x42, 0x09, 0xD2, 0x84, 0x42, 0x09, 0xD1}, - {0x21, 0x84, 0x5A, 0x00, 0x00, 0x83, 0xF0, 0x74, 0xFF, 0x09, 0x0C, 0x08, 0x43}, - {0x22, 0x00, 0x61, 0x00, 0x00, 0x83, 0xF0, 0x40, 0xFC, 0x00, 0x00, 0x00, 0x00}, - {0x23, 0xCC, 0x9F, 0x01, 0x00, 0x6F, 0xF0, 0xE4, 0xFC, 0x03, 0x28, 0x7D, 0xD1}, - {0x24, 0x3C, 0x62, 0x01, 0x00, 0x28, 0x20, 0x00, 0xE0, 0x60, 0x8D, 0x23, 0x68}, - {0x25, 0x04, 0x12, 0x01, 0x00, 0x20, 0x1C, 0x20, 0x1C, 0x24, 0xE0, 0xB0, 0x21}, - {0x26, 0x74, 0x2F, 0x00, 0x00, 0x86, 0xF0, 0x18, 0xFD, 0x21, 0x4F, 0x3B, 0x60} - } -}; +static WUDPatchList patch_install = {7, + {{0x20, 0xBC, 0x65, 0x01, 0x00, 0x84, 0x42, 0x09, 0xD2, 0x84, 0x42, 0x09, 0xD1}, + {0x21, 0x84, 0x5A, 0x00, 0x00, 0x83, 0xF0, 0x74, 0xFF, 0x09, 0x0C, 0x08, 0x43}, + {0x22, 0x00, 0x61, 0x00, 0x00, 0x83, 0xF0, 0x40, 0xFC, 0x00, 0x00, 0x00, 0x00}, + {0x23, 0xCC, 0x9F, 0x01, 0x00, 0x6F, 0xF0, 0xE4, 0xFC, 0x03, 0x28, 0x7D, 0xD1}, + {0x24, 0x3C, 0x62, 0x01, 0x00, 0x28, 0x20, 0x00, 0xE0, 0x60, 0x8D, 0x23, 0x68}, + {0x25, 0x04, 0x12, 0x01, 0x00, 0x20, 0x1C, 0x20, 0x1C, 0x24, 0xE0, 0xB0, 0x21}, + {0x26, 0x74, 0x2F, 0x00, 0x00, 0x86, 0xF0, 0x18, 0xFD, 0x21, 0x4F, 0x3B, 0x60}}}; static u8 remove_patch[] = {0x00}; @@ -1861,17 +1794,14 @@ static u32 size = 0; static void remove_patch_cb(void* p1) { if (p1 == NULL) { reset_again(); - } - else { + } else { offset = 0; WUDiWritePatch(); } } static void WUDiRemovePatch() { - BTM_VendorSpecificCommand(BT_VSC_NINTENDO_INSTALL_PATCH, - sizeof(remove_patch), remove_patch, - remove_patch_cb); + BTM_VendorSpecificCommand(BT_VSC_NINTENDO_INSTALL_PATCH, sizeof(remove_patch), remove_patch, remove_patch_cb); } static void write_patch_cb(void* p1) { @@ -1880,12 +1810,10 @@ static void write_patch_cb(void* p1) { install_num = 0; patch_num = patch_install.num; WUDiInstallPatch(); - } - else { + } else { WUDiWritePatch(); } - } - else { + } else { reset_again(); } } @@ -1902,25 +1830,21 @@ static void WUDiWritePatch() { } for (i = 0; i < (s32)length; i++) { - buf[(s32)sizeof(u32) + i] = - patch_binary[sizeof(size) + sizeof(offset) + offset + i]; + buf[(s32)sizeof(u32) + i] = patch_binary[sizeof(size) + sizeof(offset) + offset + i]; } offset += length; - BTM_VendorSpecificCommand(BT_VSC_NINTENDO_WRITE_PATCH, - (s32)sizeof(u32) + length, buf, write_patch_cb); + BTM_VendorSpecificCommand(BT_VSC_NINTENDO_WRITE_PATCH, (s32)sizeof(u32) + length, buf, write_patch_cb); } static void install_patch_cb(void* p1) { if (p1 != NULL) { if (patch_num == install_num) { reset_again(); - } - else { + } else { WUDiInstallPatch(); } - } - else { + } else { reset_again(); } } @@ -1935,9 +1859,7 @@ static void WUDiInstallPatch() { memcpy(&buf[offsetof(WUDPatchList, cmds)], patch_install.cmds[install_num].data, num * sizeof(WUDPatchCmd)); install_num += num; - BTM_VendorSpecificCommand(BT_VSC_NINTENDO_INSTALL_PATCH, - sizeof(num) + num * sizeof(WUDPatchCmd), buf, - install_patch_cb); + BTM_VendorSpecificCommand(BT_VSC_NINTENDO_INSTALL_PATCH, sizeof(num) + num * sizeof(WUDPatchCmd), buf, install_patch_cb); } static void WUDiAppendRuntimePatch() { @@ -1971,13 +1893,11 @@ void WUDiGetFirmwareVersion() { DEBUGPrint("manufacturer : %04x\n", version.manufacturer); - DEBUGPrint(" ==> 2045 firmware ver.002.003.014.%d\n", - version.hci_revision & 0xFFF); + DEBUGPrint(" ==> 2045 firmware ver.002.003.014.%d\n", version.hci_revision & 0xFFF); if ((version.hci_revision & 0xFFF) == 167) { WUDiAppendRuntimePatch(); - } - else { + } else { WUDiInitSub(); } } @@ -1989,9 +1909,9 @@ void WUDiInitSub() { char devName[] = "Wii"; DEV_CLASS devClass = { - 0x00, // No designated Major Service Classes - 0x04, // Major Device Class 4 (Audio/Video) - 0x48 // Minor Device Class 18 (Audio/Video -> Gaming/Toy) + 0x00, // No designated Major Service Classes + 0x04, // Major Device Class 4 (Audio/Video) + 0x48 // Minor Device Class 18 (Audio/Video -> Gaming/Toy) }; DEBUGPrint("start WUDiInitSub()\n"); @@ -2056,8 +1976,7 @@ void WUDiAutoSync() { if (pSyncCallback != NULL) { pSyncCallback(result, 0); - } - else { + } else { WUDStartSyncDevice(); } } @@ -2080,8 +1999,7 @@ void WUDiDeleteAllLinkKeys() { if (pClearCallback != NULL) { pClearCallback(result); - } - else { + } else { WUDStartClearDevice(); } } @@ -2090,7 +2008,8 @@ void WUDiRegisterDevice(BD_ADDR addr) { WUDCB* p = &_wcb; WUDDevInfo* pInfo; tBTA_STATUS status; - BOOL enabled = OSDisableInterrupts();; + BOOL enabled = OSDisableInterrupts(); + ; pInfo = WUDiGetDevInfo(addr); @@ -2103,14 +2022,12 @@ void WUDiRegisterDevice(BD_ADDR addr) { desc.dsc_list = descriptor; DEBUGPrint("BTA_HhAddDev()\n"); - BTA_HhAddDev(pInfo->devAddr, pInfo->hhAttrMask, pInfo->subclass, - pInfo->appID, desc); + BTA_HhAddDev(pInfo->devAddr, pInfo->hhAttrMask, pInfo->subclass, pInfo->appID, desc); } if (pInfo->UNK_0x5B == 0 || pInfo->UNK_0x5B == 4 || pInfo->UNK_0x5B == 2 || pInfo->UNK_0x5B == 5) { p->devNums++; - } - else { + } else { p->devSmpNums++; } @@ -2128,10 +2045,8 @@ void WUDiRemoveDevice(BD_ADDR addr) { pInfo = WUDiGetDevInfo(addr); if (pInfo != NULL) { - DEBUGPrint(" handle : %d, addr : %02x:%02x:%02x:%02x:%02x:%02x\n", - pInfo->devHandle, pInfo->devAddr[0], pInfo->devAddr[1], - pInfo->devAddr[2], pInfo->devAddr[3], pInfo->devAddr[4], - pInfo->devAddr[5]); + DEBUGPrint(" handle : %d, addr : %02x:%02x:%02x:%02x:%02x:%02x\n", pInfo->devHandle, pInfo->devAddr[0], pInfo->devAddr[1], pInfo->devAddr[2], + pInfo->devAddr[3], pInfo->devAddr[4], pInfo->devAddr[5]); DEBUGPrint("remove device info from database.\n"); @@ -2146,8 +2061,7 @@ void WUDiRemoveDevice(BD_ADDR addr) { if (pInfo->UNK_0x5B == 0 || pInfo->UNK_0x5B == 2 || pInfo->UNK_0x5B == 4 || pInfo->UNK_0x5B == 5) { p->devNums--; - } - else { + } else { p->devSmpNums--; } @@ -2195,8 +2109,7 @@ WUDDevInfo* WUDiGetDevInfoIndex(int idx) { if (0 <= idx && idx < WUD_MAX_DEV_ENTRY_FOR_STD) { pInfo = &p->stdDevs[idx]; - } - else { + } else { pInfo = &p->smpDevs[idx - WUD_MAX_DEV_ENTRY_FOR_STD]; } @@ -2221,8 +2134,7 @@ WUDDevInfo* WUDiGetNewDevInfo() { break; } } - } - else { + } else { pInfo = p->smpListTail->devInfo; } @@ -2323,8 +2235,7 @@ void WUDiMoveTopSmpDevInfoPtr(WUDDevInfo* pInfo) { if (WUD_BDCMP(p->smpListTail->devInfo->devAddr, p->smpList[i].devInfo->devAddr) == 0) { p->smpListTail = p->smpList[i].prev; - } - else { + } else { p->smpList[i].next->prev = p->smpList[i].prev; } @@ -2360,8 +2271,7 @@ void WUDiMoveBottomSmpDevInfoPtr(WUDDevInfo* pInfo) { if (WUD_BDCMP(p->smpListHead->devInfo->devAddr, p->smpList[i].devInfo->devAddr) == 0) { p->smpListHead = p->smpList[i].next; - } - else { + } else { p->smpList[i].prev->next = p->smpList[i].next; } @@ -2409,8 +2319,7 @@ void WUDiMoveTopOfDisconnectedSmpDevice(WUDDevInfo* pInfo) { } p->smpListHead = p->smpList[i].next; - } - else { + } else { p->smpList[i].prev->next = p->smpList[i].next; } @@ -2422,8 +2331,7 @@ void WUDiMoveTopOfDisconnectedSmpDevice(WUDDevInfo* pInfo) { pIt->prev->next = &p->smpList[i]; pIt->prev = &p->smpList[i]; - } - else { + } else { p->smpList[i].prev = pIt; p->smpList[i].next = pIt->next; @@ -2458,8 +2366,7 @@ void WUDiMoveTopStdDevInfoPtr(WUDDevInfo* pInfo) { if (WUD_BDCMP(p->stdListTail->devInfo->devAddr, p->stdList[i].devInfo->devAddr) == 0) { p->stdListTail = p->stdList[i].prev; - } - else { + } else { p->stdList[i].next->prev = p->stdList[i].prev; } @@ -2495,8 +2402,7 @@ void WUDiMoveBottomStdDevInfoPtr(WUDDevInfo* pInfo) { if (WUD_BDCMP(p->stdListHead->devInfo->devAddr, p->stdList[i].devInfo->devAddr) == 0) { p->stdListHead = p->stdList[i].next; - } - else { + } else { p->stdList[i].prev->next = p->stdList[i].next; } @@ -2543,8 +2449,7 @@ void WUDiMoveTopOfDisconnectedStdDevice(WUDDevInfo* pInfo) { break; p->stdListHead = p->stdList[i].next; - } - else { + } else { p->stdList[i].prev->next = p->stdList[i].next; } @@ -2556,8 +2461,7 @@ void WUDiMoveTopOfDisconnectedStdDevice(WUDDevInfo* pInfo) { pIt->prev->next = &p->stdList[i]; pIt->prev = &p->stdList[i]; - } - else { + } else { p->stdList[i].prev = pIt; p->stdList[i].next = pIt->next; @@ -2578,11 +2482,8 @@ BOOL WUDIsBusy() { enabled = OSDisableInterrupts(); - if (p->syncState == WUD_STATE_SYNC_START && - p->deleteState == WUD_STATE_DELETE_START && - p->stackState == WUD_STATE_STACK_INITIALIZED && + if (p->syncState == WUD_STATE_SYNC_START && p->deleteState == WUD_STATE_DELETE_START && p->stackState == WUD_STATE_STACK_INITIALIZED && p->initState == WUD_STATE_INIT_UNK5) { - OSRestoreInterrupts(enabled); return FALSE; } @@ -2622,9 +2523,8 @@ void WUDSecurityCallback(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* pData) { WUD_BDCPY(p->hostAddr, pEnable->bd_addr); DEBUGPrint("BTA_ENABLE_EVT\n"); - DEBUGPrint("host : %02x:%02x:%02x:%02x:%02x:%02x\n", p->hostAddr[0], - p->hostAddr[1], p->hostAddr[2], p->hostAddr[3], - p->hostAddr[4], p->hostAddr[5]); + DEBUGPrint("host : %02x:%02x:%02x:%02x:%02x:%02x\n", p->hostAddr[0], p->hostAddr[1], p->hostAddr[2], p->hostAddr[3], p->hostAddr[4], + p->hostAddr[5]); WUDiEnableStack(); p->libStatus = WUD_LIB_STATUS_2; @@ -2649,16 +2549,13 @@ void WUDSecurityCallback(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* pData) { DEBUGPrint("BTA_DM_AUTH_CMPL_EVT\n"); - DEBUGPrint(" addr : %02x:%02x:%02x:%02x:%02x:%02x\n", - pAuthCmpl->bd_addr[0], pAuthCmpl->bd_addr[1], - pAuthCmpl->bd_addr[2], pAuthCmpl->bd_addr[3], - pAuthCmpl->bd_addr[4], pAuthCmpl->bd_addr[5]); + DEBUGPrint(" addr : %02x:%02x:%02x:%02x:%02x:%02x\n", pAuthCmpl->bd_addr[0], pAuthCmpl->bd_addr[1], pAuthCmpl->bd_addr[2], + pAuthCmpl->bd_addr[3], pAuthCmpl->bd_addr[4], pAuthCmpl->bd_addr[5]); - DEBUGPrint(" key : %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pAuthCmpl->key[0], pAuthCmpl->key[1], pAuthCmpl->key[2], pAuthCmpl->key[3], - pAuthCmpl->key[4], pAuthCmpl->key[5], pAuthCmpl->key[6], pAuthCmpl->key[7], - pAuthCmpl->key[8], pAuthCmpl->key[9], pAuthCmpl->key[10], pAuthCmpl->key[11], - pAuthCmpl->key[12], pAuthCmpl->key[13], pAuthCmpl->key[14], pAuthCmpl->key[15]); + DEBUGPrint(" key : %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", pAuthCmpl->key[0], + pAuthCmpl->key[1], pAuthCmpl->key[2], pAuthCmpl->key[3], pAuthCmpl->key[4], pAuthCmpl->key[5], pAuthCmpl->key[6], + pAuthCmpl->key[7], pAuthCmpl->key[8], pAuthCmpl->key[9], pAuthCmpl->key[10], pAuthCmpl->key[11], pAuthCmpl->key[12], + pAuthCmpl->key[13], pAuthCmpl->key[14], pAuthCmpl->key[15]); DEBUGPrint(" result = %d\n", pAuthCmpl->success); @@ -2688,10 +2585,8 @@ void WUDSecurityCallback(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* pData) { DEBUGPrint("BTA_DM_LINK_UP_EVT\n"); - DEBUGPrint(" addr : %02x:%02x:%02x:%02x:%02x:%02x\n", - pLinkUp->bd_addr[0], pLinkUp->bd_addr[1], - pLinkUp->bd_addr[2], pLinkUp->bd_addr[3], - pLinkUp->bd_addr[4], pLinkUp->bd_addr[5]); + DEBUGPrint(" addr : %02x:%02x:%02x:%02x:%02x:%02x\n", pLinkUp->bd_addr[0], pLinkUp->bd_addr[1], pLinkUp->bd_addr[2], + pLinkUp->bd_addr[3], pLinkUp->bd_addr[4], pLinkUp->bd_addr[5]); pInfo = WUDiGetDevInfo(pLinkUp->bd_addr); if (pInfo == NULL && WUD_BDCMP(pLinkUp->bd_addr, _work.devAddr) == 0) { @@ -2701,11 +2596,8 @@ void WUDSecurityCallback(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* pData) { if (pInfo == NULL || WUDiGetLinkNum() == WUD_MAX_CHANNELS) { btm_remove_acl(pLinkUp->bd_addr); - DEBUGPrint("%s --> %02x:%02x:%02x:%02x:%02x:%02x\n", - pInfo == NULL ? "not paired" : "4 links exist", - pLinkUp->bd_addr[0], pLinkUp->bd_addr[1], - pLinkUp->bd_addr[2], pLinkUp->bd_addr[3], - pLinkUp->bd_addr[4], pLinkUp->bd_addr[5]); + DEBUGPrint("%s --> %02x:%02x:%02x:%02x:%02x:%02x\n", pInfo == NULL ? "not paired" : "4 links exist", pLinkUp->bd_addr[0], + pLinkUp->bd_addr[1], pLinkUp->bd_addr[2], pLinkUp->bd_addr[3], pLinkUp->bd_addr[4], pLinkUp->bd_addr[5]); break; } @@ -2718,10 +2610,8 @@ void WUDSecurityCallback(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* pData) { DEBUGPrint("BTA_DM_LINK_DOWN_EVT\n"); - DEBUGPrint(" addr : %02x:%02x:%02x:%02x:%02x:%02x\n", - pLinkDown->bd_addr[0], pLinkDown->bd_addr[1], - pLinkDown->bd_addr[2], pLinkDown->bd_addr[3], - pLinkDown->bd_addr[4], pLinkDown->bd_addr[5]); + DEBUGPrint(" addr : %02x:%02x:%02x:%02x:%02x:%02x\n", pLinkDown->bd_addr[0], pLinkDown->bd_addr[1], pLinkDown->bd_addr[2], + pLinkDown->bd_addr[3], pLinkDown->bd_addr[4], pLinkDown->bd_addr[5]); DEBUGPrint("result: %d\n", pLinkDown->status); @@ -2742,12 +2632,10 @@ void WUDSecurityCallback(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* pData) { } } } - } - else if (WUD_BDCMP(_work.devAddr, pLinkDown->bd_addr) == 0) { + } else if (WUD_BDCMP(_work.devAddr, pLinkDown->bd_addr) == 0) { p->syncState = WUD_STATE_SYNC_ERROR; p->linkedNum--; - } - else { + } else { DEBUGPrint("this device in not paired\n"); } @@ -2775,21 +2663,15 @@ void WUDSearchCallback(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* pData) { case BTA_DM_INQ_RES_EVT: { tBTA_DM_INQ_RES* pResp = &pData->inq_res; - DEBUGPrint("INQUIRY RESULT: %02x:%02x:%02x:%02x:%02x:%02x %02x%02x%02x %d\n", - pResp->bd_addr[0], pResp->bd_addr[1], pResp->bd_addr[2], - pResp->bd_addr[3], pResp->bd_addr[4], pResp->bd_addr[5], - pResp->dev_class[0], pResp->dev_class[1], pResp->dev_class[2], - pResp->rssi); + DEBUGPrint("INQUIRY RESULT: %02x:%02x:%02x:%02x:%02x:%02x %02x%02x%02x %d\n", pResp->bd_addr[0], pResp->bd_addr[1], pResp->bd_addr[2], + pResp->bd_addr[3], pResp->bd_addr[4], pResp->bd_addr[5], pResp->dev_class[0], pResp->dev_class[1], pResp->dev_class[2], + pResp->rssi); _discRssi = pResp->rssi; - if (_wcb.syncSkipChecks == TRUE || - (_wcb.syncSkipChecks == FALSE && - WUDiGetLinkNum() < WUD_MAX_CHANNELS - 1)) { - + if (_wcb.syncSkipChecks == TRUE || (_wcb.syncSkipChecks == FALSE && WUDiGetLinkNum() < WUD_MAX_CHANNELS - 1)) { timeout = 6400; - } - else { + } else { timeout = 32768; } @@ -2809,10 +2691,8 @@ void WUDSearchCallback(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* pData) { _discResp.services = dmDiscRes->services; _discNumResps++; - DEBUGPrint("DISCOVER RESULT: %02x:%02x:%02x:%02x:%02x:%02x %s (%04x)\n", - _discResp.devAddr[0], _discResp.devAddr[1], _discResp.devAddr[2], - _discResp.devAddr[3], _discResp.devAddr[4], _discResp.devAddr[5], - _discResp.devName, _discResp.services); + DEBUGPrint("DISCOVER RESULT: %02x:%02x:%02x:%02x:%02x:%02x %s (%04x)\n", _discResp.devAddr[0], _discResp.devAddr[1], + _discResp.devAddr[2], _discResp.devAddr[3], _discResp.devAddr[4], _discResp.devAddr[5], _discResp.devName, _discResp.services); break; } case BTA_DM_DISC_CMPL_EVT: { @@ -2902,15 +2782,13 @@ void WUDStoredLinkKeyCallback(void* p1) { while (i < pReturn->num_keys) { pInfo = WUDiGetDevInfo(pPair->bd_addr); - DEBUGPrint("BD_ADDR: %02x:%02x:%02x:%02x:%02x:%02x\n", - pPair->bd_addr[0], pPair->bd_addr[1], pPair->bd_addr[2], - pPair->bd_addr[3], pPair->bd_addr[4], pPair->bd_addr[5]); + DEBUGPrint("BD_ADDR: %02x:%02x:%02x:%02x:%02x:%02x\n", pPair->bd_addr[0], pPair->bd_addr[1], pPair->bd_addr[2], pPair->bd_addr[3], + pPair->bd_addr[4], pPair->bd_addr[5]); - DEBUGPrint("LINKKEY: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - pPair->link_key[0], pPair->link_key[1], pPair->link_key[2], pPair->link_key[3], - pPair->link_key[4], pPair->link_key[5], pPair->link_key[6], pPair->link_key[7], - pPair->link_key[8], pPair->link_key[9], pPair->link_key[10], pPair->link_key[11], - pPair->link_key[12], pPair->link_key[13], pPair->link_key[14], pPair->link_key[15]); + DEBUGPrint("LINKKEY: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", pPair->link_key[0], + pPair->link_key[1], pPair->link_key[2], pPair->link_key[3], pPair->link_key[4], pPair->link_key[5], pPair->link_key[6], + pPair->link_key[7], pPair->link_key[8], pPair->link_key[9], pPair->link_key[10], pPair->link_key[11], pPair->link_key[12], + pPair->link_key[13], pPair->link_key[14], pPair->link_key[15]); if (pInfo == NULL) { DEBUGPrint("this device is not stored in NAND\n"); @@ -2933,8 +2811,7 @@ void WUDStoredLinkKeyCallback(void* p1) { WUD_BDCPY(pInfo->devAddr, pPair->bd_addr); memcpy(pInfo->linkKey, pPair->link_key, LINK_KEY_LEN); } - } - else { + } else { WUD_BDCPY(pInfo->devAddr, pPair->bd_addr); memcpy(pInfo->linkKey, pPair->link_key, LINK_KEY_LEN); @@ -2943,9 +2820,8 @@ void WUDStoredLinkKeyCallback(void* p1) { } WUD_BDCPY(p->pairAddr, pPair->bd_addr); - DEBUGPrint(" LAST: %02x:%02x:%02x:%02x:%02x:%02x\n", - p->pairAddr[0], p->pairAddr[1], p->pairAddr[2], - p->pairAddr[3], p->pairAddr[4], p->pairAddr[5]); + DEBUGPrint(" LAST: %02x:%02x:%02x:%02x:%02x:%02x\n", p->pairAddr[0], p->pairAddr[1], p->pairAddr[2], p->pairAddr[3], + p->pairAddr[4], p->pairAddr[5]); } pPair++; @@ -2958,8 +2834,7 @@ void WUDStoredLinkKeyCallback(void* p1) { pRead = p1; DEBUGPrint("BTM_CB_EVT_READ_STORED_LINK_KEYS\n"); - DEBUGPrint(" status: %d max_keys: %d num_keys: %d\n", pRead->status, - pRead->max_keys, pRead->read_keys); + DEBUGPrint(" status: %d max_keys: %d num_keys: %d\n", pRead->status, pRead->max_keys, pRead->read_keys); p->linkKeyState = WUD_STATE_LINK_KEY_START; break; @@ -2968,8 +2843,7 @@ void WUDStoredLinkKeyCallback(void* p1) { pWrite = p1; DEBUGPrint("BTM_CB_EVT_WRITE_STORED_LINK_KEYS\n"); - DEBUGPrint(" status: %d num_keys: %d\n", pWrite->status, - pWrite->num_keys); + DEBUGPrint(" status: %d num_keys: %d\n", pWrite->status, pWrite->num_keys); p->linkKeyState = WUD_STATE_LINK_KEY_START; break; @@ -2978,8 +2852,7 @@ void WUDStoredLinkKeyCallback(void* p1) { pDelete = p1; DEBUGPrint("BTM_CB_EVT_DELETE_STORED_LINK_KEYS\n"); - DEBUGPrint(" status: %d num_keys: %d\n", pDelete->status, - pDelete->num_keys); + DEBUGPrint(" status: %d num_keys: %d\n", pDelete->status, pDelete->num_keys); if (pDelete->num_keys == 0) { DEBUGPrint("WARNING: no entry is deleted\n"); @@ -3007,11 +2880,9 @@ void WUDPowerManagerCallback(BD_ADDR addr, tBTM_PM_STATUS status, UINT16 value, if (pInfo == NULL) { if (WUD_BDCMP(_work.devAddr, addr) == 0) { pInfo = &_work; - } - else { + } else { WUD_DEBUGPrint("Unknown device is connected and changes the connection type!!!!\n"); - WUD_DEBUGPrint(" addr = %02x:%02x:%02x:%02x:%02x:%02x, status = %d\n", - addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], status); + WUD_DEBUGPrint(" addr = %02x:%02x:%02x:%02x:%02x:%02x, status = %d\n", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], status); return; } } @@ -3027,10 +2898,8 @@ void WUDPowerManagerCallback(BD_ADDR addr, tBTM_PM_STATUS status, UINT16 value, } } - DEBUGPrint(" addr = %02x:%02x:%02x:%02x:%02x:%02x, status = %d\n", - pInfo->devAddr[0], pInfo->devAddr[1], pInfo->devAddr[2], - pInfo->devAddr[3], pInfo->devAddr[4], pInfo->devAddr[5], - pInfo->status); + DEBUGPrint(" addr = %02x:%02x:%02x:%02x:%02x:%02x, status = %d\n", pInfo->devAddr[0], pInfo->devAddr[1], pInfo->devAddr[2], pInfo->devAddr[3], + pInfo->devAddr[4], pInfo->devAddr[5], pInfo->status); } BD_ADDR_PTR _WUDGetDevAddr(UINT8 handle) { @@ -3039,8 +2908,7 @@ BD_ADDR_PTR _WUDGetDevAddr(UINT8 handle) { if (handle < WUD_MAX_DEV_ENTRY) { pAddr = _dev_handle_to_bda[handle]; - } - else { + } else { pAddr = NULL; } @@ -3054,8 +2922,7 @@ u16 _WUDGetQueuedSize(s8 handle) { if (0 <= handle && handle < WUD_MAX_DEV_ENTRY) { queuedSize = _dev_handle_queue_size[handle]; - } - else { + } else { queuedSize = 0; } @@ -3069,8 +2936,7 @@ u16 _WUDGetNotAckedSize(s8 handle) { if (0 <= handle && handle < WUD_MAX_DEV_ENTRY) { notAckedSize = _dev_handle_notack_num[handle]; - } - else { + } else { notAckedSize = 0; } @@ -3093,15 +2959,8 @@ DECOMP_FORCE_ACTIVE(WUD_c5, "_WUDStartSyncDevice()\n") DECOMP_FORCE_ACTIVE(WUD_c6, "_WUDDeleteStoreDevice()\n") DECOMP_FORCE_ACTIVE(WUD_c7, "dev number = %d\n") -static u8 reset_auth_count_cmd[] = { - 0x30, 0x36, 0x08, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 -}; +static u8 reset_auth_count_cmd[] = {0x30, 0x36, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; void WUDResetAuthFailCount() { BTM_VendorSpecificCommand(BT_VSC_NINTENDO_WRITE_PATCH, (u8)sizeof(reset_auth_count_cmd), reset_auth_count_cmd, NULL); diff --git a/libs/RVL_SDK/src/wud/WUDHidHost.c b/libs/RVL_SDK/src/wud/WUDHidHost.c index bd515cc8..43bbff12 100644 --- a/libs/RVL_SDK/src/wud/WUDHidHost.c +++ b/libs/RVL_SDK/src/wud/WUDHidHost.c @@ -26,9 +26,8 @@ void WUDHidHostCallback(tBTA_HH_EVT event, tBTA_HH* pData) { pConn = &pData->conn; DEBUGPrint("BTA_HH_OPEN_EVT\n"); - DEBUGPrint("handle: %d, addr: %02x:%02x:%02x:%02x:%02x:%02x\n", - pConn->handle, pConn->bda[0], pConn->bda[1], pConn->bda[2], - pConn->bda[3], pConn->bda[4], pConn->bda[5]); + DEBUGPrint("handle: %d, addr: %02x:%02x:%02x:%02x:%02x:%02x\n", pConn->handle, pConn->bda[0], pConn->bda[1], pConn->bda[2], pConn->bda[3], + pConn->bda[4], pConn->bda[5]); if (pConn->status == BTA_HH_OK) { pInfo = &_work; @@ -63,8 +62,7 @@ void WUDHidHostCallback(tBTA_HH_EVT event, tBTA_HH* pData) { if (pInfo->UNK_0x5B == 3 || pInfo->UNK_0x5B == 1) { WUDiMoveTopSmpDevInfoPtr(pInfo); - } - else { + } else { WUDiMoveTopStdDevInfoPtr(pInfo); } @@ -73,8 +71,7 @@ void WUDHidHostCallback(tBTA_HH_EVT event, tBTA_HH* pData) { if (p->hidConnCB != NULL) { p->hidConnCB(pInfo, TRUE); } - } - else { + } else { DEBUGPrint("error code: %d\n", pConn->status); if (p->syncState != WUD_STATE_SYNC_START) { @@ -87,15 +84,13 @@ void WUDHidHostCallback(tBTA_HH_EVT event, tBTA_HH* pData) { p->syncState = WUD_STATE_SYNC_ERROR; } - } - else { + } else { if (WUDiGetDevInfo(pConn->bda) && pConn->status == BTA_HH_ERR_AUTH_FAILED) { pInfo = WUDiGetDevInfo(pConn->bda); if (pInfo) { if (pInfo->UNK_0x5B == 3 || pInfo->UNK_0x5B == 1) { WUDiMoveBottomSmpDevInfoPtr(pInfo); - } - else { + } else { WUDiMoveBottomStdDevInfoPtr(pInfo); } } @@ -121,8 +116,7 @@ void WUDHidHostCallback(tBTA_HH_EVT event, tBTA_HH* pData) { if (pInfo != NULL) { if (pInfo->UNK_0x5B == 3 || pInfo->UNK_0x5B == 1) { WUDiMoveTopOfDisconnectedSmpDevice(pInfo); - } - else { + } else { WUDiMoveTopOfDisconnectedStdDevice(pInfo); } } @@ -171,10 +165,8 @@ void WUDHidHostCallback(tBTA_HH_EVT event, tBTA_HH* pData) { DEBUGPrint("BTA_HH_ADD_DEV_EVT\n"); - DEBUGPrint("result: %d, handle: %d, addr: %02x:%02x:%02x:%02x:%02x:%02x\n", - pConn->status, pConn->handle, - pConn->bda[0], pConn->bda[1], pConn->bda[2], - pConn->bda[3], pConn->bda[4], pConn->bda[5]); + DEBUGPrint("result: %d, handle: %d, addr: %02x:%02x:%02x:%02x:%02x:%02x\n", pConn->status, pConn->handle, pConn->bda[0], pConn->bda[1], + pConn->bda[2], pConn->bda[3], pConn->bda[4], pConn->bda[5]); pInfo = WUDiGetDevInfo(pConn->bda); pInfo->devHandle = pConn->handle; @@ -187,10 +179,8 @@ void WUDHidHostCallback(tBTA_HH_EVT event, tBTA_HH* pData) { pConn = &pData->dev_info; DEBUGPrint("BTA_HH_RMV_DEV_EVT\n"); - DEBUGPrint("result: %d, handle: %d, addr: %02x:%02x:%02x:%02x:%02x:%02x\n", - pConn->status, pConn->handle, - pConn->bda[0], pConn->bda[1], pConn->bda[2], - pConn->bda[3], pConn->bda[4], pConn->bda[5]); + DEBUGPrint("result: %d, handle: %d, addr: %02x:%02x:%02x:%02x:%02x:%02x\n", pConn->status, pConn->handle, pConn->bda[0], pConn->bda[1], + pConn->bda[2], pConn->bda[3], pConn->bda[4], pConn->bda[5]); break; } @@ -231,8 +221,7 @@ void bta_hh_co_data(UINT8 handle, UINT8* pReport, UINT16 len, tBTA_HH_PROTO_MODE if (p->hidRecvCB != NULL) { p->hidRecvCB(handle, pReport, len); } - } - else { + } else { DEBUGPrint("Invalid app_id [%d]\n", appId); } } diff --git a/libs/RevoEX/include/private/cdb.h b/libs/RevoEX/include/private/cdb.h index 698ecaed..e2a33e5a 100644 --- a/libs/RevoEX/include/private/cdb.h +++ b/libs/RevoEX/include/private/cdb.h @@ -6,11 +6,13 @@ #include #include -#include #include +#include + -#include #include +#include + #include @@ -21,33 +23,33 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus -void MutexInitialized(); +void MutexInitialized(); -CDBErr _CDBOnVFErrorOccured(s32 vfError, const char* unused0, u32 unused1); -#define CDBOnVFErrorOccured(vfError) _CDBOnVFErrorOccured(vfError, "", 0) +CDBErr _CDBOnVFErrorOccured(s32 vfError, const char* unused0, u32 unused1); +#define CDBOnVFErrorOccured(vfError) _CDBOnVFErrorOccured(vfError, "", 0) -CDBErr _CDBOnNANDErrorOccured(s32 nandError, const char* unused0, u32 unused1); -#define CDBOnNANDErrorOccured(nandError) _CDBOnNANDErrorOccured(nandError, "", 0) +CDBErr _CDBOnNANDErrorOccured(s32 nandError, const char* unused0, u32 unused1); +#define CDBOnNANDErrorOccured(nandError) _CDBOnNANDErrorOccured(nandError, "", 0) -void CDBSetFatalVFErrorFlag(); +void CDBSetFatalVFErrorFlag(); -CDBErr CDBSetVFSyncMode(int sync); -CDBErr CDBVFSync(); +CDBErr CDBSetVFSyncMode(int sync); +CDBErr CDBVFSync(); -CDBErr CDBInitHashedMacAddr(); +CDBErr CDBInitHashedMacAddr(); -u64 CDBGetWiiId(); +u64 CDBGetWiiId(); -u32 CDBGetWiiHighId(); -u32 CDBGetWiiLowId(); +u32 CDBGetWiiHighId(); +u32 CDBGetWiiLowId(); -u32 CDBGetWiiHighIdEx(u64 wiiId); -u32 CDBGetWiiLowIdEx(u64 wiiId); +u32 CDBGetWiiHighIdEx(u64 wiiId); +u32 CDBGetWiiLowIdEx(u64 wiiId); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // PRIVATE_CDB_H +#endif // PRIVATE_CDB_H diff --git a/libs/RevoEX/include/private/cdb/CDBAttr.h b/libs/RevoEX/include/private/cdb/CDBAttr.h index da10e504..1e7d227b 100644 --- a/libs/RevoEX/include/private/cdb/CDBAttr.h +++ b/libs/RevoEX/include/private/cdb/CDBAttr.h @@ -1,98 +1,98 @@ #ifndef PRIVATE_CDB_ATTR_H #define PRIVATE_CDB_ATTR_H -#include #include +#include #include #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus typedef struct _CDBAttrSignature { - u8 sha1Hmac[20]; // 0x00 - u8 unk_0x14[0x1BC - 0x14]; + u8 sha1Hmac[20]; // 0x00 + u8 unk_0x14[0x1BC - 0x14]; } CDBAttrSignature; -#define CDB_ATTR_BUF_MAGIC_LEN 7 +#define CDB_ATTR_BUF_MAGIC_LEN 7 -#define CDB_ATTR_BUF_MAX_DESC_LEN 88 +#define CDB_ATTR_BUF_MAX_DESC_LEN 88 #define CDB_ATTR_BUF_KEY_STRING_LEN CDB_RECORD_KEY_STRING_LEN -#define CDB_ATTR_BUF_KEY_IV0_LEN 2 -#define CDB_ATTR_BUF_KEY_IV1_LEN 8 -#define CDB_ATTR_BUF_KEY_IV_LEN (CDB_ATTR_BUF_KEY_IV0_LEN * CDB_ATTR_BUF_KEY_IV1_LEN) +#define CDB_ATTR_BUF_KEY_IV0_LEN 2 +#define CDB_ATTR_BUF_KEY_IV1_LEN 8 +#define CDB_ATTR_BUF_KEY_IV_LEN (CDB_ATTR_BUF_KEY_IV0_LEN * CDB_ATTR_BUF_KEY_IV1_LEN) typedef struct _CDBAttrBuf { - char magic[CDB_ATTR_BUF_MAGIC_LEN]; // 0x00 (Always "CDBFILE") - s8 version; // 0x07 + char magic[CDB_ATTR_BUF_MAGIC_LEN]; // 0x00 (Always "CDBFILE") + s8 version; // 0x07 - u64 wiiId; // 0x08 + u64 wiiId; // 0x08 - u8 descLength; // 0x10 - u8 padding_0x11[3]; - char desc[CDB_ATTR_BUF_MAX_DESC_LEN]; // 0x14 - u32 padding_0x6C; + u8 descLength; // 0x10 + u8 padding_0x11[3]; + char desc[CDB_ATTR_BUF_MAX_DESC_LEN]; // 0x14 + u32 padding_0x6C; - CDBId cdbID; // 0x70 + CDBId cdbID; // 0x70 - u32 fileSize; // 0x78 - u32 lastModifiedDate; // 0x7C + u32 fileSize; // 0x78 + u32 lastModifiedDate; // 0x7C - char keyString[CDB_ATTR_BUF_KEY_STRING_LEN]; // 0x80 + char keyString[CDB_ATTR_BUF_KEY_STRING_LEN]; // 0x80 - s8 iv[CDB_ATTR_BUF_KEY_IV_LEN]; // 0xA0 + s8 iv[CDB_ATTR_BUF_KEY_IV_LEN]; // 0xA0 - CDBAttrSignature signature; // 0xB0 + CDBAttrSignature signature; // 0xB0 - u8 padding_0x26C[0x400 - 0x26C]; + u8 padding_0x26C[0x400 - 0x26C]; } CDBAttrBuf; // Do not aling over 4 bytes #pragma pack(push, 4) typedef struct _CDBAttr { - CDBAttrBuf buf; // 0x00 - BOOL unk_0x400; // 0x400 - BOOL unk_0x404; // 0x404 - BOOL unk_0x408; // 0x408 + CDBAttrBuf buf; // 0x00 + BOOL unk_0x400; // 0x400 + BOOL unk_0x404; // 0x404 + BOOL unk_0x408; // 0x408 } CDBAttr; #pragma pack(pop) -CDBErr CDBAttrCheckAttrBuf(CDBAttr* attr); +CDBErr CDBAttrCheckAttrBuf(CDBAttr* attr); -void CDBAttrInit(CDBAttr* attr); +void CDBAttrInit(CDBAttr* attr); -CDBErr CDBAttrCreateOnNAND(CDBAttr* attr, const char* desc, u32 lastModifiedDate); +CDBErr CDBAttrCreateOnNAND(CDBAttr* attr, const char* desc, u32 lastModifiedDate); -CDBErr CDBAttrSetModifiedDate(CDBAttr* attr, u32 modifiedDate); +CDBErr CDBAttrSetModifiedDate(CDBAttr* attr, u32 modifiedDate); -CDBErr CDBAttrSetModifiedCount(CDBAttr* attr, u32 modifiedCount); -CDBErr CDBAttrGetModifiedCount(CDBAttr* attr, u32* modifiedCount); +CDBErr CDBAttrSetModifiedCount(CDBAttr* attr, u32 modifiedCount); +CDBErr CDBAttrGetModifiedCount(CDBAttr* attr, u32* modifiedCount); -CDBErr CDBAttrGetIDNumber(CDBAttr* attr, CDBId* cdbID); -CDBErr CDBAttrSetWiiId(CDBAttr* attr, u64 wiiId); +CDBErr CDBAttrGetIDNumber(CDBAttr* attr, CDBId* cdbID); +CDBErr CDBAttrSetWiiId(CDBAttr* attr, u64 wiiId); -void CDBAttrSetKeyStr(CDBAttr* attr, CDBRecordKey* recordKey); -void CDBAttrGetKeyStr(CDBAttr* attr, char* keyString); +void CDBAttrSetKeyStr(CDBAttr* attr, CDBRecordKey* recordKey); +void CDBAttrGetKeyStr(CDBAttr* attr, char* keyString); -u32 CDBAttrSetIV(CDBAttr* attr, u32 seed); +u32 CDBAttrSetIV(CDBAttr* attr, u32 seed); -void CDBAttrInitIV(CDBAttr* attr); +void CDBAttrInitIV(CDBAttr* attr); -u32 CDBAttrSetIV(CDBAttr* attr, u32 seed); -void CDBAttrGetIV(CDBAttr* attr, u8* iv); +u32 CDBAttrSetIV(CDBAttr* attr, u32 seed); +void CDBAttrGetIV(CDBAttr* attr, u8* iv); -void CDBAttrGetSignature(CDBAttr* attr, CDBAttrSignature* signature); -void CDBAttrClearSignature(CDBAttr* attr); +void CDBAttrGetSignature(CDBAttr* attr, CDBAttrSignature* signature); +void CDBAttrClearSignature(CDBAttr* attr); -void CDBAttrSetFileSize(CDBAttr* attr, u32 fileSize); -void CDBAttrGetFileSize(CDBAttr* attr, u32* fileSize); +void CDBAttrSetFileSize(CDBAttr* attr, u32 fileSize); +void CDBAttrGetFileSize(CDBAttr* attr, u32* fileSize); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // PRIVATE_CDB_ATTR_H +#endif // PRIVATE_CDB_ATTR_H diff --git a/libs/RevoEX/include/private/cdb/CDBBridge.h b/libs/RevoEX/include/private/cdb/CDBBridge.h index 98a7009a..fd41cc83 100644 --- a/libs/RevoEX/include/private/cdb/CDBBridge.h +++ b/libs/RevoEX/include/private/cdb/CDBBridge.h @@ -1,94 +1,94 @@ #ifndef PRIVATE_CDB_BRIDGE_H #define PRIVATE_CDB_BRIDGE_H -#include #include +#include #include #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus typedef struct _CDBBridgeFile { - VFFILE* vf; // 0x00 - VFFILE* sd; // 0x04 + VFFILE* vf; // 0x00 + VFFILE* sd; // 0x04 } CDBBridgeFile; /* === VF API === */ -CDBErr CDBFCreateFileVF(CDBBridgeFile* file, const char* fileName); -CDBErr CDBFDeleteFileVF(const char* fileName); +CDBErr CDBFCreateFileVF(CDBBridgeFile* file, const char* fileName); +CDBErr CDBFDeleteFileVF(const char* fileName); -CDBErr CDBFCreateDirVF(const char* dirName); +CDBErr CDBFCreateDirVF(const char* dirName); -CDBErr CDBFOpenVF(CDBBridgeFile* file, const char* fileName); -CDBErr CDBFCloseVF(CDBBridgeFile* file); +CDBErr CDBFOpenVF(CDBBridgeFile* file, const char* fileName); +CDBErr CDBFCloseVF(CDBBridgeFile* file); -CDBErr CDBFReadAttrVF(CDBBridgeFile* file, CDBAttr* attr); +CDBErr CDBFReadAttrVF(CDBBridgeFile* file, CDBAttr* attr); -CDBErr CDBFWriteAttrVF(CDBBridgeFile* file, CDBAttr* attr); -CDBErr CDBFWriteAttrOnlyLeadChunkVF(CDBBridgeFile* file, CDBAttr* attr); +CDBErr CDBFWriteAttrVF(CDBBridgeFile* file, CDBAttr* attr); +CDBErr CDBFWriteAttrOnlyLeadChunkVF(CDBBridgeFile* file, CDBAttr* attr); -CDBErr CDBFReadDataVF(CDBBridgeFile* file, void* buffer, u32 size, u32* readSize); -CDBErr CDBFWriteDataVF(CDBBridgeFile* file, void* buffer, u32 size); +CDBErr CDBFReadDataVF(CDBBridgeFile* file, void* buffer, u32 size, u32* readSize); +CDBErr CDBFWriteDataVF(CDBBridgeFile* file, void* buffer, u32 size); -CDBErr CDBFSeekDataVF(CDBBridgeFile* file, u32 offset, CDBSeek seek); -s32 CDBFTellDataVF(CDBBridgeFile* file); +CDBErr CDBFSeekDataVF(CDBBridgeFile* file, u32 offset, CDBSeek seek); +s32 CDBFTellDataVF(CDBBridgeFile* file); -CDBErr CDBFGetDataSizeVF(CDBBridgeFile* file, u32* dataSize); -CDBErr CDBFGetFileSizeVF(CDBBridgeFile* file, u32* fileSize); +CDBErr CDBFGetDataSizeVF(CDBBridgeFile* file, u32* dataSize); +CDBErr CDBFGetFileSizeVF(CDBBridgeFile* file, u32* fileSize); /* === SD API === */ -CDBErr CDBFCreateFileSD(CDBBridgeFile* file, const char* fileName); -CDBErr CDBFDeleteFileSD(const char* fileName); +CDBErr CDBFCreateFileSD(CDBBridgeFile* file, const char* fileName); +CDBErr CDBFDeleteFileSD(const char* fileName); -CDBErr CDBFCreateDirSD(const char* dirName); +CDBErr CDBFCreateDirSD(const char* dirName); -CDBErr CDBFOpenSD(CDBBridgeFile* file, const char* fileName); -CDBErr CDBFCloseSD(CDBBridgeFile* file); +CDBErr CDBFOpenSD(CDBBridgeFile* file, const char* fileName); +CDBErr CDBFCloseSD(CDBBridgeFile* file); -CDBErr CDBFReadAttrSD(CDBBridgeFile* file, CDBAttr* attr); +CDBErr CDBFReadAttrSD(CDBBridgeFile* file, CDBAttr* attr); -CDBErr CDBFWriteAttrSD(CDBBridgeFile* file, CDBAttr* attr); -CDBErr CDBFWriteAttrOnlyLeadChunkSD(CDBBridgeFile* file, CDBAttr* attr); +CDBErr CDBFWriteAttrSD(CDBBridgeFile* file, CDBAttr* attr); +CDBErr CDBFWriteAttrOnlyLeadChunkSD(CDBBridgeFile* file, CDBAttr* attr); -CDBErr CDBFReadDataSD(CDBBridgeFile* file, void* buffer, u32 size, u32* readSize); -CDBErr CDBFWriteDataSD(CDBBridgeFile* file, void* buffer, u32 size); +CDBErr CDBFReadDataSD(CDBBridgeFile* file, void* buffer, u32 size, u32* readSize); +CDBErr CDBFWriteDataSD(CDBBridgeFile* file, void* buffer, u32 size); -CDBErr CDBFSeekDataSD(CDBBridgeFile* file, u32 offset, CDBSeek seek); -s32 CDBFTellDataSD(CDBBridgeFile* file); +CDBErr CDBFSeekDataSD(CDBBridgeFile* file, u32 offset, CDBSeek seek); +s32 CDBFTellDataSD(CDBBridgeFile* file); -CDBErr CDBFGetDataSizeSD(CDBBridgeFile* file, u32* dataSize); -CDBErr CDBFGetFileSizeSD(CDBBridgeFile* file, u32* fileSize); +CDBErr CDBFGetDataSizeSD(CDBBridgeFile* file, u32* dataSize); +CDBErr CDBFGetFileSizeSD(CDBBridgeFile* file, u32* fileSize); /* === MAIN API === */ -CDBErr CDBFCreateFile(CDBBridgeFile* file, const char* fileName, CDBLocation type); -CDBErr CDBFDeleteFile(const char* fileName, CDBLocation type); +CDBErr CDBFCreateFile(CDBBridgeFile* file, const char* fileName, CDBLocation type); +CDBErr CDBFDeleteFile(const char* fileName, CDBLocation type); -CDBErr CDBFCreateDir(const char* dirName, CDBLocation type); +CDBErr CDBFCreateDir(const char* dirName, CDBLocation type); -CDBErr CDBFOpen(CDBBridgeFile* file, const char* fileName, CDBLocation type); -CDBErr CDBFClose(CDBBridgeFile* file, CDBLocation type); +CDBErr CDBFOpen(CDBBridgeFile* file, const char* fileName, CDBLocation type); +CDBErr CDBFClose(CDBBridgeFile* file, CDBLocation type); -CDBErr CDBFReadAttr(CDBBridgeFile* file, CDBAttr* attr, CDBLocation type); +CDBErr CDBFReadAttr(CDBBridgeFile* file, CDBAttr* attr, CDBLocation type); -CDBErr CDBFWriteAttr(CDBBridgeFile* file, CDBAttr* attr, CDBLocation type); -CDBErr CDBFWriteAttrOnlyLeadChunk(CDBBridgeFile* file, CDBAttr* chunk, CDBLocation type); +CDBErr CDBFWriteAttr(CDBBridgeFile* file, CDBAttr* attr, CDBLocation type); +CDBErr CDBFWriteAttrOnlyLeadChunk(CDBBridgeFile* file, CDBAttr* chunk, CDBLocation type); -CDBErr CDBFReadData(CDBBridgeFile* file, void* buffer, u32 size, u32* readSize, CDBLocation type); -CDBErr CDBFWriteData(CDBBridgeFile* file, void* buffer, u32 size, CDBLocation type); +CDBErr CDBFReadData(CDBBridgeFile* file, void* buffer, u32 size, u32* readSize, CDBLocation type); +CDBErr CDBFWriteData(CDBBridgeFile* file, void* buffer, u32 size, CDBLocation type); -CDBErr CDBFSeekData(CDBBridgeFile* file, u32 offset, CDBSeek seek, CDBLocation type); -s32 CDBFTellData(CDBBridgeFile* file, CDBLocation type); +CDBErr CDBFSeekData(CDBBridgeFile* file, u32 offset, CDBSeek seek, CDBLocation type); +s32 CDBFTellData(CDBBridgeFile* file, CDBLocation type); -CDBErr CDBFGetDataSize(CDBBridgeFile* file, u32* dataSize, CDBLocation type); -CDBErr CDBFGetFileSize(CDBBridgeFile* file, u32* fileSize, CDBLocation type); +CDBErr CDBFGetDataSize(CDBBridgeFile* file, u32* dataSize, CDBLocation type); +CDBErr CDBFGetFileSize(CDBBridgeFile* file, u32* fileSize, CDBLocation type); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // PRIVATE_CDB_BRIDGE_H +#endif // PRIVATE_CDB_BRIDGE_H diff --git a/libs/RevoEX/include/private/cdb/CDBConfig.h b/libs/RevoEX/include/private/cdb/CDBConfig.h index 33cc9e85..80944fca 100644 --- a/libs/RevoEX/include/private/cdb/CDBConfig.h +++ b/libs/RevoEX/include/private/cdb/CDBConfig.h @@ -1,12 +1,12 @@ #ifndef PRIVATE_CDB_CONFIGURATION_H #define PRIVATE_CDB_CONFIGURATION_H -#define CDB_CFG_VF_DRIVE_LETTER "CDB" -#define CDB_CFG_VF_DRIVE_ROOT "CDB:" +#define CDB_CFG_VF_DRIVE_LETTER "CDB" +#define CDB_CFG_VF_DRIVE_ROOT "CDB:" -#define CDB_CFG_SD_VF_DRIVE_LETTER "SD" -#define CDB_CFG_SD_VF_DRIVE_ROOT "SD:" +#define CDB_CFG_SD_VF_DRIVE_LETTER "SD" +#define CDB_CFG_SD_VF_DRIVE_ROOT "SD:" -#define CDB_CFG_CDBID_FILE "cdb.conf" +#define CDB_CFG_CDBID_FILE "cdb.conf" -#endif // PRIVATE_CDB_CONFIGURATION_H +#endif // PRIVATE_CDB_CONFIGURATION_H diff --git a/libs/RevoEX/include/private/cdb/CDBConv.h b/libs/RevoEX/include/private/cdb/CDBConv.h index fbb0a3f0..b2910cad 100644 --- a/libs/RevoEX/include/private/cdb/CDBConv.h +++ b/libs/RevoEX/include/private/cdb/CDBConv.h @@ -6,57 +6,61 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus -BOOL CDBIsMakerCodeStr(const char* makerCode); -BOOL CDBIsGameCodeStr(const char* gameCode); +BOOL CDBIsMakerCodeStr(const char* makerCode); +BOOL CDBIsGameCodeStr(const char* gameCode); -int CDBCompareTypeStr(char* str1, char* str2); +int CDBCompareTypeStr(char* str1, char* str2); -void CDBConvYearValueToYearStr(char* yearStr, int year); -void CDBConvMonthValueToMonthStr(char* monthStr, int month); -void CDBConvDayValueToDayStr(char* dayStr, int day); -void CDBConvHourValueToHourStr(char* hourStr, int hour); -void CDBConvMinuteValueToMinuteStr(char* minuteStr, int minute); +void CDBConvYearValueToYearStr(char* yearStr, int year); +void CDBConvMonthValueToMonthStr(char* monthStr, int month); +void CDBConvDayValueToDayStr(char* dayStr, int day); +void CDBConvHourValueToHourStr(char* hourStr, int hour); +void CDBConvMinuteValueToMinuteStr(char* minuteStr, int minute); -void CDBGenRootPath(char* rootPath, CDBLocation location, u64* wiiId); +void CDBGenRootPath(char* rootPath, CDBLocation location, u64* wiiId); -void CDBConvYearStrToFullPath(char* fullPath, char* yearStr, CDBLocation location, u64* wiiId); -void CDBConvMonthStrToFullPath(char* fullPath, char* yearStr, char* monthStr, CDBLocation location, u64* wiiId); -void CDBConvDayStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, CDBLocation location, u64* wiiId); -void CDBConvHourStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, CDBLocation location, u64* wiiId); -void CDBConvMinuteStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, CDBLocation location, u64* wiiId); -void CDBConvCodeStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, char* codeStr, CDBLocation location, u64* wiiId); -void CDBConvTypeStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, char* codeStr, char* typeStr, CDBLocation location, u64* wiiId); -void CDBConvFileNameStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, char* codeStr, char* typeStr, char* fileStr, CDBLocation location, u64* wiiId); +void CDBConvYearStrToFullPath(char* fullPath, char* yearStr, CDBLocation location, u64* wiiId); +void CDBConvMonthStrToFullPath(char* fullPath, char* yearStr, char* monthStr, CDBLocation location, u64* wiiId); +void CDBConvDayStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, CDBLocation location, u64* wiiId); +void CDBConvHourStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, CDBLocation location, u64* wiiId); +void CDBConvMinuteStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, CDBLocation location, + u64* wiiId); +void CDBConvCodeStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, char* codeStr, + CDBLocation location, u64* wiiId); +void CDBConvTypeStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, char* codeStr, + char* typeStr, CDBLocation location, u64* wiiId); +void CDBConvFileNameStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, char* codeStr, + char* typeStr, char* fileStr, CDBLocation location, u64* wiiId); CDBDate CDBConvDirStrToCDBDate(char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, CDBLocation location, u64* wiiId); -void CDBConvGCStrToGCValue(char* gcStr, u32* gcValue); -void CDBConvGCValueToGCStr(u32 gcValue, char* gcStr); +void CDBConvGCStrToGCValue(char* gcStr, u32* gcValue); +void CDBConvGCValueToGCStr(u32 gcValue, char* gcStr); -void CDBConvMCValueToMCStr(u16 mcValue, char* mcStr); -void CDBConvMCStrToMCValue(char* mcStr, u16* mcValue); +void CDBConvMCValueToMCStr(u16 mcValue, char* mcStr); +void CDBConvMCStrToMCValue(char* mcStr, u16* mcValue); -void CDBConvKeyStrToEpochValue(char* keyString, CDBDate* epochVal); -void CDBConvKeyStrToEpochStr(char* keyString, char* epochVal); +void CDBConvKeyStrToEpochValue(char* keyString, CDBDate* epochVal); +void CDBConvKeyStrToEpochStr(char* keyString, char* epochVal); -void CDBConvEpochStrToEpochValue(char* epochStr, CDBDate* epochVal); -void CDBConvEpochValueToDate(CDBDate epoch, int* year, int* month, int* day, int* hour, int* min, int* sec) NO_INLINE; +void CDBConvEpochStrToEpochValue(char* epochStr, CDBDate* epochVal); +void CDBConvEpochValueToDate(CDBDate epoch, int* year, int* month, int* day, int* hour, int* min, int* sec) NO_INLINE; -CDBErr CDBConvKeyToFullPath(CDBRecordKey* recordKey, char* fullPath); +CDBErr CDBConvKeyToFullPath(CDBRecordKey* recordKey, char* fullPath); -void CDBConvKeyStrToCode(char* keyString, char* code); -void CDBConvKeyStrToSerialNumber(char* keyString, char* serialNum); -void CDBConvKeyStrToFileName(char* keyString, char* fileName); -void CDBConvKeyStrToGameCode(char* keyString, u32* gameCode); -void CDBConvKeyStrToMakerCode(char* keyString, u32* makerCode); -void CDBConvKeyStrToType(char* keyString, char* type); +void CDBConvKeyStrToCode(char* keyString, char* code); +void CDBConvKeyStrToSerialNumber(char* keyString, char* serialNum); +void CDBConvKeyStrToFileName(char* keyString, char* fileName); +void CDBConvKeyStrToGameCode(char* keyString, u32* gameCode); +void CDBConvKeyStrToMakerCode(char* keyString, u32* makerCode); +void CDBConvKeyStrToType(char* keyString, char* type); -void CDBConvertCDBDateToCalendarTime(CDBDate date, int* year, int* month, int* day, int* hour, int* min, int* sec) NO_INLINE; +void CDBConvertCDBDateToCalendarTime(CDBDate date, int* year, int* month, int* day, int* hour, int* min, int* sec) NO_INLINE; #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // PRIVATE_CDB_CONV_H +#endif // PRIVATE_CDB_CONV_H diff --git a/libs/RevoEX/include/private/cdb/CDBCrypt.h b/libs/RevoEX/include/private/cdb/CDBCrypt.h index 5a43a151..215e8b48 100644 --- a/libs/RevoEX/include/private/cdb/CDBCrypt.h +++ b/libs/RevoEX/include/private/cdb/CDBCrypt.h @@ -5,24 +5,24 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus typedef struct _CDBCryptBuf { union { - u8 buffer[0xFB00*4]; - u32 buffer32[0xFB00]; - }; // 0x00 - - u32 unk_0x3EC00; - u32 unk_0x3EC04; - BOOL allocated; // 0x3EC08 - u8 unk_0x3EC0C[0x34]; + u8 buffer[0xFB00 * 4]; + u32 buffer32[0xFB00]; + }; // 0x00 + + u32 unk_0x3EC00; + u32 unk_0x3EC04; + BOOL allocated; // 0x3EC08 + u8 unk_0x3EC0C[0x34]; } CDBCryptBuf; void CDBCryptBufSysInit(CDBCryptBuf* cryptBuf); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // PRIVATE_CDB_CRYPT_H +#endif // PRIVATE_CDB_CRYPT_H diff --git a/libs/RevoEX/include/private/cdb/CDBDatabase.h b/libs/RevoEX/include/private/cdb/CDBDatabase.h index df6bb0a1..1577fad4 100644 --- a/libs/RevoEX/include/private/cdb/CDBDatabase.h +++ b/libs/RevoEX/include/private/cdb/CDBDatabase.h @@ -1,29 +1,33 @@ #ifndef PRIVATE_CDB_WORK_H #define PRIVATE_CDB_WORK_H -#include #include #include +#include + #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus typedef struct _CDBDatabasePool { - u8 unk_0x00[0x14000]; + u8 unk_0x00[0x14000]; } CDBDatabasePool; typedef struct _CDBDatabaseInstance { - u8 unk_0x00[0x3600]; + u8 unk_0x00[0x3600]; } _CDBDatabaseInstance; -void CDBDatabaseInstancePoolInit(void* work); +void CDBDatabaseInstancePoolInit(void* work); -CDBErr CDBDatabasePrivateCreateRecordAtOnce(CDBDatabase* database, CDBRecord* record, const char* typeStr, const char* fileTypeStr, u8* recordData, u32 recordDataSize, char* makerCodeStr, char* gameCodeStr); -CDBErr CDBDatabasePrivateCreateRecordAtOnceEx(CDBDatabase* database, CDBRecord* record, const char* typeStr, const char* fileTypeStr, int year, int month, int day, int hour, int min, int sec, u8* recordData, u32 recordDataSize, char* makerCode, char* gameCode); +CDBErr CDBDatabasePrivateCreateRecordAtOnce(CDBDatabase* database, CDBRecord* record, const char* typeStr, const char* fileTypeStr, u8* recordData, + u32 recordDataSize, char* makerCodeStr, char* gameCodeStr); +CDBErr CDBDatabasePrivateCreateRecordAtOnceEx(CDBDatabase* database, CDBRecord* record, const char* typeStr, const char* fileTypeStr, int year, + int month, int day, int hour, int min, int sec, u8* recordData, u32 recordDataSize, char* makerCode, + char* gameCode); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // PRIVATE_CDB_WORK_H +#endif // PRIVATE_CDB_WORK_H diff --git a/libs/RevoEX/include/private/cdb/CDBFileSystem.h b/libs/RevoEX/include/private/cdb/CDBFileSystem.h index 5a15e736..debc043d 100644 --- a/libs/RevoEX/include/private/cdb/CDBFileSystem.h +++ b/libs/RevoEX/include/private/cdb/CDBFileSystem.h @@ -3,87 +3,88 @@ #include -#include #include +#include + #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus typedef struct _CDBFindDataVF { - VFDta dta; // 0x00 - BOOL isEnd; // 0x444 + VFDta dta; // 0x00 + BOOL isEnd; // 0x444 } CDBFindDataVF; typedef struct _CDBFindDataSD { - VFDta dta; // 0x00 - BOOL isEnd; // 0x444 + VFDta dta; // 0x00 + BOOL isEnd; // 0x444 } CDBFindDataSD; typedef struct _CDBFindData { - CDBLocation loc; // 0x00 - CDBFindDataVF vf; // 0x04 - CDBFindDataSD sd; // 0x44C + CDBLocation loc; // 0x00 + CDBFindDataVF vf; // 0x04 + CDBFindDataSD sd; // 0x44C } CDBFindData; /* === UTILS === */ -void CDBFSConcatenatePath(char* path, const char* concatPath); +void CDBFSConcatenatePath(char* path, const char* concatPath); -BOOL CDBFSIsYearDirName(char* dirName); -BOOL CDBFSIsMonthDirName(char* dirName); -BOOL CDBFSIsDayDirName(char* dirName); -BOOL CDBFSIsHourDirName(char* dirName); -BOOL CDBFSIsMinuteDirName(char* dirName); -BOOL CDBFSIsCodeDirName(char* dirName); -BOOL CDBFSIsTypeDirName(char* dirName); +BOOL CDBFSIsYearDirName(char* dirName); +BOOL CDBFSIsMonthDirName(char* dirName); +BOOL CDBFSIsDayDirName(char* dirName); +BOOL CDBFSIsHourDirName(char* dirName); +BOOL CDBFSIsMinuteDirName(char* dirName); +BOOL CDBFSIsCodeDirName(char* dirName); +BOOL CDBFSIsTypeDirName(char* dirName); -BOOL CDBFSIsCDBFileOnSD(char* fileName); -BOOL CDBFSIsMCGCDirNameOnSD(char* dirName); -BOOL CDBFSIsTypeDirNameOnSD(char* dirName); // Duplicate of CDBFSIsTypeDirNameOn +BOOL CDBFSIsCDBFileOnSD(char* fileName); +BOOL CDBFSIsMCGCDirNameOnSD(char* dirName); +BOOL CDBFSIsTypeDirNameOnSD(char* dirName); // Duplicate of CDBFSIsTypeDirNameOn /* === VF API === */ -char* CDBFindDataGetNameVF(CDBFindDataVF* findData); -int CDBFindDataIsDirectoryVF(CDBFindDataVF* findData); -BOOL CDBFindDataIsEndVF(CDBFindDataVF* findData); +char* CDBFindDataGetNameVF(CDBFindDataVF* findData); +int CDBFindDataIsDirectoryVF(CDBFindDataVF* findData); +BOOL CDBFindDataIsEndVF(CDBFindDataVF* findData); -BOOL CDBFSIsExistFileVF(const char* fileName); +BOOL CDBFSIsExistFileVF(const char* fileName); -void CDBFSFindFirstVF(CDBFindDataVF* findData, const char* fileName); -void CDBFSFindNextVF(CDBFindDataVF* findData); -void CDBFSFindCloseVF(CDBFindDataVF* findData); +void CDBFSFindFirstVF(CDBFindDataVF* findData, const char* fileName); +void CDBFSFindNextVF(CDBFindDataVF* findData); +void CDBFSFindCloseVF(CDBFindDataVF* findData); -BOOL CDBFSIsDirNameVF(char* path); +BOOL CDBFSIsDirNameVF(char* path); -CDBErr CDBFSCreateDirForceVF(const char* dirName); -CDBErr CDBFSDeleteDirVF(const char* dirName); +CDBErr CDBFSCreateDirForceVF(const char* dirName); +CDBErr CDBFSDeleteDirVF(const char* dirName); /* === SD API === */ -void CDBFSSDInit(); +void CDBFSSDInit(); -CDBErr CDBFSSDMount(); -CDBErr CDBFSSDUnmount(); +CDBErr CDBFSSDMount(); +CDBErr CDBFSSDUnmount(); -BOOL CDBFSSDIsMounted(); -BOOL CDBFSSDIsEjected(); -BOOL CDBFSSDIsInserted(); +BOOL CDBFSSDIsMounted(); +BOOL CDBFSSDIsEjected(); +BOOL CDBFSSDIsInserted(); -char* CDBFindDataGetNameSD(CDBFindDataSD* findData); -int CDBFindDataIsDirectorySD(CDBFindDataSD* findData); -BOOL CDBFindDataIsEndSD(CDBFindDataSD* findData); +char* CDBFindDataGetNameSD(CDBFindDataSD* findData); +int CDBFindDataIsDirectorySD(CDBFindDataSD* findData); +BOOL CDBFindDataIsEndSD(CDBFindDataSD* findData); -BOOL CDBFSIsExistFileSD(const char* fileName); +BOOL CDBFSIsExistFileSD(const char* fileName); -void CDBFSFindFirstSD(CDBFindDataSD* findData, const char* fileName); -void CDBFSFindNextSD(CDBFindDataSD* findData); -void CDBFSFindCloseSD(CDBFindDataSD* findData); +void CDBFSFindFirstSD(CDBFindDataSD* findData, const char* fileName); +void CDBFSFindNextSD(CDBFindDataSD* findData); +void CDBFSFindCloseSD(CDBFindDataSD* findData); -BOOL CDBFSIsDirNameSD(char* path); +BOOL CDBFSIsDirNameSD(char* path); -CDBErr CDBFSCreateDirForceSD(const char* dirName); -CDBErr CDBFSDeleteDirSD(const char* dirName); +CDBErr CDBFSCreateDirForceSD(const char* dirName); +CDBErr CDBFSDeleteDirSD(const char* dirName); extern char CDB_SD_VFF_FILE_NAME[72]; @@ -94,21 +95,21 @@ extern char CDB_SD_VF_DRIVE_LETTER[4]; /* === MAIN API === */ -CDBErr CDBFSInit(void* cacheBuffer, u32 cacheSize); -CDBErr CDBFSUninit(); +CDBErr CDBFSInit(void* cacheBuffer, u32 cacheSize); +CDBErr CDBFSUninit(); -void CDBFSFindFirst(CDBFindData* findData, const char* fileName, CDBLocation location); +void CDBFSFindFirst(CDBFindData* findData, const char* fileName, CDBLocation location); -void CDBFSFindFirstRootEx(CDBFindData *findData, CDBLocation location, u64* wiiId); +void CDBFSFindFirstRootEx(CDBFindData* findData, CDBLocation location, u64* wiiId); extern char CDB_WIIID_DAT_PATH[NAND_MAX_PATH]; -#define CDB_WIIID_DAT_SIZE 40 +#define CDB_WIIID_DAT_SIZE 40 extern char CDB_VFF_FILE_NAME[NAND_MAX_PATH]; -extern u32 CDB_VFF_FILE_SIZE; +extern u32 CDB_VFF_FILE_SIZE; #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // PRIVATE_CDB_FILE_SYSTEM_H +#endif // PRIVATE_CDB_FILE_SYSTEM_H diff --git a/libs/RevoEX/include/private/cdb/CDBRecord.h b/libs/RevoEX/include/private/cdb/CDBRecord.h index 29cef221..0b3bf7e7 100644 --- a/libs/RevoEX/include/private/cdb/CDBRecord.h +++ b/libs/RevoEX/include/private/cdb/CDBRecord.h @@ -1,87 +1,84 @@ #ifndef PRIVATE_CDB_RECORD_H #define PRIVATE_CDB_RECORD_H -#include #include #include +#include + #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus typedef struct _CDBRecordFile { - u8 unk_0x00[0x1C - 0x00]; - int unk_0x1C; - CDBAttr attr; // 0x20 - CDBBridgeFile bridgeFile; // 0x42C - u8 unk_0x434[0x438 - 0x434]; - CDBRecordKey key; // 0x438 - u8 unk_0x468[0x480 - 0x468]; + u8 unk_0x00[0x1C - 0x00]; + int unk_0x1C; + CDBAttr attr; // 0x20 + CDBBridgeFile bridgeFile; // 0x42C + u8 unk_0x434[0x438 - 0x434]; + CDBRecordKey key; // 0x438 + u8 unk_0x468[0x480 - 0x468]; } CDBRecordFile; -enum { - CDB_RECORD_ALLOC_READ = (1 << 0), - CDB_RECORD_ALLOC_WRITE = (1 << 1), - CDB_RECORD_ALLOC_RW = CDB_RECORD_ALLOC_READ | CDB_RECORD_ALLOC_WRITE -}; +enum { CDB_RECORD_ALLOC_READ = (1 << 0), CDB_RECORD_ALLOC_WRITE = (1 << 1), CDB_RECORD_ALLOC_RW = CDB_RECORD_ALLOC_READ | CDB_RECORD_ALLOC_WRITE }; /* RECORD POOL */ -CDBErr CDBRecordPoolInit(void* work); +CDBErr CDBRecordPoolInit(void* work); /* RECORD */ -CDBErr CDBRecordAllocate(CDBRecord* record, int flag); -CDBErr CDBRecordFree(CDBRecord* record); +CDBErr CDBRecordAllocate(CDBRecord* record, int flag); +CDBErr CDBRecordFree(CDBRecord* record); /* RECORD KEY */ -BOOL CDBRecordKeyIsValid(CDBRecordKey* recordKey); +BOOL CDBRecordKeyIsValid(CDBRecordKey* recordKey); -void CDBRecordKeyInitByOnlyDate(CDBRecordKey* recordKey, CDBDate epoch); -void CDBRecordKeyInitFromFileName2(CDBRecordKey* recordKey, char* keyString, char* gameCode, char* fileType); -void CDBRecordKeyInit(CDBRecordKey* recordKey, CDBDate epoch, int gameCode, u16 makerCode, int serialNumber, char* fileType, int unk); +void CDBRecordKeyInitByOnlyDate(CDBRecordKey* recordKey, CDBDate epoch); +void CDBRecordKeyInitFromFileName2(CDBRecordKey* recordKey, char* keyString, char* gameCode, char* fileType); +void CDBRecordKeyInit(CDBRecordKey* recordKey, CDBDate epoch, int gameCode, u16 makerCode, int serialNumber, char* fileType, int unk); -void CDBRecordKeyGetKeyStr(CDBRecordKey* recordKey, char* keyString); +void CDBRecordKeyGetKeyStr(CDBRecordKey* recordKey, char* keyString); -void CDBRecordKeySetSerialNumber(CDBRecordKey* recordKey, int serialNum); +void CDBRecordKeySetSerialNumber(CDBRecordKey* recordKey, int serialNum); -void CDBRecordKeyCopy(CDBRecordKey* recordKey, CDBRecordKey* newRecordKey); +void CDBRecordKeyCopy(CDBRecordKey* recordKey, CDBRecordKey* newRecordKey); -BOOL CDBRecordKeyCompare(CDBRecordKey* recordKey1, CDBRecordKey* recordKey2); -int CDBRecordKeyCompareByDate(CDBRecordKey* recordKey1, CDBRecordKey* recordKey2); +BOOL CDBRecordKeyCompare(CDBRecordKey* recordKey1, CDBRecordKey* recordKey2); +int CDBRecordKeyCompareByDate(CDBRecordKey* recordKey1, CDBRecordKey* recordKey2); /* RECORD FILE */ -CDBErr CDBRecordFileReadAttrBuf(CDBRecord* record); -CDBErr CDBRecordFileWriteAttrBuf(CDBRecord* record); +CDBErr CDBRecordFileReadAttrBuf(CDBRecord* record); +CDBErr CDBRecordFileWriteAttrBuf(CDBRecord* record); -CDBErr CDBRecordFileCreateBlank(CDBRecord* record); -CDBErr CDBRecordFileCreateAtOnce(CDBRecord* record, void* buffer, u32 size); +CDBErr CDBRecordFileCreateBlank(CDBRecord* record); +CDBErr CDBRecordFileCreateAtOnce(CDBRecord* record, void* buffer, u32 size); -CDBErr CDBRecordFileDelete(CDBRecord* record); +CDBErr CDBRecordFileDelete(CDBRecord* record); -CDBErr CDBRecordFileDump(CDBRecord* record, void* buffer, u32 size); +CDBErr CDBRecordFileDump(CDBRecord* record, void* buffer, u32 size); -CDBErr CDBRecordFileOpen(CDBRecord* record, char* fileName, int allocFlag); -CDBErr CDBRecordFileClose(CDBRecord* record); +CDBErr CDBRecordFileOpen(CDBRecord* record, char* fileName, int allocFlag); +CDBErr CDBRecordFileClose(CDBRecord* record); -CDBErr CDBRecordFileGetFileSize(CDBRecord* record, u32* fileSize); -CDBErr CDBRecordFileGetDataSize(CDBRecord* record, u32* dataSize); +CDBErr CDBRecordFileGetFileSize(CDBRecord* record, u32* fileSize); +CDBErr CDBRecordFileGetDataSize(CDBRecord* record, u32* dataSize); -CDBErr CDBRecordFileWriteData(CDBRecord* record, void* buffer, u32 size); +CDBErr CDBRecordFileWriteData(CDBRecord* record, void* buffer, u32 size); -CDBErr CDBRecordFileReadData(CDBRecord* record, void* buffer, u32 size, u32* readSize); -CDBErr CDBRecordFileReadDataFile(CDBRecord* record, void* buffer, u32 size, u32* readSize); +CDBErr CDBRecordFileReadData(CDBRecord* record, void* buffer, u32 size, u32* readSize); +CDBErr CDBRecordFileReadDataFile(CDBRecord* record, void* buffer, u32 size, u32* readSize); -CDBErr CDBRecordFileSeekData(CDBRecord* record, u32 offset, CDBSeek seek); -CDBErr CDBRecordFileSeekDataFile(CDBRecord* record, u32 offset, CDBSeek seek); +CDBErr CDBRecordFileSeekData(CDBRecord* record, u32 offset, CDBSeek seek); +CDBErr CDBRecordFileSeekDataFile(CDBRecord* record, u32 offset, CDBSeek seek); -int CDBRecordFileTellData(CDBRecord* record); -int CDBRecordFileTellDataFile(CDBRecord* record); +int CDBRecordFileTellData(CDBRecord* record); +int CDBRecordFileTellDataFile(CDBRecord* record); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // PRIVATE_CDB_RECORD_H +#endif // PRIVATE_CDB_RECORD_H diff --git a/libs/RevoEX/include/private/cdb/CDBReport.h b/libs/RevoEX/include/private/cdb/CDBReport.h index d2722e1c..43462ea1 100644 --- a/libs/RevoEX/include/private/cdb/CDBReport.h +++ b/libs/RevoEX/include/private/cdb/CDBReport.h @@ -7,25 +7,26 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus -BOOL CDBIsPrintDebugMessage(s32 type); -void CDBReport_(s32 type); +BOOL CDBIsPrintDebugMessage(s32 type); +void CDBReport_(s32 type); -#define CDBReport(type, args...) { \ - if (CDBIsPrintDebugMessage(type)) { \ - CDBReport_((s32)type); \ - OSReport(args); \ - } \ -} +#define CDBReport(type, args...) \ + { \ + if (CDBIsPrintDebugMessage(type)) { \ + CDBReport_((s32)type); \ + OSReport(args); \ + } \ + } -#define CDBReportFatal(args...) CDBReport(CDB_VERBOSE_LEVEL_FATAL, args) -#define CDBReportError(args...) CDBReport(CDB_VERBOSE_LEVEL_ERROR, args) -#define CDBReportWarn(args...) CDBReport(CDB_VERBOSE_LEVEL_WARN, args) -#define CDBReportInfo(args...) CDBReport(CDB_VERBOSE_LEVEL_INFO, args) +#define CDBReportFatal(args...) CDBReport(CDB_VERBOSE_LEVEL_FATAL, args) +#define CDBReportError(args...) CDBReport(CDB_VERBOSE_LEVEL_ERROR, args) +#define CDBReportWarn(args...) CDBReport(CDB_VERBOSE_LEVEL_WARN, args) +#define CDBReportInfo(args...) CDBReport(CDB_VERBOSE_LEVEL_INFO, args) #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // PRIVATE_CDB_REPORT_H +#endif // PRIVATE_CDB_REPORT_H diff --git a/libs/RevoEX/include/private/cdb/CDBUtils.h b/libs/RevoEX/include/private/cdb/CDBUtils.h index 66f32489..8608477a 100644 --- a/libs/RevoEX/include/private/cdb/CDBUtils.h +++ b/libs/RevoEX/include/private/cdb/CDBUtils.h @@ -7,22 +7,23 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus -int CDBSafeStrLen(const char* s, int n); +int CDBSafeStrLen(const char* s, int n); -void CDBCheckMakerCodeStr(char* makerCodeStr); -void CDBCheckGameCodeStr(char* gameCodeStr); +void CDBCheckMakerCodeStr(char* makerCodeStr); +void CDBCheckGameCodeStr(char* gameCodeStr); -#define CDBToLower(string, count) { \ - int i; \ - for (i = 0; i < count; i++) { \ - string[i] = tolower(string[i]); \ - } \ -} +#define CDBToLower(string, count) \ + { \ + int i; \ + for (i = 0; i < count; i++) { \ + string[i] = tolower(string[i]); \ + } \ + } #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // PRIVATE_CDB_UTILS_H +#endif // PRIVATE_CDB_UTILS_H diff --git a/libs/RevoEX/include/private/nwc24.h b/libs/RevoEX/include/private/nwc24.h index f8a8e44f..f6a1df47 100644 --- a/libs/RevoEX/include/private/nwc24.h +++ b/libs/RevoEX/include/private/nwc24.h @@ -7,9 +7,9 @@ #include #include -#include #include #include +#include #include #include @@ -27,6 +27,6 @@ #include #include -NWC24Err NWC24iPrepareShutdown(); +NWC24Err NWC24iPrepareShutdown(); #endif // REVOLUTION_NWC24_H diff --git a/libs/RevoEX/include/private/nwc24/NWC24Config.h b/libs/RevoEX/include/private/nwc24/NWC24Config.h index c70e1391..34892321 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24Config.h +++ b/libs/RevoEX/include/private/nwc24/NWC24Config.h @@ -10,10 +10,10 @@ extern "C" { #endif -#define NWC24_CONFIG_MAGIC 'WcCf' -#define NWC24_CONFIG_CURRENT_VERSION 8 +#define NWC24_CONFIG_MAGIC 'WcCf' +#define NWC24_CONFIG_CURRENT_VERSION 8 -#define NWC24_CONFIG_MAX_ID_COUNT 32 +#define NWC24_CONFIG_MAX_ID_COUNT 32 typedef enum NWC24IdCreationStage { NWC24_IDCS_INITIAL = 0, @@ -22,41 +22,41 @@ typedef enum NWC24IdCreationStage { } NWC24IdCreationStage; typedef struct NWC24ConfigData { - u32 magic; // 0x00 - u32 version; // 0x04 + u32 magic; // 0x00 + u32 version; // 0x04 - NWC24UserId userId; // 0x08 + NWC24UserId userId; // 0x08 - u32 idCreationCount; // 0x10 - u32 idCreationStage; // 0x14 + u32 idCreationCount; // 0x10 + u32 idCreationStage; // 0x14 - char accountDomain[64]; // 0x18 - char password[32]; // 0x58 + char accountDomain[64]; // 0x18 + char password[32]; // 0x58 - char mailCheckId[36]; // 0x78 - char accMgtServerURL[128]; // 0x9C + char mailCheckId[36]; // 0x78 + char accMgtServerURL[128]; // 0x9C - char mailChkServerURL[128]; // 0x11C - char mailRcvServerURL[128]; // 0x19C - char mailDelServerURL[128]; // 0x21C - char mailTrsServerURL[128]; // 0x29C + char mailChkServerURL[128]; // 0x11C + char mailRcvServerURL[128]; // 0x19C + char mailDelServerURL[128]; // 0x21C + char mailTrsServerURL[128]; // 0x29C - char unk_0x31C[0x3F8 - 0x31C]; + char unk_0x31C[0x3F8 - 0x31C]; - BOOL allowBootWC24Title; // 0x3F8 + BOOL allowBootWC24Title; // 0x3F8 - u32 checksum; // 0x3FC + u32 checksum; // 0x3FC } NWC24ConfigData; -NWC24Err NWC24iConfigInit(BOOL deleteSomeFile); -NWC24Err NWC24iConfigOpen(); -NWC24Err NWC24iConfigReload(); -NWC24Err NWC24iConfigFlush(); +NWC24Err NWC24iConfigInit(BOOL deleteSomeFile); +NWC24Err NWC24iConfigOpen(); +NWC24Err NWC24iConfigReload(); +NWC24Err NWC24iConfigFlush(); -void NWC24SetIdCreationCount(u32 idCreationCount); -u32 NWC24GetIdCreationCount(); +void NWC24SetIdCreationCount(u32 idCreationCount); +u32 NWC24GetIdCreationCount(); -NWC24Err NWC24GetIdCreationStage(NWC24IdCreationStage* idCreationStage); +NWC24Err NWC24GetIdCreationStage(NWC24IdCreationStage* idCreationStage); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/private/nwc24/NWC24Download.h b/libs/RevoEX/include/private/nwc24/NWC24Download.h index f1752606..0b466fa0 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24Download.h +++ b/libs/RevoEX/include/private/nwc24/NWC24Download.h @@ -9,8 +9,8 @@ extern "C" { #endif -NWC24Err NWC24iOpenDlTaskList(); -NWC24Err NWC24iCloseDlTaskList(); +NWC24Err NWC24iOpenDlTaskList(); +NWC24Err NWC24iCloseDlTaskList(); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/private/nwc24/NWC24File.h b/libs/RevoEX/include/private/nwc24/NWC24File.h index a710d9f5..4e019d39 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24File.h +++ b/libs/RevoEX/include/private/nwc24/NWC24File.h @@ -1,10 +1,11 @@ #ifndef PRIVATE_NWC24_FILE_H #define PRIVATE_NWC24_FILE_H -#include #include +#include #include + #include #ifdef __cplusplus @@ -49,53 +50,53 @@ enum { }; typedef struct NWC24File { - u32 id; // at 0x0 - u32 mode; // at 0x4 + u32 id; // at 0x0 + u32 mode; // at 0x4 - u32 align; // at 0x8 + u32 align; // at 0x8 - NANDFileInfo nand; // at 0xC - VFFILE* vf; // at 0x98 + NANDFileInfo nand; // at 0xC + VFFILE* vf; // at 0x98 } NWC24File; typedef struct NWC24FileStream { - NWC24File* file; // 0x00 + NWC24File* file; // 0x00 - char* buffer; // 0x04 - u32 length; // 0x08 - u32 realOffset; // 0x0C + char* buffer; // 0x04 + u32 length; // 0x08 + u32 realOffset; // 0x0C - u32 baseOffset; // 0x10 - u32 currentOffset; // 0x14 + u32 baseOffset; // 0x10 + u32 currentOffset; // 0x14 - u32 areaSize; // 0x18 + u32 areaSize; // 0x18 } NWC24FileStream; -#define NWC24_VF_DRIVE "@24" +#define NWC24_VF_DRIVE "@24" -NWC24Err NWC24FOpen(NWC24File* file, const char* path, u32 mode); -NWC24Err NWC24iFOpenNand(NWC24File* file, const char* path, u32 mode); -NWC24Err NWC24iFOpenVF(NWC24File* file, const char* path, u32 mode); +NWC24Err NWC24FOpen(NWC24File* file, const char* path, u32 mode); +NWC24Err NWC24iFOpenNand(NWC24File* file, const char* path, u32 mode); +NWC24Err NWC24iFOpenVF(NWC24File* file, const char* path, u32 mode); -NWC24Err NWC24FClose(NWC24File* file); -NWC24Err NWC24iFCloseNand(NWC24File* file) NO_INLINE; -NWC24Err NWC24iFCloseVF(NWC24File* file); +NWC24Err NWC24FClose(NWC24File* file); +NWC24Err NWC24iFCloseNand(NWC24File* file) NO_INLINE; +NWC24Err NWC24iFCloseVF(NWC24File* file); -NWC24Err NWC24FSeek(NWC24File* file, s32 offset, int whence); -NWC24Err NWC24FRead(void* dest, s32 size, NWC24File* file); -NWC24Err NWC24FWrite(const void* src, s32 size, NWC24File* file); -NWC24Err NWC24FGetLength(NWC24File* file, u32* pLength); -NWC24Err NWC24FDelete(const char* path); -NWC24Err NWC24FDeleteVF(const char* path); -NWC24Err NWC24MountVF(const char* drive, const char* fileName); -NWC24Err NWC24UnmountVF(const char* drive); -NWC24Err NWC24CheckSizeVF(const char* drive, u32* pSize); +NWC24Err NWC24FSeek(NWC24File* file, s32 offset, int whence); +NWC24Err NWC24FRead(void* dest, s32 size, NWC24File* file); +NWC24Err NWC24FWrite(const void* src, s32 size, NWC24File* file); +NWC24Err NWC24FGetLength(NWC24File* file, u32* pLength); +NWC24Err NWC24FDelete(const char* path); +NWC24Err NWC24FDeleteVF(const char* path); +NWC24Err NWC24MountVF(const char* drive, const char* fileName); +NWC24Err NWC24UnmountVF(const char* drive); +NWC24Err NWC24CheckSizeVF(const char* drive, u32* pSize); -NWC24Err NWC24FStreamInit(NWC24FileStream* stream, NWC24File* file, u32 baseOffset, u32 areaSize, char* buffer, u32 size); -u32 NWC24FStreamGetSize(NWC24FileStream* stream); -char NWC24FStreamGetc(NWC24FileStream* stream); -NWC24Err NWC24FStreamSeek(NWC24FileStream* stream, u32 pos); -NWC24Err NWC24FStreamGetPtr(NWC24FileStream* stream, char** buffer, u32 length); +NWC24Err NWC24FStreamInit(NWC24FileStream* stream, NWC24File* file, u32 baseOffset, u32 areaSize, char* buffer, u32 size); +u32 NWC24FStreamGetSize(NWC24FileStream* stream); +char NWC24FStreamGetc(NWC24FileStream* stream); +NWC24Err NWC24FStreamSeek(NWC24FileStream* stream, u32 pos); +NWC24Err NWC24FStreamGetPtr(NWC24FileStream* stream, char** buffer, u32 length); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/private/nwc24/NWC24FriendList.h b/libs/RevoEX/include/private/nwc24/NWC24FriendList.h index ca193c9f..de6c9d86 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24FriendList.h +++ b/libs/RevoEX/include/private/nwc24/NWC24FriendList.h @@ -13,36 +13,36 @@ extern "C" { /* Friend List */ typedef struct NWC24FLHeader { - u32 magic; // 0x00 - u32 version; // 0x04 - u32 infoCount; // 0x08 - u32 registeredCount; // 0x0C - u32 unk_0x10[4]; - u32 unk_0x20[7]; - u32 unk_0x3C; - NWC24UserId friendIds[NWC24_FRIEND_INFO_MAX]; // 0x40 + u32 magic; // 0x00 + u32 version; // 0x04 + u32 infoCount; // 0x08 + u32 registeredCount; // 0x0C + u32 unk_0x10[4]; + u32 unk_0x20[7]; + u32 unk_0x3C; + NWC24UserId friendIds[NWC24_FRIEND_INFO_MAX]; // 0x40 } NWC24FLHeader; -NWC24Err NWC24iInitFriendList(BOOL force); -NWC24Err NWC24iCreateFriendList(); +NWC24Err NWC24iInitFriendList(BOOL force); +NWC24Err NWC24iCreateFriendList(); -NWC24Err NWC24iOpenFriendList(); -NWC24Err NWC24iReadFriendInfoRaw(NWC24FriendInfo* info, u32 index); +NWC24Err NWC24iOpenFriendList(); +NWC24Err NWC24iReadFriendInfoRaw(NWC24FriendInfo* info, u32 index); /* Secret Friend List */ typedef struct NWC24SecretFLHeader { - u32 magic; // 0x00 - u32 version; // 0x04 - u32 infoCount; // 0x08 + u32 magic; // 0x00 + u32 version; // 0x04 + u32 infoCount; // 0x08 u32 unk_0x0C; - u8 unk_0x10[0x7F0]; + u8 unk_0x10[0x7F0]; } NWC24SecretFLHeader; -NWC24Err NWC24iInitSecretFriendList(BOOL force); +NWC24Err NWC24iInitSecretFriendList(BOOL force); -NWC24Err NWC24iCreateSecretFriendList(); -NWC24Err NWC24iOpenSecretFriendList(); +NWC24Err NWC24iCreateSecretFriendList(); +NWC24Err NWC24iOpenSecretFriendList(); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/private/nwc24/NWC24Ipc.h b/libs/RevoEX/include/private/nwc24/NWC24Ipc.h index f971a407..86d98530 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24Ipc.h +++ b/libs/RevoEX/include/private/nwc24/NWC24Ipc.h @@ -1,8 +1,9 @@ #ifndef PRIVATE_NWC24_IPC_H #define PRIVATE_NWC24_IPC_H -#include #include +#include + #include @@ -10,18 +11,21 @@ extern "C" { #endif -NWC24Err NWC24iOpenResourceManager(const char* funcName, const char* path, s32* pFd, u32 flags); -#define NWC24OpenResourceManager(path, pFd, flags) NWC24iOpenResourceManager(__FUNCTION__, path, pFd, flags) -NWC24Err NWC24iCloseResourceManager(const char* funcName, s32 fd); -#define NWC24CloseResourceManager(fd) NWC24iCloseResourceManager(__FUNCTION__, fd) +NWC24Err NWC24iOpenResourceManager(const char* funcName, const char* path, s32* pFd, u32 flags); +#define NWC24OpenResourceManager(path, pFd, flags) NWC24iOpenResourceManager(__FUNCTION__, path, pFd, flags) +NWC24Err NWC24iCloseResourceManager(const char* funcName, s32 fd); +#define NWC24CloseResourceManager(fd) NWC24iCloseResourceManager(__FUNCTION__, fd) -NWC24Err NWC24iIoctlResourceManager(const char* funcName, s32 fd, s32 cmd, void* input, u32 input_bytes, void* output, u32 output_bytes); -#define NWC24IoctlResourceManager(fd, cmd, input, input_bytes, output, output_bytes) NWC24iIoctlResourceManager(__FUNCTION__, fd, cmd, input, input_bytes, output, output_bytes) -NWC24Err NWC24iIoctlResourceManagerAsync(const char* funcName, s32 fd, s32 cmd, void* input, u32 input_bytes, void* output, u32 output_bytes, s32* ret); -#define NWC24IoctlResourceManagerAsync(fd, cmd, input, input_bytes, output, output_bytes, ret) NWC24iIoctlResourceManagerAsync(__FUNCTION__, fd, cmd, input, input_bytes, output, output_bytes, ret) +NWC24Err NWC24iIoctlResourceManager(const char* funcName, s32 fd, s32 cmd, void* input, u32 input_bytes, void* output, u32 output_bytes); +#define NWC24IoctlResourceManager(fd, cmd, input, input_bytes, output, output_bytes) \ + NWC24iIoctlResourceManager(__FUNCTION__, fd, cmd, input, input_bytes, output, output_bytes) +NWC24Err NWC24iIoctlResourceManagerAsync(const char* funcName, s32 fd, s32 cmd, void* input, u32 input_bytes, void* output, u32 output_bytes, + s32* ret); +#define NWC24IoctlResourceManagerAsync(fd, cmd, input, input_bytes, output, output_bytes, ret) \ + NWC24iIoctlResourceManagerAsync(__FUNCTION__, fd, cmd, input, input_bytes, output, output_bytes, ret) -BOOL NWC24iIsAsyncRequestPending(); -#define NWC24IsAsyncRequestPending() NWC24iIsAsyncRequestPending() +BOOL NWC24iIsAsyncRequestPending(); +#define NWC24IsAsyncRequestPending() NWC24iIsAsyncRequestPending() #ifdef __cplusplus } diff --git a/libs/RevoEX/include/private/nwc24/NWC24MBox.h b/libs/RevoEX/include/private/nwc24/NWC24MBox.h index 8b04288a..3e40510e 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24MBox.h +++ b/libs/RevoEX/include/private/nwc24/NWC24MBox.h @@ -9,7 +9,7 @@ extern "C" { #endif -NWC24Err NWC24iOpenMBox(); +NWC24Err NWC24iOpenMBox(); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/private/nwc24/NWC24Manage.h b/libs/RevoEX/include/private/nwc24/NWC24Manage.h index 7dc821d4..388888a2 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24Manage.h +++ b/libs/RevoEX/include/private/nwc24/NWC24Manage.h @@ -9,7 +9,7 @@ extern "C" { #endif -NWC24Err NWC24iSetNewMsgArrived(u32 flags); +NWC24Err NWC24iSetNewMsgArrived(u32 flags); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/private/nwc24/NWC24Mime.h b/libs/RevoEX/include/private/nwc24/NWC24Mime.h index 4e72a6a5..932a5fe2 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24Mime.h +++ b/libs/RevoEX/include/private/nwc24/NWC24Mime.h @@ -10,17 +10,18 @@ extern "C" { #endif -void NWC24InitBase64Table(u8* table); +void NWC24InitBase64Table(u8* table); -NWC24Err NWC24Base64Encode(u8* decoded, int decodedSize, u8* encooded, int encodedSize, u32* stringSize); -NWC24Err NWC24Base64Decode(u8* encooded, int encodedSize, u8* decoded, int decodedSize, u32* stringSize); +NWC24Err NWC24Base64Encode(u8* decoded, int decodedSize, u8* encooded, int encodedSize, u32* stringSize); +NWC24Err NWC24Base64Decode(u8* encooded, int encodedSize, u8* decoded, int decodedSize, u32* stringSize); -NWC24Err NWC24EncodeQuotedPrintable(char* encData, u32 encDataSize, u32* encodedSize, u8* decData, u32 decDataSize, u32* decodedSize); -NWC24Err NWC24DecodeQuotedPrintable(char* decData, u32 decDataSize, u32* decodedSize, u8* encData, u32 encDataSize, u32* encodedSize); +NWC24Err NWC24EncodeQuotedPrintable(char* encData, u32 encDataSize, u32* encodedSize, u8* decData, u32 decDataSize, u32* decodedSize); +NWC24Err NWC24DecodeQuotedPrintable(char* decData, u32 decDataSize, u32* decodedSize, u8* encData, u32 encDataSize, u32* encodedSize); -NWC24Err NWC24EncodeWord(u8* encData, u32 encDataSize, u32* encodedSize, char* charset, u32 charsetSize, char encoding, u8* decData, u32 decDataSize); +NWC24Err NWC24EncodeWord(u8* encData, u32 encDataSize, u32* encodedSize, char* charset, u32 charsetSize, char encoding, u8* decData, u32 decDataSize); -NWC24Err NWC24DecodeMIMEHeaderFieldBody(u8* charsetData, u32 charsetDataSize, u8* decData, u32 decDataSize, u32* decodedSize, u8* encData, u32 encDataSize); +NWC24Err NWC24DecodeMIMEHeaderFieldBody(u8* charsetData, u32 charsetDataSize, u8* decData, u32 decDataSize, u32* decodedSize, u8* encData, + u32 encDataSize); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/private/nwc24/NWC24MsgObj.h b/libs/RevoEX/include/private/nwc24/NWC24MsgObj.h index cfffcd10..218e8e2f 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24MsgObj.h +++ b/libs/RevoEX/include/private/nwc24/NWC24MsgObj.h @@ -4,8 +4,8 @@ #include #include -#include #include +#include #include @@ -13,56 +13,56 @@ extern "C" { #endif -#define NWC24_MSG_RECIPIENT_MAX 8 -#define NWC24_MSG_ATTACHMENT_MAX 2 +#define NWC24_MSG_RECIPIENT_MAX 8 +#define NWC24_MSG_ATTACHMENT_MAX 2 typedef struct NWC24MsgObjPrivate { - u32 msgId; // 0x00 - u32 type; // 0x04 - u32 length; // 0x08 - u32 appId; // 0x0C - u8 unk_0x10[0x4]; - u32 tag; // 0x14 - u32 ledPattern; // 0x18 - NWC24UserId fromId; // 0x20 - u32 unk_0x28; - u32 unk_0x2C; - NWC24Data unk_0x30; - NWC24Data unk_0x38; - NWC24Data subject; // 0x40 - NWC24Data text; // 0x48 - NWC24Data unk_0x50; - NWC24Data unk_0x58; - NWC24Charset charset; // 0x60 - NWC24Encoding encoding; // 0x64 - NWC24Data attached[NWC24_MSG_ATTACHMENT_MAX]; // 0x68 - u32 attachedSize[NWC24_MSG_ATTACHMENT_MAX]; // 0x78 - NWC24MIMEType attachedType[NWC24_MSG_ATTACHMENT_MAX]; // 0x80 + u32 msgId; // 0x00 + u32 type; // 0x04 + u32 length; // 0x08 + u32 appId; // 0x0C + u8 unk_0x10[0x4]; + u32 tag; // 0x14 + u32 ledPattern; // 0x18 + NWC24UserId fromId; // 0x20 + u32 unk_0x28; + u32 unk_0x2C; + NWC24Data unk_0x30; + NWC24Data unk_0x38; + NWC24Data subject; // 0x40 + NWC24Data text; // 0x48 + NWC24Data unk_0x50; + NWC24Data unk_0x58; + NWC24Charset charset; // 0x60 + NWC24Encoding encoding; // 0x64 + NWC24Data attached[NWC24_MSG_ATTACHMENT_MAX]; // 0x68 + u32 attachedSize[NWC24_MSG_ATTACHMENT_MAX]; // 0x78 + NWC24MIMEType attachedType[NWC24_MSG_ATTACHMENT_MAX]; // 0x80 union { NWC24UserId toIds[NWC24_MSG_RECIPIENT_MAX]; - NWC24Data toAddrs[NWC24_MSG_RECIPIENT_MAX]; - }; // 0x88 - u8 numTo; // 0xC8 - u8 numAttached; // 0xC9 - u16 groupId; // 0xCA + NWC24Data toAddrs[NWC24_MSG_RECIPIENT_MAX]; + }; // 0x88 + u8 numTo; // 0xC8 + u8 numAttached; // 0xC9 + u16 groupId; // 0xCA union { struct { u32 noreply : 1; u32 unknown : 7; - u32 delay : 8; + u32 delay : 8; u32 regdate : 16; }; u32 raw; - } msgBoardFlags; // 0xCC - NWC24Data unk_0xD0; - NWC24Data faceData; // 0xD8 - NWC24Data altName; // 0xE0 - u32 textSize; // 0xE4 - u32 dwcId; // 0xEC - u32 iconNew; // 0xF0 - u32 unk_0xF4; - u32 unk_0xF8; - u32 unk_0xFC; + } msgBoardFlags; // 0xCC + NWC24Data unk_0xD0; + NWC24Data faceData; // 0xD8 + NWC24Data altName; // 0xE0 + u32 textSize; // 0xE4 + u32 dwcId; // 0xEC + u32 iconNew; // 0xF0 + u32 unk_0xF4; + u32 unk_0xF8; + u32 unk_0xFC; } NWC24MsgObjPrivate; #ifdef __cplusplus diff --git a/libs/RevoEX/include/private/nwc24/NWC24Parser.h b/libs/RevoEX/include/private/nwc24/NWC24Parser.h index cec65d21..7386bdc1 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24Parser.h +++ b/libs/RevoEX/include/private/nwc24/NWC24Parser.h @@ -16,14 +16,14 @@ const char* NWC24GetMIMETypeStr(NWC24MIMEType type); const char* NWC24iGetMIMETypeSuffix(NWC24MIMEType type); const char* NWC24GetCharsetStr(NWC24Charset charset); -NWC24Err NWC24ParseCharsetStr(NWC24Charset* charset, const char* str); +NWC24Err NWC24ParseCharsetStr(NWC24Charset* charset, const char* str); const char* NWC24GetEncodingStr(NWC24Encoding encoding); -NWC24Err NWC24ParseEncodingStr(NWC24Encoding* encoding, const char* str); +NWC24Err NWC24ParseEncodingStr(NWC24Encoding* encoding, const char* str); -NWC24Err NWC24iExtractAddrSpec(NWC24FileStream* fileStream, u32 fullAddrLen, u32 startIdx, char* newAddr, u32 newAddrLen); +NWC24Err NWC24iExtractAddrSpec(NWC24FileStream* fileStream, u32 fullAddrLen, u32 startIdx, char* newAddr, u32 newAddrLen); -NWC24Err NWC24iSearchHeaderF(NWC24FileStream* fileStream, const char* fieldName, u32 headerSize, u32* foundOffset, u32* foundLength); +NWC24Err NWC24iSearchHeaderF(NWC24FileStream* fileStream, const char* fieldName, u32 headerSize, u32* foundOffset, u32* foundLength); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/private/nwc24/NWC24Private.h b/libs/RevoEX/include/private/nwc24/NWC24Private.h index 84aa47bf..c99de16c 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24Private.h +++ b/libs/RevoEX/include/private/nwc24/NWC24Private.h @@ -10,37 +10,37 @@ extern "C" { #endif typedef struct NWC24Data { - const void* ptr; // 0x00 - u32 size; // 0x04 + const void* ptr; // 0x00 + u32 size; // 0x04 } NWC24Data; typedef struct NWC24Work NWC24Work; extern struct NWC24Work { - char stringWork[1024]; // 0x00 - char mainWork[1024]; // 0x400 - char pathWork[256]; // 0x800 + char stringWork[1024]; // 0x00 + char mainWork[1024]; // 0x400 + char pathWork[256]; // 0x800 - u8 readBuffer[512]; // 0x900 - u8 writeBuffer[2048]; // 0xB00 + u8 readBuffer[512]; // 0x900 + u8 writeBuffer[2048]; // 0xB00 - u8 configData[1024]; // 0x1300 + u8 configData[1024]; // 0x1300 - u8 unk_0x1700[128]; // 0x1700 - u8 unk_0x1780[128]; // 0x1780 - u8 unk_0x1800[256]; // 0x1800 - u8 base64Work[256]; // 0x1900 - u8 unk_0x1A00[4096]; // 0x1A00 + u8 unk_0x1700[128]; // 0x1700 + u8 unk_0x1780[128]; // 0x1780 + u8 unk_0x1800[256]; // 0x1800 + u8 base64Work[256]; // 0x1900 + u8 unk_0x1A00[4096]; // 0x1A00 - u8 flHead[1024]; // 0x2A00 - u8 secretFlHead[2048]; // 0x2E00 + u8 flHead[1024]; // 0x2A00 + u8 secretFlHead[2048]; // 0x2E00 - u8 dlHead[2048]; // 0x3600 - u8 dlTask[512]; // 0x3E00 -} *NWC24WorkP; + u8 dlHead[2048]; // 0x3600 + u8 dlTask[512]; // 0x3E00 +}* NWC24WorkP; -void NWC24Data_Init(NWC24Data* data); -void NWC24Data_SetDataP(NWC24Data* data, const void* ptr, u32 size); +void NWC24Data_Init(NWC24Data* data); +void NWC24Data_SetDataP(NWC24Data* data, const void* ptr, u32 size); enum { NWC24_IOCTL_SUSPEND_SCHEDULER = 1, @@ -54,7 +54,7 @@ enum { NWC24_IOCTL_SHUTDOWN = 40, }; -#define nwc24Work (NWC24WorkP) +#define nwc24Work (NWC24WorkP) #ifdef __cplusplus } diff --git a/libs/RevoEX/include/private/nwc24/NWC24Schedule.h b/libs/RevoEX/include/private/nwc24/NWC24Schedule.h index 04162b23..c6a2e501 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24Schedule.h +++ b/libs/RevoEX/include/private/nwc24/NWC24Schedule.h @@ -22,61 +22,61 @@ typedef enum NWC24ScdTaskStage { } NWC24ScdTaskStage; typedef struct NWC24ScdStat { - NWC24Err result; // 0x00 + NWC24Err result; // 0x00 - u32 permission; // 0x04 - s32 lastCriticalError; // 0x08 - u32 newMsgFlag; // 0x0C - NWC24ScdTaskStage taskStage; // 0x10 + u32 permission; // 0x04 + s32 lastCriticalError; // 0x08 + u32 newMsgFlag; // 0x0C + NWC24ScdTaskStage taskStage; // 0x10 - u32 numErrors; // 0x14 + u32 numErrors; // 0x14 - u32 numMsgSent; // 0x18 - u32 numMsgReceived; // 0x1C - u32 numMsgSaved; // 0x20 - u32 numMsgRejected; // 0x24 - u32 numMsgFiltered; // 0x28 + u32 numMsgSent; // 0x18 + u32 numMsgReceived; // 0x1C + u32 numMsgSaved; // 0x20 + u32 numMsgRejected; // 0x24 + u32 numMsgFiltered; // 0x28 - u32 countMailChk; // 0x2C - u32 countMailRcv; // 0x30 - u32 countMailSav; // 0x34 - u32 countMailSnd; // 0x38 + u32 countMailChk; // 0x2C + u32 countMailRcv; // 0x30 + u32 countMailSav; // 0x34 + u32 countMailSnd; // 0x38 - u32 countDL; // 0x3C - u32 countEstablished; // 0x40 + u32 countDL; // 0x3C + u32 countEstablished; // 0x40 - u32 mailTaskTrace; // 0x44 - u32 dlTaskTrace; // 0x48 + u32 mailTaskTrace; // 0x44 + u32 dlTaskTrace; // 0x48 - u32 countMailPrc; // 0x4C - u32 countForceRecv; // 0x50 - u32 countMailIdle; // 0x54 - u32 countScriptExec; // 0x58 + u32 countMailPrc; // 0x4C + u32 countForceRecv; // 0x50 + u32 countMailIdle; // 0x54 + u32 countScriptExec; // 0x58 - u32 reserved[9]; // 0x5C + u32 reserved[9]; // 0x5C - s32 errorLog[32]; // 0x80 + s32 errorLog[32]; // 0x80 } NWC24ScdStat; -NWC24Err NWC24iGetSchedulerStat(NWC24ScdStat* scdStat, u32 scdStatSize); +NWC24Err NWC24iGetSchedulerStat(NWC24ScdStat* scdStat, u32 scdStatSize); -NWC24Err NWC24iSetScriptMode(int mode); +NWC24Err NWC24iSetScriptMode(int mode); -NWC24Err NWC24iRequestGenerateUserId(NWC24UserId* pId, u32* arg1); -NWC24Err NWC24iRequestRegisterUserId(); +NWC24Err NWC24iRequestGenerateUserId(NWC24UserId* pId, u32* arg1); +NWC24Err NWC24iRequestRegisterUserId(); -NWC24Err NWC24iStartupSocket(s32* pSoErr); -NWC24Err NWC24iCleanupSocket(s32* pSoErr); +NWC24Err NWC24iStartupSocket(s32* pSoErr); +NWC24Err NWC24iCleanupSocket(s32* pSoErr); -NWC24Err NWC24iLockSocket(); -NWC24Err NWC24iUnlockSocket(); +NWC24Err NWC24iLockSocket(); +NWC24Err NWC24iUnlockSocket(); -NWC24Err NWC24iSaveMailNow() NO_INLINE; +NWC24Err NWC24iSaveMailNow() NO_INLINE; -NWC24Err NWC24iDownloadNowEx(BOOL* saveMail, u32 flags, u16 taskId, u32 subTaskMask); +NWC24Err NWC24iDownloadNowEx(BOOL* saveMail, u32 flags, u16 taskId, u32 subTaskMask); -NWC24Err NWC24iTrySuspendForOpenLib(); -NWC24Err NWC24iResumeForCloseLib(); +NWC24Err NWC24iTrySuspendForOpenLib(); +NWC24Err NWC24iResumeForCloseLib(); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/private/nwc24/NWC24Std.h b/libs/RevoEX/include/private/nwc24/NWC24Std.h index 9627aab6..92d90241 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24Std.h +++ b/libs/RevoEX/include/private/nwc24/NWC24Std.h @@ -12,27 +12,27 @@ extern "C" { #endif -int STD_strnlen(const char* str, u32 len); +int STD_strnlen(const char* str, u32 len); -int Util_xtoi(char ch); +int Util_xtoi(char ch); -void* Mail_memcpy(void* dest, void* src, u32 len); -void* Mail_memset(void* dest, int fill, u32 count); +void* Mail_memcpy(void* dest, void* src, u32 len); +void* Mail_memset(void* dest, int fill, u32 count); -int Mail_strlen(const char* str); -char* Mail_strcpy(char* dest, const char* src); -char* Mail_strncpy(char* dest, const char* src, u32 len); -char* Mail_strcat(char* dest, const char* src); -char* Mail_strncat(char* dest, const char* src, u32 len); -int Mail_strncmp(const char* str1, const char* str2, u32 len); +int Mail_strlen(const char* str); +char* Mail_strcpy(char* dest, const char* src); +char* Mail_strncpy(char* dest, const char* src, u32 len); +char* Mail_strcat(char* dest, const char* src); +char* Mail_strncat(char* dest, const char* src, u32 len); +int Mail_strncmp(const char* str1, const char* str2, u32 len); -BOOL Mail_islower(int ch); -int Mail_tolower(int ch); +BOOL Mail_islower(int ch); +int Mail_tolower(int ch); -int Mail_sprintf(char* buffer, char* format, ...); -int Mail_vsprintf(char* buffer, char* format, va_list* args); +int Mail_sprintf(char* buffer, char* format, ...); +int Mail_vsprintf(char* buffer, char* format, va_list* args); -int Mail_strnicmp(const char* str1, const char * str2, int len); +int Mail_strnicmp(const char* str1, const char* str2, int len); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/private/nwc24/NWC24Time.h b/libs/RevoEX/include/private/nwc24/NWC24Time.h index 62f00a5e..8949057c 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24Time.h +++ b/libs/RevoEX/include/private/nwc24/NWC24Time.h @@ -1,8 +1,8 @@ #ifndef PRIVATE_NWC24_TIME_H #define PRIVATE_NWC24_TIME_H -#include #include +#include #include @@ -10,11 +10,11 @@ extern "C" { #endif -NWC24Err NWC24iGetUniversalTime(OSTime* pTime); -NWC24Err NWC24iGetTimeDifference(OSTime* pDiff); +NWC24Err NWC24iGetUniversalTime(OSTime* pTime); +NWC24Err NWC24iGetTimeDifference(OSTime* pDiff); -NWC24Err NWC24iSetRtcCounter(u32 rtcCounter, u32 flags); -NWC24Err NWC24iSynchronizeRtcCounter(BOOL forceSave); +NWC24Err NWC24iSetRtcCounter(u32 rtcCounter, u32 flags); +NWC24Err NWC24iSynchronizeRtcCounter(BOOL forceSave); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/private/nwc24/NWC24UserId.h b/libs/RevoEX/include/private/nwc24/NWC24UserId.h index 0d2d92e2..6c2fbfc5 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24UserId.h +++ b/libs/RevoEX/include/private/nwc24/NWC24UserId.h @@ -10,11 +10,11 @@ extern "C" { #endif -NWC24Err NWC24CheckUserId(NWC24UserId id); -NWC24Err NWC24iCheckUserIdCRC(NWC24UserId id); +NWC24Err NWC24CheckUserId(NWC24UserId id); +NWC24Err NWC24iCheckUserIdCRC(NWC24UserId id); #ifdef __cplusplus } #endif -#endif // PRIVATE_NWC24_USERID_H +#endif // PRIVATE_NWC24_USERID_H diff --git a/libs/RevoEX/include/private/nwc24/NWC24Utils.h b/libs/RevoEX/include/private/nwc24/NWC24Utils.h index feb526ea..5daf15d6 100644 --- a/libs/RevoEX/include/private/nwc24/NWC24Utils.h +++ b/libs/RevoEX/include/private/nwc24/NWC24Utils.h @@ -13,21 +13,21 @@ extern "C" { #endif typedef struct NWC24Date { - u16 year; // 0x00 - u8 month; // 0x02 - u8 day; // 0x03 - u8 hour; // 0x04 - u8 sec; // 0x05 - u8 min; // 0x06 - u8 unk_0x07; + u16 year; // 0x00 + u8 month; // 0x02 + u8 day; // 0x03 + u8 hour; // 0x04 + u8 sec; // 0x05 + u8 min; // 0x06 + u8 unk_0x07; } NWC24Date; -void NWC24Date_Init(NWC24Date* date); +void NWC24Date_Init(NWC24Date* date); -void NWC24iConvIdToStr(NWC24UserId addr, char* out); +void NWC24iConvIdToStr(NWC24UserId addr, char* out); -NWC24Err NWC24iCheckStringLength(const char* str, int minLen, int maxLen); -s32 NWC24iStrLCpy(char* dest, const char* src, s32 len); +NWC24Err NWC24iCheckStringLength(const char* str, int minLen, int maxLen); +s32 NWC24iStrLCpy(char* dest, const char* src, s32 len); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/private/ssl.h b/libs/RevoEX/include/private/ssl.h index 76e7951d..dd5bc054 100644 --- a/libs/RevoEX/include/private/ssl.h +++ b/libs/RevoEX/include/private/ssl.h @@ -8,4 +8,4 @@ void SSL_InitMutex(OSMutex* mutex_p); void SSL_LockMutex(OSMutex* mutex_p); void SSL_UnlockMutex(OSMutex* mutex_p); -#endif // PRIVATE_SSL_H +#endif // PRIVATE_SSL_H diff --git a/libs/RevoEX/include/private/vf/pf_cache.h b/libs/RevoEX/include/private/vf/pf_cache.h index 0151534d..eeb95066 100644 --- a/libs/RevoEX/include/private/vf/pf_cache.h +++ b/libs/RevoEX/include/private/vf/pf_cache.h @@ -6,38 +6,38 @@ typedef struct PF_CACHE_PAGE PF_CACHE_PAGE; struct PF_CACHE_PAGE { - u16 stat; // 0x00 - u16 option; // 0x02 + u16 stat; // 0x00 + u16 option; // 0x02 - u8* buffer; // 0x04 - u8* p_buf; // 0x08 - u8* p_mod_sbuf; // 0x0C - u8* p_mod_ebuf; // 0x10 + u8* buffer; // 0x04 + u8* p_buf; // 0x08 + u8* p_mod_sbuf; // 0x0C + u8* p_mod_ebuf; // 0x10 - u32 size; // 0x14 - u32 sector; // 0x18 - void* signature; // 0x1C + u32 size; // 0x14 + u32 sector; // 0x18 + void* signature; // 0x1C - PF_CACHE_PAGE* p_next; // 0x20 - PF_CACHE_PAGE* p_prev; // 0x24 + PF_CACHE_PAGE* p_next; // 0x20 + PF_CACHE_PAGE* p_prev; // 0x24 }; typedef struct PF_SECTOR_CACHE { - u32 mode; // 0x00 + u32 mode; // 0x00 - u16 num_fat_pages; // 0x04 - u16 num_data_pages; // 0x06 + u16 num_fat_pages; // 0x04 + u16 num_data_pages; // 0x06 - PF_CACHE_PAGE* pages; // 0x08 - PF_CACHE_PAGE* p_current_fat; // 0x0C - PF_CACHE_PAGE* p_current_data; // 0x10 + PF_CACHE_PAGE* pages; // 0x08 + PF_CACHE_PAGE* p_current_fat; // 0x0C + PF_CACHE_PAGE* p_current_data; // 0x10 - u8 (*buffers)[512]; // 0x14 + u8 (*buffers)[512]; // 0x14 - u32 fat_buff_size; // 0x18 - u32 data_buff_size; // 0x1C + u32 fat_buff_size; // 0x18 + u32 data_buff_size; // 0x1C - void* signature; // 0x20 + void* signature; // 0x20 } PF_SECTOR_CACHE; -#endif // PRIVATE_PF_CACHE_H +#endif // PRIVATE_PF_CACHE_H diff --git a/libs/RevoEX/include/private/vf/pf_charcode.h b/libs/RevoEX/include/private/vf/pf_charcode.h index 741479c6..f3ccae5d 100644 --- a/libs/RevoEX/include/private/vf/pf_charcode.h +++ b/libs/RevoEX/include/private/vf/pf_charcode.h @@ -6,12 +6,12 @@ #include typedef struct PF_CHARCODE { - s32 (*oem2unicode)(s8*, u16*); // 0x00 - s32 (*unicode2oem)(u16*, s8*); // 0x04 - s32 (*oem_char_width)(s8*); // 0x08 - u32 (*is_oem_mb_char)(s8, u32); // 0x0C - s32 (*unicode_char_width)(u16*); // 0x10 - u32 (*is_unicode_mb_char)(u16, u32); // 0x14 + s32 (*oem2unicode)(s8*, u16*); // 0x00 + s32 (*unicode2oem)(u16*, s8*); // 0x04 + s32 (*oem_char_width)(s8*); // 0x08 + u32 (*is_oem_mb_char)(s8, u32); // 0x0C + s32 (*unicode_char_width)(u16*); // 0x10 + u32 (*is_unicode_mb_char)(u16, u32); // 0x14 } PF_CHARCODE; -#endif // PRIVATE_PF_CHAR_CODE_H +#endif // PRIVATE_PF_CHAR_CODE_H diff --git a/libs/RevoEX/include/private/vf/pf_clib.h b/libs/RevoEX/include/private/vf/pf_clib.h index 26b131c0..c8fff4db 100644 --- a/libs/RevoEX/include/private/vf/pf_clib.h +++ b/libs/RevoEX/include/private/vf/pf_clib.h @@ -3,16 +3,16 @@ #include -s32 VFipf_toupper(s32 c); +s32 VFipf_toupper(s32 c); -void* VFipf_memcpy(void* dst, void* src, u32 length); -void* VFipf_memset(void* dst, s32 c, u32 length); +void* VFipf_memcpy(void* dst, void* src, u32 length); +void* VFipf_memset(void* dst, s32 c, u32 length); -u32 VFipf_strlen(const s8* s); -s8* VFipf_strcpy(s8* dst, const s8* src); -s32 VFipf_strcmp(const s8* s1, const s8* s2); -s32 VFipf_strncmp(const s8* s1, const s8* s2, u32 length); +u32 VFipf_strlen(const s8* s); +s8* VFipf_strcpy(s8* dst, const s8* src); +s32 VFipf_strcmp(const s8* s1, const s8* s2); +s32 VFipf_strncmp(const s8* s1, const s8* s2, u32 length); #include -#endif // PRIVATE_PF_C_LIBRARY_H +#endif // PRIVATE_PF_C_LIBRARY_H diff --git a/libs/RevoEX/include/private/vf/pf_entry.h b/libs/RevoEX/include/private/vf/pf_entry.h index 7f242c34..60867fb6 100644 --- a/libs/RevoEX/include/private/vf/pf_entry.h +++ b/libs/RevoEX/include/private/vf/pf_entry.h @@ -6,41 +6,41 @@ typedef struct PF_VOLUME PF_VOLUME; typedef struct PF_DIR_TAIL { - u32 tracker_size; // 0x00 - u32 tracker_buff[1]; // 0x04 - u32* tracker_bits; // 0x08 + u32 tracker_size; // 0x00 + u32 tracker_buff[1]; // 0x04 + u32* tracker_bits; // 0x08 } PF_DIR_TAIL; typedef struct PF_DIR_ENT { - u16 long_name[261]; // 0x00 + u16 long_name[261]; // 0x00 - u8 num_entry_LFNs; // 0x20A + u8 num_entry_LFNs; // 0x20A - u8 ordinal; // 0x20B + u8 ordinal; // 0x20B - u8 check_sum; // 0x20C + u8 check_sum; // 0x20C - u8 align_pad[1]; // 0x20D + u8 align_pad[1]; // 0x20D - s8 short_name[13]; // 0x20E - u8 small_letter_flag; // 0x21B + s8 short_name[13]; // 0x20E + u8 small_letter_flag; // 0x21B - u8 attr; // 0x21C + u8 attr; // 0x21C - u8 create_time_ms; // 0x21D - u16 create_time; // 0x21E - u16 create_date; // 0x220 - u16 access_date; // 0x222 - u16 modify_time; // 0x224 - u16 modify_date; // 0x226 + u8 create_time_ms; // 0x21D + u16 create_time; // 0x21E + u16 create_date; // 0x220 + u16 access_date; // 0x222 + u16 modify_time; // 0x224 + u16 modify_date; // 0x226 - u32 file_size; // 0x228 - PF_VOLUME* p_vol; // 0x22C - u32 path_len; // 0x230 + u32 file_size; // 0x228 + PF_VOLUME* p_vol; // 0x22C + u32 path_len; // 0x230 - u32 start_cluster; // 0x234 - u32 entry_sector; // 0x238 - u16 entry_offset; // 0x23C + u32 start_cluster; // 0x234 + u32 entry_sector; // 0x238 + u16 entry_offset; // 0x23C } PF_DIR_ENT; -#endif // PRIVATE_PF_ENTRY_H +#endif // PRIVATE_PF_ENTRY_H diff --git a/libs/RevoEX/include/private/vf/pf_fat.h b/libs/RevoEX/include/private/vf/pf_fat.h index 2a5b04c3..fe2208b1 100644 --- a/libs/RevoEX/include/private/vf/pf_fat.h +++ b/libs/RevoEX/include/private/vf/pf_fat.h @@ -14,8 +14,8 @@ typedef enum PF_FAT_TYPE { } PF_FAT_TYPE; typedef struct PF_LAST_CLUSTER { - u32 num_last_cluster; // 0x00 - u32 max_chain_index; // 0x04 + u32 num_last_cluster; // 0x00 + u32 max_chain_index; // 0x04 } PF_LAST_CLUSTER; typedef struct PF_FAT_HINT { @@ -24,37 +24,37 @@ typedef struct PF_FAT_HINT { } PF_FAT_HINT; typedef struct PF_CLUSTER_LINK { - u32* buffer; // 0x00 + u32* buffer; // 0x00 - u16 interval; // 0x04 - u16 interval_offset; // 0x06 + u16 interval; // 0x04 + u16 interval_offset; // 0x06 - u32 position; // 0x08 + u32 position; // 0x08 - u32 max_count; // 0x0C + u32 max_count; // 0x0C - u32 save_index; // 0x10 + u32 save_index; // 0x10 } PF_CLUSTER_LINK; typedef struct PF_CLUSTER_LINK_VOL { - u16 flag; // 0x00 - u16 interval; // 0x02 + u16 flag; // 0x00 + u16 interval; // 0x02 - u32* buffer; // 0x04 - u32 link_max; // 0x08 + u32* buffer; // 0x04 + u32 link_max; // 0x08 } PF_CLUSTER_LINK_VOL; typedef struct PF_FFD { - u32 start_cluster; // 0x00 - u32* p_start_cluster; // 0x04 + u32 start_cluster; // 0x00 + u32* p_start_cluster; // 0x04 - PF_LAST_CLUSTER last_cluster; // 0x08 - PF_FAT_HINT last_access; // 0x10 + PF_LAST_CLUSTER last_cluster; // 0x08 + PF_FAT_HINT last_access; // 0x10 - PF_CLUSTER_LINK cluster_link; // 0x18 + PF_CLUSTER_LINK cluster_link; // 0x18 - PF_FAT_HINT* p_hint; // 0x2C - PF_VOLUME* p_vol; // 0x30 + PF_FAT_HINT* p_hint; // 0x2C + PF_VOLUME* p_vol; // 0x30 } PF_FFD; -#endif // PRIVATE_PF_FAT_H +#endif // PRIVATE_PF_FAT_H diff --git a/libs/RevoEX/include/private/vf/pf_service.h b/libs/RevoEX/include/private/vf/pf_service.h index 1825232d..28144f5f 100644 --- a/libs/RevoEX/include/private/vf/pf_service.h +++ b/libs/RevoEX/include/private/vf/pf_service.h @@ -3,6 +3,6 @@ #include -void VFiPF_LE16_TO_U16_STR(u8* src, u32 length); +void VFiPF_LE16_TO_U16_STR(u8* src, u32 length); -#endif // PRIVATE_PF_SERVICE_H +#endif // PRIVATE_PF_SERVICE_H diff --git a/libs/RevoEX/include/private/vf/pf_str.h b/libs/RevoEX/include/private/vf/pf_str.h index 785f2d82..594c853b 100644 --- a/libs/RevoEX/include/private/vf/pf_str.h +++ b/libs/RevoEX/include/private/vf/pf_str.h @@ -14,10 +14,10 @@ enum { }; typedef struct PF_STR { - const s8* p_head; // 0x00 - const s8* p_tail; // 0x04 + const s8* p_head; // 0x00 + const s8* p_tail; // 0x04 - u32 code_mode; // 0x08 + u32 code_mode; // 0x08 } PF_STR; -#endif // PRIVATE_PF_STR_H +#endif // PRIVATE_PF_STR_H diff --git a/libs/RevoEX/include/private/vf/pf_volume.h b/libs/RevoEX/include/private/vf/pf_volume.h index f2e48ff4..aad18d30 100644 --- a/libs/RevoEX/include/private/vf/pf_volume.h +++ b/libs/RevoEX/include/private/vf/pf_volume.h @@ -3,18 +3,19 @@ #include -#include #include -#include #include +#include +#include + typedef void (*PF_VOL_CALLBACK)(); typedef struct PF_CUR_DIR { - u32 stat; // 0x00 - s32 context_id; // 0x04 + u32 stat; // 0x00 + s32 context_id; // 0x04 - PF_DIR_ENT directory; // 0x08 + PF_DIR_ENT directory; // 0x08 } PF_CUR_DIR; typedef struct PF_CURSOR { @@ -25,177 +26,177 @@ typedef struct PF_CURSOR { } PF_CURSOR; typedef struct PF_DIR_CURSOR { - u32 physical_entry_index; // 0x00 - u32 logical_entry_index; // 0x04 - u32 logical_seek_index; // 0x08 + u32 physical_entry_index; // 0x00 + u32 logical_entry_index; // 0x04 + u32 logical_seek_index; // 0x08 } PF_DIR_CURSOR; typedef struct PF_SDD { - u32 stat; // 0x00 + u32 stat; // 0x00 - u16 num_handlers; // 0x04 + u16 num_handlers; // 0x04 - PF_FFD ffd; // 0x08 - PF_DIR_ENT dir_entry; // 0x3C + PF_FFD ffd; // 0x08 + PF_DIR_ENT dir_entry; // 0x3C } PF_SDD; typedef struct PF_FILE PF_FILE; typedef struct PF_LOCK { - u16 mode; // 0x00 + u16 mode; // 0x00 - u16 count; // 0x02 - u32 wcount; // 0x04 + u16 count; // 0x02 + u32 wcount; // 0x04 + + PF_FILE* owner; // 0x08 - PF_FILE* owner; // 0x08 - long resource; // 0x0C } PF_LOCK; typedef struct PF_SFD { - u32 stat; // 0x00 + u32 stat; // 0x00 - PF_FFD ffd; // 0x04 + PF_FFD ffd; // 0x04 - PF_DIR_ENT dir_entry; // 0x38 + PF_DIR_ENT dir_entry; // 0x38 - PF_LOCK lock; // 0x278 + PF_LOCK lock; // 0x278 - u16 num_handlers; // 0x288 + u16 num_handlers; // 0x288 } PF_SFD; typedef struct PF_BPB { - u16 bytes_per_sector; // 0x00 + u16 bytes_per_sector; // 0x00 - u16 num_reserved_sectors; // 0x02 - u16 num_root_dir_entries; // 0x04 + u16 num_reserved_sectors; // 0x02 + u16 num_root_dir_entries; // 0x04 - u8 sectors_per_cluster; // 0x06 + u8 sectors_per_cluster; // 0x06 - u8 num_FATs; // 0x07 + u8 num_FATs; // 0x07 - u32 total_sectors; // 0x08 - u32 sectors_per_FAT; // 0x0C + u32 total_sectors; // 0x08 + u32 sectors_per_FAT; // 0x0C - u32 root_dir_cluster; // 0x10 + u32 root_dir_cluster; // 0x10 - u16 fs_info_sector; // 0x14 - u16 backup_boot_sector; // 0x16 + u16 fs_info_sector; // 0x14 + u16 backup_boot_sector; // 0x16 - u16 ext_flags; // 0x18 + u16 ext_flags; // 0x18 - u8 media; // 0x1A + u8 media; // 0x1A - PF_FAT_TYPE fat_type; // 0x1C + PF_FAT_TYPE fat_type; // 0x1C - u8 log2_bytes_per_sector; // 0x20 - u8 log2_sectors_per_cluster; // 0x21 + u8 log2_bytes_per_sector; // 0x20 + u8 log2_sectors_per_cluster; // 0x21 - u8 num_active_FATs; // 0x22 - u16 num_root_dir_sectors; // 0x24 + u8 num_active_FATs; // 0x22 + u16 num_root_dir_sectors; // 0x24 - u32 active_FAT_sector; // 0x28 + u32 active_FAT_sector; // 0x28 - u32 first_root_dir_sector; // 0x2C - u32 first_data_sector; // 0x30 + u32 first_root_dir_sector; // 0x2C + u32 first_data_sector; // 0x30 - u32 num_clusters; // 0x34 + u32 num_clusters; // 0x34 } PF_BPB; typedef struct PF_FILE { - u32 stat; // 0x00 + u32 stat; // 0x00 - u32 open_mode; // 0x04 + u32 open_mode; // 0x04 - PF_SFD* p_sfd; // 0x08 + PF_SFD* p_sfd; // 0x08 - PF_FAT_HINT hint; // 0x0C + PF_FAT_HINT hint; // 0x0C - PF_FAT_HINT last_access; // 0x14 - s32 last_error; // 0x1C + PF_FAT_HINT last_access; // 0x14 + s32 last_error; // 0x1C - PF_CURSOR cursor; // 0x20 + PF_CURSOR cursor; // 0x20 - u16 lock_count; // 0x30 + u16 lock_count; // 0x30 } PF_FILE; typedef struct PF_DIR { - u32 stat; // 0x00 + u32 stat; // 0x00 - PF_SDD* p_sdd; // 0x04 + PF_SDD* p_sdd; // 0x04 - PF_FAT_HINT hint; // 0x08 - PF_DIR_CURSOR cursor; // 0x10 + PF_FAT_HINT hint; // 0x08 + PF_DIR_CURSOR cursor; // 0x10 } PF_DIR; typedef struct PF_CONTEXT { - u32 stat; // 0x00 - s32 context_id; // 0x04 + u32 stat; // 0x00 + s32 context_id; // 0x04 } PF_CONTEXT; typedef struct PF_VOLUME { - PF_BPB bpb; // 0x00 + PF_BPB bpb; // 0x00 - u32 num_free_clusters; // 0x38 - u32 last_free_cluster; // 0x3C + u32 num_free_clusters; // 0x38 + u32 last_free_cluster; // 0x3C - PF_SFD sfds[5]; // 0x40 - PF_FILE ufds[5]; // 0xCFC - PF_SDD sdds[3]; // 0xE00 - PF_DIR udds[3]; // 0x1574 + PF_SFD sfds[5]; // 0x40 + PF_FILE ufds[5]; // 0xCFC + PF_SDD sdds[3]; // 0xE00 + PF_DIR udds[3]; // 0x1574 - s32 num_opened_files; // 0x15C8 - s32 num_opened_directories; // 0x15CC + s32 num_opened_files; // 0x15C8 + s32 num_opened_directories; // 0x15CC - PF_SECTOR_CACHE cache; // 0x15D0 + PF_SECTOR_CACHE cache; // 0x15D0 - s8 label[12]; // 0x15F4 + s8 label[12]; // 0x15F4 - PF_CUR_DIR current_dir[1]; // 0x1600 + PF_CUR_DIR current_dir[1]; // 0x1600 - PF_DIR_TAIL tail_entry; // 0x1848 + PF_DIR_TAIL tail_entry; // 0x1848 - s32 last_error; // 0x1854 - s32 last_driver_error; // 0x1858 + s32 last_error; // 0x1854 + s32 last_driver_error; // 0x1858 - u32 file_config; // 0x185C - u16 flags; // 0x1860 - s8 drv_char; // 0x1862 - u16 fsi_flag; // 0x1864 + u32 file_config; // 0x185C + u16 flags; // 0x1860 + s8 drv_char; // 0x1862 + u16 fsi_flag; // 0x1864 - PF_CLUSTER_LINK_VOL cluster_link; // 0x1868 + PF_CLUSTER_LINK_VOL cluster_link; // 0x1868 - void* p_part; // 0x1874 - PF_VOL_CALLBACK p_callback; // 0x1878 + void* p_part; // 0x1874 + PF_VOL_CALLBACK p_callback; // 0x1878 - const u8* format_param; // 0x187C + const u8* format_param; // 0x187C } PF_VOLUME; typedef struct PF_CUR_VOLUME { - u32 stat; // 0x00 - s32 context_id; // 0x04 - PF_VOLUME* p_vol; // 0x08 + u32 stat; // 0x00 + s32 context_id; // 0x04 + PF_VOLUME* p_vol; // 0x08 } PF_CUR_VOLUME; typedef struct PF_VOLUME_SET { - PF_CUR_VOLUME current_vol[1]; // 0x00 + PF_CUR_VOLUME current_vol[1]; // 0x00 - s32 num_attached_drives; // 0x0C - s32 num_mounted_volumes; // 0x10 + s32 num_attached_drives; // 0x0C + s32 num_mounted_volumes; // 0x10 - u32 config; // 0x14 + u32 config; // 0x14 - void* param; // 0x18 + void* param; // 0x18 - s32 last_error; // 0x1C - s32 last_driver_error; // 0x20 + s32 last_error; // 0x1C + s32 last_driver_error; // 0x20 - PF_CHARCODE codeset; // 0x24 - u32 setting; // 0x3C + PF_CHARCODE codeset; // 0x24 + u32 setting; // 0x3C - PF_CONTEXT context[1]; // 0x40 - PF_VOLUME volumes[26]; // 0x48 + PF_CONTEXT context[1]; // 0x40 + PF_VOLUME volumes[26]; // 0x48 } PF_VOLUME_SET; extern PF_VOLUME_SET VFipf_vol_set; -#endif // PRIVATE_PF_VOLUME_H +#endif // PRIVATE_PF_VOLUME_H diff --git a/libs/RevoEX/include/private/vf/pf_w_clib.h b/libs/RevoEX/include/private/vf/pf_w_clib.h index 3610b317..0946e9e1 100644 --- a/libs/RevoEX/include/private/vf/pf_w_clib.h +++ b/libs/RevoEX/include/private/vf/pf_w_clib.h @@ -5,8 +5,8 @@ #include -u32 VFipf_w_strlen(const u16* s); -u16* VFipf_w_strcpy(u16* dst, const u16* src); -s32 VFipf_w_strncmp(const u16* s1, const u16* s2, u32 length); +u32 VFipf_w_strlen(const u16* s); +u16* VFipf_w_strcpy(u16* dst, const u16* src); +s32 VFipf_w_strncmp(const u16* s1, const u16* s2, u32 length); -#endif // PRIVATE_PF_WIDE_CHAR_C_LIBRARY_H +#endif // PRIVATE_PF_WIDE_CHAR_C_LIBRARY_H diff --git a/libs/RevoEX/include/revolution/cdb.h b/libs/RevoEX/include/revolution/cdb.h index f3266abd..d0f1503c 100644 --- a/libs/RevoEX/include/revolution/cdb.h +++ b/libs/RevoEX/include/revolution/cdb.h @@ -5,36 +5,34 @@ #include -#include #include +#include #include #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus -#define CDB_DATABASE_POOL_SIZE 0x18030 -#define CDB_RECORD_POOL_SIZE 0x61D0 -#define CDB_CRYPT_BUF_SIZE 0x3EC40 +#define CDB_DATABASE_POOL_SIZE 0x18030 +#define CDB_RECORD_POOL_SIZE 0x61D0 +#define CDB_CRYPT_BUF_SIZE 0x3EC40 -#define CDB_SYSTEM_WORK_SIZE (CDB_DATABASE_POOL_SIZE \ - + CDB_RECORD_POOL_SIZE \ - + CDB_CRYPT_BUF_SIZE) \ +#define CDB_SYSTEM_WORK_SIZE (CDB_DATABASE_POOL_SIZE + CDB_RECORD_POOL_SIZE + CDB_CRYPT_BUF_SIZE) -CDBErr CDBInit(void* work); -CDBErr CDBInitEx(void* work, void* fsCacheBuffer, u32 fsCacheSize); +CDBErr CDBInit(void* work); +CDBErr CDBInitEx(void* work, void* fsCacheBuffer, u32 fsCacheSize); -CDBErr CDBUninit(); +CDBErr CDBUninit(); -s32 CDBGetFreeSize(); +s32 CDBGetFreeSize(); -s32 CDBGetLastNANDError(); -s32 CDBGetLastVFError(); +s32 CDBGetLastNANDError(); +s32 CDBGetLastVFError(); -BOOL CDBGetFatalVFErrorFlag(); +BOOL CDBGetFatalVFErrorFlag(); -CDBErr CDBMountSD(); -CDBErr CDBUnmountSDForce(); +CDBErr CDBMountSD(); +CDBErr CDBUnmountSDForce(); static inline void CDBSetVerboseLevel(CDBVerboseLevel verbose) { extern s32 CDBPrintDebugLevel; @@ -43,6 +41,6 @@ static inline void CDBSetVerboseLevel(CDBVerboseLevel verbose) { #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // REVOLUTION_CDB_H +#endif // REVOLUTION_CDB_H diff --git a/libs/RevoEX/include/revolution/cdb/CDBDatabase.h b/libs/RevoEX/include/revolution/cdb/CDBDatabase.h index afdbb9ee..91808dfc 100644 --- a/libs/RevoEX/include/revolution/cdb/CDBDatabase.h +++ b/libs/RevoEX/include/revolution/cdb/CDBDatabase.h @@ -3,17 +3,17 @@ #include -#include #include +#include #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus typedef struct _CDBDatabase { - u16 makerCode; // 0x00 - u32 gameCode; // 0x04 - void* instance; // 0x08 + u16 makerCode; // 0x00 + u32 gameCode; // 0x04 + void* instance; // 0x08 } CDBDatabase; typedef enum CDBSearchDirection { @@ -22,31 +22,35 @@ typedef enum CDBSearchDirection { CDB_SEARCH_DIRECTION_RIGHT, } CDBSearchDirection; -#define CDB_RECORD_BUFFER_SIZE 0x400 +#define CDB_RECORD_BUFFER_SIZE 0x400 -typedef BOOL (CDBSearchRecordCB)(void*, CDBRecord*); +typedef BOOL(CDBSearchRecordCB)(void*, CDBRecord*); -CDBErr CDBDatabaseInit(CDBDatabase* database); +CDBErr CDBDatabaseInit(CDBDatabase* database); -CDBErr CDBDatabaseOpen(CDBDatabase* database); -CDBErr CDBDatabaseClose(CDBDatabase* database); +CDBErr CDBDatabaseOpen(CDBDatabase* database); +CDBErr CDBDatabaseClose(CDBDatabase* database); -CDBErr CDBDatabaseCheckOpenRecord(); -CDBErr CDBDatabaseCheckOpenDatabase(); +CDBErr CDBDatabaseCheckOpenRecord(); +CDBErr CDBDatabaseCheckOpenDatabase(); -CDBErr CDBDatabaseCreateRecordAtOnce(CDBDatabase* database, CDBRecord* record, const char* typeStr, const char* fileTypeStr, u8* recordData, u32 recordDataSize); -CDBErr CDBDatabaseCreateRecordAtOnceEx(CDBDatabase* database, CDBRecord* record, const char* typeStr, const char* fileTypeStr, u8* recordData, u32 recordDataSize, int year, int month, int day, int hour, int min, int sec); +CDBErr CDBDatabaseCreateRecordAtOnce(CDBDatabase* database, CDBRecord* record, const char* typeStr, const char* fileTypeStr, u8* recordData, + u32 recordDataSize); +CDBErr CDBDatabaseCreateRecordAtOnceEx(CDBDatabase* database, CDBRecord* record, const char* typeStr, const char* fileTypeStr, u8* recordData, + u32 recordDataSize, int year, int month, int day, int hour, int min, int sec); -CDBErr CDBDatabaseFindByKey(CDBDatabase* database, CDBRecord* record, CDBRecordKey* recordKey); +CDBErr CDBDatabaseFindByKey(CDBDatabase* database, CDBRecord* record, CDBRecordKey* recordKey); -CDBErr CDBDatabaseSearch(CDBDatabase* database, CDBDate beginDate, CDBDate endDate, CDBSearchDirection searchDirection, char* makerCode, char* gameCode, int unk7, CDBRecordLocation recordLocation, int unk9, CDBSearchRecordCB searchRecordCB, void* searchRecordArg); +CDBErr CDBDatabaseSearch(CDBDatabase* database, CDBDate beginDate, CDBDate endDate, CDBSearchDirection searchDirection, char* makerCode, + char* gameCode, int unk7, CDBRecordLocation recordLocation, int unk9, CDBSearchRecordCB searchRecordCB, + void* searchRecordArg); -CDBErr CDBDatabaseCleanUpEmptyDirectories(CDBDatabase* database, CDBRecordLocation recordLocation); +CDBErr CDBDatabaseCleanUpEmptyDirectories(CDBDatabase* database, CDBRecordLocation recordLocation); -BOOL CDBIsSDAvailable(); +BOOL CDBIsSDAvailable(); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // REVOLUTION_CDB_DATABASE_H +#endif // REVOLUTION_CDB_DATABASE_H diff --git a/libs/RevoEX/include/revolution/cdb/CDBDate.h b/libs/RevoEX/include/revolution/cdb/CDBDate.h index f20f9f48..4d64f645 100644 --- a/libs/RevoEX/include/revolution/cdb/CDBDate.h +++ b/libs/RevoEX/include/revolution/cdb/CDBDate.h @@ -7,9 +7,9 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus -void CDBClampCDBDate(CDBDate* cdbDate); +void CDBClampCDBDate(CDBDate* cdbDate); CDBDate CDBMakeCDBDate(int year, int month, int day, int hour, int min, int sec); @@ -22,6 +22,6 @@ CDBDate CDBMakeCDBDateYearEnd(int year, int month, int day, int hour, int min, i #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // REVOLUTION_CDB_DATE_H +#endif // REVOLUTION_CDB_DATE_H diff --git a/libs/RevoEX/include/revolution/cdb/CDBRecord.h b/libs/RevoEX/include/revolution/cdb/CDBRecord.h index f1d949b0..6fd3310b 100644 --- a/libs/RevoEX/include/revolution/cdb/CDBRecord.h +++ b/libs/RevoEX/include/revolution/cdb/CDBRecord.h @@ -5,23 +5,23 @@ #include -#include #include +#include #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus -#define CDB_RECORD_KEY_STRING_LEN 32 -#define CDB_RECORD_KEY_STRLEN_LEN 23 +#define CDB_RECORD_KEY_STRING_LEN 32 +#define CDB_RECORD_KEY_STRLEN_LEN 23 -#define CDB_KEYSTR_EPOCH_SIZE 10 -#define CDB_KEYSTR_CODE_SIZE 7 -#define CDB_KEYSTR_GAME_CODE_SIZE 4 -#define CDB_KEYSTR_MAKER_CODE_SIZE 2 -#define CDB_KEYSTR_SERIAL_NUMBER_SIZE 3 -#define CDB_KEYSTR_TYPE_EXT_SIZE 4 -#define CDB_KEYSTR_TYPE_SIZE 3 +#define CDB_KEYSTR_EPOCH_SIZE 10 +#define CDB_KEYSTR_CODE_SIZE 7 +#define CDB_KEYSTR_GAME_CODE_SIZE 4 +#define CDB_KEYSTR_MAKER_CODE_SIZE 2 +#define CDB_KEYSTR_SERIAL_NUMBER_SIZE 3 +#define CDB_KEYSTR_TYPE_EXT_SIZE 4 +#define CDB_KEYSTR_TYPE_SIZE 3 typedef enum CDBRecordLocation { CDB_RECORD_LOCATION_NAND = 1, @@ -33,70 +33,70 @@ typedef enum CDBRecordLocation { typedef struct _CDBRecordKey { union { - char keyString[CDB_RECORD_KEY_STRING_LEN]; // 0x00 + char keyString[CDB_RECORD_KEY_STRING_LEN]; // 0x00 struct { - char epoch[CDB_KEYSTR_EPOCH_SIZE]; // 0x00 - char pad0; // 0x0A (10) + char epoch[CDB_KEYSTR_EPOCH_SIZE]; // 0x00 + char pad0; // 0x0A (10) union { - char code[CDB_KEYSTR_CODE_SIZE]; + char code[CDB_KEYSTR_CODE_SIZE]; struct { - char gameCode[CDB_KEYSTR_GAME_CODE_SIZE]; - char pad1; - char makerCode[CDB_KEYSTR_MAKER_CODE_SIZE]; + char gameCode[CDB_KEYSTR_GAME_CODE_SIZE]; + char pad1; + char makerCode[CDB_KEYSTR_MAKER_CODE_SIZE]; }; - }; // 0x0B (11) - char pad2; // 0x12 (18) - char serialNum[CDB_KEYSTR_SERIAL_NUMBER_SIZE]; // 0x13 (19) + }; // 0x0B (11) + char pad2; // 0x12 (18) + char serialNum[CDB_KEYSTR_SERIAL_NUMBER_SIZE]; // 0x13 (19) union { - char typeExt[CDB_KEYSTR_TYPE_EXT_SIZE]; + char typeExt[CDB_KEYSTR_TYPE_EXT_SIZE]; struct { - char pad3; - char type[CDB_KEYSTR_TYPE_SIZE]; + char pad3; + char type[CDB_KEYSTR_TYPE_SIZE]; }; - }; // 0x16 (22) + }; // 0x16 (22) } keyStrStruct; }; - u64 wiiId; // 0x20 - CDBLocation location; // 0x28 - int unk_0x2C; + u64 wiiId; // 0x20 + CDBLocation location; // 0x28 + int unk_0x2C; } CDBRecordKey; typedef struct _CDBRecord { - u32 unk_0x00; - void* cryptBuf; // 0x04 - CDBRecordKey key; // 0x08 - void* file; // 0x38 - u32 unk_0x3C; + u32 unk_0x00; + void* cryptBuf; // 0x04 + CDBRecordKey key; // 0x08 + void* file; // 0x38 + u32 unk_0x3C; } CDBRecord; -#define CDBKeyStrEpoch(keyString) ((char*)&keyString[offsetof(CDBRecordKey, keyStrStruct.epoch)]) -#define CDBKeyStrCode(keyString) ((char*)&keyString[offsetof(CDBRecordKey, keyStrStruct.code)]) -#define CDBKeyStrGameCode(keyString) ((char*)&keyString[offsetof(CDBRecordKey, keyStrStruct.gameCode)]) -#define CDBKeyStrMakerCode(keyString) ((char*)&keyString[offsetof(CDBRecordKey, keyStrStruct.makerCode)]) -#define CDBKeyStrSerialNumber(keyString) ((char*)&keyString[offsetof(CDBRecordKey, keyStrStruct.serialNum)]) -#define CDBKeyStrTypeExt(keyString) ((char*)&keyString[offsetof(CDBRecordKey, keyStrStruct.typeExt)]) -#define CDBKeyStrType(keyString) ((char*)&keyString[offsetof(CDBRecordKey, keyStrStruct.type)]) +#define CDBKeyStrEpoch(keyString) ((char*)&keyString[offsetof(CDBRecordKey, keyStrStruct.epoch)]) +#define CDBKeyStrCode(keyString) ((char*)&keyString[offsetof(CDBRecordKey, keyStrStruct.code)]) +#define CDBKeyStrGameCode(keyString) ((char*)&keyString[offsetof(CDBRecordKey, keyStrStruct.gameCode)]) +#define CDBKeyStrMakerCode(keyString) ((char*)&keyString[offsetof(CDBRecordKey, keyStrStruct.makerCode)]) +#define CDBKeyStrSerialNumber(keyString) ((char*)&keyString[offsetof(CDBRecordKey, keyStrStruct.serialNum)]) +#define CDBKeyStrTypeExt(keyString) ((char*)&keyString[offsetof(CDBRecordKey, keyStrStruct.typeExt)]) +#define CDBKeyStrType(keyString) ((char*)&keyString[offsetof(CDBRecordKey, keyStrStruct.type)]) -CDBErr CDBRecordOpen(CDBRecord* record); -CDBErr CDBRecordRead(CDBRecord* record, void* buffer, u32 length, u32* readSize); -CDBErr CDBRecordWrite(CDBRecord* record, void* buffer, u32 length); -CDBErr CDBRecordSeek(CDBRecord* record, s32 offset, CDBSeek seekOrigin); -CDBErr CDBRecordClose(CDBRecord* record); +CDBErr CDBRecordOpen(CDBRecord* record); +CDBErr CDBRecordRead(CDBRecord* record, void* buffer, u32 length, u32* readSize); +CDBErr CDBRecordWrite(CDBRecord* record, void* buffer, u32 length); +CDBErr CDBRecordSeek(CDBRecord* record, s32 offset, CDBSeek seekOrigin); +CDBErr CDBRecordClose(CDBRecord* record); -CDBErr CDBRecordGetDataSize(CDBRecord* record, u32* recordSize); -CDBErr CDBRecordGetId(CDBRecord* record, CDBId* id); +CDBErr CDBRecordGetDataSize(CDBRecord* record, u32* recordSize); +CDBErr CDBRecordGetId(CDBRecord* record, CDBId* id); -CDBErr CDBRecordGetCalendarTimeForce(CDBRecord* record, int* year, int* month, int* day, int* hour, int* min, int* sec); -CDBErr CDBRecordGetKeyForce(CDBRecord* record, CDBRecordKey* recordKey); -CDBErr CDBRecordGetTypeForce(CDBRecord* record, char* type); -CDBErr CDBRecordGetGameCodeForce(CDBRecord* record, char* gcStr); +CDBErr CDBRecordGetCalendarTimeForce(CDBRecord* record, int* year, int* month, int* day, int* hour, int* min, int* sec); +CDBErr CDBRecordGetKeyForce(CDBRecord* record, CDBRecordKey* recordKey); +CDBErr CDBRecordGetTypeForce(CDBRecord* record, char* type); +CDBErr CDBRecordGetGameCodeForce(CDBRecord* record, char* gcStr); -CDBErr CDBRecordRemove(CDBRecord* record); +CDBErr CDBRecordRemove(CDBRecord* record); -CDBErr CDBRecordBackupToSD(CDBRecord* record); +CDBErr CDBRecordBackupToSD(CDBRecord* record); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // REVOLUTION_CDB_RECORD_H +#endif // REVOLUTION_CDB_RECORD_H diff --git a/libs/RevoEX/include/revolution/cdb/CDBTypes.h b/libs/RevoEX/include/revolution/cdb/CDBTypes.h index f8bf67ca..2dfe5871 100644 --- a/libs/RevoEX/include/revolution/cdb/CDBTypes.h +++ b/libs/RevoEX/include/revolution/cdb/CDBTypes.h @@ -5,48 +5,48 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus typedef u32 CDBDate; typedef enum CDBErr { - CDB_ERROR_OK = 0, - CDB_ERROR_1 = 1, - CDB_ERROR_2 = 2, - CDB_ERROR_3 = 3, - CDB_ERROR_4 = 4, - CDB_ERROR_5 = 5, - CDB_ERROR_INVALID_ATTR_BUF = 6, - CDB_ERROR_7 = 7, + CDB_ERROR_OK = 0, + CDB_ERROR_1 = 1, + CDB_ERROR_2 = 2, + CDB_ERROR_3 = 3, + CDB_ERROR_4 = 4, + CDB_ERROR_5 = 5, + CDB_ERROR_INVALID_ATTR_BUF = 6, + CDB_ERROR_7 = 7, CDB_ERROR_READ_LENGTH_WRONG = 8, - CDB_ERROR_9 = 9, - CDB_ERROR_SD_IS_MOUNTED = 10, + CDB_ERROR_9 = 9, + CDB_ERROR_SD_IS_MOUNTED = 10, CDB_ERROR_SD_IS_NOT_MOUNTED = 11, - CDB_ERROR_VF_ERROR = 12, - CDB_ERROR_NAND_ERROR = 13, - CDB_ERROR_14 = 14, - CDB_ERROR_OUT_OF_RANGE = 15, - CDB_ERROR_16 = 16, - CDB_ERROR_17 = 17, - CDB_ERROR_18 = 18, - CDB_ERROR_19 = 19, - CDB_ERROR_20 = 20, - CDB_ERROR_21 = 21, - CDB_ERROR_CRYPT_ALLOC_FAIL = 22, - CDB_ERROR_OUT_OF_SPACE = 23, - CDB_ERROR_VF_INIT_FAIL = 24, - CDB_ERROR_25 = 25, - CDB_ERROR_26 = 26, - CDB_ERROR_27 = 27, - CDB_ERROR_28 = 28, - CDB_ERROR_ACCESS_DENIED = 29, - CDB_ERROR_FILE_EXISTS = 30, - CDB_ERROR_SD_EJECTED = 31, - CDB_ERROR_32 = 32, - CDB_ERROR_33 = 33, - CDB_ERROR_34 = 34, - CDB_ERROR_CANNOT_OPEN_FILE = 35, - CDB_ERROR_FATAL_ERROR = 36, + CDB_ERROR_VF_ERROR = 12, + CDB_ERROR_NAND_ERROR = 13, + CDB_ERROR_14 = 14, + CDB_ERROR_OUT_OF_RANGE = 15, + CDB_ERROR_16 = 16, + CDB_ERROR_17 = 17, + CDB_ERROR_18 = 18, + CDB_ERROR_19 = 19, + CDB_ERROR_20 = 20, + CDB_ERROR_21 = 21, + CDB_ERROR_CRYPT_ALLOC_FAIL = 22, + CDB_ERROR_OUT_OF_SPACE = 23, + CDB_ERROR_VF_INIT_FAIL = 24, + CDB_ERROR_25 = 25, + CDB_ERROR_26 = 26, + CDB_ERROR_27 = 27, + CDB_ERROR_28 = 28, + CDB_ERROR_ACCESS_DENIED = 29, + CDB_ERROR_FILE_EXISTS = 30, + CDB_ERROR_SD_EJECTED = 31, + CDB_ERROR_32 = 32, + CDB_ERROR_33 = 33, + CDB_ERROR_34 = 34, + CDB_ERROR_CANNOT_OPEN_FILE = 35, + CDB_ERROR_FATAL_ERROR = 36, } CDBErr; typedef enum CDBVerboseLevel { @@ -58,18 +58,9 @@ typedef enum CDBVerboseLevel { CDB_VERBOSE_LEVEL_ALL = CDB_VERBOSE_LEVEL_INFO } CDBVerboseLevel; -typedef enum CDBLocation { - CDB_FS_LOCATION_NAND = 1, - CDB_FS_LOCATION_SD, - CDB_FS_LOCATION_3, - CDB_FS_LOCATION_4 -} CDBLocation; +typedef enum CDBLocation { CDB_FS_LOCATION_NAND = 1, CDB_FS_LOCATION_SD, CDB_FS_LOCATION_3, CDB_FS_LOCATION_4 } CDBLocation; -typedef enum CDBSeek { - CDB_SEEK_CUR = 0, - CDB_SEEK_BEGIN, - CDB_SEEK_END -} CDBSeek; +typedef enum CDBSeek { CDB_SEEK_CUR = 0, CDB_SEEK_BEGIN, CDB_SEEK_END } CDBSeek; typedef struct _CDBId { u32 num; // 0x00 @@ -78,6 +69,6 @@ typedef struct _CDBId { #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // REVOLUTION_CDB_TYPES_H +#endif // REVOLUTION_CDB_TYPES_H diff --git a/libs/RevoEX/include/revolution/ncd.h b/libs/RevoEX/include/revolution/ncd.h index f55dedca..1b23ae46 100644 --- a/libs/RevoEX/include/revolution/ncd.h +++ b/libs/RevoEX/include/revolution/ncd.h @@ -3,34 +3,34 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus #include #include -NCDErr NCDReadConfig(NCDConfig* config); -NCDErr NCDWriteConfig(const NCDConfig* config); +NCDErr NCDReadConfig(NCDConfig* config); +NCDErr NCDWriteConfig(const NCDConfig* config); -NCDErr NCDSetIpConfig(NCDIpConfig* ipConfig); -NCDErr NCDSetIfConfig(NCDIfConfig* ifConfig); +NCDErr NCDSetIpConfig(NCDIpConfig* ipConfig); +NCDErr NCDSetIfConfig(NCDIfConfig* ifConfig); -NCDErr NCDGetCurrentIpConfig(NCDIpConfig* ipConfig); +NCDErr NCDGetCurrentIpConfig(NCDIpConfig* ipConfig); -NCDErr NCDGetLinkStatus(); -BOOL NCDIsInterfaceDecided(); +NCDErr NCDGetLinkStatus(); +BOOL NCDIsInterfaceDecided(); -NCDErr NCDGetWirelessMacAddress(u8* macAddr); +NCDErr NCDGetWirelessMacAddress(u8* macAddr); -NCDErr NCDLockWirelessDriver(); -NCDErr NCDUnlockWirelessDriver(s32 id); +NCDErr NCDLockWirelessDriver(); +NCDErr NCDUnlockWirelessDriver(s32 id); -s32 NCDRestoreConfig(); +s32 NCDRestoreConfig(); -void NCDSleep(OSTime tick); +void NCDSleep(OSTime tick); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // REVOLUTION_NCD_H +#endif // REVOLUTION_NCD_H diff --git a/libs/RevoEX/include/revolution/ncd/NCDTypes.h b/libs/RevoEX/include/revolution/ncd/NCDTypes.h index 484ec0f4..ef353f49 100644 --- a/libs/RevoEX/include/revolution/ncd/NCDTypes.h +++ b/libs/RevoEX/include/revolution/ncd/NCDTypes.h @@ -8,7 +8,7 @@ typedef s32 NCDErr; #define PACKED __attribute__((packed)) enum { - NCD_LINKSTATUS_WIRED = 3, // ? + NCD_LINKSTATUS_WIRED = 3, // ? }; enum { @@ -25,34 +25,34 @@ enum { NCD_NWC24_PERMISSION_ALL = 7 }; -#define NCD_MAC_ADDRESS_LENGTH 6 +#define NCD_MAC_ADDRESS_LENGTH 6 typedef struct NCDProxyServerProfile { - u8 mode; // 0x00 - u8 authType; // 0x01 - u8 reserved[2]; // 0x02 + u8 mode; // 0x00 + u8 authType; // 0x01 + u8 reserved[2]; // 0x02 - char server[256]; // 0x04 - u16 port; // 0x104 + char server[256]; // 0x04 + u16 port; // 0x104 - char username[33]; // 0x106 - char password[33]; // 0x127 + char username[33]; // 0x106 + char password[33]; // 0x127 } NCDProxyServerProfile; typedef struct NCDProxyProfile { - NCDProxyServerProfile http; // 0x00 - NCDProxyServerProfile ssl; // 0x148 + NCDProxyServerProfile http; // 0x00 + NCDProxyServerProfile ssl; // 0x148 struct { - u32 isEnabled; // 0x00 - char servers[1024]; // 0x04 - } noProxy; // 0x290 + u32 isEnabled; // 0x00 + char servers[1024]; // 0x04 + } noProxy; // 0x290 struct { - u32 isEnabled; // 0x00 - u32 isAutomaticEnabled; // 0x04 - char automatic[256]; // 0x08 - } browser; // 0x694 + u32 isEnabled; // 0x00 + u32 isAutomaticEnabled; // 0x04 + char automatic[256]; // 0x08 + } browser; // 0x694 } NCDProxyProfile; typedef struct NCDIpAdjustProfile { @@ -62,141 +62,141 @@ typedef struct NCDIpAdjustProfile { } NCDIpAdjustProfile; typedef struct NCDIpProfile { - u8 addr[4]; // 0x00 - u8 netmask[4]; // 0x04 - u8 gateway[4]; // 0x08 - u8 dns1[4]; // 0x0C - u8 dns2[4]; // 0x10 + u8 addr[4]; // 0x00 + u8 netmask[4]; // 0x04 + u8 gateway[4]; // 0x08 + u8 dns1[4]; // 0x0C + u8 dns2[4]; // 0x10 } NCDIpProfile; typedef struct NCDIpConfig { - BOOL useDhcp; // 0x00 - BOOL useProxy; // 0x04 + BOOL useDhcp; // 0x00 + BOOL useProxy; // 0x04 - NCDIpProfile ip; // 0x08 + NCDIpProfile ip; // 0x08 - NCDIpAdjustProfile adjust; // 0x1C - NCDProxyProfile proxy; // 0x28 + NCDIpAdjustProfile adjust; // 0x1C + NCDProxyProfile proxy; // 0x28 } NCDIpConfig; typedef struct NCDWiredProfile { - u8 reserved[4]; // 0x00 + u8 reserved[4]; // 0x00 } NCDWiredProfile; typedef struct NCDPrivacy { - u16 mode; // 0x00 - u8 reserved[2]; // 0x02 - union { + u16 mode; // 0x00 + u8 reserved[2]; // 0x02 + union { struct { - u16 keyId; // 0x00 - union { - u16 option; // 0x02 - u8 reserved[2]; // 0x02 + u16 keyId; // 0x00 + union { + u16 option; // 0x02 + u8 reserved[2]; // 0x02 }; - u8 key[4][5]; // 0x04 + u8 key[4][5]; // 0x04 } wep40; struct { - u16 keyId; // 0x00 - union { - u16 option; // 0x02 - u8 reserved[2]; // 0x02 + u16 keyId; // 0x00 + union { + u16 option; // 0x02 + u8 reserved[2]; // 0x02 }; u8 key[4][13]; // 0x04 } wep104; struct { - u16 keyLen; // 0x00 - u8 reserved[2]; // 0x02 - u8 key[64]; // 0x04 + u16 keyLen; // 0x00 + u8 reserved[2]; // 0x02 + u8 key[64]; // 0x04 } tkip; struct { - u16 keyLen; // 0x00 - u8 reserved[2]; // 0x02 - u8 key[64]; // 0x04 + u16 keyLen; // 0x00 + u8 reserved[2]; // 0x02 + u8 key[64]; // 0x04 } aes; }; } NCDPrivacy; typedef struct NCDApConfig { - u8 ssid[32]; // 0x00 - u16 ssidLength; // 0x20 + u8 ssid[32]; // 0x00 + u16 ssidLength; // 0x20 - u8 reserved[2]; // 0x22 + u8 reserved[2]; // 0x22 - NCDPrivacy privacy; // 0x24 + NCDPrivacy privacy; // 0x24 } NCDApConfig; typedef struct NCDUsbapConfig { - u16 nickname[11]; // 0x00 - u8 reserved[2]; // 0x16 + u16 nickname[11]; // 0x00 + u8 reserved[2]; // 0x16 } NCDUsbapConfig; typedef struct NCDAossConfig { struct { - u8 ssid[32]; // 0x00 - u16 ssidLength; // 0x20 - u16 keyId; // 0x22 - u8 key[4][5]; // 0x24 - } wep40; // 0x00 + u8 ssid[32]; // 0x00 + u16 ssidLength; // 0x20 + u16 keyId; // 0x22 + u8 key[4][5]; // 0x24 + } wep40; // 0x00 struct { - u8 ssid[32]; // 0x00 - u16 ssidLength; // 0x20 - u16 keyId; // 0x22 - u8 key[4][13]; // 0x24 - } wep104; // 0x38 + u8 ssid[32]; // 0x00 + u16 ssidLength; // 0x20 + u16 keyId; // 0x22 + u8 key[4][13]; // 0x24 + } wep104; // 0x38 struct { - u8 ssid[32]; // 0x00 - u16 ssidLength; // 0x20 - u16 keyLen; // 0x22 - u8 key[64]; // 0x24 - } tkip; // 0x90 + u8 ssid[32]; // 0x00 + u16 ssidLength; // 0x20 + u16 keyLen; // 0x22 + u8 key[64]; // 0x24 + } tkip; // 0x90 struct { - u8 ssid[32]; // 0x00 - u16 ssidLength; // 0x20 - u16 keyLen; // 0x22 - u8 key[64]; // 0x24 - } aes; // 0xF4 + u8 ssid[32]; // 0x00 + u16 ssidLength; // 0x20 + u16 keyLen; // 0x22 + u8 key[64]; // 0x24 + } aes; // 0xF4 } NCDAossConfig; typedef struct NCDWirelessProfile { - u16 rateset; // 0x00 - u8 configMethod; // 0x02 - u8 retryLimit; // 0x03 + u16 rateset; // 0x00 + u8 configMethod; // 0x02 + u8 retryLimit; // 0x03 union { - NCDApConfig manual; - NCDUsbapConfig usbap; - NCDAossConfig aoss; - NCDApConfig rakuraku; - } config; // 0x04 + NCDApConfig manual; + NCDUsbapConfig usbap; + NCDAossConfig aoss; + NCDApConfig rakuraku; + } config; // 0x04 } NCDWirelessProfile; typedef struct NCDIfConfig { - u8 selectedMedia; // 0x00 - u8 linkTimeout; // 0x01 + u8 selectedMedia; // 0x00 + u8 linkTimeout; // 0x01 union { - NCDWiredProfile wired; - NCDWirelessProfile wireless; - } netif; // 0x02 + NCDWiredProfile wired; + NCDWirelessProfile wireless; + } netif; // 0x02 } NCDIfConfig; typedef struct NCDProfile { - u8 flags; // 0x00 - u8 reserved[3]; // 0x01 - NCDIpProfile ip; // 0x04 - NCDIpAdjustProfile adjust; // 0x18 - NCDProxyProfile proxy; // 0x24 + u8 flags; // 0x00 + u8 reserved[3]; // 0x01 + NCDIpProfile ip; // 0x04 + NCDIpAdjustProfile adjust; // 0x18 + NCDProxyProfile proxy; // 0x24 union { - NCDWiredProfile wired; - NCDWirelessProfile wireless; - } netif; // 0x7C0 + NCDWiredProfile wired; + NCDWirelessProfile wireless; + } netif; // 0x7C0 } NCDProfile; typedef struct NCDConfig { - u32 version; // 0x00 - u8 selectedMedia; // 0x04 - u8 nwc24Permission; // 0x05 - u8 linkTimeout; // 0x06 - u8 reserved[1]; // 0x07 - NCDProfile profiles[3]; // 0x08 + u32 version; // 0x00 + u8 selectedMedia; // 0x04 + u8 nwc24Permission; // 0x05 + u8 linkTimeout; // 0x06 + u8 reserved[1]; // 0x07 + NCDProfile profiles[3]; // 0x08 } PACKED NCDConfig; -#endif // REVOLUTION_NCD_TYPES_H +#endif // REVOLUTION_NCD_TYPES_H diff --git a/libs/RevoEX/include/revolution/net/NETDigest.h b/libs/RevoEX/include/revolution/net/NETDigest.h index 40978828..84e9996e 100644 --- a/libs/RevoEX/include/revolution/net/NETDigest.h +++ b/libs/RevoEX/include/revolution/net/NETDigest.h @@ -21,12 +21,12 @@ typedef struct NETMD5Context { u32 d; }; u32 state[4]; - }; // 0x00 - u64 length; // 0x04 + }; // 0x00 + u64 length; // 0x04 union { u32 buffer32[16]; - u8 buffer8[64]; - }; // 0x0C + u8 buffer8[64]; + }; // 0x0C } NETMD5Context; #define NET_MD5_DIGEST_SIZE 16 @@ -48,10 +48,10 @@ static void NETCalcMD5(void* digest, const void* input, u32 length) { /* == SHA1 == */ typedef struct NETSHA1Context { - u8 unk_0x00[0x60]; // 0x00 + u8 unk_0x00[0x60]; // 0x00 } NETSHA1Context; -#define NET_SHA1_DIGEST_SIZE 20 +#define NET_SHA1_DIGEST_SIZE 20 typedef u8 NETSHA1Sum[NET_SHA1_DIGEST_SIZE]; @@ -71,4 +71,4 @@ static void NETCalcSHA1(void* digest, const void* input, u32 length) { } #endif -#endif // REVOLUTION_NET_DIGEST_H +#endif // REVOLUTION_NET_DIGEST_H diff --git a/libs/RevoEX/include/revolution/net/NETMisc.h b/libs/RevoEX/include/revolution/net/NETMisc.h index 3db36a52..ba9eae8e 100644 --- a/libs/RevoEX/include/revolution/net/NETMisc.h +++ b/libs/RevoEX/include/revolution/net/NETMisc.h @@ -1,17 +1,17 @@ #ifndef REVOLUTION_NET_MISC_H #define REVOLUTION_NET_MISC_H -#include #include +#include #ifdef __cplusplus extern "C" { #endif -BOOL NETGetUniversalCalendar(OSCalendarTime* time); +BOOL NETGetUniversalCalendar(OSCalendarTime* time); #ifdef __cplusplus } #endif -#endif // REVOLUTION_NET_MISC_H +#endif // REVOLUTION_NET_MISC_H diff --git a/libs/RevoEX/include/revolution/nwc24.h b/libs/RevoEX/include/revolution/nwc24.h index ff13ab60..9d00527a 100644 --- a/libs/RevoEX/include/revolution/nwc24.h +++ b/libs/RevoEX/include/revolution/nwc24.h @@ -9,8 +9,8 @@ #include -#include #include +#include #include #include diff --git a/libs/RevoEX/include/revolution/nwc24/NWC24Config.h b/libs/RevoEX/include/revolution/nwc24/NWC24Config.h index 1d6172dc..69f2c28f 100644 --- a/libs/RevoEX/include/revolution/nwc24/NWC24Config.h +++ b/libs/RevoEX/include/revolution/nwc24/NWC24Config.h @@ -10,37 +10,37 @@ extern "C" { #endif -NWC24Err NWC24GetMyUserId(NWC24UserId* pId); -NWC24Err NWC24GenerateNewUserId(NWC24UserId* pId); -NWC24Err NWC24RegisterUserId(); +NWC24Err NWC24GetMyUserId(NWC24UserId* pId); +NWC24Err NWC24GenerateNewUserId(NWC24UserId* pId); +NWC24Err NWC24RegisterUserId(); const char* NWC24GetAccountDomain(); -void NWC24SetAccountDomain(const char* accountDomain); +void NWC24SetAccountDomain(const char* accountDomain); const char* NWC24GetMBoxDir(); -u32 NWC24GetAppId(); -u16 NWC24GetGroupId(); +u32 NWC24GetAppId(); +u16 NWC24GetGroupId(); const char* NWC24GetPassword(); -void NWC24SetPassword(const char* password); +void NWC24SetPassword(const char* password); const char* NWC24GetMailCheckId(); -void NWC24SetMailCheckId(const char* mailCheckId); +void NWC24SetMailCheckId(const char* mailCheckId); const char* NWC24GetAccMgtServerURL(); -void NWC24SetAccMgtServerURL(const char* accMgtServerURL); +void NWC24SetAccMgtServerURL(const char* accMgtServerURL); const char* NWC24GetMailChkServerURL(); -void NWC24SetMailChkServerURL(const char* mailChkServerURL); +void NWC24SetMailChkServerURL(const char* mailChkServerURL); const char* NWC24GetMailRcvServerURL(); -void NWC24SetMailRcvServerURL(const char* mailRcvServerURL); +void NWC24SetMailRcvServerURL(const char* mailRcvServerURL); const char* NWC24GetMailDelServerURL(); -void NWC24SetMailDelServerURL(const char* mailDelServerURL); +void NWC24SetMailDelServerURL(const char* mailDelServerURL); const char* NWC24GetMailTrsServerURL(); -void NWC24SetMailTrsServerURL(const char* mailTrsServerURL); +void NWC24SetMailTrsServerURL(const char* mailTrsServerURL); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/revolution/nwc24/NWC24Dl.h b/libs/RevoEX/include/revolution/nwc24/NWC24Dl.h index 4c92685c..0c773f06 100644 --- a/libs/RevoEX/include/revolution/nwc24/NWC24Dl.h +++ b/libs/RevoEX/include/revolution/nwc24/NWC24Dl.h @@ -9,8 +9,8 @@ extern "C" { #endif -#define NWC24_DL_TASK_MAX 120 -#define NWC24_DL_SUBTASK_MAX 32 +#define NWC24_DL_TASK_MAX 120 +#define NWC24_DL_SUBTASK_MAX 32 typedef u16 NWC24DlId; @@ -56,12 +56,7 @@ typedef enum NWC24DLStep { DL24STEP_END, } NWC24DLStep; -typedef enum { - NWC24_DLTYPE_MULTIPART_V1, - NWC24_DLTYPE_OCTETSTREAM_V1, - NWC24_DLTYPE_MULTIPART_V2, - NWC24_DLTYPE_OCTETSTREAM_V2 -} NWC24DLType; +typedef enum { NWC24_DLTYPE_MULTIPART_V1, NWC24_DLTYPE_OCTETSTREAM_V1, NWC24_DLTYPE_MULTIPART_V2, NWC24_DLTYPE_OCTETSTREAM_V2 } NWC24DLType; typedef enum { NWC24_DL_STTYPE_NONE, @@ -71,7 +66,7 @@ typedef enum { NWC24_DL_STTYPE_TIME_DAY } NWC24DLSubTaskType; -typedef enum { +typedef enum { NWC24_DL_STFLAG_TRAILING_FILENAME = (1 << 0), NWC24_DL_STFLAG_TRAILING_URL = (1 << 1), NWC24_DL_STFLAG_INTELLIGENT_UPDATE = (1 << 8), @@ -79,7 +74,7 @@ typedef enum { } NWC24DLSubTaskFlags; typedef struct NWC24DlTask { - u8 data[512]; // 0x00 + u8 data[512]; // 0x00 } NWC24DlTask; typedef struct NWC24DlIterateWork { @@ -91,34 +86,34 @@ typedef struct NWC24DlIterateWork { int unk_0x14; } NWC24DlIterateWork; -NWC24Err NWC24InitDlTask(NWC24DlTask* dlTask, NWC24DLType dlType); +NWC24Err NWC24InitDlTask(NWC24DlTask* dlTask, NWC24DLType dlType); -NWC24Err NWC24SetDlId(NWC24DlTask* dlTask, NWC24DlId dlId); -NWC24Err NWC24SetDlPriority(NWC24DlTask* dlTask, u8 dlPrio); -NWC24Err NWC24SetDlInterval(NWC24DlTask* dlTask, u16 dlInterval); -NWC24Err NWC24SetDlUrl(NWC24DlTask* dlTask, const char* dlUrl); -NWC24Err NWC24SetDlFlags(NWC24DlTask* dlTask, u32 dlFlags); +NWC24Err NWC24SetDlId(NWC24DlTask* dlTask, NWC24DlId dlId); +NWC24Err NWC24SetDlPriority(NWC24DlTask* dlTask, u8 dlPrio); +NWC24Err NWC24SetDlInterval(NWC24DlTask* dlTask, u16 dlInterval); +NWC24Err NWC24SetDlUrl(NWC24DlTask* dlTask, const char* dlUrl); +NWC24Err NWC24SetDlFlags(NWC24DlTask* dlTask, u32 dlFlags); -NWC24Err NWC24GetDlAppId(const NWC24DlTask* dlTask, u32* dlAppId); +NWC24Err NWC24GetDlAppId(const NWC24DlTask* dlTask, u32* dlAppId); -NWC24Err NWC24DumpDlTask(NWC24DlTask* dlTask); +NWC24Err NWC24DumpDlTask(NWC24DlTask* dlTask); -NWC24Err NWC24IterateDlTask(NWC24DlId* dlIterateId, BOOL begin); -NWC24Err NWC24IterateDlTaskEx(NWC24DlIterateWork* dlIterateWork, NWC24DlId* dlIterateId); +NWC24Err NWC24IterateDlTask(NWC24DlId* dlIterateId, BOOL begin); +NWC24Err NWC24IterateDlTaskEx(NWC24DlIterateWork* dlIterateWork, NWC24DlId* dlIterateId); -NWC24Err NWC24UpdateDlTask(NWC24DlTask* dlTask); +NWC24Err NWC24UpdateDlTask(NWC24DlTask* dlTask); -NWC24Err NWC24DeleteDlTask(NWC24DlTask* dlTask); -NWC24Err NWC24AddDlTask(NWC24DlTask* dlTask); +NWC24Err NWC24DeleteDlTask(NWC24DlTask* dlTask); +NWC24Err NWC24AddDlTask(NWC24DlTask* dlTask); -NWC24Err NWC24GetDlTask(NWC24DlTask* dlTask, NWC24DlId dlId); +NWC24Err NWC24GetDlTask(NWC24DlTask* dlTask, NWC24DlId dlId); -NWC24Err NWC24PurgeOldestDlTask(); -NWC24Err NWC24ManageDlTaskListForMenu(); +NWC24Err NWC24PurgeOldestDlTask(); +NWC24Err NWC24ManageDlTaskListForMenu(); -NWC24Err NWC24ExtendDlTaskList(u32 num); +NWC24Err NWC24ExtendDlTaskList(u32 num); -NWC24Err NWC24GetDlOptOutFlags(NWC24DlTask* dlTask, u8* dlOptOutFlags); +NWC24Err NWC24GetDlOptOutFlags(NWC24DlTask* dlTask, u8* dlOptOutFlags); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/revolution/nwc24/NWC24Err.h b/libs/RevoEX/include/revolution/nwc24/NWC24Err.h index f4afdbfe..ac2b5de9 100644 --- a/libs/RevoEX/include/revolution/nwc24/NWC24Err.h +++ b/libs/RevoEX/include/revolution/nwc24/NWC24Err.h @@ -2,59 +2,59 @@ #define NWC24_ERROR_H typedef enum NWC24Err { - NWC24_OK = 0, + NWC24_OK = 0, - NWC24_ERR_FATAL = -1, - NWC24_ERR_FAILED = -2, - NWC24_ERR_INVALID_VALUE = -3, - NWC24_ERR_NOT_SUPPORTED = -4, - NWC24_ERR_NULL = -5, - NWC24_ERR_FULL = -6, - NWC24_ERR_PROTECTED = -7, - NWC24_ERR_OVERFLOW = -8, - NWC24_ERR_LIB_NOT_OPENED = -9, - NWC24_ERR_LIB_OPENED = -10, - NWC24_ERR_NOMEM = -11, - NWC24_ERR_CONFIG = -12, - NWC24_ERR_NOT_FOUND = -13, - NWC24_ERR_BROKEN = -14, - NWC24_ERR_DONE = -15, - NWC24_ERR_FILE_OPEN = -16, - NWC24_ERR_FILE_CLOSE = -17, - NWC24_ERR_FILE_READ = -18, - NWC24_ERR_FILE_WRITE = -19, - NWC24_ERR_FILE_NOEXISTS = -20, - NWC24_ERR_FILE_OTHER = -21, - NWC24_ERR_MUTEX = -22, - NWC24_ERR_ALIGNMENT = -23, - NWC24_ERR_FORMAT = -24, - NWC24_ERR_STRING_END = -25, - NWC24_ERR_BUSY = -26, - NWC24_ERR_VER_MISMATCH = -27, - NWC24_ERR_HIDDEN = -28, - NWC24_ERR_INPROGRESS = -29, - NWC24_ERR_NOT_READY = -30, - NWC24_ERR_NETWORK = -31, - NWC24_ERR_SERVER = -32, - NWC24_ERR_CONFIG_NETWORK = -33, - NWC24_ERR_ID_NOEXISTS = -34, - NWC24_ERR_ID_GENERATED = -35, - NWC24_ERR_ID_REGISTERED = -36, - NWC24_ERR_ID_CRC = -37, - NWC24_ERR_NAND_CORRUPT = -38, - NWC24_ERR_DISABLED = -39, + NWC24_ERR_FATAL = -1, + NWC24_ERR_FAILED = -2, + NWC24_ERR_INVALID_VALUE = -3, + NWC24_ERR_NOT_SUPPORTED = -4, + NWC24_ERR_NULL = -5, + NWC24_ERR_FULL = -6, + NWC24_ERR_PROTECTED = -7, + NWC24_ERR_OVERFLOW = -8, + NWC24_ERR_LIB_NOT_OPENED = -9, + NWC24_ERR_LIB_OPENED = -10, + NWC24_ERR_NOMEM = -11, + NWC24_ERR_CONFIG = -12, + NWC24_ERR_NOT_FOUND = -13, + NWC24_ERR_BROKEN = -14, + NWC24_ERR_DONE = -15, + NWC24_ERR_FILE_OPEN = -16, + NWC24_ERR_FILE_CLOSE = -17, + NWC24_ERR_FILE_READ = -18, + NWC24_ERR_FILE_WRITE = -19, + NWC24_ERR_FILE_NOEXISTS = -20, + NWC24_ERR_FILE_OTHER = -21, + NWC24_ERR_MUTEX = -22, + NWC24_ERR_ALIGNMENT = -23, + NWC24_ERR_FORMAT = -24, + NWC24_ERR_STRING_END = -25, + NWC24_ERR_BUSY = -26, + NWC24_ERR_VER_MISMATCH = -27, + NWC24_ERR_HIDDEN = -28, + NWC24_ERR_INPROGRESS = -29, + NWC24_ERR_NOT_READY = -30, + NWC24_ERR_NETWORK = -31, + NWC24_ERR_SERVER = -32, + NWC24_ERR_CONFIG_NETWORK = -33, + NWC24_ERR_ID_NOEXISTS = -34, + NWC24_ERR_ID_GENERATED = -35, + NWC24_ERR_ID_REGISTERED = -36, + NWC24_ERR_ID_CRC = -37, + NWC24_ERR_NAND_CORRUPT = -38, + NWC24_ERR_DISABLED = -39, NWC24_ERR_INVALID_OPERATION = -40, - NWC24_ERR_FILE_EXISTS = -41, - NWC24_ERR_INTERNAL_IPC = -42, - NWC24_ERR_INTERNAL_VF = -43, + NWC24_ERR_FILE_EXISTS = -41, + NWC24_ERR_INTERNAL_IPC = -42, + NWC24_ERR_INTERNAL_VF = -43, NWC24_ERR_ID_NOT_REGISTERED = -44, - NWC24_ERR_VERIFY_SIGNATURE = -45, - NWC24_ERR_FILE_BROKEN = -46, - NWC24_ERR_INVALID_CHAR = -47, - NWC24_ERR_CANCELLED = -48, - NWC24_ERR_OLD_SYSTEM = -49, - NWC24_ERR_SCRIPT_VERSION = -50, - NWC24_ERR_GIVE_UP = -51, + NWC24_ERR_VERIFY_SIGNATURE = -45, + NWC24_ERR_FILE_BROKEN = -46, + NWC24_ERR_INVALID_CHAR = -47, + NWC24_ERR_CANCELLED = -48, + NWC24_ERR_OLD_SYSTEM = -49, + NWC24_ERR_SCRIPT_VERSION = -50, + NWC24_ERR_GIVE_UP = -51, } NWC24Err; #include diff --git a/libs/RevoEX/include/revolution/nwc24/NWC24ErrorCodes.h b/libs/RevoEX/include/revolution/nwc24/NWC24ErrorCodes.h index b33a72fc..989b5bbf 100644 --- a/libs/RevoEX/include/revolution/nwc24/NWC24ErrorCodes.h +++ b/libs/RevoEX/include/revolution/nwc24/NWC24ErrorCodes.h @@ -1,14 +1,14 @@ #ifndef NWC24_ERROR_CODES_H #define NWC24_ERROR_CODES_H -#define NWC24_ERRCODE_1090XX (-109000) /* Error initializing NWC24 Library (XX == NWC24Err) */ -#define NWC24_ERRCODE_1091XX (-109100) /* Error running check (XX = NWC24Err) */ -#define NWC24_ERRCODE_1092XX (-109200) /* Error registering User ID (XX == NWC24Err) */ -#define NWC24_ERRCODE_1093XX (-109300) /* Error committing message (XX == NWC24Err) */ +#define NWC24_ERRCODE_1090XX (-109000) /* Error initializing NWC24 Library (XX == NWC24Err) */ +#define NWC24_ERRCODE_1091XX (-109100) /* Error running check (XX = NWC24Err) */ +#define NWC24_ERRCODE_1092XX (-109200) /* Error registering User ID (XX == NWC24Err) */ +#define NWC24_ERRCODE_1093XX (-109300) /* Error committing message (XX == NWC24Err) */ #include -void NWC24iSetErrorCode(s32 code); +void NWC24iSetErrorCode(s32 code); #define NWC24iMakeCode(code, result) (result + code) diff --git a/libs/RevoEX/include/revolution/nwc24/NWC24Friend.h b/libs/RevoEX/include/revolution/nwc24/NWC24Friend.h index 18d13d42..2aec0abd 100644 --- a/libs/RevoEX/include/revolution/nwc24/NWC24Friend.h +++ b/libs/RevoEX/include/revolution/nwc24/NWC24Friend.h @@ -10,7 +10,7 @@ extern "C" { #endif -#define NWC24_FRIEND_INFO_MAX 100 +#define NWC24_FRIEND_INFO_MAX 100 typedef enum NWC24FriendType { NWC24_FRIENDTYPE_NONE = 0, @@ -25,46 +25,45 @@ typedef enum NWC24FriendStatus { NWC24_FRIENDSTATUS_DECLINED, } NWC24FriendStatus; -#define NWC24_FRIEND_NAME_LENGTH 12 +#define NWC24_FRIEND_NAME_LENGTH 12 typedef union NWC24FriendAddr { - NWC24UserId wiiId; // Wii Friend Code - NWC24UserMailAddr mailAddr; // Email Address + NWC24UserId wiiId; // Wii Friend Code + NWC24UserMailAddr mailAddr; // Email Address } NWC24FriendAddr; typedef struct NWC24FriendAttr { - u32 type; // 0x00 - u32 status; // 0x04 - u16 name[NWC24_FRIEND_NAME_LENGTH]; // 0x08 - NWC24UserId fdId; // 0x20 - u32 reserved[6]; // 0x28 + u32 type; // 0x00 + u32 status; // 0x04 + u16 name[NWC24_FRIEND_NAME_LENGTH]; // 0x08 + NWC24UserId fdId; // 0x20 + u32 reserved[6]; // 0x28 } NWC24FriendAttr; typedef struct NWC24FriendInfo { - NWC24FriendAttr attr; // 0x00 - NWC24FriendAddr addr; // 0x40 + NWC24FriendAttr attr; // 0x00 + NWC24FriendAddr addr; // 0x40 } NWC24FriendInfo; // ??? typedef struct NWC24SecretFriendInfo { - u8 unk_0x00[0x20]; + u8 unk_0x00[0x20]; } NWC24SecretFriendInfo; +NWC24Err NWC24ReadFriendInfo(NWC24FriendInfo* info, u32 index); +NWC24Err NWC24WriteFriendInfo(const NWC24FriendInfo* friendInfo, u32 index); +NWC24Err NWC24DeleteFriendInfo(u32 index); +NWC24Err NWC24UpdateFriendInfo(const NWC24FriendInfo* friendInfo, u32 index); +NWC24Err NWC24SwapFriendInfos(u32 index1, u32 index2); +NWC24Err NWC24SearchFriendInfoById(NWC24UserId id, u32* index); +NWC24Err NWC24SearchFriendInfoByAddr(const NWC24FriendAddr* addr, u32* index); +NWC24Err NWC24GetNumFriendInfos(u32* numFriendInfo); +NWC24Err NWC24GetNumRegFriendInfos(u32* numRegFriendInfo); -NWC24Err NWC24ReadFriendInfo(NWC24FriendInfo* info, u32 index); -NWC24Err NWC24WriteFriendInfo(const NWC24FriendInfo* friendInfo, u32 index); -NWC24Err NWC24DeleteFriendInfo(u32 index); -NWC24Err NWC24UpdateFriendInfo(const NWC24FriendInfo* friendInfo, u32 index); -NWC24Err NWC24SwapFriendInfos(u32 index1, u32 index2); -NWC24Err NWC24SearchFriendInfoById(NWC24UserId id, u32* index); -NWC24Err NWC24SearchFriendInfoByAddr(const NWC24FriendAddr* addr, u32* index); -NWC24Err NWC24GetNumFriendInfos(u32* numFriendInfo); -NWC24Err NWC24GetNumRegFriendInfos(u32* numRegFriendInfo); +BOOL NWC24IsFriendInfoThere(u32 index); // This also returns NWC24Err -BOOL NWC24IsFriendInfoThere(u32 index); // This also returns NWC24Err - -NWC24Err NWC24CheckPublicMailAddr(const char* addr); -NWC24Err NWC24CheckFriendInfo(const NWC24FriendInfo* friendInfo); +NWC24Err NWC24CheckPublicMailAddr(const char* addr); +NWC24Err NWC24CheckFriendInfo(const NWC24FriendInfo* friendInfo); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/revolution/nwc24/NWC24Manage.h b/libs/RevoEX/include/revolution/nwc24/NWC24Manage.h index 55c68b21..0cc02247 100644 --- a/libs/RevoEX/include/revolution/nwc24/NWC24Manage.h +++ b/libs/RevoEX/include/revolution/nwc24/NWC24Manage.h @@ -9,24 +9,24 @@ extern "C" { #endif -BOOL NWC24IsMsgLibOpened(); -BOOL NWC24IsMsgLibOpenedByTool(); -BOOL NWC24IsMsgLibOpenBlocking(); +BOOL NWC24IsMsgLibOpened(); +BOOL NWC24IsMsgLibOpenedByTool(); +BOOL NWC24IsMsgLibOpenBlocking(); #define NWC24_LIB_WORK_SIZE 0x4000 -NWC24Err NWC24OpenLib(void* work); -NWC24Err NWC24OpenMsgLib(void* work); -NWC24Err NWC24CloseLib(); -NWC24Err NWC24CloseMsgLib(); +NWC24Err NWC24OpenLib(void* work); +NWC24Err NWC24OpenMsgLib(void* work); +NWC24Err NWC24CloseLib(); +NWC24Err NWC24CloseMsgLib(); -NWC24Err NWC24BlockOpenMsgLib(BOOL block); +NWC24Err NWC24BlockOpenMsgLib(BOOL block); -NWC24Err NWC24Check(u32 usage); -s32 NWC24GetErrorCode(); +NWC24Err NWC24Check(u32 usage); +s32 NWC24GetErrorCode(); -NWC24Err NWC24InitFiles(void* work, BOOL force); -NWC24Err NWC24InitFilesIndividually(void* work, BOOL forceConfig, BOOL forceMBox, BOOL forceFriendList, BOOL forceDlTask); +NWC24Err NWC24InitFiles(void* work, BOOL force); +NWC24Err NWC24InitFilesIndividually(void* work, BOOL forceConfig, BOOL forceMBox, BOOL forceFriendList, BOOL forceDlTask); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/revolution/nwc24/NWC24MsgBoard.h b/libs/RevoEX/include/revolution/nwc24/NWC24MsgBoard.h index 355bdd62..20173025 100644 --- a/libs/RevoEX/include/revolution/nwc24/NWC24MsgBoard.h +++ b/libs/RevoEX/include/revolution/nwc24/NWC24MsgBoard.h @@ -13,27 +13,27 @@ extern "C" { #endif typedef enum NWC24MsgType { - NWC24_MSGTYPE_RVL_MENU_SHARED = 0, - NWC24_MSGTYPE_WII_MENU_SHARED = 0, + NWC24_MSGTYPE_RVL_MENU_SHARED = 0, + NWC24_MSGTYPE_WII_MENU_SHARED = 0, - NWC24_MSGTYPE_RVL = 1, - NWC24_MSGTYPE_RVL_APPZ = 1, - NWC24_MSGTYPE_RVL_APP_ONLY = 1, - NWC24_MSGTYPE_WII = 1, - NWC24_MSGTYPE_WII_APP = 1, - NWC24_MSGTYPE_WII_APP_ONLY = 1, + NWC24_MSGTYPE_RVL = 1, + NWC24_MSGTYPE_RVL_APPZ = 1, + NWC24_MSGTYPE_RVL_APP_ONLY = 1, + NWC24_MSGTYPE_WII = 1, + NWC24_MSGTYPE_WII_APP = 1, + NWC24_MSGTYPE_WII_APP_ONLY = 1, - NWC24_MSGTYPE_RVL_MENU = 2, - NWC24_MSGTYPE_RVL_MENU_ONLY = 2, - NWC24_MSGTYPE_WII_MENU = 2, - NWC24_MSGTYPE_WII_MENU_ONLY = 2, + NWC24_MSGTYPE_RVL_MENU = 2, + NWC24_MSGTYPE_RVL_MENU_ONLY = 2, + NWC24_MSGTYPE_WII_MENU = 2, + NWC24_MSGTYPE_WII_MENU_ONLY = 2, - NWC24_MSGTYPE_RVL_APP_HIDDEN = 3, - NWC24_MSGTYPE_RVL_HIDDEN = 3, - NWC24_MSGTYPE_WII_APP_HIDDEN = 3, - NWC24_MSGTYPE_WII_HIDDEN = 3, + NWC24_MSGTYPE_RVL_APP_HIDDEN = 3, + NWC24_MSGTYPE_RVL_HIDDEN = 3, + NWC24_MSGTYPE_WII_APP_HIDDEN = 3, + NWC24_MSGTYPE_WII_HIDDEN = 3, - NWC24_MSGTYPE_PUBLIC = 4 + NWC24_MSGTYPE_PUBLIC = 4 } NWC24MsgType; typedef enum NWC24MBoxType { @@ -53,98 +53,102 @@ typedef enum NWC24EncodingRegion { /* NWC24 Message Object */ typedef struct NWC24MsgObj { - u32 data[64]; // 0x00 + u32 data[64]; // 0x00 } NWC24MsgObj; -#define NWC24_FACE_DATA_SIZE 0x4A /* sizeof(RFLCharData) */ +#define NWC24_FACE_DATA_SIZE 0x4A /* sizeof(RFLCharData) */ -#define NWC24_ATTACH_PICTURE_MAX 0x14000 -#define NWC24_ATTACH_MSGBOARD_MAX 0x1E000 -#define NWC24_ATTACH_MINIDATA_MAX 0x2800 +#define NWC24_ATTACH_PICTURE_MAX 0x14000 +#define NWC24_ATTACH_MSGBOARD_MAX 0x1E000 +#define NWC24_ATTACH_MINIDATA_MAX 0x2800 -#define NWC24_SUBJECT_PUBLIC_WORK_SIZE 0x600 -#define NWC24_TEXT_PUBLIC_WORK_SIZE 0x2EE0 +#define NWC24_SUBJECT_PUBLIC_WORK_SIZE 0x600 +#define NWC24_TEXT_PUBLIC_WORK_SIZE 0x2EE0 -#define NWC24_MSG_SUBJECT_LENGTH 256 -#define NWC24_MSG_TEXT_LENGTH 3000 +#define NWC24_MSG_SUBJECT_LENGTH 256 +#define NWC24_MSG_TEXT_LENGTH 3000 -NWC24Err NWC24InitMsgObj(NWC24MsgObj* msg, NWC24MsgType type); +NWC24Err NWC24InitMsgObj(NWC24MsgObj* msg, NWC24MsgType type); -NWC24Err NWC24SetMsgToId(NWC24MsgObj* msg, NWC24UserId id); -NWC24Err NWC24SetMsgToAddr(NWC24MsgObj* msg, const char* addr, u32 length); -NWC24Err NWC24SetMsgSubject(NWC24MsgObj* msg, const char* subject, u32 length); -NWC24Err NWC24SetMsgText(NWC24MsgObj* msg, const char* text, u32 textLen, NWC24Charset charset, NWC24Encoding encoding); -NWC24Err NWC24SetMsgAttached(NWC24MsgObj* msg, const void* attachData, u32 attachSize, NWC24MIMEType type); -NWC24Err NWC24SetMsgFaceData(NWC24MsgObj* msg, const void* faceData); -NWC24Err NWC24SetMsgMBNoReply(NWC24MsgObj* msg, BOOL mbNoReplyFlag); -NWC24Err NWC24SetMsgMBRegDate(NWC24MsgObj* msg, u16 year, u8 month, u8 day); -NWC24Err NWC24SetMsgAppId(NWC24MsgObj* msg, u32 appId); -NWC24Err NWC24SetMsgLedPattern(NWC24MsgObj* msg, int ledPattern); +NWC24Err NWC24SetMsgToId(NWC24MsgObj* msg, NWC24UserId id); +NWC24Err NWC24SetMsgToAddr(NWC24MsgObj* msg, const char* addr, u32 length); +NWC24Err NWC24SetMsgSubject(NWC24MsgObj* msg, const char* subject, u32 length); +NWC24Err NWC24SetMsgText(NWC24MsgObj* msg, const char* text, u32 textLen, NWC24Charset charset, NWC24Encoding encoding); +NWC24Err NWC24SetMsgAttached(NWC24MsgObj* msg, const void* attachData, u32 attachSize, NWC24MIMEType type); +NWC24Err NWC24SetMsgFaceData(NWC24MsgObj* msg, const void* faceData); +NWC24Err NWC24SetMsgMBNoReply(NWC24MsgObj* msg, BOOL mbNoReplyFlag); +NWC24Err NWC24SetMsgMBRegDate(NWC24MsgObj* msg, u16 year, u8 month, u8 day); +NWC24Err NWC24SetMsgAppId(NWC24MsgObj* msg, u32 appId); +NWC24Err NWC24SetMsgLedPattern(NWC24MsgObj* msg, int ledPattern); -NWC24Err NWC24GetMsgType(const NWC24MsgObj* msg, NWC24MsgType* type); -NWC24Err NWC24GetMsgSubjectSize(const NWC24MsgObj* msg, u32* subjectSize); -NWC24Err NWC24GetMsgTextSize(const NWC24MsgObj* msg, u32* textSize); -NWC24Err NWC24GetMsgNumAttached(const NWC24MsgObj* msg, u32* numAttach); -NWC24Err NWC24GetMsgAttachedSize(const NWC24MsgObj* msg, u32 attachIndex, u32* attachSize); -NWC24Err NWC24GetMsgAttachedType(const NWC24MsgObj* msg, u32 attachIndex, NWC24MIMEType* attachType); -NWC24Err NWC24GetMsgAppId(const NWC24MsgObj* msg, u32* appId); -NWC24Err NWC24GetMsgGroupId(const NWC24MsgObj* msg, u16* groupId); -NWC24Err NWC24GetMsgFromId(const NWC24MsgObj* msg, NWC24UserId* fromId); -NWC24Err NWC24GetMsgDate(const NWC24MsgObj* msg, OSCalendarTime* msgDate); -NWC24Err NWC24GetMsgIconNewSign(const NWC24MsgObj* msg, u32* iconNewSign); +NWC24Err NWC24GetMsgType(const NWC24MsgObj* msg, NWC24MsgType* type); +NWC24Err NWC24GetMsgSubjectSize(const NWC24MsgObj* msg, u32* subjectSize); +NWC24Err NWC24GetMsgTextSize(const NWC24MsgObj* msg, u32* textSize); +NWC24Err NWC24GetMsgNumAttached(const NWC24MsgObj* msg, u32* numAttach); +NWC24Err NWC24GetMsgAttachedSize(const NWC24MsgObj* msg, u32 attachIndex, u32* attachSize); +NWC24Err NWC24GetMsgAttachedType(const NWC24MsgObj* msg, u32 attachIndex, NWC24MIMEType* attachType); +NWC24Err NWC24GetMsgAppId(const NWC24MsgObj* msg, u32* appId); +NWC24Err NWC24GetMsgGroupId(const NWC24MsgObj* msg, u16* groupId); +NWC24Err NWC24GetMsgFromId(const NWC24MsgObj* msg, NWC24UserId* fromId); +NWC24Err NWC24GetMsgDate(const NWC24MsgObj* msg, OSCalendarTime* msgDate); +NWC24Err NWC24GetMsgIconNewSign(const NWC24MsgObj* msg, u32* iconNewSign); -NWC24Err NWC24ReadMsgField(const NWC24MsgObj* msg, char* fieldName, u8* fieldBuf, u32 fieldBufLen); -NWC24Err NWC24ReadMsgFaceData(const NWC24MsgObj* msg, u8* faceData); -NWC24Err NWC24ReadMsgAltName(const NWC24MsgObj* msg, u16* altName, u32 altNameLen); -NWC24Err NWC24ReadMsgMBNoReply(const NWC24MsgObj* msg, BOOL* mbNoReplyFlag); -NWC24Err NWC24ReadMsgMBRegDate(const NWC24MsgObj* msg, u16* year, u8* month, u8* day); -NWC24Err NWC24ReadMsgMBDelay(const NWC24MsgObj* msg, u8* mbDelay); -NWC24Err NWC24ReadMsgMBUpdateSW(const NWC24MsgObj* msg, u32* mbUpdateSW); -NWC24Err NWC24ReadMsgMBOptOutFlag(const NWC24MsgObj* msg, BOOL* mbOptOutFlag, u32* appId); -NWC24Err NWC24ReadMsgFromAddr(const NWC24MsgObj* msg, char* addr, u32 addrLen); -NWC24Err NWC24ReadMsgSubject(const NWC24MsgObj* msg, char* subject, u32 subjectLen); -NWC24Err NWC24ReadMsgText(const NWC24MsgObj* msg, char* text, u32 textLen, NWC24Charset* charset, NWC24Encoding* encoding); -NWC24Err NWC24ReadMsgTextEx(const NWC24MsgObj* msg, char* text, u32 textLen, const char* name, u32 nameLen, NWC24Charset* charset, NWC24Encoding* encoding); -NWC24Err NWC24ReadMsgAttached(const NWC24MsgObj* msg, u32 attachIndex, u8* attachData, u32 attachSize); +NWC24Err NWC24ReadMsgField(const NWC24MsgObj* msg, char* fieldName, u8* fieldBuf, u32 fieldBufLen); +NWC24Err NWC24ReadMsgFaceData(const NWC24MsgObj* msg, u8* faceData); +NWC24Err NWC24ReadMsgAltName(const NWC24MsgObj* msg, u16* altName, u32 altNameLen); +NWC24Err NWC24ReadMsgMBNoReply(const NWC24MsgObj* msg, BOOL* mbNoReplyFlag); +NWC24Err NWC24ReadMsgMBRegDate(const NWC24MsgObj* msg, u16* year, u8* month, u8* day); +NWC24Err NWC24ReadMsgMBDelay(const NWC24MsgObj* msg, u8* mbDelay); +NWC24Err NWC24ReadMsgMBUpdateSW(const NWC24MsgObj* msg, u32* mbUpdateSW); +NWC24Err NWC24ReadMsgMBOptOutFlag(const NWC24MsgObj* msg, BOOL* mbOptOutFlag, u32* appId); +NWC24Err NWC24ReadMsgFromAddr(const NWC24MsgObj* msg, char* addr, u32 addrLen); +NWC24Err NWC24ReadMsgSubject(const NWC24MsgObj* msg, char* subject, u32 subjectLen); +NWC24Err NWC24ReadMsgText(const NWC24MsgObj* msg, char* text, u32 textLen, NWC24Charset* charset, NWC24Encoding* encoding); +NWC24Err NWC24ReadMsgTextEx(const NWC24MsgObj* msg, char* text, u32 textLen, const char* name, u32 nameLen, NWC24Charset* charset, + NWC24Encoding* encoding); +NWC24Err NWC24ReadMsgAttached(const NWC24MsgObj* msg, u32 attachIndex, u8* attachData, u32 attachSize); -NWC24Err NWC24ReadMsgSubjectPublic(const NWC24MsgObj* msg, u16* subject, u32* subjectLen, NWC24EncodingRegion encRegion, u16 unk, u8* work, u32 workSize); -NWC24Err NWC24ReadMsgTextPublic(const NWC24MsgObj* msg, u16* text, u32* textLen, NWC24EncodingRegion encRegion, u16 unk, u8* work, u32 workSize); -NWC24Err NWC24SetMsgSubjectPublic(NWC24MsgObj* msg, const u16* subject, u32 subjectLen, NWC24EncodingRegion encRegion, u16 unk, u8* work, u32 workSize); -NWC24Err NWC24SetMsgSubjectAndTextPublic(NWC24MsgObj* msg, const u16* subject, u32 subjectLen, const u16* text, u32 textLen, NWC24EncodingRegion encRegion, u16 unk, u8* work, u32 workSize); +NWC24Err NWC24ReadMsgSubjectPublic(const NWC24MsgObj* msg, u16* subject, u32* subjectLen, NWC24EncodingRegion encRegion, u16 unk, u8* work, + u32 workSize); +NWC24Err NWC24ReadMsgTextPublic(const NWC24MsgObj* msg, u16* text, u32* textLen, NWC24EncodingRegion encRegion, u16 unk, u8* work, u32 workSize); +NWC24Err NWC24SetMsgSubjectPublic(NWC24MsgObj* msg, const u16* subject, u32 subjectLen, NWC24EncodingRegion encRegion, u16 unk, u8* work, + u32 workSize); +NWC24Err NWC24SetMsgSubjectAndTextPublic(NWC24MsgObj* msg, const u16* subject, u32 subjectLen, const u16* text, u32 textLen, + NWC24EncodingRegion encRegion, u16 unk, u8* work, u32 workSize); -NWC24Err NWC24CommitMsg(NWC24MsgObj* msg); +NWC24Err NWC24CommitMsg(NWC24MsgObj* msg); /* NWC24 Message Box */ -NWC24Err NWC24GetNumMsgs(NWC24MBoxType msgBoxType, u32* numMsgs); +NWC24Err NWC24GetNumMsgs(NWC24MBoxType msgBoxType, u32* numMsgs); -NWC24Err NWC24GetMsgObj(NWC24MsgObj* msg, NWC24MBoxType msgBoxType, u32 index); -NWC24Err NWC24GetMsgIdList(NWC24MBoxType msgBoxType, u32* msgIds, u32 maxLength); +NWC24Err NWC24GetMsgObj(NWC24MsgObj* msg, NWC24MBoxType msgBoxType, u32 index); +NWC24Err NWC24GetMsgIdList(NWC24MBoxType msgBoxType, u32* msgIds, u32 maxLength); -NWC24Err NWC24DeleteMsg(NWC24MBoxType msgBoxType, u32 index); +NWC24Err NWC24DeleteMsg(NWC24MBoxType msgBoxType, u32 index); /* NWC24 Channel Jump */ -#define NWC24_MAX_CHJP_BLOCKS 8 -#define NWC24_MAX_CHJP_BLOCK_SIZE 64 -#define NWC24_MAX_CHJP_SIZE (NWC24_MAX_CHJP_BLOCKS * (NWC24_MAX_CHJP_BLOCK_SIZE)) +#define NWC24_MAX_CHJP_BLOCKS 8 +#define NWC24_MAX_CHJP_BLOCK_SIZE 64 +#define NWC24_MAX_CHJP_SIZE (NWC24_MAX_CHJP_BLOCKS * (NWC24_MAX_CHJP_BLOCK_SIZE)) -#define NWC24_CHJP_HEADER_SIZE 0x18 -#define NWC24_CHJP_HEADER_MAGIC 'ChJp' +#define NWC24_CHJP_HEADER_SIZE 0x18 +#define NWC24_CHJP_HEADER_MAGIC 'ChJp' typedef struct NWC24CHJumpObj { - u32 magic; // 0x00 - u32 totalSize; // 0x04 - u32 numBlocks; // 0x08 - u32 flag; // 0x10 - u64 titleId; // 0x14 - char data[NWC24_MAX_CHJP_SIZE]; // 0x18 + u32 magic; // 0x00 + u32 totalSize; // 0x04 + u32 numBlocks; // 0x08 + u32 flag; // 0x10 + u64 titleId; // 0x14 + char data[NWC24_MAX_CHJP_SIZE]; // 0x18 } NWC24CHJumpObj; -NWC24Err NWC24CheckCHJumpObj(const NWC24CHJumpObj* chjp, u32 dataSize); -NWC24Err NWC24GetCHJumpTitleId(const NWC24CHJumpObj* chjp, u64* titleId); -NWC24Err NWC24GetCHJumpBlockSize(const NWC24CHJumpObj* chjp, u32* size, u32 index); -NWC24Err NWC24GetCHJumpBlockData(const NWC24CHJumpObj* chjp, char* data, u32 size, u32 index); +NWC24Err NWC24CheckCHJumpObj(const NWC24CHJumpObj* chjp, u32 dataSize); +NWC24Err NWC24GetCHJumpTitleId(const NWC24CHJumpObj* chjp, u64* titleId); +NWC24Err NWC24GetCHJumpBlockSize(const NWC24CHJumpObj* chjp, u32* size, u32 index); +NWC24Err NWC24GetCHJumpBlockData(const NWC24CHJumpObj* chjp, char* data, u32 size, u32 index); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/revolution/nwc24/NWC24Schedule.h b/libs/RevoEX/include/revolution/nwc24/NWC24Schedule.h index f99c5311..6d1cd485 100644 --- a/libs/RevoEX/include/revolution/nwc24/NWC24Schedule.h +++ b/libs/RevoEX/include/revolution/nwc24/NWC24Schedule.h @@ -9,14 +9,14 @@ extern "C" { #endif -s32 NWC24SuspendScheduler(); -s32 NWC24ResumeScheduler(); +s32 NWC24SuspendScheduler(); +s32 NWC24ResumeScheduler(); -NWC24Err NWC24AdjustUniversalTime(); +NWC24Err NWC24AdjustUniversalTime(); -NWC24Err NWC24ExecDownloadTask(u32 flags, u16 taskId, u32 subTaskMask); +NWC24Err NWC24ExecDownloadTask(u32 flags, u16 taskId, u32 subTaskMask); -NWC24Err NWC24GetSchedulerError(s32* numErrors, s32* errorCode); +NWC24Err NWC24GetSchedulerError(s32* numErrors, s32* errorCode); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/revolution/nwc24/NWC24System.h b/libs/RevoEX/include/revolution/nwc24/NWC24System.h index 1c74da80..f451f84a 100644 --- a/libs/RevoEX/include/revolution/nwc24/NWC24System.h +++ b/libs/RevoEX/include/revolution/nwc24/NWC24System.h @@ -9,9 +9,9 @@ extern "C" { #endif -NWC24Err NWC24EnableLedNotification(BOOL enableLed); +NWC24Err NWC24EnableLedNotification(BOOL enableLed); -NWC24Err NWC24DoDailyTasks(void* work); +NWC24Err NWC24DoDailyTasks(void* work); #ifdef __cplusplus } diff --git a/libs/RevoEX/include/revolution/nwc24/NWC24Types.h b/libs/RevoEX/include/revolution/nwc24/NWC24Types.h index f2742a2e..910f04dd 100644 --- a/libs/RevoEX/include/revolution/nwc24/NWC24Types.h +++ b/libs/RevoEX/include/revolution/nwc24/NWC24Types.h @@ -4,52 +4,46 @@ #include typedef enum NWC24MIMEType { - NWC24_TEXT_PLAIN = 0x00010000, - NWC24_TEXT_HTML = 0x00010001, + NWC24_TEXT_PLAIN = 0x00010000, + NWC24_TEXT_HTML = 0x00010001, - NWC24_IMAGE_JPEG = 0x00020000, - NWC24_X_WII_PICTURE = 0x00020001, + NWC24_IMAGE_JPEG = 0x00020000, + NWC24_X_WII_PICTURE = 0x00020001, - NWC24_APPLICATION_OCTET_STREAM = 0x00030000, - NWC24_X_WII_MSGBOARD = 0x00030001, - NWC24_X_WII_MINIDATA = 0x00030002, + NWC24_APPLICATION_OCTET_STREAM = 0x00030000, + NWC24_X_WII_MSGBOARD = 0x00030001, + NWC24_X_WII_MINIDATA = 0x00030002, - NWC24_MULTIPART_MIXED = 0x000F0000, - NWC24_MULTIPART_ALTERNATIVE = 0x000F0001, - NWC24_MULTIPART_RELATED = 0x000F0002 + NWC24_MULTIPART_MIXED = 0x000F0000, + NWC24_MULTIPART_ALTERNATIVE = 0x000F0001, + NWC24_MULTIPART_RELATED = 0x000F0002 } NWC24MIMEType; typedef enum NWC24Charset { - NWC24_EUC_JP = 0x00020002, - NWC24_EUC_US = 0x00030002, - NWC24_ISO_2022_JP = 0x00020000, - NWC24_ISO_8859_1 = 0x00080001, - NWC24_ISO_8859_10 = 0x0008000A, - NWC24_ISO_8859_15 = 0x0008000F, - NWC24_ISO_8859_2 = 0x00080002, - NWC24_ISO_8859_3 = 0x00080003, - NWC24_ISO_8859_5 = 0x00080005, - NWC24_ISO_8859_7 = 0x00080007, - NWC24_ISO_8859_9 = 0x00080009, - NWC24_SHIFT_JIS = 0x00020001, - NWC24_US_ASCII = 0x00000000, - NWC24_UTF_16BE = 0x00010010, - NWC24_UTF_32BE = 0x00010020, - NWC24_UTF_8 = 0x00010008, - NWC24_WINDOWS_1252 = 0x000F1252, - NWC24_GB_2312 = 0x000B2312, - NWC24_CHARSET_UNKNOWN = 0xFFFFFFFF + NWC24_EUC_JP = 0x00020002, + NWC24_EUC_US = 0x00030002, + NWC24_ISO_2022_JP = 0x00020000, + NWC24_ISO_8859_1 = 0x00080001, + NWC24_ISO_8859_10 = 0x0008000A, + NWC24_ISO_8859_15 = 0x0008000F, + NWC24_ISO_8859_2 = 0x00080002, + NWC24_ISO_8859_3 = 0x00080003, + NWC24_ISO_8859_5 = 0x00080005, + NWC24_ISO_8859_7 = 0x00080007, + NWC24_ISO_8859_9 = 0x00080009, + NWC24_SHIFT_JIS = 0x00020001, + NWC24_US_ASCII = 0x00000000, + NWC24_UTF_16BE = 0x00010010, + NWC24_UTF_32BE = 0x00010020, + NWC24_UTF_8 = 0x00010008, + NWC24_WINDOWS_1252 = 0x000F1252, + NWC24_GB_2312 = 0x000B2312, + NWC24_CHARSET_UNKNOWN = 0xFFFFFFFF } NWC24Charset; -typedef enum NWC24Encoding { - NWC24_ENC_7BIT = 0, - NWC24_ENC_8BIT, - NWC24_ENC_BASE64, - NWC24_ENC_QUOTED_PRINTABLE, - NWC24_MAX_ENCODINGS -} NWC24Encoding; +typedef enum NWC24Encoding { NWC24_ENC_7BIT = 0, NWC24_ENC_8BIT, NWC24_ENC_BASE64, NWC24_ENC_QUOTED_PRINTABLE, NWC24_MAX_ENCODINGS } NWC24Encoding; -typedef u64 NWC24UserId; -typedef char NWC24UserMailAddr[256]; +typedef u64 NWC24UserId; +typedef char NWC24UserMailAddr[256]; #endif // NWC24_TYPES_H diff --git a/libs/RevoEX/include/revolution/so/SOBasic.h b/libs/RevoEX/include/revolution/so/SOBasic.h index 8d9d8584..b79a96bd 100644 --- a/libs/RevoEX/include/revolution/so/SOBasic.h +++ b/libs/RevoEX/include/revolution/so/SOBasic.h @@ -5,130 +5,130 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus -#define SO_SOL_SOCKET 0xFFFF -#define SO_SOL_IP 0 -#define SO_SOL_ICMP 1 -#define SO_SOL_TCP 6 -#define SO_SOL_UDP 17 +#define SO_SOL_SOCKET 0xFFFF +#define SO_SOL_IP 0 +#define SO_SOL_ICMP 1 +#define SO_SOL_TCP 6 +#define SO_SOL_UDP 17 -#define SO_SOL_CONFIG 0xFFFE +#define SO_SOL_CONFIG 0xFFFE -#define SO_IPPROTO_ICMP 1 -#define SO_IPPROTO_IGMP 2 -#define SO_IPPROTO_TCP 6 -#define SO_IPPROTO_UDP 17 +#define SO_IPPROTO_ICMP 1 +#define SO_IPPROTO_IGMP 2 +#define SO_IPPROTO_TCP 6 +#define SO_IPPROTO_UDP 17 -#define SO_CONFIG_FILTER_INPUT 0x1001 -#define SO_CONFIG_FILTER_OUTPUT 0x1002 -#define SO_CONFIG_ERROR 0x1003 -#define SO_CONFIG_MAC_ADDRESS 0x1004 -#define SO_CONFIG_LINK_STATE 0x1005 -#define SO_CONFIG_INTERFACE_STATISTICS 0x1006 -#define SO_CONFIG_MUTE 0x1007 +#define SO_CONFIG_FILTER_INPUT 0x1001 +#define SO_CONFIG_FILTER_OUTPUT 0x1002 +#define SO_CONFIG_ERROR 0x1003 +#define SO_CONFIG_MAC_ADDRESS 0x1004 +#define SO_CONFIG_LINK_STATE 0x1005 +#define SO_CONFIG_INTERFACE_STATISTICS 0x1006 +#define SO_CONFIG_MUTE 0x1007 -#define SO_POLLRDNORM 0x0001 -#define SO_POLLRDBAND 0x0002 -#define SO_POLLPRI 0x0004 -#define SO_POLLWRNORM 0x0008 -#define SO_POLLWRBAND 0x0010 -#define SO_POLLERR 0x0020 -#define SO_POLLHUP 0x0040 -#define SO_POLLNVAL 0x0080 -#define SO_POLLIN (SO_POLLRDNORM | SO_POLLRDBAND) -#define SO_POLLOUT (SO_POLLWRNORM) +#define SO_POLLRDNORM 0x0001 +#define SO_POLLRDBAND 0x0002 +#define SO_POLLPRI 0x0004 +#define SO_POLLWRNORM 0x0008 +#define SO_POLLWRBAND 0x0010 +#define SO_POLLERR 0x0020 +#define SO_POLLHUP 0x0040 +#define SO_POLLNVAL 0x0080 +#define SO_POLLIN (SO_POLLRDNORM | SO_POLLRDBAND) +#define SO_POLLOUT (SO_POLLWRNORM) -#define SO_SO_RCVBUF 0x00001002 -#define SO_SO_SNDBUF 0x00001001 +#define SO_SO_RCVBUF 0x00001002 +#define SO_SO_SNDBUF 0x00001001 -#define SO_CONFIG_IP_ADDR_NUMBER 0x4002 -#define SO_CONFIG_IP_ADDR_TABLE 0x4003 +#define SO_CONFIG_IP_ADDR_NUMBER 0x4002 +#define SO_CONFIG_IP_ADDR_TABLE 0x4003 -#define SO_INFTIM -1 +#define SO_INFTIM -1 -#define SO_PF_INET 2 +#define SO_PF_INET 2 -#define SO_SOCK_STREAM 1 -#define SO_SOCK_DGRAM 2 +#define SO_SOCK_STREAM 1 +#define SO_SOCK_DGRAM 2 -#define SO_F_GETFL 3 -#define SO_F_SETFL 4 +#define SO_F_GETFL 3 +#define SO_F_SETFL 4 -#define SO_O_NONBLOCK 4 +#define SO_O_NONBLOCK 4 -#define ETH_ALEN 4 +#define ETH_ALEN 4 typedef struct SOPollFD { - int fd; // 0x00 - int events; // 0x04 - int revents; // 0x08 + int fd; // 0x00 + int events; // 0x04 + int revents; // 0x08 } SOPollFD; typedef struct SOHostEnt { - char* name; // 0x00 - char** aliases; // 0x04 - s16 addrType; // 0x08 - s16 length; // 0x0A - u8** addrList; // 0x0C + char* name; // 0x00 + char** aliases; // 0x04 + s16 addrType; // 0x08 + s16 length; // 0x0A + u8** addrList; // 0x0C } SOHostEnt; typedef struct SOInAddr { - u32 addr; // 0x00 + u32 addr; // 0x00 } SOInAddr; typedef struct SOSockAddrIn { - u8 len; // 0x00 - u8 family; // 0x01 - u16 port; // 0x02 - SOInAddr addr; // 0x04 + u8 len; // 0x00 + u8 family; // 0x01 + u16 port; // 0x02 + SOInAddr addr; // 0x04 } SOSockAddrIn; typedef struct SOSockAddr { - u8 len; // 0x00 - u8 family; // 0x01 - u8 data[6]; // 0x02 + u8 len; // 0x00 + u8 family; // 0x01 + u8 data[6]; // 0x02 } SOSockAddr; typedef struct SOAddrInfo SOAddrInfo; struct SOAddrInfo { - int flags; // 0x00 - int family; // 0x04 - int sockType; // 0x08 - int protocol; // 0x0C - u32 addrLen; // 0x10 - char* canonName; // 0x14 - void* addr; // 0x18 - SOAddrInfo* next; // 0x20 + int flags; // 0x00 + int family; // 0x04 + int sockType; // 0x08 + int protocol; // 0x0C + u32 addrLen; // 0x10 + char* canonName; // 0x14 + void* addr; // 0x18 + SOAddrInfo* next; // 0x20 }; -int SOSocket(int pf, int type, int protocol); -int SOClose(int s); +int SOSocket(int pf, int type, int protocol); +int SOClose(int s); -int SOConnect(int s, void* sockAddr); +int SOConnect(int s, void* sockAddr); -int SORecv(int s, void* buf, int len, int flags); -int SOSend(int s, void* buf, int len, int flags); -int SOFcntl(int s, int cmd, ...); +int SORecv(int s, void* buf, int len, int flags); +int SOSend(int s, void* buf, int len, int flags); +int SOFcntl(int s, int cmd, ...); -int SOShutdown(int s, int how); +int SOShutdown(int s, int how); -int SOInetAtoN(const char* cp, SOInAddr* inp); -char* SOInetNtoA(SOInAddr in); -int SOInetPtoN(int af, const char* src, void* dst); +int SOInetAtoN(const char* cp, SOInAddr* inp); +char* SOInetNtoA(SOInAddr in); +int SOInetPtoN(int af, const char* src, void* dst); -u32 SONtoHl(u32 netlong); -u16 SONtoHs(u16 netshort); -u32 SOHtoNl(u32 hostlong); -u16 SOHtoNs(u16 hostshort); +u32 SONtoHl(u32 netlong); +u16 SONtoHs(u16 netshort); +u32 SOHtoNl(u32 hostlong); +u16 SOHtoNs(u16 hostshort); -s32 SOGetHostID(); -SOHostEnt* SOGetHostByName(const char* name); -int SOGetAddrInfo(const char* nodeName, const char* servName, const SOAddrInfo* hints, SOAddrInfo** res); -void SOFreeAddrInfo(SOAddrInfo* head); +s32 SOGetHostID(); +SOHostEnt* SOGetHostByName(const char* name); +int SOGetAddrInfo(const char* nodeName, const char* servName, const SOAddrInfo* hints, SOAddrInfo** res); +void SOFreeAddrInfo(SOAddrInfo* head); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus #endif // REVOLUTION_SO_BASIC_H diff --git a/libs/RevoEX/include/revolution/so/SOOption.h b/libs/RevoEX/include/revolution/so/SOOption.h index a2697f4b..76e1fa64 100644 --- a/libs/RevoEX/include/revolution/so/SOOption.h +++ b/libs/RevoEX/include/revolution/so/SOOption.h @@ -5,18 +5,18 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus typedef struct IPAddrEntry { - u8 addr[4]; // 0x00 - u8 netMask[4]; // 0x04 - u8 bcastAddr[4]; // 0x08 + u8 addr[4]; // 0x00 + u8 netMask[4]; // 0x04 + u8 bcastAddr[4]; // 0x08 } IPAddrEntry; int SOGetInterfaceOpt(void* unk, int level, int optname, void* optval, int* optlen); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus #endif // REVOLUTION_SO_OPTION_H diff --git a/libs/RevoEX/include/revolution/soex.h b/libs/RevoEX/include/revolution/soex.h index f99b29e0..e8cb9663 100644 --- a/libs/RevoEX/include/revolution/soex.h +++ b/libs/RevoEX/include/revolution/soex.h @@ -8,14 +8,14 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus typedef void* (*SOAlloc)(u32, s32); -typedef void (*SOFree)(u32, void*, s32); +typedef void (*SOFree)(u32, void*, s32); typedef struct SOLibraryConfig { SOAlloc alloc; // 0x00 - SOFree free; // 0x04 + SOFree free; // 0x04 } SOLibraryConfig; int SOInit(SOLibraryConfig* config); @@ -31,6 +31,6 @@ int SOGetLastError(); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus #endif // REVOLUTION_SO_EX_H diff --git a/libs/RevoEX/include/revolution/ssl.h b/libs/RevoEX/include/revolution/ssl.h index 1683cc30..d8cb2215 100644 --- a/libs/RevoEX/include/revolution/ssl.h +++ b/libs/RevoEX/include/revolution/ssl.h @@ -5,46 +5,46 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus typedef int SSLResult; typedef int SSLId; -#define SSL_INVALID_RESULT -1 +#define SSL_INVALID_RESULT -1 -#define SSL_ID_INVALID SSL_INVALID_RESULT +#define SSL_ID_INVALID SSL_INVALID_RESULT -#define SSL_ID_MAX 8 -#define SSL_ROOT_CA_ID_MAX 8 -#define SSL_CLIENT_CERT_ID_MAX 8 +#define SSL_ID_MAX 8 +#define SSL_ROOT_CA_ID_MAX 8 +#define SSL_CLIENT_CERT_ID_MAX 8 -#define SSL_ROOT_CA_LENGTH 4096 -#define SSL_PRIVATE_KEY_LENGTH 4096 -#define SSL_CLIENT_CERT_LENGTH 4096 +#define SSL_ROOT_CA_LENGTH 4096 +#define SSL_PRIVATE_KEY_LENGTH 4096 +#define SSL_CLIENT_CERT_LENGTH 4096 -#define SSL_BUFFER_MAX_LENGTH 32768 +#define SSL_BUFFER_MAX_LENGTH 32768 -#define SSL_SERVER_NAME_LENGTH 256 +#define SSL_SERVER_NAME_LENGTH 256 -SSLId SSLNew(u32 verifyOption, const char* serverName); +SSLId SSLNew(u32 verifyOption, const char* serverName); -SSLResult SSLConnect(SSLId sslId, int socket); -SSLResult SSLDoHandshake(SSLId sslId); +SSLResult SSLConnect(SSLId sslId, int socket); +SSLResult SSLDoHandshake(SSLId sslId); -SSLResult SSLRead(SSLId sslId, char* buf, u32 bufSize); -SSLResult SSLWrite(SSLId sslId, const char* buf, u32 bufSize); +SSLResult SSLRead(SSLId sslId, char* buf, u32 bufSize); +SSLResult SSLWrite(SSLId sslId, const char* buf, u32 bufSize); -SSLResult SSLShutdown(SSLId sslId); +SSLResult SSLShutdown(SSLId sslId); -SSLResult SSLSetClientCert(SSLId sslId, const char* clientCertData, u32 clientCertSize, const char* privateKeyData, u32 privateKeySize); -SSLResult SSLSetRootCA(SSLId sslId, const char* rootCAData, u32 rootCASize); +SSLResult SSLSetClientCert(SSLId sslId, const char* clientCertData, u32 clientCertSize, const char* privateKeyData, u32 privateKeySize); +SSLResult SSLSetRootCA(SSLId sslId, const char* rootCAData, u32 rootCASize); -SSLResult SSLSetBuiltinRootCA(SSLId sslId, u32 rootCAId); -SSLResult SSLSetBuiltinClientCert(SSLId sslId, u32 clientCertId); +SSLResult SSLSetBuiltinRootCA(SSLId sslId, u32 rootCAId); +SSLResult SSLSetBuiltinClientCert(SSLId sslId, u32 clientCertId); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // REVOLUTION_SSL_H +#endif // REVOLUTION_SSL_H diff --git a/libs/RevoEX/include/revolution/vf.h b/libs/RevoEX/include/revolution/vf.h index b12c0d57..9046a714 100644 --- a/libs/RevoEX/include/revolution/vf.h +++ b/libs/RevoEX/include/revolution/vf.h @@ -5,12 +5,12 @@ #ifdef __cplusplus extern "C" { -#endif // __cplusplus +#endif // __cplusplus -#define VF_WORK_SIZE 0x14000 +#define VF_WORK_SIZE 0x14000 -void VFInitEx(void* heap_start_address, u32 size); -s32 VFIsAvailable(); +void VFInitEx(void* heap_start_address, u32 size); +s32 VFIsAvailable(); VFError VFCreateSystemFileNANDFlashEx(const char* sys_file_name, u32 file_size); @@ -36,8 +36,8 @@ VFError VFCreateDir(const char* dir_name); VFError VFChangeDir(const char* dir_name); VFError VFDeleteDir(const char* dir_name); -s32 VFGetFileSizeByFd(VFFILE* file); -s32 VFGetOffsetByFd(VFFILE* file); +s32 VFGetFileSizeByFd(VFFILE* file); +s32 VFGetOffsetByFd(VFFILE* file); VFError VFGetDriveFreeSize(const char* drive); @@ -54,10 +54,10 @@ VFError VFSync(const char* drive, s32 mode); VFError VFGetLastError(); VFError VFGetLastDeviceError(const char* drive); -char* VFGetApiErrorString(VFError error); +char* VFGetApiErrorString(VFError error); #ifdef __cplusplus } -#endif // __cplusplus +#endif // __cplusplus -#endif // REVOLUTION_VF_H +#endif // REVOLUTION_VF_H diff --git a/libs/RevoEX/include/revolution/vf/types.h b/libs/RevoEX/include/revolution/vf/types.h index b892e92f..edb1e86f 100644 --- a/libs/RevoEX/include/revolution/vf/types.h +++ b/libs/RevoEX/include/revolution/vf/types.h @@ -7,38 +7,38 @@ extern "C" { #endif -typedef s32 VFError; +typedef s32 VFError; /* From ErrInfoTbl */ enum { - VF_ERR_SUCCESS = 0, // Success - VF_ERR_EPERM = 1, // "Operation is not possible" - VF_ERR_ENOENT = 2, // "No such file or directory" - VF_ERR_EIO = 5, // "I/O Error(Driver Error)" - VF_ERR_ENOEXEC = 8, // "Not Executable by internal" - VF_ERR_EBADF = 9, // "Bad file descripto" - VF_ERR_ENOMEM = 12, // "Not enough system memory" - VF_ERR_EACCES = 13, // "Permission denied" - VF_ERR_EBUSY = 16, // "Can not use system resouces" - VF_ERR_EEXIST = 17, // "File already exists" - VF_ERR_EISDIR = 21, // "find directory when file req" - VF_ERR_EINVAL = 22, // "Invalid argument" - VF_ERR_ENFILE = 23, // "Too many open files(system)" - VF_ERR_EMFILE = 24, // "Too many open files(user)" - VF_ERR_EFBIG = 27, // "Over file size limit(4GB-1)" - VF_ERR_ENOSPC = 28, // "Device out of space" - VF_ERR_ENOLCK = 46, // "Can not lock the file" - VF_ERR_ENOSYS = 88, // "Not implement function" - VF_ERR_ENOTEMPTY = 90, // "Directory is not empty" + VF_ERR_SUCCESS = 0, // Success + VF_ERR_EPERM = 1, // "Operation is not possible" + VF_ERR_ENOENT = 2, // "No such file or directory" + VF_ERR_EIO = 5, // "I/O Error(Driver Error)" + VF_ERR_ENOEXEC = 8, // "Not Executable by internal" + VF_ERR_EBADF = 9, // "Bad file descripto" + VF_ERR_ENOMEM = 12, // "Not enough system memory" + VF_ERR_EACCES = 13, // "Permission denied" + VF_ERR_EBUSY = 16, // "Can not use system resouces" + VF_ERR_EEXIST = 17, // "File already exists" + VF_ERR_EISDIR = 21, // "find directory when file req" + VF_ERR_EINVAL = 22, // "Invalid argument" + VF_ERR_ENFILE = 23, // "Too many open files(system)" + VF_ERR_EMFILE = 24, // "Too many open files(user)" + VF_ERR_EFBIG = 27, // "Over file size limit(4GB-1)" + VF_ERR_ENOSPC = 28, // "Device out of space" + VF_ERR_ENOLCK = 46, // "Can not lock the file" + VF_ERR_ENOSYS = 88, // "Not implement function" + VF_ERR_ENOTEMPTY = 90, // "Directory is not empty" - VF_ERR_NOT_EXIST_FILE = 0xB001, - VF_ERR_CANNOT_ALLOC_DRV = 0xB002, - VF_ERR_NOT_ALLOCATED_DRV = 0xB003, - VF_ERR_ALREADY_ATTACHED_DRV_NAME = 0xB004, - VF_ERR_ALREADY_MOUNTED_DRV_NAME = 0xB005, - VF_ERR_VFF_FILE_FORMAT = 0xB006, + VF_ERR_NOT_EXIST_FILE = 0xB001, + VF_ERR_CANNOT_ALLOC_DRV = 0xB002, + VF_ERR_NOT_ALLOCATED_DRV = 0xB003, + VF_ERR_ALREADY_ATTACHED_DRV_NAME = 0xB004, + VF_ERR_ALREADY_MOUNTED_DRV_NAME = 0xB005, + VF_ERR_VFF_FILE_FORMAT = 0xB006, - VF_ERR_SYSTEM = -1 // "system error(general error)" + VF_ERR_SYSTEM = -1 // "system error(general error)" }; enum { @@ -62,60 +62,56 @@ enum { VF_STATUS_PROTECTED = (1 << 2), }; -typedef void VFFILE; -typedef void VFDIR; -typedef void VFVOLUME; +typedef void VFFILE; +typedef void VFDIR; +typedef void VFVOLUME; typedef void (*VFEventCallback)(u32); -enum { - VF_EVENT_NONE = 0, - VF_EVENT_INSERTED, - VF_EVENT_EJECTED -}; +enum { VF_EVENT_NONE = 0, VF_EVENT_INSERTED, VF_EVENT_EJECTED }; typedef struct VFDta { - VFFILE* file; // 0x00 - VFDIR* dir; // 0x04 - VFVOLUME* vol; // 0x08 + VFFILE* file; // 0x00 + VFDIR* dir; // 0x04 + VFVOLUME* vol; // 0x08 - u32 parentStartCluster; // 0x0C - u32 parentPos; // 0x10 + u32 parentStartCluster; // 0x0C + u32 parentPos; // 0x10 - u32 status; // 0x14 - u8 numEntryLFNs; // 0x18 - u8 ordinal; // 0x19 - u8 check_sum; // 0x1A - u8 attr; // 0x1B - char regExp[520]; // 0x1C + u32 status; // 0x14 + u8 numEntryLFNs; // 0x18 + u8 ordinal; // 0x19 + u8 check_sum; // 0x1A + u8 attr; // 0x1B + char regExp[520]; // 0x1C - u16 time; // 0x224 - u16 date; // 0x226 - u32 fileSize; // 0x228 - u8 attribute; // 0x22C - char fileName[13]; // 0x22D - char longName[520]; // 0x23A - s8 pad[2]; // 0x442 + u16 time; // 0x224 + u16 date; // 0x226 + u32 fileSize; // 0x228 + u8 attribute; // 0x22C + char fileName[13]; // 0x22D + char longName[520]; // 0x23A + s8 pad[2]; // 0x442 } VFDta; typedef struct VFFileStat { - u32 size; // 0x00 + u32 size; // 0x00 - u32 accessDate; // 0x04 + u32 accessDate; // 0x04 - u32 updateTime; // 0x06 - u32 updateDate; // 0x08 + u32 updateTime; // 0x06 + u32 updateDate; // 0x08 - u32 createTime; // 0x0A - u32 createDate; // 0x0C + u32 createTime; // 0x0A + u32 createDate; // 0x0C - u32 compSec; // 0x0E + u32 compSec; // 0x0E - u8 stat; // 0x10 + u8 stat; // 0x10 } VFFileStat; #ifdef __cplusplus } #endif -#endif // REVOLUTION_VF_TYPES_H +#endif // REVOLUTION_VF_TYPES_H diff --git a/libs/RevoEX/src/cdb/CDBAttr.c b/libs/RevoEX/src/cdb/CDBAttr.c index e5569928..2b396755 100644 --- a/libs/RevoEX/src/cdb/CDBAttr.c +++ b/libs/RevoEX/src/cdb/CDBAttr.c @@ -1,16 +1,16 @@ -#include #include +#include +#include #include #include -#include -extern CDBErr GenCDBIdNumber(u32* cdbIDNum); +extern CDBErr GenCDBIdNumber(u32* cdbIDNum); -static char CDB_ATTR_MAGIC[] = "CDBFILE"; +static char CDB_ATTR_MAGIC[] = "CDBFILE"; static const u8 CDB_ATTR_VERSION = 2; -static u32 s_seed = 0; +static u32 s_seed = 0; u32 CDBAttrGetDescOffset(CDBAttr* attr) { return attr->buf.version == 1 ? 0x0D : offsetof(CDBAttrBuf, descLength); @@ -62,28 +62,27 @@ void CDBAttrInit(CDBAttr* attr) { } CDBErr CDBAttrCreateOnNAND(CDBAttr* attr, const char* desc, u32 lastModifiedDate) { - CDBErr err; - u32 descStrLen; - u32 cdbNum; + CDBErr err; + u32 descStrLen; + u32 cdbNum; - u8 attrDescLength; - u32 attrLastModifiedDate; - u32 attrModifiedCount; - u32 attrCdbIDNum; + u8 attrDescLength; + u32 attrLastModifiedDate; + u32 attrModifiedCount; + u32 attrCdbIDNum; - u64 attrWiiID; + u64 attrWiiID; CDBAttrInit(attr); - memcpy(&attr->buf.magic, CDB_ATTR_MAGIC, sizeof(CDB_ATTR_MAGIC)-1); + memcpy(&attr->buf.magic, CDB_ATTR_MAGIC, sizeof(CDB_ATTR_MAGIC) - 1); memcpy(&attr->buf.version, &CDB_ATTR_VERSION, sizeof(CDB_ATTR_VERSION)); - descStrLen = strlen(desc)+1; + descStrLen = strlen(desc) + 1; if (descStrLen >= CDB_ATTR_BUF_MAX_DESC_LEN) { err = CDB_ERROR_16; - } - else { + } else { attrDescLength = descStrLen; memcpy((u8*)&attr->buf + CDBAttrGetDescOffset(attr), &attrDescLength, sizeof(u8)); @@ -162,8 +161,7 @@ void CDBAttrSetKeyStr(CDBAttr* attr, CDBRecordKey* recordKey) { if (CDBRecordKeyIsValid(recordKey)) { memset(attr->buf.keyString, 0, CDB_ATTR_BUF_KEY_STRING_LEN); CDBRecordKeyGetKeyStr(recordKey, attr->buf.keyString); - } - else { + } else { CDBReportError("CDBAttrSetKeyStr : invalid CDBRecordKey\n"); } } @@ -200,7 +198,7 @@ void CDBAttrGetIV(CDBAttr* attr, u8* iv) { int i, j; for (i = 0; i < 2; i++) { for (j = 0; j < 8; j++) { - iv[(i*8)+j] = attr->buf.iv[(i * 8) + j]; + iv[(i * 8) + j] = attr->buf.iv[(i * 8) + j]; } } } diff --git a/libs/RevoEX/src/cdb/CDBConv.c b/libs/RevoEX/src/cdb/CDBConv.c index 8f0896fa..efc59289 100644 --- a/libs/RevoEX/src/cdb/CDBConv.c +++ b/libs/RevoEX/src/cdb/CDBConv.c @@ -1,26 +1,26 @@ -#include #include +#include #include -#include +#include #include #include -#include +#include BOOL CDBIsMakerCodeStr(const char* makerCode) { - return CDBSafeStrLen(makerCode, 2+1) == 2; + return CDBSafeStrLen(makerCode, 2 + 1) == 2; } BOOL CDBIsGameCodeStr(const char* gameCode) { - return CDBSafeStrLen(gameCode, 4+1) == 4; + return CDBSafeStrLen(gameCode, 4 + 1) == 4; } int CDBCompareTypeStr(char* str1, char* str2) { - if (CDBSafeStrLen(str1, 5+1) < 0) { + if (CDBSafeStrLen(str1, 5 + 1) < 0) { return -1; } - if (CDBSafeStrLen(str2, 5+1) < 0) { + if (CDBSafeStrLen(str2, 5 + 1) < 0) { return 1; } return strcmpi(str1, str2); @@ -37,7 +37,7 @@ void CDBClampCDBDate(CDBDate* cdbDate) { if (cdbDate != NULL) { CDBConvertCDBDateToCalendarTime(*cdbDate, &year, &month, &day, &hour, &min, &sec); if (year > MAX_YEAR) { - *cdbDate = CDBMakeCDBDate(MAX_YEAR, MAX_MONTH-1, MAX_DAY, hour, min, sec); + *cdbDate = CDBMakeCDBDate(MAX_YEAR, MAX_MONTH - 1, MAX_DAY, hour, min, sec); } } } @@ -102,11 +102,11 @@ CDBDate CDBMakeCDBDateMonthEnd(int year, int month, int day, int hour, int min, } CDBDate CDBMakeCDBDateYearBegin(int year, int month, int day, int hour, int min, int sec) { - return CDBMakeCDBDate(year, MIN_MONTH-1, MIN_DAY, MIN_HOUR, MIN_MINUTE, MIN_SECOND); + return CDBMakeCDBDate(year, MIN_MONTH - 1, MIN_DAY, MIN_HOUR, MIN_MINUTE, MIN_SECOND); } CDBDate CDBMakeCDBDateYearEnd(int year, int month, int day, int hour, int min, int sec) { - return CDBMakeCDBDate(year, MAX_MONTH-1, MAX_DAY, MAX_HOUR, MAX_MINUTE, MAX_SECOND); + return CDBMakeCDBDate(year, MAX_MONTH - 1, MAX_DAY, MAX_HOUR, MAX_MINUTE, MAX_SECOND); } void CDBConvYearValueToYearStr(char* yearStr, int year) { @@ -132,9 +132,9 @@ void CDBConvMinuteValueToMinuteStr(char* minuteStr, int minute) { DECOMP_FORCE_ACTIVE(CDBConv_c, "%08X"); void CDBGenRootPath(char* rootPath, CDBLocation location, u64* wiiId) { - u32 wiiIdHi, wiiIdLo; - char wiiIdHiPath[16]; - char wiiIdLoPath[16]; + u32 wiiIdHi, wiiIdLo; + char wiiIdHiPath[16]; + char wiiIdLoPath[16]; if (location == CDB_FS_LOCATION_NAND) { strcpy(rootPath, CDB_CFG_VF_DRIVE_ROOT); @@ -144,8 +144,7 @@ void CDBGenRootPath(char* rootPath, CDBLocation location, u64* wiiId) { if (wiiId == NULL || *wiiId == 0) { wiiIdHi = CDBGetWiiHighId(); wiiIdLo = CDBGetWiiLowId(); - } - else { + } else { wiiIdHi = CDBGetWiiHighIdEx(*wiiId); wiiIdLo = CDBGetWiiLowIdEx(*wiiId); } @@ -185,7 +184,8 @@ void CDBConvHourStrToFullPath(char* fullPath, char* yearStr, char* monthStr, cha CDBFSConcatenatePath(fullPath, hourStr); } -void CDBConvMinuteStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, CDBLocation location, u64* wiiId) { +void CDBConvMinuteStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, CDBLocation location, + u64* wiiId) { CDBGenRootPath(fullPath, location, wiiId); CDBFSConcatenatePath(fullPath, yearStr); CDBFSConcatenatePath(fullPath, monthStr); @@ -194,7 +194,8 @@ void CDBConvMinuteStrToFullPath(char* fullPath, char* yearStr, char* monthStr, c CDBFSConcatenatePath(fullPath, minuteStr); } -void CDBConvCodeStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, char* codeStr, CDBLocation location, u64* wiiId) { +void CDBConvCodeStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, char* codeStr, + CDBLocation location, u64* wiiId) { CDBGenRootPath(fullPath, location, wiiId); CDBFSConcatenatePath(fullPath, yearStr); CDBFSConcatenatePath(fullPath, monthStr); @@ -205,7 +206,8 @@ void CDBConvCodeStrToFullPath(char* fullPath, char* yearStr, char* monthStr, cha } // I cannot take it anymore -void CDBConvTypeStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, char* codeStr, char* typeStr, CDBLocation location, u64* wiiId) { +void CDBConvTypeStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, char* codeStr, + char* typeStr, CDBLocation location, u64* wiiId) { CDBGenRootPath(fullPath, location, wiiId); CDBFSConcatenatePath(fullPath, yearStr); CDBFSConcatenatePath(fullPath, monthStr); @@ -216,7 +218,8 @@ void CDBConvTypeStrToFullPath(char* fullPath, char* yearStr, char* monthStr, cha CDBFSConcatenatePath(fullPath, typeStr); } -void CDBConvFileNameStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, char* codeStr, char* typeStr, char* fileNameStr, CDBLocation location, u64* wiiId) { +void CDBConvFileNameStrToFullPath(char* fullPath, char* yearStr, char* monthStr, char* dayStr, char* hourStr, char* minuteStr, char* codeStr, + char* typeStr, char* fileNameStr, CDBLocation location, u64* wiiId) { CDBGenRootPath(fullPath, location, wiiId); CDBFSConcatenatePath(fullPath, yearStr); CDBFSConcatenatePath(fullPath, monthStr); @@ -235,36 +238,34 @@ CDBDate CDBConvDirStrToCDBDate(char* yearStr, char* monthStr, char* dayStr, char void CDBConvGCStrToGCValue(char* gcStr, u32* gcValue) { if (gcStr == NULL) { *gcValue = -1; - } - else { + } else { memcpy(gcValue, gcStr, sizeof(u32)); } } void CDBConvGCValueToGCStr(u32 gcValue, char* gcStr) { memcpy(gcStr, &gcValue, sizeof(u32)); - gcStr[4] = 0; // Null termination - strcmp(gcStr, "JXXN"); // ? + gcStr[4] = 0; // Null termination + strcmp(gcStr, "JXXN"); // ? } void CDBConvMCValueToMCStr(u16 mcValue, char* mcStr) { memcpy(mcStr, &mcValue, sizeof(u16)); - mcStr[2] = 0; // Null termination + mcStr[2] = 0; // Null termination CDBCheckMakerCodeStr(mcStr); } void CDBConvMCStrToMCValue(char* mcStr, u16* mcValue) { if (mcStr == NULL) { *mcValue = -1; - } - else { + } else { memcpy(mcValue, mcStr, sizeof(u16)); } } void CDBConvKeyStrToEpochValue(char* keyString, CDBDate* epochVal) { char epochStr[32]; - + strncpy(epochStr, CDBKeyStrEpoch(keyString), CDB_KEYSTR_EPOCH_SIZE); epochStr[CDB_KEYSTR_EPOCH_SIZE] = 0; @@ -273,7 +274,7 @@ void CDBConvKeyStrToEpochValue(char* keyString, CDBDate* epochVal) { void CDBConvKeyStrToEpochStr(char* keyString, char* epochVal) { char epochStr[16]; - + strncpy(epochVal, CDBKeyStrEpoch(keyString), CDB_KEYSTR_EPOCH_SIZE); epochVal[CDB_KEYSTR_EPOCH_SIZE] = 0; } @@ -284,7 +285,7 @@ void CDBConvEpochStrToEpochValue(char* epochStr, CDBDate* epochVal) { void CDBConvEpochValueToDate(CDBDate epoch, int* year, int* month, int* day, int* hour, int* min, int* sec) { OSCalendarTime calendar; - + OSTicksToCalendarTime(OSSecondsToTicks((OSTime)epoch), &calendar); if (year != NULL) { @@ -323,23 +324,23 @@ CDBErr CDBConvKeyToFullPath(CDBRecordKey* recordKey, char* fullPath) { } void CDBConvKeyStrToFullPath_(char* keyString, char* fullPath, CDBLocation location, u64* wiiId) { - char yearStr[8]; - char monthStr[8]; - char dayStr[8]; - char hourStr[8]; - char minStr[8]; + char yearStr[8]; + char monthStr[8]; + char dayStr[8]; + char hourStr[8]; + char minStr[8]; + + char codeStr[8]; + char typeStr[8]; + char serialNumStr[8]; + char fileNameStr[8]; - char codeStr[8]; - char typeStr[8]; - char serialNumStr[8]; - char fileNameStr[8]; - CDBDate epoch; - int year; - int month; - int day; - int hour; - int min; + int year; + int month; + int day; + int hour; + int min; CDBConvKeyStrToEpochValue(keyString, &epoch); CDBConvEpochValueToDate(epoch, &year, &month, &day, &hour, &min, NULL); @@ -357,8 +358,7 @@ void CDBConvKeyStrToFullPath_(char* keyString, char* fullPath, CDBLocation locat if (location == CDB_FS_LOCATION_NAND || location == CDB_FS_LOCATION_SD) { CDBConvFileNameStrToFullPath(fullPath, yearStr, monthStr, dayStr, hourStr, minStr, codeStr, typeStr, fileNameStr, location, wiiId); - } - else { + } else { CDBReportFatal("CDBConvKeyStrToFullPath unknown location=%d\n", location); OSHalt("CDBConvKeyStrToFullPath", 733); } @@ -376,15 +376,15 @@ void CDBConvKeyStrToSerialNumber(char* keyString, char* serialNum) { void CDBConvKeyStrToFileName(char* keyString, char* fileName) { CDBDate epoch; - char serialNum[CDB_KEYSTR_SERIAL_NUMBER_SIZE+1]; - + char serialNum[CDB_KEYSTR_SERIAL_NUMBER_SIZE + 1]; + CDBConvKeyStrToEpochValue(keyString, &epoch); CDBConvKeyStrToSerialNumber(keyString, serialNum); sprintf(fileName, "%08X.%s", epoch, serialNum); } void CDBConvKeyStrToGameCode(char* keyString, u32* gameCode) { - char gcStr[CDB_KEYSTR_GAME_CODE_SIZE+1]; + char gcStr[CDB_KEYSTR_GAME_CODE_SIZE + 1]; memcpy(gcStr, CDBKeyStrGameCode(keyString), CDB_KEYSTR_GAME_CODE_SIZE); gcStr[CDB_KEYSTR_GAME_CODE_SIZE] = 0; @@ -392,7 +392,7 @@ void CDBConvKeyStrToGameCode(char* keyString, u32* gameCode) { } void CDBConvKeyStrToMakerCode(char* keyString, u32* makerCode) { - char mcStr[CDB_KEYSTR_MAKER_CODE_SIZE+1]; + char mcStr[CDB_KEYSTR_MAKER_CODE_SIZE + 1]; memcpy(mcStr, CDBKeyStrMakerCode(keyString), CDB_KEYSTR_MAKER_CODE_SIZE); mcStr[2] = 0; @@ -413,7 +413,7 @@ void CDBConvKeyStrToType(char* keyString, char* type) { void CDBConvertCDBDateToCalendarTime(CDBDate date, int* year, int* month, int* day, int* hour, int* min, int* sec) { OSCalendarTime calendar; - + OSTicksToCalendarTime(OSSecondsToTicks((OSTime)date), &calendar); if (year != NULL) { diff --git a/libs/RevoEX/src/cdb/CDBCrypt.c b/libs/RevoEX/src/cdb/CDBCrypt.c index 70ae6535..e51e69c2 100644 --- a/libs/RevoEX/src/cdb/CDBCrypt.c +++ b/libs/RevoEX/src/cdb/CDBCrypt.c @@ -1,5 +1,5 @@ -#include #include +#include static CDBCryptBuf* s_cryptBuf; @@ -17,8 +17,7 @@ CDBErr CDBCryptBufAllocate(CDBCryptBuf* cryptBuf) { cryptBuf->buffer32[0] = (u32)s_cryptBuf; s_cryptBuf->allocated = TRUE; return CDB_ERROR_OK; - } - else { + } else { CDBReportError("failed to allocate crypt buffer\n"); return CDB_ERROR_CRYPT_ALLOC_FAIL; } @@ -31,8 +30,7 @@ CDBErr CDBCryptBufFree(CDBCryptBuf* cryptBuf) { s_cryptBuf->allocated = FALSE; *cryptBuf->buffer32 = 0; return CDB_ERROR_OK; - } - else { + } else { CDBReportError("failed to free crypt buffer\n"); return CDB_ERROR_1; } diff --git a/libs/RevoEX/src/cdb/CDBFBridge.c b/libs/RevoEX/src/cdb/CDBFBridge.c index 95d1a9fa..a146c431 100644 --- a/libs/RevoEX/src/cdb/CDBFBridge.c +++ b/libs/RevoEX/src/cdb/CDBFBridge.c @@ -1,37 +1,31 @@ -#include #include +#include #include CDBErr CDBFCreateFile(CDBBridgeFile* file, const char* fileName, CDBLocation type) { - return type == CDB_FS_LOCATION_NAND ? CDBFCreateFileVF(file, fileName) : - CDBFCreateFileSD(file, fileName); + return type == CDB_FS_LOCATION_NAND ? CDBFCreateFileVF(file, fileName) : CDBFCreateFileSD(file, fileName); } CDBErr CDBFDeleteFile(const char* fileName, CDBLocation type) { - return type == CDB_FS_LOCATION_NAND ? CDBFDeleteFileVF(fileName) : - CDBFDeleteFileSD(fileName); + return type == CDB_FS_LOCATION_NAND ? CDBFDeleteFileVF(fileName) : CDBFDeleteFileSD(fileName); } CDBErr CDBFCreateDir(const char* dirName, CDBLocation type) { - return type == CDB_FS_LOCATION_NAND ? CDBFCreateDirVF(dirName) : - CDBFCreateDirSD(dirName); + return type == CDB_FS_LOCATION_NAND ? CDBFCreateDirVF(dirName) : CDBFCreateDirSD(dirName); } CDBErr CDBFOpen(CDBBridgeFile* file, const char* fileName, CDBLocation type) { - return type == CDB_FS_LOCATION_NAND ? CDBFOpenVF(file, fileName) : - CDBFOpenSD(file, fileName); + return type == CDB_FS_LOCATION_NAND ? CDBFOpenVF(file, fileName) : CDBFOpenSD(file, fileName); } CDBErr CDBFClose(CDBBridgeFile* file, CDBLocation type) { - return type == CDB_FS_LOCATION_NAND ? CDBFCloseVF(file) : - CDBFCloseSD(file); + return type == CDB_FS_LOCATION_NAND ? CDBFCloseVF(file) : CDBFCloseSD(file); } CDBErr CDBFReadAttr(CDBBridgeFile* file, CDBAttr* attr, CDBLocation type) { u32 modifiedCount; - CDBErr err = type == CDB_FS_LOCATION_NAND ? CDBFReadAttrVF(file, attr) : - CDBFReadAttrSD(file, attr); + CDBErr err = type == CDB_FS_LOCATION_NAND ? CDBFReadAttrVF(file, attr) : CDBFReadAttrSD(file, attr); memcpy(&modifiedCount, &attr->buf.cdbID.modifiedCount, sizeof(u32)); return err; } @@ -40,8 +34,7 @@ CDBErr CDBFWriteAttr(CDBBridgeFile* file, CDBAttr* attr, CDBLocation type) { CDBErr err; u32 modifiedCount; memcpy(&modifiedCount, &attr->buf.cdbID.modifiedCount, sizeof(u32)); - err = type == CDB_FS_LOCATION_NAND ? CDBFWriteAttrVF(file, attr) : - CDBFWriteAttrSD(file, attr); + err = type == CDB_FS_LOCATION_NAND ? CDBFWriteAttrVF(file, attr) : CDBFWriteAttrSD(file, attr); return err; } @@ -49,38 +42,30 @@ CDBErr CDBFWriteAttrOnlyLeadChunk(CDBBridgeFile* file, CDBAttr* attr, CDBLocatio CDBErr err; u32 modifiedCount; memcpy(&modifiedCount, &attr->buf.cdbID.modifiedCount, sizeof(u32)); - err = type == CDB_FS_LOCATION_NAND ? CDBFWriteAttrOnlyLeadChunkVF(file, attr) : - CDBFWriteAttrOnlyLeadChunkSD(file, attr); + err = type == CDB_FS_LOCATION_NAND ? CDBFWriteAttrOnlyLeadChunkVF(file, attr) : CDBFWriteAttrOnlyLeadChunkSD(file, attr); return err; } CDBErr CDBFReadData(CDBBridgeFile* file, void* buffer, u32 size, u32* readSize, CDBLocation type) { - return type == CDB_FS_LOCATION_NAND ? CDBFReadDataVF(file, buffer, size, readSize) : - CDBFReadDataSD(file, buffer, size, readSize); + return type == CDB_FS_LOCATION_NAND ? CDBFReadDataVF(file, buffer, size, readSize) : CDBFReadDataSD(file, buffer, size, readSize); } CDBErr CDBFWriteData(CDBBridgeFile* file, void* buffer, u32 size, CDBLocation type) { - return type == CDB_FS_LOCATION_NAND ? CDBFWriteDataVF(file, buffer, size) : - CDBFWriteDataSD(file, buffer, size); + return type == CDB_FS_LOCATION_NAND ? CDBFWriteDataVF(file, buffer, size) : CDBFWriteDataSD(file, buffer, size); } - CDBErr CDBFSeekData(CDBBridgeFile* file, u32 offset, CDBSeek seek, CDBLocation type) { - return type == CDB_FS_LOCATION_NAND ? CDBFSeekDataVF(file, offset, seek) : - CDBFSeekDataSD(file, offset, seek); + return type == CDB_FS_LOCATION_NAND ? CDBFSeekDataVF(file, offset, seek) : CDBFSeekDataSD(file, offset, seek); } s32 CDBFTellData(CDBBridgeFile* file, CDBLocation type) { - return type == CDB_FS_LOCATION_NAND ? CDBFTellDataVF(file) : - CDBFTellDataSD(file); + return type == CDB_FS_LOCATION_NAND ? CDBFTellDataVF(file) : CDBFTellDataSD(file); } CDBErr CDBFGetDataSize(CDBBridgeFile* file, u32* dataSize, CDBLocation type) { - return type == CDB_FS_LOCATION_NAND ? CDBFGetDataSizeVF(file, dataSize) : - CDBFGetDataSizeSD(file, dataSize); + return type == CDB_FS_LOCATION_NAND ? CDBFGetDataSizeVF(file, dataSize) : CDBFGetDataSizeSD(file, dataSize); } CDBErr CDBFGetFileSize(CDBBridgeFile* file, u32* fileSize, CDBLocation type) { - return type == CDB_FS_LOCATION_NAND ? CDBFGetFileSizeVF(file, fileSize) : - CDBFGetFileSizeSD(file, fileSize); + return type == CDB_FS_LOCATION_NAND ? CDBFGetFileSizeVF(file, fileSize) : CDBFGetFileSizeSD(file, fileSize); } diff --git a/libs/RevoEX/src/cdb/CDBFBridgeSD.c b/libs/RevoEX/src/cdb/CDBFBridgeSD.c index a479c7e7..02b5f3b9 100644 --- a/libs/RevoEX/src/cdb/CDBFBridgeSD.c +++ b/libs/RevoEX/src/cdb/CDBFBridgeSD.c @@ -1,5 +1,5 @@ -#include #include +#include CDBErr CDBFCreateFileSD(CDBBridgeFile* file, const char* fileName) { VFError vfErr; @@ -10,14 +10,11 @@ CDBErr CDBFCreateFileSD(CDBBridgeFile* file, const char* fileName) { if (vfErr == VF_ERR_EEXIST) { return CDB_ERROR_FILE_EXISTS; - } - else if (vfErr == VF_ERR_ENOSPC) { + } else if (vfErr == VF_ERR_ENOSPC) { return CDB_ERROR_OUT_OF_SPACE; - } - else if (vfErr == VF_ERR_EACCES) { + } else if (vfErr == VF_ERR_EACCES) { return CDB_ERROR_ACCESS_DENIED; - } - else { + } else { if (CDBFSSDIsEjected()) { return CDB_ERROR_SD_EJECTED; } @@ -76,8 +73,7 @@ CDBErr CDBFOpenSD_readonly(CDBBridgeFile* file, const char* fileName) { if (vfErr == VF_ERR_ENOENT || vfErr == VF_ERR_EINVAL) { return CDB_ERROR_CANNOT_OPEN_FILE; - } - else { + } else { if (CDBFSSDIsEjected()) { return CDB_ERROR_SD_EJECTED; } @@ -104,8 +100,7 @@ CDBErr CDBFOpenSD(CDBBridgeFile* file, const char* fileName) { } if (vfErr == VF_ERR_EACCES) { return CDBFOpenSD_readonly(file, fileName); - } - else { + } else { if (CDBFSSDIsEjected()) { return CDB_ERROR_SD_EJECTED; } @@ -183,18 +178,17 @@ CDBErr CDBFSeekSD_(VFFILE* file, u32 offset, CDBSeek seek) { s32 CDBFGetOffsetSD(VFFILE* file) { if (file != NULL) { return VFGetOffsetByFd(file); - } - else { + } else { return -1; } } CDBErr CDBFReadAttrSD(CDBBridgeFile* file, CDBAttr* attrBuf) { - CDBErr err; + CDBErr err; VFError vfErr; - - s32 fileOffset; - u32 readSize; + + s32 fileOffset; + u32 readSize; fileOffset = CDBFGetOffsetSD(file->sd); @@ -207,12 +201,10 @@ CDBErr CDBFReadAttrSD(CDBBridgeFile* file, CDBAttr* attrBuf) { if (vfErr != VF_ERR_SUCCESS) { if (CDBFSSDIsEjected()) { err = CDB_ERROR_SD_EJECTED; - } - else { + } else { err = CDBOnVFErrorOccured(vfErr); } - } - else { + } else { err = CDB_ERROR_OK; } @@ -245,10 +237,10 @@ CDBErr CDBFReadAttrSD(CDBBridgeFile* file, CDBAttr* attrBuf) { } CDBErr CDBFWriteAttrSD(CDBBridgeFile* file, CDBAttr* attrBuf) { - CDBErr err; + CDBErr err; VFError vfErr; - - s32 fileOffset; + + s32 fileOffset; fileOffset = CDBFGetOffsetSD(file->sd); @@ -264,20 +256,16 @@ CDBErr CDBFWriteAttrSD(CDBBridgeFile* file, CDBAttr* attrBuf) { if (vfErr != VF_ERR_SUCCESS) { if (vfErr == VF_ERR_ENOSPC) { err = CDB_ERROR_OUT_OF_SPACE; - } - else if (vfErr == VF_ERR_EACCES) { + } else if (vfErr == VF_ERR_EACCES) { err = CDB_ERROR_ACCESS_DENIED; - } - else { + } else { if (CDBFSSDIsEjected()) { err = CDB_ERROR_SD_EJECTED; - } - else { + } else { err = CDBOnVFErrorOccured(vfErr); } } - } - else { + } else { err = CDB_ERROR_OK; } @@ -302,10 +290,10 @@ CDBErr CDBFWriteAttrSD(CDBBridgeFile* file, CDBAttr* attrBuf) { } CDBErr CDBFWriteAttrOnlyLeadChunkSD(CDBBridgeFile* file, CDBAttr* attrBuf) { - CDBErr err; + CDBErr err; VFError vfErr; - - s32 fileOffset; + + s32 fileOffset; fileOffset = CDBFGetOffsetSD(file->sd); @@ -321,20 +309,16 @@ CDBErr CDBFWriteAttrOnlyLeadChunkSD(CDBBridgeFile* file, CDBAttr* attrBuf) { if (vfErr != VF_ERR_SUCCESS) { if (vfErr == VF_ERR_ENOSPC) { err = CDB_ERROR_OUT_OF_SPACE; - } - else if (vfErr == VF_ERR_EACCES) { + } else if (vfErr == VF_ERR_EACCES) { err = CDB_ERROR_ACCESS_DENIED; - } - else { + } else { if (CDBFSSDIsEjected()) { err = CDB_ERROR_SD_EJECTED; - } - else { + } else { err = CDBOnVFErrorOccured(vfErr); } } - } - else { + } else { err = CDB_ERROR_OK; } @@ -379,11 +363,9 @@ CDBErr CDBFWriteDataSD(CDBBridgeFile* file, void* buffer, u32 size) { if (vfErr != VF_ERR_SUCCESS) { if (vfErr == VF_ERR_ENOSPC) { return CDB_ERROR_OUT_OF_SPACE; - } - else if (vfErr == VF_ERR_EACCES) { + } else if (vfErr == VF_ERR_EACCES) { return CDB_ERROR_ACCESS_DENIED; - } - else { + } else { if (CDBFSSDIsEjected()) { return CDB_ERROR_SD_EJECTED; } @@ -412,12 +394,10 @@ CDBErr CDBFGetDataSizeSD(CDBBridgeFile* file, u32* dataSize) { if (size < 0) { if (CDBFSSDIsEjected()) { err = CDB_ERROR_SD_EJECTED; - } - else { + } else { err = CDB_ERROR_CANNOT_OPEN_FILE; } - } - else { + } else { *dataSize = size; err = CDB_ERROR_OK; } @@ -428,7 +408,7 @@ CDBErr CDBFGetDataSizeSD(CDBBridgeFile* file, u32* dataSize) { return err; } } - + *dataSize -= 0x400; return err; @@ -441,15 +421,13 @@ CDBErr CDBFGetFileSizeSD(CDBBridgeFile* file, u32* fileSize) { if (size < 0) { if (CDBFSSDIsEjected()) { err = CDB_ERROR_SD_EJECTED; - } - else { + } else { err = CDB_ERROR_CANNOT_OPEN_FILE; } - } - else { + } else { *fileSize = size; err = CDB_ERROR_OK; } - + return err; } diff --git a/libs/RevoEX/src/cdb/CDBFBridgeVF.c b/libs/RevoEX/src/cdb/CDBFBridgeVF.c index 74925ef2..afc5e3e3 100644 --- a/libs/RevoEX/src/cdb/CDBFBridgeVF.c +++ b/libs/RevoEX/src/cdb/CDBFBridgeVF.c @@ -1,5 +1,5 @@ -#include #include +#include CDBErr CDBFCreateFileVF(CDBBridgeFile* file, const char* fileName) { VFError vfErr; @@ -10,11 +10,9 @@ CDBErr CDBFCreateFileVF(CDBBridgeFile* file, const char* fileName) { if (vfErr == VF_ERR_EEXIST) { return CDB_ERROR_FILE_EXISTS; - } - else if (vfErr == VF_ERR_ENOSPC) { + } else if (vfErr == VF_ERR_ENOSPC) { return CDB_ERROR_OUT_OF_SPACE; - } - else { + } else { CDBSetFatalVFErrorFlag(); return CDBOnVFErrorOccured(vfErr); } @@ -56,8 +54,7 @@ CDBErr CDBFOpenVF(CDBBridgeFile* file, const char* fileName) { if (vfErr == VF_ERR_ENOENT || vfErr == VF_ERR_EINVAL) { return CDB_ERROR_CANNOT_OPEN_FILE; - } - else { + } else { CDBSetFatalVFErrorFlag(); vfErr = VFGetLastError(); return CDBOnVFErrorOccured(vfErr); @@ -128,11 +125,11 @@ CDBErr CDBFSeekVF_(VFFILE* file, u32 offset, CDBSeek seek) { } CDBErr CDBFReadAttrVF(CDBBridgeFile* file, CDBAttr* attr) { - CDBErr err; + CDBErr err; VFError vfErr; - - s32 fileOffset; - u32 readSize; + + s32 fileOffset; + u32 readSize; fileOffset = VFGetOffsetByFd(file->vf); @@ -145,8 +142,7 @@ CDBErr CDBFReadAttrVF(CDBBridgeFile* file, CDBAttr* attr) { if (vfErr != VF_ERR_SUCCESS) { CDBSetFatalVFErrorFlag(); err = CDBOnVFErrorOccured(vfErr); - } - else { + } else { err = CDB_ERROR_OK; } @@ -167,10 +163,10 @@ CDBErr CDBFReadAttrVF(CDBBridgeFile* file, CDBAttr* attr) { } CDBErr CDBFWriteAttrVF(CDBBridgeFile* file, CDBAttr* attr) { - CDBErr err; + CDBErr err; VFError vfErr; - - s32 fileOffset; + + s32 fileOffset; fileOffset = VFGetOffsetByFd(file->vf); @@ -183,13 +179,11 @@ CDBErr CDBFWriteAttrVF(CDBBridgeFile* file, CDBAttr* attr) { if (vfErr != VF_ERR_SUCCESS) { if (vfErr == VF_ERR_ENOSPC) { err = CDB_ERROR_OUT_OF_SPACE; - } - else { + } else { CDBSetFatalVFErrorFlag(); err = CDBOnVFErrorOccured(vfErr); } - } - else { + } else { err = CDB_ERROR_OK; } @@ -206,10 +200,10 @@ CDBErr CDBFWriteAttrVF(CDBBridgeFile* file, CDBAttr* attr) { } CDBErr CDBFWriteAttrOnlyLeadChunkVF(CDBBridgeFile* file, CDBAttr* chunk) { - CDBErr err; + CDBErr err; VFError vfErr; - - s32 fileOffset; + + s32 fileOffset; fileOffset = VFGetOffsetByFd(file->vf); @@ -222,13 +216,11 @@ CDBErr CDBFWriteAttrOnlyLeadChunkVF(CDBBridgeFile* file, CDBAttr* chunk) { if (vfErr != VF_ERR_SUCCESS) { if (vfErr == VF_ERR_ENOSPC) { err = CDB_ERROR_OUT_OF_SPACE; - } - else { + } else { CDBSetFatalVFErrorFlag(); err = CDBOnVFErrorOccured(vfErr); } - } - else { + } else { err = CDB_ERROR_OK; } @@ -259,8 +251,7 @@ CDBErr CDBFWriteDataVF(CDBBridgeFile* file, void* buffer, u32 size) { if (vfErr != VF_ERR_SUCCESS) { if (vfErr == VF_ERR_ENOSPC) { return CDB_ERROR_OUT_OF_SPACE; - } - else { + } else { CDBSetFatalVFErrorFlag(); return CDBOnVFErrorOccured(vfErr); } @@ -286,12 +277,11 @@ CDBErr CDBFGetDataSizeVF(CDBBridgeFile* file, u32* dataSize) { s32 size = VFGetFileSizeByFd(file->vf); if (size < 0) { err = CDB_ERROR_CANNOT_OPEN_FILE; - } - else { + } else { *dataSize = size; err = CDB_ERROR_OK; } - + *dataSize -= 0x400; return err; @@ -303,8 +293,7 @@ CDBErr CDBFGetFileSizeVF(CDBBridgeFile* file, u32* fileSize) { s32 size = VFGetFileSizeByFd(file->vf); if (size < 0) { err = CDB_ERROR_CANNOT_OPEN_FILE; - } - else { + } else { *fileSize = size; err = CDB_ERROR_OK; } diff --git a/libs/RevoEX/src/cdb/CDBFileSystem.c b/libs/RevoEX/src/cdb/CDBFileSystem.c index cb3f93de..0c6352fd 100644 --- a/libs/RevoEX/src/cdb/CDBFileSystem.c +++ b/libs/RevoEX/src/cdb/CDBFileSystem.c @@ -1,16 +1,14 @@ -#include #include +#include #include #include -char CDB_WIIID_DAT_PATH[NAND_MAX_PATH]; +char CDB_WIIID_DAT_PATH[NAND_MAX_PATH]; -char CDB_VFF_FILE_NAME[NAND_MAX_PATH]; -u32 CDB_VFF_FILE_SIZE; - -// This is absolutely DISGUSTING. +char CDB_VFF_FILE_NAME[NAND_MAX_PATH]; +u32 CDB_VFF_FILE_SIZE; // Left over unused logs DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "NANDCreateDir %s\n"); @@ -31,8 +29,8 @@ DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "VFChangeDir %s %s\n"); static inline CDBErr CDBFSInitVFFile(void* cacheBuffer, u32 cacheSize) { VFError vfErr; - s32 nandErr; - + s32 nandErr; + vfErr = VFMountDriveNANDFlashCacheEx(CDB_CFG_VF_DRIVE_LETTER, CDB_VFF_FILE_NAME, cacheBuffer, cacheSize); if (vfErr != VF_ERR_SUCCESS) { CDBReportInfo("VFMountDriveNANDFlashEx VFErr=%d(%s)\n", vfErr, VFGetApiErrorString(vfErr)); @@ -83,18 +81,17 @@ static inline CDBErr CDBFSInitVFFile(void* cacheBuffer, u32 cacheSize) { CDBReportFatal("VFFormatDrive VFErr=%d\n", vfErr); return CDBOnVFErrorOccured(vfErr); } - } - else { + } else { CDBReportFatal("VFMountDriveNANDFlashEx VFErr=%d(%s)\n", vfErr, VFGetApiErrorString(vfErr)); return CDBOnVFErrorOccured(vfErr); } } CDBReportInfo("VFMountDriveNANDFlashEx %s->%s succeeded\n", CDB_VFF_FILE_NAME, CDB_CFG_VF_DRIVE_LETTER); - - vfErr = VFChangeDir(CDB_CFG_VF_DRIVE_ROOT"/"); + + vfErr = VFChangeDir(CDB_CFG_VF_DRIVE_ROOT "/"); if (vfErr != VF_ERR_SUCCESS) { - CDBReportFatal("VFChangeDir %s %s\n", CDB_CFG_VF_DRIVE_ROOT"/", VFGetApiErrorString(vfErr)); + CDBReportFatal("VFChangeDir %s %s\n", CDB_CFG_VF_DRIVE_ROOT "/", VFGetApiErrorString(vfErr)); return CDBOnVFErrorOccured(vfErr); } @@ -108,7 +105,7 @@ DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "<--NANDPrivateDelete\n"); CDBErr CDBFSInit(void* cacheBuffer, u32 cacheSize) { VFError vfErr; - s32 nandErr; + s32 nandErr; strcpy(CDB_VFF_FILE_NAME, "/title/00000001/00000002/data/cdb.vff"); CDB_VFF_FILE_SIZE = 0x1400000; @@ -133,8 +130,7 @@ CDBErr CDBFSUninit() { char* CDBFindDataGetName(CDBFindData* findData) { if (findData->loc == CDB_FS_LOCATION_NAND) { return CDBFindDataGetNameVF(&findData->vf); - } - else { + } else { return CDBFindDataGetNameSD(&findData->sd); } } @@ -142,8 +138,7 @@ char* CDBFindDataGetName(CDBFindData* findData) { BOOL CDBFindDataIsDirectory(CDBFindData* findData) { if (findData->loc == CDB_FS_LOCATION_NAND) { return CDBFindDataIsDirectoryVF(&findData->vf); - } - else { + } else { return CDBFindDataIsDirectorySD(&findData->sd); } } @@ -151,8 +146,7 @@ BOOL CDBFindDataIsDirectory(CDBFindData* findData) { BOOL CDBFindDataIsEnd(CDBFindData* findData) { if (findData->loc == CDB_FS_LOCATION_NAND) { return CDBFindDataIsEndVF(&findData->vf); - } - else { + } else { return CDBFindDataIsEndSD(&findData->sd); } } @@ -160,17 +154,16 @@ BOOL CDBFindDataIsEnd(CDBFindData* findData) { BOOL CDBFSIsExistFile(const char* fileName, CDBLocation location) { if (location == CDB_FS_LOCATION_NAND) { return CDBFSIsExistFileVF(fileName); - } - else { + } else { return CDBFSIsExistFileSD(fileName); } } -void CDBFSFindFirstRoot(CDBFindData *findData, CDBLocation location) { +void CDBFSFindFirstRoot(CDBFindData* findData, CDBLocation location) { CDBFSFindFirstRootEx(findData, location, NULL); } -void CDBFSFindFirstRootEx(CDBFindData *findData, CDBLocation location, u64* wiiId) { +void CDBFSFindFirstRootEx(CDBFindData* findData, CDBLocation location, u64* wiiId) { char rootPath[256]; findData->loc = location; @@ -184,8 +177,7 @@ void CDBFSFindFirst(CDBFindData* findData, const char* fileName, CDBLocation loc findData->loc = location; if (findData->loc == CDB_FS_LOCATION_NAND) { CDBFSFindFirstVF(&findData->vf, fileName); - } - else { + } else { CDBFSFindFirstSD(&findData->sd, fileName); } } @@ -193,8 +185,7 @@ void CDBFSFindFirst(CDBFindData* findData, const char* fileName, CDBLocation loc void CDBFSFindNext(CDBFindData* findData) { if (findData->loc == CDB_FS_LOCATION_NAND) { CDBFSFindNextVF(&findData->vf); - } - else { + } else { CDBFSFindNextSD(&findData->sd); } } @@ -202,8 +193,7 @@ void CDBFSFindNext(CDBFindData* findData) { void CDBFSFindClose(CDBFindData* findData) { if (findData->loc == CDB_FS_LOCATION_NAND) { CDBFSFindCloseVF(&findData->vf); - } - else { + } else { CDBFSFindCloseSD(&findData->sd); } } @@ -212,8 +202,7 @@ void CDBFSDeleteDir(char* dirName, CDBLocation location) { CDBReportInfo("CDBFSDeleteDir() %s\n", dirName); if (location == CDB_FS_LOCATION_NAND) { CDBFSDeleteDirVF(dirName); - } - else { + } else { CDBFSDeleteDirSD(dirName); } } diff --git a/libs/RevoEX/src/cdb/CDBFileSystemSD.c b/libs/RevoEX/src/cdb/CDBFileSystemSD.c index 47f7523f..c0aea84e 100644 --- a/libs/RevoEX/src/cdb/CDBFileSystemSD.c +++ b/libs/RevoEX/src/cdb/CDBFileSystemSD.c @@ -1,39 +1,39 @@ -#include #include +#include #include -#include #include +#include typedef struct CDB_FS_SD_WORK { - int sdStatus; // 0x00 + int sdStatus; // 0x00 - BOOL isMounted; // 0x04 - BOOL isEjected; // 0x08 - BOOL isInserted; // 0x0C + BOOL isMounted; // 0x04 + BOOL isEjected; // 0x08 + BOOL isInserted; // 0x0C - VFEventCallback sdCallback; // 0x10 + VFEventCallback sdCallback; // 0x10 } CDB_FS_SD_WORK; enum { SD_STATUS_NOT_MOUNTED = 0, SD_STATUS_MOUNTED, - SD_STATUS_UNAVAILABLE, // ? + SD_STATUS_UNAVAILABLE, // ? }; -char CDB_SD_VFF_FILE_NAME[72]; +char CDB_SD_VFF_FILE_NAME[72]; -char CDB_SD_ROOT_PATH_LS[32]; -char CDB_SD_ROOT_PATH_CD[32]; +char CDB_SD_ROOT_PATH_LS[32]; +char CDB_SD_ROOT_PATH_CD[32]; -char CDB_SD_VF_DRIVE_LETTER[4]; +char CDB_SD_VF_DRIVE_LETTER[4]; -static CDB_FS_SD_WORK s_fssdWork; +static CDB_FS_SD_WORK s_fssdWork; BOOL CDBFSIsExistFileSD(const char* fileName) { - char findName[256]; - VFDta vfDta; + char findName[256]; + VFDta vfDta; VFError vfErr; @@ -54,7 +54,7 @@ BOOL CDBFSIsExistFileSD(const char* fileName) { } void CDBFSFindFirstSD(CDBFindDataSD* findData, const char* fileName) { - char findName[256]; + char findName[256]; VFError vfErr; @@ -104,8 +104,7 @@ void CDBFSFindCloseSD(CDBFindDataSD* findData) { char* CDBFindDataGetNameSD(CDBFindDataSD* findData) { if (findData->dta.longName[0] == 0) { return findData->dta.fileName; - } - else { + } else { return findData->dta.longName; } } @@ -131,7 +130,7 @@ BOOL CDBFSIsDirNameSD(char* path) { } } // It is not a drive letter, it is a path! - return path[strlen(path)-1] != ':'; + return path[strlen(path) - 1] != ':'; } CDBErr CDBFSCreateDirForceSD(const char* dirName) { @@ -211,8 +210,7 @@ void CDBFSSDEjectedCallback(u32 vfEvent) { if (vfEvent == VF_EVENT_EJECTED) { CDBReportInfo("SDEjectedCallback EJECTED\n"); s_fssdWork.isEjected = TRUE; - } - else if (vfEvent == VF_EVENT_INSERTED) { + } else if (vfEvent == VF_EVENT_INSERTED) { CDBReportInfo("SDEjectedCallback INSERTED\n"); s_fssdWork.isInserted = TRUE; } @@ -269,7 +267,7 @@ CDBErr CDBFSSDUnmount() { s_fssdWork.isEjected = FALSE; s_fssdWork.isInserted = FALSE; - /* @BUG: should not have CDB_SD_VF_DRIVE_LETTER */ + /* @bug: should not have CDB_SD_VF_DRIVE_LETTER */ CDBReportInfo("VFUnmountDriveForce %s succeeded\n", "SD Slot0", CDB_SD_VF_DRIVE_LETTER); return CDB_ERROR_OK; } @@ -286,4 +284,4 @@ BOOL CDBFSSDIsInserted() { return s_fssdWork.isInserted; } -DECOMP_FORCE_ACTIVE(CDBFileSystem_c, CDB_SD_VFF_FILE_NAME); // Unused but linked +DECOMP_FORCE_ACTIVE(CDBFileSystem_c, CDB_SD_VFF_FILE_NAME); // Unused but linked diff --git a/libs/RevoEX/src/cdb/CDBFileSystemUtils.c b/libs/RevoEX/src/cdb/CDBFileSystemUtils.c index d5b7c415..47ab1f19 100644 --- a/libs/RevoEX/src/cdb/CDBFileSystemUtils.c +++ b/libs/RevoEX/src/cdb/CDBFileSystemUtils.c @@ -1,10 +1,10 @@ -#include #include +#include #include -#include -#include #include +#include +#include void CDBFSConcatenatePath(char* path, const char* concatPath) { strcat(path, "/"); @@ -12,7 +12,7 @@ void CDBFSConcatenatePath(char* path, const char* concatPath) { } BOOL CDBFSIsYearDirName(char* dirName) { - if (CDBSafeStrLen(dirName, 4+1) == 4) { + if (CDBSafeStrLen(dirName, 4 + 1) == 4) { if (isdigit(dirName[0]) && isdigit(dirName[1]) && isdigit(dirName[2]) && isdigit(dirName[3])) { return TRUE; } @@ -22,7 +22,7 @@ BOOL CDBFSIsYearDirName(char* dirName) { } BOOL CDBFSIsMonthDirName(char* dirName) { - if (CDBSafeStrLen(dirName, 2+1) == 2) { + if (CDBSafeStrLen(dirName, 2 + 1) == 2) { if (isdigit(dirName[0]) && isdigit(dirName[1])) { int val = atoi(dirName); if (val >= 0 && val <= 11) { @@ -35,7 +35,7 @@ BOOL CDBFSIsMonthDirName(char* dirName) { } BOOL CDBFSIsDayDirName(char* dirName) { - if (CDBSafeStrLen(dirName, 2+1) == 2) { + if (CDBSafeStrLen(dirName, 2 + 1) == 2) { if (isdigit(dirName[0]) && isdigit(dirName[1])) { int val = atoi(dirName); if (val >= 1 && val <= 31) { @@ -48,7 +48,7 @@ BOOL CDBFSIsDayDirName(char* dirName) { } BOOL CDBFSIsHourDirName(char* dirName) { - if (CDBSafeStrLen(dirName, 2+1) == 2) { + if (CDBSafeStrLen(dirName, 2 + 1) == 2) { if (isdigit(dirName[0]) && isdigit(dirName[1])) { int val = atoi(dirName); if (val >= 0 && val <= 23) { @@ -61,7 +61,7 @@ BOOL CDBFSIsHourDirName(char* dirName) { } BOOL CDBFSIsMinuteDirName(char* dirName) { - if (CDBSafeStrLen(dirName, 2+1) == 2) { + if (CDBSafeStrLen(dirName, 2 + 1) == 2) { if (isdigit(dirName[0]) && isdigit(dirName[1])) { int val = atoi(dirName); if (val >= 0 && val <= 59) { @@ -74,7 +74,7 @@ BOOL CDBFSIsMinuteDirName(char* dirName) { } BOOL CDBFSIsCodeDirName(char* dirName) { - if (CDBSafeStrLen(dirName, 7+1) == 7) { + if (CDBSafeStrLen(dirName, 7 + 1) == 7) { if (dirName[4] == '_') { return TRUE; } @@ -84,18 +84,16 @@ BOOL CDBFSIsCodeDirName(char* dirName) { } BOOL CDBFSIsTypeDirName(char* dirName) { - int strLen1 = CDBSafeStrLen(dirName, 5+1); - int strLen2 = CDBSafeStrLen(dirName, 2+1); + int strLen1 = CDBSafeStrLen(dirName, 5 + 1); + int strLen2 = CDBSafeStrLen(dirName, 2 + 1); BOOL result; if (strLen2 == 1 && dirName[0] == '.') { result = TRUE; - } - else if (strLen2 == 2 && dirName[0] == '.' && dirName[1] == '.') { + } else if (strLen2 == 2 && dirName[0] == '.' && dirName[1] == '.') { result = TRUE; - } - else { + } else { result = FALSE; } @@ -109,7 +107,7 @@ BOOL CDBFSIsTypeDirName(char* dirName) { } BOOL CDBFSIsCDBFileOnSD(char* fileName) { - if (CDBSafeStrLen(fileName, 12+1) == 12) { + if (CDBSafeStrLen(fileName, 12 + 1) == 12) { char* ptr = fileName; char i, j; for (i = 0; i < 4; i++) { @@ -137,7 +135,7 @@ BOOL CDBFSIsCDBFileOnSD(char* fileName) { } BOOL CDBFSIsMCGCDirNameOnSD(char* dirName) { - if (CDBSafeStrLen(dirName, 7+1) == 7) { + if (CDBSafeStrLen(dirName, 7 + 1) == 7) { if (dirName[4] == '_') { return TRUE; } @@ -148,18 +146,16 @@ BOOL CDBFSIsMCGCDirNameOnSD(char* dirName) { // Duplicate of CDBFSIsTypeDirNameOn BOOL CDBFSIsTypeDirNameOnSD(char* dirName) { - int strLen1 = CDBSafeStrLen(dirName, 5+1); - int strLen2 = CDBSafeStrLen(dirName, 2+1); + int strLen1 = CDBSafeStrLen(dirName, 5 + 1); + int strLen2 = CDBSafeStrLen(dirName, 2 + 1); BOOL result; if (strLen2 == 1 && dirName[0] == '.') { result = TRUE; - } - else if (strLen2 == 2 && dirName[0] == '.' && dirName[1] == '.') { + } else if (strLen2 == 2 && dirName[0] == '.' && dirName[1] == '.') { result = TRUE; - } - else { + } else { result = FALSE; } diff --git a/libs/RevoEX/src/cdb/CDBFileSystemVF.c b/libs/RevoEX/src/cdb/CDBFileSystemVF.c index 8f310930..1374e4d4 100644 --- a/libs/RevoEX/src/cdb/CDBFileSystemVF.c +++ b/libs/RevoEX/src/cdb/CDBFileSystemVF.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -8,8 +8,7 @@ char* CDBFindDataGetNameVF(CDBFindDataVF* findData) { if (findData->dta.longName[0] == 0) { return findData->dta.fileName; - } - else { + } else { return findData->dta.longName; } } @@ -23,8 +22,8 @@ BOOL CDBFindDataIsEndVF(CDBFindDataVF* findData) { } BOOL CDBFSIsExistFileVF(const char* fileName) { - char findName[256]; - VFDta vfDta; + char findName[256]; + VFDta vfDta; VFError vfErr; @@ -45,7 +44,7 @@ BOOL CDBFSIsExistFileVF(const char* fileName) { } void CDBFSFindFirstVF(CDBFindDataVF* findData, const char* fileName) { - char findName[256]; + char findName[256]; VFError vfErr; diff --git a/libs/RevoEX/src/cdb/CDBId.c b/libs/RevoEX/src/cdb/CDBId.c index 30085c29..a365de67 100644 --- a/libs/RevoEX/src/cdb/CDBId.c +++ b/libs/RevoEX/src/cdb/CDBId.c @@ -1,15 +1,15 @@ -#include #include +#include #include #include CDBErr GenCDBIdNumber(u32* cdbIdNum) { - char confPath[256]; + char confPath[256]; VFFILE* confFile; - CDBErr err; + CDBErr err; VFError vfErr; sprintf(confPath, "%s%s%s", CDB_CFG_VF_DRIVE_ROOT, "/", CDB_CFG_CDBID_FILE); diff --git a/libs/RevoEX/src/cdb/CDBRecordFile.c b/libs/RevoEX/src/cdb/CDBRecordFile.c index b36dbb66..08f53fa2 100644 --- a/libs/RevoEX/src/cdb/CDBRecordFile.c +++ b/libs/RevoEX/src/cdb/CDBRecordFile.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -39,8 +39,7 @@ CDBErr CDBRecordFileWriteAttrBuf(CDBRecord* record) { if (err != CDB_ERROR_OK) { return err; } - } - else if (recordFile->attr.unk_0x400 || recordFile->attr.unk_0x404) { + } else if (recordFile->attr.unk_0x400 || recordFile->attr.unk_0x404) { err = CDBFWriteAttr(&recordFile->bridgeFile, &recordFile->attr, record->key.location); if (err != CDB_ERROR_OK) { return err; @@ -97,7 +96,7 @@ CDBErr CDBRecordFileCreateBlank(CDBRecord* record) { } CDBReportInfo(" create %s...\n", record->key.keyString); - + return CDB_ERROR_OK; } @@ -193,7 +192,7 @@ CDBErr CDBRecordFileCreateAtOnce(CDBRecord* record, void* buffer, u32 size) { CDBErr CDBRecordFileDelete(CDBRecord* record) { char fullPath[256]; CDBErr err; - + if (!CDBRecordKeyIsValid(&record->key)) { CDBReportError("invalid key\n"); return CDB_ERROR_5; @@ -284,8 +283,7 @@ CDBErr CDBRecordFileReadData(CDBRecord* record, void* buffer, u32 size, u32* rea } return CDB_ERROR_OK; - } - else { + } else { return CDBFReadData(&recordFile->bridgeFile, buffer, size, readSize, record->key.location); } } @@ -298,7 +296,7 @@ CDBErr CDBRecordFileReadDataFile(CDBRecord* record, void* buffer, u32 size, u32* CDBErr CDBRecordFileSeekData(CDBRecord* record, u32 offset, CDBSeek seek) { CDBRecordFile* recordFile = record->file; CDBCryptBuf* cryptBuf = record->cryptBuf; - + if (cryptBuf != NULL) { switch (seek) { case CDB_SEEK_BEGIN: { @@ -307,7 +305,7 @@ CDBErr CDBRecordFileSeekData(CDBRecord* record, u32 offset, CDBSeek seek) { break; } case CDB_SEEK_END: { - cryptBuf->unk_0x3EC04 = (cryptBuf->unk_0x3EC00-1) - offset; + cryptBuf->unk_0x3EC04 = (cryptBuf->unk_0x3EC00 - 1) - offset; break; } case CDB_SEEK_CUR: { @@ -316,8 +314,7 @@ CDBErr CDBRecordFileSeekData(CDBRecord* record, u32 offset, CDBSeek seek) { } } return CDB_ERROR_OK; - } - else { + } else { return CDBFSeekData(&recordFile->bridgeFile, offset, seek, record->key.location); } } @@ -330,7 +327,7 @@ CDBErr CDBRecordFileSeekDataFile(CDBRecord* record, u32 offset, CDBSeek seek) { int CDBRecordFileTellData(CDBRecord* record) { CDBRecordFile* recordFile = record->file; CDBCryptBuf* cryptBuf = record->cryptBuf; - + if (cryptBuf != NULL) { return cryptBuf->unk_0x3EC04 - sizeof(CDBAttrBuf); } diff --git a/libs/RevoEX/src/cdb/CDBRecordKey.c b/libs/RevoEX/src/cdb/CDBRecordKey.c index e46439c9..7a222d1f 100644 --- a/libs/RevoEX/src/cdb/CDBRecordKey.c +++ b/libs/RevoEX/src/cdb/CDBRecordKey.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -11,7 +11,8 @@ BOOL CDBRecordKeyIsValid(CDBRecordKey* recordKey) { keyLength = strlen(recordKey->keyString); if (keyLength >= CDB_RECORD_KEY_STRLEN_LEN) { - if (recordKey->keyStrStruct.pad0 == '_' && recordKey->keyStrStruct.pad1 == '_' && recordKey->keyStrStruct.pad2 == '_' && recordKey->keyStrStruct.pad3 == '.') { + if (recordKey->keyStrStruct.pad0 == '_' && recordKey->keyStrStruct.pad1 == '_' && recordKey->keyStrStruct.pad2 == '_' && + recordKey->keyStrStruct.pad3 == '.') { if (recordKey->location >= CDB_FS_LOCATION_NAND && recordKey->location <= CDB_FS_LOCATION_4) { return TRUE; } diff --git a/libs/RevoEX/src/cdb/CDBSystem.c b/libs/RevoEX/src/cdb/CDBSystem.c index 8e09754d..01303969 100644 --- a/libs/RevoEX/src/cdb/CDBSystem.c +++ b/libs/RevoEX/src/cdb/CDBSystem.c @@ -1,26 +1,26 @@ -#include #include +#include -#include #include #include #include +#include -#include #include +#include -static OSMutex s_mutex; -static BOOL s_mutexInitialized = FALSE; +static OSMutex s_mutex; +static BOOL s_mutexInitialized = FALSE; -static BOOL s_fatalVFFlag = FALSE; +static BOOL s_fatalVFFlag = FALSE; // This was likely a local originally, but oh well! s32 CDBPrintDebugLevel = CDB_VERBOSE_LEVEL_NONE; -static VFError s_lastVFError; -static s32 s_lastNANDError; +static VFError s_lastVFError; +static s32 s_lastNANDError; -static u8 s_cdbWiiId[OSRoundUp32B(CDB_WIIID_DAT_SIZE)] ALIGN32; +static u8 s_cdbWiiId[OSRoundUp32B(CDB_WIIID_DAT_SIZE)] ALIGN32; void MutexInitialized() { s_mutexInitialized = TRUE; @@ -126,8 +126,7 @@ CDBErr CDBInitHashedMacAddr() { } usingCdbWii = FALSE; - } - else { + } else { // "Using cdbwiiid.dat" CDBReportInfo("cdbwiiid.datを使用します\n"); @@ -142,8 +141,7 @@ CDBErr CDBInitHashedMacAddr() { return CDBOnNANDErrorOccured(ret); } } - } - else { + } else { usingCdbWii = FALSE; } @@ -179,7 +177,7 @@ CDBErr CDBInitHashedMacAddr() { OSReport("MACハッシュ20バイト + ゼロ20バイト = {\n"); for (i = 0; i < 4; i++) { for (j = 0; j < 10; j++) { - OSReport("%02X ", s_cdbWiiId[(i*10)+(j)]); + OSReport("%02X ", s_cdbWiiId[(i * 10) + (j)]); } OSReport("\n"); } @@ -299,8 +297,7 @@ void CDBCheckMakerCodeStr(char* makerCodeStr) { makerCodeStr[0] = 0x23; if (makerCodeStr[1] >= 0 && makerCodeStr[1] <= 9) { makerCodeStr[1] += 0x30; - } - else { + } else { makerCodeStr[1] = 0x23; } } @@ -312,8 +309,7 @@ CDBErr CDBSetVFSyncMode(int sync) { if (sync != 0) { vfErr = VFSync(CDB_CFG_VF_DRIVE_LETTER, 0); - } - else { + } else { vfErr = VFSync(CDB_CFG_VF_DRIVE_LETTER, 1); } @@ -322,7 +318,7 @@ CDBErr CDBSetVFSyncMode(int sync) { } s_vfSync = sync; - + return CDB_ERROR_OK; } diff --git a/libs/RevoEX/src/cdb/cdb.c b/libs/RevoEX/src/cdb/cdb.c index cd8708b4..e1e391c0 100644 --- a/libs/RevoEX/src/cdb/cdb.c +++ b/libs/RevoEX/src/cdb/cdb.c @@ -1,5 +1,5 @@ -#include #include +#include #include diff --git a/libs/RevoEX/src/net/NETVersion.c b/libs/RevoEX/src/net/NETVersion.c index 1ccc7a53..c98e4204 100644 --- a/libs/RevoEX/src/net/NETVersion.c +++ b/libs/RevoEX/src/net/NETVersion.c @@ -5,5 +5,3 @@ const char* NETRexPPCVersionPrintableString = "<< REX-PPC 2.0.4.0 (RevoEX-2.0PR4 const char* NETGetRexPPCVersionPrintable() { return NETRexPPCVersionPrintableString; } - - diff --git a/libs/RevoEX/src/net/crc.c b/libs/RevoEX/src/net/crc.c index c22873f7..5d12fca5 100644 --- a/libs/RevoEX/src/net/crc.c +++ b/libs/RevoEX/src/net/crc.c @@ -1,11 +1,7 @@ #include -static const u16 crc16_table[] = { - 0x0000, 0xCC01, 0xD801, 0x1400, - 0xF001, 0x3C00, 0x2800, 0xE401, - 0xA001, 0x6C00, 0x7800, 0xB401, - 0x5000, 0x9C01, 0x8801, 0x4400 -}; +static const u16 crc16_table[] = {0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401, + 0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400}; u16 NETCalcCRC16(const void* pData, s32 size) { int i; @@ -18,12 +14,8 @@ u16 NETCalcCRC16(const void* pData, s32 size) { return (u16)crc; } -static const u32 crc32_table[] = { - 0x00000000, 0x1DB71064, 0x3B6E20C8, 0x26D930AC, - 0x76DC4190, 0x6B6B51F4, 0x4DB26158, 0x5005713C, - 0xEDB88320, 0xF00F9344, 0xD6D6A3E8, 0xCB61B38C, - 0x9B64C2B0, 0x86D3D2D4, 0xA00AE278, 0xBDBDF21C -}; +static const u32 crc32_table[] = {0x00000000, 0x1DB71064, 0x3B6E20C8, 0x26D930AC, 0x76DC4190, 0x6B6B51F4, 0x4DB26158, 0x5005713C, + 0xEDB88320, 0xF00F9344, 0xD6D6A3E8, 0xCB61B38C, 0x9B64C2B0, 0x86D3D2D4, 0xA00AE278, 0xBDBDF21C}; u32 NETCalcCRC32(const void* pData, s32 size) { int i; @@ -35,5 +27,3 @@ u32 NETCalcCRC32(const void* pData, s32 size) { } return ~crc; } - - diff --git a/libs/RevoEX/src/net/wireless_macaddr.c b/libs/RevoEX/src/net/wireless_macaddr.c index bb7a68d4..4da9936e 100644 --- a/libs/RevoEX/src/net/wireless_macaddr.c +++ b/libs/RevoEX/src/net/wireless_macaddr.c @@ -3,5 +3,3 @@ extern int NCDiGetWirelessMacAddress(void* data); int NETGetWirelessMacAddress(void* data) { return NCDiGetWirelessMacAddress(data); } - - diff --git a/libs/RevoEX/src/nwc24/NWC24CHJump.c b/libs/RevoEX/src/nwc24/NWC24CHJump.c index c9007364..060464fb 100644 --- a/libs/RevoEX/src/nwc24/NWC24CHJump.c +++ b/libs/RevoEX/src/nwc24/NWC24CHJump.c @@ -3,8 +3,8 @@ #include typedef struct CHJumpBlock { - u32 offset; // 0x00 - u32 size; // 0x04 + u32 offset; // 0x00 + u32 size; // 0x04 } CHJumpBlock; static const char* GetCHDataPtr(const NWC24CHJumpObj* chjp) { @@ -20,14 +20,14 @@ static u32 GetCHJumpBlockTableSize(const NWC24CHJumpObj* chjp) { } NWC24Err NWC24CheckCHJumpObj(const NWC24CHJumpObj* chjp, u32 dataSize) { - u32 blockTblSize; - u32 num; - u32 i; - int offset; - int size; + u32 blockTblSize; + u32 num; + u32 i; + int offset; + int size; - const CHJumpBlock* block; - const char* blockTbl = GetCHDataPtr(chjp); + const CHJumpBlock* block; + const char* blockTbl = GetCHDataPtr(chjp); // Verify magic if (chjp->magic != NWC24_CHJP_HEADER_MAGIC) { @@ -54,7 +54,7 @@ NWC24Err NWC24CheckCHJumpObj(const NWC24CHJumpObj* chjp, u32 dataSize) { if (offset < blockTblSize) { return NWC24_ERR_FORMAT; } - + // Check if block does not exceed total CHJump size size = block->size; if (offset + size > chjp->totalSize) { @@ -71,8 +71,8 @@ NWC24Err NWC24GetCHJumpTitleId(const NWC24CHJumpObj* chjp, u64* titleId) { } NWC24Err NWC24GetCHJumpBlockSize(const NWC24CHJumpObj* chjp, u32* size, u32 index) { - const CHJumpBlock* block; - const char* blockTbl = GetCHDataPtr(chjp); + const CHJumpBlock* block; + const char* blockTbl = GetCHDataPtr(chjp); if (chjp->numBlocks <= index) { return NWC24_ERR_INVALID_VALUE; @@ -80,13 +80,13 @@ NWC24Err NWC24GetCHJumpBlockSize(const NWC24CHJumpObj* chjp, u32* size, u32 inde block = GetCHJumpBlock(blockTbl, index); *size = block->size; - + return NWC24_OK; } NWC24Err NWC24GetCHJumpBlockData(const NWC24CHJumpObj* chjp, char* data, u32 size, u32 index) { - const CHJumpBlock* block; - const char* blockTbl = GetCHDataPtr(chjp); + const CHJumpBlock* block; + const char* blockTbl = GetCHDataPtr(chjp); char* srcData; u32 srcSize; diff --git a/libs/RevoEX/src/nwc24/NWC24Config.c b/libs/RevoEX/src/nwc24/NWC24Config.c index dbb0804a..375d52f4 100644 --- a/libs/RevoEX/src/nwc24/NWC24Config.c +++ b/libs/RevoEX/src/nwc24/NWC24Config.c @@ -1,44 +1,43 @@ -#include #include +#include -#include #include +#include #include #include static NWC24ConfigData* config = NULL; -static BOOL ConfigModified = FALSE; +static BOOL ConfigModified = FALSE; -static const char* MBoxDir = "/shared2/wc24/mbox"; -static const char* ConfigFile = "/shared2/wc24/nwc24msg.cfg"; -static const char* CfgBakFile = "/shared2/wc24/nwc24msg.cbk"; +static const char* MBoxDir = "/shared2/wc24/mbox"; +static const char* ConfigFile = "/shared2/wc24/nwc24msg.cfg"; +static const char* CfgBakFile = "/shared2/wc24/nwc24msg.cbk"; -static u16 VirtualGroupId = 01; // Nintendo +static u16 VirtualGroupId = 01; // Nintendo -static void SetDefaultConfig(); +static void SetDefaultConfig(); -static u32 GetConfigCheckSum(); +static u32 GetConfigCheckSum(); static NWC24Err CheckConfig() NO_INLINE; static NWC24Err GenerateUserId(NWC24UserId* pId); static NWC24Err RegisterUserId() NO_INLINE; -static void CacheUserIdToLoMem(NWC24UserId id); +static void CacheUserIdToLoMem(NWC24UserId id); static NWC24Err GetCachedUserIdFromLoMem(NWC24UserId* pId); NWC24Err NWC24GetMyUserId(NWC24UserId* pId) { - NWC24Err scdErr; - NWC24Err result; + NWC24Err scdErr; + NWC24Err result; result = NWC24_OK; // If config was loaded, load user ID from there if (NWC24IsMsgLibOpened() || NWC24IsMsgLibOpenedByTool()) { *pId = config->userId; - } - else { + } else { // Otherwise, load from cache scdErr = GetCachedUserIdFromLoMem(pId); if (scdErr == NWC24_OK) { @@ -133,7 +132,7 @@ NWC24Err NWC24iConfigInit(BOOL force) { if (result == NWC24_ERR_VER_MISMATCH && !force && config->version > NWC24_CONFIG_CURRENT_VERSION) { return result; } - + // Other reason why it failed to read the config? Create a new one. if (result == NWC24_OK || result == NWC24_ERR_VER_MISMATCH || result == NWC24_ERR_BROKEN) { @@ -188,7 +187,7 @@ NWC24Err NWC24iConfigReload() { result = CheckConfig(); if (result == NWC24_OK) { - ConfigModified = FALSE; // current config is fine + ConfigModified = FALSE; // current config is fine return result; } } @@ -207,7 +206,7 @@ NWC24Err NWC24iConfigReload() { result = CheckConfig(); if (result == NWC24_OK) { - ConfigModified = TRUE; // current config is not fine + ConfigModified = TRUE; // current config is not fine } } @@ -299,7 +298,7 @@ u16 NWC24GetGroupId() { switch (OSGetAppType()) { case OS_APP_TYPE_IPL: { - groupId = 01; // Nintendo + groupId = 01; // Nintendo break; } case OS_APP_TYPE_DVD: { @@ -384,7 +383,7 @@ void NWC24SetMailTrsServerURL(const char* mailTrsServerURL) { } void NWC24SetIdCreationCount(u32 idCreationCount) { - config->idCreationCount = idCreationCount & (NWC24_CONFIG_MAX_ID_COUNT-1); + config->idCreationCount = idCreationCount & (NWC24_CONFIG_MAX_ID_COUNT - 1); ConfigModified = TRUE; } @@ -461,22 +460,22 @@ static NWC24Err CheckConfig() { } static NWC24Err GenerateUserId(NWC24UserId* pId) { - NWC24Err result; - u32 arg1 = 0; + NWC24Err result; + u32 arg1 = 0; if (pId == NULL) { return NWC24_ERR_INVALID_VALUE; } - *pId = 9999999999999999; // dummy + *pId = 9999999999999999; // dummy result = NWC24iRequestGenerateUserId(pId, &arg1); CacheUserIdToLoMem(*pId); return result; } static NWC24Err RegisterUserId() { - NWC24Err result; - s32 scheduleErrCount, scheduleErr; + NWC24Err result; + s32 scheduleErrCount, scheduleErr; result = NWC24SuspendScheduler(); if (result < NWC24_OK) { @@ -485,11 +484,10 @@ static NWC24Err RegisterUserId() { result = NWC24iRequestRegisterUserId(); if (result != NWC24_OK && result != NWC24_ERR_ID_REGISTERED) { - NWC24Err result2 = NWC24GetSchedulerError(&scheduleErrCount,&scheduleErr); + NWC24Err result2 = NWC24GetSchedulerError(&scheduleErrCount, &scheduleErr); if (result2 == NWC24_OK && scheduleErrCount > 0) { NWC24iSetErrorCode(scheduleErr); - } - else { + } else { NWC24iSetErrorCode(NWC24iMakeCode(NWC24_ERRCODE_1092XX, result)); } } @@ -513,6 +511,6 @@ static NWC24Err GetCachedUserIdFromLoMem(NWC24UserId* pId) { if (*pId == 0) { return NWC24_ERR_NULL; } - + return NWC24iCheckUserIdCRC(*pId); } diff --git a/libs/RevoEX/src/nwc24/NWC24FileAPI.c b/libs/RevoEX/src/nwc24/NWC24FileAPI.c index 3abdc427..4904cab6 100644 --- a/libs/RevoEX/src/nwc24/NWC24FileAPI.c +++ b/libs/RevoEX/src/nwc24/NWC24FileAPI.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -18,12 +18,12 @@ static NWC24Err AlignedSeek(NWC24File* file, s32 offset, int whence); static NWC24Err ConvertError(s32 nanderr, NWC24Err wc24err); static NWC24Err ConvertVfError(s32 vferr, NWC24Err wc24err); -#define INVALIDATE_ALIGN (1 << (DEFAULT_ALIGN-1)) // ? +#define INVALIDATE_ALIGN (1 << (DEFAULT_ALIGN - 1)) // ? -#define NWC24_IO_WRITE_BUFFER_SIZE ((int)(sizeof(nwc24Work->writeBuffer))) -#define NWC24_IO_READ_BUFFER_SIZE ((int)(sizeof(nwc24Work->readBuffer) )) +#define NWC24_IO_WRITE_BUFFER_SIZE ((int)(sizeof(nwc24Work->writeBuffer))) +#define NWC24_IO_READ_BUFFER_SIZE ((int)(sizeof(nwc24Work->readBuffer))) -#define NAND_RETRY_COUNT 3 +#define NAND_RETRY_COUNT 3 NWC24Err NWC24FOpen(NWC24File* file, const char* path, u32 mode) { InstanceIdGen++; @@ -33,9 +33,7 @@ NWC24Err NWC24FOpen(NWC24File* file, const char* path, u32 mode) { file->align = 0; file->mode = mode; - if (mode == NWC24_OPEN_NAND_WBUFF || mode == NWC24_OPEN_NAND_RBUFF || - mode == NWC24_OPEN_VF_WBUFF || mode == NWC24_OPEN_VF_RBUFF) { - + if (mode == NWC24_OPEN_NAND_WBUFF || mode == NWC24_OPEN_NAND_RBUFF || mode == NWC24_OPEN_VF_WBUFF || mode == NWC24_OPEN_VF_RBUFF) { if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { return NWC24_ERR_LIB_NOT_OPENED; } @@ -152,16 +150,14 @@ NWC24Err NWC24FClose(NWC24File* file) { NWC24Err close = NWC24_OK; NWC24Err read = NWC24_OK; - if (file->mode == NWC24_OPEN_NAND_WBUFF || - file->mode == NWC24_OPEN_VF_WBUFF) { + if (file->mode == NWC24_OPEN_NAND_WBUFF || file->mode == NWC24_OPEN_VF_WBUFF) { read = BufferedWriteFlush(file); WrBufferMutex = 0; } if (file->mode & NWC24_OPEN_VF) { close = NWC24iFCloseVF(file); - } - else { + } else { close = NWC24iFCloseNand(file); } @@ -186,8 +182,7 @@ NWC24Err NWC24iFCloseNand(NWC24File* file) { if (result == NAND_RESULT_CORRUPT) { err = NWC24_ERR_NAND_CORRUPT; - } - else if (result != NAND_RESULT_OK) { + } else if (result != NAND_RESULT_OK) { err = NWC24_ERR_FILE_CLOSE; } @@ -205,13 +200,11 @@ NWC24Err NWC24iFCloseVF(NWC24File* file) { return NWC24_OK; } - NWC24Err NWC24FSeek(NWC24File* file, s32 offset, int whence) { s32 result; u32 i; - if (file->mode == NWC24_OPEN_NAND_RBUFF || - file->mode == NWC24_OPEN_VF_RBUFF) { + if (file->mode == NWC24_OPEN_NAND_RBUFF || file->mode == NWC24_OPEN_VF_RBUFF) { return AlignedSeek(file, offset, whence); } @@ -479,7 +472,7 @@ NWC24Err NWC24CreateVF(const char* path, u32 fileSize) { return ConvertVfError(vfResult, NWC24_ERR_INTERNAL_VF); } - vfResult = VFCreateDir(NWC24_VF_DRIVE":/mb"); + vfResult = VFCreateDir(NWC24_VF_DRIVE ":/mb"); if (vfResult != VF_ERR_SUCCESS) { return ConvertVfError(vfResult, NWC24_ERR_INTERNAL_VF); } @@ -654,8 +647,7 @@ static NWC24Err BufferedRead(void* dest, s32 size, NWC24File* file) { } result = bytesread; - } - else { + } else { for (i = 0; i < NAND_RETRY_COUNT; i++) { result = NANDRead(&file->nand, buf, now); if (!(result == NAND_RESULT_BUSY || result == NAND_RESULT_ALLOC_FAILED)) { @@ -673,8 +665,7 @@ static NWC24Err BufferedRead(void* dest, s32 size, NWC24File* file) { if (result != now) { err = NWC24_ERR_FILE_READ; break; - } - else { + } else { memcpy(bdst, buf + pos, left); bdst += left; total -= left; @@ -714,13 +705,13 @@ static NWC24Err AlignedSeek(NWC24File* file, s32 offset, int whence) { static NWC24Err ConvertError(s32 nanderr, NWC24Err wc24err) { switch (nanderr) { - case NAND_RESULT_ECC_CRIT: - case NAND_RESULT_AUTHENTICATION: - return NWC24_ERR_FILE_BROKEN; - case NAND_RESULT_CORRUPT: - return NWC24_ERR_NAND_CORRUPT; - default: - return wc24err; + case NAND_RESULT_ECC_CRIT: + case NAND_RESULT_AUTHENTICATION: + return NWC24_ERR_FILE_BROKEN; + case NAND_RESULT_CORRUPT: + return NWC24_ERR_NAND_CORRUPT; + default: + return wc24err; } } diff --git a/libs/RevoEX/src/nwc24/NWC24FriendList.c b/libs/RevoEX/src/nwc24/NWC24FriendList.c index 32e5eee3..692e55fb 100644 --- a/libs/RevoEX/src/nwc24/NWC24FriendList.c +++ b/libs/RevoEX/src/nwc24/NWC24FriendList.c @@ -1,5 +1,5 @@ -#include #include +#include typedef s32 ChkHostNameError; @@ -15,50 +15,50 @@ enum { CHECK_HOSTNAME_SUCCESS }; -#define FRIEND_LIST_MAGIC 'WcFl' +#define FRIEND_LIST_MAGIC 'WcFl' #define FRIEND_LIST_VERSION 2 static const char* FLFilePath = "/shared2/wc24/nwc24fl.bin"; -static NWC24Err GetCachedFLHeader(NWC24FLHeader** header); +static NWC24Err GetCachedFLHeader(NWC24FLHeader** header); static ChkHostNameError CheckHostName(const char* hostName, u32 hostNameLength); static u32 GetUnkFlag(u32 index) { - NWC24Err result; - NWC24FLHeader* header; - u32 data; + NWC24Err result; + NWC24FLHeader* header; + u32 data; result = GetCachedFLHeader(&header); if (result != NWC24_OK) { return result; } - + data = header->unk_0x10[index >> 5] >> (index & 0x1f) & 1; return (NWC24Err)data; } static NWC24Err SetUnkFlag(u32 index, int flag) { - NWC24Err result; - NWC24FLHeader* header; + NWC24Err result; + NWC24FLHeader* header; result = GetCachedFLHeader(&header); if (result != NWC24_OK) { return result; } - + header->unk_0x10[index >> 5] = ~(1 << (index & 0x1f)) & header->unk_0x10[index >> 5] | flag << (index & 0x1f); return NWC24_OK; } static NWC24Err SetUnkFlag2(int flag) { - NWC24Err result; - NWC24FLHeader* header; + NWC24Err result; + NWC24FLHeader* header; result = GetCachedFLHeader(&header); if (result != NWC24_OK) { return result; } - + header->unk_0x3C |= flag; return NWC24_OK; } @@ -74,7 +74,7 @@ static NWC24Err ConvAddrToCheckValue(const NWC24FriendAddr* addr, NWC24UserId* v return NWC24_ERR_STRING_END; } - for (i = 0; i < (int)sizeof(NWC24UserId)-1; i++) { + for (i = 0; i < (int)sizeof(NWC24UserId) - 1; i++) { if (i < strLen) { *value |= Mail_tolower(addr->mailAddr[i]); } @@ -86,7 +86,7 @@ static NWC24Err ConvAddrToCheckValue(const NWC24FriendAddr* addr, NWC24UserId* v } NWC24Err NWC24ReadFriendInfo(NWC24FriendInfo* info, u32 index) { - NWC24Err result; + NWC24Err result; result = NWC24iReadFriendInfoRaw(info, index); if (result != NWC24_OK) { @@ -94,7 +94,7 @@ NWC24Err NWC24ReadFriendInfo(NWC24FriendInfo* info, u32 index) { } if (info->attr.type == NWC24_FRIENDTYPE_WII) { - Mail_memset(&info->addr.mailAddr[sizeof(NWC24UserId)], 0, sizeof(NWC24UserMailAddr)-sizeof(NWC24UserId)); + Mail_memset(&info->addr.mailAddr[sizeof(NWC24UserId)], 0, sizeof(NWC24UserMailAddr) - sizeof(NWC24UserId)); } result = GetUnkFlag(index); @@ -106,18 +106,18 @@ NWC24Err NWC24ReadFriendInfo(NWC24FriendInfo* info, u32 index) { } NWC24Err NWC24WriteFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) { - NWC24Err result; - NWC24Err resultFile; + NWC24Err result; + NWC24Err resultFile; - NWC24FLHeader* header; - NWC24FriendAttr* tmpFriendAttr; - NWC24FriendAddr* tmpFriendAddr; + NWC24FLHeader* header; + NWC24FriendAttr* tmpFriendAttr; + NWC24FriendAddr* tmpFriendAddr; - NWC24File file; - u32 fileOffset; + NWC24File file; + u32 fileOffset; - int i; - NWC24UserId friendValue; + int i; + NWC24UserId friendValue; if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { return NWC24_ERR_LIB_NOT_OPENED; @@ -138,13 +138,13 @@ NWC24Err NWC24WriteFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) { *tmpFriendAttr = friendInfo->attr; tmpFriendAttr->status = NWC24_FRIENDSTATUS_PENDING; - for (i = 0; i < NWC24_FRIEND_NAME_LENGTH-1; i++) { + for (i = 0; i < NWC24_FRIEND_NAME_LENGTH - 1; i++) { if (tmpFriendAttr->name[i] == 0) { break; } } - if (i == NWC24_FRIEND_NAME_LENGTH-1) { + if (i == NWC24_FRIEND_NAME_LENGTH - 1) { return NWC24_ERR_STRING_END; } @@ -174,9 +174,8 @@ NWC24Err NWC24WriteFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) { header->friendIds[index] = friendInfo->addr.wiiId; tmpFriendAddr->wiiId = friendInfo->addr.wiiId; - Mail_memset(&tmpFriendAddr->mailAddr[sizeof(NWC24UserId)], 0, sizeof(NWC24UserMailAddr)-sizeof(NWC24UserId)); - } - else if (tmpFriendAttr->type == NWC24_FRIENDTYPE_EMAIL) { + Mail_memset(&tmpFriendAddr->mailAddr[sizeof(NWC24UserId)], 0, sizeof(NWC24UserMailAddr) - sizeof(NWC24UserId)); + } else if (tmpFriendAttr->type == NWC24_FRIENDTYPE_EMAIL) { result = ConvAddrToCheckValue(&friendInfo->addr, &friendValue); if (result != NWC24_OK) { return result; @@ -221,14 +220,14 @@ NWC24Err NWC24WriteFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) { } NWC24Err NWC24DeleteFriendInfo(u32 index) { - NWC24Err result; - NWC24Err resultWrite; + NWC24Err result; + NWC24Err resultWrite; - NWC24FLHeader* header; - NWC24FriendInfo* tmpFriendInfo; + NWC24FLHeader* header; + NWC24FriendInfo* tmpFriendInfo; - NWC24File file; - u32 fileOffset; + NWC24File file; + u32 fileOffset; if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { return NWC24_ERR_LIB_NOT_OPENED; @@ -278,16 +277,16 @@ NWC24Err NWC24DeleteFriendInfo(u32 index) { } NWC24Err NWC24UpdateFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) { - NWC24Err result; - NWC24Err resultFile; + NWC24Err result; + NWC24Err resultFile; - NWC24FLHeader* header; - NWC24FriendInfo* tmpFriendInfo; + NWC24FLHeader* header; + NWC24FriendInfo* tmpFriendInfo; - NWC24File file; - u32 fileOffset; + NWC24File file; + u32 fileOffset; - int i; + int i; if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { return NWC24_ERR_LIB_NOT_OPENED; @@ -329,14 +328,12 @@ NWC24Err NWC24UpdateFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) { resultFile = NWC24_ERR_PROTECTED; goto out; } - } - else if (friendInfo->attr.type == NWC24_FRIENDTYPE_EMAIL) { + } else if (friendInfo->attr.type == NWC24_FRIENDTYPE_EMAIL) { if (Mail_strnicmp(tmpFriendInfo->addr.mailAddr, friendInfo->addr.mailAddr, sizeof(NWC24UserMailAddr))) { resultFile = NWC24_ERR_PROTECTED; goto out; } - } - else { + } else { resultFile = NWC24_ERR_INVALID_VALUE; goto out; } @@ -362,19 +359,19 @@ out: } NWC24Err NWC24SwapFriendInfos(u32 index1, u32 index2) { - NWC24Err result; - NWC24Err resultFile; + NWC24Err result; + NWC24Err resultFile; - NWC24FLHeader* header; - NWC24FriendInfo* friendInfo1; - NWC24FriendInfo* friendInfo2; + NWC24FLHeader* header; + NWC24FriendInfo* friendInfo1; + NWC24FriendInfo* friendInfo2; - NWC24File file; - u32 fileOffset1; - u32 fileOffset2; + NWC24File file; + u32 fileOffset1; + u32 fileOffset2; - int friendUnkFlag1; - int friendUnkFlag2; + int friendUnkFlag1; + int friendUnkFlag2; if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { return NWC24_ERR_LIB_NOT_OPENED; @@ -414,7 +411,7 @@ NWC24Err NWC24SwapFriendInfos(u32 index1, u32 index2) { if (resultFile == NWC24_OK) { NWC24FSeek(&file, fileOffset2, NWC24_SEEK_BEG); resultFile = NWC24FRead(friendInfo2, sizeof(NWC24FriendInfo), &file); - if (resultFile == NWC24_OK) { + if (resultFile == NWC24_OK) { // Write friend infos NWC24FSeek(&file, fileOffset1, NWC24_SEEK_BEG); resultFile = NWC24FWrite(friendInfo2, sizeof(NWC24FriendInfo), &file); @@ -450,11 +447,11 @@ NWC24Err NWC24SwapFriendInfos(u32 index1, u32 index2) { } NWC24Err NWC24SearchFriendInfoById(NWC24UserId id, u32* index) { - NWC24Err result; + NWC24Err result; - NWC24FLHeader* header; + NWC24FLHeader* header; - u32 i; + u32 i; if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { return NWC24_ERR_LIB_NOT_OPENED; @@ -476,15 +473,15 @@ NWC24Err NWC24SearchFriendInfoById(NWC24UserId id, u32* index) { } NWC24Err NWC24SearchFriendInfoByAddr(const NWC24FriendAddr* addr, u32* index) { - NWC24Err result; + NWC24Err result; - NWC24FLHeader* header; - NWC24FriendInfo* tmpFriendInfo; + NWC24FLHeader* header; + NWC24FriendInfo* tmpFriendInfo; - int cmpResult; + int cmpResult; - u32 i; - NWC24UserId friendValue; + u32 i; + NWC24UserId friendValue; if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { return NWC24_ERR_LIB_NOT_OPENED; @@ -521,9 +518,9 @@ NWC24Err NWC24SearchFriendInfoByAddr(const NWC24FriendAddr* addr, u32* index) { } NWC24Err NWC24GetNumFriendInfos(u32* numFriendInfo) { - NWC24Err result; + NWC24Err result; - NWC24FLHeader* header; + NWC24FLHeader* header; if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { return NWC24_ERR_LIB_NOT_OPENED; @@ -540,9 +537,9 @@ NWC24Err NWC24GetNumFriendInfos(u32* numFriendInfo) { } NWC24Err NWC24GetNumRegFriendInfos(u32* numRegFriendInfo) { - NWC24Err result; + NWC24Err result; - NWC24FLHeader* header; + NWC24FLHeader* header; if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { return NWC24_ERR_LIB_NOT_OPENED; @@ -559,9 +556,9 @@ NWC24Err NWC24GetNumRegFriendInfos(u32* numRegFriendInfo) { } BOOL NWC24IsFriendInfoThere(u32 index) { - NWC24Err result; + NWC24Err result; - NWC24FLHeader* header; + NWC24FLHeader* header; if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { return NWC24_ERR_LIB_NOT_OPENED; @@ -594,7 +591,7 @@ NWC24Err NWC24iInitFriendList(BOOL force) { if (result == NWC24_OK && !force) { return result; } - + if (result == NWC24_ERR_VER_MISMATCH) { result = GetCachedFLHeader(&header); if (header->version > FRIEND_LIST_VERSION) { @@ -607,14 +604,14 @@ NWC24Err NWC24iInitFriendList(BOOL force) { } NWC24Err NWC24iCreateFriendList() { - NWC24Err result; - NWC24Err resultWrite; + NWC24Err result; + NWC24Err resultWrite; - NWC24FLHeader* header; - NWC24FriendInfo* tmpFriendInfo; + NWC24FLHeader* header; + NWC24FriendInfo* tmpFriendInfo; - NWC24File file; - u32 i; + NWC24File file; + u32 i; header = (NWC24FLHeader*)nwc24Work->flHead; tmpFriendInfo = (NWC24FriendInfo*)nwc24Work->mainWork; @@ -661,12 +658,12 @@ NWC24Err NWC24iCreateFriendList() { } NWC24Err NWC24iReadFriendInfoRaw(NWC24FriendInfo* info, u32 index) { - NWC24Err result; - NWC24Err resultFile; + NWC24Err result; + NWC24Err resultFile; - NWC24FLHeader* header; + NWC24FLHeader* header; - NWC24File file; + NWC24File file; if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { return NWC24_ERR_LIB_NOT_OPENED; @@ -711,11 +708,11 @@ NWC24Err NWC24iReadFriendInfoRaw(NWC24FriendInfo* info, u32 index) { } static NWC24Err GetCachedFLHeader(NWC24FLHeader** header) { - NWC24Err result; - NWC24Err resultRead; - NWC24Err resultClose; + NWC24Err result; + NWC24Err resultRead; + NWC24Err resultClose; - NWC24File file; + NWC24File file; *header = (NWC24FLHeader*)nwc24Work->flHead; @@ -731,8 +728,7 @@ static NWC24Err GetCachedFLHeader(NWC24FLHeader** header) { if (resultRead != NWC24_OK) { result = resultRead; - } - else { + } else { result = resultClose; } @@ -753,7 +749,7 @@ static NWC24Err GetCachedFLHeader(NWC24FLHeader** header) { } // Supposed to be a static declaration in NWC24CheckPublicMailAddr but VF's LTO just had to make it global. -const char g_SpecialsChars[11] = { '(', ')', '<', '>', '[', ']', ':', ';', '\\', ',', '"' }; +const char g_SpecialsChars[11] = {'(', ')', '<', '>', '[', ']', ':', ';', '\\', ',', '"'}; NWC24Err NWC24CheckFriendInfo(const NWC24FriendInfo* friendInfo) { NWC24Err result; @@ -761,15 +757,14 @@ NWC24Err NWC24CheckFriendInfo(const NWC24FriendInfo* friendInfo) { if (friendInfo == NULL) { return NWC24_ERR_NULL; } - + if (friendInfo->attr.type != NWC24_FRIENDTYPE_WII) { if (friendInfo->attr.type == NWC24_FRIENDTYPE_EMAIL) { result = NWC24CheckPublicMailAddr(friendInfo->addr.mailAddr); if (result != NWC24_OK) { return result; } - } - else { + } else { return NWC24_ERR_INVALID_VALUE; } } @@ -777,9 +772,9 @@ NWC24Err NWC24CheckFriendInfo(const NWC24FriendInfo* friendInfo) { } NWC24Err NWC24CheckPublicMailAddr(const char* addr) { - int i, j; - int len; - BOOL readingDomain; + int i, j; + int len; + BOOL readingDomain; // static const char specials[] = { '(', ')', '<', '>', '[', ']', ':', ';', '\\', ',', '"' }; @@ -798,7 +793,7 @@ NWC24Err NWC24CheckPublicMailAddr(const char* addr) { } readingDomain = FALSE; - + for (i = 0; i < len; i++) { char ch = addr[i]; @@ -813,7 +808,7 @@ NWC24Err NWC24CheckPublicMailAddr(const char* addr) { } // If the character is not a letter or symbol, invalid! - if (ch <= ' ' || ch >= '~'+1) { + if (ch <= ' ' || ch >= '~' + 1) { return NWC24_ERR_FORMAT; } @@ -831,16 +826,16 @@ NWC24Err NWC24CheckPublicMailAddr(const char* addr) { } // If the hostname is not valid, invalid! - if (CheckHostName(&addr[i+1], (len - i)) < CHECK_HOSTNAME_SUCCESS) { + if (CheckHostName(&addr[i + 1], (len - i)) < CHECK_HOSTNAME_SUCCESS) { return NWC24_ERR_FORMAT; } - return Mail_strnicmp(&addr[i], NWC24GetAccountDomain(), (len - i)+1) == 0 ? NWC24_ERR_PROTECTED : NWC24_OK; + return Mail_strnicmp(&addr[i], NWC24GetAccountDomain(), (len - i) + 1) == 0 ? NWC24_ERR_PROTECTED : NWC24_OK; } static ChkHostNameError CheckHostName(const char* hostName, u32 hostNameLength) { - int i; - BOOL foundDot; + int i; + BOOL foundDot; // Parameter check if (hostNameLength == 0) { @@ -880,9 +875,7 @@ static ChkHostNameError CheckHostName(const char* hostName, u32 hostNameLength) } // Check if there are invalid characters - if ((ch < '0' || ch > '9') - && (ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z') - && (ch != '-' && ch != '_')) { + if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z') && (ch != '-' && ch != '_')) { return CHECK_HOSTNAME_INVALID_CHARACTERS; } @@ -895,7 +888,7 @@ static ChkHostNameError CheckHostName(const char* hostName, u32 hostNameLength) } // Check if the end of hostname has a dot - if (i > 0 && hostName[i-1] == '.') { + if (i > 0 && hostName[i - 1] == '.') { return CHECK_HOSTNAME_DOT_AT_END; } diff --git a/libs/RevoEX/src/nwc24/NWC24Ipc.c b/libs/RevoEX/src/nwc24/NWC24Ipc.c index fe58d231..4e1640f5 100644 --- a/libs/RevoEX/src/nwc24/NWC24Ipc.c +++ b/libs/RevoEX/src/nwc24/NWC24Ipc.c @@ -1,5 +1,5 @@ -#include #include +#include #include #include @@ -48,7 +48,8 @@ NWC24Err NWC24iIoctlResourceManager(const char* funcName, s32 fd, s32 cmd, void* return NWC24_OK; } -NWC24Err NWC24iIoctlResourceManagerAsync(const char* funcName, s32 fd, s32 cmd, void* input, u32 input_bytes, void* output, u32 output_bytes, s32* ret) { +NWC24Err NWC24iIoctlResourceManagerAsync(const char* funcName, s32 fd, s32 cmd, void* input, u32 input_bytes, void* output, u32 output_bytes, + s32* ret) { s32 err = IOS_IoctlAsync(fd, cmd, input, input_bytes, output, output_bytes, CallbackAsyncIpc, ret); if (err < IPC_RESULT_OK) { return NWC24_ERR_INTERNAL_IPC; diff --git a/libs/RevoEX/src/nwc24/NWC24Manage.c b/libs/RevoEX/src/nwc24/NWC24Manage.c index 74999d06..0dab9780 100644 --- a/libs/RevoEX/src/nwc24/NWC24Manage.c +++ b/libs/RevoEX/src/nwc24/NWC24Manage.c @@ -1,23 +1,14 @@ -#include #include +#include -#include #include +#include #define MANAGE_ERROR_CODE_BASE 109000 -enum { - NWC24_LIB_CLOSED, - NWC24_LIB_OPENED, - NWC24_LIB_OPENED_BY_TOOL, - NWC24_LIB_BLOCKED -}; +enum { NWC24_LIB_CLOSED, NWC24_LIB_OPENED, NWC24_LIB_OPENED_BY_TOOL, NWC24_LIB_BLOCKED }; -enum { - NWC24_FAIL_SFL = (1 << 0), - NWC24_FAIL_DL_TASK = (1 << 1), - NWC24_FAIL_FATAL = (1 << 2) -}; +enum { NWC24_FAIL_SFL = (1 << 0), NWC24_FAIL_DL_TASK = (1 << 1), NWC24_FAIL_FATAL = (1 << 2) }; SDKDefineVersion(NWC24, "Dec 12 2008", "03:06:06"); @@ -120,8 +111,7 @@ static NWC24Err NWC24OpenLibInternal(NWC24Work* work, s32 state) { if (result == NWC24_ERR_FILE_NOEXISTS) { failFlag |= NWC24_FAIL_FATAL; - } - else { + } else { failFlag |= NWC24_FAIL_SFL; } } @@ -132,8 +122,7 @@ static NWC24Err NWC24OpenLibInternal(NWC24Work* work, s32 state) { if (result == NWC24_ERR_FILE_NOEXISTS) { failFlag |= NWC24_FAIL_FATAL; - } - else { + } else { failFlag |= NWC24_FAIL_DL_TASK; } } @@ -146,8 +135,7 @@ static NWC24Err NWC24OpenLibInternal(NWC24Work* work, s32 state) { NWC24WorkP = NULL; NWC24iResumeForCloseLib(); result = failErr; - } - else { + } else { Opened = state; return NWC24_OK; } @@ -257,19 +245,15 @@ NWC24Err NWC24BlockOpenMsgLib(BOOL block) { if (block) { if (Opened == NWC24_LIB_CLOSED) { Opened = NWC24_LIB_BLOCKED; - } - else if (Opened == NWC24_LIB_OPENED) { + } else if (Opened == NWC24_LIB_OPENED) { result = NWC24_ERR_LIB_OPENED; - } - else { + } else { result = NWC24_ERR_BUSY; } - } - else { + } else { if (Opened == NWC24_LIB_BLOCKED) { Opened = NWC24_LIB_CLOSED; - } - else { + } else { result = NWC24_ERR_LIB_NOT_OPENED; } } @@ -290,8 +274,7 @@ NWC24Err NWC24GetSchedulerError(s32* numErrors, s32* errorCode) { if ((lastTick & 0xFFFF0000) == (curTick & 0xFFFF0000)) { result = NWC24_OK; - } - else { + } else { lastTick = curTick; result = NWC24iGetSchedulerStat((NWC24ScdStat*)InternalStatBuf, sizeof(InternalStatBuf)); } @@ -321,7 +304,7 @@ NWC24Err AnalyzeErrorCode(s32 errorCode, u32 usage, u32* score) { tmp = tmp / 10; } - //If the code is 5XXXX, it is an NCD error + // If the code is 5XXXX, it is an NCD error if (digit[5] == 0 && digit[4] == 5) { *score = 60; return NWC24_ERR_NETWORK; @@ -331,8 +314,7 @@ NWC24Err AnalyzeErrorCode(s32 errorCode, u32 usage, u32* score) { if ((usage & 2) == 0) { return NWC24_OK; } - } - else { + } else { if ((usage & 1) == 0) { return NWC24_OK; } diff --git a/libs/RevoEX/src/nwc24/NWC24MsgObj.c b/libs/RevoEX/src/nwc24/NWC24MsgObj.c index 730fac83..22220bd0 100644 --- a/libs/RevoEX/src/nwc24/NWC24MsgObj.c +++ b/libs/RevoEX/src/nwc24/NWC24MsgObj.c @@ -1,5 +1,5 @@ -#include #include +#include #define ALT_NAME_MAX 35 #define SMTP_LINE_MAX 1000 @@ -28,8 +28,7 @@ NWC24Err NWC24InitMsgObj(NWC24MsgObj* msg, NWC24MsgType type) { switch (type) { case NWC24_MSGTYPE_RVL_MENU_SHARED: - msgObj->type |= - MSG_OBJ_FOR_RECIPIENT | MSG_OBJ_FOR_APP | MSG_OBJ_FOR_MENU; + msgObj->type |= MSG_OBJ_FOR_RECIPIENT | MSG_OBJ_FOR_APP | MSG_OBJ_FOR_MENU; break; case NWC24_MSGTYPE_RVL: msgObj->type |= MSG_OBJ_FOR_RECIPIENT | MSG_OBJ_FOR_APP; @@ -57,8 +56,7 @@ NWC24Err NWC24InitMsgObj(NWC24MsgObj* msg, NWC24MsgType type) { for (i = 0; i < NWC24_MSG_RECIPIENT_MAX; i++) { if (type == NWC24_MSGTYPE_PUBLIC) { NWC24Data_Init(&msgObj->toAddrs[i]); - } - else { + } else { msgObj->toIds[i] = 0; } } @@ -83,7 +81,7 @@ NWC24Err NWC24InitMsgObj(NWC24MsgObj* msg, NWC24MsgType type) { NWC24Data_Init(&msgObj->faceData); NWC24Data_Init(&msgObj->altName); - msgObj->msgBoardFlags.raw = 0; + msgObj->msgBoardFlags.raw = 0; msgObj->dwcId = 0; msgObj->iconNew = (1 << 31); @@ -92,8 +90,7 @@ NWC24Err NWC24InitMsgObj(NWC24MsgObj* msg, NWC24MsgType type) { NWC24Err NWC24SetMsgToId(NWC24MsgObj* msg, NWC24UserId id) { NWC24MsgObjPrivate* msgObj = (NWC24MsgObjPrivate*)msg; - if (!(msgObj->type & MSG_OBJ_INITIALIZED) || - (msgObj->type & MSG_OBJ_DELIVERING)) { + if (!(msgObj->type & MSG_OBJ_INITIALIZED) || (msgObj->type & MSG_OBJ_DELIVERING)) { return NWC24_ERR_PROTECTED; } diff --git a/libs/RevoEX/src/nwc24/NWC24Parser.c b/libs/RevoEX/src/nwc24/NWC24Parser.c index b94beef9..132b85a2 100644 --- a/libs/RevoEX/src/nwc24/NWC24Parser.c +++ b/libs/RevoEX/src/nwc24/NWC24Parser.c @@ -1,104 +1,37 @@ -#include #include +#include -const char* MIMETypeStr[] = { - "application/octet-stream", - "application/x-wii-minidata", - "application/x-wii-msgboard", - "image/jpeg", - "image/x-wii-picture", - "multipart/alternative", - "multipart/mixed", - "multipart/related", - "text/html", - "text/plain" -}; +const char* MIMETypeStr[] = {"application/octet-stream", + "application/x-wii-minidata", + "application/x-wii-msgboard", + "image/jpeg", + "image/x-wii-picture", + "multipart/alternative", + "multipart/mixed", + "multipart/related", + "text/html", + "text/plain"}; -NWC24MIMEType MIMETypeConv[] = { - NWC24_APPLICATION_OCTET_STREAM, - NWC24_X_WII_MINIDATA, - NWC24_X_WII_MSGBOARD, - NWC24_IMAGE_JPEG, - NWC24_X_WII_PICTURE, - NWC24_MULTIPART_ALTERNATIVE, - NWC24_MULTIPART_MIXED, - NWC24_MULTIPART_RELATED, - NWC24_TEXT_HTML, - NWC24_TEXT_PLAIN -}; +NWC24MIMEType MIMETypeConv[] = {NWC24_APPLICATION_OCTET_STREAM, NWC24_X_WII_MINIDATA, NWC24_X_WII_MSGBOARD, NWC24_IMAGE_JPEG, NWC24_X_WII_PICTURE, + NWC24_MULTIPART_ALTERNATIVE, NWC24_MULTIPART_MIXED, NWC24_MULTIPART_RELATED, NWC24_TEXT_HTML, NWC24_TEXT_PLAIN}; -const char* MIMETypeSuffix[] = { - "dat", - "wii", - "wii", - "jpg", - "wii", - "???", - "???", - "???", - "htm", - "txt" -}; +const char* MIMETypeSuffix[] = {"dat", "wii", "wii", "jpg", "wii", "???", "???", "???", "htm", "txt"}; -const char* CharsetStr[] = { - "euc-jp", - "euc-kr", - "gb2312", - "iso-2022-jp", - "iso-8859-1", - "iso-8859-10", - "iso-8859-15", - "iso-8859-2", - "iso-8859-3", - "iso-8859-5", - "iso-8859-7", - "iso-8859-9", - "shift_jis", - "us-ascii", - "utf-16be", - "utf-32be", - "utf-8", - "windows-1252" -}; +const char* CharsetStr[] = {"euc-jp", "euc-kr", "gb2312", "iso-2022-jp", "iso-8859-1", "iso-8859-10", + "iso-8859-15", "iso-8859-2", "iso-8859-3", "iso-8859-5", "iso-8859-7", "iso-8859-9", + "shift_jis", "us-ascii", "utf-16be", "utf-32be", "utf-8", "windows-1252"}; -NWC24Charset CharsetConv[] = { - NWC24_EUC_JP, - NWC24_EUC_US, - NWC24_GB_2312, - NWC24_ISO_2022_JP, - NWC24_ISO_8859_1, - NWC24_ISO_8859_10, - NWC24_ISO_8859_15, - NWC24_ISO_8859_2, - NWC24_ISO_8859_3, - NWC24_ISO_8859_5, - NWC24_ISO_8859_7, - NWC24_ISO_8859_9, - NWC24_SHIFT_JIS, - NWC24_US_ASCII, - NWC24_UTF_16BE, - NWC24_UTF_32BE, - NWC24_UTF_8, - NWC24_WINDOWS_1252 -}; +NWC24Charset CharsetConv[] = {NWC24_EUC_JP, NWC24_EUC_US, NWC24_GB_2312, NWC24_ISO_2022_JP, NWC24_ISO_8859_1, NWC24_ISO_8859_10, + NWC24_ISO_8859_15, NWC24_ISO_8859_2, NWC24_ISO_8859_3, NWC24_ISO_8859_5, NWC24_ISO_8859_7, NWC24_ISO_8859_9, + NWC24_SHIFT_JIS, NWC24_US_ASCII, NWC24_UTF_16BE, NWC24_UTF_32BE, NWC24_UTF_8, NWC24_WINDOWS_1252}; -const char* EncodingStr[] = { - "7bit", - "8bit", - "base64", - "quoted-printable" -}; +const char* EncodingStr[] = {"7bit", "8bit", "base64", "quoted-printable"}; -NWC24Encoding EncodingConv[] = { - NWC24_ENC_7BIT, - NWC24_ENC_8BIT, - NWC24_ENC_BASE64, - NWC24_ENC_QUOTED_PRINTABLE -}; +NWC24Encoding EncodingConv[] = {NWC24_ENC_7BIT, NWC24_ENC_8BIT, NWC24_ENC_BASE64, NWC24_ENC_QUOTED_PRINTABLE}; -static int StrCmpNCS(const char* string1, const char* string2); -static int StrCmpMultiNCS(const char* string1, const char** string2Array, int count); -static int GetFieldLengthF(NWC24FileStream* fileStream); +static int StrCmpNCS(const char* string1, const char* string2); +static int StrCmpMultiNCS(const char* string1, const char** string2Array, int count); +static int GetFieldLengthF(NWC24FileStream* fileStream); const char* NWC24GetMIMETypeStr(NWC24MIMEType type) { NWC24MIMEType* conv; @@ -169,13 +102,13 @@ NWC24Err NWC24ParseEncodingStr(NWC24Encoding* encoding, const char* str) { } NWC24Err NWC24iExtractAddrSpec(NWC24FileStream* fileStream, u32 fullAddrLen, u32 startIdx, char* newAddr, u32 newAddrLen) { - NWC24Err err = NWC24_ERR_NOT_FOUND; - u32 sizeLeft; + NWC24Err err = NWC24_ERR_NOT_FOUND; + u32 sizeLeft; - u32 i = 0; - int bufIdx = 0; - int flag = 0; - BOOL foundAtCh = FALSE; + u32 i = 0; + int bufIdx = 0; + int flag = 0; + BOOL foundAtCh = FALSE; for (sizeLeft = fullAddrLen; sizeLeft != 0; sizeLeft--) { char ch = NWC24FStreamGetc(fileStream); @@ -183,8 +116,7 @@ NWC24Err NWC24iExtractAddrSpec(NWC24FileStream* fileStream, u32 fullAddrLen, u32 i++; if (i > startIdx) { err = NWC24_OK; - } - else { + } else { foundAtCh = FALSE; continue; } @@ -210,14 +142,12 @@ NWC24Err NWC24iExtractAddrSpec(NWC24FileStream* fileStream, u32 fullAddrLen, u32 } if (ch == '>') { err = NWC24_OK; - } - else if (bufIdx >= newAddrLen-1) { + } else if (bufIdx >= newAddrLen - 1) { err = NWC24_ERR_OVERFLOW; - } - else { + } else { if (ch == '@') { // foundAtCh = TRUE; - foundAtCh += TRUE; // ok. + foundAtCh += TRUE; // ok. } newAddr[bufIdx++] = ch; continue; @@ -257,7 +187,7 @@ NWC24Err NWC24iSearchHeaderF(NWC24FileStream* fileStream, const char* fieldName, err = NWC24_ERR_FORMAT; break; } - + NWC24FStreamSeek(fileStream, fieldIdx); NWC24FStreamGetPtr(fileStream, &readName, fieldLen); @@ -334,9 +264,9 @@ int StrCmpMultiNCS(const char* string1, const char** string2Array, int count) { } int GetFieldLengthF(NWC24FileStream* fileStream) { - int count = 0; - u32 state = 0; - u32 letters = 0; + int count = 0; + u32 state = 0; + u32 letters = 0; while (TRUE) { char ch = NWC24FStreamGetc(fileStream); @@ -350,11 +280,9 @@ int GetFieldLengthF(NWC24FileStream* fileStream) { if (ch == '\r') { state |= 1; - } - else if (ch == '\n') { + } else if (ch == '\n') { state <<= 1; - } - else { + } else { state = 0; letters++; } diff --git a/libs/RevoEX/src/nwc24/NWC24Schedule.c b/libs/RevoEX/src/nwc24/NWC24Schedule.c index 5bee061d..25ba2026 100644 --- a/libs/RevoEX/src/nwc24/NWC24Schedule.c +++ b/libs/RevoEX/src/nwc24/NWC24Schedule.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -61,8 +61,7 @@ s32 NWC24ResumeScheduler() { { if (nwc24ScdOpenCnt > 0 && nwc24ScdSuspendCnt == 0) { count = 0; - } - else { + } else { count = ExecResumeScheduler(); if (nwc24ScdSuspendCnt > 0) { @@ -77,9 +76,9 @@ s32 NWC24ResumeScheduler() { } NWC24Err NWC24iGetSchedulerStat(NWC24ScdStat* scdStat, u32 scdStatSize) { - IOSFd fd; - NWC24Err result; - NWC24Err resultClose; + IOSFd fd; + NWC24Err result; + NWC24Err resultClose; if (scdStatSize > sizeof(NWC24ScdStat)) { return NWC24_ERR_OVERFLOW; @@ -94,8 +93,7 @@ NWC24Err NWC24iGetSchedulerStat(NWC24ScdStat* scdStat, u32 scdStatSize) { result = NWC24OpenResourceManager("/dev/net/kd/request", &fd, 0); if (result >= 0) { - result = NWC24IoctlResourceManager(fd, 30, NULL, 0, - scdStat, scdStatSize); + result = NWC24IoctlResourceManager(fd, 30, NULL, 0, scdStat, scdStatSize); if (result >= 0) { result = scdStat->result; @@ -117,9 +115,9 @@ NWC24Err NWC24iGetSchedulerStat(NWC24ScdStat* scdStat, u32 scdStatSize) { } NWC24Err NWC24iSetScriptMode(int mode) { - IOSFd fd; - NWC24Err result; - NWC24Err resultClose; + IOSFd fd; + NWC24Err result; + NWC24Err resultClose; result = CHECK_CALLING_STATUS(FALSE); if (result < 0) { @@ -135,8 +133,8 @@ NWC24Err NWC24iSetScriptMode(int mode) { if (result >= 0) { *(int*)(&nwc24ScdCommonBuffer[0]) = mode; - result = NWC24IoctlResourceManager(fd, 34, nwc24ScdCommonBuffer, sizeof(nwc24ScdCommonBuffer), - nwc24ScdCommonResult, sizeof(nwc24ScdCommonResult)); + result = NWC24IoctlResourceManager(fd, 34, nwc24ScdCommonBuffer, sizeof(nwc24ScdCommonBuffer), nwc24ScdCommonResult, + sizeof(nwc24ScdCommonResult)); if (result >= 0) { result = *(s32*)(&nwc24ScdCommonResult[0]); @@ -160,12 +158,12 @@ NWC24Err NWC24AdjustUniversalTime() { NWC24Err NWC24ExecDownloadTask(u32 flags, u16 taskId, u32 subTaskMask) { static const char* pTempName = "dlcnt.bin"; - NWC24Err result = NWC24_OK; + NWC24Err result = NWC24_OK; - BOOL saveMail; - u32 numErrors; + BOOL saveMail; + u32 numErrors; - NANDStatus status; + NANDStatus status; saveMail = result; @@ -183,8 +181,7 @@ NWC24Err NWC24ExecDownloadTask(u32 flags, u16 taskId, u32 subTaskMask) { result = NWC24iDownloadNowEx(&saveMail, flags, taskId, subTaskMask); if (result >= NWC24_OK && saveMail) { result = NWC24iSaveMailNow(); - } - else if (result == NWC24_ERR_PROTECTED) { + } else if (result == NWC24_ERR_PROTECTED) { // Stripped out but left out if statement u32 dummy = 0; } @@ -192,12 +189,10 @@ NWC24Err NWC24ExecDownloadTask(u32 flags, u16 taskId, u32 subTaskMask) { if (result < NWC24_OK) { if (NWC24iGetSchedulerStat(&nwc24ScdStatBuf, sizeof(nwc24ScdStatBuf)) >= NWC24_OK) { NWC24iSetErrorCode(nwc24ScdStatBuf.errorLog[numErrors]); - } - else { + } else { NWC24iSetErrorCode(result - 107200); } - } - else { + } else { NWC24iSetErrorCode(0); } @@ -205,9 +200,9 @@ NWC24Err NWC24ExecDownloadTask(u32 flags, u16 taskId, u32 subTaskMask) { } NWC24Err NWC24iRequestGenerateUserId(NWC24UserId* pId, u32* arg1) { - IOSFd fd; - NWC24Err result; - NWC24Err resultClose; + IOSFd fd; + NWC24Err result; + NWC24Err resultClose; result = CHECK_CALLING_STATUS(TRUE); if (result < 0) { @@ -219,8 +214,7 @@ NWC24Err NWC24iRequestGenerateUserId(NWC24UserId* pId, u32* arg1) { result = NWC24OpenResourceManager("/dev/net/kd/request", &fd, 0); if (result >= 0) { - result = NWC24IoctlResourceManager(fd, NWC24_IOCTL_GENERATE_USER_ID, NULL, 0, - nwc24ScdCommonResult, sizeof(nwc24ScdCommonResult)); + result = NWC24IoctlResourceManager(fd, NWC24_IOCTL_GENERATE_USER_ID, NULL, 0, nwc24ScdCommonResult, sizeof(nwc24ScdCommonResult)); if (result >= 0) { result = *(s32*)(&nwc24ScdCommonResult[0]); @@ -247,9 +241,9 @@ NWC24Err NWC24iRequestGenerateUserId(NWC24UserId* pId, u32* arg1) { } NWC24Err NWC24iRequestRegisterUserId() { - IOSFd fd; - NWC24Err result; - NWC24Err resultClose; + IOSFd fd; + NWC24Err result; + NWC24Err resultClose; result = CHECK_CALLING_STATUS(TRUE); if (result < 0) { @@ -261,8 +255,7 @@ NWC24Err NWC24iRequestRegisterUserId() { result = NWC24OpenResourceManager("/dev/net/kd/request", &fd, 0); if (result >= 0) { - result = NWC24IoctlResourceManager(fd, 16, NULL, 0, - nwc24ScdCommonResult, sizeof(nwc24ScdCommonResult)); + result = NWC24IoctlResourceManager(fd, 16, NULL, 0, nwc24ScdCommonResult, sizeof(nwc24ScdCommonResult)); if (result >= 0) { result = *(s32*)(&nwc24ScdCommonResult[0]); @@ -304,9 +297,9 @@ NWC24Err NWC24iSaveMailNow() { } NWC24Err NWC24iDownloadNowEx(BOOL* saveMail, u32 flags, u16 taskId, u32 subTaskMask) { - IOSFd fd; - NWC24Err result; - NWC24Err resultClose; + IOSFd fd; + NWC24Err result; + NWC24Err resultClose; result = CHECK_CALLING_STATUS(FALSE); if (result < 0) { @@ -321,8 +314,8 @@ NWC24Err NWC24iDownloadNowEx(BOOL* saveMail, u32 flags, u16 taskId, u32 subTaskM *(u32*)(&nwc24ScdCommonBuffer[0]) = flags; *(u32*)(&nwc24ScdCommonBuffer[1]) = taskId; *(u32*)(&nwc24ScdCommonBuffer[2]) = subTaskMask; - result = NWC24IoctlResourceManager(fd, 14, nwc24ScdCommonBuffer, sizeof(nwc24ScdCommonBuffer), - nwc24ScdCommonResult, sizeof(nwc24ScdCommonResult)); + result = NWC24IoctlResourceManager(fd, 14, nwc24ScdCommonBuffer, sizeof(nwc24ScdCommonBuffer), nwc24ScdCommonResult, + sizeof(nwc24ScdCommonResult)); if (result >= 0) { result = *(s32*)(&nwc24ScdCommonResult[0]); @@ -379,9 +372,9 @@ static NWC24Err ExecSuspendScheduler() { } static NWC24Err ExecTrySuspendScheduler(u32 flags) { - IOSFd fd; - NWC24Err result; - NWC24Err resultClose; + IOSFd fd; + NWC24Err result; + NWC24Err resultClose; result = CHECK_CALLING_STATUS(TRUE); if (result < 0) { @@ -398,7 +391,7 @@ static NWC24Err ExecTrySuspendScheduler(u32 flags) { *(u32*)(&nwc24ScdCommonBuffer[0]) = flags; result = NWC24IoctlResourceManager(fd, NWC24_IOCTL_TRY_SUSPEND_SCHEDULER, nwc24ScdCommonBuffer, sizeof(nwc24ScdCommonBuffer), - nwc24ScdCommonResult, sizeof(nwc24ScdCommonResult)); + nwc24ScdCommonResult, sizeof(nwc24ScdCommonResult)); if (result >= 0) { result = ((s32*)nwc24ScdCommonResult)[0]; @@ -429,20 +422,15 @@ static NWC24Err ExecNoParamCommand(const char* funcName, s32 command, s32* exErr LockRight(); { - result = NWC24iOpenResourceManager(funcName, "/dev/net/kd/request", &fd, - 0); + result = NWC24iOpenResourceManager(funcName, "/dev/net/kd/request", &fd, 0); if (result >= 0) { - result = NWC24iIoctlResourceManager(funcName, fd, command, NULL, 0, - nwc24ScdCommonResult, - sizeof(nwc24ScdCommonResult)); + result = NWC24iIoctlResourceManager(funcName, fd, command, NULL, 0, nwc24ScdCommonResult, sizeof(nwc24ScdCommonResult)); if (result >= 0) { result = ((s32*)nwc24ScdCommonResult)[0]; - if (result == NWC24_ERR_FAILED || - result == NWC24_ERR_CONFIG_NETWORK) { - + if (result == NWC24_ERR_FAILED || result == NWC24_ERR_CONFIG_NETWORK) { if (exErr != (void*)NULL) { *exErr = *(u32*)(&nwc24ScdCommonResult[1]); } diff --git a/libs/RevoEX/src/nwc24/NWC24SecretFList.c b/libs/RevoEX/src/nwc24/NWC24SecretFList.c index 72e07823..c6ea6715 100644 --- a/libs/RevoEX/src/nwc24/NWC24SecretFList.c +++ b/libs/RevoEX/src/nwc24/NWC24SecretFList.c @@ -1,8 +1,8 @@ -#include #include +#include -#define SECRET_FRIEND_LIST_MAGIC 'WcFs' -#define SECRET_FRIEND_LIST_VERSION 2 +#define SECRET_FRIEND_LIST_MAGIC 'WcFs' +#define SECRET_FRIEND_LIST_VERSION 2 static const char* FLFilePath = "/shared2/wc24/nwc24fls.bin"; @@ -24,7 +24,7 @@ NWC24Err NWC24iInitSecretFriendList(BOOL force) { if (result == NWC24_OK && !force) { return result; } - + if (result == NWC24_ERR_VER_MISMATCH) { result = GetCachedSecretFLHeader(&header); if (header->version > SECRET_FRIEND_LIST_VERSION) { @@ -37,14 +37,14 @@ NWC24Err NWC24iInitSecretFriendList(BOOL force) { } NWC24Err NWC24iCreateSecretFriendList() { - NWC24Err result; - NWC24Err resultWrite; + NWC24Err result; + NWC24Err resultWrite; - NWC24SecretFLHeader* header; - NWC24SecretFriendInfo* tmpFriendInfo; + NWC24SecretFLHeader* header; + NWC24SecretFriendInfo* tmpFriendInfo; - NWC24File file; - u32 i; + NWC24File file; + u32 i; header = (NWC24SecretFLHeader*)nwc24Work->secretFlHead; Mail_memset(header, 0, sizeof(NWC24SecretFLHeader)); @@ -83,11 +83,11 @@ NWC24Err NWC24iCreateSecretFriendList() { } static NWC24Err GetCachedSecretFLHeader(NWC24SecretFLHeader** header) { - NWC24Err result; - NWC24Err resultRead; - NWC24Err resultClose; + NWC24Err result; + NWC24Err resultRead; + NWC24Err resultClose; - NWC24File file; + NWC24File file; *header = (NWC24SecretFLHeader*)nwc24Work->secretFlHead; @@ -103,8 +103,7 @@ static NWC24Err GetCachedSecretFLHeader(NWC24SecretFLHeader** header) { if (resultRead != NWC24_OK) { result = resultRead; - } - else { + } else { result = resultClose; } diff --git a/libs/RevoEX/src/nwc24/NWC24StdAPI.c b/libs/RevoEX/src/nwc24/NWC24StdAPI.c index cc452530..3f4c47e2 100644 --- a/libs/RevoEX/src/nwc24/NWC24StdAPI.c +++ b/libs/RevoEX/src/nwc24/NWC24StdAPI.c @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -17,7 +17,8 @@ char* Mail_strcpy(char* dest, const char* src) { int Mail_strlen(const char* str) { int i; - for (i = 0; *str != 0; i++, str++) {} + for (i = 0; *str != 0; i++, str++) { + } return i; } diff --git a/libs/RevoEX/src/nwc24/NWC24Stream.c b/libs/RevoEX/src/nwc24/NWC24Stream.c index 2750e738..afb08a16 100644 --- a/libs/RevoEX/src/nwc24/NWC24Stream.c +++ b/libs/RevoEX/src/nwc24/NWC24Stream.c @@ -1,5 +1,5 @@ -#include #include +#include #include diff --git a/libs/RevoEX/src/nwc24/NWC24Time.c b/libs/RevoEX/src/nwc24/NWC24Time.c index 1dacc45e..6a8dbb69 100644 --- a/libs/RevoEX/src/nwc24/NWC24Time.c +++ b/libs/RevoEX/src/nwc24/NWC24Time.c @@ -1,8 +1,8 @@ -#include #include +#include -#include #include +#include #include @@ -39,10 +39,7 @@ NWC24Err NWC24iGetUniversalTime(s64* pTime) { return NWC24_ERR_INVALID_VALUE; } - if (whenCached == 0 || - whenCached + OSSecondsToTicks(1) <= __OSGetSystemTime() || - nwc24TimeRtc == 0) { - + if (whenCached == 0 || whenCached + OSSecondsToTicks(1) <= __OSGetSystemTime() || nwc24TimeRtc == 0) { result = NWC24iGetTimeDifference(&nwc24TimeDifference); if (result < 0) { return result; @@ -76,9 +73,7 @@ NWC24Err NWC24iGetTimeDifference(s64* pDiff) { result = NWC24OpenResourceManager("/dev/net/kd/time", &fd, 0); if (result >= 0) { - result = NWC24IoctlResourceManager(fd, NWC24_IOCTL_GET_TIME_DIFFERENCE, - NULL, 0, &nwc24TimeCommonResult, - sizeof(nwc24TimeCommonResult)); + result = NWC24IoctlResourceManager(fd, NWC24_IOCTL_GET_TIME_DIFFERENCE, NULL, 0, &nwc24TimeCommonResult, sizeof(nwc24TimeCommonResult)); if (result >= 0) { result = *(s32*)(&nwc24TimeCommonResult[0]); @@ -119,10 +114,8 @@ NWC24Err NWC24iSetRtcCounter(u32 rtcCounter, u32 flags) { *(u32*)(&nwc24TimeCommonBuffer[0]) = rtcCounter; *(u32*)(&nwc24TimeCommonBuffer[1]) = flags; - result = NWC24IoctlResourceManager( - fd, NWC24_IOCTL_SET_RTC_COUNTER, &nwc24TimeCommonBuffer, - sizeof(nwc24TimeCommonBuffer), &nwc24TimeCommonResult, - sizeof(nwc24TimeCommonResult)); + result = NWC24IoctlResourceManager(fd, NWC24_IOCTL_SET_RTC_COUNTER, &nwc24TimeCommonBuffer, sizeof(nwc24TimeCommonBuffer), + &nwc24TimeCommonResult, sizeof(nwc24TimeCommonResult)); if (result >= 0) { result = *(s32*)(&nwc24TimeCommonResult[0]); diff --git a/libs/RevoEX/src/nwc24/NWC24UserId.c b/libs/RevoEX/src/nwc24/NWC24UserId.c index 7e966fe6..a9aea472 100644 --- a/libs/RevoEX/src/nwc24/NWC24UserId.c +++ b/libs/RevoEX/src/nwc24/NWC24UserId.c @@ -1,14 +1,14 @@ -#include #include +#include -const u8 TtableInv[] = { 13, 5, 9, 7, 0, 15, 10, 2, 12, 3, 14, 1, 8, 6, 11, 4 }; -const u8 ExcTable[] = { 1, 5, 0, 4, 2, 3, 6, 7 }; +const u8 TtableInv[] = {13, 5, 9, 7, 0, 15, 10, 2, 12, 3, 14, 1, 8, 6, 11, 4}; +const u8 ExcTable[] = {1, 5, 0, 4, 2, 3, 6, 7}; -static u8 getbyte(NWC24UserId value, u8 index); -static NWC24UserId setbyte(NWC24UserId value, u8 index, u8 set); +static u8 getbyte(NWC24UserId value, u8 index); +static NWC24UserId setbyte(NWC24UserId value, u8 index, u8 set); -NWC24UserId getUnScrambleId(NWC24UserId id); -static int checkCRC(NWC24UserId id); +NWC24UserId getUnScrambleId(NWC24UserId id); +static int checkCRC(NWC24UserId id); static u8 getbyte(NWC24UserId value, u8 index) { return (value >> (index * 8)) & 0xFF; diff --git a/libs/RevoEX/src/nwc24/NWC24Utils.c b/libs/RevoEX/src/nwc24/NWC24Utils.c index d005f41d..7c0de473 100644 --- a/libs/RevoEX/src/nwc24/NWC24Utils.c +++ b/libs/RevoEX/src/nwc24/NWC24Utils.c @@ -1,5 +1,5 @@ -#include #include +#include void NWC24Data_Init(NWC24Data* data) { data->ptr = NULL; @@ -43,7 +43,7 @@ NWC24Err NWC24iCheckStringLength(const char* str, int minLen, int maxLen) { return NWC24_ERR_NULL; } - len = STD_strnlen(str, maxLen+1); + len = STD_strnlen(str, maxLen + 1); if (len == 0) { return NWC24_ERR_NULL; } @@ -62,14 +62,14 @@ s32 NWC24iStrLCpy(char* dest, const char* src, s32 len) { return 0; } - for (i = 0; i+1 < len; src++, i++) { + for (i = 0; i + 1 < len; src++, i++) { dest[i] = *src; if (*src == 0) { break; } } - if (i+1 >= len && len != 0) { + if (i + 1 >= len && len != 0) { dest[i] = 0; } diff --git a/libs/RevoEX/src/ssl/ssl_api.c b/libs/RevoEX/src/ssl/ssl_api.c index 709d6aee..da761c03 100644 --- a/libs/RevoEX/src/ssl/ssl_api.c +++ b/libs/RevoEX/src/ssl/ssl_api.c @@ -1,16 +1,16 @@ -#include #include +#include -#include #include +#include -#include #include +#include #include #define MAX_VECTOR_ARGS 4 -#define OPEN_SSL_IOS() IOS_Open("/dev/net/ssl", 0) +#define OPEN_SSL_IOS() IOS_Open("/dev/net/ssl", 0) enum { SSL_IOCTVL_NEW = 1, @@ -27,19 +27,19 @@ enum { SDKDefineVersionEx(SSL, "Jun 21 2007", "13:10:10", 60726); -static BOOL sslRegistered = FALSE; -static s32 l_initialized = FALSE; +static BOOL sslRegistered = FALSE; +static s32 l_initialized = FALSE; -static OSMutex l_mutex; +static OSMutex l_mutex; -static char l_cert_data[SSL_ROOT_CA_LENGTH] ALIGN32; -static char l_private_key_data[SSL_PRIVATE_KEY_LENGTH] ALIGN32; -static char l_root_ca[SSL_CLIENT_CERT_LENGTH] ALIGN32; +static char l_cert_data[SSL_ROOT_CA_LENGTH] ALIGN32; +static char l_private_key_data[SSL_PRIVATE_KEY_LENGTH] ALIGN32; +static char l_root_ca[SSL_CLIENT_CERT_LENGTH] ALIGN32; -static u32 SSL_strnlen(const char* s, u32 maxlen); +static u32 SSL_strnlen(const char* s, u32 maxlen); -static int SSL_read(s32 fd, SSLId i_sslId, char* o_buf, u32 i_bufSize); -static int SSL_write(s32 fd, SSLId i_sslId, const char* i_buf, u32 i_bufSize); +static int SSL_read(s32 fd, SSLId i_sslId, char* o_buf, u32 i_bufSize); +static int SSL_write(s32 fd, SSLId i_sslId, const char* i_buf, u32 i_bufSize); static void SSL_lock(); static void SSL_unlock(); @@ -48,12 +48,12 @@ SSLId SSLNew(u32 i_verifyOption, const char* i_serverName) { s32 fd; IOSIoVector vec[MAX_VECTOR_ARGS] ALIGN32; - char server_name[SSL_SERVER_NAME_LENGTH]; - u32 name_len; - SSLId ssl_id[SSL_ID_MAX]; - u32 verify_option[SSL_ID_MAX]; + char server_name[SSL_SERVER_NAME_LENGTH]; + u32 name_len; + SSLId ssl_id[SSL_ID_MAX]; + u32 verify_option[SSL_ID_MAX]; - s32 err; + s32 err; fd = OPEN_SSL_IOS(); @@ -65,7 +65,7 @@ SSLId SSLNew(u32 i_verifyOption, const char* i_serverName) { if (fd < 0) { return SSL_ID_INVALID; } - + name_len = SSL_strnlen(i_serverName, SSL_SERVER_NAME_LENGTH); if (name_len == 0) { @@ -99,14 +99,14 @@ SSLId SSLNew(u32 i_verifyOption, const char* i_serverName) { } int SSLConnect(SSLId i_sslId, int i_socket) { - s32 fd; + s32 fd; IOSIoVector vec[MAX_VECTOR_ARGS] ALIGN32; - SSLId ssl_id[SSL_ID_MAX]; - int socket[SSL_ID_MAX]; - int result[SSL_ID_MAX]; + SSLId ssl_id[SSL_ID_MAX]; + int socket[SSL_ID_MAX]; + int result[SSL_ID_MAX]; - s32 err; + s32 err; fd = OPEN_SSL_IOS(); @@ -134,13 +134,13 @@ int SSLConnect(SSLId i_sslId, int i_socket) { } SSLResult SSLDoHandshake(SSLId i_sslId) { - s32 fd; + s32 fd; IOSIoVector vec[MAX_VECTOR_ARGS] ALIGN32; - SSLId ssl_id[SSL_ID_MAX]; - int result[SSL_ID_MAX]; + SSLId ssl_id[SSL_ID_MAX]; + int result[SSL_ID_MAX]; - s32 err; + s32 err; fd = OPEN_SSL_IOS(); if (fd < 0) { @@ -163,18 +163,18 @@ SSLResult SSLDoHandshake(SSLId i_sslId) { } SSLResult SSLRead(SSLId i_sslId, char* o_buf, u32 i_bufSize) { - s32 fd; - int ret; + s32 fd; + int ret; - u32 bufSize; - char tmp[32] ALIGN32; - u32 align; - u32 front_bytes; - u32 rest; - int total_read; + u32 bufSize; + char tmp[32] ALIGN32; + u32 align; + u32 front_bytes; + u32 rest; + int total_read; - u32 body_bytes; - u32 back_bytes; + u32 body_bytes; + u32 back_bytes; fd = OPEN_SSL_IOS(); @@ -186,16 +186,14 @@ SSLResult SSLRead(SSLId i_sslId, char* o_buf, u32 i_bufSize) { if (i_bufSize > SSL_BUFFER_MAX_LENGTH) { bufSize = SSL_BUFFER_MAX_LENGTH; - } - else { + } else { bufSize = i_bufSize; } - align = (u32)o_buf & (DEFAULT_ALIGN-1); + align = (u32)o_buf & (DEFAULT_ALIGN - 1); if (align != 0) { front_bytes = DEFAULT_ALIGN - align; - } - else { + } else { front_bytes = 0; } @@ -216,20 +214,18 @@ SSLResult SSLRead(SSLId i_sslId, char* o_buf, u32 i_bufSize) { if (ret < front_bytes) { IOS_Close(fd); return total_read; - } - else { + } else { o_buf += ret; rest -= ret; } - } - else { + } else { IOS_Close(fd); return ret; } } if (rest != 0) { - body_bytes = rest & ~(DEFAULT_ALIGN-1); + body_bytes = rest & ~(DEFAULT_ALIGN - 1); if (body_bytes != 0) { ret = SSL_read(fd, i_sslId, o_buf, body_bytes); if (ret > 0) { @@ -237,18 +233,15 @@ SSLResult SSLRead(SSLId i_sslId, char* o_buf, u32 i_bufSize) { if (ret < body_bytes) { IOS_Close(fd); return total_read; - } - else { + } else { o_buf += ret; rest -= ret; } - } - else { + } else { IOS_Close(fd); if (total_read > 0) { return total_read; - } - else { + } else { return ret; } } @@ -256,7 +249,7 @@ SSLResult SSLRead(SSLId i_sslId, char* o_buf, u32 i_bufSize) { } if (rest != 0) { - back_bytes = rest & (DEFAULT_ALIGN-1); + back_bytes = rest & (DEFAULT_ALIGN - 1); if (back_bytes != 0) { memset(tmp, 0, sizeof(tmp)); @@ -265,13 +258,11 @@ SSLResult SSLRead(SSLId i_sslId, char* o_buf, u32 i_bufSize) { if (ret > 0) { total_read += ret; memcpy(o_buf, tmp, ret); - } - else { + } else { IOS_Close(fd); if (total_read > 0) { return total_read; - } - else { + } else { return ret; } } @@ -287,17 +278,17 @@ SSLResult SSLRead(SSLId i_sslId, char* o_buf, u32 i_bufSize) { } SSLResult SSLWrite(SSLId i_sslId, const char* i_buf, u32 i_bufSize) { - s32 fd; - int ret; + s32 fd; + int ret; - char tmp[32] ALIGN32; - u32 align; - u32 front_bytes; - u32 rest; - int total_write; + char tmp[32] ALIGN32; + u32 align; + u32 front_bytes; + u32 rest; + int total_write; - u32 body_bytes; - u32 back_bytes; + u32 body_bytes; + u32 back_bytes; fd = OPEN_SSL_IOS(); @@ -307,11 +298,10 @@ SSLResult SSLWrite(SSLId i_sslId, const char* i_buf, u32 i_bufSize) { return ret; } - align = (u32)i_buf & (DEFAULT_ALIGN-1); + align = (u32)i_buf & (DEFAULT_ALIGN - 1); if (align != 0) { front_bytes = DEFAULT_ALIGN - align; - } - else { + } else { front_bytes = 0; } @@ -332,20 +322,18 @@ SSLResult SSLWrite(SSLId i_sslId, const char* i_buf, u32 i_bufSize) { if (ret < front_bytes) { IOS_Close(fd); return ret; - } - else { + } else { i_buf += ret; rest -= ret; } - } - else { + } else { IOS_Close(fd); return ret; } } if (rest != 0) { - body_bytes = rest & ~(DEFAULT_ALIGN-1); + body_bytes = rest & ~(DEFAULT_ALIGN - 1); if (body_bytes != 0) { ret = SSL_write(fd, i_sslId, i_buf, body_bytes); if (ret > 0) { @@ -353,18 +341,15 @@ SSLResult SSLWrite(SSLId i_sslId, const char* i_buf, u32 i_bufSize) { if (ret < body_bytes) { IOS_Close(fd); return total_write; - } - else { + } else { i_buf += ret; rest -= ret; } - } - else { + } else { IOS_Close(fd); if (total_write > 0) { return total_write; - } - else { + } else { return ret; } } @@ -372,7 +357,7 @@ SSLResult SSLWrite(SSLId i_sslId, const char* i_buf, u32 i_bufSize) { } if (rest != 0) { - back_bytes = rest & (DEFAULT_ALIGN-1); + back_bytes = rest & (DEFAULT_ALIGN - 1); if (back_bytes != 0) { memset(tmp, 0, sizeof(tmp)); memcpy(tmp, i_buf, back_bytes); @@ -381,13 +366,11 @@ SSLResult SSLWrite(SSLId i_sslId, const char* i_buf, u32 i_bufSize) { if (ret > 0) { total_write += ret; - } - else { + } else { IOS_Close(fd); if (total_write > 0) { return total_write; - } - else { + } else { return ret; } } @@ -403,13 +386,13 @@ SSLResult SSLWrite(SSLId i_sslId, const char* i_buf, u32 i_bufSize) { } SSLResult SSLShutdown(SSLId i_sslId) { - s32 fd; + s32 fd; IOSIoVector vec[MAX_VECTOR_ARGS] ALIGN32; - SSLId ssl_id[SSL_ID_MAX]; - int result[SSL_ID_MAX]; + SSLId ssl_id[SSL_ID_MAX]; + int result[SSL_ID_MAX]; - s32 err; + s32 err; fd = OPEN_SSL_IOS(); if (fd < 0) { @@ -432,13 +415,13 @@ SSLResult SSLShutdown(SSLId i_sslId) { } SSLResult SSLSetClientCert(SSLId i_sslId, const char* i_clientCertData, u32 i_clientCertSize, const char* i_privateKeyData, u32 i_privateKeySize) { - s32 fd; + s32 fd; IOSIoVector vec[MAX_VECTOR_ARGS] ALIGN32; - SSLResult result[SSL_ID_MAX]; - SSLId ssl_id[SSL_ID_MAX]; + SSLResult result[SSL_ID_MAX]; + SSLId ssl_id[SSL_ID_MAX]; - s32 err; + s32 err; fd = OPEN_SSL_IOS(); if (fd < 0) { @@ -473,13 +456,13 @@ SSLResult SSLSetClientCert(SSLId i_sslId, const char* i_clientCertData, u32 i_cl } SSLResult SSLSetRootCA(SSLId i_sslId, const char* i_rootCAData, u32 i_rootCASize) { - s32 fd; + s32 fd; IOSIoVector vec[MAX_VECTOR_ARGS] ALIGN32; - SSLResult result[SSL_ID_MAX]; - SSLId ssl_id[SSL_ID_MAX]; + SSLResult result[SSL_ID_MAX]; + SSLId ssl_id[SSL_ID_MAX]; - s32 err; + s32 err; fd = OPEN_SSL_IOS(); if (fd < 0) { @@ -510,14 +493,14 @@ SSLResult SSLSetRootCA(SSLId i_sslId, const char* i_rootCAData, u32 i_rootCASize } SSLResult SSLSetBuiltinRootCA(SSLId i_sslId, u32 i_rootCAId) { - s32 fd; + s32 fd; IOSIoVector vec[MAX_VECTOR_ARGS] ALIGN32; - int result[SSL_ID_MAX]; - int ssl_id[SSL_ID_MAX]; - u32 rootCAId[SSL_ROOT_CA_ID_MAX]; + int result[SSL_ID_MAX]; + int ssl_id[SSL_ID_MAX]; + u32 rootCAId[SSL_ROOT_CA_ID_MAX]; - s32 err; + s32 err; fd = OPEN_SSL_IOS(); if (fd < 0) { @@ -544,14 +527,14 @@ SSLResult SSLSetBuiltinRootCA(SSLId i_sslId, u32 i_rootCAId) { } SSLResult SSLSetBuiltinClientCert(SSLId i_sslId, u32 i_clientCertId) { - s32 fd; + s32 fd; IOSIoVector vec[MAX_VECTOR_ARGS] ALIGN32; - int result[SSL_ID_MAX]; - int ssl_id[SSL_ID_MAX]; - u32 clientCertId[SSL_CLIENT_CERT_ID_MAX]; + int result[SSL_ID_MAX]; + int ssl_id[SSL_ID_MAX]; + u32 clientCertId[SSL_CLIENT_CERT_ID_MAX]; - s32 err; + s32 err; fd = OPEN_SSL_IOS(); if (fd < 0) { @@ -580,10 +563,10 @@ SSLResult SSLSetBuiltinClientCert(SSLId i_sslId, u32 i_clientCertId) { static int SSL_read(s32 fd, SSLId i_sslId, char* o_buf, u32 i_bufSize) { IOSIoVector vec[MAX_VECTOR_ARGS] ALIGN32; - SSLId ssl_id[SSL_ID_MAX]; - SSLResult result[SSL_ID_MAX]; + SSLId ssl_id[SSL_ID_MAX]; + SSLResult result[SSL_ID_MAX]; - s32 err; + s32 err; ssl_id[0] = i_sslId; result[0] = SSL_INVALID_RESULT; @@ -605,10 +588,10 @@ static int SSL_read(s32 fd, SSLId i_sslId, char* o_buf, u32 i_bufSize) { static int SSL_write(s32 fd, SSLId i_sslId, const char* i_buf, u32 i_bufSize) { IOSIoVector vec[MAX_VECTOR_ARGS] ALIGN32; - SSLId ssl_id[SSL_ID_MAX]; - SSLResult result[SSL_ID_MAX]; + SSLId ssl_id[SSL_ID_MAX]; + SSLResult result[SSL_ID_MAX]; - s32 err; + s32 err; ssl_id[0] = i_sslId; result[0] = SSL_INVALID_RESULT; @@ -652,6 +635,7 @@ static void SSL_unlock() { static u32 SSL_strnlen(const char* s, u32 n) { int i; const char* t; - for (i = 0, t = s; i < n && *t != 0; i++, t++) {} - return t-s; + for (i = 0, t = s; i < n && *t != 0; i++, t++) { + } + return t - s; } diff --git a/libs/RevoEX/src/vf/pfile/pf_clib.c b/libs/RevoEX/src/vf/pfile/pf_clib.c index 2e74c099..64f8e90f 100644 --- a/libs/RevoEX/src/vf/pfile/pf_clib.c +++ b/libs/RevoEX/src/vf/pfile/pf_clib.c @@ -8,7 +8,7 @@ s32 VFipf_toupper(s32 c) { } void* VFipf_memcpy(void* dst, void* src, u32 length) { - u8 *d, *s; + u8 *d, *s; u32 *ld, *ls; ld = (u32*)dst; @@ -30,8 +30,8 @@ void* VFipf_memcpy(void* dst, void* src, u32 length) { } void* VFipf_memset(void* dst, s32 c, u32 length) { - u8* d; - u32* ldst, lc; + u8* d; + u32 *ldst, lc; d = (u8*)dst; while (((u32)d & 3) != 0 && length > 0) { @@ -56,27 +56,38 @@ void* VFipf_memset(void* dst, s32 c, u32 length) { u32 VFipf_strlen(const s8* s) { s8* t = (s8*)s; - while (*t) { t++; } + while (*t) { + t++; + } return t - s; } s8* VFipf_strcpy(s8* dst, const s8* src) { s8* d = dst; - while((*d = *src) != 0) { src++; d++; } + while ((*d = *src) != 0) { + src++; + d++; + } return dst; } s32 VFipf_strcmp(const s8* s1, const s8* s2) { u8 *p1 = (u8*)s1, *p2 = (u8*)s2; - while ((*p1 != '\0' && *p2 != '\0') && *p1 == *p2) { p1++; p2++; } + while ((*p1 != '\0' && *p2 != '\0') && *p1 == *p2) { + p1++; + p2++; + } return *p1 - *p2; } s32 VFipf_strncmp(const s8* s1, const s8* s2, u32 length) { u8 *p1 = (u8*)s1, *p2 = (u8*)s2; while (length-- > 0) { - if (*p1 == '\0' || *p2 == '\0' || *p1 != *p2) { return (*p1 - *p2); } - p1++; p2++; + if (*p1 == '\0' || *p2 == '\0' || *p1 != *p2) { + return (*p1 - *p2); + } + p1++; + p2++; } return 0; } diff --git a/libs/RevoEX/src/vf/pfile/pf_code.c b/libs/RevoEX/src/vf/pfile/pf_code.c index 83d16ae0..af773d73 100644 --- a/libs/RevoEX/src/vf/pfile/pf_code.c +++ b/libs/RevoEX/src/vf/pfile/pf_code.c @@ -1,12 +1,8 @@ #include const u8 VFipf_valid_fn_char[0x60] = { - 1, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, 1, 1, 3, 3, 0, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 1, 0, 1, 0, 0, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 0, 1, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 0, + 1, 3, 0, 3, 3, 3, 3, 3, 3, 3, 0, 1, 1, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 1, 0, 1, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 0, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 0, }; s32 VFiPFCODE_Combine_Width(s16 oem_width, s16 uni_width) { diff --git a/libs/RevoEX/src/vf/pfile/pf_service.c b/libs/RevoEX/src/vf/pfile/pf_service.c index 8ff4cd6a..025653be 100644 --- a/libs/RevoEX/src/vf/pfile/pf_service.c +++ b/libs/RevoEX/src/vf/pfile/pf_service.c @@ -1,12 +1,12 @@ #include void VFiPF_LE16_TO_U16_STR(u8* src, u32 length) { - u32 cnt; + u32 cnt; char tmpSrc; for (cnt = 0; cnt < length; cnt += 2) { tmpSrc = src[cnt]; - src[cnt] = src[cnt+1]; - src[cnt+1] = tmpSrc; + src[cnt] = src[cnt + 1]; + src[cnt + 1] = tmpSrc; } } diff --git a/libs/RevoEX/src/vf/pfile/pf_str.c b/libs/RevoEX/src/vf/pfile/pf_str.c index 034298eb..250a82b6 100644 --- a/libs/RevoEX/src/vf/pfile/pf_str.c +++ b/libs/RevoEX/src/vf/pfile/pf_str.c @@ -1,7 +1,7 @@ #include -#include #include +#include void VFiPFSTR_SetCodeMode(PF_STR* p_str, u32 code_mode) { p_str->code_mode = code_mode; @@ -14,8 +14,7 @@ u32 VFiPFSTR_GetCodeMode(PF_STR* p_str) { s8* VFiPFSTR_GetStrPos(PF_STR* p_str, u32 target) { if (target == PF_STR_TARGET_HEAD) { return (s8*)p_str->p_head; - } - else { + } else { return (s8*)p_str->p_tail; } } @@ -35,8 +34,7 @@ void VFiPFSTR_MoveStrPos(PF_STR* p_str, s16 length) { } offset++; } - } - else { + } else { p = (s8*)p_str->p_head; for (cnt = 0; cnt < length; cnt++) { @@ -57,12 +55,10 @@ s32 VFiPFSTR_InitStr(PF_STR* p_str, const s8* s, u32 code_mode) { if (code_mode == PF_STR_CODE_MODE_CHAR) { p_str->p_head = s; p_str->p_tail = (s8*)(s + VFipf_strlen(s)); - } - else if (code_mode == PF_STR_CODE_MODE_WCHAR) { + } else if (code_mode == PF_STR_CODE_MODE_WCHAR) { p_str->p_head = s; p_str->p_tail = (s8*)(s + (VFipf_w_strlen((u16*)s) << 1)); - } - else { + } else { return 10; } @@ -81,8 +77,7 @@ u32 VFiPFSTR_StrNumChar(PF_STR* p_str, u32 target) { if (target == PF_STR_TARGET_HEAD) { p = (s8*)p_str->p_head; - } - else { + } else { p = (s8*)p_str->p_tail; } @@ -93,8 +88,7 @@ u32 VFiPFSTR_StrNumChar(PF_STR* p_str, u32 target) { } p++; } - } - else { + } else { for (cnt = 0; *p != 0 || *(p + 1) != 0; cnt++) { s32 width = VFipf_vol_set.codeset.unicode_char_width((u16*)p); p += width; @@ -105,25 +99,25 @@ u32 VFiPFSTR_StrNumChar(PF_STR* p_str, u32 target) { } s32 VFiPFSTR_StrCmp(const PF_STR* p_str, const s8* s) { - u16 wc; - const u16* wp; + u16 wc; + const u16* wp; - const s8* p1; - const s8* p2; + const s8* p1; + const s8* p2; - s32 ret; + s32 ret; if (p_str->code_mode == PF_STR_CODE_MODE_CHAR) { p1 = p_str->p_head; p2 = (s8*)s; ret = VFipf_strcmp(p1, p2); - } - else { + } else { wp = (u16*)p_str->p_head; do { - (VFipf_vol_set.codeset.oem2unicode)((s8*)s, &wc); s++; + (VFipf_vol_set.codeset.oem2unicode)((s8*)s, &wc); + s++; if (*wp++ != wc) { break; } @@ -136,35 +130,34 @@ s32 VFiPFSTR_StrCmp(const PF_STR* p_str, const s8* s) { } s32 VFiPFSTR_StrNCmp(PF_STR* p_str, const s8* s, u32 target, s16 offset, u16 length) { - u16 wc; - const u16* wp; + u16 wc; + const u16* wp; - const s8* p1; - const s8* p2; + const s8* p1; + const s8* p2; - s32 ret; + s32 ret; if (p_str->code_mode == PF_STR_CODE_MODE_CHAR) { if (target == PF_STR_TARGET_HEAD) { p1 = (s8*)p_str->p_head + offset; - } - else { + } else { p1 = (s8*)p_str->p_tail + offset; } p2 = (s8*)s; ret = VFipf_strncmp(p1, p2, length); - } - else { + } else { if (target == PF_STR_TARGET_HEAD) { wp = (u16*)p_str->p_head + offset; - } - else { + } else { wp = (u16*)p_str->p_tail + offset; } do { - (VFipf_vol_set.codeset.oem2unicode)((s8*)s, &wc); s++; length--; + (VFipf_vol_set.codeset.oem2unicode)((s8*)s, &wc); + s++; + length--; if (*wp++ != wc || length <= 0) { break; } @@ -183,8 +176,7 @@ void VFiPFSTR_ToUpperNStr(PF_STR* p_str, u16 num, s8* dst) { for (; num > 0 && *p != 0; p++, num--) { *dst++ = (s8)VFipf_toupper(*p); } - } - else { + } else { u16* wp = (u16*)p_str->p_head; u16 wc; @@ -192,7 +184,7 @@ void VFiPFSTR_ToUpperNStr(PF_STR* p_str, u16 num, s8* dst) { wc = ('a' <= *wp && *wp <= 'z') ? *wp + ('A' - 'a') : *wp; *(dst) = (s8)wc; - *(dst+1) = (s8)(wc >> 8); + *(dst + 1) = (s8)(wc >> 8); dst += 2; } diff --git a/libs/RevoEX/src/vf/pfile/pf_w_clib.c b/libs/RevoEX/src/vf/pfile/pf_w_clib.c index a9742ff5..be5d101f 100644 --- a/libs/RevoEX/src/vf/pfile/pf_w_clib.c +++ b/libs/RevoEX/src/vf/pfile/pf_w_clib.c @@ -2,21 +2,29 @@ u32 VFipf_w_strlen(const u16* s) { u16* t = (u16*)s; - while (*t) { t++; } + while (*t) { + t++; + } return ((char*)t - (char*)s) >> 1; } u16* VFipf_w_strcpy(u16* dst, const u16* src) { u16* d = dst; - while ((*d = *src) != 0) { src++; d++; } + while ((*d = *src) != 0) { + src++; + d++; + } return dst; } s32 VFipf_w_strncmp(const u16* s1, const u16* s2, u32 length) { u16 *p1 = (u16*)s1, *p2 = (u16*)s2; while (length-- > 0) { - if (*p1 == '\0' || *p2 == '\0' || *p1 != *p2) { return *p1 - *p2; } - p1++; p2++; + if (*p1 == '\0' || *p2 == '\0' || *p1 != *p2) { + return *p1 - *p2; + } + p1++; + p2++; } return 0; } diff --git a/libs/Runtime/include/NMWException.h b/libs/Runtime/include/NMWException.h index c2e890b2..5ace1906 100644 --- a/libs/Runtime/include/NMWException.h +++ b/libs/Runtime/include/NMWException.h @@ -9,9 +9,9 @@ typedef void (*DtorFunction)(void* obj, short method); typedef struct DestructorChain DestructorChain; struct DestructorChain { - DestructorChain* next; - void* dtor; - void* object; + DestructorChain* next; + void* dtor; + void* object; }; #ifdef __cplusplus @@ -23,18 +23,18 @@ extern "C" { extern DestructorChain* __global_destructor_chain; -void* __construct_new_array(void* block, void* ctor, void* dtor, size_t size, size_t n); -void __construct_array(void* ptr, void* ctor, void* dtor, size_t size, size_t n); -void __destroy_arr(void* block, void** dtor, size_t size, size_t n); +void* __construct_new_array(void* block, void* ctor, void* dtor, size_t size, size_t n); +void __construct_array(void* ptr, void* ctor, void* dtor, size_t size, size_t n); +void __destroy_arr(void* block, void** dtor, size_t size, size_t n); -void __register_global_object(void* object, void* dtor, DestructorChain* chain); -void __destroy_global_chain(); +void __register_global_object(void* object, void* dtor, DestructorChain* chain); +void __destroy_global_chain(); -int __register_fragment(__eti_init_info* info, char* TOC); -void __unregister_fragment(int id); +int __register_fragment(__eti_init_info* info, char* TOC); +void __unregister_fragment(int id); #ifdef __cplusplus } #endif -#endif // RUNTIME_NMW_EXCEPTION_H +#endif // RUNTIME_NMW_EXCEPTION_H diff --git a/libs/Runtime/include/__ppc_eabi_init.h b/libs/Runtime/include/__ppc_eabi_init.h index 2653934d..2c3154b3 100644 --- a/libs/Runtime/include/__ppc_eabi_init.h +++ b/libs/Runtime/include/__ppc_eabi_init.h @@ -19,4 +19,4 @@ extern void __init_user(); } #endif -#endif // PPC_EABI_INIT_H +#endif // PPC_EABI_INIT_H diff --git a/libs/Runtime/include/__ppc_eabi_linker.h b/libs/Runtime/include/__ppc_eabi_linker.h index adde2726..e155d51c 100644 --- a/libs/Runtime/include/__ppc_eabi_linker.h +++ b/libs/Runtime/include/__ppc_eabi_linker.h @@ -8,42 +8,42 @@ extern "C" { #endif typedef struct __rom_copy_info { - char* rom; - char* address; - unsigned int size; + char* rom; + char* address; + unsigned int size; } __rom_copy_info; typedef struct __bss_init_info { - char* address; - unsigned int size; + char* address; + unsigned int size; } __bss_init_info; typedef struct __eti_init_info { - void* eti_start; - void* eti_end; - void* code_start; - unsigned long code_size; + void* eti_start; + void* eti_end; + void* code_start; + unsigned long code_size; } __eti_init_info; // This is all generated by the linker. // Stack -__declspec(section ".init") extern char _stack_addr[]; -__declspec(section ".init") extern char _stack_end[]; +__declspec(section ".init") extern char _stack_addr[]; +__declspec(section ".init") extern char _stack_end[]; // Small data area -__declspec(section ".init") extern char _SDA_BASE_[]; -__declspec(section ".init") extern char _SDA2_BASE_[]; +__declspec(section ".init") extern char _SDA_BASE_[]; +__declspec(section ".init") extern char _SDA2_BASE_[]; // Information about the sections -__declspec(section ".init") extern __rom_copy_info _rom_copy_info[]; -__declspec(section ".init") extern __bss_init_info _bss_init_info[]; +__declspec(section ".init") extern __rom_copy_info _rom_copy_info[]; +__declspec(section ".init") extern __bss_init_info _bss_init_info[]; // Exception table info -__declspec(section ".init") extern __eti_init_info _eti_init_info[]; +__declspec(section ".init") extern __eti_init_info _eti_init_info[]; #ifdef __cplusplus } #endif -#endif // PPC_EABI_LINKER_H +#endif // PPC_EABI_LINKER_H diff --git a/libs/Runtime/src/Gecko_ExceptionPPC.c b/libs/Runtime/src/Gecko_ExceptionPPC.c index b24e200b..1e950e3e 100644 --- a/libs/Runtime/src/Gecko_ExceptionPPC.c +++ b/libs/Runtime/src/Gecko_ExceptionPPC.c @@ -1,21 +1,21 @@ #include -#define NUM_FRAGMENT 1 +#define NUM_FRAGMENT 1 typedef int Bool; -#define False 0 -#define True 1 +#define False 0 +#define True 1 -#define Null 0 +#define Null 0 #if __MWERKS__ -#pragma exceptions on +#pragma exceptions on #endif typedef struct ProcessInfo { - __eti_init_info* exception_info; // 0x00 - char* TOC; // 0x04 - Bool active; // 0x08 + __eti_init_info* exception_info; // 0x00 + char* TOC; // 0x04 + Bool active; // 0x08 } ProcessInfo; static ProcessInfo fragmentInfo[1]; @@ -23,7 +23,7 @@ static ProcessInfo fragmentInfo[1]; int __register_fragment(struct __eti_init_info* info, char* TOC) { ProcessInfo* f; int i; - + for (i = 0, f = fragmentInfo; i < 1; ++i, ++f) { if (f->active == False) { f->exception_info = info; @@ -32,7 +32,7 @@ int __register_fragment(struct __eti_init_info* info, char* TOC) { return i; } } - + return -1; } diff --git a/libs/Runtime/src/Gecko_setjmp.c b/libs/Runtime/src/Gecko_setjmp.c index 91f779c8..49d3a188 100644 --- a/libs/Runtime/src/Gecko_setjmp.c +++ b/libs/Runtime/src/Gecko_setjmp.c @@ -1,4 +1,5 @@ #include +// clang-format off #pragma force_active on @@ -130,3 +131,4 @@ asm void longjmp(register struct __jmp_buf* env, register int status) { blr #endif } +// clang-format on diff --git a/libs/Runtime/src/NMWException.cpp b/libs/Runtime/src/NMWException.cpp index f0f6bc1f..58cdc7bd 100644 --- a/libs/Runtime/src/NMWException.cpp +++ b/libs/Runtime/src/NMWException.cpp @@ -3,36 +3,36 @@ #pragma exceptions on class __partial_array_destructor { - private: - void* p; - size_t size; - size_t n; - void* dtor; - - public: - size_t i; - - __partial_array_destructor(void* array, size_t elementsize, size_t nelements, void* destructor) { - p = array; - size = elementsize; - n = nelements; - dtor = destructor; - i = n; - } - - ~__partial_array_destructor() { - char* ptr; - - if (i < n && dtor) { - for (ptr = (char*)p + size * i; i > 0; i--) { - ptr -= size; - DTORCALL_COMPLETE(dtor, ptr); - } +private: + void* p; + size_t size; + size_t n; + void* dtor; + +public: + size_t i; + + __partial_array_destructor(void* array, size_t elementsize, size_t nelements, void* destructor) { + p = array; + size = elementsize; + n = nelements; + dtor = destructor; + i = n; + } + + ~__partial_array_destructor() { + char* ptr; + + if (i < n && dtor) { + for (ptr = (char*)p + size * i; i > 0; i--) { + ptr -= size; + DTORCALL_COMPLETE(dtor, ptr); } } + } }; -#define ARRAY_HEADER_SIZE 16 +#define ARRAY_HEADER_SIZE 16 void* __construct_new_array(void* block, void* ctor, void* dtor, size_t size, size_t n) { char* ptr; diff --git a/libs/Runtime/src/__init_cpp_exceptions.cpp b/libs/Runtime/src/__init_cpp_exceptions.cpp index 32913074..178d1c75 100644 --- a/libs/Runtime/src/__init_cpp_exceptions.cpp +++ b/libs/Runtime/src/__init_cpp_exceptions.cpp @@ -1,7 +1,7 @@ -#include -#include <__ppc_eabi_linker.h> -#include <__ppc_eabi_init.h> #include +#include <__ppc_eabi_init.h> +#include <__ppc_eabi_linker.h> +#include static int fragmentID = -2; @@ -17,20 +17,20 @@ extern void __fini_cpp_exceptions(); #endif static inline void __exception_info_constants(__eti_init_info* info, char** R2) { - register char* temp; + register char* temp; #ifdef __MWERKS__ asm { mr temp, r2; } #endif *R2 = temp; - + info = _eti_init_info; } void __init_cpp_exceptions() { if (fragmentID == -2) { - char* R2; - __eti_init_info* info; + char* R2; + __eti_init_info* info; __exception_info_constants(_eti_init_info, &R2); fragmentID = __register_fragment(_eti_init_info, R2); @@ -46,8 +46,8 @@ void __fini_cpp_exceptions() { #pragma force_active on #pragma section ".ctors$10" -__declspec(section ".ctors$10") extern void* const __init_cpp_exceptions_reference = __init_cpp_exceptions; +__declspec(section ".ctors$10") extern void* const __init_cpp_exceptions_reference = __init_cpp_exceptions; #pragma section ".dtors$10" -__declspec(section ".dtors$10") extern void* const __destroy_global_chain_reference = __destroy_global_chain; +__declspec(section ".dtors$10") extern void* const __destroy_global_chain_reference = __destroy_global_chain; #pragma section ".dtors$15" -__declspec(section ".dtors$15") extern void* const __fini_cpp_exceptions_reference = __fini_cpp_exceptions; +__declspec(section ".dtors$15") extern void* const __fini_cpp_exceptions_reference = __fini_cpp_exceptions; diff --git a/libs/Runtime/src/__mem.c b/libs/Runtime/src/__mem.c index f863793b..801e84c1 100644 --- a/libs/Runtime/src/__mem.c +++ b/libs/Runtime/src/__mem.c @@ -4,9 +4,9 @@ #pragma section code_type ".init" void* memcpy(void* dst, const void* src, size_t count) { - char* p; - char* q; - int i; + char* p; + char* q; + int i; if (src >= dst) { p = (char*)src - 1; @@ -15,8 +15,7 @@ void* memcpy(void* dst, const void* src, size_t count) { for (i = count + 1; --i;) { *++q = *++p; } - } - else { + } else { p = (char*)src + count; q = (char*)dst + count; @@ -24,11 +23,11 @@ void* memcpy(void* dst, const void* src, size_t count) { *--q = *--p; } } - + return dst; } -void __fill_mem(void* dst, int value, unsigned long length) { +void __fill_mem(void* dst, int value, unsigned long length) { #define cDest ((unsigned char*)dst) #define lDest ((unsigned long*)dst) unsigned long val = (unsigned char)value; @@ -40,12 +39,12 @@ void __fill_mem(void* dst, int value, unsigned long length) { if (length >= 32) { i = ~(unsigned long)dst & 3; - + if (i) { length -= i; do { *++cDest = val; - } while(--i); + } while (--i); } if (val) { @@ -84,7 +83,7 @@ void __fill_mem(void* dst, int value, unsigned long length) { if (length) { do { *++cDest = val; - } while(--length); + } while (--length); } #undef cDest #undef lDest @@ -98,8 +97,8 @@ void* memset(void* dst, int ch, size_t count) { #pragma section code_type ".text" __declspec(weak) size_t strlen(const char* str) { - size_t size = -1; - unsigned char* p = (unsigned char*)str - 1; + size_t size = -1; + unsigned char* p = (unsigned char*)str - 1; do { size++; @@ -107,5 +106,3 @@ __declspec(weak) size_t strlen(const char* str) { return size; } - - diff --git a/libs/Runtime/src/__va_arg.c b/libs/Runtime/src/__va_arg.c index 9b5749f5..39ca6a60 100644 --- a/libs/Runtime/src/__va_arg.c +++ b/libs/Runtime/src/__va_arg.c @@ -24,7 +24,7 @@ char* __va_arg(va_list args, _va_arg_type type) { size = 8; maxReg = maxReg - 1; if (reg & 1) - even = 1; + even = 1; inc = 2; } @@ -32,8 +32,7 @@ char* __va_arg(va_list args, _va_arg_type type) { reg += even; addr = args->reg_save_area + fprOff + (reg * regSize); *pReg = reg + inc; - } - else { + } else { *pReg = 8; addr = args->input_arg_area; addr = (char*)PTR_ROUNDUP(addr, size); diff --git a/libs/Runtime/src/global_destructor_chain.c b/libs/Runtime/src/global_destructor_chain.c index 7da3d699..57d927be 100644 --- a/libs/Runtime/src/global_destructor_chain.c +++ b/libs/Runtime/src/global_destructor_chain.c @@ -1,18 +1,18 @@ -#include #include +#include -DestructorChain* __global_destructor_chain; +DestructorChain* __global_destructor_chain; void __register_global_object(void* object, void* dtor, DestructorChain* chain) { chain->next = __global_destructor_chain; chain->dtor = dtor; chain->object = object; - + __global_destructor_chain = chain; } void __destroy_global_chain() { - DestructorChain* chain; + DestructorChain* chain; while ((chain = __global_destructor_chain) != 0) { __global_destructor_chain = chain->next; diff --git a/libs/Runtime/src/ptmf.c b/libs/Runtime/src/ptmf.c index 1c2374b8..c1a1dcd0 100644 --- a/libs/Runtime/src/ptmf.c +++ b/libs/Runtime/src/ptmf.c @@ -1,5 +1,6 @@ #include +// clang-format off typedef struct PTMF { long this_delta; // 0x00 long v_offset; // 0x04 @@ -25,3 +26,5 @@ asm void __ptmf_scall(...) { bctr #endif } + +// clang-format on diff --git a/libs/Runtime/src/runtime.c b/libs/Runtime/src/runtime.c index ed7f1981..f8b96566 100644 --- a/libs/Runtime/src/runtime.c +++ b/libs/Runtime/src/runtime.c @@ -1,5 +1,7 @@ #include +// clang-format off + #define save_restore_reg r11 #define SAVE_FPR(reg) _savefpr_##reg @@ -935,3 +937,4 @@ L_815F9D00: blr #endif } +// clang-format on diff --git a/src/BS2/BS2.c b/src/BS2/BS2.c index add1c9ed..12b37542 100644 --- a/src/BS2/BS2.c +++ b/src/BS2/BS2.c @@ -4,64 +4,64 @@ #include "BS2/sysmenu.h" #include "config.h" +#include #include #include -#include -#include #include +#include -#include #include +#include -#include #include +#include #include #include -#include #include +#include #include -#include #include +#include -#include #include +#include -BOOL InvalidShutdown = FALSE; -BOOL ShutdownFromGCFlag = FALSE; +BOOL InvalidShutdown = FALSE; +BOOL ShutdownFromGCFlag = FALSE; -vu32 BS2LastMode = BS2_LAST_MODE_0; +vu32 BS2LastMode = BS2_LAST_MODE_0; -vBOOL BS2BootFromCache = FALSE; -vBOOL BS2BootCaching = TRUE; +vBOOL BS2BootFromCache = FALSE; +vBOOL BS2BootCaching = TRUE; -vBOOL BS2DriveReset = FALSE; -vBOOL BS2WaitSpinup = TRUE; -vBOOL BS2NoDisk = FALSE; +vBOOL BS2DriveReset = FALSE; +vBOOL BS2WaitSpinup = TRUE; +vBOOL BS2NoDisk = FALSE; -BOOL BS2ReturnToMenu = FALSE; -BOOL BS2ReturnToIdle = FALSE; -BOOL BS2ReturnToDataManager = FALSE; -BOOL BS2ReturnArgs = FALSE; -BOOL BS2LaunchTitle = FALSE; +BOOL BS2ReturnToMenu = FALSE; +BOOL BS2ReturnToIdle = FALSE; +BOOL BS2ReturnToDataManager = FALSE; +BOOL BS2ReturnArgs = FALSE; +BOOL BS2LaunchTitle = FALSE; // Default -u32 BS2BootType = BS2_BOOT_TYPE_POWER_ON; +u32 BS2BootType = BS2_BOOT_TYPE_POWER_ON; -OSNandbootInfo BS2NandbootInfo ALIGN32; -MEMAllocator BS2Allocator; -OSStateFlags BS2StateFlags; +OSNandbootInfo BS2NandbootInfo ALIGN32; +MEMAllocator BS2Allocator; +OSStateFlags BS2StateFlags; -// @BUG: The location of the arguments starts in the middle of iplNwc24Manager's BSS section, so eventually these will be overwritten. -#define BS2_ARGC (*(u32*) ((BS2NandbootInfo.args - sizeof(BS2NandbootInfo.args)) + BS2NandbootInfo.argsOff)) -#define BS2_ARGV ((char**)((BS2NandbootInfo.args - (sizeof(BS2NandbootInfo.args) - 4)) + BS2NandbootInfo.argsOff)) +// @bug: The location of the arguments starts in the middle of iplNwc24Manager's BSS section, so eventually these will be overwritten. +#define BS2_ARGC (*(u32*)((BS2NandbootInfo.args - sizeof(BS2NandbootInfo.args)) + BS2NandbootInfo.argsOff)) +#define BS2_ARGV ((char**)((BS2NandbootInfo.args - (sizeof(BS2NandbootInfo.args) - 4)) + BS2NandbootInfo.argsOff)) -#define BS2_WORK_AREA 0x81200000 -#define BS2_WORK_AREA_LENGTH 0xF0000 +#define BS2_WORK_AREA 0x81200000 +#define BS2_WORK_AREA_LENGTH 0xF0000 u32 BS2GetLaunchCode() { return BS2NandbootInfo.argValue; @@ -74,8 +74,7 @@ u32 BS2GetArgc() { char** BS2GetArgv() { if (BS2_ARGC == 0) { return NULL; - } - else { + } else { return BS2_ARGV; } } @@ -97,8 +96,8 @@ u32 BS2GetBootType() { return BS2BootType; } -vBOOL InvalidSram; -vu32 BS2VideoMode; +vBOOL InvalidSram; +vu32 BS2VideoMode; static u8 SRAMtoSCLang[OS_LANG_MAX]; @@ -109,8 +108,8 @@ static void GetSomeDevFromExi() { u32 unk1; u32 i; - - for (i = 0; i < EXI_CHAN_MAX-1; i++) { + + for (i = 0; i < EXI_CHAN_MAX - 1; i++) { if (!EXILock(EXI_CHAN_0, EXI_DEV_INT, NULL)) { break; } @@ -121,8 +120,7 @@ static void GetSomeDevFromExi() { if (i == 0) { unk1 = 0; - } - else { + } else { unk1 = 0x100; } cmd = unk1 | 0xA1000000; @@ -179,11 +177,9 @@ static void UpdateProductInfoPerms() { OSReport("Failed to set product info file permission! (%d)\n", ret); } } - } - else if (ret == NAND_RESULT_NOEXISTS) { + } else if (ret == NAND_RESULT_NOEXISTS) { OSReport("product info file is not exist\n"); - } - else { + } else { OSReport("Fatal error! (%d)\n", ret); } } @@ -209,8 +205,7 @@ static void UpdateStateFlagsAndBootCache() { if (ret == FALSE) { OSReport("Failed to create\n"); } - } - else { + } else { u32 lastAppType = BS2StateFlags.lastAppType; if (lastAppType & OS_APP_TYPE_DVD) { switch (lastAppType & ~(OS_APP_TYPE_IPL | OS_APP_TYPE_DVD)) { @@ -233,15 +228,14 @@ static void UpdateStateFlagsAndBootCache() { } } } - + // If shutdown type is invalid if (BS2StateFlags.shutdownType == OS_STATE_FLAGS_SHUTDOWN_BAD) { InvalidShutdown = TRUE; - } - else if (getVISolidClrYCol() == 16 && (BS2StateFlags.shutdownType == OS_STATE_FLAGS_SHUTDOWN_RETURN_MENU || BS2StateFlags.shutdownType == OS_STATE_FLAGS_SHUTDOWN_IDLE)) { + } else if (getVISolidClrYCol() == 16 && (BS2StateFlags.shutdownType == OS_STATE_FLAGS_SHUTDOWN_RETURN_MENU || + BS2StateFlags.shutdownType == OS_STATE_FLAGS_SHUTDOWN_IDLE)) { InvalidShutdown = TRUE; - } - else { + } else { // If returning to menu if (BS2StateFlags.shutdownType == OS_STATE_FLAGS_SHUTDOWN_RETURN_MENU) { BS2ReturnToMenu = TRUE; @@ -274,7 +268,7 @@ static void UpdateStateFlagsAndBootCache() { } // If we are launching title on shutdown if (BS2StateFlags.shutdownType == OS_STATE_FLAGS_SHUTDOWN_LAUNCH_TITLE) { - if (__OSReadNandbootInfo(&BS2NandbootInfo)) { + if (__OSReadNandbootInfo(&BS2NandbootInfo)) { if (BS2NandbootInfo.returnValue == OS_NANDBOOT_8) { argv = BS2_ARGV; @@ -289,19 +283,17 @@ static void UpdateStateFlagsAndBootCache() { } // Boot cache. - if (BS2StateFlags.discState == OS_STATE_FLAGS_DISC_IN && (BS2StateFlags.lastAppType & OS_APP_TYPE_IPL) - && !BS2NoDisk && (BS2LastMode == BS2_LAST_MODE_1 || BS2LastMode == BS2_LAST_MODE_4)) { + if (BS2StateFlags.discState == OS_STATE_FLAGS_DISC_IN && (BS2StateFlags.lastAppType & OS_APP_TYPE_IPL) && !BS2NoDisk && + (BS2LastMode == BS2_LAST_MODE_1 || BS2LastMode == BS2_LAST_MODE_4)) { OSReport("Boot from cache\n"); BS2BootFromCache = TRUE; BS2BootCaching = FALSE; BS2DriveReset = FALSE; BS2WaitSpinup = FALSE; - } - else { + } else { BS2BootFromCache = FALSE; BS2BootCaching = TRUE; } - } } @@ -333,14 +325,13 @@ static void UpdateStateFlagsAndBootCache() { if (ret == NAND_RESULT_OK) { BS2BootFromCache = FALSE; - ret = NAND_RESULT_NOEXISTS; // Tell to create a new file + ret = NAND_RESULT_NOEXISTS; // Tell to create a new file BS2BootCaching = TRUE; BS2WaitSpinup = TRUE; } } } - } - else { + } else { ret = NANDClose(&BS2CacheFileInfo); BS2Report("close boot cache file(%d)\n", ret); } @@ -353,7 +344,7 @@ static void UpdateStateFlagsAndBootCache() { // Write blank data adding up to 0xB00000 // A pretty interesitng way of doing it. - + for (i = 0; i < (BS2_CACHE_BOOT_SIZE / BS2_UPDATE_LENGTH); i++) { NANDWrite(&BS2CacheFileInfo, Entries, BS2_UPDATE_LENGTH); } @@ -389,8 +380,7 @@ static void SyncSystemSettings() { if (dateTime.year < 2000 || dateTime.year > 2012) { bias = 0; } - } - else { + } else { bias = 0; } @@ -406,7 +396,8 @@ static void SyncSystemSettings() { // Flush changes __OSUnlockSram(syncSram); if (syncSram) { - while (!__OSSyncSram()) {} + while (!__OSSyncSram()) { + } } // Now for SYSCONF @@ -423,18 +414,14 @@ static void SyncSystemSettings() { if (SCGetProductVideoMode() != SC_PRODUCT_VIDEO_PAL) { if (OSGetProgressiveMode() != SCGetProgressiveMode()) { writeChanges = TRUE; - SCSetProgressiveMode(OSGetProgressiveMode() == OS_PROGRESSIVE_MODE_ON ? - SC_PROGRESSIVE_MODE_ON : - SC_PROGRESSIVE_MODE_OFF); + SCSetProgressiveMode(OSGetProgressiveMode() == OS_PROGRESSIVE_MODE_ON ? SC_PROGRESSIVE_MODE_ON : SC_PROGRESSIVE_MODE_OFF); } - } - else { + } else { // Sync SRAM language to SYSCONF if (OSGetLanguage() > OS_LANG_DUTCH) { writeChanges = TRUE; SCSetLanguage(SC_LANG_ENGLISH); - } - else { + } else { if (SRAMtoSCLang[OSGetLanguage()] != SCGetLanguage()) { writeChanges = TRUE; SCSetLanguage(SRAMtoSCLang[OSGetLanguage()]); @@ -444,9 +431,7 @@ static void SyncSystemSettings() { // Sync SRAM EURGB60 to SYSCONF if (OSGetEuRgb60Mode() != SCGetEuRgb60Mode()) { writeChanges = TRUE; - SCSetEuRgb60Mode(OSGetEuRgb60Mode() == OS_EURGB60_ON ? - SC_EURGB60_MODE_ON : - SC_EURGB60_MODE_OFF); + SCSetEuRgb60Mode(OSGetEuRgb60Mode() == OS_EURGB60_ON ? SC_EURGB60_MODE_ON : SC_EURGB60_MODE_OFF); if (SCGetProgressiveMode() == SC_PROGRESSIVE_MODE_ON && SCGetEuRgb60Mode() == SC_PROGRESSIVE_MODE_OFF) { SCSetProgressiveMode(SC_PROGRESSIVE_MODE_OFF); } @@ -478,12 +463,10 @@ static void SetupVideo() { break; } } - } - else { + } else { __VIInit((VITVMode)VI_TVMODE(BS2VideoMode, VI_INTERLACE)); } - } - else { + } else { if (VIGetScanMode() == VI_NON_INTERLACE) { if (SCGetProgressiveMode() == SC_PROGRESSIVE_MODE_ON && VIGetDTVStatus() == VI_DTV_COMPONENT) { switch (BS2VideoMode) { @@ -497,8 +480,7 @@ static void SetupVideo() { break; } } - } - else { + } else { __VIInit((VITVMode)VI_TVMODE(BS2VideoMode, VI_INTERLACE)); } } @@ -524,8 +506,7 @@ static void SetupVI1Config() { int cfg; if (SCGetProductGameRegion() == SC_PRODUCT_GAME_REGION_JP) { cfg = BS2_VI1_CFG_NTSC_J_ON; - } - else { + } else { cfg = BS2_VI1_CFG_NTSC_J_OFF; } setVI1Cfg(cfg); @@ -568,7 +549,7 @@ static BOOL HasTitleInstalled(ESTitleId titleId, void* work, u32 workLen) { // Get ticket ret = ESP_GetTicketViews(titleId, ticketView, &tikCount); - if (ret != ES_ERR_OK){ + if (ret != ES_ERR_OK) { goto fail; } @@ -657,22 +638,18 @@ static BOOL HasWaikiki() { bool hasWaikiki = FALSE; // Check memory card slot A - if (EXIGetIDEx(EXI_CHAN_0, EXI_DEV_EXT, &devId) - && (devId & 0xFFFFFF00) == WAIKIKI_ID) { + if (EXIGetIDEx(EXI_CHAN_0, EXI_DEV_EXT, &devId) && (devId & 0xFFFFFF00) == WAIKIKI_ID) { OSReport("WikikiSlot A\n"); hasWaikiki = TRUE; - } - else { + } else { OSReport("Id0 : %08x\n", devId); } // Check memory card slot B - if (EXIGetIDEx(EXI_CHAN_1, EXI_DEV_EXT, &devId) - && (devId & 0xFFFFFF00) == WAIKIKI_ID) { + if (EXIGetIDEx(EXI_CHAN_1, EXI_DEV_EXT, &devId) && (devId & 0xFFFFFF00) == WAIKIKI_ID) { OSReport("WikikiSlot B\n"); hasWaikiki = TRUE; - } - else { + } else { OSReport("Id1 : %08x\n", devId); } @@ -717,11 +694,11 @@ void BS2Entry(); /* { /* IRD BOOT MODE (aka "recovery mode") */ /***************************************/ -#define IRD_MODE_HEAP_SIZE 0x200000 +#define IRD_MODE_HEAP_SIZE 0x200000 -#define LOAD_ICON_FRAMES 4 -#define LOAD_ICON_FPS 15 -#define LOAD_ICON_LENGTH (LOAD_ICON_FRAMES * LOAD_ICON_FPS) +#define LOAD_ICON_FRAMES 4 +#define LOAD_ICON_FPS 15 +#define LOAD_ICON_LENGTH (LOAD_ICON_FRAMES * LOAD_ICON_FPS) static void BS2TickIRD(); @@ -731,18 +708,18 @@ void BS2BootIRD() { u8* arenaHi; MEMHeapHandle heap; MEMAllocator allocator; - GXColor verBG = { 0, 0, 0, 0 }; - GXColor verFG = { 255, 255, 255, 0 }; + GXColor verBG = {0, 0, 0, 0}; + GXColor verFG = {255, 255, 255, 0}; // Setup heap for BS2 arenaHi = OSGetMEM2ArenaHi(); - heap = MEMCreateExpHeap((void*)(arenaHi-IRD_MODE_HEAP_SIZE), IRD_MODE_HEAP_SIZE); + heap = MEMCreateExpHeap((void*)(arenaHi - IRD_MODE_HEAP_SIZE), IRD_MODE_HEAP_SIZE); if (heap == NULL) { OSHalt("MEM2 heap allocation error.\n", 885); } // Setup allocators for BS2 - OSSetMEM2ArenaHi((void*)(arenaHi-IRD_MODE_HEAP_SIZE)); + OSSetMEM2ArenaHi((void*)(arenaHi - IRD_MODE_HEAP_SIZE)); MEMInitAllocatorForExpHeap(&allocator, heap, DEFAULT_ALIGN); BS2SetMemAllocator(&allocator); @@ -760,9 +737,8 @@ void BS2BootIRD() { verString = OSAllocFromMEM2ArenaLo(32, DEFAULT_ALIGN); if (SCGetProductAreaString(productArea, 32)) { - sprintf(verString, "%d.%d(%s)", SYSMENU_VERSION_MAJOR, SYSMENU_VERSION_MINOR, productArea); - } - else { + sprintf(verString, "%d.%d(%s)", SYSMENU_VERSION_MAJOR, SYSMENU_VERSION_MINOR, productArea); + } else { /* Should not include productArea */ sprintf(verString, "%d.%d(XXX)", SYSMENU_VERSION_MAJOR, SYSMENU_VERSION_MINOR, productArea); } @@ -789,8 +765,8 @@ static void BS2TickIRD() { OSReport(" Company ..... %-2.2s\n", bi->DVDDiskID.company); OSReport(" Disk # ...... %x\n", bi->DVDDiskID.diskNumber); OSReport(" Game ver .... %x\n", bi->DVDDiskID.gameVersion); - OSReport("\n Banner ...... %s\n", BS2IsBannerAvailable()? "Available" : "Not available"); - OSReport(" PC Check .... %s\n", BS2CheckParentalControl()? "Success" : "Failed"); + OSReport("\n Banner ...... %s\n", BS2IsBannerAvailable() ? "Available" : "Not available"); + OSReport(" PC Check .... %s\n", BS2CheckParentalControl() ? "Success" : "Failed"); // Shutdown video VISetBlack(TRUE); @@ -798,19 +774,20 @@ static void BS2TickIRD() { VIWaitForRetrace(); // Make sure SRAM is up to date - while (!__OSSyncSram()) {} + while (!__OSSyncSram()) { + } // Launch the game (if it is a diagnostic disc; without IRD_DIAG_RESTRICT_OFF) #ifndef IRD_DIAG_RESTRICT_OFF if (BS2IsDiagDisc()) -#endif // IRD_DIAG_RESTRICT_OFF +#endif // IRD_DIAG_RESTRICT_OFF { BS2StartGame(); } // Unreachable OSHalt("", 769); - + break; } case BS2_STT_START_GC_GAME: { @@ -826,8 +803,7 @@ static void BS2TickIRD() { if (bi->DVDDiskID.streaming) { if (bi->DVDDiskID.streamingBufSize) { OSReport(" Buf size .. %d\n", bi->DVDDiskID.streamingBufSize); - } - else { + } else { OSReport(" Buf size .. 10(default)\n"); } } @@ -838,13 +814,14 @@ static void BS2TickIRD() { VIWaitForRetrace(); // Make sure SRAM is up to date - while (!__OSSyncSram()) {} + while (!__OSSyncSram()) { + } // Don't launch game (without IRD_DIAG_RESTRICT_OFF) #ifdef IRD_DIAG_RESTRICT_OFF // Launch the game BS2StartGCGame(); -#endif // IRD_DIAG_RESTRICT_OFF +#endif // IRD_DIAG_RESTRICT_OFF OSHalt("", 795); @@ -910,7 +887,8 @@ static void BS2TickIRD() { VIWaitForRetrace(); // Make sure SRAM is up to date - while (!__OSSyncSram()) {} + while (!__OSSyncSram()) { + } // Reset the system OSReturnToMenu(); @@ -940,22 +918,10 @@ static void BS2TickIRD() { /* MAIN ENTRY POINT */ /********************/ -static u8 SRAMtoSCLang[OS_LANG_MAX] = { - SC_LANG_ENGLISH, - SC_LANG_GERMAN, - SC_LANG_FRENCH, - SC_LANG_SPANISH, - SC_LANG_ITALIAN, - SC_LANG_DUTCH, - SC_LANG_SIMP_CHINESE, - SC_LANG_TRAD_CHINESE, - SC_LANG_KOREAN -}; +static u8 SRAMtoSCLang[OS_LANG_MAX] = {SC_LANG_ENGLISH, SC_LANG_GERMAN, SC_LANG_FRENCH, SC_LANG_SPANISH, SC_LANG_ITALIAN, + SC_LANG_DUTCH, SC_LANG_SIMP_CHINESE, SC_LANG_TRAD_CHINESE, SC_LANG_KOREAN}; -#define COMBO (PAD_BUTTON_LEFT \ - | PAD_BUTTON_RIGHT \ - | PAD_BUTTON_UP \ - | PAD_BUTTON_DOWN) +#define COMBO (PAD_BUTTON_LEFT | PAD_BUTTON_RIGHT | PAD_BUTTON_UP | PAD_BUTTON_DOWN) int main(int argc, char** argv) { s32 ret; @@ -963,7 +929,8 @@ int main(int argc, char** argv) { PADStatus pads[PAD_MAX_CONTROLLER]; // Wait for semaphore to fully initialize. - while (*(BOOL*)OSPhysicalToUncached(OS_ADDR_SEMAPHORE_BUSY)) {} + while (*(BOOL*)OSPhysicalToUncached(OS_ADDR_SEMAPHORE_BUSY)) { + } // Init the system. BS2Init(); @@ -975,7 +942,8 @@ int main(int argc, char** argv) { GetSomeDevFromExi(); // Wait for SC to initialize. - while (SCCheckStatus() == SC_STATUS_BUSY) {} + while (SCCheckStatus() == SC_STATUS_BUSY) { + } if (SCCheckStatus() == SC_STATUS_FATAL) { OSReport("SCInit failed!\n"); } @@ -986,8 +954,7 @@ int main(int argc, char** argv) { // Check if disc is not in the drive if (__DVDGetCoverStatus() != DVD_STATE_WAITING) { BS2NoDisk = TRUE; - } - else { + } else { BS2NoDisk = FALSE; } @@ -998,14 +965,11 @@ int main(int argc, char** argv) { // Determine BS2 Boot type if (BS2ReturnArgs) { BS2BootType = BS2_BOOT_TYPE_RETURN_ARGS; - } - else if (BS2ReturnToDataManager) { + } else if (BS2ReturnToDataManager) { BS2BootType = BS2_BOOT_TYPE_RETURN_TO_DATA_MANAGER; - } - else if (BS2ReturnToMenu) { + } else if (BS2ReturnToMenu) { BS2BootType = BS2_BOOT_TYPE_RETURN_TO_MENU; - } - else { + } else { BS2BootType = BS2_BOOT_TYPE_POWER_ON; } @@ -1070,31 +1034,32 @@ int main(int argc, char** argv) { // Initialize WPAD... for what? WPADRegisterAllocator(BS2AllocProc, BS2FreeProc); WPADInit(); - while (WPADGetStatus() != 3) {} + while (WPADGetStatus() != 3) { + } // Wait until DVD cover is opened. - while (__DVDGetCoverStatus() != DVD_COVER_OPENED) {} + while (__DVDGetCoverStatus() != DVD_COVER_OPENED) { + } // Wait 2 seconds { OSTime start = __OSGetSystemTime(); - while (__OSGetSystemTime() - start < OSMillisecondsToTicks((OSTime)2000)) {} + while (__OSGetSystemTime() - start < OSMillisecondsToTicks((OSTime)2000)) { + } } // Bye bye! OSReport("Shutdown system!\n"); OSShutdownSystem(); - } BS2BootFromCache = FALSE; BS2BootCaching = TRUE; - } - else if (BS2ReturnToIdle) { + } else if (BS2ReturnToIdle) { // Shifft to idle!!! OSReport("Shift to idle mode\n"); OSShutdownSystemForBS(); - } - else if ((rtc & RTC_FLAGS_DISC_CHANGED) && (BS2StateFlags.discState == OS_STATE_FLAGS_DISC_NONE || BS2StateFlags.shutdownType == OS_STATE_FLAGS_SHUTDOWN_LAUNCH_TITLE)) { + } else if ((rtc & RTC_FLAGS_DISC_CHANGED) && + (BS2StateFlags.discState == OS_STATE_FLAGS_DISC_NONE || BS2StateFlags.shutdownType == OS_STATE_FLAGS_SHUTDOWN_LAUNCH_TITLE)) { // We have a disc inside! OSReport("Disc in\n"); BS2DriveReset = TRUE; @@ -1102,16 +1067,13 @@ int main(int argc, char** argv) { BS2BootFromCache = FALSE; BS2BootCaching = TRUE; - } - - // Returned from menu - else if (BS2ReturnToMenu || BS2ReturnToDataManager) { + } else if (BS2ReturnToMenu || BS2ReturnToDataManager) { + // Returned from menu OSReport("Return to menu\n"); BS2DriveReset = TRUE; BS2WaitSpinup = TRUE; } - } - else { + } else { // if InvalidShutdown is true OSReport("Last shutdown sequence is invalid\n"); BS2DriveReset = TRUE; @@ -1155,7 +1117,7 @@ int main(int argc, char** argv) { OSReport("Launch NAND App from WC24\n"); argv = BS2GetArgv(); - sscanf(argv[0], "%016llx", &titleId); // Get title ID from first argument + sscanf(argv[0], "%016llx", &titleId); // Get title ID from first argument // Print info about title. OSReport("Launch : 0x%016llx\n", titleId); @@ -1180,8 +1142,7 @@ int main(int argc, char** argv) { if (HasTitleInstalled(titleId, (void*)BS2_WORK_AREA, BS2_WORK_AREA_LENGTH)) { BS2SetStateFlags(); __OSLaunchTitlevForSystem(titleId, BS2GetLaunchCode(), (const char**)&argv[1]); - } - else { + } else { // Otherwise, good bye! OSReport("specified title by WC24 is not installed!\n"); OSShutdownSystemForBS(); @@ -1191,8 +1152,7 @@ int main(int argc, char** argv) { // Has either Waikiki or Button combo (see COMBO macro) if (HasWaikiki() || (pads[3].err == PAD_ERR_NONE && (pads[3].button & COMBO) == COMBO)) { BS2BootIRD(); - } - else { + } else { BS2Entry(); } diff --git a/src/BS2/BS2BringUp.c b/src/BS2/BS2BringUp.c index 9832d7e9..21eb9066 100644 --- a/src/BS2/BS2BringUp.c +++ b/src/BS2/BS2BringUp.c @@ -1,21 +1,21 @@ #include void enableLegacyDI() { - ACRIOP_WRITE_REG32(HW_COMPAT, (ACRIOP_READ_REG32(HW_COMPAT) & 0xFFFFFFBF) | (1<<6)); - ACRIOP_WRITE_REG32(HW_AIPPROT, (ACRIOP_READ_REG32(HW_AIPPROT) & 0xFFFFFFEF) | (1<<4)); - ACRIOP_DEL_REG_F(HW_ARMIRQMASK, (1<<18)); + ACRIOP_WRITE_REG32(HW_COMPAT, (ACRIOP_READ_REG32(HW_COMPAT) & 0xFFFFFFBF) | (1 << 6)); + ACRIOP_WRITE_REG32(HW_AIPPROT, (ACRIOP_READ_REG32(HW_AIPPROT) & 0xFFFFFFEF) | (1 << 4)); + ACRIOP_DEL_REG_F(HW_ARMIRQMASK, (1 << 18)); } void setVI1Cfg(u32 val) { - ACRIOP_WRITE_REG32(HW_VI1CFG, (ACRIOP_READ_REG32(HW_VI1CFG) & 0xFFFDFFFF) | (val<<17)); + ACRIOP_WRITE_REG32(HW_VI1CFG, (ACRIOP_READ_REG32(HW_VI1CFG) & 0xFFFDFFFF) | (val << 17)); } void setVISolidClrYCol(u32 val) { - ACRIOP_WRITE_REG32(HW_VISOLID, (ACRIOP_READ_REG32(HW_VISOLID) & 0xFFFF00FF) | (val<<8)); + ACRIOP_WRITE_REG32(HW_VISOLID, (ACRIOP_READ_REG32(HW_VISOLID) & 0xFFFF00FF) | (val << 8)); } u32 getVISolidClrYCol() { - return (u8)(ACRIOP_READ_REG32(HW_VISOLID)>>8); + return (u8)(ACRIOP_READ_REG32(HW_VISOLID) >> 8); } #define ACR_IOP_ADDR (OS_BASE_UNCACHED + ACR_REG_ADDRESS + AHB_TRUSTED_OFFSET) @@ -26,5 +26,5 @@ void GPIOPPCInit() { } void EjectDisc() { - ACRIOP_SET_REG_F(HW_GPIOB_OUT, (1< #include #include -#include #include @@ -14,16 +14,16 @@ #include -#define FATAL_REPORT_X_POS 48 -#define FATAL_REPORT_Y_POS 100 +#define FATAL_REPORT_X_POS 48 +#define FATAL_REPORT_Y_POS 100 -#define BS2_REPORT_X_POS 480 -#define BS2_REPORT_Y_POS 420 +#define BS2_REPORT_X_POS 480 +#define BS2_REPORT_Y_POS 420 typedef struct OSFatalParam { - GXColor fg; // 0x00 - GXColor bg; // 0x04 - const char* msg; // 0x08 + GXColor fg; // 0x00 + GXColor bg; // 0x04 + const char* msg; // 0x08 } OSFatalParam; static OSFatalParam FatalParam; @@ -53,7 +53,7 @@ static void ScreenReport(void* xfb, u16 xfbW, u16 xfbH, GXColor yuv, s32 x, s32 u32 i, j; u32 image[72]; u32 k, l; - u8 Y; + u8 Y; u32 pixel; s32 col; @@ -76,8 +76,8 @@ loop: for (i = 0; i < 24; i++) { j = (i & 7) + ((i >> 3) * 24); - image[j + 0] = 0; - image[j + 8] = 0; + image[j + 0] = 0; + image[j + 8] = 0; image[j + 16] = 0; } @@ -98,8 +98,7 @@ loop: if ((col + k) & 1) { ptr[(pixel * 2) - 1] = yuv.g; ptr[(pixel * 2) + 1] = yuv.b; - } - else { + } else { ptr[(pixel * 2) - 1] = yuv.b; ptr[(pixel * 2) + 1] = yuv.g; } @@ -126,12 +125,11 @@ static void ConfigureVideo(u16 xfbW, u16 xfbH) NO_INLINE { switch (VIGetTvFormat()) { case VI_MPAL: case VI_NTSC: { - if (VI_HAS_REG_F(VI_CLOCK_SELECT, (1<<0))) { + if (VI_HAS_REG_F(VI_CLOCK_SELECT, (1 << 0))) { mode.viTVmode = 2; mode.viYOrigin = 0; mode.xFBmode = 0; - } - else { + } else { mode.viTVmode = 0; mode.viYOrigin = 0; mode.xFBmode = 1; @@ -162,9 +160,9 @@ static GXColor RGB2YUV(GXColor rgb) NO_INLINE { f32 Cr; GXColor yuv; - Y = 0.5f + (16.0f + ((0.098f * (f32) rgb.b) + ((0.257f * (f32) rgb.r) + (0.504f * (f32) rgb.g)))); - Cb = 0.5f + (128.0f + ((0.439f * (f32) rgb.b) + ((-0.148f * (f32) rgb.r) - (0.291f * (f32) rgb.g)))); - Cr = 0.5f + (128.0f + (((0.439f * (f32) rgb.r) - (0.368f * (f32) rgb.g)) - (0.071f * (f32) rgb.b))); + Y = 0.5f + (16.0f + ((0.098f * (f32)rgb.b) + ((0.257f * (f32)rgb.r) + (0.504f * (f32)rgb.g)))); + Cb = 0.5f + (128.0f + ((0.439f * (f32)rgb.b) + ((-0.148f * (f32)rgb.r) - (0.291f * (f32)rgb.g)))); + Cr = 0.5f + (128.0f + (((0.439f * (f32)rgb.r) - (0.368f * (f32)rgb.g)) - (0.071f * (f32)rgb.b))); yuv.r = (Y > 235.0f) ? 235.0f : (Y < 16.0f) ? 16.0f : Y; yuv.g = (Cb > 240.0f) ? 240.0f : (Cb < 16.0f) ? 16.0f : Cb; @@ -198,10 +196,12 @@ void OSFatal(GXColor fg, GXColor bg, const char* msg) { OSEnableInterrupts(); count = VIGetRetraceCount(); - while ((s32)(VIGetRetraceCount() - count) < 1) {} + while ((s32)(VIGetRetraceCount() - count) < 1) { + } t = OSGetTime(); - while (!__OSCallShutdownFunctions(FALSE, OS_SHUTDOWN_FATAL) && OSGetTime() - t < OSMillisecondsToTicks(1000)) {} + while (!__OSCallShutdownFunctions(FALSE, OS_SHUTDOWN_FATAL) && OSGetTime() - t < OSMillisecondsToTicks(1000)) { + } OSDisableInterrupts(); @@ -217,7 +217,8 @@ void OSFatal(GXColor fg, GXColor bg, const char* msg) { } EXIUnlock(EXI_CHAN_0); - while ((__EXIRegs[EXI_0_CONTROL >> 2] & (1<> 2] & (1 << EXI_CONTROL_TSTART)) == TRUE) { + } __OSSetExceptionHandler(OS_EXCEPTION_DECREMENTER, &OSDefaultExceptionHandler); GXAbortFrame(); @@ -254,7 +255,8 @@ static void Halt() { ConfigureVideo(640, 480); VIFlush(); count = VIGetRetraceCount(); - while ((s32)VIGetRetraceCount() - (s32)count < 2); + while ((s32)VIGetRetraceCount() - (s32)count < 2) + ; ScreenReport(xfb, 640, 480, RGB2YUV(fp->fg), FATAL_REPORT_X_POS, FATAL_REPORT_Y_POS, fontData->leading, fp->msg); DCFlushRange(xfb, 640 * 480 * VI_DISPLAY_PIX_SZ); @@ -262,14 +264,16 @@ static void Halt() { VIFlush(); count = VIGetRetraceCount(); - while ((s32)VIGetRetraceCount() - (s32)count < 1) {} + while ((s32)VIGetRetraceCount() - (s32)count < 1) { + } OSDisableInterrupts(); OSReport("%s\n", fp->msg); PPCHalt(); } -const char* const __DVDErrorMessage[] = { +// clang-format off +const char* __DVDErrorMessage[] = { "\n\n\n" " エラーが発生しました。\n\n" "イジェクトボタンを押してディスクを取り出してか\n" @@ -343,25 +347,24 @@ const char* const __DVDErrorMessage[] = { " Please read the Wii operations manual\n" " for more information." }; +// clang-format on static void (*FatalFunc)(); void __DVDShowFatalMessage() { const char* message; - GXColor bg = { 0, 0, 0, 0 }; - GXColor fg = { 255, 255, 255, 0 }; + GXColor bg = {0, 0, 0, 0}; + GXColor fg = {255, 255, 255, 0}; if (SCGetLanguage() == SC_LANG_JAPANESE) { OSSetFontEncode(OS_FONT_ENCODE_SJIS); - } - else { + } else { OSSetFontEncode(OS_FONT_ENCODE_ANSI); } if (SCGetLanguage() > SC_LANG_KOREAN) { message = __DVDErrorMessage[SC_LANG_ENGLISH]; - } - else { + } else { message = __DVDErrorMessage[SCGetLanguage()]; } @@ -412,7 +415,8 @@ void BS2ScreenReport(GXColor fg, GXColor bg, const char* msg) { ConfigureVideo(640, 480); VIFlush(); count = VIGetRetraceCount(); - while ((s32)VIGetRetraceCount() - (s32)count < 2); + while ((s32)VIGetRetraceCount() - (s32)count < 2) + ; ScreenReport(xfb, 640, 480, RGB2YUV(fp->fg), BS2_REPORT_X_POS, BS2_REPORT_Y_POS, fontData->leading, fp->msg); DCFlushRange(xfb, 640 * 480 * VI_DISPLAY_PIX_SZ); @@ -420,7 +424,8 @@ void BS2ScreenReport(GXColor fg, GXColor bg, const char* msg) { VIFlush(); count = VIGetRetraceCount(); - while ((s32)VIGetRetraceCount() - (s32)count < 1); + while ((s32)VIGetRetraceCount() - (s32)count < 1) + ; OSReport("%s\n", fp->msg); } diff --git a/src/BS2/BS2Init.c b/src/BS2/BS2Init.c index 987af6c0..cc38ebf1 100644 --- a/src/BS2/BS2Init.c +++ b/src/BS2/BS2Init.c @@ -20,6 +20,7 @@ extern u32 __PADFixBits; extern void __OSFPRInit(); static asm void ClearOtherBATs() { + // clang-format off #ifdef __MWERKS__ nofralloc @@ -42,29 +43,30 @@ static asm void ClearOtherBATs() { blr #endif // __MWERKS__ + // clang-format on } static void SetConsoleInfo() { OSBootInfo* bi = (OSBootInfo*)OSPhysicalToCached(OS_ADDR_BOOT_INFO); // Memory - bi->arenaLo = NULL; - bi->memorySize = *(u32*)OSPhysicalToCached(OS_ADDR_PHYSICAL_MEM1_SIZE); + bi->arenaLo = NULL; + bi->memorySize = *(u32*)OSPhysicalToCached(OS_ADDR_PHYSICAL_MEM1_SIZE); // Console type - bi->consoleType = OS_CONSOLE_RETAIL; - bi->consoleType += PI_READ_REG(PI_UNIT_INFO) >> PI_UNIT_INFO_TYPE; + bi->consoleType = OS_CONSOLE_RETAIL; + bi->consoleType += PI_READ_REG(PI_UNIT_INFO) >> PI_UNIT_INFO_TYPE; // Simulated memory size *(u32*)OSPhysicalToCached(OS_ADDR_SIMULATED_MEMORY_SIZE) = bi->memorySize; // MEM1 *(u32*)OSPhysicalToCached(OS_ADDR_AVAILABLE_MEM1_START) = 0; - *(u32*)OSPhysicalToCached(OS_ADDR_AVAILABLE_MEM1_END) = 0; - + *(u32*)OSPhysicalToCached(OS_ADDR_AVAILABLE_MEM1_END) = 0; + // BS2 stuff - *(u8*) OSPhysicalToCached(OS_ADDR_BOOT_PROGRAM_TARGET) = OS_APP_TYPE_DVD; - *(u16*)OSPhysicalToCached(OS_ADDR_DEV_KIT_VERSION) = BS2_VERSION; + *(u8*)OSPhysicalToCached(OS_ADDR_BOOT_PROGRAM_TARGET) = OS_APP_TYPE_DVD; + *(u16*)OSPhysicalToCached(OS_ADDR_DEV_KIT_VERSION) = BS2_VERSION; } void BS2Init() { @@ -75,9 +77,9 @@ void BS2Init() { ClearOtherBATs(); SetConsoleInfo(); - __PADFixBits = -1; - __OSInIPL = TRUE; // Yes, we are in the IPL! - + __PADFixBits = -1; + __OSInIPL = TRUE; // Yes, we are in the IPL! + __OSFPRInit(); PPCMtmmcr0(MMCR0_PMC1_HOLD | MMCR0_PMC2_HOLD); diff --git a/src/BS2/BS2Mach.c b/src/BS2/BS2Mach.c index 432218a6..dd053d61 100644 --- a/src/BS2/BS2Mach.c +++ b/src/BS2/BS2Mach.c @@ -2,91 +2,91 @@ #include "BS2/BS2Update.h" #include "config.h" -#include #include #include +#include #include #include typedef struct AppLoaderHeader { - char date[16]; // 0x00 - u32 entryPoint; // 0x10 - u32 length; // 0x14 - u32 trailerSize; // 0x18 - u8 pad_0x1C[4]; + char date[16]; // 0x00 + u32 entryPoint; // 0x10 + u32 length; // 0x14 + u32 trailerSize; // 0x18 + u8 pad_0x1C[4]; } AppLoaderHeader; -u8 TicketViewsBuf[OSRoundUp32B(sizeof(ESTicketView) * 64)] ALIGN32; -DVDDiskID lbl_810ADF60 ALIGN32; -OSBootInfo2 bi2 ALIGN32; -AppLoaderHeader AppLoaderHdr ALIGN32; -OSBootInfo3 bi3 ALIGN32; -u8 GameTOCBuf[OSRoundUp32B(sizeof(DVDGameTOC))] ALIGN32; -DVDDriveInfo DriveInfo ALIGN32; -DVDDiskID DiskID ALIGN32; -DVDPartitionParams PartitionParams ALIGN32; -NANDCommandBlock BS2NandBlock; -NANDFileInfo BS2CacheFileInfo; -DVDCommandBlock lbl_8108BF60; -u8 PartitionInfoBuf[OSRoundUp32B(sizeof(DVDPartitionInfo) * 256)] ALIGN32; -DVDCommandBlock Block; +u8 TicketViewsBuf[OSRoundUp32B(sizeof(ESTicketView) * 64)] ALIGN32; +DVDDiskID lbl_810ADF60 ALIGN32; +OSBootInfo2 bi2 ALIGN32; +AppLoaderHeader AppLoaderHdr ALIGN32; +OSBootInfo3 bi3 ALIGN32; +u8 GameTOCBuf[OSRoundUp32B(sizeof(DVDGameTOC))] ALIGN32; +DVDDriveInfo DriveInfo ALIGN32; +DVDDiskID DiskID ALIGN32; +DVDPartitionParams PartitionParams ALIGN32; +NANDCommandBlock BS2NandBlock; +NANDFileInfo BS2CacheFileInfo; +DVDCommandBlock lbl_8108BF60; +u8 PartitionInfoBuf[OSRoundUp32B(sizeof(DVDPartitionInfo) * 256)] ALIGN32; +DVDCommandBlock Block; -BS2State State = BS2_STT_BEGIN; -vu32 lbl_81698A0C = 0; -u32 lbl_81698A10 = 0; -u32 lbl_81698A14 = 0; -u32 lbl_81698A18 = 0; -u32 lbl_81698A1C = 0; -BOOL StartingGame = FALSE; -u32 lbl_81698A24 = 0; -u32 lbl_81698A28 = 0; -u32 lbl_81698A2C = 0; -u32 lbl_81698A30 = 0; -BOOL FatalErrorFlag = FALSE; -BOOL RetryErrorFlag = FALSE; -BOOL UpdateErrorFlag = FALSE; -BOOL AbortFlag = FALSE; -volatile int lbl_81698A44 = 0; -volatile int lbl_81698A48 = 0; -volatile int lbl_81698A4C = 0; -u32 lbl_81698A50 = 0; -u32 lbl_81698A54 = 0; -u32 lbl_81698A58 = 0; -u32 lbl_81698A5C = 0; -u64 lbl_81698A60 = 0; -u64 lbl_81698A68 = 0; -u64 lbl_81698A70 = 0; -u32 lbl_81698A78 = 0; -u32 lbl_81698A7C = 0; -u32 lbl_81698A80 = 0; -u32 lbl_81698A84 = 0; -u32 lbl_81698A88 = 0; -u32 lbl_81698A8C = 0; -u32 lbl_81698A90 = 0; -u32 lbl_81698A94 = 0; -u32 lbl_81698A98 = 0; -u32 lbl_81698A9C = 0; -u64 lbl_81698AA0 = 0; -u32 lbl_81698AA8 = 0; -u32 lbl_81698AAC = 0; -u32 lbl_81698AB0 = 0; -u32 lbl_81698AB4 = 0; -u32 lbl_81698AB8 = 0; -u32 lbl_81698ABC = 0; -u32 lbl_81698AC0 = 0; -u32 lbl_81698AC4 = 0; -u32 lbl_81698AC8 = 0; -u32 lbl_81698ACC = 0; -u32 lbl_81698AD0 = 0; -u32 lbl_81698AD4 = 0; -u32 lbl_81698AD8 = 0; -vu32 lbl_81698ADC = 0; -vu32 lbl_81698AE0 = 0; -u32* lbl_81698AE4 = 0; -u32 lbl_81698AE8 = 0; -u32 lbl_81698AEC = 0; -u32 lbl_81698AF0 = 0; +BS2State State = BS2_STT_BEGIN; +vu32 lbl_81698A0C = 0; +u32 lbl_81698A10 = 0; +u32 lbl_81698A14 = 0; +u32 lbl_81698A18 = 0; +u32 lbl_81698A1C = 0; +BOOL StartingGame = FALSE; +u32 lbl_81698A24 = 0; +u32 lbl_81698A28 = 0; +u32 lbl_81698A2C = 0; +u32 lbl_81698A30 = 0; +BOOL FatalErrorFlag = FALSE; +BOOL RetryErrorFlag = FALSE; +BOOL UpdateErrorFlag = FALSE; +BOOL AbortFlag = FALSE; +volatile int lbl_81698A44 = 0; +volatile int lbl_81698A48 = 0; +volatile int lbl_81698A4C = 0; +u32 lbl_81698A50 = 0; +u32 lbl_81698A54 = 0; +u32 lbl_81698A58 = 0; +u32 lbl_81698A5C = 0; +u64 lbl_81698A60 = 0; +u64 lbl_81698A68 = 0; +u64 lbl_81698A70 = 0; +u32 lbl_81698A78 = 0; +u32 lbl_81698A7C = 0; +u32 lbl_81698A80 = 0; +u32 lbl_81698A84 = 0; +u32 lbl_81698A88 = 0; +u32 lbl_81698A8C = 0; +u32 lbl_81698A90 = 0; +u32 lbl_81698A94 = 0; +u32 lbl_81698A98 = 0; +u32 lbl_81698A9C = 0; +u64 lbl_81698AA0 = 0; +u32 lbl_81698AA8 = 0; +u32 lbl_81698AAC = 0; +u32 lbl_81698AB0 = 0; +u32 lbl_81698AB4 = 0; +u32 lbl_81698AB8 = 0; +u32 lbl_81698ABC = 0; +u32 lbl_81698AC0 = 0; +u32 lbl_81698AC4 = 0; +u32 lbl_81698AC8 = 0; +u32 lbl_81698ACC = 0; +u32 lbl_81698AD0 = 0; +u32 lbl_81698AD4 = 0; +u32 lbl_81698AD8 = 0; +vu32 lbl_81698ADC = 0; +vu32 lbl_81698AE0 = 0; +u32* lbl_81698AE4 = 0; +u32 lbl_81698AE8 = 0; +u32 lbl_81698AEC = 0; +u32 lbl_81698AF0 = 0; void BS2Report(const char* msg, ...) { #ifdef ENABLE_BS2_REPORT @@ -124,8 +124,7 @@ void BS2DVDCallback(s32 result, DVDCommandBlock* block) { State = BS2_STT_NO_DISK; } - if ((State == BS2_STT_START_GAME || State == BS2_STT_START_GC_GAME || State == BS2_STT_RUN_UPDATE || State == BS2_STT_DATA_DISK) - && result == 1) { + if ((State == BS2_STT_START_GAME || State == BS2_STT_START_GC_GAME || State == BS2_STT_RUN_UPDATE || State == BS2_STT_DATA_DISK) && result == 1) { BS2CancelUpdate(); State = BS2_STT_NO_DISK; } @@ -134,8 +133,7 @@ void BS2DVDCallback(s32 result, DVDCommandBlock* block) { if (result == 1) { BS2CancelUpdate(); State = BS2_STT_NO_DISK; - } - else { + } else { if (DVDLowGetCoverRegister() >> 2 & 1) { BS2CancelUpdate(); if (AbortFlag == FALSE) { @@ -165,7 +163,6 @@ void BS2RestartStateMachine() { BS2Report("[BS2RestartStateMachine]\n"); - if ((rtcFlags & 1) || (rtcFlags & 2)) { BS2BootFromCache = FALSE; BS2BootCaching = TRUE; diff --git a/src/BS2/BS2ParentalControl.c b/src/BS2/BS2ParentalControl.c index e353301d..ec83464f 100644 --- a/src/BS2/BS2ParentalControl.c +++ b/src/BS2/BS2ParentalControl.c @@ -60,44 +60,39 @@ BOOL BS2IsValidDisc() { case SC_PRODUCT_AREA_TWN: { if (bi3.parentalControlFlags[SC_PARENTAL_ORG_CERO] & SC_PARENTAL_FLAG_ENABLED) { return FALSE; - } - else { + } else { return TRUE; } } case SC_PRODUCT_AREA_USA: { if (bi3.parentalControlFlags[SC_PARENTAL_ORG_ESRB] & SC_PARENTAL_FLAG_ENABLED) { return FALSE; - } - else { + } else { return TRUE; } } case SC_PRODUCT_AREA_EUR: { - if (bi3.parentalControlFlags[SC_PARENTAL_ORG_USK] & SC_PARENTAL_FLAG_ENABLED - && bi3.parentalControlFlags[SC_PARENTAL_ORG_PEGI] & SC_PARENTAL_FLAG_ENABLED - && bi3.parentalControlFlags[SC_PARENTAL_ORG_PEGI_FINLAND] & SC_PARENTAL_FLAG_ENABLED - && bi3.parentalControlFlags[SC_PARENTAL_ORG_PEGI_PORTUGAL] & SC_PARENTAL_FLAG_ENABLED - && bi3.parentalControlFlags[SC_PARENTAL_ORG_BBFC] & SC_PARENTAL_FLAG_ENABLED) { + if (bi3.parentalControlFlags[SC_PARENTAL_ORG_USK] & SC_PARENTAL_FLAG_ENABLED && + bi3.parentalControlFlags[SC_PARENTAL_ORG_PEGI] & SC_PARENTAL_FLAG_ENABLED && + bi3.parentalControlFlags[SC_PARENTAL_ORG_PEGI_FINLAND] & SC_PARENTAL_FLAG_ENABLED && + bi3.parentalControlFlags[SC_PARENTAL_ORG_PEGI_PORTUGAL] & SC_PARENTAL_FLAG_ENABLED && + bi3.parentalControlFlags[SC_PARENTAL_ORG_BBFC] & SC_PARENTAL_FLAG_ENABLED) { return FALSE; - } - else { + } else { return TRUE; } } case SC_PRODUCT_AREA_AUS: { if (bi3.parentalControlFlags[SC_PARENTAL_ORG_OFLC] & SC_PARENTAL_FLAG_ENABLED) { return FALSE; - } - else { + } else { return TRUE; } } case SC_PRODUCT_AREA_KOR: { if (bi3.parentalControlFlags[SC_PARENTAL_ORG_GRB] & SC_PARENTAL_FLAG_ENABLED) { return FALSE; - } - else { + } else { return TRUE; } } diff --git a/src/BS2/BS2Reset.c b/src/BS2/BS2Reset.c index 6e645329..e34b4b07 100644 --- a/src/BS2/BS2Reset.c +++ b/src/BS2/BS2Reset.c @@ -1,8 +1,8 @@ -#include #include +#include -#include #include +#include #include @@ -10,8 +10,8 @@ #include -static ESTicketView viewsBuf[64] ALIGN32; -static ESTicketView* views = (ESTicketView*)viewsBuf; +static ESTicketView viewsBuf[64] ALIGN32; +static ESTicketView* views = (ESTicketView*)viewsBuf; extern BOOL BS2BootFromCache; extern BOOL __OSIsReturnToIdle; @@ -50,7 +50,8 @@ void __OSLaunchMenu() { return; } - while (TRUE) {} + while (TRUE) { + } } void OSRebootSystem() { @@ -70,12 +71,10 @@ void OSRebootSystem() { } if (__DVDGetCoverStatus() != DVD_COVER_CLOSED) { state.discState = OS_STATE_FLAGS_DISC_NONE; - } - else { + } else { if (!BS2BootFromCache || (__OSGetRTCFlags(&flags) && flags)) { state.discState = OS_STATE_FLAGS_DISC_CHANGED; - } - else { + } else { state.discState = OS_STATE_FLAGS_DISC_IN; } } @@ -100,7 +99,8 @@ void OSShutdownSystem() { memset(&idleModeInfo, 0, sizeof(SCIdleModeInfo)); SCInit(); - while (SCCheckStatus() == SC_STATUS_BUSY) {} + while (SCCheckStatus() == SC_STATUS_BUSY) { + } SCGetIdleMode(&idleModeInfo); @@ -123,12 +123,10 @@ void OSShutdownSystem() { // Disc state if (__DVDGetCoverStatus() != DVD_COVER_CLOSED) { state.discState = OS_STATE_FLAGS_DISC_NONE; - } - else { + } else { if (!BS2BootFromCache || (__OSGetRTCFlags(&flags) && flags)) { state.discState = OS_STATE_FLAGS_DISC_CHANGED; - } - else { + } else { state.discState = OS_STATE_FLAGS_DISC_IN; } } @@ -136,8 +134,7 @@ void OSShutdownSystem() { // Shutdown type if (idleModeInfo.standby == SC_IDLE_MODE_STANDBY_ON) { state.shutdownType = OS_STATE_FLAGS_SHUTDOWN_IDLE; - } - else { + } else { state.shutdownType = OS_STATE_FLAGS_SHUTDOWN_POWER_OFF; } __OSClearRTCFlags(); @@ -152,8 +149,7 @@ void OSShutdownSystem() { __OSShutdownDevices(OS_SHUTDOWN_RETURN_MENU); OSEnableScheduler(); __OSLaunchMenu(); - } - else { + } else { OSDisableScheduler(); __OSShutdownDevices(OS_SHUTDOWN_STANDBY); __OSShutdownToSBY(); @@ -170,7 +166,8 @@ void OSShutdownSystemForBS() { memset(&idleModeInfo, 0, sizeof(SCIdleModeInfo)); SCInit(); - while (SCCheckStatus() == SC_STATUS_BUSY) {} + while (SCCheckStatus() == SC_STATUS_BUSY) { + } SCGetIdleMode(&idleModeInfo); @@ -187,20 +184,17 @@ void OSShutdownSystemForBS() { } if (__DVDGetCoverStatus() != DVD_COVER_CLOSED) { state.discState = OS_STATE_FLAGS_DISC_NONE; - } - else { + } else { if (!BS2BootFromCache || (__OSGetRTCFlags(&flags) && flags)) { state.discState = OS_STATE_FLAGS_DISC_CHANGED; - } - else { + } else { state.discState = OS_STATE_FLAGS_DISC_IN; } } __OSGetIOSRev(&iosRev); if (idleModeInfo.standby == SC_IDLE_MODE_STANDBY_ON && iosRev.major != 9) { state.shutdownType = OS_STATE_FLAGS_SHUTDOWN_LAUNCH_TITLE; - } - else { + } else { state.shutdownType = OS_STATE_FLAGS_SHUTDOWN_POWER_OFF; } __OSClearRTCFlags(); @@ -218,8 +212,7 @@ void OSShutdownSystemForBS() { OSDisableScheduler(); __OSShutdownDevices(3); __OSShutdownToIDL(); - } - else { + } else { OSDisableScheduler(); __OSShutdownDevices(OS_SHUTDOWN_STANDBY); __OSShutdownToSBY(); @@ -243,12 +236,10 @@ void OSReturnToMenu() { } if (__DVDGetCoverStatus() != DVD_COVER_CLOSED) { state.discState = OS_STATE_FLAGS_DISC_NONE; - } - else { + } else { if (!BS2BootFromCache || (__OSGetRTCFlags(&flags) && flags)) { state.discState = OS_STATE_FLAGS_DISC_CHANGED; - } - else { + } else { state.discState = OS_STATE_FLAGS_DISC_IN; } } @@ -274,7 +265,7 @@ void OSReturnToMenu() { void BS2SetStateFlags() { OSStateFlags state; u32 flags; - + __OSReadStateFlags(&state); state.lastAppType = OS_APP_TYPE_CHANNEL; if (BS2BootFromCache) { @@ -283,12 +274,10 @@ void BS2SetStateFlags() { state.shutdownType = OS_STATE_FLAGS_SHUTDOWN_BAD; if (__DVDGetCoverStatus() != DVD_COVER_CLOSED) { state.discState = OS_STATE_FLAGS_DISC_NONE; - } - else { + } else { if (!BS2BootFromCache || (__OSGetRTCFlags(&flags) && flags)) { state.discState = OS_STATE_FLAGS_DISC_CHANGED; - } - else { + } else { state.discState = OS_STATE_FLAGS_DISC_IN; } } diff --git a/src/BS2/BS2Start.c b/src/BS2/BS2Start.c index a7f47c87..ebc36e4b 100644 --- a/src/BS2/BS2Start.c +++ b/src/BS2/BS2Start.c @@ -1,18 +1,18 @@ #include +#include #include #include -#include -#include <__ppc_eabi_linker.h> #include <__ppc_eabi_init.h> +#include <__ppc_eabi_linker.h> #include -#define ARENA_HI_ADDR (OS_BASE_CACHED + 0x00034) +#define ARENA_HI_ADDR (OS_BASE_CACHED + 0x00034) #define EXCEPTION_MASK_ADDR (OS_BASE_CACHED + 0x00044) -extern int main(int argc, char** argv); +extern int main(int argc, char** argv); extern void exit(); extern void DBInit(); @@ -20,7 +20,8 @@ extern void DBInit(); #pragma section code_type ".init" __declspec(weak) asm void __start() { -#ifdef __MWERKS__ + // clang-format off +#ifdef __MWERKS__ nofralloc // Init hardware @@ -89,10 +90,12 @@ bi2_end_arg_parse: // This halts the CPU b exit -#endif +#endif // __MWERKS__ + // clang-format on } asm void __init_registers() { + // clang-format off #ifdef __MWERKS__ nofralloc @@ -138,7 +141,8 @@ asm void __init_registers() { ori r13, r13, _SDA_BASE_@l blr -#endif +#endif // __MWERKS__ + // clang-format on } static void copy_rom_section(void* dest, void* source, unsigned int size) { diff --git a/src/bannerSound/AudioWaveUtility.cpp b/src/bannerSound/AudioWaveUtility.cpp index 748408fb..4a7c52a6 100644 --- a/src/bannerSound/AudioWaveUtility.cpp +++ b/src/bannerSound/AudioWaveUtility.cpp @@ -5,13 +5,13 @@ /* For AIFF */ class BinaryReader { - public: - void align(u32 alignBytes); - BOOL seekChunk(u32 signature, const void* area); + public: + void align(u32 alignBytes); + BOOL seekChunk(u32 signature, const void* area); - protected: - int unk_0x00; - u8* mpRead; // 0x04 + protected: + int unk_0x00; + u8* mpRead; // 0x04 }; void BinaryReader::align(u32 alignBytes) { @@ -40,21 +40,21 @@ BOOL BinaryReader::seekChunk(u32 signature, const void* area) { /* For WAV */ class BinaryReaderLittleEndian { - public: - void align(u32 alignBytes); - BOOL seekChunk(u32 signature, const void* area); + public: + void align(u32 alignBytes); + BOOL seekChunk(u32 signature, const void* area); - u32 read32(); // TODO - u16 read16() { - u8 read[2]; - read[0] = *mpRead++; - read[1] = *mpRead++; - return (read[0] & ~0xFF00) | ((read[1] << 8) & 0xFF00); - } + u32 read32(); // TODO + u16 read16() { + u8 read[2]; + read[0] = *mpRead++; + read[1] = *mpRead++; + return (read[0] & ~0xFF00) | ((read[1] << 8) & 0xFF00); + } - protected: - int unk_0x00; - u8* mpRead; // 0x04 + protected: + int unk_0x00; + u8* mpRead; // 0x04 }; void BinaryReaderLittleEndian::align(u32 alignBytes) { @@ -88,11 +88,11 @@ f32 pow2(f32 x) { s32 l; f32 f; } exponent; - exponent.l = (x >= 0.0f ? (s32)(x - 0.5f) : (s32)(x + 0.5f)); // Shift towards 0 and round - f32 pannedval = x - exponent.l; // strictly between 1.5 and -1.5 + exponent.l = (x >= 0.0f ? (s32)(x - 0.5f) : (s32)(x + 0.5f)); // Shift towards 0 and round + f32 pannedval = x - exponent.l; // strictly between 1.5 and -1.5 // 2^x will not fit in an IEEE-754 float - if(exponent.l > 128) { + if (exponent.l > 128) { return HUGE_VALF; } @@ -102,26 +102,21 @@ f32 pow2(f32 x) { // Calculate the mantissa - static const f32 scale_frac[] = { 0.0f, 0.5f }; + static const f32 scale_frac[] = {0.0f, 0.5f}; // { 1 , 1/sqrt2 } static const f32 two_to_frac[] = {1.0f, 0.70710677f}; // coefficients of Taylor polynomial of 2^x - 1 at 0: // 2^x - 1 = (log2) * x + (log2)^2 / 2! * x^2 + ... - static const f32 __two_to_x[] = { - 0.6931472f, 0.24022661, - 0.055502914f, 0.009625022f, - 0.0013131053f, 1.8300806E-4f - }; + static const f32 __two_to_x[] = {0.6931472f, 0.24022661, 0.055502914f, 0.009625022f, 0.0013131053f, 1.8300806E-4f}; if (pannedval < 0.0f) { frac_index += 1; } - + f32 ret = pannedval + scale_frac[frac_index]; // Evaluate Taylor polynomial using Horner's method - ret = ret * (ret * (ret * (ret * (ret * (ret * __two_to_x[5] + __two_to_x[4]) + - __two_to_x[3]) + __two_to_x[2]) + __two_to_x[1]) + __two_to_x[0]); + ret = ret * (ret * (ret * (ret * (ret * (ret * __two_to_x[5] + __two_to_x[4]) + __two_to_x[3]) + __two_to_x[2]) + __two_to_x[1]) + __two_to_x[0]); // 2^n * (corrected mantissa) ret = exponent.f * (0.75f * two_to_frac[frac_index] + ((0.25f + ret) * two_to_frac[frac_index])); diff --git a/src/channelScript/CHANSVm.c b/src/channelScript/CHANSVm.c index 743984eb..87a58c58 100644 --- a/src/channelScript/CHANSVm.c +++ b/src/channelScript/CHANSVm.c @@ -1,41 +1,41 @@ #include "channelScript/CHANSVm.h" #include "channelScript/CHANSVmPrivate.h" +#include #include #include -#include #include #include #include -#define CHANSVmDebugLength 1024 +#define CHANSVmDebugLength 1024 typedef struct CHANSVmUnk0 { - vmPtr unk_0x00; - vmU32 unk_0x04; - vmU32 unk_0x08; - vmU32 unk_0x0C; + vmPtr unk_0x00; + vmU32 unk_0x04; + vmU32 unk_0x08; + vmU32 unk_0x0C; } CHANSVmUnk0; -CHANSVmImageCtorCallback VmImageCtorCallback = vmNull; -CHANSVmImageAllocatorCallback VmImageAllocCallback = vmNull; +CHANSVmImageCtorCallback VmImageCtorCallback = vmNull; +CHANSVmImageAllocatorCallback VmImageAllocCallback = vmNull; BOOL CHANSVmDebugVerboseMode = vmFalse; -#define VM_STR_LENGTH(str) (str * sizeof(vmWChar)) +#define VM_STR_LENGTH(str) (str * sizeof(vmWChar)) -#define VM_ALIGNMENT DEFAULT_ALIGN -#define VM_ALIGNED(x) ((x & (VM_ALIGNMENT-1)) == 0) -#define VM_ALIGN(x) ROUNDUP(x, VM_ALIGNMENT) +#define VM_ALIGNMENT DEFAULT_ALIGN +#define VM_ALIGNED(x) ((x & (VM_ALIGNMENT - 1)) == 0) +#define VM_ALIGN(x) ROUNDUP(x, VM_ALIGNMENT) -#define VM_NAN ((0.0f / 0.0f)) +#define VM_NAN ((0.0f / 0.0f)) void CHANSVmDebugPrintf(const vmString format, ...) { va_list args; char str[CHANSVmDebugLength]; - + va_start(args, format); vsnprintf(str, CHANSVmDebugLength - 2, format, args); va_end(args); @@ -45,8 +45,10 @@ void CHANSVmDebugPrintf(const vmString format, ...) { OSReport("%s", str); } -#define CHANS_VM_PRINTF(line, msg, ...) if (CHANSVmDebugVerboseMode) CHANSVmDebugPrintf("%s %d"msg, __FUNCTION__, line, __VA_ARGS__) -#define CHANS_VM_PRINT (line, msg, ...) if (CHANSVmDebugVerboseMode) CHANSVmDebugPrintf("%s %d"msg, __FUNCTION__, line) +#define CHANS_VM_PRINTF(line, msg, ...) \ + if (CHANSVmDebugVerboseMode) \ + CHANSVmDebugPrintf("%s %d" msg, __FUNCTION__, line, __VA_ARGS__) +#define CHANS_VM_PRINT (line, msg, ...) if (CHANSVmDebugVerboseMode) CHANSVmDebugPrintf("%s %d" msg, __FUNCTION__, line) vmPtr CHANSVmAllocFromGarbage(CHANSVm* vm, vmSize size) { CHANSVmPrivate* pVm = (CHANSVmPrivate*)vm; @@ -66,19 +68,16 @@ vmPtr CHANSVmAllocFromGarbage(CHANSVm* vm, vmSize size) { if (uVar1 < 8) { if (prevPtr == vmNull) { pVm->unk_0x3C = (vmU32*)*ptr; - } - else { + } else { *prevPtr = *ptr; } - } - else { + } else { ptr[1] = uVar1; if (prevPtr == vmNull) { pVm->unk_0x3C = (vmU32*)((vmU32)allocBuf + size); *(vmU32*)((vmU32)allocBuf + size) = *ptr; pVm->unk_0x3C[1] = ptr[1]; - } - else { + } else { *prevPtr = (vmU32)allocBuf + size; *(vmU32*)((vmU32)allocBuf + size) = *ptr; *(vmU32*)(*prevPtr + 4) = ptr[1]; @@ -117,8 +116,7 @@ CHANSVmObjHdr* CHANSVmNewObjHdr(CHANSVm* vm, int noAlloc) { if (noAlloc == 0) { pVm->freeExeBuf = (ptr + VM_ALIGN(sizeof(CHANSVmObjHdr))); object = (CHANSVmObjHdr*)ptr; - } - else { + } else { ptr = (vmU8*)(pVm->unk_0x2C - sizeof(CHANSVmObjHdr)); pVm->unk_0x2C = ptr; object = (CHANSVmObjHdr*)ptr; @@ -174,13 +172,11 @@ CHANSVmErr CHANSVmDeleteObject(CHANSVm* vm, CHANSVmObjHdr* object) { if (unk->unk_0x08 == 0) { val = 1; - } - else { + } else { if (unk->unk_0x0C != 0) { val = unk->unk_0x0C - 1; unk->unk_0x0C = val; - } - else { + } else { val = -1; } } @@ -213,7 +209,7 @@ CHANSVmObjHdr* CHANSVmCopyObject(CHANSVm* vm, CHANSVmObjHdr* outObj, CHANSVmObjH } outObj = CHANSVmNewObjHdr(vm, 0); if (outObj != vmNull) { -skip: + skip: memcpy(outObj, inObj, sizeof(CHANSVmObjHdr)); outObj->flags.raw = outObj->flags.reserved; @@ -223,13 +219,11 @@ skip: if (unk->unk_0x08 == 0) { val = 1; - } - else { + } else { if (unk->unk_0x0C < -1) { val = unk->unk_0x0C + 1; unk->unk_0x0C = val; - } - else { + } else { val = 0; } } @@ -240,7 +234,7 @@ skip: goto error; } -succeed: + succeed: return outObj; } } @@ -259,7 +253,7 @@ CHANSVmErr CHANSVmPopObject(CHANSVm* vm, CHANSVmObjHdr* object) { CHANSVmObjHdr* nextUnk = (CHANSVmObjHdr*)((vmU8*)unk + sizeof(CHANSVmObjHdr)); if (nextUnk <= pVm->unk_0x24) { err = CHANS_VM_OK; - + if (object != vmNull) { if (object == &pVm->unk_0x50) { err = CHANSVmDeleteObject(vm, object); @@ -269,8 +263,7 @@ CHANSVmErr CHANSVmPopObject(CHANSVm* vm, CHANSVmObjHdr* object) { object->flags.raw = object->flags.reserved; memset(unk, 0, sizeof(CHANSVmObjHdr)); } - } - else { + } else { err = CHANSVmDeleteObject(vm, (CHANSVmObjHdr*)unk); } @@ -291,8 +284,10 @@ void CHANSVmStrCpyToU16FromU8(vmWString output, vmString input, vmSize length) { for (i = length; i != 0; i--) { vmChar* outChar = (vmChar*)(output + outLength); outLength -= 2; - outChar--; *outChar = *--input; - outChar--; *outChar = 0; + outChar--; + *outChar = *--input; + outChar--; + *outChar = 0; } } @@ -366,6 +361,7 @@ vmBoolInt CHANSVmGetEnumedType(CHANSVmObjType* eType, vmS32 iType) NO_INLINE { } // temporary +// clang-format off VmConvertEntry VmTypeConvertFuncTbl[] = { { vmNull, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError }, { vmNull, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError }, @@ -373,6 +369,7 @@ VmConvertEntry VmTypeConvertFuncTbl[] = { { vmNull, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError }, { vmNull, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError, CHANSVmConvertObjectTypeError }, }; +// clang-format on CHANSVmObjHdr* CHANSVmConvertObjectType(CHANSVm* vm, vmU32 type, CHANSVmObjHdr* object) { CHANSVmObjType old, new; @@ -420,7 +417,7 @@ CHANSVmErr CHANSVmSetU16String(CHANSVm* vm, CHANSVmObjHdr* object, vmWString str if (CHANSVmNewObject(vm, 0, object, CHANS_VM_OBJ_TYPE_STRING, strLen) == vmNull) { return CHANS_VM_ERR_SET_STRING; } - + if (strLen != 0) { memcpy(object->value.wstring_v->str, str, strLen); } @@ -435,7 +432,7 @@ CHANSVmErr CHANSVmSetU16StringFromU8(CHANSVm* vm, CHANSVmObjHdr* object, vmStrin if (CHANSVmNewObject(vm, 0, object, CHANS_VM_OBJ_TYPE_STRING, VM_STR_LENGTH(strLen)) == vmNull) { return CHANS_VM_ERR_SET_STRING; } - + if (strLen != 0) { CHANSVmStrCpyToU16FromU8(object->value.wstring_v->str, str, strLen); } @@ -456,7 +453,7 @@ CHANSVmObjHdr* CHANSVmGetArg(CHANSVm* vm, vmU32 argIdx) { return vmNull; } - return (CHANSVmObjHdr*)pVm->unk_0x60->argv + ((pVm->unk_0x60->argc-1)-argIdx); + return (CHANSVmObjHdr*)pVm->unk_0x60->argv + ((pVm->unk_0x60->argc - 1) - argIdx); } CHANSVmObjHdr* CHANSVmGetArgInteger(CHANSVm* vm, vmU32 argIdx) { @@ -488,7 +485,8 @@ CHANSVmNativeClass* CHANSVmFindNativeClass(CHANSVm* vm, const char* clsName) { return vmNull; } -CHANSVmNativeClass* CHANSVmAddNativeClass2(CHANSVm* vm, const char* clsName, CHANSVmFunction clsCtor, CHANSVmFunction clsDtor, CHANSVmFunction clsInit) { +CHANSVmNativeClass* CHANSVmAddNativeClass2(CHANSVm* vm, const char* clsName, CHANSVmFunction clsCtor, CHANSVmFunction clsDtor, + CHANSVmFunction clsInit) { CHANSVmPrivate* pVm = (CHANSVmPrivate*)vm; CHANSVmNativeClass* cls; @@ -497,15 +495,14 @@ CHANSVmNativeClass* CHANSVmAddNativeClass2(CHANSVm* vm, const char* clsName, CHA if (CHANSVmFindNativeClass(vm, clsName) == vmNull) { clsNameLen = strlen(clsName); if (clsNameLen != 0) { - cls = (CHANSVmNativeClass*)CHANSVmAlloc(vm, (clsNameLen + sizeof(CHANSVmNativeClass)-1) & -32); + cls = (CHANSVmNativeClass*)CHANSVmAlloc(vm, (clsNameLen + sizeof(CHANSVmNativeClass) - 1) & -32); if (cls != vmNull) { CHANSVmNativeClass* next = pVm->nativeClasses; CHANSVmNativeClass* prev; if (pVm->nativeClasses == vmNull) { pVm->nativeClasses = cls; - } - else { + } else { // Set the new class as the next class for the previous class while (next != vmNull) { prev = next; @@ -571,13 +568,11 @@ VmMethodDefine(Math, acos) { if (-1.0 <= val && val <= 1.0) { newVal = acos(val); - } - else { + } else { newVal = VM_NAN; } return CHANSVmSetFloat(VmInst, VmReturnObj, newVal) == CHANS_VM_OK; - } - else { + } else { return vmFalse; } } @@ -589,13 +584,11 @@ VmMethodDefine(Math, asin) { if (-1.0 <= val && val <= 1.0) { newVal = asin(val); - } - else { + } else { newVal = VM_NAN; } return CHANSVmSetFloat(VmInst, VmReturnObj, newVal) == CHANS_VM_OK; - } - else { + } else { return vmFalse; } } @@ -692,12 +685,10 @@ VmMethodDefine(Math, max) { } return CHANSVmSetInteger(VmInst, VmReturnObj, arg0->value.int_v) == CHANS_VM_OK; - } - else { + } else { return (VmMethod(Math, fmax))(VmInst, VmParentObj, VmReturnObj); } - } - else { + } else { return vmFalse; } } @@ -723,12 +714,10 @@ VmMethodDefine(Math, min) { } return CHANSVmSetInteger(VmInst, VmReturnObj, arg0->value.int_v) == CHANS_VM_OK; - } - else { + } else { return (VmMethod(Math, fmin))(VmInst, VmParentObj, VmReturnObj); } - } - else { + } else { return vmFalse; } } @@ -754,13 +743,11 @@ VmMethodDefine(Math, round) { if (val > 0.0) { newVal = floor(val + 0.5); - } - else { + } else { newVal = ceil(val - 0.5); } return CHANSVmSetFloat(VmInst, VmReturnObj, newVal) == CHANS_VM_OK; - } - else { + } else { return vmFalse; } } @@ -782,13 +769,11 @@ VmMethodDefine(Math, sqrt) { if (arg->value.float_v < 0.0) { newVal = VM_NAN; - } - else { + } else { newVal = sqrt(val); } return CHANSVmSetFloat(VmInst, VmReturnObj, newVal) == CHANS_VM_OK; - } - else { + } else { return vmFalse; } } @@ -847,8 +832,7 @@ VmCtorDefine(Image) { if (image->unk_0x00 != 0 && image->unk_0x04 != 0) { result = VmImageCtorCallback(); } - } - else { + } else { result = vmFalse; } @@ -860,8 +844,7 @@ vmPtr CHANSVmGetFreeExeBufp(CHANSVm* vm) { if (pVm->unk_0x4C != 0 || pVm->freeExeBuf >= pVm->unk_0x2C) { return vmNull; - } - else { + } else { return pVm->freeExeBuf; } } @@ -872,8 +855,7 @@ vmU32 CHANSVmGetFreeExeSize(CHANSVm* vm) { vmS32 size = (vmU32)pVm->unk_0x2C - (vmU32)pVm->freeExeBuf; if (pVm->unk_0x4C != 0 || size < 0) { return 0; - } - else { + } else { return size; } } diff --git a/src/channelScript/systemmenu/VmSystem.c b/src/channelScript/systemmenu/VmSystem.c index 4d1316b8..ae522176 100644 --- a/src/channelScript/systemmenu/VmSystem.c +++ b/src/channelScript/systemmenu/VmSystem.c @@ -5,8 +5,8 @@ #include -bool VmSystemBeginRenderFlag; -bool VmSystemWaitForRetraceFlag; +bool VmSystemBeginRenderFlag; +bool VmSystemWaitForRetraceFlag; VmMethodDefine(SCPrivate, SC_ASPECT_RATIO_4x3) { return CHANSVmSetInteger(VmInst, VmReturnObj, SC_ASPECT_RATIO_4x3) == CHANS_VM_OK; diff --git a/src/channelScript/systemmenu/iplCSColor.cpp b/src/channelScript/systemmenu/iplCSColor.cpp index a4f5fc02..8c8027ef 100644 --- a/src/channelScript/systemmenu/iplCSColor.cpp +++ b/src/channelScript/systemmenu/iplCSColor.cpp @@ -4,17 +4,18 @@ namespace ipl { namespace cs { - + /*** GX COLOR 8 BIT ***/ namespace color { - #define COLOR_PROPERTY_COUNT 4 +#define COLOR_PROPERTY_COUNT 4 + extern const CHANSVmPropertyList cPropertyList[COLOR_PROPERTY_COUNT]; typedef union CS_Color { - u32 val32; + u32 val32; GXColor gxColor; - u8 arr[4]; + u8 arr[4]; } CS_Color; typedef struct _CS_Struct { @@ -78,7 +79,8 @@ namespace ipl { return result; } - template CHANSVmDefineMethod(set) { + template + CHANSVmDefineMethod(set) { BOOL result = FALSE; CHANSVmObjHdr* arg = CHANSVmGetArgInteger(VmInst, 0); if (util::is_valid_datap(VmParentObj) && arg != NULL) { @@ -93,7 +95,8 @@ namespace ipl { return result; } - template CHANSVmDefineMethod(get) { + template + CHANSVmDefineMethod(get) { BOOL result = FALSE; if (util::is_valid_datap(VmParentObj)) { CS_Struct* data = (CS_Struct*)*VmParentObj->value.ptr_v; @@ -106,17 +109,17 @@ namespace ipl { } const CHANSVmPropertyList cPropertyList[COLOR_PROPERTY_COUNT] = { - { "r", get<0>, set<0> }, - { "g", get<1>, set<1> }, - { "b", get<2>, set<2> }, - { "a", get<3>, set<3> }, + {"r", get<0>, set<0>}, + {"g", get<1>, set<1>}, + {"b", get<2>, set<2>}, + {"a", get<3>, set<3>}, }; - } + } // namespace color /*** GX COLOR 16 BIT ***/ namespace color_s10 { - #define COLORS10_PROPERTY_COUNT 4 +#define COLORS10_PROPERTY_COUNT 4 extern const CHANSVmPropertyList cPropertyList[COLORS10_PROPERTY_COUNT]; CHANSVmDefineMethod(ctor) { @@ -165,7 +168,8 @@ namespace ipl { return result; } - template CHANSVmDefineMethod(set) { + template + CHANSVmDefineMethod(set) { BOOL result = FALSE; CHANSVmObjHdr* arg = CHANSVmGetArgInteger(VmInst, 0); if (util::is_valid_datap(VmParentObj) && arg != NULL) { @@ -178,7 +182,8 @@ namespace ipl { return result; } - template CHANSVmDefineMethod(get) { + template + CHANSVmDefineMethod(get) { BOOL result = FALSE; if (util::is_valid_datap(VmParentObj)) { s16* data = (s16*)*VmParentObj->value.ptr_v; @@ -190,11 +195,11 @@ namespace ipl { } const CHANSVmPropertyList cPropertyList[COLORS10_PROPERTY_COUNT] = { - { "r", get<0>, set<0> }, - { "g", get<1>, set<1> }, - { "b", get<2>, set<2> }, - { "a", get<3>, set<3> }, + {"r", get<0>, set<0>}, + {"g", get<1>, set<1>}, + {"b", get<2>, set<2>}, + {"a", get<3>, set<3>}, }; - } - } -} + } // namespace color_s10 + } // namespace cs +} // namespace ipl diff --git a/src/channelScript/systemmenu/iplCSFont.cpp b/src/channelScript/systemmenu/iplCSFont.cpp index ae0c02e5..61f366e5 100644 --- a/src/channelScript/systemmenu/iplCSFont.cpp +++ b/src/channelScript/systemmenu/iplCSFont.cpp @@ -26,6 +26,6 @@ namespace ipl { } return result; } - } - } -} + } // namespace font + } // namespace cs +} // namespace ipl diff --git a/src/channelScript/systemmenu/iplCSGX.cpp b/src/channelScript/systemmenu/iplCSGX.cpp index d8ba2dd9..2f905cd2 100644 --- a/src/channelScript/systemmenu/iplCSGX.cpp +++ b/src/channelScript/systemmenu/iplCSGX.cpp @@ -5,7 +5,7 @@ namespace ipl { namespace cs { namespace gx { - #define PROPERTY_COUNT 11 +#define PROPERTY_COUNT 11 extern const CHANSVmPropertyList cPropertyList[PROPERTY_COUNT]; BOOL init(CHANSVm* vm) { @@ -19,6 +19,7 @@ namespace ipl { return result; } + // clang-format off const CHANSVmPropertyList cPropertyList[PROPERTY_COUNT] = { { "*GX_TF_I4", util::get_int, NULL }, { "*GX_TF_IA4", util::get_int, NULL }, @@ -32,6 +33,7 @@ namespace ipl { { "*GX_REPEAT", util::get_int, NULL }, { "*GX_MIRROR", util::get_int, NULL }, }; - } - } -} + // clang-format on + } // namespace gx + } // namespace cs +} // namespace ipl diff --git a/src/channelScript/systemmenu/iplCSImage.cpp b/src/channelScript/systemmenu/iplCSImage.cpp index 10bf8f92..b284908b 100644 --- a/src/channelScript/systemmenu/iplCSImage.cpp +++ b/src/channelScript/systemmenu/iplCSImage.cpp @@ -6,7 +6,7 @@ namespace ipl { namespace cs { namespace iplimage { void* allocator(CHANSVm* vm, u32 size) { - u8* buffer = new(System::getCSManager()->getHeap(), 32) u8[size]; + u8* buffer = new (System::getCSManager()->getHeap(), 32) u8[size]; return buffer; } @@ -14,6 +14,6 @@ namespace ipl { CHANSVmImageRegisterAllocator(allocator, NULL); return TRUE; } - } - } -} + } // namespace iplimage + } // namespace cs +} // namespace ipl diff --git a/src/channelScript/systemmenu/iplCSLayout.cpp b/src/channelScript/systemmenu/iplCSLayout.cpp index b19705d1..9068755a 100644 --- a/src/channelScript/systemmenu/iplCSLayout.cpp +++ b/src/channelScript/systemmenu/iplCSLayout.cpp @@ -7,5 +7,5 @@ namespace ipl { namespace layout { } - } -} + } // namespace cs +} // namespace ipl diff --git a/src/channelScript/systemmenu/iplCSMtx.cpp b/src/channelScript/systemmenu/iplCSMtx.cpp index 91353fb9..8f009b4a 100644 --- a/src/channelScript/systemmenu/iplCSMtx.cpp +++ b/src/channelScript/systemmenu/iplCSMtx.cpp @@ -8,16 +8,23 @@ namespace ipl { // used but pooled first DECOMP_FORCE_ACTIVE(iplCSMtx_cpp, "MTX34"); - #define PROPERTY_COUNT 13 +#define PROPERTY_COUNT 13 extern const CHANSVmPropertyList cPropertyList[PROPERTY_COUNT]; - #define MTX_GET(_0, _1) get_##_0##_1 - #define MTX_GET_DEF(_0, _1) CHANSVmDefineMethod(MTX_GET(_0, _1)) { return get(VmInst, VmParentObj, VmReturnObj, _0, _1); } +#define MTX_GET(_0, _1) get_##_0##_1 +#define MTX_GET_DEF(_0, _1) \ + CHANSVmDefineMethod(MTX_GET(_0, _1)) { \ + return get(VmInst, VmParentObj, VmReturnObj, _0, _1); \ + } - #define MTX_SET(_0, _1) set_##_0##_1 - #define MTX_SET_DEF(_0, _1) CHANSVmDefineMethod(MTX_SET(_0, _1)) { return set(VmInst, VmParentObj, _0, _1); } +#define MTX_SET(_0, _1) set_##_0##_1 +#define MTX_SET_DEF(_0, _1) \ + CHANSVmDefineMethod(MTX_SET(_0, _1)) { \ + return set(VmInst, VmParentObj, _0, _1); \ + } - #define MTX_PROP(_0, _1) { "_"#_0#_1, MTX_GET(_0, _1), MTX_SET(_0, _1) } +#define MTX_PROP(_0, _1) \ + { "_" #_0 #_1, MTX_GET(_0, _1), MTX_SET(_0, _1) } CHANSVmDefineMethod(ctor) { BOOL result = FALSE; @@ -28,8 +35,7 @@ namespace ipl { for (int i = 0; i < (int)ARRAY_LENGTH(args); i++) { if (CHANSVmGetArgFloat(VmInst, i)) { CHANSVmCopyObject(VmInst, &args[i], CHANSVmGetArgFloat(VmInst, i)); - } - else { + } else { if (CHANSVmSetFloat(VmInst, &args[i], 0.0) != CHANS_VM_OK) { return FALSE; } @@ -38,18 +44,18 @@ namespace ipl { CHANSVmObjHdr* arrObj = (CHANSVmObjHdr*)CHANSVmNewObjData(VmInst, VmReturnObj, 16); if (arrObj != NULL) { - u32 sizes[] = { 3, 4 }; + u32 sizes[] = {3, 4}; if (CHANSVmNewArrayObject(VmInst, arrObj, ARRAY_LENGTH(sizes), sizes) != NULL) { CHANSVmCopyObject(VmInst, CHANSVmGetArrayElement2D(VmInst, arrObj, 0, 0), &args[0]); CHANSVmCopyObject(VmInst, CHANSVmGetArrayElement2D(VmInst, arrObj, 0, 1), &args[1]); CHANSVmCopyObject(VmInst, CHANSVmGetArrayElement2D(VmInst, arrObj, 0, 2), &args[2]); CHANSVmCopyObject(VmInst, CHANSVmGetArrayElement2D(VmInst, arrObj, 0, 3), &args[3]); - + CHANSVmCopyObject(VmInst, CHANSVmGetArrayElement2D(VmInst, arrObj, 1, 0), &args[4]); CHANSVmCopyObject(VmInst, CHANSVmGetArrayElement2D(VmInst, arrObj, 1, 1), &args[5]); CHANSVmCopyObject(VmInst, CHANSVmGetArrayElement2D(VmInst, arrObj, 1, 2), &args[6]); CHANSVmCopyObject(VmInst, CHANSVmGetArrayElement2D(VmInst, arrObj, 1, 3), &args[7]); - + CHANSVmCopyObject(VmInst, CHANSVmGetArrayElement2D(VmInst, arrObj, 2, 0), &args[8]); CHANSVmCopyObject(VmInst, CHANSVmGetArrayElement2D(VmInst, arrObj, 2, 1), &args[9]); CHANSVmCopyObject(VmInst, CHANSVmGetArrayElement2D(VmInst, arrObj, 2, 2), &args[10]); @@ -125,6 +131,7 @@ namespace ipl { return result; } + // clang-format off const CHANSVmPropertyList cPropertyList[PROPERTY_COUNT] = { MTX_PROP(0, 0), MTX_PROP(0, 1), @@ -140,6 +147,7 @@ namespace ipl { MTX_PROP(2, 3), { "m", get_m, NULL } }; + // clang-format on BOOL init(CHANSVm* vm) { BOOL result = FALSE; @@ -151,6 +159,6 @@ namespace ipl { } return result; } - } - } -} + } // namespace mtx34 + } // namespace cs +} // namespace ipl diff --git a/src/channelScript/systemmenu/iplCSPane.cpp b/src/channelScript/systemmenu/iplCSPane.cpp index 7e0c7d3e..e3f78189 100644 --- a/src/channelScript/systemmenu/iplCSPane.cpp +++ b/src/channelScript/systemmenu/iplCSPane.cpp @@ -28,6 +28,6 @@ namespace ipl { } return result; } - } - } -} + } // namespace pane + } // namespace cs +} // namespace ipl diff --git a/src/channelScript/systemmenu/iplCSRect.cpp b/src/channelScript/systemmenu/iplCSRect.cpp index 1ead064b..197c26b7 100644 --- a/src/channelScript/systemmenu/iplCSRect.cpp +++ b/src/channelScript/systemmenu/iplCSRect.cpp @@ -5,7 +5,7 @@ namespace ipl { namespace cs { namespace rect { - #define METHOD_COUNT 4 +#define METHOD_COUNT 4 extern const CHANSVmMethodList cMethodList[METHOD_COUNT]; CHANSVmDefineMethod(get_width) { @@ -76,29 +76,25 @@ namespace ipl { if (arg0 != NULL) { left = arg0->value.float_v; - } - else { + } else { left = 0.0; } if (arg1 != NULL) { top = arg1->value.float_v; - } - else { + } else { top = 0.0; } if (arg2 != NULL) { right = arg2->value.float_v; - } - else { + } else { right = 0.0; } if (arg3 != NULL) { bottom = arg3->value.float_v; - } - else { + } else { bottom = 0.0; } @@ -111,12 +107,14 @@ namespace ipl { return result; } + // clang-format off const CHANSVmMethodList cMethodList[METHOD_COUNT] = { {"GetWidth", get_width }, {"GetHeight", get_height }, {"SetWidth", set_width }, {"SetHeight", set_height }, }; + // clang-format on BOOL init(CHANSVm* vm) { BOOL result = FALSE; @@ -128,6 +126,6 @@ namespace ipl { } return result; } - } - } -} + } // namespace rect + } // namespace cs +} // namespace ipl diff --git a/src/channelScript/systemmenu/iplCSSize.cpp b/src/channelScript/systemmenu/iplCSSize.cpp index 6612f69e..c0244fdc 100644 --- a/src/channelScript/systemmenu/iplCSSize.cpp +++ b/src/channelScript/systemmenu/iplCSSize.cpp @@ -5,7 +5,7 @@ namespace ipl { namespace cs { namespace size { - #define PROPERTY_COUNT 2 +#define PROPERTY_COUNT 2 extern const CHANSVmPropertyList cPropertyList[PROPERTY_COUNT]; DEFINE_CS_IPL_CTOR_ARG(f32 width, f32 height) { @@ -33,15 +33,13 @@ namespace ipl { if (arg0 != NULL) { width = arg0->value.float_v; - } - else { + } else { width = 0.0; } if (arg1 != NULL) { height = arg1->value.float_v; - } - else { + } else { height = 0.0; } @@ -65,7 +63,8 @@ namespace ipl { return result; } - template CHANSVmDefineMethod(set) { + template + CHANSVmDefineMethod(set) { BOOL result = FALSE; CHANSVmObjHdr* arg = CHANSVmGetArgFloat(VmInst, 0); if (util::is_valid_datap(VmParentObj) && arg != NULL) { @@ -77,7 +76,8 @@ namespace ipl { return result; } - template CHANSVmDefineMethod(get) { + template + CHANSVmDefineMethod(get) { BOOL result = FALSE; if (util::is_valid_datap(VmParentObj)) { f32* data = (f32*)*VmParentObj->value.ptr_v; @@ -86,10 +86,12 @@ namespace ipl { return result; } + // clang-format off const CHANSVmPropertyList cPropertyList[PROPERTY_COUNT] = { { "width", get<0>, set<0> }, { "height", get<1>, set<1> }, }; - } - } -} + // clang-format on + } // namespace size + } // namespace cs +} // namespace ipl diff --git a/src/channelScript/systemmenu/iplCSSystem.cpp b/src/channelScript/systemmenu/iplCSSystem.cpp index 5cadf953..37089f3d 100644 --- a/src/channelScript/systemmenu/iplCSSystem.cpp +++ b/src/channelScript/systemmenu/iplCSSystem.cpp @@ -7,7 +7,7 @@ extern "C" BOOL VmSystemInit(CHANSVm* vm); namespace ipl { namespace cs { namespace system { - #define METHOD_COUNT 2 +#define METHOD_COUNT 2 extern const CHANSVmMethodList cMethodList[METHOD_COUNT]; CHANSVmDefineMethod(is_first_call) { @@ -33,10 +33,12 @@ namespace ipl { return CHANSVmSetInteger(VmInst, VmReturnObj, appDlEnable) == CHANS_VM_OK; } + // clang-format off const CHANSVmMethodList cMethodList[METHOD_COUNT] = { {"isFirstCall", is_first_call }, {"isDlTaskRegistered", is_dltask_registered }, }; + // clang-format on BOOL init(CHANSVm* vm) { BOOL result = FALSE; @@ -50,6 +52,6 @@ namespace ipl { } return result; } - } - } -} + } // namespace system + } // namespace cs +} // namespace ipl diff --git a/src/channelScript/systemmenu/iplCSTexture.cpp b/src/channelScript/systemmenu/iplCSTexture.cpp index cbf9c9ba..57fb76b9 100644 --- a/src/channelScript/systemmenu/iplCSTexture.cpp +++ b/src/channelScript/systemmenu/iplCSTexture.cpp @@ -20,6 +20,6 @@ namespace ipl { } return result; } - } - } -} + } // namespace texture + } // namespace cs +} // namespace ipl diff --git a/src/channelScript/systemmenu/iplCSUtil.cpp b/src/channelScript/systemmenu/iplCSUtil.cpp index d6be77f6..af8dad8d 100644 --- a/src/channelScript/systemmenu/iplCSUtil.cpp +++ b/src/channelScript/systemmenu/iplCSUtil.cpp @@ -1,7 +1,7 @@ #include "channelScript/iplCSLibrary.h" -#include #include "iplUtility.h" +#include namespace ipl { namespace cs { @@ -38,6 +38,6 @@ namespace ipl { utility::CharacterCode::UTF16ToANSI((u8*)asciiOut, utf16In, strLen); } } - } - } -} + } // namespace util + } // namespace cs +} // namespace ipl diff --git a/src/channelScript/systemmenu/iplCSVector.cpp b/src/channelScript/systemmenu/iplCSVector.cpp index 4a1d4d69..1928ab76 100644 --- a/src/channelScript/systemmenu/iplCSVector.cpp +++ b/src/channelScript/systemmenu/iplCSVector.cpp @@ -5,7 +5,7 @@ namespace ipl { namespace cs { namespace vec3 { - #define PROPERTY_COUNT 3 +#define PROPERTY_COUNT 3 extern const CHANSVmPropertyList cPropertyList[PROPERTY_COUNT]; DEFINE_CS_IPL_CTOR_ARG(f32 x, f32 y, f32 z) { @@ -35,22 +35,19 @@ namespace ipl { if (arg0 != NULL) { x = arg0->value.float_v; - } - else { + } else { x = 0.0; } if (arg1 != NULL) { y = arg1->value.float_v; - } - else { + } else { y = 0.0; } if (arg2 != NULL) { z = arg2->value.float_v; - } - else { + } else { z = 0.0; } @@ -75,7 +72,8 @@ namespace ipl { return result; } - template CHANSVmDefineMethod(set) { + template + CHANSVmDefineMethod(set) { BOOL result = FALSE; CHANSVmObjHdr* arg = CHANSVmGetArgFloat(VmInst, 0); if (util::is_valid_datap(VmParentObj) && arg != NULL) { @@ -87,7 +85,8 @@ namespace ipl { return result; } - template CHANSVmDefineMethod(get) { + template + CHANSVmDefineMethod(get) { BOOL result = FALSE; if (util::is_valid_datap(VmParentObj)) { f32* data = (f32*)*VmParentObj->value.ptr_v; @@ -96,11 +95,13 @@ namespace ipl { return result; } + // clang-format off const CHANSVmPropertyList cPropertyList[PROPERTY_COUNT] = { { "x", get<0>, set<0> }, { "y", get<1>, set<1> }, { "z", get<2>, set<2> }, }; - } - } -} + // clang-format on + } // namespace vec3 + } // namespace cs +} // namespace ipl diff --git a/src/homebutton/HBMAnmController.cpp b/src/homebutton/HBMAnmController.cpp index 261f0e62..58ebc66d 100644 --- a/src/homebutton/HBMAnmController.cpp +++ b/src/homebutton/HBMAnmController.cpp @@ -5,11 +5,11 @@ namespace homebutton { - GroupAnmController::GroupAnmController() : - mpGroup(), - mpAnimGroup() {} + GroupAnmController::GroupAnmController() : mpGroup(), mpAnimGroup() { + } - GroupAnmController::~GroupAnmController() {} + GroupAnmController::~GroupAnmController() { + } void GroupAnmController::do_calc() { bool enable; @@ -19,8 +19,7 @@ namespace homebutton { enable = true; mpAnimGroup->SetFrame(mFrame); - } - else { + } else { enable = false; } @@ -30,4 +29,4 @@ namespace homebutton { it->mTarget->SetAnimationEnable(mpAnimGroup, enable, false); } } -} +} // namespace homebutton diff --git a/src/homebutton/HBMBase.cpp b/src/homebutton/HBMBase.cpp index 63c2a846..56b8caa1 100644 --- a/src/homebutton/HBMBase.cpp +++ b/src/homebutton/HBMBase.cpp @@ -2,25 +2,25 @@ #include "homebutton/HBMBase.h" -#include "homebutton/HBMFrameController.h" #include "homebutton/HBMAnmController.h" +#include "homebutton/HBMFrameController.h" #include "homebutton/HBMGUIManager.h" #include "homebutton/HBMController.h" #include "homebutton/HBMRemoteSpk.h" #include -#include #include +#include #include #include #include #include #include +#include #include #include -#include /* PUBLIC API */ @@ -29,7 +29,7 @@ enum HBMAllocatorType { HBM_ALLOCATOR_LOCAL, HBM_ALLOCATOR_NW4R, }; - + static MEMAllocator sAllocator; static MEMAllocator* spAllocator = &sAllocator; @@ -63,21 +63,21 @@ void HBMCreate(const HBMDataInfo* pDataInfo) { } switch (getAllocatorType(pDataInfo)) { - case HBM_ALLOCATOR_APPLI: { - nw4r::lyt::Layout::SetAllocator(pDataInfo->pAllocator); - spAllocator = pDataInfo->pAllocator; - break; - } + case HBM_ALLOCATOR_APPLI: { + nw4r::lyt::Layout::SetAllocator(pDataInfo->pAllocator); + spAllocator = pDataInfo->pAllocator; + break; + } - case HBM_ALLOCATOR_LOCAL: { - nw4r::lyt::Layout::SetAllocator(spAllocator); - break; - } + case HBM_ALLOCATOR_LOCAL: { + nw4r::lyt::Layout::SetAllocator(spAllocator); + break; + } - case HBM_ALLOCATOR_NW4R: { - spAllocator = nw4r::lyt::Layout::GetAllocator(); - break; - } + case HBM_ALLOCATOR_NW4R: { + spAllocator = nw4r::lyt::Layout::GetAllocator(); + break; + } } homebutton::HomeButton::createInstance(pDataInfo); @@ -87,7 +87,7 @@ void HBMCreate(const HBMDataInfo* pDataInfo) { void HBMDelete() { const HBMDataInfo* pHBInfo = homebutton::HomeButton::getInstance()->getHBMDataInfo(); - nw4r::lyt::Layout::SetAllocator(spAllocator); // ?? + nw4r::lyt::Layout::SetAllocator(spAllocator); // ?? homebutton::HomeButton::deleteInstance(); if (getAllocatorType(pHBInfo) == HBM_ALLOCATOR_LOCAL) { @@ -130,97 +130,16 @@ namespace homebutton { int anm; } AnmControllerTable; - static const AnmControllerTable scAnmTable[res::eAnimator_Max] = { - {0, 0 }, - { 0, 2 }, - { 4, 1 }, - { 1, 0 }, - { 1, 2 }, - { 5, 1 }, - { 2, 0 }, - { 2, 2 }, - { 6, 1 }, - { 3, 0 }, - { 3, 2 }, - { 7, 1 } - }; + static const AnmControllerTable scAnmTable[res::eAnimator_Max] = {{0, 0}, {0, 2}, {4, 1}, {1, 0}, {1, 2}, {5, 1}, + {2, 0}, {2, 2}, {6, 1}, {3, 0}, {3, 2}, {7, 1}}; static const AnmControllerTable scGroupAnmTable[res::eGrAnimator_Max] = { - { 0, 0 }, - { 1, 1 }, - { 2, 0 }, - { 3, 1 }, - { 4, 2 }, - { 4, 19 }, - { 5, 3 }, - { 5, 20 }, - { 6, 4 }, - { 6, 7 }, - { 7, 4 }, - { 7, 7 }, - { 8, 4 }, - { 8, 7 }, - { 9, 4 }, - { 9, 7 }, - { 10, 4 }, - { 10, 7 }, - { 11, 5 }, - { 12, 5 }, - { 13, 6 }, - { 13, 8 }, - { 14, 14 }, - { 14, 6 }, - { 14, 8 }, - { 15, 5 }, - { 16, 6 }, - { 16, 14 }, - { 17, 11 }, - { 17, 12 }, - { 18, 11 }, - { 18, 12 }, - { 19, 13 }, - { 20, 13 }, - { 21, 9 }, - { 21, 10 }, - { 22, 9 }, - { 22, 10 }, - { 23, 9 }, - { 23, 10 }, - { 24, 9 }, - { 24, 10 }, - { 25, 9 }, - { 25, 10 }, - { 26, 9 }, - { 26, 10 }, - { 27, 9 }, - { 27, 10 }, - { 28, 9 }, - { 28, 10 }, - { 29, 9 }, - { 29, 10 }, - { 30, 9 }, - { 30, 10 }, - { 31, 15 }, - { 31, 16 }, - { 31, 17 }, - { 31, 18 }, - { 31, 21 }, - { 32, 15 }, - { 32, 16 }, - { 32, 17 }, - { 32, 18 }, - { 32, 21 }, - { 33, 15 }, - { 33, 16 }, - { 33, 17 }, - { 33, 18 }, - { 33, 21 }, - { 34, 15 }, - { 34, 16 }, - { 34, 17 }, - { 34, 18 }, - { 34, 21 } - }; + {0, 0}, {1, 1}, {2, 0}, {3, 1}, {4, 2}, {4, 19}, {5, 3}, {5, 20}, {6, 4}, {6, 7}, {7, 4}, {7, 7}, {8, 4}, + {8, 7}, {9, 4}, {9, 7}, {10, 4}, {10, 7}, {11, 5}, {12, 5}, {13, 6}, {13, 8}, {14, 14}, {14, 6}, {14, 8}, {15, 5}, + {16, 6}, {16, 14}, {17, 11}, {17, 12}, {18, 11}, {18, 12}, {19, 13}, {20, 13}, {21, 9}, {21, 10}, {22, 9}, {22, 10}, {23, 9}, + {23, 10}, {24, 9}, {24, 10}, {25, 9}, {25, 10}, {26, 9}, {26, 10}, {27, 9}, {27, 10}, {28, 9}, {28, 10}, {29, 9}, {29, 10}, + {30, 9}, {30, 10}, {31, 15}, {31, 16}, {31, 17}, {31, 18}, {31, 21}, {32, 15}, {32, 16}, {32, 17}, {32, 18}, {32, 21}, {33, 15}, + {33, 16}, {33, 17}, {33, 18}, {33, 21}, {34, 15}, {34, 16}, {34, 17}, {34, 18}, {34, 21}}; HomeButton* HomeButton::spHomeButtonObj = NULL; @@ -238,200 +157,58 @@ namespace homebutton { "P1_Def.brlyt", "P2_Def.brlyt", "P3_Def.brlyt", - "P4_Def.brlyt", + "P4_Def.brlyt", }; const char* HomeButton::scCursorPaneName = "N_Trans"; const char* HomeButton::scCursorRotPaneName = "N_Rot"; const char* HomeButton::scCursorSRotPaneName = "N_SRot"; - const char* HomeButton::scBtnName[res::eBtn_Max] = { - "B_btnL_00", - "B_btnL_01", - "B_btnL_10", - "B_btnL_11" - }; + const char* HomeButton::scBtnName[res::eBtn_Max] = {"B_btnL_00", "B_btnL_01", "B_btnL_10", "B_btnL_11"}; - const char* HomeButton::scTxtName[res::eTxt_Max] = { - "T_btnL_00", - "T_btnL_01", - "T_btnL_10", - "T_btnL_11" - }; + const char* HomeButton::scTxtName[res::eTxt_Max] = {"T_btnL_00", "T_btnL_01", "T_btnL_10", "T_btnL_11"}; - const char* HomeButton::scGrName[res::eGroup_Max] = { - "btnL_00_inOut", - "btnL_01_inOut", - "btnL_10_inOut", - "btnL_11_inOut", - "btnL_00_psh", - "btnL_01_psh", - "btnL_10_psh", - "btnL_11_psh" - }; - const char* HomeButton::scAnimName[res::eAnim_Max] = { - "_cntBtn_in.brlan", - "_cntBtn_psh.brlan", - "_cntBtn_out.brlan" - }; + const char* HomeButton::scGrName[res::eGroup_Max] = {"btnL_00_inOut", "btnL_01_inOut", "btnL_10_inOut", "btnL_11_inOut", + "btnL_00_psh", "btnL_01_psh", "btnL_10_psh", "btnL_11_psh"}; + const char* HomeButton::scAnimName[res::eAnim_Max] = {"_cntBtn_in.brlan", "_cntBtn_psh.brlan", "_cntBtn_out.brlan"}; const char* HomeButton::scPairGroupAnimName[res::ePairAnm_Max] = { - "_ltrIcn_on.brlan", - "_optn_bar_psh.brlan", - "_close_bar_psh.brlan", - "_hmMenu_bar_in.brlan", - "_hmMenu_bar_psh.brlan", - "_link_msg_in.brlan", - "_link_msg_out.brlan", - "_cmn_msg_in.brlan", - "_cmn_msg_out.brlan", - "_cntrl_up.brlan", - "_cntrl_wndw_opn.brlan", - "_cntrl_dwn.brlan", - "_hmMenu_bar_out.brlan", - "_cmn_msg_rtrn.brlan", "_12btn_on.brlan" - }; + "_ltrIcn_on.brlan", "_optn_bar_psh.brlan", "_close_bar_psh.brlan", "_hmMenu_bar_in.brlan", "_hmMenu_bar_psh.brlan", + "_link_msg_in.brlan", "_link_msg_out.brlan", "_cmn_msg_in.brlan", "_cmn_msg_out.brlan", "_cntrl_up.brlan", + "_cntrl_wndw_opn.brlan", "_cntrl_dwn.brlan", "_hmMenu_bar_out.brlan", "_cmn_msg_rtrn.brlan", "_12btn_on.brlan"}; const char* HomeButton::scPairGroupName[res::ePairAnm_Max] = { - "ltrIcn_on", - "optn_bar_psh", - "close_bar_psh", - "hmMenu_bar_in", - "hmMenu_bar_psh", - "link_msg_in", - "link_msg_out", - "cmn_msg_in", - "cmn_msg_out", - "cntrl_up", - "cntrl_wndw_opn", - "cntrl_dwn", - "hmMenu_bar_out", - "cmn_msg_rtrn", - "12btn_on" - }; + "ltrIcn_on", "optn_bar_psh", "close_bar_psh", "hmMenu_bar_in", "hmMenu_bar_psh", "link_msg_in", "link_msg_out", "cmn_msg_in", + "cmn_msg_out", "cntrl_up", "cntrl_wndw_opn", "cntrl_dwn", "hmMenu_bar_out", "cmn_msg_rtrn", "12btn_on"}; const char* HomeButton::scGroupAnimName[res::eGrAnim_Max] = { - "_hmMenu_strt.brlan", - "_hmMenu_fnsh.brlan", - "_optn_bar_in.brlan", - "_optn_bar_out.brlan", - "_optn_btn_in.brlan", - "_optn_btn_psh.brlan", - "_vb_btn_wht_psh.brlan", - "_optn_btn_out.brlan", - "_vb_btn_ylw_psh.brlan", - "_sound_gry.brlan", - "_sound_ylw.brlan", - "_cmn_msg_btn_in.brlan", - "_cmn_msg_btn_out.brlan", - "_cmn_msg_btn_psh.brlan", - "_vb_btn_ylw_ylw.brlan", - "_btry_wink.brlan", - "_btry_gry.brlan", - "_btry_wht.brlan", - "_btry_wink_gry.brlan", - "_close_bar_in.brlan", - "_close_bar_out.brlan", - "_btry_red.brlan" - }; + "_hmMenu_strt.brlan", "_hmMenu_fnsh.brlan", "_optn_bar_in.brlan", "_optn_bar_out.brlan", "_optn_btn_in.brlan", + "_optn_btn_psh.brlan", "_vb_btn_wht_psh.brlan", "_optn_btn_out.brlan", "_vb_btn_ylw_psh.brlan", "_sound_gry.brlan", + "_sound_ylw.brlan", "_cmn_msg_btn_in.brlan", "_cmn_msg_btn_out.brlan", "_cmn_msg_btn_psh.brlan", "_vb_btn_ylw_ylw.brlan", + "_btry_wink.brlan", "_btry_gry.brlan", "_btry_wht.brlan", "_btry_wink_gry.brlan", "_close_bar_in.brlan", + "_close_bar_out.brlan", "_btry_red.brlan"}; const char* HomeButton::scGroupName[res::eGrPane_Max] = { - "hmMenu_strt", - "hmMenu_fnsh", - "hmMenuBck_strt", - "hmMenuBck_fnsh", - "optn_bar_in", - "optn_bar_out", - "optnBtn_00_inOut", - "optnBtn_01_inOut", - "optnBtn_10_inOut", - "optnBtn_11_inOut", - "optnBtn_20_inOut", - "optnBtn_00_psh", - "optnBtn_01_psh", - "optnBtn_10_psh", - "optnBtn_11_psh", - "optnBtn_20_psh", - "optnBtn_10_cntrl", - "msgBtn_00_inOut", - "msgBtn_01_inOut", - "msgBtn_00_psh", - "msgBtn_01_psh", - "vol_00", - "vol_01", - "vol_02", - "vol_03", - "vol_04", - "vol_05", - "vol_06", - "vol_07", - "vol_08", - "vol_09", - "plyr_00", - "plyr_01", - "plyr_02", - "plyr_03" - }; + "hmMenu_strt", "hmMenu_fnsh", "hmMenuBck_strt", "hmMenuBck_fnsh", "optn_bar_in", "optn_bar_out", "optnBtn_00_inOut", + "optnBtn_01_inOut", "optnBtn_10_inOut", "optnBtn_11_inOut", "optnBtn_20_inOut", "optnBtn_00_psh", "optnBtn_01_psh", "optnBtn_10_psh", + "optnBtn_11_psh", "optnBtn_20_psh", "optnBtn_10_cntrl", "msgBtn_00_inOut", "msgBtn_01_inOut", "msgBtn_00_psh", "msgBtn_01_psh", + "vol_00", "vol_01", "vol_02", "vol_03", "vol_04", "vol_05", "vol_06", + "vol_07", "vol_08", "vol_09", "plyr_00", "plyr_01", "plyr_02", "plyr_03"}; - const char* HomeButton::scFuncPaneName[res::eFuncPane_Max] = { - "let_icn_00", - "N_plyr_00", - "N_plyr_01", - "N_plyr_02", - "N_plyr_03" - }; + const char* HomeButton::scFuncPaneName[res::eFuncPane_Max] = {"let_icn_00", "N_plyr_00", "N_plyr_01", "N_plyr_02", "N_plyr_03"}; const char* HomeButton::scFuncTouchPaneName[res::eFuncTouchPane_Max] = { - "B_btn_00", - "B_bar_10", - "B_optnBtn_00", - "B_optnBtn_01", - "B_optnBtn_10", - "B_optnBtn_11", - "B_optnBtn_20", - "B_BtnA", - "B_BtnB", - "cntrl_00" - }; + "B_btn_00", "B_bar_10", "B_optnBtn_00", "B_optnBtn_01", "B_optnBtn_10", "B_optnBtn_11", "B_optnBtn_20", "B_BtnA", "B_BtnB", "cntrl_00"}; - const char* HomeButton::scFuncTextPaneName[res::eFuncTextPane_Max] = { - "T_msg_00", - "T_msg_01", - "T_Dialog" - }; + const char* HomeButton::scFuncTextPaneName[res::eFuncTextPane_Max] = {"T_msg_00", "T_msg_01", "T_Dialog"}; const char* HomeButton::scBatteryPaneName[WPAD_MAX_CONTROLLERS][res::eBatteryPane_Max] = { - { - "btryPwr_00_0", - "btryPwr_00_1", - "btryPwr_00_2", - "btryPwr_00_3" - }, - { - "btryPwr_01_0", - "btryPwr_01_1", - "btryPwr_01_2", - "btryPwr_01_3" - }, - { - "btryPwr_02_0", - "btryPwr_02_1", - "btryPwr_02_2", - "btryPwr_02_3" - }, - { - "btryPwr_03_0", - "btryPwr_03_1", - "btryPwr_03_2", - "btryPwr_03_3" - } - }; + {"btryPwr_00_0", "btryPwr_00_1", "btryPwr_00_2", "btryPwr_00_3"}, + {"btryPwr_01_0", "btryPwr_01_1", "btryPwr_01_2", "btryPwr_01_3"}, + {"btryPwr_02_0", "btryPwr_02_1", "btryPwr_02_2", "btryPwr_02_3"}, + {"btryPwr_03_0", "btryPwr_03_1", "btryPwr_03_2", "btryPwr_03_3"}}; - HomeButton::HomeButton(const HBMDataInfo* pDataInfo) : - mpHBInfo(pDataInfo), - mpLayout(NULL), - mpPaneManager(NULL), - mFader(30) { + HomeButton::HomeButton(const HBMDataInfo* pDataInfo) : mpHBInfo(pDataInfo), mpLayout(NULL), mpPaneManager(NULL), mFader(30) { mState = 2; mSelectBtnNum = HBM_SELECT_NULL; @@ -523,7 +300,7 @@ namespace homebutton { void HomeButton::createInstance(const HBMDataInfo* pDataInfo) { if (void* pMem = HBMAllocMem(sizeof(HomeButton))) { - spHomeButtonObj = new(pMem) HomeButton(pDataInfo); + spHomeButtonObj = new (pMem) HomeButton(pDataInfo); } } @@ -540,7 +317,7 @@ namespace homebutton { void setResource(nw4r::lyt::MultiArcResourceAccessor* multiArc, void* archiveData, const char* resDirectory) { if (archiveData != NULL) { void* pMem = HBMAllocMem(sizeof(nw4r::lyt::ArcResourceLink)); - nw4r::lyt::ArcResourceLink* resLink = new(pMem) nw4r::lyt::ArcResourceLink(); + nw4r::lyt::ArcResourceLink* resLink = new (pMem) nw4r::lyt::ArcResourceLink(); resLink->Set(archiveData, resDirectory); multiArc->Attach(resLink); } @@ -559,16 +336,16 @@ namespace homebutton { { void* pMem = HBMAllocMem(sizeof(nw4r::lyt::MultiArcResourceAccessor)); - mpResAccessor = new(pMem) nw4r::lyt::MultiArcResourceAccessor(); + mpResAccessor = new (pMem) nw4r::lyt::MultiArcResourceAccessor(); } - + setResource(mpResAccessor, mpHBInfo->layoutBuf, "arc"); setResource(mpResAccessor, mpHBInfo->lytLangBuf, "arc"); - + nw4r::lyt::FontRefLink* fontLink; { void* pMem = HBMAllocMem(sizeof(nw4r::lyt::FontRefLink)); - fontLink = new(pMem) nw4r::lyt::FontRefLink(); + fontLink = new (pMem) nw4r::lyt::FontRefLink(); } fontLink->Set("RevoIpl_UtrilloProGrecoStd_M_32_I4.brfnt", (nw4r::ut::Font*)mpHBInfo->fontBuf); mpResAccessor->RegistFont(fontLink); @@ -576,7 +353,7 @@ namespace homebutton { if (!mpHBInfo->cursor) { for (i = 0; i < res::eCursorLyt_Max; i++) { if (void* pMem = HBMAllocMem(sizeof(nw4r::lyt::Layout))) { - mpCursorLayout[i] = new(pMem) nw4r::lyt::Layout(); + mpCursorLayout[i] = new (pMem) nw4r::lyt::Layout(); } void* pBinary = mpResAccessor->GetResource(0, scCursorLytName[i], NULL); @@ -586,7 +363,7 @@ namespace homebutton { } if (void* pMem = HBMAllocMem(sizeof(nw4r::lyt::Layout))) { - mpLayout = new(pMem) nw4r::lyt::Layout(); + mpLayout = new (pMem) nw4r::lyt::Layout(); } { @@ -602,15 +379,14 @@ namespace homebutton { void* pBinary = mpResAccessor->GetResource(0, anmNameBuf, NULL); if (void* pMem = HBMAllocMem(sizeof(GroupAnmController))) { - mpAnmController[i] = new(pMem) GroupAnmController(); + mpAnmController[i] = new (pMem) GroupAnmController(); } mpAnmController[i]->mpAnimGroup = mpLayout->CreateAnimTransform(pBinary, mpResAccessor); mpAnmController[i]->mpGroup = mpLayout->GetGroupContainer()->FindGroupByName(scGrName[scAnmTable[i].pane]); - nw4r::lyt::PaneLinkList& rList = - mpAnmController[i]->mpGroup->GetPaneList(); + nw4r::lyt::PaneLinkList& rList = mpAnmController[i]->mpGroup->GetPaneList(); for (nw4r::lyt::PaneLinkList::Iterator it = rList.GetBeginIter(); it != rList.GetEndIter(); ++it) { it->mTarget->BindAnimation(mpAnmController[i]->mpAnimGroup, false); @@ -626,7 +402,7 @@ namespace homebutton { void* pBinary = mpResAccessor->GetResource(0, anmNameBuf, NULL); if (void* pMem = HBMAllocMem(sizeof(GroupAnmController))) { - mpGroupAnmController[i] = new(pMem) GroupAnmController(); + mpGroupAnmController[i] = new (pMem) GroupAnmController(); } mpGroupAnmController[i]->mpAnimGroup = mpLayout->CreateAnimTransform(pBinary, mpResAccessor); @@ -649,7 +425,7 @@ namespace homebutton { void* pBinary = mpResAccessor->GetResource(0, anmNameBuf, NULL); if (void* pMem = HBMAllocMem(sizeof(GroupAnmController))) { - mpPairGroupAnmController[i] = new(pMem) GroupAnmController(); + mpPairGroupAnmController[i] = new (pMem) GroupAnmController(); } mpPairGroupAnmController[i]->mpAnimGroup = mpLayout->CreateAnimTransform(pBinary, mpResAccessor); @@ -666,11 +442,11 @@ namespace homebutton { } if (void* pMem = HBMAllocMem(sizeof(HomeButtonEventHandler))) { - mpHomeButtonEventHandler = new(pMem) HomeButtonEventHandler(this); + mpHomeButtonEventHandler = new (pMem) HomeButtonEventHandler(this); } if (void* pMem = HBMAllocMem(sizeof(gui::PaneManager))) { - mpPaneManager = new(pMem) gui::PaneManager(mpHomeButtonEventHandler, spAllocator, NULL); + mpPaneManager = new (pMem) gui::PaneManager(mpHomeButtonEventHandler, spAllocator, NULL); } mpPaneManager->createLayoutScene(*mpLayout); @@ -683,12 +459,12 @@ namespace homebutton { } if (void* pMem = HBMAllocMem(sizeof(RemoteSpk))) { - mpRemoteSpk = new(pMem) RemoteSpk(mpHBInfo->spkSeBuf); + mpRemoteSpk = new (pMem) RemoteSpk(mpHBInfo->spkSeBuf); } for (i = 0; i < WPAD_MAX_CONTROLLERS; i++) { if (void* pMem = HBMAllocMem(sizeof(Controller))) { - mpController[i] = new(pMem) Controller(i, mpRemoteSpk); + mpController[i] = new (pMem) Controller(i, mpRemoteSpk); } } @@ -744,8 +520,7 @@ namespace homebutton { if (pConfig[i] == ',') { if (pConfig[i + 1] == '1') { mDialogFlag[j] = true; - } - else { + } else { mDialogFlag[j] = false; } @@ -763,7 +538,7 @@ namespace homebutton { int k = 0; bool insideStringFlag = false; wchar_t* message = static_cast(mpHBInfo->msgBuf); - + for (; message[i] != 0; i++) { if (message[i] == L'\"') { message[i] = 0; @@ -777,8 +552,7 @@ namespace homebutton { j = 0; k++; } - } - else { + } else { insideStringFlag = false; } } @@ -888,8 +662,7 @@ namespace homebutton { if (i < mVolumeNum) { idx = findGroupAnimator(i + res::eGrPane_vol_00, res::eGrAnim_sound_ylw); mpGroupAnmController[idx]->play(); - } - else { + } else { idx = findGroupAnimator(i + res::eGrPane_vol_00, res::eGrAnim_sound_gry); mpGroupAnmController[idx]->play(); } @@ -907,8 +680,7 @@ namespace homebutton { idx = findGroupAnimator(res::eGrPane_optnBtn_11_psh, res::eGrAnim_vb_btn_ylw_psh); mpGroupAnmController[idx]->play(); - } - else { + } else { idx = findGroupAnimator(res::eGrPane_optnBtn_10_psh, res::eGrAnim_vb_btn_ylw_psh); mpGroupAnmController[idx]->play(); @@ -965,8 +737,7 @@ namespace homebutton { mControllerFlag[i] = true; getController(i)->getInfoAsync(&mWpadInfo[i]); - } - else { + } else { if (!mpHBInfo->cursor) { mpCursorLayout[i]->GetRootPane()->FindPaneByName(scCursorPaneName, true)->SetVisible(false); } @@ -1008,8 +779,7 @@ namespace homebutton { if (getController(i)->isRumbling()) { getController(i)->stopMotor(); } - } - else { + } else { mOnPaneVibFrame[i] -= mpHBInfo->frameDelta; if (mOnPaneVibFrame[i] <= 0.0f || mState == 17) { @@ -1018,8 +788,7 @@ namespace homebutton { mOnPaneVibWaitFrame[i] = scOnPaneVibWaitTime; } } - } - else if (mOnPaneVibWaitFrame[i] > 0.0f) { + } else if (mOnPaneVibWaitFrame[i] > 0.0f) { mOnPaneVibWaitFrame[i] -= mpHBInfo->frameDelta; if (mOnPaneVibWaitFrame[i] <= 0.0f) { @@ -1036,8 +805,7 @@ namespace homebutton { mpLayout->GetRootPane()->FindPaneByName("back_00", true)->SetVisible(false); mpLayout->GetRootPane()->FindPaneByName("back_02", true)->SetVisible(true); - } - else { + } else { mSelectAnmNum = findGroupAnimator(res::eGrPane_hmMenu_strt, res::eGrAnim_hmMenu_strt); mpLayout->GetRootPane()->FindPaneByName("back_00", true)->SetVisible(true); @@ -1071,9 +839,7 @@ namespace homebutton { break; } case 3: { - if (!mpGroupAnmController[mSelectAnmNum]->isPlaying() && - mSelectAnmNum != res::eGrAnimator_optn_bar_in__close_bar_in) { - + if (!mpGroupAnmController[mSelectAnmNum]->isPlaying() && mSelectAnmNum != res::eGrAnimator_optn_bar_in__close_bar_in) { reset_battery(); mSelectAnmNum = res::ePairAnm_link_msg_in; mpPairGroupAnmController[mSelectAnmNum]->play(); @@ -1154,8 +920,7 @@ namespace homebutton { } mState = 7; - } - else { + } else { if (++mMsgCount <= scReConnectTime) { break; } @@ -1199,8 +964,7 @@ namespace homebutton { mpLayout->GetRootPane()->FindPaneByName(scFuncTextPaneName[res::eFuncTextPane_T_Dialog], true)->SetVisible(false); - } - else if (mSelectAnmNum == res::ePairAnm_link_msg_out) { + } else if (mSelectAnmNum == res::ePairAnm_link_msg_out) { mpLayout->GetRootPane()->FindPaneByName(scFuncTextPaneName[res::eFuncTextPane_T_msg_00], true)->SetVisible(false); mpLayout->GetRootPane()->FindPaneByName(scFuncTextPaneName[res::eFuncTextPane_T_msg_01], true)->SetVisible(false); @@ -1241,8 +1005,7 @@ namespace homebutton { } mState = 2; - } - else if (mSequence == SEQ_CONTROL) { + } else if (mSequence == SEQ_CONTROL) { mSelectAnmNum = res::ePairAnm_cntrl_wndw_opn; mpPairGroupAnmController[mSelectAnmNum]->play(); @@ -1289,12 +1052,10 @@ namespace homebutton { mState = 19; mFadeOutSeTime = mFader.getMaxFrame(); - if (mSelectBtnNum != HBM_SELECT_BTN3 && - mpHBInfo->sound_callback != NULL) { + if (mSelectBtnNum != HBM_SELECT_BTN3 && mpHBInfo->sound_callback != NULL) { mpHBInfo->sound_callback(HBMSEV_BEGIN_EXIT_ANIM, mFadeOutSeTime); } - } - else { + } else { updateTrigPane(); mSelectAnmNum = res::ePairAnm_cmn_msg_rtrn; mpPairGroupAnmController[mSelectAnmNum]->play(); @@ -1322,8 +1083,7 @@ namespace homebutton { mState = 19; mFadeOutSeTime = mFader.getMaxFrame(); - if (mSelectBtnNum != HBM_SELECT_BTN3 && - mpHBInfo->sound_callback != NULL) { + if (mSelectBtnNum != HBM_SELECT_BTN3 && mpHBInfo->sound_callback != NULL) { mpHBInfo->sound_callback(HBMSEV_BEGIN_EXIT_ANIM, mFadeOutSeTime); } @@ -1335,8 +1095,7 @@ namespace homebutton { if (!pAnim->isPlaying()) { mState = 17; fadeout_sound(0.0f); - } - else { + } else { f32 restFrame = pAnim->getMaxFrame() - pAnim->getCurrentFrame(); fadeout_sound(restFrame / mFadeOutSeTime); } @@ -1374,8 +1133,7 @@ namespace homebutton { } } - if (mSelectBtnNum != HBM_SELECT_BTN3 && - mpHBInfo->sound_callback != NULL) { + if (mSelectBtnNum != HBM_SELECT_BTN3 && mpHBInfo->sound_callback != NULL) { mpHBInfo->sound_callback(HBMSEV_BEGIN_BLACKOUT, 0); } @@ -1434,8 +1192,7 @@ namespace homebutton { VIFlush(); fadeout_sound(0.0f); - } - else { + } else { f32 restFrame = mFader.getMaxFrame() - mFader.getFrame(); fadeout_sound(restFrame / mFadeOutSeTime); } @@ -1487,10 +1244,9 @@ namespace homebutton { mpLayout->GetRootPane()->FindPaneByName(scFuncTextPaneName[res::eFuncTextPane_T_Dialog], true)->SetVisible(false); if (mpHBInfo->backFlag) { - mSelectAnmNum = findGroupAnimator(res::eGrPane_hmMenuBck_fnsh,res::eGrAnim_hmMenu_fnsh); - } - else { - mSelectAnmNum = findGroupAnimator(res::eGrPane_hmMenu_fnsh,res::eGrAnim_hmMenu_fnsh); + mSelectAnmNum = findGroupAnimator(res::eGrPane_hmMenuBck_fnsh, res::eGrAnim_hmMenu_fnsh); + } else { + mSelectAnmNum = findGroupAnimator(res::eGrPane_hmMenu_fnsh, res::eGrAnim_hmMenu_fnsh); } mpGroupAnmController[mSelectAnmNum]->play(); @@ -1503,16 +1259,13 @@ namespace homebutton { } void HomeButton::calc_letter() { - if (mLetterFlag && - !mpPairGroupAnmController[res::ePairAnm_ltrIcn_on]->isPlaying()) { - + if (mLetterFlag && !mpPairGroupAnmController[res::ePairAnm_ltrIcn_on]->isPlaying()) { mpLayout->GetRootPane()->FindPaneByName(scFuncPaneName[res::eFuncPane_let_icn_00], true)->SetVisible(true); mpPairGroupAnmController[res::ePairAnm_ltrIcn_on]->setAnmType(ANIM_TYPE_LOOP); mpPairGroupAnmController[res::ePairAnm_ltrIcn_on]->play(); - } - else if (!mLetterFlag) { + } else if (!mLetterFlag) { mpLayout->GetRootPane()->FindPaneByName(scFuncPaneName[res::eFuncPane_let_icn_00], true)->SetVisible(false); mpPairGroupAnmController[res::ePairAnm_ltrIcn_on]->stop(); @@ -1523,8 +1276,7 @@ namespace homebutton { for (int i = 0; i < res::eBatteryPane_Max; i++) { if (i < mWpadInfo[chan].battery) { mpLayout->GetRootPane()->FindPaneByName(scBatteryPaneName[chan][i], true)->SetVisible(true); - } - else { + } else { mpLayout->GetRootPane()->FindPaneByName(scBatteryPaneName[chan][i], true)->SetVisible(false); } } @@ -1533,8 +1285,7 @@ namespace homebutton { int idx = findGroupAnimator(chan + res::eGrPane_plyr_00, res::eGrAnim_btry_red); mpGroupAnmController[idx]->play(); - } - else { + } else { int idx = findGroupAnimator(chan + res::eGrPane_plyr_00, res::eGrAnim_btry_wht); mpGroupAnmController[idx]->play(); @@ -1566,12 +1317,9 @@ namespace homebutton { HomeButton* pHBObj = HomeButton::getInstance(); - if (!WPADIsSpeakerEnabled(chan) || - !pHBObj->getController(chan)->isPlayReady()) { - + if (!WPADIsSpeakerEnabled(chan) || !pHBObj->getController(chan)->isPlayReady()) { pHBObj->setSpeakerAlarm(chan, 50); - } - else { + } else { pHBObj->getController(chan)->playSound(pHBObj->getSoundArchivePlayer(), id); } } @@ -1599,8 +1347,7 @@ namespace homebutton { pHBObj->setSimpleSyncFlag(true); retrySuccessFlag = true; } - } - else /* HomeButton::SYNC_STOP */ { + } else /* HomeButton::SYNC_STOP */ { if (WPADStopSimpleSync()) { retrySuccessFlag = true; } @@ -1632,7 +1379,7 @@ namespace homebutton { } void HomeButton::update(const HBMControllerData* pController) { - #define IsValidDevType_(x) ((x)->use_devtype == WPAD_DEV_CLASSIC || (x)->kpad->dev_type == WPAD_DEV_CLASSIC) +#define IsValidDevType_(x) ((x)->use_devtype == WPAD_DEV_CLASSIC || (x)->kpad->dev_type == WPAD_DEV_CLASSIC) int i, idx; @@ -1640,26 +1387,18 @@ namespace homebutton { for (i = 0; i < WPAD_MAX_CONTROLLERS; i++) { if (pController->wiiCon[i].kpad != NULL) { - - if (pController->wiiCon[i].kpad->wpad_err != - WPAD_ERR_NO_CONTROLLER) { - + if (pController->wiiCon[i].kpad->wpad_err != WPAD_ERR_NO_CONTROLLER) { if (mPadDrawTime[i] > static_cast(scPadDrawWaitTime)) { - if (pController->wiiCon[i].kpad->wpad_err == WPAD_ERR_OK) { bool pointerEnableFlag; - if (pController->wiiCon[i].use_devtype != WPAD_DEV_CLASSIC && - pController->wiiCon[i].kpad->dev_type != WPAD_DEV_CLASSIC) { - + if (pController->wiiCon[i].use_devtype != WPAD_DEV_CLASSIC && pController->wiiCon[i].kpad->dev_type != WPAD_DEV_CLASSIC) { if (pController->wiiCon[i].kpad->dpd_valid_fg > 0) { pointerEnableFlag = true; - } - else { + } else { pointerEnableFlag = false; } - } - else { + } else { pointerEnableFlag = true; } @@ -1669,29 +1408,23 @@ namespace homebutton { mpCursorLayout[i]->GetRootPane()->FindPaneByName(scCursorPaneName, true)->SetVisible(true); } } - } - else { + } else { mpController[i]->setKpad(&pController->wiiCon[i], false); mPadDrawTime[i]++; } - if (pController->wiiCon[i].use_devtype != WPAD_DEV_CLASSIC && - pController->wiiCon[i].kpad->dev_type != WPAD_DEV_CLASSIC) { - + if (pController->wiiCon[i].use_devtype != WPAD_DEV_CLASSIC && pController->wiiCon[i].kpad->dev_type != WPAD_DEV_CLASSIC) { if (pController->wiiCon[i].kpad->dpd_valid_fg <= 0) { s32 result; u32 type; result = WPADProbe(i, &type); - if (pController->wiiCon[i].kpad->wpad_err != WPAD_ERR_COMMUNICATION_ERROR && - result != WPAD_ERR_COMMUNICATION_ERROR) { - + if (pController->wiiCon[i].kpad->wpad_err != WPAD_ERR_COMMUNICATION_ERROR && result != WPAD_ERR_COMMUNICATION_ERROR) { mpController[i]->setInValidPos(); } } } - } - else { + } else { mpController[i]->setInValidPos(); if (!mpHBInfo->cursor) { @@ -1730,8 +1463,7 @@ namespace homebutton { if (pController->wiiCon[i].use_devtype == WPAD_DEV_CLASSIC && pController->wiiCon[i].kpad->dev_type == WPAD_DEV_CLASSIC) { vec = nw4r::math::VEC3(0.0f, 0.0f, 15.0f); - } - else { + } else { Vec2 v = pController->wiiCon[i].kpad->horizon; f32 rad = nw4r::math::Atan2Deg(-v.y, v.x); @@ -1758,8 +1490,7 @@ namespace homebutton { if (getController(i)->getBatteryFlag()) { calc_battery(i); } - } - else { + } else { if (mControllerFlag[i]) { idx = findGroupAnimator(i + res::eGrPane_plyr_00, res::eGrAnim_btry_wht); mpGroupAnmController[idx]->play(); @@ -1789,8 +1520,7 @@ namespace homebutton { if (mGetPadInfoTime > scGetPadInfoTime) { mGetPadInfoTime = 0; - } - else { + } else { mGetPadInfoTime++; } } @@ -1802,7 +1532,7 @@ namespace homebutton { HBController* pController = mpController[id]->getController(); Vec2 pos; - Vec2 src = { pController->x, pController->y }; + Vec2 src = {pController->x, pController->y}; Rect bound; bound.left = -416.0; @@ -1819,23 +1549,17 @@ namespace homebutton { if (-516.0f > pos.x) { pos.x = -516.0f; - } - else if (516.0f < pos.x) { + } else if (516.0f < pos.x) { pos.x = 516.0f; - } - else if (-328.0f > pos.y) { + } else if (-328.0f > pos.y) { pos.y = -328.0f; - } - else if (328.0f < pos.y) { + } else if (328.0f < pos.y) { pos.y = 328.0f; } mpPaneManager->update(id, pos.x, -pos.y, pController->trig, pController->hold, pController->release, pController); - if (((pController->trig & (PAD_BUTTON_START << 16)) | - (pController->trig & WPAD_BUTTON_HOME)) && - isActive()) { - + if (((pController->trig & (PAD_BUTTON_START << 16)) | (pController->trig & WPAD_BUTTON_HOME)) && isActive()) { if (mSequence == SEQ_CONTROL) { mpPaneManager->update(id, 0.0f, -180.0f, 0, 0, 0, NULL); @@ -1852,8 +1576,7 @@ namespace homebutton { mSequence = SEQ_NORMAL; play_sound(HBMSE_CLOSE_CONTROLLER); - } - else if (mSequence == SEQ_NORMAL) { + } else if (mSequence == SEQ_NORMAL) { if (mpPairGroupAnmController[res::ePairAnm_hmMenu_bar_in]->isPlaying()) { mpPairGroupAnmController[res::ePairAnm_hmMenu_bar_in]->stop(); } @@ -1870,11 +1593,8 @@ namespace homebutton { mState = 14; play_sound(HBMSE_RETURN_APP); } - } - else if (mSequence == SEQ_CONTROL && isActive()) { - if ((pController->trig & WPAD_BUTTON_MINUS) || - (pController->trig & (PAD_BUTTON_LEFT << 16))) { - + } else if (mSequence == SEQ_CONTROL && isActive()) { + if ((pController->trig & WPAD_BUTTON_MINUS) || (pController->trig & (PAD_BUTTON_LEFT << 16))) { if (mVolumeNum > 0) { mVolumeNum--; @@ -1895,8 +1615,7 @@ namespace homebutton { getController(i)->playSound(mpSoundArchivePlayer, HBM_SPK_SE_CONNECT1); } - } - else { + } else { play_sound(HBMSE_VOLUME_MINUS); for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) { @@ -1906,13 +1625,11 @@ namespace homebutton { } } - } - else { + } else { play_sound(HBMSE_NOTHING_DONE); } - } - else if ((pController->trig & WPAD_BUTTON_PLUS) || (pController->trig & (PAD_BUTTON_RIGHT << 16))) { + } else if ((pController->trig & WPAD_BUTTON_PLUS) || (pController->trig & (PAD_BUTTON_RIGHT << 16))) { if (mVolumeNum < HBM_MAX_VOLUME) { idx = findGroupAnimator(mVolumeNum + res::eGrPane_vol_00, res::eGrAnim_sound_gry); mpGroupAnmController[idx]->stop(); @@ -1933,8 +1650,7 @@ namespace homebutton { getController(i)->playSound(mpSoundArchivePlayer, HBM_SPK_SE_CONNECT1); } - } - else { + } else { play_sound(HBMSE_VOLUME_PLUS); for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) { @@ -1944,15 +1660,13 @@ namespace homebutton { } } - } - else { + } else { play_sound(HBMSE_NOTHING_DONE); } } } - } - else if (mSequence == SEQ_CONTROL && mState == 5 && !mpPairGroupAnmController[mSelectAnmNum]->isPlaying()) { + } else if (mSequence == SEQ_CONTROL && mState == 5 && !mpPairGroupAnmController[mSelectAnmNum]->isPlaying()) { HBController* pController = mpController[id]->getController(); if (pController->trig != 0) { mMsgCount = scReConnectTime; @@ -1963,7 +1677,7 @@ namespace homebutton { void HomeButton::update_posController(int id) { HBController* pController = mpController[id]->getController(); Vec2 pos; - Vec2 src = { pController->x, pController->y }; + Vec2 src = {pController->x, pController->y}; Rect bound; bound.left = -416.0; @@ -1980,14 +1694,11 @@ namespace homebutton { if (-516.0f > pos.x) { pos.x = -516.0f; - } - else if (516.0f < pos.x) { + } else if (516.0f < pos.x) { pos.x = 516.0f; - } - else if (-328.0f > pos.y) { + } else if (-328.0f > pos.y) { pos.y = -328.0f; - } - else if (328.0f < pos.y) { + } else if (328.0f < pos.y) { pos.y = 328.0f; } nw4r::math::VEC2 pos2(pos.x, -pos.y); @@ -2006,12 +1717,10 @@ namespace homebutton { case SEQ_NORMAL: { for (i = 0; i < res::eFuncTouchPane_Max; i++) { if (i < res::eFuncTouchPane_B_optnBtn_00 || i == res::eFuncTouchPane_cntrl_00) { - nw4r::lyt::Pane* pTouchPane = mpLayout->GetRootPane()->FindPaneByName(scFuncTouchPaneName[i], true); mpPaneManager->getPaneComponentByPane(pTouchPane)->setTriggerTarget(true); - } - else { + } else { nw4r::lyt::Pane* pTouchPane = mpLayout->GetRootPane()->FindPaneByName(scFuncTouchPaneName[i], true); mpPaneManager->getPaneComponentByPane(pTouchPane)->setTriggerTarget(false); @@ -2026,8 +1735,7 @@ namespace homebutton { nw4r::lyt::Pane* pTouchPane = mpLayout->GetRootPane()->FindPaneByName(scFuncTouchPaneName[i], true); mpPaneManager->getPaneComponentByPane(pTouchPane)->setTriggerTarget(true); - } - else { + } else { nw4r::lyt::Pane* pTouchPane = mpLayout->GetRootPane()->FindPaneByName(scFuncTouchPaneName[i], true); mpPaneManager->getPaneComponentByPane(pTouchPane)->setTriggerTarget(false); @@ -2038,16 +1746,14 @@ namespace homebutton { } case SEQ_COMMON: { for (i = 0; i < res::eFuncTouchPane_Max; i++) { - if (i < res::eFuncTouchPane_B_BtnA || i == res::eFuncTouchPane_cntrl_00) { nw4r::lyt::Pane* pTouchPane = mpLayout->GetRootPane()->FindPaneByName(scFuncTouchPaneName[i], true); mpPaneManager->getPaneComponentByPane(pTouchPane)->setTriggerTarget(false); - } - else { + } else { nw4r::lyt::Pane* pTouchPane = mpLayout->GetRootPane()->FindPaneByName(scFuncTouchPaneName[i], true); - mpPaneManager->getPaneComponentByPane(pTouchPane) ->setTriggerTarget(true); + mpPaneManager->getPaneComponentByPane(pTouchPane)->setTriggerTarget(true); } } @@ -2072,8 +1778,7 @@ namespace homebutton { onFlag = true; } - } - else { + } else { switch (btnNo - mButtonNum) { case res::eFuncTouchPane_B_btn_00: { if (mSequence == SEQ_NORMAL) { @@ -2085,8 +1790,7 @@ namespace homebutton { setForcusSE(); onFlag = true; - } - else { + } else { mBar0AnmRev = res::ePairAnm_hmMenu_bar_in; } } @@ -2105,12 +1809,10 @@ namespace homebutton { setForcusSE(); onFlag = true; - } - else { + } else { mBar1AnmRev = idx; } - } - else if (mSequence == SEQ_CONTROL) { + } else if (mSequence == SEQ_CONTROL) { idx = findGroupAnimator(res::eGrPane_optn_bar_in, res::eGrAnim_close_bar_in); if (isDownBarActive()) { @@ -2120,8 +1822,7 @@ namespace homebutton { setForcusSE(); onFlag = true; - } - else { + } else { mBar1AnmRev = idx; } } @@ -2213,8 +1914,7 @@ namespace homebutton { if (btnNo == mButtonNum + res::eFuncTouchPane_B_bar_10 || btnNo == mButtonNum + res::eFuncTouchPane_cntrl_00) { mPaneCounter[mButtonNum + res::eFuncTouchPane_B_bar_10]++; mPaneCounter[mButtonNum + res::eFuncTouchPane_cntrl_00]++; - } - else { + } else { mPaneCounter[btnNo]++; } @@ -2234,8 +1934,7 @@ namespace homebutton { if (btnNo == mButtonNum + res::eFuncTouchPane_B_bar_10 || btnNo == mButtonNum + res::eFuncTouchPane_cntrl_00) { mPaneCounter[mButtonNum + res::eFuncTouchPane_B_bar_10]--; mPaneCounter[mButtonNum + res::eFuncTouchPane_cntrl_00]--; - } - else { + } else { mPaneCounter[btnNo]--; } } @@ -2244,8 +1943,7 @@ namespace homebutton { if (mSequence != SEQ_COMMON && btnNo < mButtonNum) { idx = findAnimator(btnNo, res::eAnim_cntBtn_out); mpAnmController[idx]->play(); - } - else { + } else { switch (btnNo - mButtonNum) { case res::eFuncTouchPane_B_btn_00: { if (mSequence == SEQ_NORMAL) { @@ -2254,8 +1952,7 @@ namespace homebutton { mBar0AnmRevHold = res::ePairAnm_hmMenu_bar_out; mBar0AnmRev = 0; - } - else { + } else { mBar0AnmRev = res::ePairAnm_hmMenu_bar_out; } } @@ -2271,20 +1968,17 @@ namespace homebutton { mpGroupAnmController[idx]->play(); mBar1AnmRevHold = idx; mBar1AnmRev = 0; - } - else { + } else { mBar1AnmRev = idx; } - } - else if (mSequence == SEQ_CONTROL) { + } else if (mSequence == SEQ_CONTROL) { idx = findGroupAnimator(res::eGrPane_optn_bar_out, res::eGrAnim_close_bar_out); if (isDownBarActive()) { mpGroupAnmController[idx]->play(); mBar1AnmRevHold = idx; mBar1AnmRev = 0; - } - else { + } else { mBar1AnmRev = idx; } } @@ -2378,13 +2072,11 @@ namespace homebutton { pTextBox->SetString(mpText[mpHBInfo->region][btnNo + 2], 0); mpLayout->GetRootPane()->FindPaneByName(scFuncTextPaneName[res::eFuncTextPane_T_Dialog], true)->SetVisible(true); - } - else { + } else { mState = 15; } - } - else { + } else { switch (btnNo - mButtonNum) { case res::eFuncTouchPane_B_btn_00: { if (mpPairGroupAnmController[res::ePairAnm_hmMenu_bar_out]->isPlaying()) { @@ -2420,8 +2112,7 @@ namespace homebutton { mSequence = SEQ_NORMAL; play_sound(HBMSE_CLOSE_CONTROLLER); - } - else if (mSequence == SEQ_NORMAL) { + } else if (mSequence == SEQ_NORMAL) { mpPairGroupAnmController[res::ePairAnm_optn_bar_psh]->play(); mSelectAnmNum = res::ePairAnm_cntrl_up; @@ -2457,8 +2148,7 @@ namespace homebutton { getController(i)->playSound(mpSoundArchivePlayer, HBM_SPK_SE_CONNECT1); } - } - else { + } else { play_sound(HBMSE_VOLUME_MINUS); for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) { @@ -2470,8 +2160,7 @@ namespace homebutton { idx = findGroupAnimator(res::eGrPane_optnBtn_00_psh, res::eGrAnim_optn_btn_psh); mpGroupAnmController[idx]->play(); - } - else { + } else { play_sound(HBMSE_NOTHING_DONE); } @@ -2495,8 +2184,7 @@ namespace homebutton { getController(i)->playSound(mpSoundArchivePlayer, HBM_SPK_SE_CONNECT1); } - } - else { + } else { play_sound(HBMSE_VOLUME_PLUS); for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) { @@ -2508,8 +2196,7 @@ namespace homebutton { idx = findGroupAnimator(res::eGrPane_optnBtn_01_psh, res::eGrAnim_optn_btn_psh); mpGroupAnmController[idx]->play(); - } - else { + } else { play_sound(HBMSE_NOTHING_DONE); } @@ -2528,8 +2215,7 @@ namespace homebutton { mpGroupAnmController[mSelectAnmNum]->play(); play_sound(HBMSE_VIBE_ON); - } - else { + } else { mSelectAnmNum = findGroupAnimator(res::eGrPane_optnBtn_10_cntrl, res::eGrAnim_vb_btn_ylw_ylw); mpGroupAnmController[mSelectAnmNum]->play(); @@ -2558,8 +2244,7 @@ namespace homebutton { mpGroupAnmController[mSelectAnmNum]->play(); play_sound(HBMSE_VIBE_OFF); - } - else { + } else { play_sound(HBMSE_NOTHING_DONE); } @@ -2600,8 +2285,7 @@ namespace homebutton { if (mSelectBtnNum == HBM_SELECT_BTN1) { play_sound(HBMSE_GOTO_MENU); - } - else if (mSelectBtnNum == HBM_SELECT_BTN2) { + } else if (mSelectBtnNum == HBM_SELECT_BTN2) { play_sound(HBMSE_RESET_APP); } @@ -2651,8 +2335,7 @@ namespace homebutton { mPaneCounter[mButtonNum + res::eFuncTouchPane_B_btn_00] = 0; } - } - else { + } else { idx = findGroupAnimator(res::eGrPane_optn_bar_out, res::eGrAnim_optn_bar_out); mpGroupAnmController[idx]->play(); @@ -2693,8 +2376,7 @@ namespace homebutton { for (int i = 0; i < 8; i++) { mpPaneManager->update(i, -10000.0f, -10000.0f, 0, 0, 0, NULL); } - } - else { + } else { mpPaneManager->update(num, -10000.0f, -10000.0f, 0, 0, 0, NULL); } } @@ -2706,10 +2388,8 @@ namespace homebutton { bool HomeButton::isUpBarActive() const { bool flag = true; - if (!isActive() || - mpPairGroupAnmController[res::ePairAnm_hmMenu_bar_out]->isPlaying() || + if (!isActive() || mpPairGroupAnmController[res::ePairAnm_hmMenu_bar_out]->isPlaying() || mpPairGroupAnmController[res::ePairAnm_hmMenu_bar_in]->isPlaying()) { - flag = false; } @@ -2720,17 +2400,13 @@ namespace homebutton { bool flag = true; int idx[4]; - idx[0] = findGroupAnimator(res::eGrPane_optn_bar_in, res::eGrAnim_optn_bar_in); + idx[0] = findGroupAnimator(res::eGrPane_optn_bar_in, res::eGrAnim_optn_bar_in); idx[1] = findGroupAnimator(res::eGrPane_optn_bar_out, res::eGrAnim_optn_bar_out); - idx[2] = findGroupAnimator(res::eGrPane_optn_bar_in, res::eGrAnim_close_bar_in); + idx[2] = findGroupAnimator(res::eGrPane_optn_bar_in, res::eGrAnim_close_bar_in); idx[3] = findGroupAnimator(res::eGrPane_optn_bar_out, res::eGrAnim_close_bar_out); - if (!isActive() || - mpGroupAnmController[idx[0]]->isPlaying() || - mpGroupAnmController[idx[1]]->isPlaying() || - mpGroupAnmController[idx[2]]->isPlaying() || - mpGroupAnmController[idx[3]]->isPlaying()) { - + if (!isActive() || mpGroupAnmController[idx[0]]->isPlaying() || mpGroupAnmController[idx[1]]->isPlaying() || + mpGroupAnmController[idx[2]]->isPlaying() || mpGroupAnmController[idx[3]]->isPlaying()) { flag = false; } @@ -2769,9 +2445,7 @@ namespace homebutton { int HomeButton::findGroupAnimator(int grPane, int grAnm) { for (int i = 0; i < res::eGrAnimator_Max; i++) { - if (scGroupAnmTable[i].pane == grPane && - scGroupAnmTable[i].anm == grAnm) { - + if (scGroupAnmTable[i].pane == grPane && scGroupAnmTable[i].anm == grAnm) { return i; } } @@ -2811,8 +2485,7 @@ namespace homebutton { mpCursorLayout[i]->GetRootPane()->SetScale(scale); } } - } - else { + } else { scale = nw4r::math::VEC2(1.0f, 1.0f); mpLayout->GetRootPane()->SetScale(scale); @@ -2861,8 +2534,7 @@ namespace homebutton { break; } case EventHandler::ON_TRIG: { - if ((pController->trig & WPAD_BUTTON_A) || - (pController->trig & (PAD_BUTTON_A << 16))) { + if ((pController->trig & WPAD_BUTTON_A) || (pController->trig & (PAD_BUTTON_A << 16))) { pHBObj->startTrigEvent(pPaneName); } @@ -2880,15 +2552,13 @@ namespace homebutton { void HomeButton::BlackFader::calc() { if (state_ == 1) { frame_++; - } - else if (state_ == 2) { + } else if (state_ == 2) { frame_--; } if (frame_ < 0) { frame_ = 0; - } - else if (frame_ > maxFrame_) { + } else if (frame_ > maxFrame_) { frame_ = maxFrame_; } } @@ -2937,7 +2607,7 @@ namespace homebutton { GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_NOOP); GXSetAlphaUpdate(GX_FALSE); GXSetZMode(GX_FALSE, GX_ALWAYS, GX_FALSE); - + GXSetNumIndStages(0); GXSetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA); GXSetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP0, GX_TEV_SWAP0); @@ -2946,7 +2616,8 @@ namespace homebutton { static void drawBlackPlate(f32 left, f32 top, f32 right, f32 bottom, GXColor clr) { GXSetTevColor(GX_TEVREG0, clr); - GXBegin(GX_QUADS, GX_VTXFMT0, 4); { + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + { GXPosition2f32(left, top); GXPosition2f32(left, bottom); GXPosition2f32(right, bottom); @@ -3008,4 +2679,4 @@ namespace homebutton { } } } -} +} // namespace homebutton diff --git a/src/homebutton/HBMController.cpp b/src/homebutton/HBMController.cpp index 9565b495..3b89fb5b 100644 --- a/src/homebutton/HBMController.cpp +++ b/src/homebutton/HBMController.cpp @@ -12,8 +12,8 @@ namespace homebutton { bool Controller::sBatteryFlag[WPAD_MAX_CONTROLLERS]; bool Controller::lbl_816989BC[WPAD_MAX_CONTROLLERS]; - OSAlarm Controller::sAlarm[WPAD_MAX_CONTROLLERS]; - OSAlarm Controller::sAlarmSoundOff[WPAD_MAX_CONTROLLERS]; + OSAlarm Controller::sAlarm[WPAD_MAX_CONTROLLERS]; + OSAlarm Controller::sAlarmSoundOff[WPAD_MAX_CONTROLLERS]; Controller* Controller::sThis[WPAD_MAX_CONTROLLERS]; void Controller::wpadConnectCallback(s32 chan, s32 result) { @@ -121,12 +121,10 @@ namespace homebutton { } if (updatePos) { - if (pPadData->kpad->dev_type == WPAD_DEV_CLASSIC && - pPadData->use_devtype == WPAD_DEV_CLASSIC) { + if (pPadData->kpad->dev_type == WPAD_DEV_CLASSIC && pPadData->use_devtype == WPAD_DEV_CLASSIC) { mHBController.x = pPadData->pos.x; mHBController.y = pPadData->pos.y; - } - else { + } else { mHBController.x = pPadData->kpad->pos.x; mHBController.y = pPadData->kpad->pos.y; } @@ -141,21 +139,33 @@ namespace homebutton { u32 t = pPadData->kpad->ex_status.cl.trig; u32 r = pPadData->kpad->ex_status.cl.release; - if (h & WPAD_BUTTON_CL_A) mHBController.hold |= WPAD_BUTTON_A; - if (t & WPAD_BUTTON_CL_A) mHBController.trig |= WPAD_BUTTON_A; - if (r & WPAD_BUTTON_CL_A) mHBController.release |= WPAD_BUTTON_A; + if (h & WPAD_BUTTON_CL_A) + mHBController.hold |= WPAD_BUTTON_A; + if (t & WPAD_BUTTON_CL_A) + mHBController.trig |= WPAD_BUTTON_A; + if (r & WPAD_BUTTON_CL_A) + mHBController.release |= WPAD_BUTTON_A; - if (h & WPAD_BUTTON_CL_PLUS) mHBController.hold |= WPAD_BUTTON_PLUS; - if (t & WPAD_BUTTON_CL_PLUS) mHBController.trig |= WPAD_BUTTON_PLUS; - if (r & WPAD_BUTTON_CL_PLUS) mHBController.release |= WPAD_BUTTON_PLUS; + if (h & WPAD_BUTTON_CL_PLUS) + mHBController.hold |= WPAD_BUTTON_PLUS; + if (t & WPAD_BUTTON_CL_PLUS) + mHBController.trig |= WPAD_BUTTON_PLUS; + if (r & WPAD_BUTTON_CL_PLUS) + mHBController.release |= WPAD_BUTTON_PLUS; - if (h & WPAD_BUTTON_CL_MINUS) mHBController.hold |= WPAD_BUTTON_MINUS; - if (t & WPAD_BUTTON_CL_MINUS) mHBController.trig |= WPAD_BUTTON_MINUS; - if (r & WPAD_BUTTON_CL_MINUS) mHBController.release |= WPAD_BUTTON_MINUS; + if (h & WPAD_BUTTON_CL_MINUS) + mHBController.hold |= WPAD_BUTTON_MINUS; + if (t & WPAD_BUTTON_CL_MINUS) + mHBController.trig |= WPAD_BUTTON_MINUS; + if (r & WPAD_BUTTON_CL_MINUS) + mHBController.release |= WPAD_BUTTON_MINUS; - if (h & WPAD_BUTTON_CL_HOME) mHBController.hold |= WPAD_BUTTON_HOME; - if (t & WPAD_BUTTON_CL_HOME) mHBController.trig |= WPAD_BUTTON_HOME; - if (r & WPAD_BUTTON_CL_HOME) mHBController.release |= WPAD_BUTTON_HOME; + if (h & WPAD_BUTTON_CL_HOME) + mHBController.hold |= WPAD_BUTTON_HOME; + if (t & WPAD_BUTTON_CL_HOME) + mHBController.trig |= WPAD_BUTTON_HOME; + if (r & WPAD_BUTTON_CL_HOME) + mHBController.release |= WPAD_BUTTON_HOME; } } @@ -179,7 +189,6 @@ namespace homebutton { } void Controller::disconnect() { - } void Controller::setSpeakerVol(f32 vol) { @@ -310,4 +319,4 @@ namespace homebutton { sBatteryFlag[getChan()] = false; } -} +} // namespace homebutton diff --git a/src/homebutton/HBMFrameController.cpp b/src/homebutton/HBMFrameController.cpp index d6cb93a5..80d5077e 100644 --- a/src/homebutton/HBMFrameController.cpp +++ b/src/homebutton/HBMFrameController.cpp @@ -20,8 +20,7 @@ namespace homebutton { float frame; if (mAnmType == ANIM_TYPE_BACKWARD) { frame = mMaxFrame; - } - else { + } else { frame = mMinFrame; } mFrame = frame; @@ -61,8 +60,7 @@ namespace homebutton { mFrame = getLastFrame(); mbAlternateBack = true; } - } - else { + } else { if ((mFrame -= mDelta) <= mMinFrame) { mFrame = mMinFrame; mbAlternateBack = false; @@ -73,4 +71,4 @@ namespace homebutton { } } } -} +} // namespace homebutton diff --git a/src/homebutton/HBMGUIManager.cpp b/src/homebutton/HBMGUIManager.cpp index 7b2bce5c..9a1adb2c 100644 --- a/src/homebutton/HBMGUIManager.cpp +++ b/src/homebutton/HBMGUIManager.cpp @@ -12,7 +12,7 @@ namespace homebutton { GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); - + GXSetCullMode(GX_CULL_NONE); GXSetNumChans(1); @@ -33,12 +33,14 @@ namespace homebutton { GXSetLineWidth(width, GX_TO_ZERO); // Draw the line - GXBegin(GX_LINES, GX_VTXFMT0, 2); { + GXBegin(GX_LINES, GX_VTXFMT0, 2); + { GXPosition3f32(x0, y0, z); GXColor1u32(*(u32*)&color); GXPosition3f32(x1, y1, z); GXColor1u32(*(u32*)&color); - } GXEnd(); + } + GXEnd(); } bool Component::update(int point, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data) { @@ -50,16 +52,14 @@ namespace homebutton { if (isPointed(point)) { onMove(x, y); mpManager->onEvent(getID(), EventHandler::ON_MOVE, data); - } - else { + } else { setPointed(point, true); onPoint(); mpManager->onEvent(getID(), EventHandler::ON_POINT, data); } touched = true; - } - else { + } else { // Not colliding with component if (isPointed(point)) { setPointed(point, false); @@ -80,8 +80,7 @@ namespace homebutton { // Then delete them from memory. if (mpAllocator) { MEMFreeToAllocator(mpAllocator, p); - } - else { + } else { delete p; } // Next component to kill! @@ -102,10 +101,9 @@ namespace homebutton { component->setManager(this); if (mpAllocator) { void* pBuf = MEMAllocFromAllocator(mpAllocator, sizeof(IDToComponent)); - IDToComponent* p = new(pBuf) IDToComponent(id, component); + IDToComponent* p = new (pBuf) IDToComponent(id, component); nw4r::ut::List_Append(&mComponents, p); - } - else { + } else { IDToComponent* p = new IDToComponent(id, component); nw4r::ut::List_Append(&mComponents, p); } @@ -178,8 +176,7 @@ namespace homebutton { if (mpAllocator) { MEMFreeToAllocator(mpAllocator, p->mpComponent); MEMFreeToAllocator(mpAllocator, p); - } - else { + } else { delete p->mpComponent; delete p; } @@ -205,10 +202,9 @@ namespace homebutton { void* pComBuf = MEMAllocFromAllocator(mpAllocator, sizeof(PaneComponent)); void* pBuf = MEMAllocFromAllocator(mpAllocator, sizeof(PaneToComponent)); - pComponent = new(pComBuf) PaneComponent(suIDCounter); - pToComponent = new(pBuf) PaneToComponent(&(*it), pComponent); - } - else { + pComponent = new (pComBuf) PaneComponent(suIDCounter); + pToComponent = new (pBuf) PaneToComponent(&(*it), pComponent); + } else { pComponent = new PaneComponent(suIDCounter); pToComponent = new PaneToComponent(&(*it), pComponent); } @@ -272,11 +268,9 @@ namespace homebutton { nw4r::ut::Rect rect = mpPane->GetPaneRect(*drawInfo); // If position is touching pane? - if (rect.left <= pos.x && pos.x <= rect.right - && rect.bottom <= pos.y && pos.y <= rect.top) { + if (rect.left <= pos.x && pos.x <= rect.right && rect.bottom <= pos.y && pos.y <= rect.top) { return true; - } - else { + } else { return false; } } @@ -314,9 +308,9 @@ namespace homebutton { } return is_visible(pane->GetParent()); } - + bool PaneComponent::isVisible() { return is_visible(mpPane); } - } -} + } // namespace gui +} // namespace homebutton diff --git a/src/homebutton/HBMRemoteSpk.cpp b/src/homebutton/HBMRemoteSpk.cpp index 167196b9..9b203a31 100644 --- a/src/homebutton/HBMRemoteSpk.cpp +++ b/src/homebutton/HBMRemoteSpk.cpp @@ -80,8 +80,7 @@ namespace homebutton { pInfo->seId = -1; pInfo->in_pcm = NULL; } - } - else { + } else { pInfo->cannotSendCnt++; // @bug 300 is out of range of a signed, 8 bit integer @@ -109,8 +108,7 @@ namespace homebutton { if (pSpkSeBuf != NULL) { available = ARCInitHandle(pSpkSeBuf, &handle); - } - else { + } else { available = false; } @@ -142,7 +140,8 @@ namespace homebutton { } OSCreateAlarm(&speakerAlarm); - OSSetPeriodicAlarm(&speakerAlarm, OSGetTime(), OSNanosecondsToTicks(nw4r::snd::detail::RemoteSpeakerManager::SPEAKER_ALARM_PERIOD_NSEC),&UpdateSpeaker); + OSSetPeriodicAlarm(&speakerAlarm, OSGetTime(), OSNanosecondsToTicks(nw4r::snd::detail::RemoteSpeakerManager::SPEAKER_ALARM_PERIOD_NSEC), + &UpdateSpeaker); } void RemoteSpk::Stop() { @@ -249,4 +248,4 @@ namespace homebutton { bool RemoteSpk::isPlayReady(s32 chan) const { return info[chan].playReady != false; } -} +} // namespace homebutton diff --git a/src/iplwww/www_message.cpp b/src/iplwww/www_message.cpp index f14b5c39..7038b786 100644 --- a/src/iplwww/www_message.cpp +++ b/src/iplwww/www_message.cpp @@ -5,7 +5,7 @@ namespace ext_ead { BOOL ut_message_base::SendMessage(OSMessage msg, s32 flags) { return OSSendMessage(&mpMsgQueue, msg, flags) != FALSE; } - + BOOL ut_message_base::JamMessage(OSMessage msg, s32 flags) { return OSJamMessage(&mpMsgQueue, msg, flags) != FALSE; } @@ -17,5 +17,5 @@ namespace ext_ead { void ut_message_base::InitMessageQueue(OSMessage* pMsg, s32 msgCount) { OSInitMessageQueue(&mpMsgQueue, pMsg, msgCount); } - } -} + } // namespace www +} // namespace ext_ead diff --git a/src/iplwww/www_print.cpp b/src/iplwww/www_print.cpp index af748996..8ede46f9 100644 --- a/src/iplwww/www_print.cpp +++ b/src/iplwww/www_print.cpp @@ -7,19 +7,19 @@ namespace ext_ead { namespace www { namespace print { - #define WWW_REPORT_LENGTH 1022 - +#define WWW_REPORT_LENGTH 1022 + /** @note Was stubbed out for release */ void IPLWWWReport(int type, const char* format, ...) { va_list args; - + va_start(args, format); #ifdef ENABLE_IPL_WWW_REPORT IPLWWWVReport(type, format, args); -#endif // ENABLE_IPL_WWW_REPORT +#endif // ENABLE_IPL_WWW_REPORT va_end(args); } - + /** @note Was stubbed out for release */ void IPLWWWVReport(int type, const char* format, va_list args) { #ifdef ENABLE_IPL_WWW_REPORT @@ -30,8 +30,8 @@ namespace ext_ead { str[WWW_REPORT_LENGTH + 1] = str[WWW_REPORT_LENGTH] = 0; OSReport("%s %s", Message[type], str); -#endif // ENABLE_IPL_WWW_REPORT +#endif // ENABLE_IPL_WWW_REPORT } - } - } -} + } // namespace print + } // namespace www +} // namespace ext_ead diff --git a/src/iplwww/www_thread.cpp b/src/iplwww/www_thread.cpp index 3808ad7b..2f293642 100644 --- a/src/iplwww/www_thread.cpp +++ b/src/iplwww/www_thread.cpp @@ -10,12 +10,11 @@ namespace ext_ead { return pThread->Run(); } - ut_thread::ut_thread() : - mpStack(NULL), - mStackSize(0), - mPriority(16) {} + ut_thread::ut_thread() : mpStack(NULL), mStackSize(0), mPriority(16) { + } - ut_thread::~ut_thread() {} + ut_thread::~ut_thread() { + } void ut_thread::Create(void* pStack, u32 stackSize, int priority, bool bStartThread) { mStackSize = stackSize; @@ -51,5 +50,5 @@ namespace ext_ead { bool ut_thread::IsThreadSuspended() { return OSIsThreadSuspended(&mThread); } - } -} + } // namespace www +} // namespace ext_ead diff --git a/src/keyboard/MyTiBg.cpp b/src/keyboard/MyTiBg.cpp index c16e0660..631cf862 100644 --- a/src/keyboard/MyTiBg.cpp +++ b/src/keyboard/MyTiBg.cpp @@ -12,6 +12,6 @@ namespace textinput { mpLayout->Animate(); mpLayout->CalculateMtx(mDrawInfo); } - } - } -} + } // namespace bg + } // namespace extend +} // namespace textinput diff --git a/src/keyboard/tiCpData.cpp b/src/keyboard/tiCpData.cpp index 13f53e8b..100a00ed 100644 Binary files a/src/keyboard/tiCpData.cpp and b/src/keyboard/tiCpData.cpp differ diff --git a/src/keyboard/tiDebug.cpp b/src/keyboard/tiDebug.cpp index d3d0f891..ed16a2ec 100644 --- a/src/keyboard/tiDebug.cpp +++ b/src/keyboard/tiDebug.cpp @@ -3,28 +3,30 @@ namespace textinput { namespace debug { struct iVertex { - iVertex(f32 posX, f32 posY, f32 posZ, u32 red, u32 green, u32 blue, u32 alpha) : - x(posX), y(posY), z(posZ), - r(red), g(green), b(blue), a(alpha) {} + iVertex(f32 posX, f32 posY, f32 posZ, u32 red, u32 green, u32 blue, u32 alpha) + : x(posX), y(posY), z(posZ), r(red), g(green), b(blue), a(alpha) { + } - f32 x, y, z; // 0x00 + f32 x, y, z; // 0x00 - u32 r, g, b, a; // 0x0C + u32 r, g, b, a; // 0x0C }; DECOMP_FORCE_LITERAL(tiDebug_cpp, 0.0f); static void draw_rect(const iVertex& v0, const iVertex& v1, const iVertex& v2, const iVertex& v3) { - GXBegin(GX_QUADS, GX_VTXFMT0, 4); { + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + { GXPosition3f32(v0.x, v0.y, v0.z); GXColor4u8(v0.r, v0.g, v0.b, v0.a); GXPosition3f32(v2.x, v2.y, v2.z); GXColor4u8(v2.r, v2.g, v2.b, v2.a); GXPosition3f32(v3.x, v3.y, v3.z); - GXColor4u8(v3.r, v3.g, v3.b, v3.a); + GXColor4u8(v3.r, v3.g, v3.b, v3.a); GXPosition3f32(v1.x, v1.y, v1.z); GXColor4u8(v1.r, v1.g, v1.b, v1.a); - } GXEnd(); + } + GXEnd(); } void drawBox_(f32 left, f32 top, f32 right, f32 bottom, f32 z, f32 scale, GXColor& color) { @@ -33,7 +35,7 @@ namespace textinput { GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); - + GXSetCullMode(GX_CULL_NONE); GXSetNumChans(1); @@ -52,16 +54,16 @@ namespace textinput { Mtx mtx; Mtx mtxScale; - MTXScale( mtxScale, scale, scale, scale); + MTXScale(mtxScale, scale, scale, scale); MTXTrans(mtx, centerX, centerY, z); - MTXConcat( mtx, mtxScale, mtx); + MTXConcat(mtx, mtxScale, mtx); GXLoadPosMtxImm(mtx, 0); - draw_rect(iVertex(left - centerX, top - centerY, 0, color.r, color.g, color.b, color.a), - iVertex(right - centerX, top - centerY, 0, color.r, color.g, color.b, color.a), - iVertex(left - centerX, bottom - centerY, 0, color.r, color.g, color.b, color.a), - iVertex(right - centerX, bottom - centerY, 0, color.r, color.g, color.b, color.a)); - + draw_rect(iVertex(left - centerX, top - centerY, 0, color.r, color.g, color.b, color.a), + iVertex(right - centerX, top - centerY, 0, color.r, color.g, color.b, color.a), + iVertex(left - centerX, bottom - centerY, 0, color.r, color.g, color.b, color.a), + iVertex(right - centerX, bottom - centerY, 0, color.r, color.g, color.b, color.a)); + Mtx mtx2; MTXIdentity(mtx2); GXLoadPosMtxImm(mtx2, GX_PNMTX0); @@ -74,7 +76,7 @@ namespace textinput { GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); - + GXSetCullMode(GX_CULL_NONE); GXSetNumChans(1); @@ -97,7 +99,8 @@ namespace textinput { f32 realWidth = (width / 6.0f) / 2.0f; if (x0 == x1) { - GXBegin(GX_QUADS, GX_VTXFMT0, 4); { + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + { GXPosition3f32(x0 - realWidth, y0, z); GXColor1u32(*(u32*)&color); GXPosition3f32(x0 - realWidth, y1, z); @@ -106,11 +109,12 @@ namespace textinput { GXColor1u32(*(u32*)&color); GXPosition3f32(x1 + realWidth, y0, z); GXColor1u32(*(u32*)&color); - } GXEnd(); - } - else { - GXBegin(GX_QUADS, GX_VTXFMT0, 4); { - GXPosition3f32(x0 , y0- realWidth, z); + } + GXEnd(); + } else { + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + { + GXPosition3f32(x0, y0 - realWidth, z); GXColor1u32(*(u32*)&color); GXPosition3f32(x0, y1 + realWidth, z); GXColor1u32(*(u32*)&color); @@ -118,8 +122,9 @@ namespace textinput { GXColor1u32(*(u32*)&color); GXPosition3f32(x1, y0 - realWidth, z); GXColor1u32(*(u32*)&color); - } GXEnd(); + } + GXEnd(); } } - } -} + } // namespace debug +} // namespace textinput diff --git a/src/keyboard/tiGUIManager.cpp b/src/keyboard/tiGUIManager.cpp index cafe1083..37003e66 100644 --- a/src/keyboard/tiGUIManager.cpp +++ b/src/keyboard/tiGUIManager.cpp @@ -6,14 +6,14 @@ #include namespace textinput { - namespace gui { + namespace gui { void drawLine_(f32 x0, f32 y0, f32 x1, f32 y1, f32 z, u8 width, GXColor& color) { GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); - + GXSetCullMode(GX_CULL_NONE); GXSetNumChans(1); @@ -34,12 +34,14 @@ namespace textinput { GXSetLineWidth(width, GX_TO_ZERO); // Draw the line - GXBegin(GX_LINES, GX_VTXFMT0, 2); { + GXBegin(GX_LINES, GX_VTXFMT0, 2); + { GXPosition3f32(x0, y0, z); GXColor1u32(*(u32*)&color); GXPosition3f32(x1, y1, z); GXColor1u32(*(u32*)&color); - } GXEnd(); + } + GXEnd(); } u32 GUIComponent::updatePointerImpl(const GUIPointer& pointer) { @@ -54,14 +56,12 @@ namespace textinput { if (isPointed(point)) { onMove(point, x, y); event = EVENT_MOVE; - } - else { + } else { setPointed(point, true); onPointIn(point); event = EVENT_POINT; } - } - else { + } else { // Not colliding with component if (isPointed(point)) { setPointed(point, false); @@ -93,8 +93,7 @@ namespace textinput { // Then delete them from memory. if (mpAllocator) { MEMFreeToAllocator(mpAllocator, p); - } - else { + } else { delete p; } // Next component to kill! @@ -104,7 +103,7 @@ namespace textinput { void GUIManager::init() { for (IDToComponent* p = static_cast(nw4r::ut::List_GetFirst(&mComponents)); p != NULL; - p = static_cast(nw4r::ut::List_GetNext(&mComponents, p))) { + p = static_cast(nw4r::ut::List_GetNext(&mComponents, p))) { p->mpComponent->init(); } } @@ -115,10 +114,9 @@ namespace textinput { component->setParentManager(this); if (mpAllocator) { void* pBuf = MEMAllocFromAllocator(mpAllocator, sizeof(IDToComponent)); - IDToComponent* p = new(pBuf) IDToComponent(id, component); + IDToComponent* p = new (pBuf) IDToComponent(id, component); nw4r::ut::List_Append(&mComponents, p); - } - else { + } else { IDToComponent* p = new IDToComponent(id, component); nw4r::ut::List_Append(&mComponents, p); } @@ -139,8 +137,7 @@ namespace textinput { GUIComponent* triggerCom = NULL; for (IDToComponent* p = static_cast(nw4r::ut::List_GetFirst(&mComponents)); p != NULL; - p = static_cast(nw4r::ut::List_GetNext(&mComponents, p))) { - + p = static_cast(nw4r::ut::List_GetNext(&mComponents, p))) { GUIComponent* component = p->mpComponent; u32 result = p->mpComponent->updatePointer(point, x, y, trig, hold, release); @@ -166,11 +163,11 @@ namespace textinput { break; } - hasTouched: - touched = true; - if (component->isTriggerTarget()) { - triggerCom = component; - } + hasTouched: + touched = true; + if (component->isTriggerTarget()) { + triggerCom = component; + } } if (component->isDragging(point)) { @@ -194,28 +191,28 @@ namespace textinput { void GUIManager::calc() { for (IDToComponent* p = static_cast(nw4r::ut::List_GetFirst(&mComponents)); p != NULL; - p = static_cast(nw4r::ut::List_GetNext(&mComponents, p))) { + p = static_cast(nw4r::ut::List_GetNext(&mComponents, p))) { p->mpComponent->calc(); } } void GUIManager::draw() { for (IDToComponent* p = static_cast(nw4r::ut::List_GetFirst(&mComponents)); p != NULL; - p = static_cast(nw4r::ut::List_GetNext(&mComponents, p))) { + p = static_cast(nw4r::ut::List_GetNext(&mComponents, p))) { p->mpComponent->draw(); } } void GUIManager::setAllComponentTriggerTarget(bool bEnable) { for (IDToComponent* p = static_cast(nw4r::ut::List_GetFirst(&mComponents)); p != NULL; - p = static_cast(nw4r::ut::List_GetNext(&mComponents, p))) { + p = static_cast(nw4r::ut::List_GetNext(&mComponents, p))) { p->mpComponent->setTriggerTarget(bEnable); } } void GUIManager::setDraggingButton(u32 dragBtn) { for (IDToComponent* p = static_cast(nw4r::ut::List_GetFirst(&mComponents)); p != NULL; - p = static_cast(nw4r::ut::List_GetNext(&mComponents, p))) { + p = static_cast(nw4r::ut::List_GetNext(&mComponents, p))) { p->mpComponent->setDraggingButton(dragBtn); } } @@ -232,8 +229,7 @@ namespace textinput { MEMFreeToAllocator(mpAllocator, p->mpComponent); MEMFreeToAllocator(mpAllocator, p); - } - else { + } else { delete p->mpComponent; delete p; } @@ -263,12 +259,11 @@ namespace textinput { void* pComBuf = MEMAllocFromAllocator(mpAllocator, sizeof(PaneComponent)); void* pBuf = MEMAllocFromAllocator(mpAllocator, sizeof(PaneToComponent)); - pComponent = new(pComBuf) PaneComponent(mIDCounter); - pToComponent = new(pBuf) PaneToComponent(pane, pComponent); - } - else { + pComponent = new (pComBuf) PaneComponent(mIDCounter); + pToComponent = new (pBuf) PaneToComponent(pane, pComponent); + } else { pComponent = new PaneComponent(mIDCounter); - pToComponent = new PaneToComponent(pane, pComponent); + pToComponent = new PaneToComponent(pane, pComponent); } // Append it @@ -338,11 +333,9 @@ namespace textinput { nw4r::ut::Rect rect = mpPane->GetPaneRect(*drawInfo); // If position is touching pane? - if (rect.left <= pos.x && pos.x <= rect.right - && rect.bottom <= pos.y && pos.y <= rect.top) { + if (rect.left <= pos.x && pos.x <= rect.right && rect.bottom <= pos.y && pos.y <= rect.top) { return true; - } - else { + } else { return false; } } @@ -380,7 +373,7 @@ namespace textinput { } return is_visible(pane->GetParent()); } - + bool PaneComponent::isVisible() { nw4r::lyt::Pane* pane = mpPane; if (pane == NULL) { @@ -394,5 +387,5 @@ namespace textinput { } return true; } - } -} + } // namespace gui +} // namespace textinput diff --git a/src/keyboard/tiLanguageIndependentData.cpp b/src/keyboard/tiLanguageIndependentData.cpp index be71f9b2..729c45a7 100644 Binary files a/src/keyboard/tiLanguageIndependentData.cpp and b/src/keyboard/tiLanguageIndependentData.cpp differ diff --git a/src/keyboard/tiLayout.cpp b/src/keyboard/tiLayout.cpp index bc864e3a..1260134a 100644 --- a/src/keyboard/tiLayout.cpp +++ b/src/keyboard/tiLayout.cpp @@ -18,7 +18,8 @@ namespace textinput { const u32* fileNameOffsets = nw4r::lyt::detail::ConvertOffsToPtr(mpRes, sizeof(*mpRes)); for (int i = 0; i < mpRes->fileNum; i++) { - mpFileResAry[i] = pResAccessor->GetResource(nw4r::lyt::RESOURCE_TYPE_TEXTURE, nw4r::lyt::detail::GetStrTableStr(fileNameOffsets, i), NULL); + mpFileResAry[i] = + pResAccessor->GetResource(nw4r::lyt::RESOURCE_TYPE_TEXTURE, nw4r::lyt::detail::GetStrTableStr(fileNameOffsets, i), NULL); } } } @@ -33,14 +34,14 @@ namespace textinput { const u32* animContOffsets = nw4r::lyt::detail::ConvertOffsToPtr(mpRes, mpRes->animContOffsetsOffset); for (u16 i = 0; i < mpRes->animContNum; i++) { - const nw4r::lyt::res::AnimationContent* cnt = nw4r::lyt::detail::ConvertOffsToPtr(mpRes, animContOffsets[i]); + const nw4r::lyt::res::AnimationContent* cnt = + nw4r::lyt::detail::ConvertOffsToPtr(mpRes, animContOffsets[i]); if (cnt->type == nw4r::lyt::res::AnimationContent::ANIMTYPE_PANE) { if (strncmp(cnt->name, name, 17) == 0) { count++; } - } - else { + } else { if (strncmp(cnt->name, name, 17) == 0) { count++; } @@ -70,8 +71,7 @@ namespace textinput { if (!bRecursive) { count = CountAnimForPane_(pane->GetName()); - } - else { + } else { count = CountAnimForPane_(pane, true); } @@ -79,20 +79,21 @@ namespace textinput { u32 linkSize = sizeof(nw4r::lyt::AnimationLink) * count; void* linkBuffer = nw4r::lyt::Layout::AllocMemory(linkSize); - + mAnimLinkAry = static_cast(linkBuffer); mAnimLinkNum = count; memset(mAnimLinkAry, 0, linkSize); for (u16 i = 0; i < count; i++) { - new(&mAnimLinkAry[i]) nw4r::lyt::AnimationLink(); + new (&mAnimLinkAry[i]) nw4r::lyt::AnimationLink(); } const u32* animContOffsets = nw4r::lyt::detail::ConvertOffsToPtr(mpRes, mpRes->animContOffsetsOffset); int linkIdx = 0; for (u16 i = 0; i < mpRes->animContNum; i++) { - const nw4r::lyt::res::AnimationContent* animCont = nw4r::lyt::detail::ConvertOffsToPtr(mpRes, animContOffsets[i]); + const nw4r::lyt::res::AnimationContent* animCont = + nw4r::lyt::detail::ConvertOffsToPtr(mpRes, animContOffsets[i]); if (animCont->type == nw4r::lyt::res::AnimationContent::ANIMTYPE_PANE) { nw4r::lyt::Pane* pFindPane = pane->FindPaneByName(animCont->name, bRecursive); @@ -102,8 +103,7 @@ namespace textinput { pFindPane->AddAnimationLink(&mAnimLinkAry[linkIdx]); linkIdx++; } - } - else { + } else { nw4r::lyt::Material* pFindMat = pane->FindMaterialByName(animCont->name, bRecursive); if (pFindMat != NULL) { @@ -133,8 +133,8 @@ namespace textinput { memset(mAnimLinkAry, 0, linkSize); for (u16 i = 0; i < count; i++) { - for (u16 i = 0; i < count; i++) { // :( - new(&mAnimLinkAry[i]) nw4r::lyt::AnimationLink(); + for (u16 i = 0; i < count; i++) { // :( + new (&mAnimLinkAry[i]) nw4r::lyt::AnimationLink(); } } @@ -142,7 +142,8 @@ namespace textinput { int linkIdx = 0; for (u16 i = 0; i < mpRes->animContNum; i++) { - const nw4r::lyt::res::AnimationContent* animCont = nw4r::lyt::detail::ConvertOffsToPtr(mpRes, animContOffsets[i]); + const nw4r::lyt::res::AnimationContent* animCont = + nw4r::lyt::detail::ConvertOffsToPtr(mpRes, animContOffsets[i]); if (strncmp(animCont->name, name, 17) != 0) { continue; @@ -151,8 +152,7 @@ namespace textinput { mAnimLinkAry[linkIdx].SetAnimTransform(this, i); if (animCont->type == nw4r::lyt::res::AnimationContent::ANIMTYPE_PANE) { pane->AddAnimationLink(&mAnimLinkAry[linkIdx]); - } - else { + } else { pane->GetMaterial()->AddAnimationLink(&mAnimLinkAry[linkIdx]); } @@ -168,7 +168,8 @@ namespace textinput { } const nw4r::lyt::res::AnimationBlock* animBlock = NULL; - const nw4r::lyt::res::DataBlockHeader* blockHeader = nw4r::lyt::detail::ConvertOffsToPtr(header, header->headerSize); + const nw4r::lyt::res::DataBlockHeader* blockHeader = + nw4r::lyt::detail::ConvertOffsToPtr(header, header->headerSize); nw4r::lyt::AnimTransform* ret = NULL; @@ -185,17 +186,17 @@ namespace textinput { case nw4r::lyt::res::AnimationInfo::ANIM_INFO_MATERIAL_COLOR: case nw4r::lyt::res::AnimationInfo::ANIM_INFO_MATERIAL_TEXTURE_PATTERN: case nw4r::lyt::res::AnimationInfo::ANIM_INFO_MATERIAL_TEXTURE_SRT: - /*case nw4r::lyt::res::AnimationInfo::ANIM_INFO_MATERIAL_IND_TEX_SRT:*/ { - void* mem = nw4r::lyt::Layout::AllocMemory(sizeof(AnimTransformPane)); - AnimTransformPane* animTrans = new(mem) AnimTransformPane(); + /*case nw4r::lyt::res::AnimationInfo::ANIM_INFO_MATERIAL_IND_TEX_SRT:*/ { + void* mem = nw4r::lyt::Layout::AllocMemory(sizeof(AnimTransformPane)); + AnimTransformPane* animTrans = new (mem) AnimTransformPane(); - if (animTrans != NULL) { - animBlock = reinterpret_cast(blockHeader); - animTrans->SetResource(animBlock, pResAcsr); + if (animTrans != NULL) { + animBlock = reinterpret_cast(blockHeader); + animTrans->SetResource(animBlock, pResAcsr); - ret = animTrans; + ret = animTrans; + } } - } } if (ret) { @@ -224,7 +225,8 @@ namespace textinput { while (pane != mpRootPane && parent != NULL) { if (&parent->GetChildList().GetBack() != pane) { nw4r::lyt::PaneList::Iterator it; - for (it = parent->GetChildList().GetBeginIter(); &*it != pane; ++it) {} + for (it = parent->GetChildList().GetBeginIter(); &*it != pane; ++it) { + } it++; return PaneAccessor(mpRootPane, &*it); @@ -236,4 +238,4 @@ namespace textinput { return PaneAccessor(mpRootPane, NULL); } -} +} // namespace textinput diff --git a/src/keyboard/tiNw4rManager.cpp b/src/keyboard/tiNw4rManager.cpp index 2ba06a31..64fe3ea4 100644 --- a/src/keyboard/tiNw4rManager.cpp +++ b/src/keyboard/tiNw4rManager.cpp @@ -17,7 +17,7 @@ namespace textinput { AnmPane* anmPane = NULL; for (anmPane = static_cast(nw4r::ut::List_GetFirst(&mAnmPanes)); anmPane != NULL; - anmPane = static_cast(nw4r::ut::List_GetNext(&mAnmPanes, anmPane))) { + anmPane = static_cast(nw4r::ut::List_GetNext(&mAnmPanes, anmPane))) { // Found anim pane! if (util::strcmp(paneName, anmPane->getPane()->GetName())) { return anmPane; @@ -31,7 +31,7 @@ namespace textinput { AnmPane* anmPane = NULL; for (anmPane = static_cast(nw4r::ut::List_GetFirst(&mAnmPanes)); anmPane != NULL; - anmPane = static_cast(nw4r::ut::List_GetNext(&mAnmPanes, anmPane))) { + anmPane = static_cast(nw4r::ut::List_GetNext(&mAnmPanes, anmPane))) { nw4r::lyt::PaneList& paneList = anmPane->getPane()->GetChildList(); nw4r::lyt::PaneList::Iterator it = paneList.GetBeginIter(); nw4r::lyt::TextBox* textBox = nw4r::ut::DynamicCast(&*it); @@ -52,7 +52,7 @@ namespace textinput { AnmPane* anmPane = NULL; for (anmPane = static_cast(nw4r::ut::List_GetFirst(&mAnmPaneList)); anmPane != NULL; - anmPane = static_cast(nw4r::ut::List_GetNext(&mAnmPaneList, anmPane))) { + anmPane = static_cast(nw4r::ut::List_GetNext(&mAnmPaneList, anmPane))) { anmPane->calc(); } } @@ -61,25 +61,16 @@ namespace textinput { AnmPane* anmPane = NULL; for (anmPane = static_cast(nw4r::ut::List_GetFirst(&mAnmPaneList)); anmPane != NULL; - anmPane = static_cast(nw4r::ut::List_GetNext(&mAnmPaneList, anmPane))) { + anmPane = static_cast(nw4r::ut::List_GetNext(&mAnmPaneList, anmPane))) { anmPane->changeAnimation(id); } } - Layout::Layout(nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* layoutBinName, EventObserver* event) : - mpLayout(NULL), - mpszLayoutBinName(layoutBinName), - mpMultiArcResourceAccessor(resAccessor), - mpPaneManager(NULL), - mpEventObserver(event), - mDrawInfo(), - mScreenRect(), - mbAnimOn(true), - mbAspectRatio4x3(true), - mAnmPaneFifo(), - mpNw4rAllocator(NULL) { + Layout::Layout(nw4r::lyt::MultiArcResourceAccessor* resAccessor, const char* layoutBinName, EventObserver* event) + : mpLayout(NULL), mpszLayoutBinName(layoutBinName), mpMultiArcResourceAccessor(resAccessor), mpPaneManager(NULL), mpEventObserver(event), + mDrawInfo(), mScreenRect(), mbAnimOn(true), mbAspectRatio4x3(true), mAnmPaneFifo(), mpNw4rAllocator(NULL) { nw4r::ut::List_Init(&mAnmPanes, offsetof(AnmPane, mLink)); - mAnmPaneFifo.init(); // but... the constructor already calls it. + mAnmPaneFifo.init(); // but... the constructor already calls it. } Layout::~Layout() { @@ -100,7 +91,7 @@ namespace textinput { // Create layout object { void* pMem = MEMAllocFromAllocator(allocator, sizeof(TiLayout)); - mpLayout = new(pMem) TiLayout(); + mpLayout = new (pMem) TiLayout(); } // Build layout data from ARC @@ -134,9 +125,9 @@ namespace textinput { gui::PaneManager* Layout::createPaneManager(MEMAllocator* allocator, TiEventHandler* eventHandler) { void* pMem = MEMAllocFromAllocator(allocator, sizeof(gui::PaneManager)); - + gui::PaneManager* paneManager = NULL; - paneManager = new(pMem) gui::PaneManager(eventHandler, allocator, NULL); + paneManager = new (pMem) gui::PaneManager(eventHandler, allocator, NULL); return paneManager; } @@ -189,7 +180,7 @@ namespace textinput { void Layout::calc() { if (mbAnimOn) { for (AnmPane* anmPane = static_cast(nw4r::ut::List_GetFirst(&mAnmPanes)); anmPane != NULL; - anmPane = static_cast(nw4r::ut::List_GetNext(&mAnmPanes, anmPane))) { + anmPane = static_cast(nw4r::ut::List_GetNext(&mAnmPanes, anmPane))) { anmPane->calc(); } } @@ -223,8 +214,7 @@ namespace textinput { nw4r::lyt::Pane* pane = mpLayout->GetRootPane()->FindPaneByName(paneName); if (pane == NULL) { return false; - } - else { + } else { *result = pane->IsVisible(); return true; } @@ -301,15 +291,14 @@ namespace textinput { util::getProjectionRect16x9(&rect16x9); MTXOrtho(projMtx, rect16x9.bottom, rect16x9.top, rect16x9.left, rect16x9.right, -1.0f, 1.0f); - } - else { + } else { MTXOrtho(projMtx, layoutRect.top, layoutRect.bottom, layoutRect.left, layoutRect.right, -1.0f, 1.0f); } GXSetProjection(projMtx, GX_ORTHOGRAPHIC); } - void Layout::SetFontForce(nw4r::ut::Font *font) { + void Layout::SetFontForce(nw4r::ut::Font* font) { PaneAccessor paneAccessor(mpLayout); while (paneAccessor.GotPane()) { @@ -340,14 +329,12 @@ namespace textinput { ReverseYAxis(&paneMtx); } pPaneMtx = paneMtx; - } - else { + } else { if (drawInfo.IsYAxisUp()) { MTX34Copy(&paneMtx, &mGlobalMtx); ReverseYAxis(&paneMtx); pPaneMtx = paneMtx; - } - else { + } else { pPaneMtx = mGlobalMtx; } } @@ -355,11 +342,12 @@ namespace textinput { MTXCopy(pPaneMtx, mtx); } - AnmPane::~AnmPane() {} + AnmPane::~AnmPane() { + } void AnmPane::addAnimation(MEMAllocator* allocator, u32 id, AnimTransformPane* animTransformPane, bool loop, bool noOff) { void* mem = MEMAllocFromAllocator(allocator, sizeof(Anim)); - Anim* anim = new(mem) Anim(id, animTransformPane, loop, noOff); + Anim* anim = new (mem) Anim(id, animTransformPane, loop, noOff); // Add it, nw4r::ut::List_Append(&mAnms, anim); @@ -369,9 +357,10 @@ namespace textinput { mpPane->SetAnimationEnable(animTransformPane, false, noOff); } - void AnmPane::forceAddAnimation(MEMAllocator* allocator, u32 id, AnimTransformPane* animTransformPane, const char* name, bool loop, bool noOff) { + void AnmPane::forceAddAnimation(MEMAllocator* allocator, u32 id, AnimTransformPane* animTransformPane, const char* name, bool loop, + bool noOff) { void* mem = MEMAllocFromAllocator(allocator, sizeof(Anim)); - Anim* anim = new(mem) Anim(id, animTransformPane, loop, noOff); + Anim* anim = new (mem) Anim(id, animTransformPane, loop, noOff); // Add it, nw4r::ut::List_Append(&mAnms, anim); @@ -397,7 +386,7 @@ namespace textinput { mpCurrentAnim->mpAnimTransform->SetFrame(0.0f); mpPane->SetAnimationEnable(mpCurrentAnim->mpAnimTransform, true, mpCurrentAnim->mbNoOff); - + onAnmEvent(PE_3); if (mpObserver != NULL) { @@ -429,8 +418,7 @@ namespace textinput { onAnmEvent(PE_4); } - } - else { + } else { mpCurrentAnim->mpAnimTransform->SetFrame(mpCurrentAnim->mfCurrentFrame); } } @@ -440,8 +428,7 @@ namespace textinput { if (mpCurrentAnim != NULL) { state->currentFrame = mpCurrentAnim->mfCurrentFrame; state->currentAnim = mpCurrentAnim->muID; - } - else { + } else { state->currentFrame = 0.0f; state->currentAnim = -1; } @@ -454,8 +441,7 @@ namespace textinput { if (state->currentAnim < 0) { mpCurrentAnim = NULL; - } - else { + } else { mpCurrentAnim = searchAnimation(state->currentAnim); } @@ -470,7 +456,7 @@ namespace textinput { void AnmPane::destroy(MEMAllocator* allocator) { if (allocator != NULL) { for (Anim* anim = static_cast(nw4r::ut::List_GetFirst(&mAnms)); anim != NULL; - anim = static_cast(nw4r::ut::List_GetFirst(&mAnms))) { + anim = static_cast(nw4r::ut::List_GetFirst(&mAnms))) { mpPane->UnbindAnimation(anim->mpAnimTransform); List_Remove(&mAnms, anim); MEMFreeToAllocator(allocator, anim); @@ -478,10 +464,9 @@ namespace textinput { this->~AnmPane(); MEMFreeToAllocator(allocator, this); - } - else { + } else { for (Anim* anim = static_cast(nw4r::ut::List_GetFirst(&mAnms)); anim != NULL; - anim = static_cast(nw4r::ut::List_GetFirst(&mAnms))) { + anim = static_cast(nw4r::ut::List_GetFirst(&mAnms))) { mpPane->UnbindAnimation(anim->mpAnimTransform); List_Remove(&mAnms, anim); delete anim; @@ -490,5 +475,5 @@ namespace textinput { delete this; } } - } -} + } // namespace nw4rmanager +} // namespace textinput diff --git a/src/keyboard/tiPkData.cpp b/src/keyboard/tiPkData.cpp index 399e297e..06d87347 100644 Binary files a/src/keyboard/tiPkData.cpp and b/src/keyboard/tiPkData.cpp differ diff --git a/src/keyboard/tiSwData.cpp b/src/keyboard/tiSwData.cpp index e00bf18a..8ecb4fe9 100644 Binary files a/src/keyboard/tiSwData.cpp and b/src/keyboard/tiSwData.cpp differ diff --git a/src/keyboard/tiTextInputBase.cpp b/src/keyboard/tiTextInputBase.cpp index 0ba1aeb5..7032c7bb 100644 --- a/src/keyboard/tiTextInputBase.cpp +++ b/src/keyboard/tiTextInputBase.cpp @@ -10,7 +10,7 @@ namespace textinput { void CommandReceiver::onCommand(INPUT_COMMAND command, void* data) { for (CommandSender* sender = static_cast(nw4r::ut::List_GetFirst(&mSenderList)); sender != NULL; - sender = static_cast(nw4r::ut::List_GetNext(&mSenderList, sender))) { + sender = static_cast(nw4r::ut::List_GetNext(&mSenderList, sender))) { sender->updateFromReceiver((u32)command, data); } } @@ -18,4 +18,4 @@ namespace textinput { void CommandReceiver::clearSender() { nw4r::ut::List_Init(&mSenderList, offsetof(CommandSender, mLink)); } -} +} // namespace textinput diff --git a/src/keyboard/tiUtil.cpp b/src/keyboard/tiUtil.cpp index 4b853a69..269b32f9 100644 --- a/src/keyboard/tiUtil.cpp +++ b/src/keyboard/tiUtil.cpp @@ -13,8 +13,7 @@ namespace textinput { if (first != NULL) { u32 index = (u32)(first - s_alphabet_map[ALPHABET_MAP_UPPER]); return s_alphabet_map[ALPHABET_MAP_LOWER][index]; - } - else { + } else { return ch; } } @@ -24,8 +23,7 @@ namespace textinput { if (first != NULL) { u32 index = (u32)(first - s_alphabet_map[ALPHABET_MAP_LOWER]); return s_alphabet_map[ALPHABET_MAP_UPPER][index]; - } - else { + } else { return ch; } } @@ -60,8 +58,7 @@ namespace textinput { if (first != NULL) { u32 index = (u32)(first - map[1]); return map[0][index]; - } - else { + } else { return ch; } } @@ -73,20 +70,11 @@ namespace textinput { L"ぁぃぅぇぉ            っ       ゃゅょゎァィゥェォヵ  ヶ        ッ       ャュョヮ", }; - static const wchar_t* s_dakuten_map[] = { - s_all_map[0], - s_all_map[1] - }; + static const wchar_t* s_dakuten_map[] = {s_all_map[0], s_all_map[1]}; - static const wchar_t* s_handaku_map[] = { - s_all_map[0], - s_all_map[2] - }; + static const wchar_t* s_handaku_map[] = {s_all_map[0], s_all_map[2]}; - static const wchar_t* s_small_map[] = { - s_all_map[0], - s_all_map[3] - }; + static const wchar_t* s_small_map[] = {s_all_map[0], s_all_map[3]}; wchar_t KBD_ConvertDakuten(wchar_t ch) { if (ch == L' ') { @@ -99,8 +87,7 @@ namespace textinput { wchar_t ch2 = ConvertDakutenEtc(s_dakuten_map, ch1); if (ch2 != ch1) { return ch2; - } - else { + } else { return ch; } } @@ -111,8 +98,7 @@ namespace textinput { wchar_t ch2 = ConvertDakutenEtc(s_dakuten_map, ch1); if (ch2 != ch1) { return ch2; - } - else { + } else { return ch; } } @@ -131,8 +117,7 @@ namespace textinput { wchar_t ch2 = ConvertDakutenEtc(s_handaku_map, ch1); if (ch2 != ch1) { return ch2; - } - else { + } else { return ch; } } @@ -151,8 +136,7 @@ namespace textinput { wchar_t ch2 = ConvertDakutenEtc(s_small_map, ch1); if (ch2 != ch1) { return ch2; - } - else { + } else { return ch; } } @@ -182,8 +166,7 @@ namespace textinput { return s_all_map[(i + j) % 4][offset]; } } - } - else { + } else { return ch; } @@ -215,8 +198,7 @@ namespace textinput { if (strncmp(s1, s2, len) == 0) { return true; - } - else { + } else { return false; } } @@ -244,10 +226,9 @@ namespace textinput { if (first != NULL) { u32 offset = (u32)(first - map[i]); - if (map[1-i][offset] != L' ') { - return map[1-i][offset]; - } - else { + if (map[1 - i][offset] != L' ') { + return map[1 - i][offset]; + } else { return ch; } } @@ -295,5 +276,5 @@ namespace textinput { rect->bottom = 228.0; rect->top = -228.0; } - } -} + } // namespace util +} // namespace textinput diff --git a/src/layout/GUIManager.cpp b/src/layout/GUIManager.cpp index 00a12150..5b35fbbe 100644 --- a/src/layout/GUIManager.cpp +++ b/src/layout/GUIManager.cpp @@ -10,7 +10,7 @@ void drawLine_(f32 x0, f32 y0, f32 x1, f32 y1, f32 z, u8 width, GXColor& color) GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); - + GXSetCullMode(GX_CULL_NONE); GXSetNumChans(1); @@ -31,12 +31,14 @@ void drawLine_(f32 x0, f32 y0, f32 x1, f32 y1, f32 z, u8 width, GXColor& color) GXSetLineWidth(width, GX_TO_ZERO); // Draw the line - GXBegin(GX_LINES, GX_VTXFMT0, 2); { + GXBegin(GX_LINES, GX_VTXFMT0, 2); + { GXPosition3f32(x0, y0, z); GXColor1u32(*(u32*)&color); GXPosition3f32(x1, y1, z); GXColor1u32(*(u32*)&color); - } GXEnd(); + } + GXEnd(); } namespace gui { @@ -49,17 +51,15 @@ namespace gui { if (isPointed(point)) { onMove(point, x, y); mpManager->onEvent(getID(), EventHandler::ON_MOVE, point, data); - } - else { + } else { setPointed(point, true); onPoint(point); mpManager->onEvent(getID(), EventHandler::ON_POINT, point, data); } touched = true; - } - else { - // Not colliding with component + } else { + // Not colliding with component if (isPointed(point)) { setPointed(point, false); offPoint(point); @@ -91,8 +91,7 @@ namespace gui { // Then delete them from memory. if (mpAllocator) { MEMFreeToAllocator(mpAllocator, p); - } - else { + } else { delete p; } // Next component to kill! @@ -113,10 +112,9 @@ namespace gui { component->setManager(this); if (mpAllocator) { void* pBuf = MEMAllocFromAllocator(mpAllocator, sizeof(IDToComponent)); - IDToComponent* p = new(pBuf) IDToComponent(id, component); + IDToComponent* p = new (pBuf) IDToComponent(id, component); nw4r::ut::List_Append(&mComponents, p); - } - else { + } else { IDToComponent* p = new IDToComponent(id, component); nw4r::ut::List_Append(&mComponents, p); } @@ -132,8 +130,7 @@ namespace gui { Component* triggerCom = NULL; for (IDToComponent* p = static_cast(nw4r::ut::List_GetFirst(&mComponents)); p != NULL; - p = static_cast(nw4r::ut::List_GetNext(&mComponents, p))) { - + p = static_cast(nw4r::ut::List_GetNext(&mComponents, p))) { bool touchedCom = p->mpComponent->update(point, x, y, trig, hold, release, data); if (touchedCom) { @@ -195,8 +192,7 @@ namespace gui { if (mpAllocator) { MEMFreeToAllocator(mpAllocator, p->mpComponent); MEMFreeToAllocator(mpAllocator, p); - } - else { + } else { delete p->mpComponent; delete p; } @@ -222,10 +218,9 @@ namespace gui { void* pComBuf = MEMAllocFromAllocator(mpAllocator, sizeof(PaneComponent)); void* pBuf = MEMAllocFromAllocator(mpAllocator, sizeof(PaneToComponent)); - pComponent = new(pComBuf) PaneComponent(suIDCounter); - pToComponent = new(pBuf) PaneToComponent(&(*it), pComponent); - } - else { + pComponent = new (pComBuf) PaneComponent(suIDCounter); + pToComponent = new (pBuf) PaneToComponent(&(*it), pComponent); + } else { pComponent = new PaneComponent(suIDCounter); pToComponent = new PaneToComponent(&(*it), pComponent); } @@ -289,11 +284,9 @@ namespace gui { nw4r::ut::Rect rect = mpPane->GetPaneRect(*drawInfo); // If position is touching pane? - if (rect.left <= pos.x && pos.x <= rect.right - && rect.bottom <= pos.y && pos.y <= rect.top) { + if (rect.left <= pos.x && pos.x <= rect.right && rect.bottom <= pos.y && pos.y <= rect.top) { return true; - } - else { + } else { return false; } } @@ -331,8 +324,8 @@ namespace gui { } return is_visible(pane->GetParent()); } - + bool PaneComponent::isVisible() { return is_visible(mpPane); } -} +} // namespace gui diff --git a/src/layout/iplGuiManager.cpp b/src/layout/iplGuiManager.cpp index c366013e..80a0d8d4 100644 --- a/src/layout/iplGuiManager.cpp +++ b/src/layout/iplGuiManager.cpp @@ -2,8 +2,8 @@ #include "iplMath.h" -#include "system/iplController.h" #include "iplSystem.h" +#include "system/iplController.h" namespace ipl { namespace gui { @@ -20,35 +20,25 @@ namespace ipl { if (System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT) { if (con && (!mbDisableCon || !mbDoneUpdateWithCon)) { // Get Projection Area - nw4r::ut::Rect projRect(0.0f, 0.0f, 0.0f, 0.0f); + nw4r::ut::Rect projRect(0.0f, 0.0f, 0.0f, 0.0f); System::getProjectionRect(&projRect); // Get Cursor Position ipl::math::VEC2 conProjPos = con->getDpdProjectionPos(); - if ((projRect.left > conProjPos.x || conProjPos.x > projRect.right) - || (projRect.top > conProjPos.y && conProjPos.y > projRect.bottom)) { + if ((projRect.left > conProjPos.x || conProjPos.x > projRect.right) || + (projRect.top > conProjPos.y && conProjPos.y > projRect.bottom)) { conProjPos.y = IPL_MATH_NULL_FLOAT; conProjPos.x = IPL_MATH_NULL_FLOAT; } // Update the base manager with controller input - ::gui::Manager::update(chan, - conProjPos.x, -conProjPos.y, - con->getTrigFlag() | con->getClassicTrigFlag(), - con->getHoldFlag() | con->getClassicHoldFlag(), - con->getReleaseFlag() | con->getClassicReleaseFlag(), - con); - + ::gui::Manager::update(chan, conProjPos.x, -conProjPos.y, con->getTrigFlag() | con->getClassicTrigFlag(), + con->getHoldFlag() | con->getClassicHoldFlag(), con->getReleaseFlag() | con->getClassicReleaseFlag(), con); + mbDoneUpdateWithCon = true; - } - else { + } else { // Update the base manager without controller input - ::gui::Manager::update(chan, - IPL_MATH_NULL_FLOAT, IPL_MATH_NULL_FLOAT, - 0, - 0, - 0, - NULL); + ::gui::Manager::update(chan, IPL_MATH_NULL_FLOAT, IPL_MATH_NULL_FLOAT, 0, 0, 0, NULL); } } } @@ -64,5 +54,5 @@ namespace ipl { component->init(); } } - } -} + } // namespace gui +} // namespace ipl diff --git a/src/layout/iplLayout.cpp b/src/layout/iplLayout.cpp index 67dd598f..f22edc4d 100644 --- a/src/layout/iplLayout.cpp +++ b/src/layout/iplLayout.cpp @@ -13,8 +13,7 @@ namespace ipl { FLAG_UNUSED, }; - Animator::Animator(nw4r::lyt::AnimTransform* animTrans, bool bRecursive, bool bUnused) : - mAnimTrans(animTrans) { + Animator::Animator(nw4r::lyt::AnimTransform* animTrans, bool bRecursive, bool bUnused) : mAnimTrans(animTrans) { mFlags = 0; int anmType; @@ -23,19 +22,18 @@ namespace ipl { if (animTrans->IsLoopData()) { anmType = ANIM_TYPE_LOOP; maxFrame = animTrans->GetFrameSize(); - } - else { + } else { anmType = ANIM_TYPE_FORWARD; - maxFrame = animTrans->GetFrameSize() - 1.0f; // Last frame + maxFrame = animTrans->GetFrameSize() - 1.0f; // Last frame } utility::FrameController::init(anmType, maxFrame, 0.0f); if (bRecursive != FALSE) { - mFlags |= (1<SetFrame(mFrame); @@ -63,27 +62,27 @@ namespace ipl { setFrame(); } - PaneAnimator::PaneAnimator(nw4r::lyt::AnimTransform* animTrans, nw4r::lyt::Pane* pane, bool bRecursive, bool bUnused) : - Animator(animTrans, bRecursive, bUnused), - mPane(pane) {} + PaneAnimator::PaneAnimator(nw4r::lyt::AnimTransform* animTrans, nw4r::lyt::Pane* pane, bool bRecursive, bool bUnused) + : Animator(animTrans, bRecursive, bUnused), mPane(pane) { + } void PaneAnimator::bind() { - mPane->BindAnimation(mAnimTrans, mFlags & (1<BindAnimation(mAnimTrans, mFlags & (1 << FLAG_RECURSIVE)); } void PaneAnimator::setFlag(bool flag) { - mPane->SetAnimationEnable(mAnimTrans, flag, mFlags & (1<SetAnimationEnable(mAnimTrans, flag, mFlags & (1 << FLAG_RECURSIVE)); } - GroupAnimator::GroupAnimator(nw4r::lyt::AnimTransform* animTrans, nw4r::lyt::Group* group, bool bRecursive, bool bUnused) : - Animator(animTrans, bRecursive, bUnused), - mGroup(group) {} + GroupAnimator::GroupAnimator(nw4r::lyt::AnimTransform* animTrans, nw4r::lyt::Group* group, bool bRecursive, bool bUnused) + : Animator(animTrans, bRecursive, bUnused), mGroup(group) { + } void GroupAnimator::bind() { // Bind all panes contained in the group nw4r::lyt::PaneLinkList& list = mGroup->GetPaneList(); for (nw4r::lyt::PaneLinkList::Iterator it = list.GetBeginIter(); it != list.GetEndIter(); ++it) { - it->mTarget->BindAnimation(mAnimTrans, mFlags & (1<mTarget->BindAnimation(mAnimTrans, mFlags & (1 << FLAG_RECURSIVE)); } } @@ -91,45 +90,26 @@ namespace ipl { // Enable Animation on all panes contained in the group nw4r::lyt::PaneLinkList& list = mGroup->GetPaneList(); for (nw4r::lyt::PaneLinkList::Iterator it = list.GetBeginIter(); it != list.GetEndIter(); ++it) { - it->mTarget->SetAnimationEnable(mAnimTrans, flag, mFlags & (1<mTarget->SetAnimationEnable(mAnimTrans, flag, mFlags & (1 << FLAG_RECURSIVE)); } } - Object::Object(EGG::Heap* heap, void* arcBuffer, const char* directory, const char* fileName) : - mLayout(), - mArc(), - mWBF1PrivateLink(), - mWBF2PrivateLink(), - mWBF1PublicLink(), - mWBF2PublicLink(), - mpHeap(heap), - mAllocator(heap, 4), - mDrawInfo(), - mCurLink(), - mArcLinks() { + Object::Object(EGG::Heap* heap, void* arcBuffer, const char* directory, const char* fileName) + : mLayout(), mArc(), mWBF1PrivateLink(), mWBF2PrivateLink(), mWBF1PublicLink(), mWBF2PublicLink(), mpHeap(heap), mAllocator(heap, 4), + mDrawInfo(), mCurLink(), mArcLinks() { attach(arcBuffer, directory); init_(fileName); } - Object::Object(EGG::Heap* heap, nand::LayoutFile* file, const char* directory, const char* fileName) : - mLayout(), - mArc(), - mWBF1PrivateLink(), - mWBF2PrivateLink(), - mWBF1PublicLink(), - mWBF2PublicLink(), - mpHeap(heap), - mAllocator(heap, 4), - mDrawInfo(), - mCurLink(), - mArcLinks() { + Object::Object(EGG::Heap* heap, nand::LayoutFile* file, const char* directory, const char* fileName) + : mLayout(), mArc(), mWBF1PrivateLink(), mWBF2PrivateLink(), mWBF1PublicLink(), mWBF2PublicLink(), mpHeap(heap), mAllocator(heap, 4), + mDrawInfo(), mCurLink(), mArcLinks() { u8* buffer; // Find layout from common if (file->getCmnFile() != NULL) { buffer = file->getCmnFile()->getBuffer(); - } - else { + } else { buffer = NULL; } if (buffer != NULL) { @@ -139,8 +119,7 @@ namespace ipl { // Find layout from language if (file->getLangFile() != NULL) { buffer = file->getLangFile()->getBuffer(); - } - else { + } else { buffer = NULL; } if (buffer != NULL) { @@ -196,11 +175,8 @@ namespace ipl { PaneAnimator* Object::bind_(const char* fileName, nw4r::lyt::Pane* pane, bool bRecursive, bool bUnused) { void* animBuf = mArc.GetResource(0, fileName); - PaneAnimator* anim = new(mpHeap, 4) PaneAnimator(mLayout.CreateAnimTransform(animBuf, &mArc), - pane, - bRecursive, - bUnused); - + PaneAnimator* anim = new (mpHeap, 4) PaneAnimator(mLayout.CreateAnimTransform(animBuf, &mArc), pane, bRecursive, bUnused); + anim->bind(); anim->setFlag(bUnused); @@ -209,30 +185,22 @@ namespace ipl { return anim; } - void Animator::bind() {} + void Animator::bind() { + } GroupAnimator* Object::bindToGroup(const char* fileName, const char* groupName, bool bRecursive, bool bUnused) { - return bind_(fileName, - mLayout.GetGroupContainer()->FindGroupByName(groupName), - bRecursive, - bUnused); + return bind_(fileName, mLayout.GetGroupContainer()->FindGroupByName(groupName), bRecursive, bUnused); } GroupAnimator* Object::bindToGroup(const char* fileName, nw4r::lyt::Group* group, bool bRecursive, bool bUnused) { - return bind_(fileName, - group, - bRecursive, - bUnused); + return bind_(fileName, group, bRecursive, bUnused); } GroupAnimator* Object::bind_(const char* fileName, nw4r::lyt::Group* group, bool bRecursive, bool bUnused) { void* animBuf = mArc.GetResource(0, fileName); - GroupAnimator* anim = new(mpHeap, 4) GroupAnimator(mLayout.CreateAnimTransform(animBuf, &mArc), - group, - bRecursive, - bUnused); - + GroupAnimator* anim = new (mpHeap, 4) GroupAnimator(mLayout.CreateAnimTransform(animBuf, &mArc), group, bRecursive, bUnused); + anim->bind(); anim->setFlag(bUnused); @@ -255,7 +223,7 @@ namespace ipl { bool Object::searchFile(const char* fileName) { return mArc.GetResource(0, fileName) != NULL; } - + void Object::calc() { initLocationAdjust(); @@ -295,8 +263,7 @@ namespace ipl { while (anim = static_cast(nw4r::ut::List_GetNext(&mAnims, anim)), anim != NULL) { anim->play(); } - } - else { + } else { anim = static_cast(nw4r::ut::List_GetNth(&mAnims, animIdx)); anim->play(); } @@ -309,8 +276,7 @@ namespace ipl { while (anim = static_cast(nw4r::ut::List_GetNext(&mAnims, anim)), anim != NULL) { anim->setMaxFrame(maxFrame); } - } - else { + } else { anim = static_cast(nw4r::ut::List_GetNth(&mAnims, animIdx)); anim->setMaxFrame(maxFrame); } @@ -323,8 +289,7 @@ namespace ipl { while (anim = static_cast(nw4r::ut::List_GetNext(&mAnims, anim)), anim != NULL) { anim->setMinFrame(minFrame); } - } - else { + } else { anim = static_cast(nw4r::ut::List_GetNth(&mAnims, animIdx)); anim->setMinFrame(minFrame); } @@ -337,8 +302,7 @@ namespace ipl { while (anim = static_cast(nw4r::ut::List_GetNext(&mAnims, anim)), anim != NULL) { anim->setAnmType(type); } - } - else { + } else { anim = static_cast(nw4r::ut::List_GetNth(&mAnims, animIdx)); anim->setAnmType(type); } @@ -353,8 +317,7 @@ namespace ipl { while (anim = static_cast(nw4r::ut::List_GetNext(&mAnims, anim)), anim != NULL) { result |= anim->isPlaying(); } - } - else { + } else { anim = static_cast(nw4r::ut::List_GetNth(&mAnims, animIdx)); result = anim->isPlaying(); } @@ -410,8 +373,7 @@ namespace ipl { nw4r::math::VEC2 adjustScale(rect4x3.GetWidth() / rect16x9.GetWidth(), 1.0f); mDrawInfo.SetLocationAdjustScale(adjustScale); mDrawInfo.SetLocationAdjust(true); - } - else { + } else { // No adjustments here mLayout.GetRootPane()->SetScale(nw4r::math::VEC2(1.0f, 1.0f)); @@ -430,15 +392,17 @@ namespace ipl { Object* Object::create(EGG::Heap* heap, u32 allocSize, nand::LayoutFile* file, const char* directory, const char* fileName) { EGG::ExpHeap* expHeap = EGG::ExpHeap::create(allocSize, heap, MEM_HEAP_OPT_DEBUG_FILL); - return new(expHeap, 4) Object(expHeap, file, directory, fileName); + return new (expHeap, 4) Object(expHeap, file, directory, fileName); } Object* Object::create(EGG::Heap* heap, u32 allocSize, void* buffer, const char* directory, const char* fileName) { EGG::ExpHeap* expHeap = EGG::ExpHeap::create(allocSize, heap, MEM_HEAP_OPT_DEBUG_FILL); - return new(expHeap, 4) Object(expHeap, buffer, directory, fileName); + return new (expHeap, 4) Object(expHeap, buffer, directory, fileName); } - PaneAnimator::~PaneAnimator() {} - GroupAnimator::~GroupAnimator() {} - } -} + PaneAnimator::~PaneAnimator() { + } + GroupAnimator::~GroupAnimator() { + } + } // namespace layout +} // namespace ipl diff --git a/src/scene/address/iplAddressAddSel.cpp b/src/scene/address/iplAddressAddSel.cpp index f627506c..1f9dd335 100644 --- a/src/scene/address/iplAddressAddSel.cpp +++ b/src/scene/address/iplAddressAddSel.cpp @@ -5,22 +5,15 @@ #include "scene/address/iplAddress.h" #include "scene/board/iplBoard.h" -#include "iplSystem.h" #include "iplSound.h" +#include "iplSystem.h" namespace ipl { namespace scene { - const char* AddressAddSel::mscButtonName[AddressAddSel::BTN_MAX] = { - "B_btn_00", - "B_btn_01" - }; + const char* AddressAddSel::mscButtonName[AddressAddSel::BTN_MAX] = {"B_btn_00", "B_btn_01"}; - AddressAddSel::AddressAddSel(EGG::Heap* heap) : - FaderSceneBase(heap), - mState(STATE_NORMAL), - mpLayout(NULL), - mpEvent(NULL), - mpGui(NULL) {} + AddressAddSel::AddressAddSel(EGG::Heap* heap) : FaderSceneBase(heap), mState(STATE_NORMAL), mpLayout(NULL), mpEvent(NULL), mpGui(NULL) { + } void AddressAddSel::create() { nand::LayoutFile* layoutFile = static_cast(System::getScene(SCENE_BOARD))->getLayoutFile(); @@ -64,7 +57,7 @@ namespace ipl { size.width += 0.5f; nw4r::ut::DynamicCast(mpLayout->FindPaneByName("T_btn_name_00"))->SetFontSize(size); } -#endif // KOREAN_BUILD +#endif // KOREAN_BUILD reset_gui(); } @@ -130,46 +123,46 @@ namespace ipl { void AddressAddSel::start_point_event(const char* paneName, controller::Interface* con) { int btnNo = get_button_no(paneName); - //if (btnNo > -1) { - switch (btnNo) { - case BTN_WII: - case BTN_EMAIL: { - if (mbHovered[btnNo] == FALSE) { - // Play hover in animation - mpLayout->getAnim(btnNo + ANIM_BTN_FOCUS_IN)->play(); + // if (btnNo > -1) { + switch (btnNo) { + case BTN_WII: + case BTN_EMAIL: { + if (mbHovered[btnNo] == FALSE) { + // Play hover in animation + mpLayout->getAnim(btnNo + ANIM_BTN_FOCUS_IN)->play(); - // Play nice sound - snd::getSystem()->startSE("WIPL_SE_BT_TARGETTING"); + // Play nice sound + snd::getSystem()->startSE("WIPL_SE_BT_TARGETTING"); - // Rrrrrumble - con->rumble(1); - } - mbHovered[btnNo]++; - break; - } - default: { - break; + // Rrrrrumble + con->rumble(1); } + mbHovered[btnNo]++; + break; } + default: { + break; + } + } //} } void AddressAddSel::start_left_event(const char* paneName) { int btnNo = get_button_no(paneName); - //if (btnNo > -1) { - switch (btnNo) { - case BTN_WII: - case BTN_EMAIL: { - if (mbHovered[btnNo] == TRUE) { - mpLayout->getAnim(btnNo + ANIM_BTN_FOCUS_OUT)->play(); - } - mbHovered[btnNo]--; - break; - } - default: { - break; + // if (btnNo > -1) { + switch (btnNo) { + case BTN_WII: + case BTN_EMAIL: { + if (mbHovered[btnNo] == TRUE) { + mpLayout->getAnim(btnNo + ANIM_BTN_FOCUS_OUT)->play(); } + mbHovered[btnNo]--; + break; } + default: { + break; + } + } //} } @@ -288,5 +281,5 @@ namespace ipl { } } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/address/iplAddressEdit.cpp b/src/scene/address/iplAddressEdit.cpp index 63da4c9c..e504754f 100644 --- a/src/scene/address/iplAddressEdit.cpp +++ b/src/scene/address/iplAddressEdit.cpp @@ -1,5 +1,5 @@ -#include #include +#include #include @@ -26,11 +26,11 @@ static ChkHostNameError CheckHostName(const char* hostName, u32 hostNameLength); - ... That's it!! */ extern "C" NWC24Err NWC24CheckPublicMailAddr_(const char* addr) { - int i, j; - int len; - BOOL readingDomain; + int i, j; + int len; + BOOL readingDomain; - static const char specials[] = { '(', ')', '<', '>', '[', ']', ':', ';', '\\', ',', '"' }; + static const char specials[] = {'(', ')', '<', '>', '[', ']', ':', ';', '\\', ',', '"'}; // Check parameters if (addr == NULL) { @@ -47,7 +47,7 @@ extern "C" NWC24Err NWC24CheckPublicMailAddr_(const char* addr) { } readingDomain = FALSE; - + for (i = 0; i < len; i++) { char ch = addr[i]; @@ -62,7 +62,7 @@ extern "C" NWC24Err NWC24CheckPublicMailAddr_(const char* addr) { } // If the character is not a letter or symbol, invalid! - if (ch <= ' ' || ch >= '~'+1) { + if (ch <= ' ' || ch >= '~' + 1) { return NWC24_ERR_FORMAT; } @@ -80,16 +80,16 @@ extern "C" NWC24Err NWC24CheckPublicMailAddr_(const char* addr) { } // If the hostname is not valid, invalid! - if (CheckHostName(&addr[i+1], (len - i)) < CHECK_HOSTNAME_SUCCESS) { + if (CheckHostName(&addr[i + 1], (len - i)) < CHECK_HOSTNAME_SUCCESS) { return NWC24_ERR_FORMAT; } - return strnicmp(&addr[i], NWC24GetAccountDomain(), (len - i)+1) == 0 ? NWC24_ERR_PROTECTED : NWC24_OK; + return strnicmp(&addr[i], NWC24GetAccountDomain(), (len - i) + 1) == 0 ? NWC24_ERR_PROTECTED : NWC24_OK; } static ChkHostNameError CheckHostName(const char* hostName, u32 hostNameLength) { - int i; - BOOL foundDot; + int i; + BOOL foundDot; // Parameter check if (hostNameLength == 0) { @@ -129,9 +129,7 @@ static ChkHostNameError CheckHostName(const char* hostName, u32 hostNameLength) } // Check if there are invalid characters - if ((ch < '0' || ch > '9') - && (ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z') - && (ch != '-' && ch != '_')) { + if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z') && (ch != '-' && ch != '_')) { return CHECK_HOSTNAME_INVALID_CHARACTERS; } @@ -144,7 +142,7 @@ static ChkHostNameError CheckHostName(const char* hostName, u32 hostNameLength) } // Check if the end of hostname has a dot - if (i > 0 && hostName[i-1] == '.') { + if (i > 0 && hostName[i - 1] == '.') { return CHECK_HOSTNAME_DOT_AT_END; } diff --git a/src/scene/backMenu/iplBackMenu.cpp b/src/scene/backMenu/iplBackMenu.cpp index 59f7cad4..4d32ce11 100644 --- a/src/scene/backMenu/iplBackMenu.cpp +++ b/src/scene/backMenu/iplBackMenu.cpp @@ -1,4 +1,4 @@ -#define VERY_DIRTY_MATCH_HACK // for 4.3k +#define VERY_DIRTY_MATCH_HACK // for 4.3k #include "scene/backMenu/iplBackMenu.h" @@ -38,14 +38,13 @@ namespace ipl { return false; } - BackMenu::BackMenu(EGG::Heap* heap) : - FaderSceneBase(heap), - unused_0x5C(0) { - setSceneParentFlags(SCN_PARENTFLAG_DRAW); // (ignored as child scenes aren't created over this scene) + BackMenu::BackMenu(EGG::Heap* heap) : FaderSceneBase(heap), unused_0x5C(0) { + setSceneParentFlags(SCN_PARENTFLAG_DRAW); // (ignored as child scenes aren't created over this scene) + } + + void BackMenu::prepare() { } - void BackMenu::prepare() {} - BOOL BackMenu::isReady() const { return TRUE; } @@ -101,9 +100,9 @@ namespace ipl { if (System::createdAfterAndLibMgr() || (System::hasCreatedAfter() && System::isNandFull())) { System::getPointer()->setVisible(true); System::getResetHandler()->enableResetToMenu(); - + reserveAllSceneDestruction(SCENE_BOARD, NULL); - + return FADER_SCN_NEXT; } return FADER_SCN_CONTINUE; @@ -115,5 +114,5 @@ namespace ipl { mpLayout->draw(); } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/board/iplBoard.cpp b/src/scene/board/iplBoard.cpp index 856a4fc7..38fd4c0b 100644 --- a/src/scene/board/iplBoard.cpp +++ b/src/scene/board/iplBoard.cpp @@ -17,31 +17,26 @@ #include "utility/iplRBRUtility.h" -#define RECORD_DATE_TO_CDB(x) (CDBMakeCDBDate((x).year, (x).month, (x).day, (x).hour, (x).min, (x).sec)) -#define RECORD_DATE_TO_CDB_BEGIN(x) (CDBMakeCDBDate((x).year, (x).month, (x).day, MIN_HOUR, MIN_MINUTE, MIN_SECOND)) -#define RECORD_DATE_TO_CDB_END(x) (CDBMakeCDBDate((x).year, (x).month, (x).day, MAX_HOUR, MAX_MINUTE, MAX_SECOND)) +#define RECORD_DATE_TO_CDB(x) (CDBMakeCDBDate((x).year, (x).month, (x).day, (x).hour, (x).min, (x).sec)) +#define RECORD_DATE_TO_CDB_BEGIN(x) (CDBMakeCDBDate((x).year, (x).month, (x).day, MIN_HOUR, MIN_MINUTE, MIN_SECOND)) +#define RECORD_DATE_TO_CDB_END(x) (CDBMakeCDBDate((x).year, (x).month, (x).day, MAX_HOUR, MAX_MINUTE, MAX_SECOND)) -#define DATE_TO_CDB_BEGIN(x) (CDBMakeCDBDate((x).year, (x).month-1, (x).day, MIN_HOUR, MIN_MINUTE, MIN_SECOND)) -#define DATE_TO_CDB_END(x) (CDBMakeCDBDate((x).year, (x).month-1, (x).day, MAX_HOUR, MAX_MINUTE, MAX_SECOND)) +#define DATE_TO_CDB_BEGIN(x) (CDBMakeCDBDate((x).year, (x).month - 1, (x).day, MIN_HOUR, MIN_MINUTE, MIN_SECOND)) +#define DATE_TO_CDB_END(x) (CDBMakeCDBDate((x).year, (x).month - 1, (x).day, MAX_HOUR, MAX_MINUTE, MAX_SECOND)) namespace ipl { namespace scene { static const struct { f32 start, end; - } scAnmFrame[] = { - { 30.0f, 50.0f }, - { 0.0f, 20.0f }, - { 100.0f, 131.0f }, - { 60.0f, 91.0f } - }; - + } scAnmFrame[] = {{30.0f, 50.0f}, {0.0f, 20.0f}, {100.0f, 131.0f}, {60.0f, 91.0f}}; + static const char* scScrollPane[] = { "TopBack_a", "TopBack_b", "TopBack_c", }; - static const wchar_t scNumber[] = {'0','1','2','3','4','5','6','7','8','9'}; + static const wchar_t scNumber[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; BOOL count_task_cb_(void* work, CDBRecord* record); void count_task_(void* work); @@ -54,55 +49,34 @@ namespace ipl { void delete_task_(void* work); - #define OBJ_LIST_LOOP(...) { \ - BoardObject* object = NULL; \ - goto CONCAT(l,__LINE__); \ - do { \ - {__VA_ARGS__} \ -CONCAT(l,__LINE__): \ - object = mObjList.getNext(object); \ - } while (object != NULL); \ - } +#define OBJ_LIST_LOOP(...) \ + { \ + BoardObject* object = NULL; \ + goto CONCAT(l, __LINE__); \ + do { \ + {__VA_ARGS__} CONCAT(l, __LINE__) : object = mObjList.getNext(object); \ + } while (object != NULL); \ + } - #define OBJ_LIST_LOOP_ALT(object, ...) { \ - goto CONCAT(l,__LINE__); \ - do { \ - {__VA_ARGS__} \ -CONCAT(l,__LINE__): \ - object = mObjList.getNext(object); \ - } while (object != NULL); \ - } +#define OBJ_LIST_LOOP_ALT(object, ...) \ + { \ + goto CONCAT(l, __LINE__); \ + do { \ + {__VA_ARGS__} CONCAT(l, __LINE__) : object = mObjList.getNext(object); \ + } while (object != NULL); \ + } enum { FOCUS_ANIM_IN = 0, FOCUS_ANIM_OUT, }; - Board::Board(EGG::Heap* heap, int unk) : - Base(heap), - ButtonEventHandlerBase(), - mState(STATE_WAIT_CDB_INIT), - mObjList(), - mbDoReadTask(false), - mbReading(false), - mbDoTaskDelete(false), - mbDoCountTask(false), - mbNewMsgAnimCount(false), - mCurrentDate(System::getCurrentTime()), - mPreviousDate(System::getCurrentTime()), - mpLayoutFile(NULL), - mpLayoutBg(NULL), - mpLayoutFocusBg(NULL), - mbRIconEnable(false), - mbLIconEnable(false), - mbFocusMode(false), - mbPlayDispSound(false), - mpCurrentFocus(NULL), - mMsgCount(-1), - mPrevMsgCount(-1), - mBoardSD(), - unk_0xFB4(false), - unk_0xFB8(unk) { + Board::Board(EGG::Heap* heap, int unk) + : Base(heap), ButtonEventHandlerBase(), mState(STATE_WAIT_CDB_INIT), mObjList(), mbDoReadTask(false), mbReading(false), + mbDoTaskDelete(false), mbDoCountTask(false), mbNewMsgAnimCount(false), mCurrentDate(System::getCurrentTime()), + mPreviousDate(System::getCurrentTime()), mpLayoutFile(NULL), mpLayoutBg(NULL), mpLayoutFocusBg(NULL), mbRIconEnable(false), + mbLIconEnable(false), mbFocusMode(false), mbPlayDispSound(false), mpCurrentFocus(NULL), mMsgCount(-1), mPrevMsgCount(-1), mBoardSD(), + unk_0xFB4(false), unk_0xFB8(unk) { setSceneParentFlags(SCN_PARENTFLAG_CALC | SCN_PARENTFLAG_DRAW); for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) { @@ -202,8 +176,7 @@ CONCAT(l,__LINE__): \ System::getCdbManager()->terminateSDProc(); mState = STATE_DONE; } - } - else { + } else { mState = STATE_DONE; } break; @@ -261,8 +234,7 @@ CONCAT(l,__LINE__): \ if (mMsgCount <= 99) { mailCount = mMsgCount; } - } - else { + } else { mailCount = 0; } @@ -278,8 +250,7 @@ CONCAT(l,__LINE__): \ if (mailCount != 0) { button->startMailNumAnm(); - } - else { + } else { button->stopMailNumAnm(); } @@ -297,11 +268,8 @@ CONCAT(l,__LINE__): \ void Board::draw() { if (mState != STATE_WAIT_CDB_INIT) { if (System::onDrawLayer(scene::DRAW_LAYER_1)) { - OBJ_LIST_LOOP({ - object->capture(); - }); - } - else if (System::onDrawLayer(scene::DRAW_LAYER_2)) { + OBJ_LIST_LOOP({ object->capture(); }); + } else if (System::onDrawLayer(scene::DRAW_LAYER_2)) { // Background utility::Graphics::setOrtho(); mpLayoutBg->draw(); @@ -313,8 +281,7 @@ CONCAT(l,__LINE__): \ OBJ_LIST_LOOP({ if (object->mState != BoardObject::STATE_PINCH) { object->draw(); - } - else { + } else { chosen = object; } }); @@ -380,7 +347,7 @@ CONCAT(l,__LINE__): \ if (!mbDoTaskDelete && !mbDoReadTask && !mbDoCountTask && !is_wait_to_clean_task()) { result = TRUE; } - + return result; } @@ -391,18 +358,15 @@ CONCAT(l,__LINE__): \ utility::Calendar::getYesterday(mCurrentDate, &yesterday); if (yesterday == date) { cmn_start_scroll_l(); - } - else { + } else { cmn_start_scroll_l_hi(date); } - } - else { + } else { utility::Date tomorrow; utility::Calendar::getTomorrow(mCurrentDate, &tomorrow); if (tomorrow == date) { cmn_start_scroll_r(); - } - else { + } else { cmn_start_scroll_r_hi(date); } } @@ -413,7 +377,7 @@ CONCAT(l,__LINE__): \ Button* button = get_button(); button->setEventHandler(NULL); - mpCurrentFocus = new(System::getMem2App(), 4) focus_object(mpLayoutFile, mpBalloonFile, boardObject); + mpCurrentFocus = new (System::getMem2App(), 4) focus_object(mpLayoutFile, mpBalloonFile, boardObject); // Focus in mpLayoutFocusBg->getAnim(FOCUS_ANIM_IN)->play(); @@ -480,8 +444,8 @@ CONCAT(l,__LINE__): \ // Get record metadata CDBRecordGetCalendarTimeForce(record, &recordDate.year, &recordDate.month, &recordDate.day, &recordHour, &recordMin, &recordDay); CDBRecordGetKeyForce(record, &recordKey); - CDBRecordGetTypeForce(record,recordType); - CDBRecordGetGameCodeForce(record,(char*)&recordGC); + CDBRecordGetTypeForce(record, recordType); + CDBRecordGetGameCodeForce(record, (char*)&recordGC); if (mbReading == true && mSearchRecord_Prev.created) { mbReading = false; @@ -547,7 +511,7 @@ CONCAT(l,__LINE__): \ } // Read CDB metadata - u8* rbrData = new(obj->mpHeap, DEFAULT_ALIGN) u8[dataSize]; + u8* rbrData = new (obj->mpHeap, DEFAULT_ALIGN) u8[dataSize]; if (rbrData == NULL) { return FALSE; } @@ -574,57 +538,55 @@ CONCAT(l,__LINE__): \ obj->create(mpLayoutFile, rbrData, recordGC, cdbId, recordKey, recordDate); mObjList.append(obj); - CDBRecordGetCalendarTimeForce(record, &mSearchRecord_Next.year, &mSearchRecord_Next.month, &mSearchRecord_Next.day, &mSearchRecord_Next.hour, &mSearchRecord_Next.min, &mSearchRecord_Next.sec); + CDBRecordGetCalendarTimeForce(record, &mSearchRecord_Next.year, &mSearchRecord_Next.month, &mSearchRecord_Next.day, + &mSearchRecord_Next.hour, &mSearchRecord_Next.min, &mSearchRecord_Next.sec); memcpy(&mSearchRecord_Next.key, &recordKey, sizeof(CDBRecordKey)); mSearchRecord_Next.created = true; if (mSearchRecord_Prev.created == false) { memcpy(&mSearchRecord_Prev, &mSearchRecord_Next, sizeof(SearchRecord)); - } - } - else { + } + } else { result = FALSE; delete[] rbrData; } OSRestoreInterrupts(old3); - } - else { + } else { delete[] rbrData; } -close: + close: cdbManager->close(record); -hide_icon: + hide_icon: if (mSearchDirection == CDB_SEARCH_DIRECTION_LEFT) { hide_licon(); - } - else { + } else { hide_ricon(); } goto out; -show_icon: + show_icon: if (mSearchDirection == CDB_SEARCH_DIRECTION_LEFT) { show_licon(); - } - else { + } else { show_ricon(); } result = FALSE; goto out; -error: + error: result = FALSE; -out: + out: return result; } void Board::stt_wait_cdb_init() { - if ((System::createdAfterAndLibMgr() || (System::hasCreatedAfter() && System::isNandFull()) || (System::isSafeMode())) && System::getChannelManager()->isInitialized()) { + if ((System::createdAfterAndLibMgr() || (System::hasCreatedAfter() && System::isNandFull()) || (System::isSafeMode())) && + System::getChannelManager()->isInitialized()) { System::getHomeButtonMenu()->enableLib(); // Scene order = Button > Channel Select > Arrow @@ -722,10 +684,8 @@ out: scene::Manager* scnMgr = System::getSceneManager(); Button* button = static_cast(scnMgr->getScene(SCENE_BUTTON)); - if (scnMgr->getScene(SCENE_CHANNEL_SELECT) == NULL - && scnMgr->getScene(SCENE_CALENDAR) == NULL - && scnMgr->getScene(SCENE_MAIL_ADDRESS_SELECT) == NULL - && scnMgr->getReservedScene() == NULL) { + if (scnMgr->getScene(SCENE_CHANNEL_SELECT) == NULL && scnMgr->getScene(SCENE_CALENDAR) == NULL && + scnMgr->getScene(SCENE_MAIL_ADDRESS_SELECT) == NULL && scnMgr->getReservedScene() == NULL) { if (!unk_0xFB4) { if (mbFocusMode) { mpLayoutFocusBg->getAnim(FOCUS_ANIM_OUT)->play(); @@ -745,8 +705,7 @@ out: mState = STATE_NORMAL; } - } - else { + } else { if (static_cast(System::getScene(SCENE_CHANNEL_TITLE)) != NULL) { if (static_cast(System::getScene(SCENE_CHANNEL_TITLE))->isInLaunching()) { return; @@ -771,8 +730,8 @@ out: return; } - if (scnMgr->getScene(SCENE_CHANNEL_SELECT) != NULL && System::requestedNewMailAnm() - && (mPrevMsgCount >= 0 && mMsgCount > 0 && mPrevMsgCount < mMsgCount)) { + if (scnMgr->getScene(SCENE_CHANNEL_SELECT) != NULL && System::requestedNewMailAnm() && + (mPrevMsgCount >= 0 && mMsgCount > 0 && mPrevMsgCount < mMsgCount)) { mPrevMsgCount = mMsgCount; button->startNewMailAnm(); @@ -791,9 +750,8 @@ out: void Board::stt_wait_child_cst() { scene::Manager* scnMgr = System::getSceneManager(); - if (scnMgr->getScene(SCENE_CHANNEL_SELECT) != NULL - || scnMgr->getScene(SCENE_CALENDAR) != NULL - || scnMgr->getScene(SCENE_MAIL_ADDRESS_SELECT) != NULL) { + if (scnMgr->getScene(SCENE_CHANNEL_SELECT) != NULL || scnMgr->getScene(SCENE_CALENDAR) != NULL || + scnMgr->getScene(SCENE_MAIL_ADDRESS_SELECT) != NULL) { mState = STATE_WAIT_CHILD_DST; } } @@ -811,12 +769,10 @@ out: scene::Manager* scnMgr = System::getSceneManager(); - if (scnMgr->getScene(SCENE_CALENDAR) != NULL - || scnMgr->getScene(SCENE_CHANNEL_SELECT) != NULL - || scnMgr->getReservedScene() != NULL) { + if (scnMgr->getScene(SCENE_CALENDAR) != NULL || scnMgr->getScene(SCENE_CHANNEL_SELECT) != NULL || + scnMgr->getReservedScene() != NULL) { mState = STATE_WAIT_CHILD_DST; - } - else { + } else { edge_arrow(); mState = STATE_NORMAL; } @@ -857,8 +813,7 @@ out: exec_count_task(); System::getNwc24Manager()->prepNextReceive(); System::stopRequestNewMailAnm(); - } - else { + } else { if (mObjList.getFreeCount() != 0) { if (mSearchDirection == CDB_SEARCH_DIRECTION_LEFT) { SearchRecord record; @@ -880,13 +835,11 @@ out: System::getNwc24Manager()->prepNextReceive(); System::stopRequestNewMailAnm(); - } - else { + } else { if (!result) { if (mSearchDirection == CDB_SEARCH_DIRECTION_LEFT) { memcpy(&mSearchRecord, &mSearchRecord_Prev, sizeof(SearchRecord)); - } - else { + } else { memcpy(&mSearchRecord, &mSearchRecord_Next, sizeof(SearchRecord)); } @@ -1117,8 +1070,7 @@ out: // Refresh mbDoReadTask = true; System::getTask1()->request(read_task_, this, NULL); - } - else if (mObjList.getCount() == 0 && mbRIconEnable) { + } else if (mObjList.getCount() == 0 && mbRIconEnable) { init_search_condition(); mSearchDirection = CDB_SEARCH_DIRECTION_RIGHT; @@ -1141,16 +1093,13 @@ out: if (!mbDoReadTask) { if (mSearchDirection == CDB_SEARCH_DIRECTION_LEFT) { memcpy(&mSearchRecord, &mSearchRecord_Next, sizeof(SearchRecord)); - } - else { + } else { memcpy(&mSearchRecord, &mSearchRecord_Prev, sizeof(SearchRecord)); } mSearchDirection = CDB_SEARCH_DIRECTION_LEFT; - OBJ_LIST_LOOP({ - object->right_away(); - }); + OBJ_LIST_LOOP({ object->right_away(); }); snd::getSystem()->startSEwithPos("WIPL_SE_MSG_HOUSE", 300.0f); @@ -1162,16 +1111,13 @@ out: if (!mbDoReadTask) { if (mSearchDirection == CDB_SEARCH_DIRECTION_RIGHT) { memcpy(&mSearchRecord, &mSearchRecord_Next, sizeof(SearchRecord)); - } - else { + } else { memcpy(&mSearchRecord, &mSearchRecord_Prev, sizeof(SearchRecord)); } mSearchDirection = CDB_SEARCH_DIRECTION_RIGHT; - OBJ_LIST_LOOP({ - object->left_away(); - }); + OBJ_LIST_LOOP({ object->left_away(); }); snd::getSystem()->startSEwithPos("WIPL_SE_MSG_HOUSE", -300.0f); @@ -1182,20 +1128,16 @@ out: void Board::stt_wait_fadeaway() { bool result = mbDoReadTask == false; OBJ_LIST_LOOP({ - result = (result & (!object->mbRightWay - && !object->mbLeftWay - && !object->mMoveAnim.isPlaying() - && object->mpLayout != NULL - && !object->mpLayout->getAnim(BoardObject::ANIM_NEXT_PAGE)->isPlaying())) != false - && object->mbModifiedPos == false; + result = (result & (!object->mbRightWay && !object->mbLeftWay && !object->mMoveAnim.isPlaying() && object->mpLayout != NULL && + !object->mpLayout->getAnim(BoardObject::ANIM_NEXT_PAGE)->isPlaying())) != false && + object->mbModifiedPos == false; }); if (result) { if (mSearchDirection == CDB_SEARCH_DIRECTION_LEFT) { hide_licon(); show_ricon(); - } - else { + } else { hide_ricon(); show_licon(); } @@ -1219,9 +1161,7 @@ out: void Board::stt_wait_stand() { bool result = TRUE; - OBJ_LIST_LOOP({ - result &= (object->mState == STATE_WAIT_CHILD_CST); - }); + OBJ_LIST_LOOP({ result &= (object->mState == STATE_WAIT_CHILD_CST); }); if (result) { mState = STATE_NORMAL; @@ -1288,20 +1228,17 @@ out: if (board->getSearchRecord().created) { start = RECORD_DATE_TO_CDB(board->getSearchRecord()); - } - else { + } else { if (board->getSearchDirection() == CDB_SEARCH_DIRECTION_LEFT) { start = DATE_TO_CDB_END(board->getDate()); - } - else { + } else { start = DATE_TO_CDB_BEGIN(board->getDate()); } } if (board->getSearchDirection() == CDB_SEARCH_DIRECTION_LEFT) { end = DATE_TO_CDB_BEGIN(board->getDate()); - } - else { + } else { end = DATE_TO_CDB_END(board->getDate()); } @@ -1336,12 +1273,10 @@ out: if (!cdbManager->isValidType(recordType)) { return TRUE; - } - else { + } else { if (board->is_already_read(recordKey.keyString)) { return TRUE; - } - else { + } else { date.month++; if (date == board->getDate()) { board->show_ricon(); @@ -1389,7 +1324,7 @@ out: } void Board::set_text_date(const utility::Date& date, const char* paneName) { - #define TEXT_LENGTH 32 +#define TEXT_LENGTH 32 wchar_t fullText[TEXT_LENGTH] = {0}; memset(&fullText, 0, sizeof(fullText)); @@ -1439,18 +1374,11 @@ out: nw4r::lyt::TextBox* textBox = nw4r::ut::DynamicCast(mpLayoutBg->FindPaneByName(paneName)); textBox->SetString(fullText); - #undef TEXT_LENGTH +#undef TEXT_LENGTH } - static const u32 scWeekMsgId[] = { - MESG_CALENDAR_MONDAY, - MESG_CALENDAR_MONDAY, - MESG_CALENDAR_TUESDAY, - MESG_CALENDAR_WEDNESDAY, - MESG_CALENDAR_THURSDAY, - MESG_CALENDAR_FRIDAY, - MESG_CALENDAR_SATURDAY - }; + static const u32 scWeekMsgId[] = {MESG_CALENDAR_MONDAY, MESG_CALENDAR_MONDAY, MESG_CALENDAR_TUESDAY, MESG_CALENDAR_WEDNESDAY, + MESG_CALENDAR_THURSDAY, MESG_CALENDAR_FRIDAY, MESG_CALENDAR_SATURDAY}; void Board::get_text_jpn(const utility::Date& date, wchar_t* text, u32 textLen) { message::Manager* msgMgr = System::getMessageManager(); @@ -1517,11 +1445,10 @@ out: scene::Manager* scnMgr = System::getSceneManager(); - if (scnMgr->getScene(SCENE_CHANNEL_SELECT) == NULL - && scnMgr->getScene(SCENE_CALENDAR) == NULL - && scnMgr->getScene(SCENE_MAIL_ADDRESS_SELECT) == NULL - && scnMgr->getReservedScene() == NULL) { - if (mState == STATE_NORMAL || (mState == STATE_PINCH || mState == STATE_INIT_LEFT_FADEAWAY || mState == STATE_INIT_RIGHT_FADEAWAY || mState == STATE_INIT_FADEAWAY)) { + if (scnMgr->getScene(SCENE_CHANNEL_SELECT) == NULL && scnMgr->getScene(SCENE_CALENDAR) == NULL && + scnMgr->getScene(SCENE_MAIL_ADDRESS_SELECT) == NULL && scnMgr->getReservedScene() == NULL) { + if (mState == STATE_NORMAL || (mState == STATE_PINCH || mState == STATE_INIT_LEFT_FADEAWAY || mState == STATE_INIT_RIGHT_FADEAWAY || + mState == STATE_INIT_FADEAWAY)) { if (System::getSceneManager()->getScene(SCENE_BUTTON) != NULL && prev != mbRIconEnable) { get_button()->animation(Button::IDANIM_RIGHT_ARROW_SHOW_LETTER); if (!get_button()->isArrowVisible(Button::ARROW_BTN_RIGHT)) { @@ -1548,11 +1475,10 @@ out: scene::Manager* scnMgr = System::getSceneManager(); - if (scnMgr->getScene(SCENE_CHANNEL_SELECT) == NULL - && scnMgr->getScene(SCENE_CALENDAR) == NULL - && scnMgr->getScene(SCENE_MAIL_ADDRESS_SELECT) == NULL - && scnMgr->getReservedScene() == NULL) { - if (mState == STATE_NORMAL || (mState == STATE_PINCH || mState == STATE_INIT_LEFT_FADEAWAY || mState == STATE_INIT_RIGHT_FADEAWAY || mState == STATE_INIT_FADEAWAY)) { + if (scnMgr->getScene(SCENE_CHANNEL_SELECT) == NULL && scnMgr->getScene(SCENE_CALENDAR) == NULL && + scnMgr->getScene(SCENE_MAIL_ADDRESS_SELECT) == NULL && scnMgr->getReservedScene() == NULL) { + if (mState == STATE_NORMAL || (mState == STATE_PINCH || mState == STATE_INIT_LEFT_FADEAWAY || mState == STATE_INIT_RIGHT_FADEAWAY || + mState == STATE_INIT_FADEAWAY)) { if (System::getSceneManager()->getScene(SCENE_BUTTON) != NULL && prev != mbLIconEnable) { get_button()->animation(Button::IDANIM_LEFT_ARROW_SHOW_LETTER); if (!get_button()->isArrowVisible(Button::ARROW_BTN_LEFT)) { @@ -1643,8 +1569,7 @@ out: if (!button->isArrowVisible(Button::ARROW_BTN_LEFT)) { button->animation(Button::IDANIM_ARROW_LEFT_APPEAR); } - } - else { + } else { if (mCurrentDate == utility::Date::getMinDate()) { if (button->isArrowVisible(Button::ARROW_BTN_LEFT) && mbLIconEnable != true) { button->animation(Button::IDANIM_ARROW_LEFT_DISAPPEAR); @@ -1652,8 +1577,7 @@ out: if (!button->isArrowVisible(Button::ARROW_BTN_RIGHT)) { button->animation(Button::IDANIM_ARROW_RIGHT_APPEAR); } - } - else { + } else { appear_arrow(); } } @@ -1696,8 +1620,7 @@ out: if (date < mPreviousDate) { ret = 0; - } - else if (date > mPreviousDate) { + } else if (date > mPreviousDate) { ret = 2; } @@ -1720,17 +1643,13 @@ out: void Board::set_key_table() { int i = 0; - OBJ_LIST_LOOP({ - strncpy((char*)mKeyTable[i++], object->mCDBRecordKey.keyString, sizeof(object->mCDBRecordKey.keyString)); - }); + OBJ_LIST_LOOP({ strncpy((char*)mKeyTable[i++], object->mCDBRecordKey.keyString, sizeof(object->mCDBRecordKey.keyString)); }); } BOOL Board::is_exist_diff_date() const { bool result = false; - OBJ_LIST_LOOP({ - result |= (object->mBoardDate != mCurrentDate); - }); + OBJ_LIST_LOOP({ result |= (object->mBoardDate != mCurrentDate); }); return result; } @@ -1827,9 +1746,7 @@ out: BOOL Board::is_wait_to_clean_task() const { bool result = false; - OBJ_LIST_LOOP({ - result |= object->mbCleaned; - }); + OBJ_LIST_LOOP({ result |= object->mbCleaned; }); return result; } @@ -1862,8 +1779,7 @@ out: void Board::after_backup() { if (System::getCdbManager()->isSDMounted()) { mBoardSD.setState(2); - } - else { + } else { System::getCdbManager()->getSDWorker()->mount_sd_async(); mBoardSD.setState(0); } @@ -1885,7 +1801,7 @@ out: if (nwc24Mgr->open()) { NWC24FriendAddr boardAddr = mpCurrentFocus->mpBoardObj->get_addr(); - switch(mpCurrentFocus->mpBoardObj->get_addr_type()) { + switch (mpCurrentFocus->mpBoardObj->get_addr_type()) { case NWC24_FRIENDTYPE_WII: { if (nwc24Mgr->searchFriendInfo(boardAddr.wiiId, &index)) { nwc24Mgr->readFriendInfo(&readInfo, index); @@ -1893,13 +1809,11 @@ out: if (info->attr.status == NWC24_FRIENDSTATUS_CONFIRMED) { result = FRIEND_CODE_ERR_SUCCESS; - } - else { + } else { result = FRIEND_CODE_ERR_UNAVAILABLE; } break; - } - else { + } else { result = FRIEND_CODE_ERR_UNAVAILABLE; } break; @@ -1911,13 +1825,11 @@ out: if (info->attr.status == NWC24_FRIENDSTATUS_CONFIRMED) { result = FRIEND_CODE_ERR_SUCCESS; - } - else { + } else { result = FRIEND_CODE_ERR_UNAVAILABLE; } break; - } - else { + } else { result = FRIEND_CODE_ERR_UNAVAILABLE; } break; @@ -1962,8 +1874,7 @@ out: updateDate(utility::Date(System::getCurrentTime())); exec_count_task(); - } - else if (mState == STATE_NORMAL && Button::cmpButtonName(paneName, Button::BTN_CALENDAR) == 0) { + } else if (mState == STATE_NORMAL && Button::cmpButtonName(paneName, Button::BTN_CALENDAR) == 0) { createChildScene(SCENE_CALENDAR, this, button); cmn_create_child(Button::IDANIM_FROM_BOARD_TO_CALENDAR); @@ -1972,8 +1883,7 @@ out: mpLayoutFocusBg->getAnim(FOCUS_ANIM_IN)->play(); mbFocusMode = true; - } - else if (mState == STATE_NORMAL && Button::cmpButtonName(paneName, Button::BTN_CREATE) == 0) { + } else if (mState == STATE_NORMAL && Button::cmpButtonName(paneName, Button::BTN_CREATE) == 0) { createChildScene(SCENE_MAIL_ADDRESS_SELECT, this, button); cmn_create_child(Button::IDANIM_FROM_BOARD_TO_MAIL_SEL); @@ -1983,32 +1893,28 @@ out: mpLayoutFocusBg->getAnim(FOCUS_ANIM_IN)->play(); mbFocusMode = true; - } - else if (mState == STATE_NORMAL && Button::cmpButtonName(paneName, Button::BTN_ARROW_RIGHT) == 0) { + } else if (mState == STATE_NORMAL && Button::cmpButtonName(paneName, Button::BTN_ARROW_RIGHT) == 0) { if (mbRIconEnable) { if (mbDoReadTask) { mbReading = true; } mState = STATE_INIT_RIGHT_FADEAWAY; button->animation(Button::IDANIM_ARROW_RIGHT_SELECT); - } - else { + } else { if (mCurrentDate != utility::Date::getMaxDate()) { button->animation(Button::IDANIM_ARROW_RIGHT_SELECT); cmn_start_scroll_r(); snd::getSystem()->startSE("WSD_SELECT"); } } - } - else if (mState == STATE_NORMAL && Button::cmpButtonName(paneName, Button::BTN_ARROW_LEFT) == 0) { + } else if (mState == STATE_NORMAL && Button::cmpButtonName(paneName, Button::BTN_ARROW_LEFT) == 0) { if (mbLIconEnable) { if (mbDoReadTask) { mbReading = true; } mState = STATE_INIT_LEFT_FADEAWAY; button->animation(Button::IDANIM_ARROW_LEFT_SELECT); - } - else { + } else { if (mCurrentDate != utility::Date::getMinDate()) { button->animation(Button::IDANIM_ARROW_LEFT_SELECT); cmn_start_scroll_l(); @@ -2042,7 +1948,7 @@ out: return; } - u8* recordData = new(logObj->mpHeap, DEFAULT_ALIGN) u8[dataSize]; + u8* recordData = new (logObj->mpHeap, DEFAULT_ALIGN) u8[dataSize]; if (recordData == NULL) { logObj->destroy(); mObjList.remove(logObj); @@ -2079,13 +1985,12 @@ out: return logObj; } - Board::ObjList::ObjList() : - mObjects() { + Board::ObjList::ObjList() : mObjects() { nw4r::ut::List_Init(&mUsedObjs, offsetof(BoardObject, mLinkNode)); nw4r::ut::List_Init(&mFreeObjs, offsetof(BoardObject, mLinkNode)); for (int i = 0; i < OBJECTS_ON_SCREEN; i++) { - nw4r::ut::List_Append(&mFreeObjs, &mObjects[i]); // Append blank data + nw4r::ut::List_Append(&mFreeObjs, &mObjects[i]); // Append blank data } } @@ -2096,5 +2001,5 @@ out: Arrow* Board::get_arrow() { return static_cast(System::getScene(SCENE_ARROW)); } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/board/iplBoardObject.cpp b/src/scene/board/iplBoardObject.cpp index ae0db31a..6a0e642d 100644 --- a/src/scene/board/iplBoardObject.cpp +++ b/src/scene/board/iplBoardObject.cpp @@ -1,7 +1,8 @@ #include "iplSceneUI.h" -#include "scene/board/iplBoardObject.h" #include "scene/board/iplBoard.h" +#include "scene/board/iplBoardObject.h" + #include "scene/button/iplButton.h" @@ -16,16 +17,33 @@ #include "utility/iplTPLValidity.h" // I don't want to keep typing this out lol -#define DELETE_PTR_FORCE(x) { delete x; x = NULL; } -#define DELETE_PTR_ARRAY_FORCE(x) { delete[] x; x = NULL; } -#define DELETE_PTR(x) if (x) { delete x; x = NULL; } -#define DELETE_PTR_ARRAY(x) if (x) { delete[] x; x = NULL; } +#define DELETE_PTR_FORCE(x) \ + { \ + delete x; \ + x = NULL; \ + } +#define DELETE_PTR_ARRAY_FORCE(x) \ + { \ + delete[] x; \ + x = NULL; \ + } +#define DELETE_PTR(x) \ + if (x) { \ + delete x; \ + x = NULL; \ + } +#define DELETE_PTR_ARRAY(x) \ + if (x) { \ + delete[] x; \ + x = NULL; \ + } -#define PICTURE_THUMB_WIDTH 64 -#define PICTURE_THUMB_HEIGHT 48 +#define PICTURE_THUMB_WIDTH 64 +#define PICTURE_THUMB_HEIGHT 48 namespace ipl { namespace scene { + // clang-format off const char* BoardObject::mAnimNames[BoardObject::TYPE_MAX][1+BoardObject::ANIM_MAX] = { { "LetterS_a.brlyt", @@ -64,6 +82,7 @@ namespace ipl { "LetterS_c_SDAnim.brlan" } }; + // clang-format on static const struct { const char* file; @@ -75,33 +94,15 @@ namespace ipl { "Letter0", }; - BoardObject::BoardObject() : - ::gui::EventHandler(), - mpLayout(NULL), - mpGui(NULL), - mpNigaoe(NULL), - mpRecordData(NULL), - mpUncompThumb(NULL), - mBoardPos(0.0f, 0.0f), - mMoveSpeed(0.0f, 0.0f), - mMoveAnim(), - mBoardDate(), - mbModifiedPos(false), - mbCleaned(false), - mbCreatedPic(false), - mbLeftWay(false), - mbRightWay(false), - mOptOutFlag(0), - mPicture(), - mpCapture(NULL), - mbCaptured(false), - mState(STATE_NORMAL), - mConPos(0.0f, 0.0f), - mConChan(0) { + BoardObject::BoardObject() + : ::gui::EventHandler(), mpLayout(NULL), mpGui(NULL), mpNigaoe(NULL), mpRecordData(NULL), mpUncompThumb(NULL), mBoardPos(0.0f, 0.0f), + mMoveSpeed(0.0f, 0.0f), mMoveAnim(), mBoardDate(), mbModifiedPos(false), mbCleaned(false), mbCreatedPic(false), mbLeftWay(false), + mbRightWay(false), mOptOutFlag(0), mPicture(), mpCapture(NULL), mbCaptured(false), mState(STATE_NORMAL), mConPos(0.0f, 0.0f), + mConChan(0) { // Setup memory allocators mpHeapArena = (u8*)System::getMem2App()->alloc(0x46000, 4); mpHeap = EGG::ExpHeap::create(mpHeapArena, 0x46000, 0); - mpAllocator = new(mpHeap, 4) EGG::Allocator(mpHeap, 4); + mpAllocator = new (mpHeap, 4) EGG::Allocator(mpHeap, 4); mStandData.init(); } @@ -116,7 +117,8 @@ namespace ipl { material->SetTexture(GX_TEXMAP0, obj->getIconTexture()); } - void BoardObject::create(nand::LayoutFile* file, u8* recordData, u32 gameCode, const CDBId& cdbId, const CDBRecordKey& recordKey, const ipl::utility::Date& date) { + void BoardObject::create(nand::LayoutFile* file, u8* recordData, u32 gameCode, const CDBId& cdbId, const CDBRecordKey& recordKey, + const ipl::utility::Date& date) { mpRecordData = recordData; mpLayoutFile = file; @@ -139,9 +141,7 @@ namespace ipl { mpUncompThumb = NULL; mpThumbLength = 0; - mMoveAnim.init(0, 8.0f, 0.0f, - math::VEC2(0.0f, 0.0f), - math::VEC2(0.0f, 0.0f)); + mMoveAnim.init(0, 8.0f, 0.0f, math::VEC2(0.0f, 0.0f), math::VEC2(0.0f, 0.0f)); mPicture.mpWork = 0; mPicture.mpRGB565 = NULL; @@ -183,11 +183,8 @@ namespace ipl { nw4r::ut::Rect rect; System::getProjectionRect4x3(&rect); - mMoveAnim.init(ANIM_TYPE_FORWARD, - mpLayout->getAnim(ANIM_NEXT_PAGE)->getMaxFrame(), - 0.0f, - math::VEC2(0.0f, 0.0f), - math::VEC2((rect.left - mBoardPos.x) - mMoveSpeed.x, (-mBoardPos.y - mMoveSpeed.y) + 53.0f)); + mMoveAnim.init(ANIM_TYPE_FORWARD, mpLayout->getAnim(ANIM_NEXT_PAGE)->getMaxFrame(), 0.0f, math::VEC2(0.0f, 0.0f), + math::VEC2((rect.left - mBoardPos.x) - mMoveSpeed.x, (-mBoardPos.y - mMoveSpeed.y) + 53.0f)); mMoveAnim.setAnmType(ANIM_TYPE_FORWARD); mMoveAnim.play(); @@ -202,11 +199,8 @@ namespace ipl { nw4r::ut::Rect rect; System::getProjectionRect4x3(&rect); - mMoveAnim.init(0, - mpLayout->getAnim(ANIM_NEXT_PAGE)->getMaxFrame(), - 0.0f, - math::VEC2(0.0f, 0.0f), - math::VEC2((rect.right - mBoardPos.x) - mMoveSpeed.x, (-mBoardPos.y - mMoveSpeed.y) + 53.0f)); + mMoveAnim.init(0, mpLayout->getAnim(ANIM_NEXT_PAGE)->getMaxFrame(), 0.0f, math::VEC2(0.0f, 0.0f), + math::VEC2((rect.right - mBoardPos.x) - mMoveSpeed.x, (-mBoardPos.y - mMoveSpeed.y) + 53.0f)); mMoveAnim.setAnmType(ANIM_TYPE_FORWARD); mMoveAnim.play(); @@ -241,31 +235,29 @@ namespace ipl { if (mRecordType == RBRRecordType_Memo) { mLetterType = TYPE_MEMO; - } - else if (mRecordType == RBRRecordType_PlayTimeLog) { + } else if (mRecordType == RBRRecordType_PlayTimeLog) { mLetterType = TYPE_PLAYTIME; - } - else { + } else { mLetterType = TYPE_LETTER; } const char** btnAnims = mAnimNames[mLetterType]; mOptOutFlag = recordHdr->flags.optOut & 1; - mpLayout = new(mpHeap, 4) layout::Object(mpHeap, mpLayoutFile, "arc", btnAnims[0]); - mpLayout->bind(btnAnims[ANIM_PASTE+1]); - mpLayout->bind(btnAnims[ANIM_FOCUS_IN+1], false); - mpLayout->bind(btnAnims[ANIM_FOCUS_OUT+1], false); - mpLayout->bind(btnAnims[ANIM_FOCUS+1], false); - mpLayout->bind(btnAnims[ANIM_EXIT+1], false); - mpLayout->bind(btnAnims[ANIM_NEXT_PAGE+1], false); - mpLayout->bindToGroup(btnAnims[ANIM_NEW+1], "G_New", false, false); - mpLayout->bindToGroup(btnAnims[ANIM_DEFAULT+1], "G_New", false, false); - mpLayout->bindToGroup(btnAnims[ANIM_SD+1], "G_New", false, false); + mpLayout = new (mpHeap, 4) layout::Object(mpHeap, mpLayoutFile, "arc", btnAnims[0]); + mpLayout->bind(btnAnims[ANIM_PASTE + 1]); + mpLayout->bind(btnAnims[ANIM_FOCUS_IN + 1], false); + mpLayout->bind(btnAnims[ANIM_FOCUS_OUT + 1], false); + mpLayout->bind(btnAnims[ANIM_FOCUS + 1], false); + mpLayout->bind(btnAnims[ANIM_EXIT + 1], false); + mpLayout->bind(btnAnims[ANIM_NEXT_PAGE + 1], false); + mpLayout->bindToGroup(btnAnims[ANIM_NEW + 1], "G_New", false, false); + mpLayout->bindToGroup(btnAnims[ANIM_DEFAULT + 1], "G_New", false, false); + mpLayout->bindToGroup(btnAnims[ANIM_SD + 1], "G_New", false, false); mpLayout->finishBinding(); - mpGui = new(mpHeap, 4) gui::PaneManager(this, mpLayout->getDrawInfo(), NULL, mpAllocator); - + mpGui = new (mpHeap, 4) gui::PaneManager(this, mpLayout->getDrawInfo(), NULL, mpAllocator); + mpGui->setupScene(mpLayout); mpGui->setAllComponentTriggerTarget(false); mpGui->setTriggerTarget(mpLayout->FindPaneByName("B_Letter"), true); @@ -277,8 +269,7 @@ namespace ipl { if (recordHdr->bodyOffset != 0) { thumbText = (wchar_t*)((u8*)mpRecordData + recordHdr->bodyOffset); } - } - else { + } else { if (recordHdr->titleOffset != 0) { thumbText = (wchar_t*)((u8*)mpRecordData + recordHdr->titleOffset); } @@ -313,13 +304,12 @@ namespace ipl { if (CXGetCompressionType(mpThumbPtr) == CX_COMPRESSION_TYPE_LZ) { u32 uncompSize = CXGetUncompressedSize(mpThumbPtr); if (uncompSize != 0 && uncompSize < 0x7800) { - mpUncompThumb = new(mpHeap, DEFAULT_ALIGN) u8[uncompSize]; + mpUncompThumb = new (mpHeap, DEFAULT_ALIGN) u8[uncompSize]; if (mpUncompThumb != NULL) { if (CXSecureUncompressLZ(mpThumbPtr, mpThumbLength, mpUncompThumb) == CX_SECURE_ERR_OK) { DCStoreRange(mpUncompThumb, uncompSize); change_ltrtex(mpLayout, mpUncompThumb); - } - else { + } else { DELETE_PTR_ARRAY_FORCE(mpUncompThumb); } } @@ -328,10 +318,9 @@ namespace ipl { } } if (recordHdr->attach[i].type == RBRAttachmentType_Picture) { - if (create_picture(&mPicture, - System::getMem2App(), System::getMem2App(), - ((u8*)mpRecordData + recordHdr->attach[i].offset), 4 + recordHdr->attach[i].size)) { - mpCapture = new(mpHeap, 4) utility::Capture(mpHeap, 0, 0, PICTURE_THUMB_WIDTH, PICTURE_THUMB_HEIGHT, GX_TF_RGB565); + if (create_picture(&mPicture, System::getMem2App(), System::getMem2App(), ((u8*)mpRecordData + recordHdr->attach[i].offset), + 4 + recordHdr->attach[i].size)) { + mpCapture = new (mpHeap, 4) utility::Capture(mpHeap, 0, 0, PICTURE_THUMB_WIDTH, PICTURE_THUMB_HEIGHT, GX_TF_RGB565); mbCaptured = false; mbCreatedPic = true; @@ -349,13 +338,11 @@ namespace ipl { if (recordTime < currTime) { if (OSSecondsToTicks(NEW_MESSAGE_DURATION_SECONDS) > (OSTime)(currTime - recordTime)) { mpLayout->getAnim(ANIM_NEW)->play(); - } - else { + } else { mpLayout->getAnim(ANIM_DEFAULT)->play(); } } - } - else { + } else { mpLayout->getAnim(ANIM_SD)->play(); } @@ -366,8 +353,7 @@ namespace ipl { if (mbCreatedPic) { mState = STATE_MAKE_THUMB; - } - else { + } else { mpLayout->getAnim(ANIM_PASTE)->play(); mState = STATE_FADE_IN; } @@ -426,8 +412,7 @@ namespace ipl { } snd::getSystem()->holdSEwithPosDis("WIPL_SE_BOARD_DRAG", mBoardPos.x + mMoveSpeed.x, speed); - } - else { + } else { if (con->isValidDpd()) { nw4r::ut::Rect rbrPos; RBRUtility::getPosRect(&rbrPos); @@ -441,15 +426,13 @@ namespace ipl { if (newPos.x < rbrPos.left) { newPos.x = rbrPos.left; - } - else if (newPos.x > rbrPos.right) { + } else if (newPos.x > rbrPos.right) { newPos.x = rbrPos.right; } if (newPos.y < rbrPos.bottom) { newPos.y = rbrPos.bottom; - } - else if (newPos.y > rbrPos.top) { + } else if (newPos.y > rbrPos.top) { newPos.y = rbrPos.top; } @@ -474,8 +457,7 @@ namespace ipl { mState = STATE_NORMAL; } - } - else { + } else { System::getPointer()->changeType(mConChan, PointerType::LayoutPoint); mMoveSpeed.clear(); mConPos.clear(); @@ -490,7 +472,8 @@ namespace ipl { f32 dVar2 = nw4r::math::CosFIdx(((mStandData.unk_0x0C * 30.0f + 30.0f) * 0.7111111f)); f32 dVar3 = nw4r::math::SinFIdx(((mStandData.unk_0x0C * 30.0f + 30.0f) * 0.7111111f)); - mBoardPos = (((mStandData.pos * (f32)(10 - mStandData.unk_0x08)) + (math::VEC2(dVar3 * 160.0f, dVar2 * 160.0f) * mStandData.unk_0x08)) / 10.0f); + mBoardPos = + (((mStandData.pos * (f32)(10 - mStandData.unk_0x08)) + (math::VEC2(dVar3 * 160.0f, dVar2 * 160.0f) * mStandData.unk_0x08)) / 10.0f); if ((mStandData.unk_0x08 += 1) > 10) { mStandData.init(); @@ -502,7 +485,7 @@ namespace ipl { if (mpLayout == NULL) { return; } - + if (mState == STATE_MAKE_THUMB) { return; } @@ -523,7 +506,8 @@ namespace ipl { utility::Graphics::calcOrthoCamera(); utility::Graphics::setCamera(); - utility::Graphics::drawTexture(nw4r::ut::Rect(0.0f, 0.0f, PICTURE_THUMB_WIDTH, PICTURE_THUMB_HEIGHT), mPicture.texObj, (GXColor){255, 255, 255, 255}, 1); + utility::Graphics::drawTexture(nw4r::ut::Rect(0.0f, 0.0f, PICTURE_THUMB_WIDTH, PICTURE_THUMB_HEIGHT), mPicture.texObj, + (GXColor){255, 255, 255, 255}, 1); if (mpCapture != NULL) { mpCapture->capture(TRUE); } @@ -566,7 +550,7 @@ namespace ipl { BOOL BoardObject::create_picture(picture* picture, EGG::Heap* picHeap, EGG::Heap* workHeap, u8* src, u32 srcSize) { BOOL result = FALSE; - + picture->width = ODHGetWidth(src); picture->height = ODHGetHeight(src); @@ -574,26 +558,24 @@ namespace ipl { if (picture->width > 0 && picture->width <= 512 && picture->height > 0 && picture->height <= 456) { u32 rgb565Size = pictureSize * 2; - picture->mpRGB565 = new(picHeap, DEFAULT_ALIGN) u8[rgb565Size]; + picture->mpRGB565 = new (picHeap, DEFAULT_ALIGN) u8[rgb565Size]; u32 workSize = ODHGetWorkSize(pictureSize); - picture->mpWork = new(workHeap, -DEFAULT_ALIGN) u8[workSize]; + picture->mpWork = new (workHeap, -DEFAULT_ALIGN) u8[workSize]; if (picture->mpRGB565 != NULL && picture->mpWork != NULL) { if (ODHDecodeRGB565(src, srcSize, picture->mpRGB565, rgb565Size, picture->mpWork, workSize)) { DCStoreRange(picture->mpRGB565, rgb565Size); GXInitTexObj(&picture->texObj, picture->mpRGB565, picture->width, picture->height, GX_TF_RGB565, GX_CLAMP, GX_CLAMP, 0); - + result = TRUE; DELETE_PTR_ARRAY_FORCE(picture->mpWork); - } - else { + } else { DELETE_PTR_ARRAY_FORCE(picture->mpRGB565); DELETE_PTR_ARRAY_FORCE(picture->mpWork); } - } - else { + } else { DELETE_PTR_ARRAY(picture->mpRGB565); DELETE_PTR_ARRAY(picture->mpWork); } @@ -622,27 +604,26 @@ namespace ipl { memset(local_28, 0, sizeof(local_28)); if (thumbText != NULL) { - for (int i = 0; i < THUMB_TEXT_LENGTH+1 && thumbText[i] != (u16)'\n'; i++) { + for (int i = 0; i < THUMB_TEXT_LENGTH + 1 && thumbText[i] != (u16)'\n'; i++) { local_28[i] = thumbText[i]; } } if (System::getRegion() == SC_LANG_JAPANESE) { if (local_28[THUMB_TEXT_LENGTH] != 0) { - local_28[THUMB_TEXT_LENGTH+0] = L'…'; + local_28[THUMB_TEXT_LENGTH + 0] = L'…'; } - } - else { + } else { if (local_28[THUMB_TEXT_LENGTH] != 0) { - local_28[THUMB_TEXT_LENGTH+2] = '.'; - local_28[THUMB_TEXT_LENGTH+1] = '.'; - local_28[THUMB_TEXT_LENGTH+0] = '.'; + local_28[THUMB_TEXT_LENGTH + 2] = '.'; + local_28[THUMB_TEXT_LENGTH + 1] = '.'; + local_28[THUMB_TEXT_LENGTH + 0] = '.'; } } textBox->SetString(local_28); } - + void BoardObject::update(int chan) { if (mpGui != NULL) { mpGui->update(chan); @@ -725,8 +706,8 @@ namespace ipl { case ON_HOLD: { if (con != NULL && con->decide()) { if (static_cast(System::getScene(SCENE_BOARD))->getHoveredObj(num) == this) { - if (static_cast(System::getScene(SCENE_BUTTON))->isActive() - && !static_cast(System::getScene(SCENE_BUTTON))->hasReservedAnim()) { + if (static_cast(System::getScene(SCENE_BUTTON))->isActive() && + !static_cast(System::getScene(SCENE_BUTTON))->hasReservedAnim()) { static_cast(System::getScene(SCENE_BOARD))->focus(this); } } @@ -828,7 +809,7 @@ namespace ipl { header.yPos = mBoardPos.y; header.crc32 = cdbManager->calcCRC(&header); if (cdbManager->findByKey(&cdbRecord, &mCDBRecordKey)) { - cdbManager->unused(); // does nothing but got that auto mutex lock + cdbManager->unused(); // does nothing but got that auto mutex lock if (cdbManager->open(&cdbRecord)) { if (cdbManager->seek(&cdbRecord, 0, CDB_SEEK_BEGIN)) { @@ -880,12 +861,12 @@ namespace ipl { result = ARCInitHandle(buffer, handle); -out: + out: return result; } void GenerateWEAK() { nw4r::lyt::TextBox* textBox = nw4r::ut::DynamicCast(((nw4r::lyt::Pane*)NULL)->FindPaneByName(NULL)); } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/board/iplBoardSD.cpp b/src/scene/board/iplBoardSD.cpp index 755284cd..335bcd2a 100644 --- a/src/scene/board/iplBoardSD.cpp +++ b/src/scene/board/iplBoardSD.cpp @@ -6,9 +6,8 @@ namespace ipl { namespace scene { - BoardSD::BoardSD() : - mState(STATE_PREPARE), - mSDState(0) {} + BoardSD::BoardSD() : mState(STATE_PREPARE), mSDState(0) { + } void BoardSD::update() { SDVFWorker* sdWorker = System::getCdbManager()->getSDWorker(); @@ -50,8 +49,7 @@ namespace ipl { error_handling(sdWorker->get_async_result()); if (sdWorker->get_async_result() == SDVFWorker::RESULT_SUCCESS) { mState = STATE_CLEANUP; - } - else { + } else { sdWorker->mount_sd_async(); mState = STATE_PREPARE; } @@ -91,5 +89,5 @@ namespace ipl { } } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/board/iplFocusObject.cpp b/src/scene/board/iplFocusObject.cpp index a61d51ab..eaf1e027 100644 --- a/src/scene/board/iplFocusObject.cpp +++ b/src/scene/board/iplFocusObject.cpp @@ -8,11 +8,13 @@ #include "scene/setting/iplNCDSetting.h" -#include #include +#include + namespace ipl { namespace scene { + // clang-format off const char* focus_object::mAnimNames[BoardObject::TYPE_MAX][1+ANIM_ARROW_MAX] = { { "my_Memo_a.brlyt", @@ -54,6 +56,7 @@ namespace ipl { "my_Memo_a_HDActionEnd.brlan", } }; + // clang-format on const char* focus_object::mscButtonName[focus_object::BTN_MAX] = { "B_ArwR", @@ -62,6 +65,7 @@ namespace ipl { "B_Nigaoe", }; + // clang-format off static const struct { const char* file; const char* s_pane; @@ -113,43 +117,15 @@ namespace ipl { "LetterI", }, }; + // clang-format on - focus_object::focus_object(nand::LayoutFile* layoutFile, nand::LayoutFile* balloonFile, BoardObject* boardObject) : - mState(STATE_INIT_NORMAL), - mNextState(STATE_NONE), - mPrevState(STATE_NONE), - mFinalResult(RESULT_NONE), - mCurrentResult(RESULT_NONE), - mpBoardObj(boardObject), - mpLayout(NULL), - mpGui(NULL), - mpNigaoeBalloon(NULL), - mpParsedText(NULL), - mEvent(this), - mButtonEvent(this), - mOptOutEvent(this), - mScroller(), - mPicture(), - unk_0xF8(0), - unk_0xFC(0), - mGUIAlloc(System::getMem2App(), 4), - mpCmpArcData(NULL), - mpArcData(NULL), - mArcLength(0), - mbChanJump(false), - mpChJpData(NULL), - mpSoundData(NULL), - mSoundSize(0), - mbSoundPlaying(false), - mURLProc(), - mFadeAnim(), - mNwc24ErrCountdown(0), - mChanJumpCountdown(0), - mbShowUArw(false), - mbShowDArw(false), - mbScaleUArw(false), - mbScaleDArw(false), - mbParentalSuccess(false) { + focus_object::focus_object(nand::LayoutFile* layoutFile, nand::LayoutFile* balloonFile, BoardObject* boardObject) + : mState(STATE_INIT_NORMAL), mNextState(STATE_NONE), mPrevState(STATE_NONE), mFinalResult(RESULT_NONE), mCurrentResult(RESULT_NONE), + mpBoardObj(boardObject), mpLayout(NULL), mpGui(NULL), mpNigaoeBalloon(NULL), mpParsedText(NULL), mEvent(this), mButtonEvent(this), + mOptOutEvent(this), mScroller(), mPicture(), unk_0xF8(0), unk_0xFC(0), mGUIAlloc(System::getMem2App(), 4), mpCmpArcData(NULL), + mpArcData(NULL), mArcLength(0), mbChanJump(false), mpChJpData(NULL), mpSoundData(NULL), mSoundSize(0), mbSoundPlaying(false), + mURLProc(), mFadeAnim(), mNwc24ErrCountdown(0), mChanJumpCountdown(0), mbShowUArw(false), mbShowDArw(false), mbScaleUArw(false), + mbScaleDArw(false), mbParentalSuccess(false) { for (int i = 0; i < BTN_MAX; i++) { mbHovered[i] = 0; } @@ -312,7 +288,8 @@ namespace ipl { show_or_hide_arw(showUArw, showDArw, hideUArw, hideDArw); - if ((mState == STATE_NORMAL || (mState == STATE_PIC_FADE_IN || mState == STATE_PIC_NORMAL || mState == STATE_PIC_FADE_OUT)) && mpSoundData != NULL) { + if ((mState == STATE_NORMAL || (mState == STATE_PIC_FADE_IN || mState == STATE_PIC_NORMAL || mState == STATE_PIC_FADE_OUT)) && + mpSoundData != NULL) { if (mSoundTimer()) { snd::getBannerPlayer()->start(mpSoundData, mSoundSize); mSoundTimer.set_msec(1471228928); @@ -341,9 +318,9 @@ namespace ipl { mpLayout->GetRootPane()->SetTranslate(math::VEC3((nw4r::math::VEC3)mFadeAnim.get())); mpLayout->FindPaneByName("N_Memo")->SetTranslate(nw4r::math::VEC3(0.0f, mScroller.get(), 0.0f)); - + mpLayout->calc(); - + mpNigaoeBalloon->updatePos(calc_balloon_pos()); mpNigaoeBalloon->calc(); @@ -355,8 +332,7 @@ namespace ipl { mbSoundPlaying = false; snd::getSystem()->muteOffBGM(120); } - } - else { + } else { mSoundStopTimer.set_msec(100); } } @@ -398,8 +374,7 @@ namespace ipl { } void focus_object::stt_wait_btn() { - if (get_button()->isActive() - && !get_button()->hasReservedAnim()) { + if (get_button()->isActive() && !get_button()->hasReservedAnim()) { switch (mNextState) { case STATE_FADE_OUT: { init_fadeout(false); @@ -424,10 +399,8 @@ namespace ipl { break; } case STATE_OPT_WAIT_SELECT_MSG: { - System::getDialog()->callBtn3(MESG_BOARD_OPT_OUT_SELECT, - MESG_BOARD_OPT_OUT_ONE, - MESG_BOARD_OPT_OUT_ALL, - MESG_BOARD_OPT_OUT_CANCEL); + System::getDialog()->callBtn3(MESG_BOARD_OPT_OUT_SELECT, MESG_BOARD_OPT_OUT_ONE, MESG_BOARD_OPT_OUT_ALL, + MESG_BOARD_OPT_OUT_CANCEL); break; } } @@ -458,7 +431,7 @@ namespace ipl { mNextState = STATE_NONE; } } - + void focus_object::stt_del_wait_msg() { switch (System::getDialog()->getLastResult()) { case DialogWindow::RESULT_LEFT_BUTTON: { @@ -478,8 +451,7 @@ namespace ipl { mState = STATE_WAIT_MSG; mNextState = STATE_NORMAL; - } - else { + } else { mFadeAnim.playBackwards(); mpNigaoeBalloon->terminate(); @@ -597,8 +569,7 @@ namespace ipl { } void focus_object::stt_ltr_wait_ltr_scene() { - if (System::getReservedScene() == NULL - && System::getScene(SCENE_LETTER_WRITER) == NULL) { + if (System::getReservedScene() == NULL && System::getScene(SCENE_LETTER_WRITER) == NULL) { System::startReceiveSchedule(); switch (mPrevState) { @@ -629,7 +600,7 @@ namespace ipl { break; } case DialogWindow::RESULT_RIGHT_BUTTON: { - char url[(256+1) * sizeof(wchar_t)]; + char url[(256 + 1) * sizeof(wchar_t)]; memset(url, 0, sizeof(url)); mURLProc.get_url(url, 256 * sizeof(wchar_t)); @@ -740,8 +711,7 @@ namespace ipl { nwc24Mgr->close(); System::getDialog()->callBtn1(MESG_BOARD_OPT_OUT_DONE, MESG_CMN_OK); mState = STATE_OPT_WAIT_CONFIRM_MSG; - } - else { + } else { check_delete_task_failure(); } } @@ -772,8 +742,7 @@ namespace ipl { nwc24Mgr->close(); System::getDialog()->callBtn1(MESG_BOARD_OPT_OUT_DONE_ALL, MESG_CMN_OK); mState = STATE_OPT_WAIT_CONFIRM_MSG; - } - else { + } else { check_delete_task_failure(); } } @@ -809,8 +778,7 @@ namespace ipl { mPrevState = mState; mState = STATE_NET_WAIT_PARENTAL; - } - else { + } else { mFinalResult = RESULT_INTERNET_SETTING; mState = STATE_DONE; } @@ -866,8 +834,7 @@ namespace ipl { mCurrentResult = RESULT_NONE; mState = STATE_DONE; - } - else { + } else { show_cmn_btn(); get_button()->setEventHandler(&mButtonEvent, &mOptOutEvent); @@ -884,8 +851,7 @@ namespace ipl { if (mScroller.getBInst().isActive() ? false : true) { if (con->down(controller::BTN_UP)) { mScroller.scrollUpByCon(); - } - else if (con->down(controller::BTN_DOWN)) { + } else if (con->down(controller::BTN_DOWN)) { mScroller.scrollDownByCon(); } } @@ -918,16 +884,14 @@ namespace ipl { } mState = STATE_CHN_WAIT_MSG; - } - else { + } else { System::getDialog()->callBtn1(MESG_BOARD_CHJUMP_NO_OPERA, MESG_CMN_OK); mNextState = STATE_NORMAL; mPrevState = mState; mState = STATE_WAIT_MSG; } } - } - else { + } else { mbHoveredURL[i] = false; } } @@ -1049,31 +1013,31 @@ namespace ipl { RBRHeader* recordHdr = (RBRHeader*)mpBoardObj->mpRecordData; const char** animNames = mAnimNames[type]; - mpLayout = new(System::getMem2App(), 4) layout::Object(System::getMem2App(), layoutFile, "arc", animNames[0]); + mpLayout = new (System::getMem2App(), 4) layout::Object(System::getMem2App(), layoutFile, "arc", animNames[0]); // Letter - mpLayout->bind(animNames[1+ANIM_SELECT]); - mpLayout->bind(animNames[1+ANIM_EXIT], false); + mpLayout->bind(animNames[1 + ANIM_SELECT]); + mpLayout->bind(animNames[1 + ANIM_EXIT], false); // Right arrows - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_LOOP], "G_ArwRoop", false, false); - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_FOCUS_ON], "G_ArwR_Focus", false, false); - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_FOCUS_OFF], "G_ArwR_Focus", false, false); - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_SELECT], "G_ArwR_Ac", false, false); - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_APPEAR], "G_ArwR_End", false, false); - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_LOST], "G_ArwR_End", false, false); - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_HD_AC_START], "G_ArwR_HDAc", false, false); - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_HD_AC_END], "G_ArwR_HDAc", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_LOOP], "G_ArwRoop", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_FOCUS_ON], "G_ArwR_Focus", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_FOCUS_OFF], "G_ArwR_Focus", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_SELECT], "G_ArwR_Ac", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_APPEAR], "G_ArwR_End", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_LOST], "G_ArwR_End", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_HD_AC_START], "G_ArwR_HDAc", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_HD_AC_END], "G_ArwR_HDAc", false, false); // Left arrow - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_LOOP], "G_ArwRoop", false, false); - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_FOCUS_ON], "G_ArwL_Focus", false, false); - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_FOCUS_OFF], "G_ArwL_Focus", false, false); - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_SELECT], "G_ArwL_Ac", false, false); - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_APPEAR], "G_ArwL_End", false, false); - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_LOST], "G_ArwL_End", false, false); - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_HD_AC_START], "G_ArwL_HDAc", false, false); - mpLayout->bindToGroup(animNames[1+ANIM_ARROW_HD_AC_END], "G_ArwL_HDAc", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_LOOP], "G_ArwRoop", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_FOCUS_ON], "G_ArwL_Focus", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_FOCUS_OFF], "G_ArwL_Focus", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_SELECT], "G_ArwL_Ac", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_APPEAR], "G_ArwL_End", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_LOST], "G_ArwL_End", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_HD_AC_START], "G_ArwL_HDAc", false, false); + mpLayout->bindToGroup(animNames[1 + ANIM_ARROW_HD_AC_END], "G_ArwL_HDAc", false, false); if (type == BoardObject::TYPE_LETTER) { mpLayout->bindToGroup("my_LetterL_Reply.brlan", "G_Reply", false, false); @@ -1102,8 +1066,7 @@ namespace ipl { default: { if (recordHdr->titleOffset != 0) { pStr = (wchar_t*)((u8*)mpBoardObj->mpRecordData + recordHdr->titleOffset); - } - else { + } else { pStr = nullStr; } break; @@ -1123,8 +1086,7 @@ namespace ipl { nw4r::lyt::Pane* bodyPane = mpLayout->FindPaneByName("N_Body"); nw4r::ut::Rect textRect = mpLayout->getTextDrawRect("T_Letter"); mLineCount = ceilf(-textRect.GetHeight() / bodyPane->GetSize().height); - } - else { + } else { utility::layout::set_string(mpLayout->FindPaneByName("T_Letter"), nullStr); mLineCount = 1; @@ -1134,8 +1096,7 @@ namespace ipl { if (recordHdr->faceOffset != 0 && mpBoardObj->mpNigaoe != NULL && mpBoardObj->mpNigaoe->created()) { nigaoePane->SetVisible(true); utility::layout::set_texture(nigaoePane->GetMaterial(), mpBoardObj->mpNigaoe->getIconTexture()); - } - else { + } else { nigaoePane->SetVisible(false); } @@ -1162,7 +1123,7 @@ namespace ipl { void focus_object::make_gui_mgr() { nw4r::lyt::Pane* trigPane; - mpGui = new(System::getMem2App(), 4) gui::PaneManager(&mEvent, mpLayout->getDrawInfo(), NULL, &mGUIAlloc); + mpGui = new (System::getMem2App(), 4) gui::PaneManager(&mEvent, mpLayout->getDrawInfo(), NULL, &mGUIAlloc); mpGui->setupScene(mpLayout); mpGui->setAllComponentTriggerTarget(false); @@ -1185,11 +1146,11 @@ namespace ipl { } void focus_object::make_parsed_text(const wchar_t* inText) { - mpParsedText = new(System::getMem2App(), 4) wchar_t[PARSED_TEXT_LENGTH]; + mpParsedText = new (System::getMem2App(), 4) wchar_t[PARSED_TEXT_LENGTH]; memset(mpParsedText, 0, PARSED_TEXT_LENGTH * sizeof(wchar_t)); const wchar_t *pURLStr, *pStr = inText; - const wchar_t URLSep[2] = { 0x1A, 0x00 }; + const wchar_t URLSep[2] = {0x1A, 0x00}; u32 i = 0; u32 strLen = wcslen(inText); @@ -1212,19 +1173,18 @@ namespace ipl { strLen = wcslen(inText); i = 0; - } - else { + } else { i++; } } wcsncat(mpParsedText, inText, i); } - + BOOL focus_object::is_url_end_code(wchar_t ch) const { bool result = FALSE; for (int i = 0; i < ARRAY_LENGTH(unk_0x114); i++) { - result |= ((unk_0x114[i]-ch) == 0); + result |= ((unk_0x114[i] - ch) == 0); } return result; } @@ -1235,8 +1195,7 @@ namespace ipl { const wchar_t* cmp1 = L"http://"; const wchar_t* cmp2 = L"https://"; - if (wcsncmp(url, cmp1, wcslen(cmp1)) == 0 - || wcsncmp(url, cmp2, wcslen(cmp2)) == 0) { + if (wcsncmp(url, cmp1, wcslen(cmp1)) == 0 || wcsncmp(url, cmp2, wcslen(cmp2)) == 0) { result = TRUE; } return result; @@ -1253,7 +1212,8 @@ namespace ipl { int focus_object::get_url_end(const wchar_t* url) const { int i; - for (i = 0; !is_url_end_code(url[i]) && !is_buffer_over(url, i+1); i++) {} + for (i = 0; !is_url_end_code(url[i]) && !is_buffer_over(url, i + 1); i++) { + } return i; } @@ -1270,19 +1230,8 @@ namespace ipl { } void focus_object::check_paren(wchar_t ch) { - wchar_t patterns[] = { L'(', L')', - L'{', L'}', - L'[', L']', - L'<', L'>', - L'[', L']', - L'(', L')', - L'{', L'}', - L'<', L'>', - L'《', L'》', - L'【', L'】', - L'〔', L'〕', - L'「', L'」', - L'『', L'』'}; + wchar_t patterns[] = {L'(', L')', L'{', L'}', L'[', L']', L'<', L'>', L'[', L']', L'(', L')', L'{', + L'}', L'<', L'>', L'《', L'》', L'【', L'】', L'〔', L'〕', L'「', L'」', L'『', L'』'}; for (int i = 0; i < ARRAY_LENGTH(patterns); i += 2) { if (ch == patterns[i]) { @@ -1309,14 +1258,13 @@ namespace ipl { if (cmpData != NULL && CXGetCompressionType(cmpData) == CX_COMPRESSION_TYPE_LZ) { u32 uncompSize = CXGetUncompressedSize(cmpData); if (uncompSize != 0 && uncompSize < 0x64000) { - mpArcData = new(System::getMem2App(), DEFAULT_ALIGN) u8[uncompSize]; + mpArcData = new (System::getMem2App(), DEFAULT_ALIGN) u8[uncompSize]; if (mpArcData != NULL) { if (CXSecureUncompressLZ(mpCmpArcData, mArcLength, mpArcData) == CX_SECURE_ERR_OK) { DCStoreRange(mpArcData, uncompSize); change_ltrtex(); - } - else { + } else { delete[] mpArcData; mpArcData = NULL; } @@ -1347,7 +1295,7 @@ namespace ipl { } BOOL focus_object::setup_chanjump() { - char blockData[NWC24_MAX_CHJP_SIZE+2/*?*/]; + char blockData[NWC24_MAX_CHJP_SIZE + 2 /*?*/]; u32 blockSize; memset(blockData, 0, sizeof(blockData)); @@ -1392,7 +1340,7 @@ namespace ipl { void focus_object::make_picture(RBRAttachment* attach) { u8* picData = (u8*)(mpBoardObj->mpRecordData + attach->offset); - if (mpBoardObj->create_picture(&mPicture, System::getTreasureHeap(), System::getMem2App(), picData, attach->size+4)) { + if (mpBoardObj->create_picture(&mPicture, System::getTreasureHeap(), System::getMem2App(), picData, attach->size + 4)) { nw4r::lyt::Pane* pane = mpLayout->FindPaneByName("Pic"); pane->GetMaterial()->SetTexture(GX_TEXMAP0, mPicture.texObj); resize_pane(pane); @@ -1407,12 +1355,7 @@ namespace ipl { if (mpBoardObj->arc_init_handle(pArc, &arc)) { ARCFileInfo arcFile; - const char* soundFileList[] = { - "sound.bns", - "sound.wav", - "sound.aif", - "sound.aiff" - }; + const char* soundFileList[] = {"sound.bns", "sound.wav", "sound.aif", "sound.aiff"}; for (int i = 0; i < (int)ARRAY_LENGTH(soundFileList); i++) { if (ARCOpen(&arc, soundFileList[i], &arcFile)) { @@ -1421,8 +1364,7 @@ namespace ipl { if (snd::getSystem()->checkTmpSoundFile(mpSoundData, mSoundSize)) { return; - } - else { + } else { mpSoundData = NULL; mSoundSize = 0; return; @@ -1449,8 +1391,7 @@ namespace ipl { newSize.height = paneH; newSize.width = paneW * (paneH / val); } - } - else { + } else { f32 val = (paneH * mPicture.width) / mPicture.height; newSize.width = val; if (val > paneW) { @@ -1458,7 +1399,7 @@ namespace ipl { newSize.height = paneH * (paneW / val); } } - + pane->SetSize(newSize); } return; @@ -1471,9 +1412,7 @@ namespace ipl { get_button()->setEventHandler(&mButtonEvent, &mOptOutEvent); - mFadeAnim.init(ANIM_TYPE_FORWARD, - 17.0f, 0.0f, - math::VEC3(mpBoardObj->mBoardPos.x, mpBoardObj->mBoardPos.y, 0.0f), + mFadeAnim.init(ANIM_TYPE_FORWARD, 17.0f, 0.0f, math::VEC3(mpBoardObj->mBoardPos.x, mpBoardObj->mBoardPos.y, 0.0f), math::VEC3(0.0f, 0.0f, 0.0f)); mFadeAnim.play(); @@ -1485,10 +1424,11 @@ namespace ipl { } void focus_object::init_balloon(nand::LayoutFile* layoutFile) { - mpNigaoeBalloon = new(System::getMem2App(), 4) TextBalloon(System::getMem2App(), layoutFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f), 120.0f, 30.0f); - - wchar_t ngName[RFL_NAME_LENGTH+2]; - mpBoardObj->get_nigaoe_name(ngName, RFL_NAME_LENGTH+2); + mpNigaoeBalloon = new (System::getMem2App(), 4) + TextBalloon(System::getMem2App(), layoutFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f), 120.0f, 30.0f); + + wchar_t ngName[RFL_NAME_LENGTH + 2]; + mpBoardObj->get_nigaoe_name(ngName, RFL_NAME_LENGTH + 2); mpNigaoeBalloon->init(ngName); mpNigaoeBalloon->init_textbox(); @@ -1514,7 +1454,8 @@ namespace ipl { nw4r::ut::Rect projRect; System::getProjectionRect(&projRect); - f32 limit = 160.0f + ((mLineCount * body->GetSize().height) + (header->GetSize().height + footer->GetSize().height) - projRect.GetHeight()); + f32 limit = + 160.0f + ((mLineCount * body->GetSize().height) + (header->GetSize().height + footer->GetSize().height) - projRect.GetHeight()); if (limit < 0.0f) { limit = 0.0f; } @@ -1627,8 +1568,7 @@ namespace ipl { if (!con->down(controller::BTN_DOWN)) { scale_down_darw(); } - } - else { + } else { if (mScroller.getBInst().isUp()) { scale_up_uarw(); } @@ -1651,19 +1591,16 @@ namespace ipl { if (recordType == RBRRecordType_PlayTimeLog) { btnAnim = Button::IDANIM_APPEAR_LEFT_BUTTON; - } - else { + } else { bool result = false; if (recordType == RBRRecordType_SWUpdate) { button->reserveText(Button::TEXT_RIGHT_BUTTON, MESG_BOARD_UPDATE); result = true; - } - else if (mbChanJump) { + } else if (mbChanJump) { button->reserveText(Button::TEXT_RIGHT_BUTTON, MESG_CMN_START); result = true; - } - else if (mpBoardObj->permit_reply()) { + } else if (mpBoardObj->permit_reply()) { button->reserveText(Button::TEXT_RIGHT_BUTTON, MESG_BOARD_REPLY); result = true; } @@ -1671,12 +1608,10 @@ namespace ipl { if (mpBoardObj->mOptOutFlag) { if (result) { btnAnim = Button::IDANIM_OPTOUT_IN_ALT; - } - else { + } else { btnAnim = Button::IDANIM_OPTOUT_IN; } - } - else { + } else { btnAnim = Button::IDANIM_APPEAR_LEFT_AND_TRASH_BUTTON; if (result) { btnAnim = Button::IDANIM_APPEAR_ALL_BUTTONS; @@ -1694,8 +1629,7 @@ namespace ipl { if (recordType == RBRRecordType_PlayTimeLog) { btnAnim = Button::IDANIM_DISAPPEAR_LEFT_BUTTON; - } - else { + } else { bool result = false; if (recordType == RBRRecordType_SWUpdate || mbChanJump || mpBoardObj->permit_reply()) { @@ -1705,12 +1639,10 @@ namespace ipl { if (mpBoardObj->mOptOutFlag) { if (result) { btnAnim = Button::IDANIM_OPTOUT_OUT_ALT; - } - else { + } else { btnAnim = Button::IDANIM_OPTOUT_OUT; } - } - else { + } else { btnAnim = Button::IDANIM_DISAPPEAR_LEFT_AND_TRASH_BUTTON; if (result) { btnAnim = Button::IDANIM_DISAPPEAR_ALL_BUTTONS; @@ -1893,7 +1825,7 @@ namespace ipl { // WC24 library check switch (checkErr) { case NWC24_ERR_NETWORK: { - set_err_msg(errStr, sizeof(errStr)/sizeof(wchar_t), MESG_ERROR_NWC24_NETWORK, errorCode); + set_err_msg(errStr, sizeof(errStr) / sizeof(wchar_t), MESG_ERROR_NWC24_NETWORK, errorCode); System::getDialog()->callBtn1(errStr, MESG_CMN_OK); mState = STATE_WAIT_MSG; @@ -1903,7 +1835,7 @@ namespace ipl { } case NWC24_ERR_FULL: case NWC24_ERR_SERVER: { - set_err_msg(errStr, sizeof(errStr)/sizeof(wchar_t), MESG_ERROR_NWC24_SERVER, errorCode); + set_err_msg(errStr, sizeof(errStr) / sizeof(wchar_t), MESG_ERROR_NWC24_SERVER, errorCode); System::getDialog()->callBtn1(errStr, MESG_CMN_OK); mState = STATE_WAIT_MSG; @@ -1918,7 +1850,7 @@ namespace ipl { } System::getNwc24Manager()->close(); -exit: + exit: return result; } @@ -1950,13 +1882,12 @@ exit: mCurrentResult = RESULT_SW_UPDATE; mPrevState = mState; mState = STATE_NET_WAIT_PARENTAL; - } - else { + } else { mFinalResult = RESULT_SW_UPDATE; mState = STATE_DONE; } -exit: + exit: return; } @@ -1967,7 +1898,7 @@ exit: wchar_t nwc24ErrStr[32]; memset(nwc24ErrStr, 0, sizeof(nwc24ErrStr)); - swprintf(nwc24ErrStr, sizeof(nwc24ErrStr)/sizeof(wchar_t), L"%06d\n", nwc24Err); + swprintf(nwc24ErrStr, sizeof(nwc24ErrStr) / sizeof(wchar_t), L"%06d\n", nwc24Err); wcsncat(outErrMsg, nwc24ErrStr, outErrMsgLen - wcslen(outErrMsg)); wcsncat(outErrMsg, System::getMessage(errMsgId), outErrMsgLen - wcslen(outErrMsg)); @@ -2066,8 +1997,7 @@ exit: break; } } - } - else if (Button::cmpButtonName(paneName, Button::BTN_TRASH_DELETE) == 0) { + } else if (Button::cmpButtonName(paneName, Button::BTN_TRASH_DELETE) == 0) { if (mpInstance->mState == focus_object::STATE_NORMAL) { button->animation(Button::IDANIM_SELECT_TRASH_BUTTON); @@ -2085,8 +2015,7 @@ exit: mpInstance->mState = focus_object::STATE_WAIT_BTN; mpInstance->mNextState = focus_object::STATE_DEL_WAIT_MSG; } - } - else if (Button::cmpButtonName(paneName, Button::BTN_CREATE_R_BUTTON) == 0) { + } else if (Button::cmpButtonName(paneName, Button::BTN_CREATE_R_BUTTON) == 0) { bool result = false; switch (mpInstance->mState) { @@ -2094,19 +2023,17 @@ exit: result = true; button->reserveAnm(Button::IDANIM_SELECT_CREATE_R); - + if (mpInstance->mpBoardObj->mRecordType == RBRRecordType_SWUpdate) { mpInstance->check_network_for_news(); - } - else { + } else { if (mpInstance->mbChanJump) { if (mpInstance->setup_chanjump()) { mpInstance->init_fadeout(false); mpInstance->mCurrentResult = focus_object::RESULT_CHJUMP; mpInstance->mState = focus_object::STATE_FADE_OUT; } - } - else { + } else { mpInstance->mNwc24ErrCountdown = 0; mpInstance->mPrevState = mpInstance->mState; mpInstance->mState = focus_object::STATE_LETTER_WAIT_NET; @@ -2163,5 +2090,5 @@ exit: } } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/board/iplUrlProcessor.cpp b/src/scene/board/iplUrlProcessor.cpp index bca2d191..864f03c5 100644 --- a/src/scene/board/iplUrlProcessor.cpp +++ b/src/scene/board/iplUrlProcessor.cpp @@ -9,8 +9,7 @@ namespace ipl { namespace scene { - UrlProcessor::UrlProcessor() : - nw4r::ut::WideTagProcessor() { + UrlProcessor::UrlProcessor() : nw4r::ut::WideTagProcessor() { nw4r::ut::List_Init(&mUrlCollisions, offsetof(url_collision, mLinkList)); init(); } @@ -44,8 +43,7 @@ namespace ipl { if (mConData[i].valid) { mConData[i].pos = con->getDpdProjectionPos(); - } - else { + } else { mConData[i].pos.x = 0.0f; mConData[i].pos.y = 0.0f; } @@ -68,11 +66,10 @@ namespace ipl { } nw4r::ut::Operation UrlProcessor::Process(u16 code, nw4r::ut::PrintContext* context) { - if (code == (u16)0x1A || code == (u16)'\n') { + if (code == (u16)0x1A || code == (u16)'\n') { if (unk_0x50 == 0) { make_collision(context, code); - } - else if (code == 0x1A) { + } else if (code == 0x1A) { parse(context); } } @@ -82,8 +79,8 @@ namespace ipl { void UrlProcessor::make_collision(nw4r::ut::PrintContext* context, u16 code) { if (code == 0x1A) { if (unk_0x51 == 0) { - url_collision* url_col = new(System::getMem2App(), 4) url_collision(); - line_collision* line_col = new(System::getMem2App(), 4) line_collision(); + url_collision* url_col = new (System::getMem2App(), 4) url_collision(); + line_collision* line_col = new (System::getMem2App(), 4) line_collision(); url_col->unk_0x00 = unk_0x48; url_col->unk_0x04 = (wchar_t*)context->str; @@ -93,8 +90,7 @@ namespace ipl { nw4r::ut::List_Append(&mUrlCollisions, url_col); unk_0x51 = 1; - } - else { + } else { url_collision* url_col = (url_collision*)nw4r::ut::List_GetPrev(&mUrlCollisions, NULL); line_collision* line_col = (line_collision*)nw4r::ut::List_GetPrev(&url_col->mLineCollisions, NULL); @@ -106,8 +102,7 @@ namespace ipl { unk_0x51 = 0; unk_0x48++; } - } - else { + } else { if (unk_0x51 != 0) { url_collision* url_col = (url_collision*)nw4r::ut::List_GetPrev(&mUrlCollisions, NULL); line_collision* line_col = (line_collision*)nw4r::ut::List_GetPrev(&url_col->mLineCollisions, NULL); @@ -115,7 +110,7 @@ namespace ipl { line_col->unk_0x04 = context->writer->GetCursorX(); line_col->unk_0x08 = context->writer->GetCursorY(); - line_col = new(System::getMem2App(), 4) line_collision(); + line_col = new (System::getMem2App(), 4) line_collision(); line_col->unk_0x00 = -208.0f; nw4r::ut::List_Append(&url_col->mLineCollisions, line_col); @@ -128,18 +123,15 @@ namespace ipl { if (unk_0x51 == 0) { if (unk_0x4C == unk_0x48) { context->writer->SetTextColor(0xFFE664FF); - } - else if (unk_0x53 != 0 && is_focused()) { + } else if (unk_0x53 != 0 && is_focused()) { context->writer->SetCursorY(curY - 2.0f); context->writer->SetTextColor(0xF06E28FF); unk_0x52 = 1; - } - else { + } else { context->writer->SetTextColor(0x34BEEDFF); } - unk_0x51 = 1; - } - else { + unk_0x51 = 1; + } else { if (unk_0x52 != 0) { context->writer->SetCursorY(2.0f + curY); unk_0x52 = 0; @@ -215,7 +207,7 @@ namespace ipl { void UrlProcessor::get_url(char* urlOut, u32 urlLen) { url_collision* url_col = get_selected_col(); if (url_col != NULL) { - wchar_t url[0x200+sizeof(wchar_t)]; + wchar_t url[0x200 + sizeof(wchar_t)]; memset(url, 0, sizeof(url)); int chIdx2 = 0; @@ -229,7 +221,7 @@ namespace ipl { } utility::CharacterCode::UTF16ToUTF8(urlOut, url, urlLen); - urlOut[urlLen-1] = 0; + urlOut[urlLen - 1] = 0; } } @@ -248,5 +240,5 @@ namespace ipl { delete col; } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/button/iplArrow.cpp b/src/scene/button/iplArrow.cpp index 9843f4ec..309cd547 100644 --- a/src/scene/button/iplArrow.cpp +++ b/src/scene/button/iplArrow.cpp @@ -6,14 +6,13 @@ namespace ipl { namespace scene { void Arrow::draw() { Button* button; - if (System::onDefaultDrawLayer() - && (button = static_cast(System::getScene(SCENE_BUTTON)), button != NULL)) { + if (System::onDefaultDrawLayer() && (button = static_cast(System::getScene(SCENE_BUTTON)), button != NULL)) { layout::Object::setDefaultCamera(); for (int i = 0; i < Button::ARROW_BTN_MAX; i++) { layout::Object* arrowLayout = button->get_layout(); nw4r::lyt::Pane* pane = arrowLayout->FindPaneByName(Button::mscArrowName[i]); - + pane->SetVisible(true); arrowLayout->draw(pane); pane->SetVisible(false); @@ -25,5 +24,5 @@ namespace ipl { } } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/button/iplButton.cpp b/src/scene/button/iplButton.cpp index b3896f8b..93a29102 100644 --- a/src/scene/button/iplButton.cpp +++ b/src/scene/button/iplButton.cpp @@ -12,6 +12,7 @@ namespace ipl { /* MAIN BUTTON */ /* =========== */ + // clang-format off static const Button::AnmFrame scAnmFrame[Button::IDANIM_MAX] = { /*IDANIM_FROM_CH_SEL_TO_BOARD*/ { /*start=*/1000.0f, /*end=*/1040.0f }, /*IDANIM_FROM_CH_SEL_TO_SETTING*/ { /*start=*/7000.0f, /*end=*/7040.0f }, @@ -178,15 +179,9 @@ namespace ipl { "ArwR", "ArwL" }; + // clang-format on - Button::Button(EGG::Heap* heap) - : Base(heap), - unk_0x54(0), - mOptOutBtn(), - mSdMenuBtn(), - unk_0x104(false), - unk_0x105(false), - mReservedCmd() { + Button::Button(EGG::Heap* heap) : Base(heap), unk_0x54(0), mOptOutBtn(), mSdMenuBtn(), unk_0x104(false), unk_0x105(false), mReservedCmd() { for (int i = 0; i < ARROW_BTN_MAX; i++) { mbArrowVisible[i] = true; } @@ -196,10 +191,11 @@ namespace ipl { mbEnabled = true; } - Button::~Button() {} - + Button::~Button() { + } + void Button::prepare() { - mpLayoutFile = System::getNandManager()->readLayoutAsync(getSceneHeap(), "cmnBtn.ash"); + mpLayoutFile = System::getNandManager()->readLayoutAsync(getSceneHeap(), "cmnBtn.ash"); mpBalloonFile = System::getNandManager()->readLayoutAsync(getSceneHeap(), "balloon.ash"); } @@ -213,18 +209,18 @@ namespace ipl { } // Bind button animatons - mpButtonAnim[ANIM_SCENE_CHANGE] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_SeenChange", false); - mpButtonAnim[ANIM_ARROW_R_AC] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_ArwR_Ac", false); - mpButtonAnim[ANIM_ARROW_L_AC] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_ArwL_Ac", false); - mpButtonAnim[ANIM_ARROW_R_HD_AC] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_ArwR_HDAc", false); - mpButtonAnim[ANIM_ARROW_L_HD_AC] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_ArwL_HDAc", false); - mpButtonAnim[ANIM_ARROW_R_END] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_ArwR_End", false); - mpButtonAnim[ANIM_ARROW_L_END] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_ArwL_End", false); - mpButtonAnim[ANIM_CALENDAR_EXIT] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_CalExit", false); - mpButtonAnim[ANIM_TRASH_DELETE] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_Dust", false); - mpButtonAnim[ANIM_COMMON_BUTTON] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_Cmn_R", false); - mpButtonAnim[ANIM_ARROW_LETTER_R] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_TabaR", false); - mpButtonAnim[ANIM_ARROW_LETTER_L] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_TabaL", false); + mpButtonAnim[ANIM_SCENE_CHANGE] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_SeenChange", false); + mpButtonAnim[ANIM_ARROW_R_AC] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_ArwR_Ac", false); + mpButtonAnim[ANIM_ARROW_L_AC] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_ArwL_Ac", false); + mpButtonAnim[ANIM_ARROW_R_HD_AC] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_ArwR_HDAc", false); + mpButtonAnim[ANIM_ARROW_L_HD_AC] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_ArwL_HDAc", false); + mpButtonAnim[ANIM_ARROW_R_END] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_ArwR_End", false); + mpButtonAnim[ANIM_ARROW_L_END] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_ArwL_End", false); + mpButtonAnim[ANIM_CALENDAR_EXIT] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_CalExit", false); + mpButtonAnim[ANIM_TRASH_DELETE] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_Dust", false); + mpButtonAnim[ANIM_COMMON_BUTTON] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_Cmn_R", false); + mpButtonAnim[ANIM_ARROW_LETTER_R] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_TabaR", false); + mpButtonAnim[ANIM_ARROW_LETTER_L] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_TabaL", false); // Bind "new messages" animation and setup its frame controller mpButtonAnim[ANIM_BOARD_BBS_NUM_LOOP] = mpLayout->bindToGroup("my_IplTop_e.brlan", "G_BbsSignal", false); @@ -262,7 +258,8 @@ namespace ipl { // Setup text balloons for (int i = 0; i < BALLOON_MAX; i++) { - mpBalloons[i] = new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f), 120.0f, 30.0f); + mpBalloons[i] = + new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f), 120.0f, 30.0f); mpBalloons[i]->init(System::getMessage(scBalloonMsg[i]), 0); mpBalloons[i]->init_textbox(); } @@ -277,15 +274,18 @@ namespace ipl { if (SCGetAspectRatio() == SC_ASPECT_RATIO_16x9) { nw4r::lyt::Size size; - size = nw4r::ut::DynamicCast(mpBalloons[BALLOON_BBS_BOARD]->get_layout()->FindPaneByName("T_Balloon"))->GetFontSize(); + size = nw4r::ut::DynamicCast(mpBalloons[BALLOON_BBS_BOARD]->get_layout()->FindPaneByName("T_Balloon")) + ->GetFontSize(); size.width += 0.75f; - nw4r::ut::DynamicCast(mpBalloons[BALLOON_BBS_BOARD]->get_layout()->FindPaneByName("T_Balloon"))->SetFontSize(size); + nw4r::ut::DynamicCast(mpBalloons[BALLOON_BBS_BOARD]->get_layout()->FindPaneByName("T_Balloon")) + ->SetFontSize(size); - size = nw4r::ut::DynamicCast(mpBalloons[BALLOON_CH_SEL]->get_layout()->FindPaneByName("T_Balloon"))->GetFontSize(); + size = + nw4r::ut::DynamicCast(mpBalloons[BALLOON_CH_SEL]->get_layout()->FindPaneByName("T_Balloon"))->GetFontSize(); size.width += 1.0f; nw4r::ut::DynamicCast(mpBalloons[BALLOON_CH_SEL]->get_layout()->FindPaneByName("T_Balloon"))->SetFontSize(size); } -#endif // KOREAN_BUILD +#endif // KOREAN_BUILD } void Button::calc() { @@ -295,8 +295,7 @@ namespace ipl { Command popped = mReservedCmd.get_popped_item(); if (popped.type == Command::TYPE_ANIM) { animation(popped.animId); - } - else { + } else { const char* pane = mscTextPaneName[popped.paneId]; setText(pane, System::getMessage(popped.msgId)); } @@ -306,11 +305,9 @@ namespace ipl { break; } case 1: { - if (!mpButtonAnim[ANIM_SCENE_CHANGE]->isPlaying() - && !mpButtonAnim[ANIM_CALENDAR_EXIT]->isPlaying() - && !mpButtonAnim[ANIM_COMMON_BUTTON]->isPlaying() - && !mpButtonAnim[ANIM_TRASH_DELETE]->isPlaying() - && !mOptOutBtn.mpLayout->isPlaying()) { + if (!mpButtonAnim[ANIM_SCENE_CHANGE]->isPlaying() && !mpButtonAnim[ANIM_CALENDAR_EXIT]->isPlaying() && + !mpButtonAnim[ANIM_COMMON_BUTTON]->isPlaying() && !mpButtonAnim[ANIM_TRASH_DELETE]->isPlaying() && + !mOptOutBtn.mpLayout->isPlaying()) { unk_0x54 = 0; } break; @@ -323,7 +320,7 @@ namespace ipl { // Calculate opt out button mOptOutBtn.calc(); - + // Calculate SD Menu Button (if we are not in maintenance mode) if (!System::isSafeMode()) { mSdMenuBtn.calc(); @@ -398,10 +395,10 @@ namespace ipl { void Button::startPointEvent(const char* paneName, controller::Interface* con) { int btnNo = getButtonNo(paneName); - if ((btnNo != BTN_BBS_BOARD || !System::isSafeMode()) && btnNo != -1 - && (mbEnabled || btnNo == BTN_ARROW_RIGHT || btnNo == BTN_ARROW_LEFT) - && (btnNo != BTN_ARROW_RIGHT || mbArrowVisible[ARROW_BTN_RIGHT] == true) - && (btnNo != BTN_ARROW_LEFT || mbArrowVisible[ARROW_BTN_LEFT] == true)) { + if ((btnNo != BTN_BBS_BOARD || !System::isSafeMode()) && btnNo != -1 && + (mbEnabled || btnNo == BTN_ARROW_RIGHT || btnNo == BTN_ARROW_LEFT) && + (btnNo != BTN_ARROW_RIGHT || mbArrowVisible[ARROW_BTN_RIGHT] == true) && + (btnNo != BTN_ARROW_LEFT || mbArrowVisible[ARROW_BTN_LEFT] == true)) { if (mbHovered[btnNo] == FALSE) { // Play hover in animation layout::Animator* anim = mpLayout->getAnim(btnNo); @@ -430,10 +427,10 @@ namespace ipl { void Button::startLeftEvent(const char* paneName) { int btnNo = getButtonNo(paneName); - if ((btnNo != BTN_BBS_BOARD || !System::isSafeMode()) && btnNo != -1 - && (mbEnabled | btnNo == BTN_ARROW_RIGHT /*TYPO!!*/ || btnNo == BTN_ARROW_LEFT) - && (btnNo != BTN_ARROW_RIGHT || mbArrowVisible[ARROW_BTN_RIGHT] == true) - && (btnNo != BTN_ARROW_LEFT || mbArrowVisible[ARROW_BTN_LEFT] == true)) { + if ((btnNo != BTN_BBS_BOARD || !System::isSafeMode()) && btnNo != -1 && + (mbEnabled | btnNo == BTN_ARROW_RIGHT /*TYPO!!*/ || btnNo == BTN_ARROW_LEFT) && + (btnNo != BTN_ARROW_RIGHT || mbArrowVisible[ARROW_BTN_RIGHT] == true) && + (btnNo != BTN_ARROW_LEFT || mbArrowVisible[ARROW_BTN_LEFT] == true)) { if (mbHovered[btnNo] == TRUE) { // Play hover out animation layout::Animator* anim = mpLayout->getAnim(btnNo); @@ -679,8 +676,7 @@ namespace ipl { anim = mpButtonAnim[ANIM_ARROW_R_END]; if (bAppear) { frame = scAnmFrame[IDANIM_ARROW_RIGHT_APPEAR].end; - } - else { + } else { frame = scAnmFrame[IDANIM_ARROW_RIGHT_DISAPPEAR].end; } break; @@ -690,8 +686,7 @@ namespace ipl { anim = mpButtonAnim[ANIM_ARROW_L_END]; if (bAppear) { frame = scAnmFrame[IDANIM_ARROW_LEFT_APPEAR].end; - } - else { + } else { frame = scAnmFrame[IDANIM_ARROW_LEFT_DISAPPEAR].end; } break; @@ -830,7 +825,7 @@ namespace ipl { command.animId = animId; mReservedCmd.push(command); } - + void Button::reserveText(int paneId, u32 msgId) { Command command; command.type = Command::TYPE_TEXT; @@ -843,20 +838,19 @@ namespace ipl { /* OPT OUT BUTTON */ /* ============== */ - OptOutButton::OptOutButton() : - mpLayout(NULL), mpGui(NULL), - mbHovered(FALSE) {} + OptOutButton::OptOutButton() : mpLayout(NULL), mpGui(NULL), mbHovered(FALSE) { + } void OptOutButton::create(nand::LayoutFile* layoutFile, EGG::Heap* heap) { // Setup layout mpLayout = new layout::Object(heap, layoutFile, "arc", "my_BtnStop_a.brlyt"); // Setup animations - mpLayout->bindToGroup("my_BtnStop_a_Btn_In.brlan", "G_SeenChange", false); - mpLayout->bindToGroup("my_BtnStop_a_Btn_Out.brlan", "G_SeenChange", false, false); - mpLayout->bindToGroup("my_BtnStop_a_Focus_In.brlan", "G_Stop", false, false); - mpLayout->bindToGroup("my_BtnStop_a_Focus_Out.brlan", "G_Stop", false, false); - mpLayout->bindToGroup("my_BtnStop_a_Select.brlan", "G_Stop", false, false); + mpLayout->bindToGroup("my_BtnStop_a_Btn_In.brlan", "G_SeenChange", false); + mpLayout->bindToGroup("my_BtnStop_a_Btn_Out.brlan", "G_SeenChange", false, false); + mpLayout->bindToGroup("my_BtnStop_a_Focus_In.brlan", "G_Stop", false, false); + mpLayout->bindToGroup("my_BtnStop_a_Focus_Out.brlan", "G_Stop", false, false); + mpLayout->bindToGroup("my_BtnStop_a_Select.brlan", "G_Stop", false, false); mpLayout->finishBinding(); // Setup interface @@ -944,7 +938,8 @@ namespace ipl { onEventDerived(compId, event, static_cast(data)); } - void ButtonEventHandlerBase::onEventDerived(u32 compId, u32 event, const controller::Interface* con) {} + void ButtonEventHandlerBase::onEventDerived(u32 compId, u32 event, const controller::Interface* con) { + } void OptOutButtonEventHandlerBase::onEvent(u32 compId, u32 event, void* data) { gui::PaneComponent* component = static_cast(mpManager->getComponent(compId)); @@ -966,6 +961,7 @@ namespace ipl { onEventDerived(compId, event, static_cast(data)); } - void OptOutButtonEventHandlerBase::onEventDerived(u32 compId, u32 event, const controller::Interface* con) {} - } -} + void OptOutButtonEventHandlerBase::onEventDerived(u32 compId, u32 event, const controller::Interface* con) { + } + } // namespace scene +} // namespace ipl diff --git a/src/scene/calendar/iplCalendar.cpp b/src/scene/calendar/iplCalendar.cpp index 339025ec..88557eaf 100644 --- a/src/scene/calendar/iplCalendar.cpp +++ b/src/scene/calendar/iplCalendar.cpp @@ -1,18 +1,19 @@ #include "scene/board/iplBoard.h" -#include "scene/calendar/iplCalendar.h" #include "scene/button/iplButton.h" +#include "scene/calendar/iplCalendar.h" -#include "iplSystem.h" #include "iplSound.h" +#include "iplSystem.h" namespace ipl { namespace scene { - #define DATE_COUNT 42 +#define DATE_COUNT 42 utility::Date Calendar::mscMinDate(MIN_YEAR, MIN_MONTH, MIN_DAY); utility::Date Calendar::mscMaxDate(MAX_YEAR, MAX_MONTH, MAX_DAY); + // clang-format off static const Calendar::AnmFrame scAnmFrame[Calendar::IDANIM_MAX] = { { 1000.0f, 1040.0f }, { 1040.0f, 1040.0f }, @@ -101,26 +102,17 @@ namespace ipl { "N_CalPos_b", "N_CalPos_c", }; + // clang-format on - Calendar::Calendar(EGG::Heap* heap) : - FaderSceneBase(heap), - ButtonEventHandlerBase(), - mState(STATE_NORMAL), - mPrevState(STATE_NORMAL), - mpLayout(NULL), - mpLayoutFile(NULL), - mpGroupAnim(NULL), - mpInitAnim(NULL), - mpBoardDate(NULL), - mpSelectDate(NULL), - mbScrolling(false), - unk_0xA0(FALSE), - mbTaskCanceled(FALSE), - mbBackToBoardAlt(FALSE) { + Calendar::Calendar(EGG::Heap* heap) + : FaderSceneBase(heap), ButtonEventHandlerBase(), mState(STATE_NORMAL), mPrevState(STATE_NORMAL), mpLayout(NULL), mpLayoutFile(NULL), + mpGroupAnim(NULL), mpInitAnim(NULL), mpBoardDate(NULL), mpSelectDate(NULL), mbScrolling(false), unk_0xA0(FALSE), mbTaskCanceled(FALSE), + mbBackToBoardAlt(FALSE) { nw4r::ut::List_Init(&mDateList, offsetof(Date, mNode1)); nw4r::ut::List_Init(&unk_0x90, offsetof(Date, mNode2)); - mbAsian = System::getRegion() == SC_PRODUCT_AREA_JPN || (u32)System::getRegion() == SC_PRODUCT_AREA_KOR || (u32)System::getRegion() == SC_PRODUCT_AREA_CHN; + mbAsian = System::getRegion() == SC_PRODUCT_AREA_JPN || (u32)System::getRegion() == SC_PRODUCT_AREA_KOR || + (u32)System::getRegion() == SC_PRODUCT_AREA_CHN; mbUSA = System::getRegion() == SC_PRODUCT_AREA_USA; } @@ -137,7 +129,7 @@ namespace ipl { mpLayout->calc(); mpLayout->finishBinding(); - for (int i = 0; i < (DATE_COUNT*2); i++) { + for (int i = 0; i < (DATE_COUNT * 2); i++) { Date* date = new Date(getSceneHeap(), mpLayoutFile, "arc", "my_IplTop_f.brlyt"); if (i < DATE_COUNT) { nw4r::ut::List_Append(&unk_0x90, date); @@ -240,8 +232,7 @@ namespace ipl { void Calendar::initCalcFadeout() { if (mbBackToBoardAlt == FALSE) { static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_BACK_TO_BOARD); - } - else { + } else { static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_BACK_TO_BOARD_ALT); } } @@ -256,11 +247,10 @@ namespace ipl { mpLayout->draw(); if (mState == STATE_SCROLL_RIGHT || mState == STATE_SCROLL_LEFT) { - for (int i = (DATE_COUNT*2)-1; i >= 0; i--) { + for (int i = (DATE_COUNT * 2) - 1; i >= 0; i--) { ((Date*)nw4r::ut::List_GetNth(&mDateList, i))->draw(false); } - } - else { + } else { for (u32 i = 0; i < DATE_COUNT; i++) { ((Date*)nw4r::ut::List_GetNth(&unk_0x90, i))->draw(false); } @@ -290,12 +280,10 @@ namespace ipl { mbBackToBoardAlt = FALSE; start_exit(); snd::getSystem()->startSE("WIPL_SE_CANCEL"); - } - else if (Button::cmpButtonName(paneName, Button::BTN_ARROW_RIGHT) == 0 && !is_upper_limit()) { + } else if (Button::cmpButtonName(paneName, Button::BTN_ARROW_RIGHT) == 0 && !is_upper_limit()) { static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_RIGHT_SELECT); start_scroll_r(); - } - else if (Button::cmpButtonName(paneName, Button::BTN_ARROW_LEFT) == 0 && !is_lower_limit()){ + } else if (Button::cmpButtonName(paneName, Button::BTN_ARROW_LEFT) == 0 && !is_lower_limit()) { static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_LEFT_SELECT); start_scroll_l(); } @@ -335,8 +323,7 @@ namespace ipl { controller::Interface* con = System::getMasterController(); if (con->down(controller::BTN_NEXT_LEFT) && !is_lower_limit()) { start_scroll_l(); - } - else if (con->down(controller::BTN_NEXT_RIGHT) && !is_upper_limit()) { + } else if (con->down(controller::BTN_NEXT_RIGHT) && !is_upper_limit()) { start_scroll_r(); } } @@ -422,8 +409,7 @@ namespace ipl { mbTaskCanceled = TRUE; mPrevState = STATE_SCROLL_RIGHT; mState = STATE_WAIT_TASK; - } - else { + } else { do_scroll_r(); } } @@ -437,9 +423,8 @@ namespace ipl { if (!is_upper_limit()) { if (is_lower_limit()) { static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_LEFT_APPEAR); - } - else { - if (mpBoardDate->year == mscMaxDate.year && mpBoardDate->month == mscMaxDate.month-1) { + } else { + if (mpBoardDate->year == mscMaxDate.year && mpBoardDate->month == mscMaxDate.month - 1) { static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_RIGHT_DISAPPEAR); } } @@ -466,8 +451,7 @@ namespace ipl { mbTaskCanceled = TRUE; mPrevState = STATE_SCROLL_LEFT; mState = STATE_WAIT_TASK; - } - else { + } else { do_scroll_l(); } } @@ -481,9 +465,8 @@ namespace ipl { if (!is_lower_limit()) { if (is_upper_limit()) { static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_RIGHT_APPEAR); - } - else { - if (mpBoardDate->year == mscMinDate.year && mpBoardDate->month == mscMinDate.month+1) { + } else { + if (mpBoardDate->year == mscMinDate.year && mpBoardDate->month == mscMinDate.month + 1) { static_cast(System::getScene(SCENE_BUTTON))->animation(Button::IDANIM_ARROW_LEFT_DISAPPEAR); } } @@ -504,12 +487,11 @@ namespace ipl { mState = STATE_DONE; if (unk_0xA0 == TRUE) { - OSReport("検索タスク終了要求\n"); // "Search task termination requested" + OSReport("検索タスク終了要求\n"); // "Search task termination requested" mbTaskCanceled = TRUE; mPrevState = mState; mState = STATE_WAIT_TASK; - } - else { + } else { do_exit(); } } @@ -556,25 +538,24 @@ namespace ipl { void Calendar::set_textbox_month(const char* paneName, const utility::Date& date) { wchar_t fullStr[32] = L""; - const wchar_t numbers[] = {'0','1','2','3','4','5','6','7','8','9'}; + const wchar_t numbers[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; int year = date.year; int i = 0; if (mbAsian) { fullStr[i++] = numbers[year / 1000]; - fullStr[i++]= numbers[(year / 100) % 10]; + fullStr[i++] = numbers[(year / 100) % 10]; fullStr[i++] = numbers[(year / 10) % 10]; fullStr[i++] = numbers[year % 10]; - const wchar_t* msg = System::getMessage(scMonthToMessageID[date.month-1]); + const wchar_t* msg = System::getMessage(scMonthToMessageID[date.month - 1]); wchar_t msgCh; do { msgCh = *msg++; fullStr[i++] = msgCh; } while (msgCh != 0); - } - else { - const wchar_t* msg = System::getMessage(scMonthToMessageID[date.month-1]); + } else { + const wchar_t* msg = System::getMessage(scMonthToMessageID[date.month - 1]); wchar_t msgCh; do { msgCh = *msg++; @@ -594,29 +575,28 @@ namespace ipl { } void Calendar::set_textbox_date(int unk, const utility::Date& date) { - s32 lang = System::getLanguage(); // unused + s32 lang = System::getLanguage(); // unused int week = utility::Calendar::getWeek(date.year, date.month, 1); int maxDays = utility::Calendar::getDays(date.year, date.month); OSCalendarTime curTime = System::getCurrentTime(); - utility::Date local_64(curTime.wday, curTime.year+1, curTime.mon); + utility::Date local_64(curTime.wday, curTime.year + 1, curTime.mon); utility::Date local_70; utility::Date local_7c; - utility::Calendar::getLastMonth(date,&local_70); - utility::Calendar::getNextMonth(date,&local_7c); + utility::Calendar::getLastMonth(date, &local_70); + utility::Calendar::getNextMonth(date, &local_7c); int iVar10; if (mbAsian || mbUSA) { iVar10 = 6 - utility::Calendar::getWeek(date.year, date.month, maxDays); - } - else { + } else { week--; if (week < 0) { week = 6; } - iVar10 = 6 - (utility::Calendar::getWeek(date.year, date.month, maxDays)-1); + iVar10 = 6 - (utility::Calendar::getWeek(date.year, date.month, maxDays) - 1); if (iVar10 >= 7) { iVar10 = 0; } @@ -669,13 +649,12 @@ namespace ipl { local_88.month = local_7c.month; local_88.day = ((i - maxDays) - week) + 1; goto out; - } - else { + } else { dateScn->setVisible(false); continue; } -out: + out: dateScn->setDate(local_88); dateScn->setAttribute(attr); } @@ -727,7 +706,7 @@ out: if (calendar != NULL) { for (u32 i = 0; i < DATE_COUNT; i++) { if (calendar->mbTaskCanceled == TRUE) { - OSReport("タスクキャンセルされた\n"); // Task canceled + OSReport("タスクキャンセルされた\n"); // Task canceled calendar->mbTaskCanceled = FALSE; break; } @@ -739,13 +718,13 @@ out: CDBDate end = dateScn->mpDate->cdbDateEnd(); cdb::Manager* cdbManager = System::getCdbManager(); - cdbManager->search(begin, end, - CDB_SEARCH_DIRECTION_RIGHT, cdbManager->isSDMounted() ? CDB_RECORD_LOCATION_ALL : CDB_RECORD_LOCATION_NAND, - 0, search_task_cb_, dateScn); + cdbManager->search(begin, end, CDB_SEARCH_DIRECTION_RIGHT, + cdbManager->isSDMounted() ? CDB_RECORD_LOCATION_ALL : CDB_RECORD_LOCATION_NAND, 0, search_task_cb_, + dateScn); } } - OSReport("タスク終了\n"); // Task end + OSReport("タスク終了\n"); // Task end calendar->unk_0xA0 = FALSE; calendar->mbTaskCanceled = FALSE; @@ -753,7 +732,7 @@ out: } void Calendar::exec_search_task() { - OSReport("検索開始\n"); // Start search + OSReport("検索開始\n"); // Start search unk_0xA0 = TRUE; System::getTask1()->requestJam(search_task_, this, NULL); } @@ -765,5 +744,5 @@ out: BOOL Calendar::is_lower_limit() { return mpBoardDate->year == mscMinDate.year && mpBoardDate->month == mscMinDate.month; } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/calendar/iplDate.cpp b/src/scene/calendar/iplDate.cpp index 0d5f3014..a4c669ac 100644 --- a/src/scene/calendar/iplDate.cpp +++ b/src/scene/calendar/iplDate.cpp @@ -1,12 +1,13 @@ #include "iplSceneUI.h" -#include "scene/calendar/iplDate.h" #include "scene/calendar/iplCalendar.h" +#include "scene/calendar/iplDate.h" #include "iplSystem.h" namespace ipl { namespace scene { + // clang-format off const char* Date::mscAnimPanes[Date::ANIM_PANE_MAX] = { "N_CalDay_r", "W_Cal", @@ -29,22 +30,17 @@ namespace ipl { { Date::ANIM_PANE_MSG, 1.0f, 1.0f }, { Date::ANIM_PANE_MSG, 0.0f, 0.0f }, }; + // clang-format on - utility::Date Date::mscMinDate(MIN_YEAR, MIN_MONTH, MIN_DAY); - utility::Date Date::mscMaxDate(MAX_YEAR, MAX_MONTH, MAX_DAY); + utility::Date Date::mscMinDate(MIN_YEAR, MIN_MONTH, MIN_DAY); + utility::Date Date::mscMaxDate(MAX_YEAR, MAX_MONTH, MAX_DAY); - u8 padding[0x10]; + u8 padding[0x10]; DECOMP_FORCE_ACTIVE(iplDate_cpp, padding); - Date::Date(EGG::Heap* heap, nand::LayoutFile* file, const char* layoutFolder, const char* layoutFileName) : - ::gui::EventHandler(), - mbAppearMsg(0), - unk_0x10(0), - unk_0x14(0), - mpLayout(NULL), - mpCurrentPaneAnim(0), - unk_0x3C(0) { + Date::Date(EGG::Heap* heap, nand::LayoutFile* file, const char* layoutFolder, const char* layoutFileName) + : ::gui::EventHandler(), mbAppearMsg(0), unk_0x10(0), unk_0x14(0), mpLayout(NULL), mpCurrentPaneAnim(0), unk_0x3C(0) { // Layout mpLayout = new layout::Object(heap, file, layoutFolder, layoutFileName); @@ -53,7 +49,7 @@ namespace ipl { mpPaneAnims[i] = mpLayout->bind("my_IplTop_f.brlan", mscAnimPanes[i], false); } mpLayout->finishBinding(); - + // Setup GUI mpGui = new gui::PaneManager(this, mpLayout->getDrawInfo(), NULL, NULL); mpGui->setupScene(mpLayout); @@ -75,7 +71,7 @@ namespace ipl { mpLayout->calc(); mpGui->calc(); - if (mpCurrentPaneAnim != NULL && !mpCurrentPaneAnim->isPlaying()) { + if (mpCurrentPaneAnim != NULL && !mpCurrentPaneAnim->isPlaying()) { mpCurrentPaneAnim = NULL; onCmdRecv(3); } @@ -88,8 +84,7 @@ namespace ipl { if (unk_0x3C != 0) { mpLayout->draw(); } - } - else { + } else { if (unk_0x3C == 0) { mpLayout->draw(); } @@ -125,28 +120,23 @@ namespace ipl { if ((attr & 2) == 2) { if ((attr & 8) == 8) { doAnim(IDANIM_BLUE_TEXT); - } - else if ((attr & 4) == 4) { + } else if ((attr & 4) == 4) { doAnim(IDANIM_RED_TEXT); - } - else { + } else { doAnim(IDANIM_RESET_GREY_TEXT); } if ((attr & 1) == 1) { doAnim(IDANIM_LOOP); - } - else { + } else { doAnim(IDANIM_RESET_GREY_BUTTON); } - } - else { + } else { doAnim(IDANIM_GREY_TEXT); doAnim(IDANIM_GREY_BUTTON); } if (mbAppearMsg) { doAnim(IDANIM_APPEAR_MSG); - } - else { + } else { doAnim(IDANIM_NO_MSG); } return; @@ -156,7 +146,7 @@ namespace ipl { *mpDate = date; set_textbox(mpDate->day); } - + void Date::update() { mpGui->update(); } @@ -217,7 +207,7 @@ namespace ipl { } } - static const wchar_t scNumber[] = {'0','1','2','3','4','5','6','7','8','9'}; + static const wchar_t scNumber[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; bool Date::isValidDate(const utility::Date& date) { return date.year >= mscMinDate.year && date.year <= mscMaxDate.year; @@ -231,22 +221,20 @@ namespace ipl { wchar_t ch; if (day >= 10) { ch = scNumber[day / 10]; - } - else { + } else { ch = scNumber[day % 10]; } numStr[index++] = ch; if (day >= 10) { ch = scNumber[day % 10]; - } - else { + } else { ch = 0; } numStr[index++] = ch; numStr[index++] = 0; - + nw4r::lyt::TextBox* pane = nw4r::ut::DynamicCast(mpLayout->FindPaneByName(mscAnimPanes[2])); pane->SetString(numStr); } @@ -261,8 +249,7 @@ namespace ipl { if (cmd == 1) { mpCurrentPaneAnim = doAnim(IDANIM_FOCUS_IN); unk_0x10 = 1; - } - else if (cmd == 2) { + } else if (cmd == 2) { mpCurrentPaneAnim = doAnim(IDANIM_FOCUS_OUT); unk_0x10 = 2; } @@ -295,5 +282,5 @@ namespace ipl { unk_0x3C = 0; onCmdRecv(3); } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/channelEdit/iplChanAppEdit.cpp b/src/scene/channelEdit/iplChanAppEdit.cpp index aa23c86e..79c11196 100644 --- a/src/scene/channelEdit/iplChanAppEdit.cpp +++ b/src/scene/channelEdit/iplChanAppEdit.cpp @@ -18,4 +18,4 @@ namespace ipl { ((intp*)0)->get(); ((intp*)0)->get(); } -} +} // namespace ipl diff --git a/src/scene/channelSelect/iplChannelObj.cpp b/src/scene/channelSelect/iplChannelObj.cpp index de6258cb..30ce8dc6 100644 --- a/src/scene/channelSelect/iplChannelObj.cpp +++ b/src/scene/channelSelect/iplChannelObj.cpp @@ -6,6 +6,7 @@ namespace ipl { namespace scene { + // clang-format off static const char* scPaneAnims[] = { "Cursur_a", "T_Balloon", @@ -150,47 +151,15 @@ namespace ipl { 85.0f, 48.0f } }; + // clang-format on - ChannelObj::ChannelObj(EGG::Heap* heap, int page, int index) : - unk_0x10(heap), - unk_0x08(NULL), - unk_0x0C(NULL), - mpDiskHeap(NULL), - unk_0x18(0), - mChanPage(page), - mChanIndex(index), - mpBasePane(NULL), - mpDiskLyt(NULL), - mpDiskAnim(NULL), - unk_0x40(NULL), - unk_0x44(NULL), - unk_0x48(NULL), - unk_0x58(0), - unk_0x5C(0), - unk_0x60(NULL), - unk_0x68(0), - unk_0x6C(0), - unk_0x70(0), - unk_0x74(0), - unk_0x78(NULL), - unk_0x7C(0), - unk_0x80(0), - unk_0x84(0), - unk_0x88(0), - unk_0x8C(cfChanThumbOfss[SCGetAspectRatio()][0]), - unk_0x90(cfChanThumbOfss[SCGetAspectRatio()][1]), - mpModuleHeap(NULL), - unk_0x9C(NULL), - unk_0xA0(NULL), - unk_0xE4(0), - unk_0xE8(NULL), - unk_0xEC(0), - unk_0xF4(0), - unk_0xF8(36000), - unk_0xFC(36000), - unk_0x100(NULL), - unk_0x104(NULL), - unk_0x110(NULL) { + ChannelObj::ChannelObj(EGG::Heap* heap, int page, int index) + : unk_0x10(heap), unk_0x08(NULL), unk_0x0C(NULL), mpDiskHeap(NULL), unk_0x18(0), mChanPage(page), mChanIndex(index), mpBasePane(NULL), + mpDiskLyt(NULL), mpDiskAnim(NULL), unk_0x40(NULL), unk_0x44(NULL), unk_0x48(NULL), unk_0x58(0), unk_0x5C(0), unk_0x60(NULL), + unk_0x68(0), unk_0x6C(0), unk_0x70(0), unk_0x74(0), unk_0x78(NULL), unk_0x7C(0), unk_0x80(0), unk_0x84(0), unk_0x88(0), + unk_0x8C(cfChanThumbOfss[SCGetAspectRatio()][0]), unk_0x90(cfChanThumbOfss[SCGetAspectRatio()][1]), mpModuleHeap(NULL), unk_0x9C(NULL), + unk_0xA0(NULL), unk_0xE4(0), unk_0xE8(NULL), unk_0xEC(0), unk_0xF4(0), unk_0xF8(36000), unk_0xFC(36000), unk_0x100(NULL), + unk_0x104(NULL), unk_0x110(NULL) { if (SCGetAspectRatio() == SC_ASPECT_RATIO_16x9) { nw4r::ut::Rect projRect4x3; System::getProjectionRect4x3(&projRect4x3); @@ -198,8 +167,7 @@ namespace ipl { System::getProjectionRect16x9(&projRect16x9); mLocationAdjust = projRect16x9.GetWidth() / projRect4x3.GetWidth(); - } - else { + } else { mLocationAdjust = 1.0f; } @@ -213,8 +181,7 @@ namespace ipl { if (isDiskChannel()) { destroyDiskLayout(); - } - else { + } else { unk_0x30->destroyHeap(); } @@ -315,14 +282,12 @@ namespace ipl { if (unk_0xF0 == NULL) { unk_0xF0 = System::getChannelManager()->loadThumbnailCSAsync(mpModuleHeap, mChanPage, mChanIndex); unk_0xEC = 4; - } - else { + } else { unk_0xEC = 2; } result = 2; - } - else { + } else { result = 1; } } @@ -339,7 +304,7 @@ namespace ipl { unk_0x104 = NULL; if (unk_0x100->bssSize != 0) { - unk_0x104 = new(mpModuleHeap, DEFAULT_ALIGN) u8[unk_0x100->bssSize]; + unk_0x104 = new (mpModuleHeap, DEFAULT_ALIGN) u8[unk_0x100->bssSize]; memset(unk_0x104, 0, unk_0x100->bssSize); } @@ -347,8 +312,7 @@ namespace ipl { if (RSOIsImportSymbolResolvedAll(unk_0x100)) { OSReport("Module's ImportSymbol is resolved all.\n"); - } - else { + } else { OSReport("%d module's ImportSymbols are not resolved.\n", RSOGetNumImportSymbolsUnresolved(unk_0x100)); } @@ -358,7 +322,7 @@ namespace ipl { // ThreadCalc() unk_0xE8->setCalcFunc((channel::ThreadCalcFunc)RSOFindExportSymbolAddr(unk_0x100, "ThreadCalc")); - ((void(*)())unk_0x100->prolog)(); + ((void (*)())unk_0x100->prolog)(); // Create(nw4r::lyt::Layout*) channel::CreateFunc createFunc = (channel::CreateFunc)RSOFindExportSymbolAddr(unk_0x100, "Create"); @@ -390,7 +354,7 @@ namespace ipl { if (unk_0x10D && unk_0x10C) { unk_0xE4 = 1; - ((void(*)())unk_0x100->epilog)(); + ((void (*)())unk_0x100->epilog)(); RSOUnLinkList(unk_0x100); @@ -401,11 +365,10 @@ namespace ipl { clearModuleParam(); result = 3; - } - else { + } else { result = 2; } - + break; } case 4: { @@ -439,11 +402,10 @@ namespace ipl { System::getCSManager()->setData(data); if (!System::getCSManager()->init(unk_0xF0, unk_0xE8)) { unk_0xEC = 6; - } - else { + } else { unk_0xEC = 5; } - + delete unk_0xF0; unk_0xF0 = NULL; } @@ -499,11 +461,9 @@ namespace ipl { if (unk_0x40->searchFile("icon.brlan")) { unk_0x44 = unk_0x40->bind("icon.brlan"); - } - else if (unk_0x40->searchFile("icon_Whole.brlan")) { + } else if (unk_0x40->searchFile("icon_Whole.brlan")) { unk_0x44 = unk_0x40->bind("icon_Whole.brlan"); - } - else { + } else { unk_0x44 = NULL; } @@ -539,8 +499,7 @@ namespace ipl { if (isDiskChannel()) { if (unk_0x40 != NULL) { setBalloonText((wchar_t*)System::getChannelManager()->getTitleName(mChanPage, mChanIndex, 0)); - } - else { + } else { setBalloonText(System::getMessage(0)); } } @@ -553,8 +512,7 @@ namespace ipl { BOOL ChannelObj::isDiskChannel() const { if (isValid() && System::getChannelManager()->getSceneID(mChanPage, mChanIndex) == channel::SCENE_ID_DISK_CHANNEL) { return TRUE; - } - else { + } else { return FALSE; } } @@ -566,11 +524,9 @@ namespace ipl { void ChannelObj::onPoint(int unk) { if (unk & 0x10000U) { unk_0x74 = 0; - } - else if (unk & 0x20000U) { + } else if (unk & 0x20000U) { unk_0x74 = 1; - } - else if ((unk_0x74 += 1) > 1) { + } else if ((unk_0x74 += 1) > 1) { return; } @@ -585,11 +541,9 @@ namespace ipl { void ChannelObj::onLeft(int unk) { if (unk & 0x10000U) { unk_0x74 = 0; - } - else if (unk & 0x20000U) { + } else if (unk & 0x20000U) { unk_0x74 = 1; - } - else if ((unk_0x74 -= 1) > 0) { + } else if ((unk_0x74 -= 1) > 0) { return; } @@ -605,8 +559,7 @@ namespace ipl { if (unk) { setCursorAnim(1); unk_0x74 = 1; - } - else { + } else { setCursorAnim(0); unk_0x74 = 0; } @@ -646,8 +599,7 @@ namespace ipl { for (nw4r::lyt::GroupList::Iterator it = layout->GetGroupList().GetBeginIter(); it != layout->GetGroupList().GetEndIter(); it++) { if (strcmp(it->GetName(), langGroup) == 0) { bVar4 = true; - } - else { + } else { bool bVar3 = true; for (int i = 0; i < 16; i++) { char name[6]; @@ -660,7 +612,8 @@ namespace ipl { if (bVar3) { nw4r::lyt::Group* group = layout->FindGroupByName(langGroup); - for (nw4r::lyt::PaneLinkList::Iterator it2 = group->GetPaneList().GetBeginIter(); it2 != group->GetPaneList().GetEndIter(); it2++) { + for (nw4r::lyt::PaneLinkList::Iterator it2 = group->GetPaneList().GetBeginIter(); it2 != group->GetPaneList().GetEndIter(); + it2++) { it2->mTarget->SetVisible(false); } @@ -680,8 +633,7 @@ namespace ipl { for (nw4r::lyt::PaneLinkList::Iterator it = group->GetPaneList().GetBeginIter(); it != group->GetPaneList().GetEndIter(); it++) { it->mTarget->SetVisible(true); } - } - else { + } else { s32 region = System::getRegion(); for (int i = 0; i < 16; i++) { char* groupName = (char*)lbl_8164E328[region][i]; @@ -689,7 +641,8 @@ namespace ipl { if (groupName != NULL) { if (strcmp(groupName, &local_50[scLangLookup[region][i]]) == 0) { nw4r::lyt::Group* group = layout->FindGroupByName(groupName); - for (nw4r::lyt::PaneLinkList::Iterator it = group->GetPaneList().GetBeginIter(); it != group->GetPaneList().GetEndIter(); it++) { + for (nw4r::lyt::PaneLinkList::Iterator it = group->GetPaneList().GetBeginIter(); it != group->GetPaneList().GetEndIter(); + it++) { it->mTarget->SetVisible(true); } } @@ -742,18 +695,15 @@ namespace ipl { if (isValid()) { if (System::getChannelManager()->getSceneID(mChanPage, mChanIndex) == channel::SCENE_ID_DISK_CHANNEL) { frame = 0.0f; - } - else { + } else { if (unk_0x2C->checkData() == nand::RESULT_SUCCESS) { frame = createWadThumbnail(); - } - else { + } else { frame = createWrongThumbnail(); bVar1 = true; } } - } - else { + } else { frame = createEmptyThumbnail(); bVar1 = true; } @@ -785,29 +735,23 @@ namespace ipl { if (rsoIdx != 0) { if (unk_0x30->searchFile("icon_Start.brlan")) { unk_0x34 = unk_0x30->bind("icon_Start.brlan"); - } - else { + } else { unk_0x34 = NULL; } - } - else { + } else { if (csIdx != 0) { if (unk_0x30->searchFile("icon_Start.brlan")) { unk_0x34 = unk_0x30->bind("icon_Start.brlan"); - } - else { + } else { unk_0x34 = NULL; } - } - else { + } else { if (unk_0x30->searchFile("icon.brlan")) { unk_0x34 = unk_0x30->bind("icon_.brlan"); - } - else { + } else { if (unk_0x30->searchFile("icon_Whole.brlan")) { unk_0x34 = unk_0x30->bind("icon_Whole.brlan"); - } - else { + } else { unk_0x34 = NULL; } } @@ -817,8 +761,7 @@ namespace ipl { if (unk_0x34 != NULL) { if (rsoIdx != 0 || csIdx != 0) { frame = unk_0x34->getMinFrame(); - } - else { + } else { frame = unk_0x34->getMinFrame() + (System::getRndm()->get_u16() % (u16)(unk_0x34->getMaxFrame() - unk_0x34->getMinFrame())); } } @@ -858,8 +801,7 @@ namespace ipl { if (unk_0x40 != NULL) { unk_0x30 = unk_0x40; unk_0x34 = unk_0x44; - } - else { + } else { unk_0x30 = mpDiskLyt; unk_0x34 = mpDiskAnim; } @@ -883,7 +825,7 @@ namespace ipl { } void ChannelObj::initCursor() { - unk_0x48 = new(unk_0x08, 4) layout::Object(unk_0x08, unk_0x24, "arc", "my_IplTop_d.brlyt"); + unk_0x48 = new (unk_0x08, 4) layout::Object(unk_0x08, unk_0x24, "arc", "my_IplTop_d.brlyt"); for (int i = 0; i < 3; i++) { unk_0x4C[i] = unk_0x48->bind(scCursorAnims[i], scPaneAnims[0], false); @@ -910,14 +852,12 @@ namespace ipl { unk_0x48->getAnim(1)->initAnmFrame(); unk_0x48->GetRootPane()->SetVisible(false); - } - else if (unk == 4) { + } else if (unk == 4) { unk_0x58 = 4; unk_0x5C = 0; unk_0x48->GetRootPane()->SetVisible(true); startCursorAnim(2); - } - else { + } else { switch (unk_0x58) { case 0: { if (unk == 1) { @@ -930,11 +870,9 @@ namespace ipl { case 1: { if (unk == 2) { unk_0x58 = 2; - } - else if (unk == 3) { + } else if (unk == 3) { unk_0x5C = 3; - } - else if (unk == 1) { + } else if (unk == 1) { unk_0x5C = 0; } break; @@ -949,8 +887,7 @@ namespace ipl { case 3: { if (unk == 1) { unk_0x5C = 1; - } - else if (unk == 3) { + } else if (unk == 3) { unk_0x5C = 0; } break; @@ -960,47 +897,46 @@ namespace ipl { } void ChannelObj::calcCursorAnim() { - } /*void ChannelObj::startCursorAnim(int unk) { - + } void ChannelObj::initBalloon() { - + } void ChannelObj::setBalloonText(const wchar_t* text) { - + } void ChannelObj::calcBalloon(const nw4r::math::VEC3& vec) { - + } void ChannelObj::setBalloonAnim(int unk) { - + } void ChannelObj::calcBalloonAnim(int unk) { - + } void ChannelObj::clearModuleParam() { - + } void ChannelObj::bindNewAnm(layout::Object* layout) { - + } void ChannelObj::updateNew() { - + } void ChannelObj::setupNew() { - + }*/ - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/channelSelect/iplClock.cpp b/src/scene/channelSelect/iplClock.cpp index d72db500..bd8c3e1c 100644 --- a/src/scene/channelSelect/iplClock.cpp +++ b/src/scene/channelSelect/iplClock.cpp @@ -7,6 +7,7 @@ namespace ipl { namespace scene { bool clock::m_already_shown_wii_menu = false; + // clang-format off static const char* s_time_num[] = { "Num0", "Num1", @@ -19,30 +20,31 @@ namespace ipl { "Num8", "Num9", }; + // clang-format on - clock::clock() : - mpLayout(NULL) {} + clock::clock() : mpLayout(NULL) { + } void clock::init(EGG::Heap* heap, nand::LayoutFile* layoutFile) { // Init layout - mpLayout = new(heap, 4) layout::Object(heap, layoutFile, "arc", "my_Clock_a.brlyt"); - + mpLayout = new (heap, 4) layout::Object(heap, layoutFile, "arc", "my_Clock_a.brlyt"); + // Bind animations - mpLayout->bind("my_Clock_a_Change.brlan", "T_WiiMenu", false); - mpLayout->bind("my_Clock_a_Change.brlan", "N_Clock", false); - mpLayout->bind("my_Clock_a_Min.brlan", "ClockTen", false); - mpLayout->bind("my_Clock_a_NumApear.brlan", "Clock0", false, false); - mpLayout->bind("my_Clock_a_NumApear.brlan", "Clock1", false, false); - mpLayout->bind("my_Clock_a_NumApear.brlan", "Clock2", false, false); - mpLayout->bind("my_Clock_a_NumApear.brlan", "Clock3", false, false); - mpLayout->bind("my_Clock_a_NumApear.brlan", "AM_PM", false, false); - mpLayout->bind("my_Clock_a_NumApear.brlan", "AM_PM_R", false, false); - mpLayout->bind("my_Clock_a_NumLost.brlan", "Clock0", false); - mpLayout->bind("my_Clock_a_NumLost.brlan", "Clock1", false); - mpLayout->bind("my_Clock_a_NumLost.brlan", "Clock2", false); - mpLayout->bind("my_Clock_a_NumLost.brlan", "Clock3", false); - mpLayout->bind("my_Clock_a_NumLost.brlan", "AM_PM", false); - mpLayout->bind("my_Clock_a_NumLost.brlan", "AM_PM_R", false); + mpLayout->bind("my_Clock_a_Change.brlan", "T_WiiMenu", false); + mpLayout->bind("my_Clock_a_Change.brlan", "N_Clock", false); + mpLayout->bind("my_Clock_a_Min.brlan", "ClockTen", false); + mpLayout->bind("my_Clock_a_NumApear.brlan", "Clock0", false, false); + mpLayout->bind("my_Clock_a_NumApear.brlan", "Clock1", false, false); + mpLayout->bind("my_Clock_a_NumApear.brlan", "Clock2", false, false); + mpLayout->bind("my_Clock_a_NumApear.brlan", "Clock3", false, false); + mpLayout->bind("my_Clock_a_NumApear.brlan", "AM_PM", false, false); + mpLayout->bind("my_Clock_a_NumApear.brlan", "AM_PM_R", false, false); + mpLayout->bind("my_Clock_a_NumLost.brlan", "Clock0", false); + mpLayout->bind("my_Clock_a_NumLost.brlan", "Clock1", false); + mpLayout->bind("my_Clock_a_NumLost.brlan", "Clock2", false); + mpLayout->bind("my_Clock_a_NumLost.brlan", "Clock3", false); + mpLayout->bind("my_Clock_a_NumLost.brlan", "AM_PM", false); + mpLayout->bind("my_Clock_a_NumLost.brlan", "AM_PM_R", false); mpLayout->finishBinding(); // Configure clock layout @@ -80,8 +82,7 @@ namespace ipl { mpLayout->getAnim(ANIM_CLOCK_CHANGE)->init(); mState = STATE_NORMAL; - } - else { + } else { m_already_shown_wii_menu = true; mWiiMenuTimer.set_msec(WII_MENU_APPEAR_FOR); @@ -118,7 +119,7 @@ namespace ipl { wiiMenuPane->SetTranslate(nw4r::math::VEC2(mtx.m[0][3], mtx.m[1][3])); wiiMenuPane->CalculateMtx(*mpLayout->getDrawInfo()); - + mpLayout->draw(wiiMenuPane); } @@ -186,12 +187,7 @@ namespace ipl { }; const char* clockTexNames[CLOCK_TEXTURE_MAX] = { - "Clock0", - "Clock1", - "Clock2", - "Clock3", - "AM_PM", - "AM_PM_R", + "Clock0", "Clock1", "Clock2", "Clock3", "AM_PM", "AM_PM_R", }; bool isPM = mCurrentTex.isPM; @@ -264,5 +260,5 @@ namespace ipl { } return ret; } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/channelTitle/iplChannelTitle.cpp b/src/scene/channelTitle/iplChannelTitle.cpp index d6e58509..ae47be46 100644 --- a/src/scene/channelTitle/iplChannelTitle.cpp +++ b/src/scene/channelTitle/iplChannelTitle.cpp @@ -18,4 +18,4 @@ namespace ipl { ((intp*)0)->get(); ((intp*)0)->get(); } -} +} // namespace ipl diff --git a/src/scene/faceSelect/iplFaceSelect.cpp b/src/scene/faceSelect/iplFaceSelect.cpp index 9b9fe9b5..96f8387d 100644 --- a/src/scene/faceSelect/iplFaceSelect.cpp +++ b/src/scene/faceSelect/iplFaceSelect.cpp @@ -6,8 +6,8 @@ #include "system/iplNigaoeManager.h" -#include "iplSystem.h" #include "iplSound.h" +#include "iplSystem.h" #include @@ -15,16 +15,17 @@ #include -#define NO_MII_ICON "NigaoeD_00" +#define NO_MII_ICON "NigaoeD_00" -#define LOADED_MIIS (mCurrentPage * MAX_FACE_EACH_PAGE) -#define CAN_SCROLL_LEFT ((mCurrentPage > 0)) -#define CAN_SCROLL_RIGHT ((mCurrentPage + 1) * MAX_FACE_EACH_PAGE < mFaceCount) +#define LOADED_MIIS (mCurrentPage * MAX_FACE_EACH_PAGE) +#define CAN_SCROLL_LEFT ((mCurrentPage > 0)) +#define CAN_SCROLL_RIGHT ((mCurrentPage + 1) * MAX_FACE_EACH_PAGE < mFaceCount) -#define NIGAOE_ICON_SIZE 76 +#define NIGAOE_ICON_SIZE 76 namespace ipl { namespace scene { + // clang-format off const char* FaceSelect::mscButtonName[BTN_MAX] = { "B_NigaoeSel0", "B_NigaoeSel1", @@ -78,26 +79,16 @@ namespace ipl { "NigaoeSel8_02", "NigaoeSel9_02", }; + // clang-format on - FaceSelect::FaceSelect(EGG::Heap* heap, int fadeType) : - FaderSceneBase(heap), - mpLayout(NULL), - mpEvent(NULL), - mpGui(NULL), - mpButtonEvent(NULL), - mState(STATE_NORMAL), - mPrevState(STATE_NORMAL), - mCurrentPage(0), - mFaceCount(0), - mSelectedFaceId(-1), - mCachedPage(0), - mbLeftArrowExit(false), - mbRightArrowExit(false), - mFadeType(fadeType) { + FaceSelect::FaceSelect(EGG::Heap* heap, int fadeType) + : FaderSceneBase(heap), mpLayout(NULL), mpEvent(NULL), mpGui(NULL), mpButtonEvent(NULL), mState(STATE_NORMAL), mPrevState(STATE_NORMAL), + mCurrentPage(0), mFaceCount(0), mSelectedFaceId(-1), mCachedPage(0), mbLeftArrowExit(false), mbRightArrowExit(false), + mFadeType(fadeType) { for (int i = 0; i < BTN_MAX; i++) { mbHovered[i] = FALSE; } - + for (int i = 0; i < RFL_MAX_DATABASE; i++) { mFaceIds[i] = -1; } @@ -116,50 +107,50 @@ namespace ipl { mpLayout = new layout::Object(getSceneHeap(), mpLayoutFile, "arc", "my_selectNigaoe_a.brlyt"); // Bind all of the animations - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeIn.brlan", "G_All", false, mFadeType == FADE_FROM_MEMO); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeOut.brlan", "G_All", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeIn_a.brlan", "G_All", false, mFadeType == FADE_FROM_ADDRESS_EDIT); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeOut_a.brlan", "G_All",false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeIn_b.brlan", "G_All", false, mFadeType == FADE_FROM_ADDRESS_ADD); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeOut_b.brlan", "G_All", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus0", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus1", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus2", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus3", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus4", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus5", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus6", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus7", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus8", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus9", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus0", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus1", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus2", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus3", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus4", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus5", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus6", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus7", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus8", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus9", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_MoveArwR1.brlan", "G_NigaoeAll", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_MoveArwL1.brlan", "G_NigaoeAll", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_FocusOn.brlan", "G_ArwL_Focus", false); - mpLayout->bindToGroup("my_selectNigaoe_a_FocusOff.brlan", "G_ArwL_Focus", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_Select.brlan", "G_ArwL_Ac", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_HDActionStart.brlan", "G_ArwL_HDAc", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_HDActionRepeat.brlan", "G_ArwL_HDAc", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_Appear.brlan", "G_ArwL_End", false); - mpLayout->bindToGroup("my_selectNigaoe_a_Lost.brlan", "G_ArwL_End", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_FocusOn.brlan", "G_ArwR_Focus", false); - mpLayout->bindToGroup("my_selectNigaoe_a_FocusOff.brlan", "G_ArwR_Focus", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_Select.brlan", "G_ArwR_Ac", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_HDActionStart.brlan", "G_ArwR_HDAc", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_HDActionRepeat.brlan", "G_ArwR_HDAc", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_Appear.brlan", "G_ArwR_End", false); - mpLayout->bindToGroup("my_selectNigaoe_a_Lost.brlan", "G_ArwR_End", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_Loop.brlan", "G_ArwRoop", false, false); - mpLayout->bindToGroup("my_selectNigaoe_a_PageSwitch.brlan", "G_Page", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeIn.brlan", "G_All", false, mFadeType == FADE_FROM_MEMO); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeOut.brlan", "G_All", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeIn_a.brlan", "G_All", false, mFadeType == FADE_FROM_ADDRESS_EDIT); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeOut_a.brlan", "G_All", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeIn_b.brlan", "G_All", false, mFadeType == FADE_FROM_ADDRESS_ADD); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeOut_b.brlan", "G_All", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus0", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus1", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus2", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus3", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus4", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus5", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus6", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus7", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus8", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusIn.brlan", "G_Foucus9", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus0", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus1", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus2", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus3", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus4", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus5", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus6", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus7", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus8", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_NigaoeFoucusOut.brlan", "G_Foucus9", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_MoveArwR1.brlan", "G_NigaoeAll", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_MoveArwL1.brlan", "G_NigaoeAll", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_FocusOn.brlan", "G_ArwL_Focus", false); + mpLayout->bindToGroup("my_selectNigaoe_a_FocusOff.brlan", "G_ArwL_Focus", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_Select.brlan", "G_ArwL_Ac", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_HDActionStart.brlan", "G_ArwL_HDAc", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_HDActionRepeat.brlan", "G_ArwL_HDAc", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_Appear.brlan", "G_ArwL_End", false); + mpLayout->bindToGroup("my_selectNigaoe_a_Lost.brlan", "G_ArwL_End", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_FocusOn.brlan", "G_ArwR_Focus", false); + mpLayout->bindToGroup("my_selectNigaoe_a_FocusOff.brlan", "G_ArwR_Focus", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_Select.brlan", "G_ArwR_Ac", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_HDActionStart.brlan", "G_ArwR_HDAc", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_HDActionRepeat.brlan", "G_ArwR_HDAc", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_Appear.brlan", "G_ArwR_End", false); + mpLayout->bindToGroup("my_selectNigaoe_a_Lost.brlan", "G_ArwR_End", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_Loop.brlan", "G_ArwRoop", false, false); + mpLayout->bindToGroup("my_selectNigaoe_a_PageSwitch.brlan", "G_Page", false, false); // Done binding animations mpLayout->finishBinding(); @@ -210,7 +201,8 @@ namespace ipl { f32 unk4 = 30.0f; f32 unk3 = 120.0f; for (int i = 0; i < MAX_BALLOONS; i++) { - mpBalloons[i] = new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f), unk3, unk4); + mpBalloons[i] = + new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f), unk3, unk4); } } @@ -221,8 +213,7 @@ namespace ipl { bool result = true; for (int i = 0; i < MAX_FACE_EACH_PAGE; i++) { // If face was created - result &= !mpFaces[mCachedPage][i].creating - || mpFaces[mCachedPage][i].created ? true : false; + result &= !mpFaces[mCachedPage][i].creating || mpFaces[mCachedPage][i].created ? true : false; } if (result) { mbPreparing = false; @@ -233,15 +224,13 @@ namespace ipl { mpLayout->getAnim(mFadeAnimIndex + ANIM_FADE_IN)->play(); mpLayout->getAnim(ANIM_APPEARING)->play(); } - } - else { + } else { command = !mpLayout->getAnim(mFadeAnimIndex + ANIM_FADE_IN)->isPlaying() ? FADER_SCN_NEXT : FADER_SCN_CONTINUE; } return command; } - void FaceSelect::initCalcNormal() { static_cast(System::getScene(SCENE_BUTTON))->setEventHandler(mpButtonEvent); @@ -316,7 +305,7 @@ namespace ipl { if (System::onDefaultDrawLayer()) { u32 scLeft, scTop; u32 scWidth, scHeight; - + utility::Graphics::setOrtho(); GXGetScissor(&scLeft, &scTop, &scWidth, &scHeight); @@ -382,8 +371,7 @@ namespace ipl { start_lloaded(); change_state(STATE_LEFT_LOAD); } - } - else { + } else { // Scroll right when pressing Minus or R trigger if (con->downTrg(controller::BTN_NEXT_RIGHT) && CAN_SCROLL_RIGHT) { start_rloaded(); @@ -409,8 +397,7 @@ namespace ipl { bool result = true; for (int i = 0; i < MAX_FACE_EACH_PAGE; i++) { // If face was created - result &= !mpFaces[mCachedPage][i].creating - || mpFaces[mCachedPage][i].created ? true : false; + result &= !mpFaces[mCachedPage][i].creating || mpFaces[mCachedPage][i].created ? true : false; } // Scroll to the left! @@ -425,8 +412,7 @@ namespace ipl { bool result = true; for (int i = 0; i < MAX_FACE_EACH_PAGE; i++) { // If face was created - result &= !mpFaces[mCachedPage][i].creating - || mpFaces[mCachedPage][i].created ? true : false; + result &= !mpFaces[mCachedPage][i].creating || mpFaces[mCachedPage][i].created ? true : false; } // Scroll to the right! @@ -559,7 +545,7 @@ namespace ipl { nw4r::lyt::Pane* paneObj = mpLayout->FindPaneByName(paneName); math::VEC3 balloonPos(0.0f, 0.0f, 0.0f); MTXMultVec(paneObj->GetGlobalMtx(), balloonPos, balloonPos); - + // UUGHHH f32 y = 50.0f; balloonPos.y += y; @@ -627,16 +613,14 @@ namespace ipl { mpLayout->getAnim(ANIM_RIGHT_ARROW_SELECT)->play(); start_rloaded(); change_state(STATE_RIGHT_LOAD); - } - else { + } else { if (is_exist(btnNo)) { // Button scene animation Button* button = static_cast(System::getScene(SCENE_BUTTON)); button->animation(Button::IDANIM_DISAPPEAR_LEFT_BUTTON); if (mFadeType == FADE_FROM_ADDRESS_EDIT) { button->reserveAnm(Button::IDANIM_APPEAR_LEFT_BUTTON); - } - else { + } else { button->reserveAnm(Button::IDANIM_APPEAR_LEFT_AND_RIGHT_BUTTON); } @@ -690,7 +674,7 @@ namespace ipl { } void FaceSelect::set_page() { - const wchar_t numbers[] = {'0','1','2','3','4','5','6','7','8','9'}; + const wchar_t numbers[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; wchar_t numStr[3] = L""; @@ -734,8 +718,7 @@ namespace ipl { // Set mii face pane->SetVisible(true); material->SetTexture(GX_TEXMAP0, mpFaces[mCachedPage][i].object->getIconTexture()); - } - else { + } else { // Set "no mii" icon GXTexObj texObj; pane->SetVisible(false); @@ -747,8 +730,7 @@ namespace ipl { if (object != NULL) { // Setup balloon text mpBalloons[i]->init(object->getName(), RFL_NAME_LENGTH); - } - else { + } else { mpBalloons[i]->terminate(); } } @@ -785,10 +767,9 @@ namespace ipl { mpFaces[mCachedPage][i].creating = true; mpFaces[mCachedPage][i].created = false; // Create! - System::getMiiManager()->create(System::getMem2App(), NIGAOE_ICON_SIZE, NIGAOE_ICON_SIZE, mFaceIds[index], - nigaoe_make_icon_cb_, (void*)&mpFaces[mCachedPage][i]); - } - else { + System::getMiiManager()->create(System::getMem2App(), NIGAOE_ICON_SIZE, NIGAOE_ICON_SIZE, mFaceIds[index], nigaoe_make_icon_cb_, + (void*)&mpFaces[mCachedPage][i]); + } else { mpFaces[mCachedPage][i].creating = false; } } @@ -842,8 +823,7 @@ namespace ipl { button->reserveAnm(Button::IDANIM_DISAPPEAR_LEFT_BUTTON); if (mpInstance->mFadeType == FaceSelect::FADE_FROM_ADDRESS_EDIT) { button->reserveAnm(Button::IDANIM_APPEAR_LEFT_BUTTON); - } - else { + } else { button->reserveAnm(Button::IDANIM_APPEAR_LEFT_AND_RIGHT_BUTTON); } @@ -861,5 +841,5 @@ namespace ipl { } } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/health/iplHealth.cpp b/src/scene/health/iplHealth.cpp index 8d7094db..d7615f69 100644 --- a/src/scene/health/iplHealth.cpp +++ b/src/scene/health/iplHealth.cpp @@ -38,17 +38,18 @@ namespace ipl { return false; } - - #define HAS_SEC2MS(x) (x * 1000) - - #define HAS_TIMER_FADE_IN HAS_SEC2MS(1) /* Seconds after fading in */ - #define HAS_TIMER_PRESS_A HAS_SEC2MS(2) /* Seconds until the user can pass through the screen */ - #define HAS_TIMER_NOT_PRESS_A HAS_SEC2MS(60) /* Seconds for the user to do something to pass through the screen */ - - #define HAS_TIMER_SAFE_MODE HAS_SEC2MS(3) /* Seconds the user has to hold the safe mode combo on for */ - #define HAS_PRESS_A_BUTTON (controller::BTN_INTERACT | controller::BTN_BACK) /* Buttons the user can press to goto the main menu */ +#define HAS_SEC2MS(x) (x * 1000) +#define HAS_TIMER_FADE_IN HAS_SEC2MS(1) /* Seconds after fading in */ +#define HAS_TIMER_PRESS_A HAS_SEC2MS(2) /* Seconds until the user can pass through the screen */ +#define HAS_TIMER_NOT_PRESS_A HAS_SEC2MS(60) /* Seconds for the user to do something to pass through the screen */ + +#define HAS_TIMER_SAFE_MODE HAS_SEC2MS(3) /* Seconds the user has to hold the safe mode combo on for */ + +#define HAS_PRESS_A_BUTTON (controller::BTN_INTERACT | controller::BTN_BACK) /* Buttons the user can press to goto the main menu */ + + // clang-format off enum { LANG_JPN = 0, LANG_US_ENG, @@ -95,22 +96,16 @@ namespace ipl { "Push_KOR", "Push_CHN" }; + // clang-format on - skHealth::skHealth(EGG::Heap *heap) : - FaderSceneBase(heap), - mpHasPane(NULL), - mpPushPane(NULL), - mWaitTick(0), - mPushTick(0), - mbFadedIn(false), - mWpadMask(0), - mSafeModeTick(0), - mbHeldCombo(false), - mbDoneSafeMode(false) { - setSceneParentFlags(SCN_PARENTFLAG_DRAW); // (ignored as child scenes aren't created over this scene) + skHealth::skHealth(EGG::Heap* heap) + : FaderSceneBase(heap), mpHasPane(NULL), mpPushPane(NULL), mWaitTick(0), mPushTick(0), mbFadedIn(false), mWpadMask(0), mSafeModeTick(0), + mbHeldCombo(false), mbDoneSafeMode(false) { + setSceneParentFlags(SCN_PARENTFLAG_DRAW); // (ignored as child scenes aren't created over this scene) } - skHealth::~skHealth() {} + skHealth::~skHealth() { + } void skHealth::prepare() { mpLayoutFile = System::getNandManager()->readLayoutAsync(System::getMem2App(), "health.ash", true); @@ -201,8 +196,8 @@ namespace ipl { // Make all of the panes invisible for (int i = 0; i < ARRAY_LENGTH(has_pane_name); i++) { - pHasPane = mpLayout->FindPaneByName(has_pane_name[i]); - pPushPane = mpLayout->FindPaneByName(push_pane_name[i]); + pHasPane = mpLayout->FindPaneByName(has_pane_name[i]); + pPushPane = mpLayout->FindPaneByName(push_pane_name[i]); pHasPane->SetVisible(false); pPushPane->SetVisible(false); @@ -210,18 +205,18 @@ namespace ipl { // Make the necessary panes visible u32 country = getCountryIndex_(); - mpHasPane = mpLayout->FindPaneByName(has_pane_name[country]); - mpPushPane = mpLayout->FindPaneByName(push_pane_name[country]); + mpHasPane = mpLayout->FindPaneByName(has_pane_name[country]); + mpPushPane = mpLayout->FindPaneByName(push_pane_name[country]); mpHasPane->SetVisible(true); // Bind the animations - mpLayout->bindToGroup("it_Has_a_SeenIn.brlan", "G_All"); - mpLayout->bindToGroup("it_Has_a_Push.brlan", "G_Push"); + mpLayout->bindToGroup("it_Has_a_SeenIn.brlan", "G_All"); + mpLayout->bindToGroup("it_Has_a_Push.brlan", "G_Push"); mpLayout->bindToGroup("it_Has_a_SeenOut.brlan", "G_All"); mpLayout->setAnmType(ANIM_TYPE_FORWARD, ANIM_FADE_IN); - mpLayout->setAnmType(ANIM_TYPE_LOOP, ANIM_WAIT_PUSH); + mpLayout->setAnmType(ANIM_TYPE_LOOP, ANIM_WAIT_PUSH); mpLayout->setAnmType(ANIM_TYPE_FORWARD, ANIM_FADE_OUT); mpLayout->finishBinding(); @@ -267,8 +262,8 @@ namespace ipl { } FaderSceneCommand skHealth::calcNormal() { - FaderSceneCommand result = FADER_SCN_CONTINUE; - u32 newWpadMask = utility::wpad::getWpadConnectedMask(); + FaderSceneCommand result = FADER_SCN_CONTINUE; + u32 newWpadMask = utility::wpad::getWpadConnectedMask(); check_safe_mode(); @@ -279,12 +274,11 @@ namespace ipl { if (finish_safe_mode_check()) { // Either user pressed A (or B), connected controller, went to safe more OR was on the screen for 60 seconds? We fade out. - if (System::getMasterController()->downTrg(HAS_PRESS_A_BUTTON) || mWpadMask != newWpadMask - || OSTicksToMilliseconds(OSDiffTick(OSGetTick(), mPushTick)) > HAS_TIMER_NOT_PRESS_A || mbDoneSafeMode) { + if (System::getMasterController()->downTrg(HAS_PRESS_A_BUTTON) || mWpadMask != newWpadMask || + OSTicksToMilliseconds(OSDiffTick(OSGetTick(), mPushTick)) > HAS_TIMER_NOT_PRESS_A || mbDoneSafeMode) { if (mWpadMask != newWpadMask && !utility::wpad::isIncreaseConnectedWpad(mWpadMask, newWpadMask)) { mWpadMask = newWpadMask; - } - else { + } else { snd::getSystem()->startSE("WIPL_SE_BT_PUSH"); mpLayout->start(ANIM_FADE_OUT); @@ -316,14 +310,14 @@ namespace ipl { System::getPointer()->setVisible(true); System::getResetHandler()->enableResetToMenu(); - for (int i = 0; i < 1; i++) { // :question: + for (int i = 0; i < 1; i++) { // :question: reserveAllSceneDestruction(SCENE_BOARD, NULL); } return FADER_SCN_NEXT; } } - + return FADER_SCN_CONTINUE; } @@ -337,20 +331,18 @@ namespace ipl { void skHealth::check_safe_mode() { // If the user is holding the combo? if (!mbHeldCombo) { - if (System::getMasterController()->down(controller::REVO_BTN_PLUS) - && System::getMasterController()->down(controller::REVO_BTN_MINUS)) { + if (System::getMasterController()->down(controller::REVO_BTN_PLUS) && + System::getMasterController()->down(controller::REVO_BTN_MINUS)) { mSafeModeTick = OSGetTick(); mbHeldCombo = true; } - } - else { + } else { // Have they let go of the combo? Restart the timer - if (!System::getMasterController()->down(controller::REVO_BTN_PLUS) - || !System::getMasterController()->down(controller::REVO_BTN_MINUS)) { + if (!System::getMasterController()->down(controller::REVO_BTN_PLUS) || + !System::getMasterController()->down(controller::REVO_BTN_MINUS)) { mSafeModeTick = 0; mbHeldCombo = false; - } - else { + } else { // Have they been holding the combo after the timer? Welcome to safe mode! if (OSTicksToMilliseconds(OSDiffTick(OSGetTick(), mSafeModeTick)) > HAS_TIMER_SAFE_MODE) { mbDoneSafeMode = true; @@ -363,12 +355,13 @@ namespace ipl { BOOL skHealth::finish_safe_mode_check() const { BOOL result = FALSE; - if (!(System::getMasterController()->down(controller::REVO_BTN_PLUS) - || System::getMasterController()->down(controller::REVO_BTN_MINUS)) || mbDoneSafeMode) { + if (!(System::getMasterController()->down(controller::REVO_BTN_PLUS) || + System::getMasterController()->down(controller::REVO_BTN_MINUS)) || + mbDoneSafeMode) { result = TRUE; } return result; } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/letterWriter/iplLetterWriter.cpp b/src/scene/letterWriter/iplLetterWriter.cpp index 1acd6973..aca1acbd 100644 --- a/src/scene/letterWriter/iplLetterWriter.cpp +++ b/src/scene/letterWriter/iplLetterWriter.cpp @@ -1,10 +1,11 @@ #include "iplSceneUI.h" -#include "scene/letterWriter/iplLetterWriter.h" -#include "scene/button/iplButton.h" -#include "scene/mailAddSel/iplMailAddressSelect.h" #include "scene/address/iplAddress.h" #include "scene/board/iplBoard.h" +#include "scene/button/iplButton.h" +#include "scene/letterWriter/iplLetterWriter.h" +#include "scene/mailAddSel/iplMailAddressSelect.h" + #include #include @@ -14,20 +15,13 @@ namespace ipl { namespace scene { - LetterWriter::LetterWriter(EGG::Heap* heap, int type) : - TextWriter(heap), - mbToFriend(false), - mLetterState(LETTER_STATE_NORMAL), - mLetterType((textinput::extend::letter::InputForm::Type)type), - mpTextSubjectWork(NULL), - mpCaptionString(NULL), - mpCaptionAllocator(NULL), - mNwc24ErrCountdown2(0) { - setSceneParentFlags(SCN_PARENTFLAG_DRAW | SCN_PARENTFLAG_CALC); // already set by TextWriter base + LetterWriter::LetterWriter(EGG::Heap* heap, int type) + : TextWriter(heap), mbToFriend(false), mLetterState(LETTER_STATE_NORMAL), mLetterType((textinput::extend::letter::InputForm::Type)type), + mpTextSubjectWork(NULL), mpCaptionString(NULL), mpCaptionAllocator(NULL), mNwc24ErrCountdown2(0) { + setSceneParentFlags(SCN_PARENTFLAG_DRAW | SCN_PARENTFLAG_CALC); // already set by TextWriter base } LetterWriter::~LetterWriter() { - } void LetterWriter::destroy() { @@ -90,8 +84,9 @@ namespace ipl { // Text balloon for Mii face // What the fuck is up with these two floats - mpNigaoeBalloon = new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f), 120.0f, 30.0f); - + mpNigaoeBalloon = + new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f), 120.0f, 30.0f); + // Scroller mpScroller = new utility::YoungBScroller(); @@ -109,8 +104,7 @@ namespace ipl { case textinput::extend::letter::InputForm::T_MailAddressSel: { if (mLetterType == textinput::extend::letter::InputForm::T_Picture) { createChildScene(SCENE_ADDRESS, this, NULL, (void*)2); - } - else { + } else { createChildScene(SCENE_ADDRESS, this, NULL, (void*)1); } @@ -141,8 +135,7 @@ namespace ipl { mLetterState = LETTER_STATE_SEND; TextWriter::initCalcNormal(); - } - else { + } else { Address* address = static_cast(System::getScene(SCENE_ADDRESS)); memcpy(&mFriendInfo, &address->getFriendCache()->getInfo(address->getChosenFriendIndex()), sizeof(NWC24FriendInfo)); @@ -227,8 +220,7 @@ namespace ipl { if (getBoard()->isOptOut()) { button->reserveAnm(Button::IDANIM_OPTOUT_IN_ALT); - } - else { + } else { button->reserveAnm(Button::IDANIM_APPEAR_ALL_BUTTONS); } @@ -260,8 +252,7 @@ namespace ipl { if (!mbToFriend) { System::getKeyboard()->deactivate(); mState = STATE_DONE; - } - else { + } else { caption = makeHeaderCaption((const wchar_t*)mFriendInfo.attr.name); getLetterInputForm()->setHeaderCaption(caption); } @@ -330,8 +321,7 @@ namespace ipl { button->reserveText(Button::TEXT_RIGHT_BUTTON, MESG_BOARD_REPLY); if (getBoard()->isOptOut()) { button->reserveAnm(Button::IDANIM_OPTOUT_IN_ALT); - } - else { + } else { button->reserveAnm(Button::IDANIM_APPEAR_ALL_BUTTONS); } break; @@ -360,8 +350,7 @@ namespace ipl { System::getKeyboard()->sendRelease(); mState = STATE_DONE; - } - else if (Button::cmpButtonName(paneName, Button::BTN_CREATE_R_BUTTON) == 0) { + } else if (Button::cmpButtonName(paneName, Button::BTN_CREATE_R_BUTTON) == 0) { button->animation(Button::IDANIM_SELECT_CREATE_R); button->setEventHandler(NULL); @@ -369,8 +358,7 @@ namespace ipl { if (mLetterType != textinput::extend::letter::InputForm::T_Address) { openNWC24(); - } - else { + } else { onSend(); } } @@ -400,15 +388,13 @@ namespace ipl { NWC24UserId myUserId; if (mbToFriend) { myUserId = mFriendInfo.addr.wiiId; - } - else { + } else { getMyUserID(&myUserId); } if (sendMessageByNWC24(myUserId, mWCString) != 0) { - OSReport("送信失敗\n"); // "Send failure" - } - else { + OSReport("送信失敗\n"); // "Send failure" + } else { PlayTimeLog::sendMsgLog((wchar_t*)mFriendInfo.attr.name); getBoard()->reopen_log(); } @@ -435,8 +421,7 @@ namespace ipl { button->reserveText(Button::TEXT_RIGHT_BUTTON, MESG_BOARD_REPLY); if (getBoard()->isOptOut()) { button->reserveAnm(Button::IDANIM_OPTOUT_IN_ALT); - } - else { + } else { button->reserveAnm(Button::IDANIM_APPEAR_ALL_BUTTONS); } break; @@ -472,8 +457,7 @@ namespace ipl { int LetterWriter::sendMessageByNWC24(NWC24UserId userId, const wchar_t* wcString) { if (mbToFriend && mFriendInfo.attr.type == NWC24_FRIENDTYPE_EMAIL) { return sendToPC(userId, wcString); - } - else { + } else { return sendToWii(userId, wcString); } } @@ -497,17 +481,18 @@ namespace ipl { // Set letter contents if (*wcString != 0) { - if (!System::getNwc24Manager()->setMsgText(&msgObj, (char*)wcString, wcslen(wcString) * sizeof(wchar_t), NWC24_UTF_16BE, NWC24_ENC_BASE64)) { + if (!System::getNwc24Manager()->setMsgText(&msgObj, (char*)wcString, wcslen(wcString) * sizeof(wchar_t), NWC24_UTF_16BE, + NWC24_ENC_BASE64)) { OSReport("NWC24SetMsgText err\n"); return SEND_ERR_NWC24; } - } - else { + } else { wchar_t blank[2]; blank[0] = L' '; blank[1] = 0; - if (!System::getNwc24Manager()->setMsgText(&msgObj, (char*)blank, wcslen(blank) * sizeof(wchar_t), NWC24_UTF_16BE, NWC24_ENC_BASE64)) { + if (!System::getNwc24Manager()->setMsgText(&msgObj, (char*)blank, wcslen(blank) * sizeof(wchar_t), NWC24_UTF_16BE, + NWC24_ENC_BASE64)) { OSReport("NWC24SetMsgText err\n"); return SEND_ERR_NWC24; } @@ -528,7 +513,7 @@ namespace ipl { OSReport("NWC24SetMsgMBNoReply err\n"); return SEND_ERR_NWC24; } - + if (!System::getNwc24Manager()->setLedPattern(&msgObj)) { OSReport("setMsgCommand err\n"); return SEND_ERR_NWC24; @@ -572,7 +557,8 @@ namespace ipl { // Set letter contents const wchar_t* subject = System::getMessage(MESG_LETTERWRITER_EMAIL_SUBJECT); - if (!System::getNwc24Manager()->setMsgSubjectAndTextPublic(&msgObj, (u16*)subject, wcslen(subject), (u16*)wcString, wcslen(wcString), mpTextSubjectWork, mTextSubjectWorkSize)) { + if (!System::getNwc24Manager()->setMsgSubjectAndTextPublic(&msgObj, (u16*)subject, wcslen(subject), (u16*)wcString, wcslen(wcString), + mpTextSubjectWork, mTextSubjectWorkSize)) { OSReport("setMsgSubjectAndTextPublic err\n"); return SEND_ERR_NWC24; } @@ -601,5 +587,5 @@ namespace ipl { Board* LetterWriter::getBoard() { return static_cast(System::getScene(SCENE_BOARD)); } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/limitOver/iplLimitOver.cpp b/src/scene/limitOver/iplLimitOver.cpp index b5c5f9dc..6b97faeb 100644 --- a/src/scene/limitOver/iplLimitOver.cpp +++ b/src/scene/limitOver/iplLimitOver.cpp @@ -13,14 +13,15 @@ namespace ipl { namespace scene { - #define LIMIT_SEC2MS(x) (x * 1000) - - #define LIMIT_TIMER_FADE_IN LIMIT_SEC2MS(1) /* Seconds after fading in */ - #define LIMIT_TIMER_PRESS_A LIMIT_SEC2MS(2) /* Seconds until the user can pass through the screen */ - #define LIMIT_TIMER_NOT_PRESS_A LIMIT_SEC2MS(60) /* Seconds for the user to do something to pass through the screen */ +#define LIMIT_SEC2MS(x) (x * 1000) - #define LIMIT_PRESS_A_BUTTON (controller::BTN_INTERACT | controller::BTN_BACK) /* Buttons the user can press to goto the main menu */ +#define LIMIT_TIMER_FADE_IN LIMIT_SEC2MS(1) /* Seconds after fading in */ +#define LIMIT_TIMER_PRESS_A LIMIT_SEC2MS(2) /* Seconds until the user can pass through the screen */ +#define LIMIT_TIMER_NOT_PRESS_A LIMIT_SEC2MS(60) /* Seconds for the user to do something to pass through the screen */ +#define LIMIT_PRESS_A_BUTTON (controller::BTN_INTERACT | controller::BTN_BACK) /* Buttons the user can press to goto the main menu */ + + // clang-format off enum { LANG_JPN = 0, LANG_US_ENG, @@ -84,21 +85,18 @@ namespace ipl { "Push_KR_KOR", "Push_CN_CHN", }; + // clang-format on - LimitOver::LimitOver(EGG::Heap* heap) : - FaderSceneBase(heap), - mpTextPane(NULL), - mpPushPane(NULL), - mWaitTick(0), - mPushTick(0), - mbFadedIn(false), - mbDoneInit(false), - mWpadMask(0) {} + LimitOver::LimitOver(EGG::Heap* heap) + : FaderSceneBase(heap), mpTextPane(NULL), mpPushPane(NULL), mWaitTick(0), mPushTick(0), mbFadedIn(false), mbDoneInit(false), + mWpadMask(0) { + } - LimitOver::~LimitOver() {} + LimitOver::~LimitOver() { + } void LimitOver::prepare() { - mpLayoutFile = System::getNandManager()->readLayoutAsync(getSceneHeap(),"limitOver.ash", true); + mpLayoutFile = System::getNandManager()->readLayoutAsync(getSceneHeap(), "limitOver.ash", true); ES_SetUid(SYSMENU_TITLE_ID); utility::ESMisc::DeleteExpiredFlagFile(); @@ -212,12 +210,12 @@ namespace ipl { mpTextPane->SetVisible(true); // Bind the animations - mpLayout->bindToGroup("my_Timer_c_Fade_In.brlan", "G_All"); + mpLayout->bindToGroup("my_Timer_c_Fade_In.brlan", "G_All"); mpLayout->bindToGroup("my_Timer_c_Push_blink.brlan", "G_Push"); - mpLayout->bindToGroup("my_Timer_c_Fade_Out.brlan", "G_All"); + mpLayout->bindToGroup("my_Timer_c_Fade_Out.brlan", "G_All"); mpLayout->setAnmType(ANIM_TYPE_FORWARD, ANIM_FADE_IN); - mpLayout->setAnmType(ANIM_TYPE_LOOP, ANIM_WAIT_PUSH); + mpLayout->setAnmType(ANIM_TYPE_LOOP, ANIM_WAIT_PUSH); mpLayout->setAnmType(ANIM_TYPE_FORWARD, ANIM_FADE_OUT); mpLayout->finishBinding(); @@ -271,8 +269,8 @@ namespace ipl { } FaderSceneCommand LimitOver::calcNormal() { - FaderSceneCommand result = FADER_SCN_CONTINUE; - u32 newWpadMask = utility::wpad::getWpadConnectedMask(); + FaderSceneCommand result = FADER_SCN_CONTINUE; + u32 newWpadMask = utility::wpad::getWpadConnectedMask(); // Finished waiting?? The user can finally pass through the screen if (OSTicksToMilliseconds(OSDiffTick(OSGetTick(), mPushTick)) < LIMIT_TIMER_PRESS_A) { @@ -280,12 +278,11 @@ namespace ipl { } // Either user pressed A (or B), connected controller OR was on the screen for 60 seconds? We fade out. - if (System::getMasterController()->downTrg(LIMIT_PRESS_A_BUTTON) || mWpadMask != newWpadMask - || OSTicksToMilliseconds(OSDiffTick(OSGetTick(), mPushTick)) > LIMIT_TIMER_NOT_PRESS_A) { + if (System::getMasterController()->downTrg(LIMIT_PRESS_A_BUTTON) || mWpadMask != newWpadMask || + OSTicksToMilliseconds(OSDiffTick(OSGetTick(), mPushTick)) > LIMIT_TIMER_NOT_PRESS_A) { if (mWpadMask != newWpadMask && !utility::wpad::isIncreaseConnectedWpad(mWpadMask, newWpadMask)) { mWpadMask = newWpadMask; - } - else { + } else { snd::getSystem()->startSE("WIPL_SE_BT_PUSH"); mpLayout->start(ANIM_FADE_OUT); @@ -323,5 +320,5 @@ namespace ipl { mpLayout->draw(); } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/mailAddSel/iplMailAddressSelect.cpp b/src/scene/mailAddSel/iplMailAddressSelect.cpp index cda35f54..bd7f3491 100644 --- a/src/scene/mailAddSel/iplMailAddressSelect.cpp +++ b/src/scene/mailAddSel/iplMailAddressSelect.cpp @@ -1,11 +1,11 @@ #include "iplSceneUI.h" -#include "scene/mailAddSel/iplMailAddressSelect.h" #include "scene/button/iplButton.h" +#include "scene/mailAddSel/iplMailAddressSelect.h" #include "scene/parentalDialog/iplParentalDialog.h" -#include "scene/textWriter/iplTextWriter.h" #include "scene/letterWriter/iplLetterWriter.h" +#include "scene/textWriter/iplTextWriter.h" #include "scene/setting/iplNCDSetting.h" #include "scene/setting/iplSetting.h" @@ -18,21 +18,17 @@ namespace ipl { return static_cast(System::getScene(SCENE_BUTTON)); } + // clang-format off const char* MailAddressSelect::mscButtonName[MailAddressSelect::BTN_MAX] = { "B_MailIn", "B_LetterIn", "B_AdressIn", }; + // clang-format on - MailAddressSelect::MailAddressSelect(EGG::Heap* heap) : - FaderSceneBase(heap), - ButtonEventHandlerBase(), - mpLayout(NULL), - mpLayoutFile(NULL), - mpEvent(NULL), - mpGui(NULL), - mState(STATE_NORMAL), - mbParentalBypass(false) { + MailAddressSelect::MailAddressSelect(EGG::Heap* heap) + : FaderSceneBase(heap), ButtonEventHandlerBase(), mpLayout(NULL), mpLayoutFile(NULL), mpEvent(NULL), mpGui(NULL), mState(STATE_NORMAL), + mbParentalBypass(false) { setSceneParentFlags(SCN_PARENTFLAG_CALC | SCN_PARENTFLAG_DRAW); for (int i = 0; i < BTN_MAX; i++) { @@ -41,7 +37,6 @@ namespace ipl { } MailAddressSelect::~MailAddressSelect() { - } void MailAddressSelect::prepare() { @@ -53,20 +48,20 @@ namespace ipl { mpLayout = new layout::Object(getSceneHeap(), mpLayoutFile, "arc", "my_Mail_a.brlyt"); // Bind animations - mpLayout->bindToGroup("my_Mail_a_SelectIn.brlan", "G_SelectInOut", false); - mpLayout->bindToGroup("my_Mail_a_SelectOut.brlan", "G_SelectInOut", false, false); - mpLayout->bindToGroup("my_Mail_a_MailFoucusIn.brlan", "G_MailFoucus", false, false); - mpLayout->bindToGroup("my_Mail_a_MailFoucusOut.brlan", "G_MailFoucus", false, false); - mpLayout->bindToGroup("my_Mail_a_MailIn.brlan", "G_AdressInOut", false, false); - mpLayout->bindToGroup("my_Mail_a_MailOut.brlan", "G_AdressInOut", false, false); - mpLayout->bindToGroup("my_Mail_a_LetterFoucusIn.brlan", "G_LetterFoucus", false, false); + mpLayout->bindToGroup("my_Mail_a_SelectIn.brlan", "G_SelectInOut", false); + mpLayout->bindToGroup("my_Mail_a_SelectOut.brlan", "G_SelectInOut", false, false); + mpLayout->bindToGroup("my_Mail_a_MailFoucusIn.brlan", "G_MailFoucus", false, false); + mpLayout->bindToGroup("my_Mail_a_MailFoucusOut.brlan", "G_MailFoucus", false, false); + mpLayout->bindToGroup("my_Mail_a_MailIn.brlan", "G_AdressInOut", false, false); + mpLayout->bindToGroup("my_Mail_a_MailOut.brlan", "G_AdressInOut", false, false); + mpLayout->bindToGroup("my_Mail_a_LetterFoucusIn.brlan", "G_LetterFoucus", false, false); mpLayout->bindToGroup("my_Mail_a_LetterFoucusOut.brlan", "G_LetterFoucus", false, false); - mpLayout->bindToGroup("my_Mail_a_LetterIn.brlan", "G_AdressInOut", false, false); - mpLayout->bindToGroup("my_Mail_a_LetterOut.brlan", "G_AdressInOut", false, false); - mpLayout->bindToGroup("my_Mail_a_AdressFoucusIn.brlan", "G_AdressFoucus", false, false); + mpLayout->bindToGroup("my_Mail_a_LetterIn.brlan", "G_AdressInOut", false, false); + mpLayout->bindToGroup("my_Mail_a_LetterOut.brlan", "G_AdressInOut", false, false); + mpLayout->bindToGroup("my_Mail_a_AdressFoucusIn.brlan", "G_AdressFoucus", false, false); mpLayout->bindToGroup("my_Mail_a_AdressFoucusOut.brlan", "G_AdressFoucus", false, false); - mpLayout->bindToGroup("my_Mail_a_AdressIn.brlan", "G_AdressInOut", false, false); - mpLayout->bindToGroup("my_Mail_a_AdressOut.brlan", "G_AdressInOut", false, false); + mpLayout->bindToGroup("my_Mail_a_AdressIn.brlan", "G_AdressInOut", false, false); + mpLayout->bindToGroup("my_Mail_a_AdressOut.brlan", "G_AdressInOut", false, false); mpLayout->finishBinding(); mpLayout->getAnim(ANIM_FADE_IN)->play(); @@ -94,7 +89,7 @@ namespace ipl { size.width += 1.0f; nw4r::ut::DynamicCast(mpLayout->FindPaneByName("T_Mail"))->SetFontSize(size); } -#endif // KOREAN_BUILD +#endif // KOREAN_BUILD // Pause NWC24 Receive System::stopReceiveSchedule(); @@ -157,9 +152,8 @@ namespace ipl { break; } case STATE_WAIT_FOR_ZOOM_OUT: { - if (!mpLayout->isPlaying(ANIM_BTN_MAIL_ZOOM_OUT) - && !mpLayout->isPlaying(ANIM_BTN_LETTER_ZOOM_OUT) - && !mpLayout->isPlaying(ANIM_BTN_ADDRESS_ZOOM_OUT)) { + if (!mpLayout->isPlaying(ANIM_BTN_MAIL_ZOOM_OUT) && !mpLayout->isPlaying(ANIM_BTN_LETTER_ZOOM_OUT) && + !mpLayout->isPlaying(ANIM_BTN_ADDRESS_ZOOM_OUT)) { button->setEventHandler(this); mState = STATE_NORMAL; @@ -182,8 +176,7 @@ namespace ipl { mbParentalBypass = false; mState = STATE_PARENTAL_DIALOG; - } - else { + } else { System::getFader()->fadeOut(); reserveAllSceneDestruction(SCENE_SETTING, (void*)Setting::ARG_INTERNET_SETTING); @@ -228,8 +221,7 @@ namespace ipl { reserveAllSceneDestruction(SCENE_SETTING, (void*)Setting::ARG_INTERNET_SETTING); mState = STATE_DONE; - } - else { + } else { getButton()->animation(Button::IDANIM_APPEAR_LEFT_BUTTON); getButton()->setEventHandler(this); @@ -277,8 +269,7 @@ namespace ipl { mpLayout->getAnim(ANIM_BTN_LETTER_ZOOM_IN)->play(); mState = STATE_DISABLE_SCENE; - } - else { + } else { if ((mNwc24ErrCountdown += 1) > 300) { mNwc24ErrCountdown = 0; System::getDialog()->callBtn1(MESG_ERROR_NWC24_FATAL, MESG_CMN_OK); @@ -294,7 +285,7 @@ namespace ipl { void MailAddressSelect::initCalcFadeout() { getButton()->setEventHandler(NULL); - + if (System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT) { mpLayout->getAnim(ANIM_FADE_OUT)->play(); } @@ -303,8 +294,7 @@ namespace ipl { FaderSceneCommand MailAddressSelect::calcFadeout() { if (System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT) { return !mpLayout->getAnim(ANIM_FADE_OUT)->isPlaying() ? FADER_SCN_NEXT : FADER_SCN_CONTINUE; - } - else { + } else { return System::getFader()->getStatus() == EGG::Fader::PREPARE_IN ? FADER_SCN_NEXT : FADER_SCN_CONTINUE; } } @@ -457,8 +447,7 @@ namespace ipl { void MailAddressSelect::finishMemo(bool closing) { if (closing) { mState = STATE_CLOSING; - } - else { + } else { mpLayout->getAnim(ANIM_BTN_MAIL_ZOOM_OUT)->play(); mState = STATE_WAIT_FOR_ZOOM_OUT; } @@ -467,8 +456,7 @@ namespace ipl { void MailAddressSelect::finishLetter(bool closing) { if (closing) { mState = STATE_CLOSING; - } - else { + } else { mpLayout->getAnim(ANIM_BTN_LETTER_ZOOM_OUT)->play(); mState = STATE_WAIT_FOR_ZOOM_OUT; } @@ -491,7 +479,7 @@ namespace ipl { wchar_t nwc24ErrStr[32]; memset(nwc24ErrStr, 0, sizeof(nwc24ErrStr)); - swprintf(nwc24ErrStr, sizeof(nwc24ErrStr)/sizeof(wchar_t), L"%06d\n", nwc24Err); + swprintf(nwc24ErrStr, sizeof(nwc24ErrStr) / sizeof(wchar_t), L"%06d\n", nwc24Err); wcsncat(outErrMsg, nwc24ErrStr, outErrMsgLen - wcslen(outErrMsg)); wcsncat(outErrMsg, System::getMessage(errMsgId), outErrMsgLen - wcslen(outErrMsg)); @@ -533,7 +521,7 @@ namespace ipl { // WC24 library check switch (checkErr) { case NWC24_ERR_NETWORK: { - set_err_msg(errStr, sizeof(errStr)/sizeof(wchar_t), MESG_ERROR_NWC24_NETWORK, errorCode); + set_err_msg(errStr, sizeof(errStr) / sizeof(wchar_t), MESG_ERROR_NWC24_NETWORK, errorCode); System::getDialog()->callBtn1(errStr, MESG_CMN_OK); mState = STATE_DIALOG; @@ -541,7 +529,7 @@ namespace ipl { } case NWC24_ERR_FULL: case NWC24_ERR_SERVER: { - set_err_msg(errStr, sizeof(errStr)/sizeof(wchar_t), MESG_ERROR_NWC24_SERVER, errorCode); + set_err_msg(errStr, sizeof(errStr) / sizeof(wchar_t), MESG_ERROR_NWC24_SERVER, errorCode); System::getDialog()->callBtn1(errStr, MESG_CMN_OK); mState = STATE_DIALOG; @@ -554,7 +542,7 @@ namespace ipl { } System::getNwc24Manager()->close(); -exit: + exit: return result; } @@ -635,5 +623,5 @@ exit: } } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/parentalDialog/iplParentalDialog.cpp b/src/scene/parentalDialog/iplParentalDialog.cpp index 931a5f3b..d7006b00 100644 --- a/src/scene/parentalDialog/iplParentalDialog.cpp +++ b/src/scene/parentalDialog/iplParentalDialog.cpp @@ -2,8 +2,8 @@ #include "scene/parentalDialog/iplParentalDialog.h" -#include "iplSystem.h" #include "iplSound.h" +#include "iplSystem.h" #include @@ -14,23 +14,17 @@ namespace ipl { namespace scene { + // clang-format off const char* ParentalDialog::mscButtonName[ParentalDialog::BTN_MAX] = { "B_BtnA", "B_BtnB", "B_BtnC", }; + // clang-format on - ParentalDialog::ParentalDialog(EGG::Heap* heap, int type) : - FaderSceneBase(heap), - mState(STATE_NORMAL), - mpLayout(NULL), - mpLayoutFile(NULL), - mpEvent(NULL), - mpGui(NULL), - mDialogType(type), - mResult(RESULT_NONE), - mbInputPin(false), - mAttempts(0) { + ParentalDialog::ParentalDialog(EGG::Heap* heap, int type) + : FaderSceneBase(heap), mState(STATE_NORMAL), mpLayout(NULL), mpLayoutFile(NULL), mpEvent(NULL), mpGui(NULL), mDialogType(type), + mResult(RESULT_NONE), mbInputPin(false), mAttempts(0) { for (int i = 0; i < BTN_MAX; i++) { mbHovered[i] = FALSE; } @@ -47,20 +41,20 @@ namespace ipl { mpLayout = new layout::Object(getSceneHeap(), mpLayoutFile, "arc", "my_ParentalWindow_a.brlyt"); // Bind animations - mpLayout->bindToGroup("my_ParentalWindow_a_DialogIn.brlan", "G_InOut", false); - mpLayout->bindToGroup("my_ParentalWindow_a_DialogOut.brlan", "G_InOut", false, false); - mpLayout->bindToGroup("my_ParentalWindow_a_FocusBtn_on.brlan", "G_FocusBtnA", false, false); + mpLayout->bindToGroup("my_ParentalWindow_a_DialogIn.brlan", "G_InOut", false); + mpLayout->bindToGroup("my_ParentalWindow_a_DialogOut.brlan", "G_InOut", false, false); + mpLayout->bindToGroup("my_ParentalWindow_a_FocusBtn_on.brlan", "G_FocusBtnA", false, false); mpLayout->bindToGroup("my_ParentalWindow_a_FocusBtn_off.brlan", "G_FocusBtnA", false, false); mpLayout->bindToGroup("my_ParentalWindow_a_SelectBtn_Ac.brlan", "G_FocusBtnA", false, false); - mpLayout->bindToGroup("my_ParentalWindow_a_FocusBtn_on.brlan", "G_FocusBtnB", false, false); + mpLayout->bindToGroup("my_ParentalWindow_a_FocusBtn_on.brlan", "G_FocusBtnB", false, false); mpLayout->bindToGroup("my_ParentalWindow_a_FocusBtn_off.brlan", "G_FocusBtnB", false, false); mpLayout->bindToGroup("my_ParentalWindow_a_SelectBtn_Ac.brlan", "G_FocusBtnB", false, false); - mpLayout->bindToGroup("my_ParentalWindow_a_FocusBtn_on.brlan", "G_FocusBtnC", false, false); + mpLayout->bindToGroup("my_ParentalWindow_a_FocusBtn_on.brlan", "G_FocusBtnC", false, false); mpLayout->bindToGroup("my_ParentalWindow_a_FocusBtn_off.brlan", "G_FocusBtnC", false, false); mpLayout->bindToGroup("my_ParentalWindow_a_SelectBtn_Ac.brlan", "G_FocusBtnC", false, false); - mpLayout->bindToGroup("my_ParentalWindow_a_BeforeAfter.brlan", "G_BrforeAfter", false, false); - mpLayout->bindToGroup("my_ParentalWindow_a_OffBtn.brlan", "G_OnOffBtnB", false, false); - mpLayout->bindToGroup("my_ParentalWindow_a_OnBtn.brlan", "G_OnOffBtnB", false, false); + mpLayout->bindToGroup("my_ParentalWindow_a_BeforeAfter.brlan", "G_BrforeAfter", false, false); + mpLayout->bindToGroup("my_ParentalWindow_a_OffBtn.brlan", "G_OnOffBtnB", false, false); + mpLayout->bindToGroup("my_ParentalWindow_a_OnBtn.brlan", "G_OnOffBtnB", false, false); mpLayout->finishBinding(); // Setup interface @@ -173,8 +167,7 @@ namespace ipl { if (state->wcString != NULL) { if (*state->wcString == 0) { System::getKeyboard()->memoMgr()->setTitleText(System::getMessage(MESG_PARENTAL_DLG_NO_PIN)); - } - else { + } else { System::getKeyboard()->memoMgr()->setTitleText(L""); } } @@ -194,8 +187,7 @@ namespace ipl { mpLayout->getAnim(ANIM_CHANGE_INPUT_BUTTON)->setAnmType(ANIM_TYPE_BACKWARD); mpLayout->getAnim(ANIM_CHANGE_INPUT_BUTTON)->play(); mState = STATE_NORMAL; - } - else { + } else { // Exit out if too many attempts mResult = RESULT_OVER_ATTEMPTS; mState = STATE_DONE; @@ -291,11 +283,11 @@ namespace ipl { if (check()) { // Correct!! - System::getDialog()->callBtn0(mDialogType == TYPE_GAME ? MESG_PARENTAL_DLG_SUCCESS : MESG_PARENTAL_DLG_SUCCESS_TEMP, 180); + System::getDialog()->callBtn0(mDialogType == TYPE_GAME ? MESG_PARENTAL_DLG_SUCCESS : MESG_PARENTAL_DLG_SUCCESS_TEMP, + 180); mResult = RESULT_SUCCESS; mState = STATE_WAIT_MSG; - } - else { + } else { // Incorrect!! mAttempts++; System::getDialog()->callBtn1(MESG_PARENTAL_DLG_BAD_PIN, MESG_CMN_OK); @@ -327,7 +319,7 @@ namespace ipl { System::getKeyboard()->memoMgr()->setTitleText(System::getMessage(MESG_PARENTAL_DLG_NO_PIN)); mState = STATE_WAIT_INPUT; - + break; } } @@ -353,11 +345,11 @@ namespace ipl { } BOOL ParentalDialog::check() const { - u8 myPin[SC_PARENTAL_PASSWORD_LENGTH+1]; + u8 myPin[SC_PARENTAL_PASSWORD_LENGTH + 1]; SCParentalControlsInfo pcInfo; - BOOL pcInfoResult= SCGetParentalControl(&pcInfo); + BOOL pcInfoResult = SCGetParentalControl(&pcInfo); memset(myPin, 0, sizeof(myPin)); utility::CharacterCode::UTF16ToANSI(myPin, mMyPin, SC_PARENTAL_PASSWORD_LENGTH); @@ -401,5 +393,5 @@ namespace ipl { } } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/saveDataEdit/iplWiiBannerFileInfo.cpp b/src/scene/saveDataEdit/iplWiiBannerFileInfo.cpp index 53a9827c..d7bb03c4 100644 --- a/src/scene/saveDataEdit/iplWiiBannerFileInfo.cpp +++ b/src/scene/saveDataEdit/iplWiiBannerFileInfo.cpp @@ -16,8 +16,8 @@ namespace ipl { mAnim_AltBackward = 0; // Init name - wmemset(mSaveName, 0, SAVE_NAME_LENGTH+1); - wmemset(mSaveSubName, 0, SAVE_NAME_LENGTH+1); + wmemset(mSaveName, 0, SAVE_NAME_LENGTH + 1); + wmemset(mSaveSubName, 0, SAVE_NAME_LENGTH + 1); // Init banner memset(mpBannerData, 0, SAVE_BANNER_TEX_SIZE); @@ -103,9 +103,7 @@ namespace ipl { } while (i < SAVE_ICON_COUNT); // Init current frame texture - GXInitTexObj(&mCurIconTex, mpIconData[i-1], - SAVE_ICON_TEX_WIDTH, SAVE_ICON_TEX_HEIGHT, - GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE); + GXInitTexObj(&mCurIconTex, mpIconData[i - 1], SAVE_ICON_TEX_WIDTH, SAVE_ICON_TEX_HEIGHT, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE); } GXTexObj* WiiBannerFileInfo::loadIconTexture() { @@ -121,9 +119,7 @@ namespace ipl { } while (i < SAVE_ICON_COUNT); // Load current icon frame texture - GXInitTexObj(&mCurIconTex, mpIconData[i-1], - SAVE_ICON_TEX_WIDTH, SAVE_ICON_TEX_HEIGHT, - GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE); + GXInitTexObj(&mCurIconTex, mpIconData[i - 1], SAVE_ICON_TEX_WIDTH, SAVE_ICON_TEX_HEIGHT, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE); GXLoadTexObj(&mCurIconTex, GX_TEXMAP0); return &mCurIconTex; @@ -131,9 +127,7 @@ namespace ipl { GXTexObj* WiiBannerFileInfo::loadBannerTexture() { // Load current banner texture - GXInitTexObj(&mCurBannerTex, mpBannerData, - SAVE_BANNER_TEX_WIDTH, SAVE_BANNER_TEX_HEIGHT, - GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE); + GXInitTexObj(&mCurBannerTex, mpBannerData, SAVE_BANNER_TEX_WIDTH, SAVE_BANNER_TEX_HEIGHT, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE); GXLoadTexObj(&mCurBannerTex, GX_TEXMAP0); return &mCurBannerTex; @@ -150,7 +144,8 @@ namespace ipl { // Set max frame ticks int i = 0; for (i = 0; i < SAVE_ICON_COUNT; i++) { - if (get_iconspeed(i) == 0) break; // A frame with the speed of 0 indicates the end. + if (get_iconspeed(i) == 0) + break; // A frame with the speed of 0 indicates the end. mAnim_MaxFrameTicks += (get_iconspeed_ticks(i)); } @@ -185,5 +180,5 @@ namespace ipl { } return (mFrameSpeed >> (frame * 2)) & 0b00000011; } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/sceneMisc/iplReboot.cpp b/src/scene/sceneMisc/iplReboot.cpp index d3bfda55..7971eb7d 100644 --- a/src/scene/sceneMisc/iplReboot.cpp +++ b/src/scene/sceneMisc/iplReboot.cpp @@ -4,8 +4,8 @@ #include "scene/channelSelect/iplChannelSelect.h" -#include "scene/settingSelect/iplSettingSelectArg.h" #include "scene/setting/iplSetting.h" +#include "scene/settingSelect/iplSettingSelectArg.h" #include "iplSystem.h" @@ -16,7 +16,7 @@ namespace ipl { System::getHomeButtonMenu()->enableLib(); switch (mSettingsType) { - case REBOOT_DATA_MANAGEMENT: { + case REBOOT_DATA_MANAGEMENT: { reserveSceneChange(SCENE_SETTING_BG, (void*)SettingSelectArg::ARG_START_AFTER_REBOOT); break; } @@ -33,5 +33,5 @@ namespace ipl { requestSceneDestruction(); } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/sceneMisc/iplRootScene.cpp b/src/scene/sceneMisc/iplRootScene.cpp index d9f47b43..cb49e547 100644 --- a/src/scene/sceneMisc/iplRootScene.cpp +++ b/src/scene/sceneMisc/iplRootScene.cpp @@ -1,6 +1,6 @@ #include "scene/iplRootScene.h" -#include "scene/misc/iplReboot.h" #include "scene/iplSceneCreator.h" +#include "scene/misc/iplReboot.h" #include "scene/setting/iplSetting.h" #include "iplSystem.h" @@ -28,19 +28,16 @@ namespace ipl { if (SCGetUpdateType() == SC_UPDATE_TYPE_NONE) { *initialScene = SCENE_SETTING; *initialSubScene = Setting::ARG_SETUP; - } - else { + } else { *initialScene = SCENE_SETTING; *initialSubScene = Setting::ARG_UNK_5; } - } - else { + } else { // If the last play title had it's ticket expired, show the channel limit if (utility::ESMisc::IsLastTicketExpired(NULL)) { *initialScene = SCENE_LIMIT_OVER; System::getResetHandler()->enableResetToMenu(); - } - else { + } else { // Depending on boot type switch (System::getBS2BootType()) { // Data management @@ -98,5 +95,5 @@ namespace ipl { TVRCManager::getHandle()->setEnable(FALSE); } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/sceneSystem/iplFaderSceneBase.cpp b/src/scene/sceneSystem/iplFaderSceneBase.cpp index f57d728b..369a8f28 100644 --- a/src/scene/sceneSystem/iplFaderSceneBase.cpp +++ b/src/scene/sceneSystem/iplFaderSceneBase.cpp @@ -2,9 +2,8 @@ namespace ipl { namespace scene { - FaderSceneBase::FaderSceneBase(EGG::Heap* heap) : - Base(heap), - mScnFadeState(STT_FADE_IN) {} + FaderSceneBase::FaderSceneBase(EGG::Heap* heap) : Base(heap), mScnFadeState(STT_FADE_IN) { + } void FaderSceneBase::calc() { if (mScnFadeState != STT_DONE) { @@ -45,5 +44,5 @@ namespace ipl { calcCommonAfter(); } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/sceneSystem/iplSceneBase.cpp b/src/scene/sceneSystem/iplSceneBase.cpp index ff732cd8..3ff62a15 100644 --- a/src/scene/sceneSystem/iplSceneBase.cpp +++ b/src/scene/sceneSystem/iplSceneBase.cpp @@ -4,15 +4,11 @@ namespace ipl { namespace scene { - Base::Base(EGG::Heap* heap) : - mpHeap(heap), - mParentFlags(0), - mScnState(0), - mSceneID(0), - mPrevSceneID(0), - mCommand() {} + Base::Base(EGG::Heap* heap) : mpHeap(heap), mParentFlags(0), mScnState(0), mSceneID(0), mPrevSceneID(0), mCommand() { + } - Base::~Base() {} + Base::~Base() { + } void Base::do_prepare() { prepare(); @@ -47,11 +43,11 @@ namespace ipl { void Base::createChildScene(int sceneId, Base* parent, Base* child, void* args) { Command command; - command.type = COMMAND_CREATE_CHILD; - command.newSceneID = sceneId; - command.parent = parent; - command.child = child; - command.args = args; + command.type = COMMAND_CREATE_CHILD; + command.newSceneID = sceneId; + command.parent = parent; + command.child = child; + command.args = args; System::getSceneManager()->pushCommand(command); } @@ -59,23 +55,23 @@ namespace ipl { void Base::reserveSceneChange(int sceneId, void* args) { Command command; - command.type = COMMAND_RESERVE_CHANGE; - command.newSceneID = sceneId; - command.prevSceneID = mSceneID; - command.parent = getParent(); - command.child = getNext(); - command.args = args; + command.type = COMMAND_RESERVE_CHANGE; + command.newSceneID = sceneId; + command.prevSceneID = mSceneID; + command.parent = getParent(); + command.child = getNext(); + command.args = args; System::getSceneManager()->pushCommand(command); } void Base::reserveAllSceneDestruction(int sceneId, void* args) { - mCommand.type = COMMAND_RESERVE_ALL_DESTRUCT; - mCommand.newSceneID = SCENE_ROOT; - mCommand.newRootID = sceneId; - mCommand.args = args; + mCommand.type = COMMAND_RESERVE_ALL_DESTRUCT; + mCommand.newSceneID = SCENE_ROOT; + mCommand.newRootID = sceneId; + mCommand.args = args; System::getSceneManager()->setDestructSync(); } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/sceneSystem/iplSceneCreator.cpp b/src/scene/sceneSystem/iplSceneCreator.cpp index 08038c7a..ab4233a4 100644 --- a/src/scene/sceneSystem/iplSceneCreator.cpp +++ b/src/scene/sceneSystem/iplSceneCreator.cpp @@ -1,35 +1,35 @@ #include "scene/iplSceneCreator.h" -#include "scene/iplRootScene.h" -#include "scene/channelSelect/iplChannelSelect.h" -#include "scene/channelTitle/iplChannelTitle.h" +#include "scene/address/iplAddress.h" +#include "scene/address/iplAddressAddSel.h" +#include "scene/address/iplAddressEdit.h" +#include "scene/backMenu/iplBackMenu.h" #include "scene/board/iplBoard.h" #include "scene/button/iplButton.h" #include "scene/calendar/iplCalendar.h" -#include "scene/mailAddSel/iplMailAddressSelect.h" -#include "scene/textWriter/iplTextWriter.h" -#include "scene/letterWriter/iplLetterWriter.h" #include "scene/channelEdit/iplChannelEdit.h" +#include "scene/channelSelect/iplChannelSelect.h" +#include "scene/channelTitle/iplChannelTitle.h" +#include "scene/faceSelect/iplFaceSelect.h" +#include "scene/health/iplHealth.h" +#include "scene/iplRootScene.h" +#include "scene/kitayamaTest/iplKitayamaTest.h" +#include "scene/letterWriter/iplLetterWriter.h" +#include "scene/limitOver/iplLimitOver.h" +#include "scene/mailAddSel/iplMailAddressSelect.h" #include "scene/memory/iplMemory.h" #include "scene/memoryCard/iplMemoryCard.h" -#include "scene/setting/iplSetting.h" -#include "scene/settingSelect/iplSettingSelect.h" -#include "scene/settingSelect/iplSettingButton.h" -#include "scene/settingSelect/iplSettingBg.h" -#include "scene/address/iplAddress.h" -#include "scene/address/iplAddressEdit.h" -#include "scene/address/iplAddressAddSel.h" -#include "scene/nakamuraTest/iplNakamuraTest.h" -#include "scene/health/iplHealth.h" -#include "scene/parentalDialog/iplParentalDialog.h" -#include "scene/faceSelect/iplFaceSelect.h" -#include "scene/kitayamaTest/iplKitayamaTest.h" -#include "scene/backMenu/iplBackMenu.h" -#include "scene/limitOver/iplLimitOver.h" #include "scene/misc/iplReboot.h" +#include "scene/nakamuraTest/iplNakamuraTest.h" +#include "scene/parentalDialog/iplParentalDialog.h" +#include "scene/sdButton/iplSDButton.h" #include "scene/sdChannelSelect/iplSDChannelSelect.h" #include "scene/sdChannelTitle/iplSDChannelTitle.h" -#include "scene/sdButton/iplSDButton.h" +#include "scene/setting/iplSetting.h" +#include "scene/settingSelect/iplSettingBg.h" +#include "scene/settingSelect/iplSettingButton.h" +#include "scene/settingSelect/iplSettingSelect.h" +#include "scene/textWriter/iplTextWriter.h" namespace ipl { namespace scene { @@ -221,5 +221,5 @@ namespace ipl { return scene; } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/sceneSystem/iplSceneManager.cpp b/src/scene/sceneSystem/iplSceneManager.cpp index 43a52442..d0a59934 100644 --- a/src/scene/sceneSystem/iplSceneManager.cpp +++ b/src/scene/sceneSystem/iplSceneManager.cpp @@ -16,17 +16,15 @@ namespace ipl { newSceneID = 0; } - Manager::Manager(EGG::Heap* heap) : - mpRootScene(NULL), - mCommands(), - mpReservedScene(NULL), - mReservedCommand(), - mbCreatedReserved(false), - mbDestroySyncTask(false) { + Manager::Manager(EGG::Heap* heap) + : mpRootScene(NULL), mCommands(), mpReservedScene(NULL), mReservedCommand(), mbCreatedReserved(false), mbDestroySyncTask(false) { // Setup the heaps!! - mpBigSceneHeap = EGG::UnitHeap::create(EGG::UnitHeap::calcHeapSize(SCENE_BIG_SIZE, 3, 4), SCENE_BIG_SIZE, heap, 4, MEM_HEAP_OPT_DEBUG_FILL); - mpMdmSceneHeap = EGG::UnitHeap::create(EGG::UnitHeap::calcHeapSize(SCENE_MEDIUM_SIZE, 4, 4), SCENE_MEDIUM_SIZE, heap, 4, MEM_HEAP_OPT_DEBUG_FILL); - mpSmlSceneHeap = EGG::UnitHeap::create(EGG::UnitHeap::calcHeapSize(SCENE_SMALL_SIZE, 6, 4), SCENE_SMALL_SIZE, heap, 4, MEM_HEAP_OPT_DEBUG_FILL); + mpBigSceneHeap = + EGG::UnitHeap::create(EGG::UnitHeap::calcHeapSize(SCENE_BIG_SIZE, 3, 4), SCENE_BIG_SIZE, heap, 4, MEM_HEAP_OPT_DEBUG_FILL); + mpMdmSceneHeap = + EGG::UnitHeap::create(EGG::UnitHeap::calcHeapSize(SCENE_MEDIUM_SIZE, 4, 4), SCENE_MEDIUM_SIZE, heap, 4, MEM_HEAP_OPT_DEBUG_FILL); + mpSmlSceneHeap = + EGG::UnitHeap::create(EGG::UnitHeap::calcHeapSize(SCENE_SMALL_SIZE, 6, 4), SCENE_SMALL_SIZE, heap, 4, MEM_HEAP_OPT_DEBUG_FILL); } void Manager::init() { @@ -45,19 +43,18 @@ namespace ipl { System::setCurrentHeap(mpRootScene->mpHeap); mpRootScene->do_create(); - + System::getMem1Root()->becomeCurrentHeap(); } void Manager::calc() { calc(mpRootScene); - + if (mpReservedScene) { if (mbCreatedReserved) { attachReservedScene(); } - } - else { + } else { if (mCommands.get_current_index() != 0) { const Command& popped = mCommands.get_popped_item(); switch (popped.type) { @@ -117,8 +114,7 @@ namespace ipl { BOOL Manager::isResetAcceptable() { if (!mpRootScene) { return TRUE; - } - else { + } else { for (SceneObj::iterator it = SceneObj::iterator(mpRootScene); it.getPtr() != NULL; ++it) { if (it->isResetAcceptable() == FALSE) { return FALSE; @@ -139,8 +135,7 @@ namespace ipl { BOOL Manager::isResetProcessDone() { if (!mpRootScene) { return TRUE; - } - else { + } else { for (SceneObj::iterator it = SceneObj::iterator(mpRootScene); it.getPtr() != NULL; ++it) { if (it->isResetProcessDone() == FALSE) { return FALSE; @@ -157,8 +152,7 @@ namespace ipl { if (stack18->getPrev()) { stack18.setPtr(stack18->getPrev()); stack18.reverse(); - } - else { + } else { stack18.setPtr(stack18->getParent()); } if ((stack10->mScnState & SceneObj::SCN_STATE_DESTROY_REQ) != 0) { @@ -176,15 +170,15 @@ namespace ipl { mReservedCommand = command; mbCreatedReserved = false; mpReservedScene->do_prepare(); - + System::getMem1Root()->becomeCurrentHeap(); } SceneObj* Manager::createScene(int sceneId, int prevSceneId, void* args) { - EGG::Heap* heap = NULL; - int size = Creator::size(sceneId); + EGG::Heap* heap = NULL; + int size = Creator::size(sceneId); - SceneObj* scene = NULL; + SceneObj* scene = NULL; switch (size) { case SCENE_BIG_SIZE: { @@ -239,8 +233,7 @@ namespace ipl { if (mReservedCommand.child) { scene->insert(mpReservedScene, mReservedCommand.child); - } - else { + } else { scene->attach(mpReservedScene); } @@ -261,7 +254,7 @@ namespace ipl { BOOL Manager::isReady(int sceneId) { BOOL result = FALSE; - int gotID = 0; + int gotID = 0; if (System::getNandManager()->receiveToken(&gotID) && sceneId == gotID) { result = TRUE; } @@ -284,5 +277,5 @@ namespace ipl { } return found; } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/sdButton/iplSDArrow.cpp b/src/scene/sdButton/iplSDArrow.cpp index 1cd5c24f..ecb3f277 100644 --- a/src/scene/sdButton/iplSDArrow.cpp +++ b/src/scene/sdButton/iplSDArrow.cpp @@ -6,14 +6,13 @@ namespace ipl { namespace scene { void SDArrow::draw() { SDButton* button; - if (System::onDefaultDrawLayer() - && (button = static_cast(System::getScene(SCENE_SD_BUTTON)), button != NULL)) { + if (System::onDefaultDrawLayer() && (button = static_cast(System::getScene(SCENE_SD_BUTTON)), button != NULL)) { layout::Object::setDefaultCamera(); for (int i = 0; i < SDButton::ARROW_BTN_MAX; i++) { layout::Object* arrowLayout = button->get_layout(); nw4r::lyt::Pane* pane = arrowLayout->FindPaneByName(SDButton::mscArrowName[i]); - + pane->SetVisible(true); arrowLayout->draw(pane); pane->SetVisible(false); @@ -22,5 +21,5 @@ namespace ipl { button->drawBalloon(); } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/sdButton/iplSDButton.cpp b/src/scene/sdButton/iplSDButton.cpp index 9080cf54..68ec9cef 100644 --- a/src/scene/sdButton/iplSDButton.cpp +++ b/src/scene/sdButton/iplSDButton.cpp @@ -12,6 +12,7 @@ namespace ipl { /* MAIN BUTTON */ /* =========== */ + // clang-format off static const u32 scBalloonMsg[SDButton::BALLOON_MAX] = { MESG_SD_BUTTON_WII_MENU, MESG_SD_BUTTON_HELP, @@ -28,10 +29,9 @@ namespace ipl { "ArwR", "ArwL" }; + // clang-format on - SDButton::SDButton(EGG::Heap* heap) - : Base(heap), - unk_0x54(0) { + SDButton::SDButton(EGG::Heap* heap) : Base(heap), unk_0x54(0) { setSceneParentFlags(SCN_PARENTFLAG_CALC | SCN_PARENTFLAG_DRAW); for (int i = 0; i < 2; i++) { @@ -43,42 +43,43 @@ namespace ipl { mbEnabled = true; } - SDButton::~SDButton() {} + SDButton::~SDButton() { + } void SDButton::prepare() { - mpLayoutFile = System::getNandManager()->readLayoutAsync(getSceneHeap(), "sdButton.ash"); + mpLayoutFile = System::getNandManager()->readLayoutAsync(getSceneHeap(), "sdButton.ash"); mpBalloonFile = System::getNandManager()->readLayoutAsync(getSceneHeap(), "balloon.ash"); } void SDButton::create() { // Setup layout mpLayout = new layout::Object(getSceneHeap(), mpLayoutFile, "arc", "mn_SdcardMenu_b.brlyt"); - + // Bind button animatons mpLayout->bindToGroup("mn_SdcardMenu_b_Btn_Wiimenu_rollover.brlan", "G_BL", false); - mpLayout->bindToGroup("mn_SdcardMenu_b_Btn_Wiimenu_on.brlan", "G_BL", false); - mpLayout->bindToGroup("mn_SdcardMenu_b_Btn_Wiimenu_rollout.brlan", "G_BL", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_Btn_Wiimenu_on.brlan", "G_BL", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_Btn_Wiimenu_rollout.brlan", "G_BL", false); mpLayout->getAnim(ANIM_WIIMENU_BTN_ROLL_OVER)->initAnmFrame(); - mpLayout->bindToGroup("mn_SdcardMenu_b_Btn_Help_rollover.brlan", "G_BR", false); - mpLayout->bindToGroup("mn_SdcardMenu_b_Btn_Help_on.brlan", "G_BR", false); - mpLayout->bindToGroup("mn_SdcardMenu_b_Btn_Help_rollout.brlan", "G_BR", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_Btn_Help_rollover.brlan", "G_BR", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_Btn_Help_on.brlan", "G_BR", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_Btn_Help_rollout.brlan", "G_BR", false); mpLayout->getAnim(ANIM_HELP_BTN_ROLL_OVER)->initAnmFrame(); // Bind arrow animations - mpLayout->bindToGroup("mn_SdcardMenu_b_Arw_wating_roop.brlan", "G_ArwRoop", false); - mpLayout->bindToGroup("mn_SdcardMenu_b_ArwL_on.brlan", "G_ArwL_Ac", false); - mpLayout->bindToGroup("mn_SdcardMenu_b_ArwR_on.brlan", "G_ArwR_Ac", false); - mpLayout->bindToGroup("mn_SdcardMenu_b_ArwL_rollover.brlan", "G_ArwL_Focus", false); - mpLayout->bindToGroup("mn_SdcardMenu_b_ArwR_rollover.brlan", "G_ArwR_Focus", false); - mpLayout->bindToGroup("mn_SdcardMenu_b_ArwL_rollout.brlan", "G_ArwL_Focus", false); - mpLayout->bindToGroup("mn_SdcardMenu_b_ArwR_rollout.brlan", "G_ArwR_Focus", false); - mpLayout->bindToGroup("mn_SdcardMenu_b_ArwL_in.brlan", "G_ArwL_End", false); - mpLayout->bindToGroup("mn_SdcardMenu_b_ArwR_in.brlan", "G_ArwR_End", false); - mpLayout->bindToGroup("mn_SdcardMenu_b_ArwL_out.brlan", "G_ArwL_End", false); - mpLayout->bindToGroup("mn_SdcardMenu_b_ArwR_out.brlan", "G_ArwR_End", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_Arw_wating_roop.brlan", "G_ArwRoop", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_ArwL_on.brlan", "G_ArwL_Ac", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_ArwR_on.brlan", "G_ArwR_Ac", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_ArwL_rollover.brlan", "G_ArwL_Focus", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_ArwR_rollover.brlan", "G_ArwR_Focus", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_ArwL_rollout.brlan", "G_ArwL_Focus", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_ArwR_rollout.brlan", "G_ArwR_Focus", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_ArwL_in.brlan", "G_ArwL_End", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_ArwR_in.brlan", "G_ArwR_End", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_ArwL_out.brlan", "G_ArwL_End", false); + mpLayout->bindToGroup("mn_SdcardMenu_b_ArwR_out.brlan", "G_ArwR_End", false); mpLayout->getAnim(ANIM_ARROW_LEFT_ROLL_OVER)->initAnmFrame(); mpLayout->getAnim(ANIM_ARROW_RIGHT_ROLL_OVER)->initAnmFrame(); @@ -99,7 +100,8 @@ namespace ipl { // Setup text balloons for (int i = 0; i < BALLOON_MAX; i++) { - mpBalloons[i] = new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f), 120.0f, 30.0f); + mpBalloons[i] = + new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f), 120.0f, 30.0f); mpBalloons[i]->init(System::getMessage(scBalloonMsg[i]), 0); mpBalloons[i]->init_textbox(TRUE); } @@ -196,10 +198,9 @@ namespace ipl { void SDButton::startPointEvent(const char* paneName, controller::Interface* con) { int btnNo = getButtonNo(paneName); - if (btnNo != -1 - && (mbEnabled || btnNo == BTN_ARROW_RIGHT || btnNo == BTN_ARROW_LEFT) - && (btnNo != BTN_ARROW_RIGHT || mbArrowVisible[ARROW_BTN_RIGHT] == true) - && (btnNo != BTN_ARROW_LEFT || mbArrowVisible[ARROW_BTN_LEFT] == true)) { + if (btnNo != -1 && (mbEnabled || btnNo == BTN_ARROW_RIGHT || btnNo == BTN_ARROW_LEFT) && + (btnNo != BTN_ARROW_RIGHT || mbArrowVisible[ARROW_BTN_RIGHT] == true) && + (btnNo != BTN_ARROW_LEFT || mbArrowVisible[ARROW_BTN_LEFT] == true)) { if (mbHovered[btnNo] == FALSE) { layout::Animator* anim = NULL; @@ -264,10 +265,9 @@ namespace ipl { void SDButton::startLeftEvent(const char* paneName) { int btnNo = getButtonNo(paneName); - if (btnNo != -1 - && (mbEnabled || btnNo == BTN_ARROW_RIGHT || btnNo == BTN_ARROW_LEFT) - && (btnNo != BTN_ARROW_RIGHT || mbArrowVisible[ARROW_BTN_RIGHT] == true) - && (btnNo != BTN_ARROW_LEFT || mbArrowVisible[ARROW_BTN_LEFT] == true)) { + if (btnNo != -1 && (mbEnabled || btnNo == BTN_ARROW_RIGHT || btnNo == BTN_ARROW_LEFT) && + (btnNo != BTN_ARROW_RIGHT || mbArrowVisible[ARROW_BTN_RIGHT] == true) && + (btnNo != BTN_ARROW_LEFT || mbArrowVisible[ARROW_BTN_LEFT] == true)) { layout::Animator* anim = NULL; if (mbHovered[btnNo] == TRUE) { @@ -401,8 +401,7 @@ namespace ipl { case ARROW_BTN_RIGHT: { if (bAppear) { anim = mpLayout->getAnim(ANIM_ARROW_RIGHT_OUT); - } - else { + } else { anim = mpLayout->getAnim(ANIM_ARROW_RIGHT_IN); } break; @@ -411,8 +410,7 @@ namespace ipl { case ARROW_BTN_LEFT: { if (bAppear) { anim = mpLayout->getAnim(ANIM_ARROW_LEFT_OUT); - } - else { + } else { anim = mpLayout->getAnim(ANIM_ARROW_LEFT_IN); } break; @@ -523,6 +521,7 @@ namespace ipl { onEventDerived(compId, event, static_cast(data)); } - void SDButtonEventHandlerBase::onEventDerived(u32 compId, u32 event, const controller::Interface* con) {} - } -} + void SDButtonEventHandlerBase::onEventDerived(u32 compId, u32 event, const controller::Interface* con) { + } + } // namespace scene +} // namespace ipl diff --git a/src/scene/sdButton/iplSDMenuButton.cpp b/src/scene/sdButton/iplSDMenuButton.cpp index 65d25d5f..4043ba94 100644 --- a/src/scene/sdButton/iplSDMenuButton.cpp +++ b/src/scene/sdButton/iplSDMenuButton.cpp @@ -6,6 +6,7 @@ namespace ipl { namespace scene { + // clang-format off const char* scSDBtnName[] = { "Ac", }; @@ -18,28 +19,28 @@ namespace ipl { -152.0f, -245.0f }; + // clang-format on - SDMenuButton::SDMenuButton() : - mpLayout(NULL), mpGui(NULL), - mbHovered(), - mbEnabled(true) {} + SDMenuButton::SDMenuButton() : mpLayout(NULL), mpGui(NULL), mbHovered(), mbEnabled(true) { + } - SDMenuButton::~SDMenuButton() {} + SDMenuButton::~SDMenuButton() { + } void SDMenuButton::create(nand::LayoutFile* layoutFile, nand::LayoutFile* balloonFile, EGG::Heap* heap) { mpLayout = new layout::Object(heap, layoutFile, "arc", "mn_Sdcard_Btn.brlyt"); - mpLayout->bindToGroup("mn_Sdcard_Btn_On_Roop.brlan", "On_Roop", false); - mpLayout->bindToGroup("mn_Sdcard_Btn_BtnL_In.brlan", "Btn_L_InOut", false); - mpLayout->bindToGroup("mn_Sdcard_Btn_BtnL_Out.brlan", "Btn_L_InOut", false); - mpLayout->bindToGroup("mn_Sdcard_Btn_Insert.brlan", "Insert", false); - mpLayout->bindToGroup("mn_Sdcard_Btn_BtnL_On.brlan", "Btn_L_On", false); - mpLayout->bindToGroup("mn_Sdcard_Btn_BtnL_RollOver.brlan", "Btn_L_Roll", false); - mpLayout->bindToGroup("mn_Sdcard_Btn_BtnL_RollOut.brlan", "Btn_L_On", false); + mpLayout->bindToGroup("mn_Sdcard_Btn_On_Roop.brlan", "On_Roop", false); + mpLayout->bindToGroup("mn_Sdcard_Btn_BtnL_In.brlan", "Btn_L_InOut", false); + mpLayout->bindToGroup("mn_Sdcard_Btn_BtnL_Out.brlan", "Btn_L_InOut", false); + mpLayout->bindToGroup("mn_Sdcard_Btn_Insert.brlan", "Insert", false); + mpLayout->bindToGroup("mn_Sdcard_Btn_BtnL_On.brlan", "Btn_L_On", false); + mpLayout->bindToGroup("mn_Sdcard_Btn_BtnL_RollOver.brlan", "Btn_L_Roll", false); + mpLayout->bindToGroup("mn_Sdcard_Btn_BtnL_RollOut.brlan", "Btn_L_On", false); mpLayout->getAnim(ANIM_BTN_ROLL_OVER)->initAnmFrame(); mpLayout->finishBinding(); mpLayout->getAnim(ANIM_ON_LOOP)->initAnmFrame(); mpLayout->getAnim(ANIM_ON_LOOP)->play(); - + mpGui = new gui::PaneManager(NULL, mpLayout->getDrawInfo(), NULL, NULL); mpGui->setupScene(mpLayout); mpGui->setAllComponentTriggerTarget(false); @@ -49,8 +50,7 @@ namespace ipl { mpLayout->show("N_Btn_Off"); nw4r::math::VEC3 newPos(SCGetAspectRatio() == SC_ASPECT_RATIO_16x9 ? scBtnPos[SC_ASPECT_RATIO_16x9] : scBtnPos[SC_ASPECT_RATIO_4x3], - -172.0f, - -172.0f); + -172.0f, -172.0f); mpLayout->GetRootPane()->SetTranslate(newPos); for (int i = 0; i < BTN_MAX; i++) { @@ -120,7 +120,7 @@ namespace ipl { } } - if (mbHovered[btnNo] < 4/*???*/) { + if (mbHovered[btnNo] < 4 /*???*/) { mbHovered[btnNo]++; } } @@ -185,8 +185,7 @@ namespace ipl { anim->setMinFrame(static_cast(frame)); anim->setMaxFrame(15.0f); } - } - else { + } else { anim = mpLayout->getAnim(ANIM_BTN_OUT); anim->setMinFrame(0.0f); anim->setMaxFrame(15.0f); @@ -207,8 +206,7 @@ namespace ipl { anim->initAnmFrame(); if (backwards) { anim->setAnmType(ANIM_TYPE_BACKWARD); - } - else { + } else { anim->setAnmType(ANIM_TYPE_FORWARD); } anim->play(); @@ -254,8 +252,7 @@ namespace ipl { if (bInserted) { mpLayout->setVisible("N_Btn_On", true); mpLayout->setVisible("N_Btn_Off", false); - } - else { + } else { mpLayout->setVisible("N_Btn_On", false); mpLayout->setVisible("N_Btn_Off", true); @@ -300,6 +297,7 @@ namespace ipl { onEventDerived(compId, event, static_cast(data)); } - void SDMenuEventHandlerBase::onEventDerived(u32 compId, u32 event, const controller::Interface* con) {} - } -} + void SDMenuEventHandlerBase::onEventDerived(u32 compId, u32 event, const controller::Interface* con) { + } + } // namespace scene +} // namespace ipl diff --git a/src/scene/setting/iplParental.cpp b/src/scene/setting/iplParental.cpp index baa312c6..c7122001 100644 --- a/src/scene/setting/iplParental.cpp +++ b/src/scene/setting/iplParental.cpp @@ -9,16 +9,16 @@ namespace ipl { namespace parental { - Parental::SCData Parental::m_sc; - Parental::SCData Parental::m_scSave; + Parental::SCData Parental::m_sc; + Parental::SCData Parental::m_scSave; - char Parental::mRequestNum[REQUEST_NUMBER_LENGTH+1]; + char Parental::mRequestNum[REQUEST_NUMBER_LENGTH + 1]; - char Parental::mStackPass[SC_PARENTAL_PASSWORD_LENGTH]; - u8 Parental::mMistake[Parental::MISTAKE_MAX]; - char Parental::mMasterKey[MASTER_KEY_LENGTH+1]; + char Parental::mStackPass[SC_PARENTAL_PASSWORD_LENGTH]; + u8 Parental::mMistake[Parental::MISTAKE_MAX]; + char Parental::mMasterKey[MASTER_KEY_LENGTH + 1]; - u32 Parental::mCrc32Table[Parental::CRC32_TABLE_SIZE+1]; + u32 Parental::mCrc32Table[Parental::CRC32_TABLE_SIZE + 1]; void Parental::init() { memset(&m_sc, 0, sizeof(SCData)); @@ -35,7 +35,7 @@ namespace ipl { m_sc.netContentRestrict = SCGetNetContentRestrictions(); m_sc.wwwRestrict = SCGetWwwRestriction(); - memcpy(&m_scSave, &m_sc,sizeof(SCData)); + memcpy(&m_scSave, &m_sc, sizeof(SCData)); clearMiss(); makeMasterkey(); @@ -79,7 +79,8 @@ namespace ipl { u32 Parental::checkRestrictions() { // what even - return (m_sc.wwwRestrict == 0) & 4 | -(m_sc.netContentRestrict & 1) & 8 | -((m_sc.netContentRestrict >> 1) & 1) & 2 | (m_sc.netContentRestrict >> 2) & 1; + return (m_sc.wwwRestrict == 0) & 4 | -(m_sc.netContentRestrict & 1) & 8 | -((m_sc.netContentRestrict >> 1) & 1) & 2 | + (m_sc.netContentRestrict >> 2) & 1; } BOOL Parental::checkPass(const char* pass) { @@ -87,8 +88,7 @@ namespace ipl { if (result == 0) { memcpy(m_sc.info.password, pass, ARRAY_LENGTH(m_sc.info.password)); return TRUE; - } - else { + } else { return FALSE; } } @@ -104,8 +104,7 @@ namespace ipl { if (_checkPass(pass)) { mMistake[MISTAKE_PASS] = 0; return TRUE; - } - else { + } else { mMistake[MISTAKE_PASS] += 1; } return FALSE; @@ -118,8 +117,7 @@ namespace ipl { if (memcmp(m_sc.info.secretAnswer, secAnswer, sizeof(m_sc.info.secretAnswer)) == 0) { mMistake[MISTAKE_SEC_ANSWER] = 0; return TRUE; - } - else { + } else { mMistake[MISTAKE_SEC_ANSWER] += 1; } return FALSE; @@ -132,8 +130,7 @@ namespace ipl { if (strncmp(master, mMasterKey, MASTER_KEY_LENGTH) == 0) { mMistake[MISTAKE_MASTER] = 0; return TRUE; - } - else { + } else { mMistake[MISTAKE_MASTER] += 1; } return FALSE; @@ -166,8 +163,7 @@ namespace ipl { if (flag == 0) { memcpy(&m_sc, &m_scSave, sizeof(SCData)); clearMiss(); - } - else { + } else { m_sc.info.enable = SC_PARENTAL_FLAG_ENABLED; } } @@ -204,7 +200,7 @@ namespace ipl { void Parental::adjustOgn(u8 country) { m_sc.info.rating = 20; - switch (country) { // irregular + switch (country) { // irregular case SC_COUNTRY_DE: { m_sc.info.org = SC_PARENTAL_ORG_USK; break; @@ -229,7 +225,6 @@ namespace ipl { } } - void Parental::write() { if (!SCSetParentalControl(&m_sc.info)) { OSReport("SCSetParentalControl Failed!\n"); @@ -290,7 +285,7 @@ namespace ipl { } void Parental::makeMasterkey() { - char data[REQUEST_NUMBER_LENGTH+1]; + char data[REQUEST_NUMBER_LENGTH + 1]; memset(data, 0, sizeof(mRequestNum)); memset(mRequestNum, 0, sizeof(mRequestNum)); @@ -316,7 +311,6 @@ namespace ipl { OSReport("data+req:%s\n", data); } - char* Parental::getRequestNum() { makeMasterkey(); return mRequestNum; @@ -333,5 +327,5 @@ namespace ipl { DECOMP_FORCE_ACTIVE(iplParental_cpp, "requestNum:%s\n"); DECOMP_FORCE_ACTIVE(iplParental_cpp, "masterkey:%s\n"); DECOMP_FORCE_ACTIVE(iplParental_cpp, "country: %d\n"); - } -} + } // namespace parental +} // namespace ipl diff --git a/src/scene/settingSelect/iplSettingBg.cpp b/src/scene/settingSelect/iplSettingBg.cpp index 11fc8ec8..8387d0ac 100644 --- a/src/scene/settingSelect/iplSettingBg.cpp +++ b/src/scene/settingSelect/iplSettingBg.cpp @@ -7,11 +7,7 @@ namespace ipl { namespace scene { - SettingBg::SettingBg(EGG::Heap* heap, int arg) : - Base(heap), - mSettingArg(arg), - mpLayout(NULL), - mpLayoutFile(NULL) { + SettingBg::SettingBg(EGG::Heap* heap, int arg) : Base(heap), mSettingArg(arg), mpLayout(NULL), mpLayoutFile(NULL) { setSceneParentFlags(SCN_PARENTFLAG_CALC | SCN_PARENTFLAG_DRAW); } @@ -40,6 +36,7 @@ namespace ipl { } } - SettingBg::~SettingBg() {} - } -} + SettingBg::~SettingBg() { + } + } // namespace scene +} // namespace ipl diff --git a/src/scene/settingSelect/iplSettingButton.cpp b/src/scene/settingSelect/iplSettingButton.cpp index 617ff5af..16df6d8a 100644 --- a/src/scene/settingSelect/iplSettingButton.cpp +++ b/src/scene/settingSelect/iplSettingButton.cpp @@ -7,14 +7,14 @@ namespace ipl { namespace scene { + // clang-format off static const char* scBtnSoundType[SettingButton::MAX_SOUND_TYPE] = { "WIPL_SE_CANCEL", "WIPL_SE_DECIDE", }; + // clang-format on - SettingButton::SettingButton(EGG::Heap* heap, int arg) : - FaderSceneBase(heap), - ::gui::EventHandler() { + SettingButton::SettingButton(EGG::Heap* heap, int arg) : FaderSceneBase(heap), ::gui::EventHandler() { unk_0x264 = 64; unk_0x268 = 0; unk_0x26C = 0; @@ -36,15 +36,15 @@ namespace ipl { void SettingButton::create() { mpLayout = new layout::Object(getSceneHeap(), mpLayoutFile, "arc", "it_Button_a.brlyt"); - - mpLayout->bindToGroup("it_Button_a_SeenIn.brlan", "G_BarIn", false); - mpLayout->bindToGroup("it_Button_a_BtnFoucusIn.brlan", "G_FocusBtnA", false, false); - mpLayout->bindToGroup("it_Button_a_BtnFoucusOut.brlan", "G_FocusBtnA", false, false); - mpLayout->bindToGroup("it_Button_a_BtnFlash.brlan", "G_SelectBtnA", false, false); - mpLayout->bindToGroup("it_Button_a_WiiAppear.brlan", "G_Wii", false, false); - mpLayout->bindToGroup("it_Button_a_WiiLost.brlan", "G_Wii", false); - mpLayout->bindToGroup("it_Button_a_AlphIn.brlan", "G_FocusBtnA", false, false); - mpLayout->bindToGroup("it_Button_a_AlphOut.brlan", "G_FocusBtnA", false, false); + + mpLayout->bindToGroup("it_Button_a_SeenIn.brlan", "G_BarIn", false); + mpLayout->bindToGroup("it_Button_a_BtnFoucusIn.brlan", "G_FocusBtnA", false, false); + mpLayout->bindToGroup("it_Button_a_BtnFoucusOut.brlan", "G_FocusBtnA", false, false); + mpLayout->bindToGroup("it_Button_a_BtnFlash.brlan", "G_SelectBtnA", false, false); + mpLayout->bindToGroup("it_Button_a_WiiAppear.brlan", "G_Wii", false, false); + mpLayout->bindToGroup("it_Button_a_WiiLost.brlan", "G_Wii", false); + mpLayout->bindToGroup("it_Button_a_AlphIn.brlan", "G_FocusBtnA", false, false); + mpLayout->bindToGroup("it_Button_a_AlphOut.brlan", "G_FocusBtnA", false, false); mpLayout->finishBinding(); mpGui = new gui::PaneManager(this, mpLayout->getDrawInfo(), NULL, NULL, true); @@ -57,8 +57,7 @@ namespace ipl { if (mSettingArg == SettingSelectArg::ARG_START_SAVE_DATA) { mbShowBtn = false; mpLayout->getAnim(ANIM_ALPHA_IN)->init(); - } - else { + } else { mbShowBtn = true; mpLayout->getAnim(ANIM_ALPHA_OUT)->init(); } @@ -71,8 +70,7 @@ namespace ipl { mbFadedIn = true; mpLayout->getAnim(ANIM_SEEN_IN)->play(); } - } - else { + } else { if (!mpLayout->getAnim(ANIM_SEEN_IN)->isPlaying()) { result = FADER_SCN_NEXT; } @@ -82,10 +80,8 @@ namespace ipl { } FaderSceneCommand SettingButton::calcNormal() { - if (!mpLayout->getAnim(ANIM_ALPHA_IN)->isPlaying() - && !mpLayout->getAnim(ANIM_ALPHA_OUT)->isPlaying() - && !mpLayout->getAnim(ANIM_BTN_FLASH)->isPlaying() - && unk_0x268 != 0) { + if (!mpLayout->getAnim(ANIM_ALPHA_IN)->isPlaying() && !mpLayout->getAnim(ANIM_ALPHA_OUT)->isPlaying() && + !mpLayout->getAnim(ANIM_BTN_FLASH)->isPlaying() && unk_0x268 != 0) { Unk unk = unk_0x64[unk_0x26C]; switch (unk.command) { case CMD_SHOW_BTN: { @@ -108,7 +104,6 @@ namespace ipl { } unk_0x268--; } - } return FADER_SCN_CONTINUE; @@ -160,7 +155,7 @@ namespace ipl { mbTrigBtn = true; mpGui->init(); - + mBtnHovered = FALSE; } } @@ -168,9 +163,9 @@ namespace ipl { void SettingButton::onEvent(u32 compId, u32 event, void* data) { gui::PaneComponent* component = static_cast(mpManager->getComponent(compId)); const char* paneName = component->getPane()->GetName(); - + controller::Interface* controller = reinterpret_cast(data); - + switch (event) { case ::gui::EventHandler::ON_POINT: { start_point_event(paneName, controller); @@ -246,5 +241,5 @@ namespace ipl { bool SettingButton::isPlaying() const { return mpLayout->getAnim(ANIM_BTN_FLASH)->isPlaying(); } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/settingSelect/iplSettingSelect.cpp b/src/scene/settingSelect/iplSettingSelect.cpp index 06f142ce..33cd749a 100644 --- a/src/scene/settingSelect/iplSettingSelect.cpp +++ b/src/scene/settingSelect/iplSettingSelect.cpp @@ -1,6 +1,6 @@ #include "scene/settingSelect/iplSettingSelect.h" -#include "scene/settingSelect/iplSettingSelectArg.h" #include "scene/settingSelect/iplSettingButton.h" +#include "scene/settingSelect/iplSettingSelectArg.h" #include "scene/setting/iplSetting.h" @@ -13,8 +13,11 @@ namespace ipl { namespace scene { - #define CHANGE_STATE(x) mPrevState = mState; mState = x +#define CHANGE_STATE(x) \ + mPrevState = mState; \ + mState = x + // clang-format off const char* SettingSelect::mscButtonName[SettingSelect::BTN_MAX] = { "B_DataManage_00", "B_Setting_00", @@ -23,18 +26,11 @@ namespace ipl { "B_Wii_00", "B_Cube_00", }; + // clang-format on - SettingSelect::SettingSelect(EGG::Heap* heap, int arg) : - Base(heap), - ::gui::EventHandler(), - mState(STATE_WAIT_BUTTON_FADE_IN), - mPrevState(STATE_WAIT_BUTTON_FADE_IN), - mSettingArg(arg), - mpLayout(NULL), - mpLayoutFile(NULL), - mpGui(NULL), - unk_0x90(0), - unk_0x94(0) { + SettingSelect::SettingSelect(EGG::Heap* heap, int arg) + : Base(heap), ::gui::EventHandler(), mState(STATE_WAIT_BUTTON_FADE_IN), mPrevState(STATE_WAIT_BUTTON_FADE_IN), mSettingArg(arg), + mpLayout(NULL), mpLayoutFile(NULL), mpGui(NULL), unk_0x90(0), unk_0x94(0) { setSceneParentFlags(SCN_PARENTFLAG_CALC | SCN_PARENTFLAG_DRAW); } @@ -98,7 +94,7 @@ namespace ipl { mpLayout->bindToGroup("it_ObjSetUp_a_SaveDataFoucusFlash.brlan", "G_Cube_01", false, false); mpLayout->bindToGroup("it_ObjSetUp_a_SaveDataOut.brlan", "G_Cube_00", false, false); mpLayout->bindToGroup("it_ObjSetUp_a_SaveDataBack.brlan", "G_Cube_00", false, false); - + mpLayout->finishBinding(); mpGui = new gui::PaneManager(this, mpLayout->getDrawInfo(), NULL, NULL, true); @@ -108,8 +104,7 @@ namespace ipl { if (mSettingArg == SettingSelectArg::ARG_START_NORMAL) { mpGui->setTriggerTarget(mpLayout->FindPaneByName(mscButtonName[BTN_DATA_MANAGE]), true); mpGui->setTriggerTarget(mpLayout->FindPaneByName(mscButtonName[BTN_SETTING]), true); - } - else { + } else { mpGui->setTriggerTarget(mpLayout->FindPaneByName(mscButtonName[BTN_SAVEDATA]), true); mpGui->setTriggerTarget(mpLayout->FindPaneByName(mscButtonName[BTN_CHANNEL]), true); } @@ -202,14 +197,13 @@ namespace ipl { void SettingSelect::stt_wait_button_fadein() { SettingButton* settingButton = static_cast(System::getSceneManager()->getScene(SCENE_SETTING_BUTTON)); - if (System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT - && settingButton != NULL && settingButton->getSceneFadeState() != FaderSceneBase::STT_FADE_IN) { + if (System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT && settingButton != NULL && + settingButton->getSceneFadeState() != FaderSceneBase::STT_FADE_IN) { if (mSettingArg == SettingSelectArg::ARG_START_NORMAL) { mpLayout->getAnim(ANIM_DATA_MANAGE_IN)->play(); mpLayout->getAnim(ANIM_SETTING_IN)->play(); CHANGE_STATE(STATE_1ST_WAIT_FADE_IN); - } - else { + } else { layout::Animator* anim = mpLayout->getAnim(ANIM_DATA_MANAGE_FLASH); anim->initAnmFrame(anim->getMaxFrame()); @@ -231,8 +225,7 @@ namespace ipl { if (unk_0x90 != 0) { System::getFader()->fadeOut(); CHANGE_STATE(STATE_WAIT_BLACK_OUT); - } - else { + } else { mpGui->setTriggerTarget(mpLayout->FindPaneByName(mscButtonName[BTN_DATA_MANAGE]), false); mpGui->setTriggerTarget(mpLayout->FindPaneByName(mscButtonName[BTN_SETTING]), false); mpGui->setTriggerTarget(mpLayout->FindPaneByName(mscButtonName[BTN_SAVEDATA]), true); @@ -257,8 +250,7 @@ namespace ipl { if (unk_0x90 != 0) { CHANGE_STATE(STATE_WAIT_CHILD); reset_gui(); - } - else { + } else { mpGui->setTriggerTarget(mpLayout->FindPaneByName(mscButtonName[BTN_SAVEDATA]), false); mpGui->setTriggerTarget(mpLayout->FindPaneByName(mscButtonName[BTN_CHANNEL]), false); mpGui->setTriggerTarget(mpLayout->FindPaneByName(mscButtonName[BTN_WII_SAVE]), true); @@ -329,8 +321,7 @@ namespace ipl { System::getChannelManager()->refreshAsync(); CHANGE_STATE(STATE_16); - } - else { + } else { mpLayout->getAnim(ANIM_DATA_MANAGE_BACK)->play(); mpLayout->getAnim(ANIM_SETTING_IN)->play(); mpLayout->getAnim(ANIM_SAVE_DATA_OUT)->play(); @@ -374,19 +365,19 @@ namespace ipl { } void SettingSelect::stt_wait_child() { - if (getChild() == NULL && System::getReservedScene() == NULL) { + if (getChild() == NULL && System::getReservedScene() == NULL) { int backAnim = -1; int inAnim = -1; switch (unk_0x90) { case 13: { - #ifndef KOREAN_BUILD +#ifndef KOREAN_BUILD backAnim = ANIM_WII_SAVE_DATA_BACK; inAnim = ANIM_GC_SAVE_DATA_IN; - #else +#else backAnim = ANIM_SAVE_DATA_BACK; inAnim = ANIM_CHANNEL_IN; - #endif +#endif break; } case 14: { @@ -408,7 +399,7 @@ namespace ipl { mpLayout->getAnim(inAnim)->play(); CHANGE_STATE(STATE_WAIT_CHILD_ANIM); - } + } } void SettingSelect::stt_wait_child_anm() { @@ -422,11 +413,11 @@ namespace ipl { case 13: case 14: { static_cast(System::getScene(SCENE_SETTING_BUTTON))->showWii(); - #ifndef KOREAN_BUILD +#ifndef KOREAN_BUILD CHANGE_STATE(STATE_3RD_NORMAL); - #else +#else CHANGE_STATE(STATE_2ND_NORMAL); - #endif +#endif break; } } @@ -500,10 +491,9 @@ namespace ipl { BOOL SettingSelect::condition(int btnNo) { BOOL result = FALSE; - if (btnNo != -1 && - (((btnNo == BTN_DATA_MANAGE || btnNo == BTN_SETTING) && mState == STATE_1ST_NORMAL) - || ((btnNo == BTN_SAVEDATA || btnNo == BTN_CHANNEL) && mState == STATE_2ND_NORMAL) - || ((btnNo == BTN_WII_SAVE || btnNo == BTN_GC_SAVE) && mState == STATE_3RD_NORMAL))) { + if (btnNo != -1 && (((btnNo == BTN_DATA_MANAGE || btnNo == BTN_SETTING) && mState == STATE_1ST_NORMAL) || + ((btnNo == BTN_SAVEDATA || btnNo == BTN_CHANNEL) && mState == STATE_2ND_NORMAL) || + ((btnNo == BTN_WII_SAVE || btnNo == BTN_GC_SAVE) && mState == STATE_3RD_NORMAL))) { result = TRUE; } @@ -605,15 +595,15 @@ namespace ipl { break; } case BTN_SAVEDATA: { - #ifdef KOREAN_BUILD +#ifdef KOREAN_BUILD unk_0x90 = 13; - #endif +#endif flashAnim = ANIM_SAVE_DATA_FLASH; outAnim = ANIM_CHANNEL_OUT; - #ifdef KOREAN_BUILD +#ifdef KOREAN_BUILD createChildScene(SCENE_MEMORY, this, NULL); static_cast(System::getScene(SCENE_SETTING_BUTTON))->hideWii(); - #endif +#endif CHANGE_STATE(STATE_2ND_WAIT_FADE_OUT); if (mSettingArg == SettingSelectArg::ARG_START_SAVE_DATA) { static_cast(System::getScene(SCENE_SETTING_BUTTON))->showBtn(); @@ -655,7 +645,7 @@ namespace ipl { if (flashAnim != -1) { // Play flash anim mpLayout->getAnim(flashAnim)->play(); - mpLayout->getAnim(flashAnim+1)->play(); + mpLayout->getAnim(flashAnim + 1)->play(); // Play out anim mpLayout->getAnim(outAnim)->play(); @@ -666,20 +656,20 @@ namespace ipl { bool SettingSelect::is_stopped_all_anm() const { bool result = true; - + for (int i = 0; i < ANIM_MAX; i++) { result &= !mpLayout->getAnim(i)->isPlaying(); } - + return result; } void SettingSelect::onEvent(u32 compId, u32 event, void* data) { gui::PaneComponent* component = static_cast(mpManager->getComponent(compId)); const char* paneName = component->getPane()->GetName(); - + controller::Interface* controller = reinterpret_cast(data); - + switch (event) { case ::gui::EventHandler::ON_POINT: { start_point_event(paneName, controller); @@ -779,8 +769,7 @@ namespace ipl { if (System::getDataManagerArg() != NULL) { __OSLaunchTitlelForSystem(System::getBS2LaunchTitle(), 5, System::getDataManagerArg(), NULL); - } - else { + } else { OSRebootSystem(); } @@ -789,5 +778,5 @@ namespace ipl { } } } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/textBalloon/iplBalloon.cpp b/src/scene/textBalloon/iplBalloon.cpp index eaaf6b7c..0d5b74f7 100644 --- a/src/scene/textBalloon/iplBalloon.cpp +++ b/src/scene/textBalloon/iplBalloon.cpp @@ -10,17 +10,11 @@ namespace ipl { namespace scene { - TextBalloon::TextBalloon(EGG::Heap* heap, nand::LayoutFile* layoutFile, const char* directory, const char* fileName, const math::VEC3& unk2, f32 unk3, f32 unk4) : - unk_0x08(FALSE), - mpText(NULL), - mTextLen(0), - mBalloonPos(unk2), - unk_0x28(0), - unk_0x2C(1), - unk_0x30(unk3), - unk_0x34(unk4), - mWaitUntilFadeIn(0) { - mpLayout = new(heap, 4) layout::Object(heap, layoutFile, directory, fileName); + TextBalloon::TextBalloon(EGG::Heap* heap, nand::LayoutFile* layoutFile, const char* directory, const char* fileName, const math::VEC3& unk2, + f32 unk3, f32 unk4) + : unk_0x08(FALSE), mpText(NULL), mTextLen(0), mBalloonPos(unk2), unk_0x28(0), unk_0x2C(1), unk_0x30(unk3), unk_0x34(unk4), + mWaitUntilFadeIn(0) { + mpLayout = new (heap, 4) layout::Object(heap, layoutFile, directory, fileName); mpLayout->bind("my_IplTopBalloon_a_BalloonInOut.brlan"); mpLayout->finishBinding(); @@ -157,8 +151,7 @@ namespace ipl { mpLayout->getAnim()->setAnmType(ANIM_TYPE_BACKWARD); mpLayout->getAnim()->restart(); } - } - else if (unk_0x08 == TRUE) { + } else if (unk_0x08 == TRUE) { mWaitUntilFadeIn = 0; unk_0x08 = FALSE; } @@ -175,8 +168,7 @@ namespace ipl { if (SCGetAspectRatio() == SC_ASPECT_RATIO_16x9) { temp0 = unk_0x30; - } - else { + } else { temp0 = unk_0x34; } @@ -189,7 +181,7 @@ namespace ipl { System::getProjectionRect(&proj16x9); System::getProjectionRect4x3(&proj4x3); - switch(unk_0x28) { + switch (unk_0x28) { case 1: { temp1 = get_size("W_Base")->width / 2; break; @@ -211,8 +203,7 @@ namespace ipl { if (temp2 < temp0) { temp3 = temp0 - temp2; - } - else if (temp4 < temp0) { + } else if (temp4 < temp0) { temp3 = temp4 - temp0; } @@ -231,7 +222,7 @@ namespace ipl { strLen = 32; } - wchar_t fullStr[(32+3)] = L""; + wchar_t fullStr[(32 + 3)] = L""; wcsncpy(fullStr, text, 32); @@ -251,22 +242,20 @@ namespace ipl { } if (System::getRegion() == SC_PRODUCT_AREA_JPN) { - fullStr[i-1] = NULL; - fullStr[i-2] = L'…'; - } - else { + fullStr[i - 1] = NULL; + fullStr[i - 2] = L'…'; + } else { temp1 = -1.179962f; extraLen = 2; - fullStr[i+1] = NULL; - fullStr[i] = '.'; - fullStr[i-1] = '.'; - fullStr[i-2] = '.'; + fullStr[i + 1] = NULL; + fullStr[i] = '.'; + fullStr[i - 1] = '.'; + fullStr[i - 2] = '.'; } } - } - else { + } else { textPane->FreeStringBuffer(); - textPane->AllocStringBuffer((32+3)); + textPane->AllocStringBuffer((32 + 3)); textPane->SetString(fullStr); } @@ -276,9 +265,7 @@ namespace ipl { System::getProjectionRect16x9(&proj16x9); f32 locationAdjust = proj16x9.GetWidth() / proj4x3.GetWidth(); - f32 temp1 = SCGetAspectRatio() == SC_ASPECT_RATIO_16x9 ? - locationAdjust : - 1.0f; + f32 temp1 = SCGetAspectRatio() == SC_ASPECT_RATIO_16x9 ? locationAdjust : 1.0f; nw4r::ut::Rect textRect = textPane->GetTextDrawRect(*mpLayout->getDrawInfo()); @@ -300,5 +287,5 @@ namespace ipl { const nw4r::lyt::Size& size = mpLayout->FindPaneByName(paneName)->GetSize(); return &size; } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/scene/textWriter/iplTextWriter.cpp b/src/scene/textWriter/iplTextWriter.cpp index 84a2fee5..2c43f743 100644 --- a/src/scene/textWriter/iplTextWriter.cpp +++ b/src/scene/textWriter/iplTextWriter.cpp @@ -1,10 +1,11 @@ #include "iplSceneUI.h" -#include "scene/textWriter/iplTextWriter.h" +#include "scene/board/iplBoard.h" #include "scene/button/iplButton.h" #include "scene/faceSelect/iplFaceSelect.h" #include "scene/mailAddSel/iplMailAddressSelect.h" -#include "scene/board/iplBoard.h" +#include "scene/textWriter/iplTextWriter.h" + #include #include @@ -34,19 +35,13 @@ namespace ipl { textWriter->setNigaoe(obj); } - TextWriter::TextWriter(EGG::Heap* heap) : - FaderSceneBase(heap), - mState(STATE_NORMAL), - mSelectedFaceId(-1), - mpNigaoe(NULL), - mbClosing(false), - unk_0x7D(true), - mNwc24ErrCountdown(0) { + TextWriter::TextWriter(EGG::Heap* heap) + : FaderSceneBase(heap), mState(STATE_NORMAL), mSelectedFaceId(-1), mpNigaoe(NULL), mbClosing(false), unk_0x7D(true), + mNwc24ErrCountdown(0) { setSceneParentFlags(SCN_PARENTFLAG_DRAW | SCN_PARENTFLAG_CALC); } TextWriter::~TextWriter() { - } void TextWriter::destroy() { @@ -100,7 +95,7 @@ namespace ipl { f32 f0 = 30.0f; f32 f1 = 120.0f; mpNigaoeBalloon = new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f), f1, f0); - + // Scroller mpScroller = new utility::YoungBScroller(); } @@ -227,8 +222,8 @@ namespace ipl { // Calculate scrolling mpScroller->calc(); if (mpScroller->isActive()) { - if ((getMemoInputForm()->getScroll() < getMemoInputForm()->getScrollMax() && mpScroller->isDown()) - || ( getMemoInputForm()->getScroll() > 0.0f && mpScroller->isUp() )) { + if ((getMemoInputForm()->getScroll() < getMemoInputForm()->getScrollMax() && mpScroller->isDown()) || + (getMemoInputForm()->getScroll() > 0.0f && mpScroller->isUp())) { // Memo scrolling getMemoInputForm()->setAddScroll(mpScroller->getSpeed(), mpScroller->isUp(), mpScroller->isDown()); @@ -236,26 +231,22 @@ namespace ipl { if (mpScroller->isUp()) { if (getMemoInputForm()->getScroll() + mpScroller->getSpeed() < getMemoInputForm()->getScrollMax()) { mpScroller->addSoundFreq(mpScroller->getSpeed()); + } else { + mpScroller->addSoundFreq((getMemoInputForm()->getScroll() + mpScroller->getSpeed()) - + getMemoInputForm()->getScrollMax()); } - else { - mpScroller->addSoundFreq((getMemoInputForm()->getScroll() + mpScroller->getSpeed()) - getMemoInputForm()->getScrollMax()); - } - } - else if (mpScroller->isDown()) { + } else if (mpScroller->isDown()) { if (getMemoInputForm()->getScroll() + mpScroller->getSpeed() > 0.0f) { mpScroller->addSoundFreq(mpScroller->getSpeed()); - } - else { + } else { mpScroller->addSoundFreq(getMemoInputForm()->getScroll() + mpScroller->getSpeed()); } } - } - else { + } else { getMemoInputForm()->setAddScroll(0.0f, false, false); } } - } - else { + } else { getMemoInputForm()->setAddScroll(0.0f, false, false); } } @@ -268,9 +259,9 @@ namespace ipl { getButton()->setEventHandler(NULL); static_cast(System::getScene(SCENE_MAIL_ADDRESS_SELECT))->finishMemo(mbClosing); - + System::getKeyboard()->endMgr(); - + mpNigaoeBalloon->calc(); } @@ -336,8 +327,7 @@ namespace ipl { System::getDialog()->callBtn1(MESG_TEXTWRITER_NO_MII, MESG_CMN_OK); return false; - } - else { + } else { // Miis found System::getKeyboard()->deactivate(); @@ -385,8 +375,7 @@ namespace ipl { mpNigaoeBalloon->fadeoutForce(); mState = STATE_DONE; - } - else if (Button::cmpButtonName(paneName, Button::BTN_CREATE_R_BUTTON) == 0) { + } else if (Button::cmpButtonName(paneName, Button::BTN_CREATE_R_BUTTON) == 0) { button->animation(Button::IDANIM_SELECT_CREATE_R); button->setEventHandler(NULL); @@ -418,7 +407,7 @@ namespace ipl { NWC24UserId myUserId; getMyUserID(&myUserId); if (sendMessageByNWC24(myUserId, mWCString) != 0) { - OSReport("送信失敗\n"); // "Send failure" + OSReport("送信失敗\n"); // "Send failure" } closeNWC24(); @@ -457,13 +446,11 @@ namespace ipl { if (System::getNwc24Manager()->open()) { mState = STATE_NORMAL; onSend(); - } - else { + } else { if (mState == STATE_NORMAL) { mState = STATE_SEND; mNwc24ErrCountdown = 0; - } - else if (mState == STATE_SEND) { + } else if (mState == STATE_SEND) { if ((mNwc24ErrCountdown += 1) >= 300) { mState = STATE_SEND_ERR; System::getDialog()->callBtn1(MESG_TEXTWRITER_SEND_ERROR, MESG_CMN_OK); @@ -491,7 +478,8 @@ namespace ipl { // Set memo contents if (*wcString != 0) { - if (!System::getNwc24Manager()->setMsgText(&msgObj, (char*)wcString, wcslen(wcString) * sizeof(wchar_t), NWC24_UTF_16BE, NWC24_ENC_8BIT)) { + if (!System::getNwc24Manager()->setMsgText(&msgObj, (char*)wcString, wcslen(wcString) * sizeof(wchar_t), NWC24_UTF_16BE, + NWC24_ENC_8BIT)) { OSReport("NWC24SetMsgText err\n"); return SEND_ERR_NWC24; } @@ -552,8 +540,7 @@ namespace ipl { int faceId = mpNigaoe->getIndex(); if (faceId >= 0) { faceName = (wchar_t*)RFLiGetCharData(faceId)->name; - } - else { + } else { faceName = NULL; } mpNigaoeBalloon->init(faceName, RFL_NAME_LENGTH); @@ -575,5 +562,5 @@ namespace ipl { Button* TextWriter::getButton() { return static_cast(System::getScene(SCENE_BUTTON)); } - } -} + } // namespace scene +} // namespace ipl diff --git a/src/system/TVRC.cpp b/src/system/TVRC.cpp index 6008bb0b..5ed7f459 100644 --- a/src/system/TVRC.cpp +++ b/src/system/TVRC.cpp @@ -2,58 +2,58 @@ #include -#include #include +#include #include #include namespace LibTVRC { - const char* TVRC_FILE_HEADER = "TVR0"; - u32 __tienHoseiNsec = 1100; - u32 _limitMilli = 400; + const char* TVRC_FILE_HEADER = "TVR0"; + u32 __tienHoseiNsec = 1100; + u32 _limitMilli = 400; - ARCHandle _database ALIGN32; - OSAlarm _alarm; + ARCHandle _database ALIGN32; + OSAlarm _alarm; - BOOL _isRepeatActive; - BOOL _isUseRepeatCode; + BOOL _isRepeatActive; + BOOL _isUseRepeatCode; - u32 _lastError; - void* _tvrcFile; - undefined4 _Hz; - undefined4 _onTimeRatio; + u32 _lastError; + void* _tvrcFile; + undefined4 _Hz; + undefined4 _onTimeRatio; - int _makerID; - int _typeNo; + int _makerID; + int _typeNo; - BOOL _isUseCustomParams; - BOOL _isInitialized; - BOOL _isActive; - BOOL _isReserveDeactive; + BOOL _isUseCustomParams; + BOOL _isInitialized; + BOOL _isActive; + BOOL _isReserveDeactive; - OSTime _unitStartTime; - OSTime _unitLastTime; - OSTime _totalStartTime; + OSTime _unitStartTime; + OSTime _unitLastTime; + OSTime _totalStartTime; - BOOL _isOnOff; - BOOL _isLastOnOff; + BOOL _isOnOff; + BOOL _isLastOnOff; - int _ctCombo; + int _ctCombo; - int _func0state; - int _loop0count; + int _func0state; + int _loop0count; - int _func1state; + int _func1state; - u32 _bitLength; - u32 _bitArray; - u32 _repeatBitLength; - u32 _repeatBitArray; + u32 _bitLength; + u32 _bitArray; + u32 _repeatBitLength; + u32 _repeatBitArray; - OSTime _tickT; - OSTime _tickWait[2]; -} + OSTime _tickT; + OSTime _tickWait[2]; +} // namespace LibTVRC using namespace LibTVRC; @@ -81,12 +81,12 @@ BOOL TVRCInit(void* pRsrc) { } BOOL TVRCSetModelType(int makerID, int typeNo, void* pFileData, int length) { - ARCDir dir; - ARCDirEntry dirEntry; - char dirName[16]; + ARCDir dir; + ARCDirEntry dirEntry; + char dirName[16]; - ARCFileInfo file; - int fileLen; + ARCFileInfo file; + int fileLen; if (_isInitialized == FALSE || _database.archiveStartAddr == NULL) { return FALSE; @@ -136,9 +136,8 @@ void TVRCSetRepeatTimeout(u32 value) { BOOL TVRCSendStopAsync() { if (!_isInitialized || !_isActive) { return FALSE; - - } - else { + + } else { _isReserveDeactive = TRUE; return TRUE; } diff --git a/src/system/enc_dummy.c b/src/system/enc_dummy.c index 44a15420..5ee153c0 100644 --- a/src/system/enc_dummy.c +++ b/src/system/enc_dummy.c @@ -10,51 +10,45 @@ // Dummy out Japanese encoding stuff #ifdef KOREAN_BUILD -BOOL enc_tbl_jp_loaded = FALSE; +BOOL enc_tbl_jp_loaded = FALSE; -u16* enc_tbl_jp_wctomb = NULL; -u16* enc_tbl_jp_mbtowc = NULL; - -u16* enc_offset_jp = NULL; -#endif // KOREAN_BUILD +u16* enc_tbl_jp_wctomb = NULL; +u16* enc_tbl_jp_mbtowc = NULL; +u16* enc_offset_jp = NULL; +#endif // KOREAN_BUILD // Dummy out Chinese encoding stuff -BOOL enc_tbl_cn_loaded = FALSE; +BOOL enc_tbl_cn_loaded = FALSE; -u16* enc_tbl_cn_wctomb = NULL; -u16* enc_tbl_cn_mbtowc = NULL; +u16* enc_tbl_cn_wctomb = NULL; +u16* enc_tbl_cn_mbtowc = NULL; -u16* enc_offset_cn = NULL; - -u16* enc_tbl_cnex_mbtowc = NULL; +u16* enc_offset_cn = NULL; +u16* enc_tbl_cnex_mbtowc = NULL; // Dummy out Korean encoding stuff #ifndef KOREAN_BUILD -u16* enc_tbl_kr_wctomb1 = NULL; -u16* enc_tbl_kr_mbtowc1 = NULL; +u16* enc_tbl_kr_wctomb1 = NULL; +u16* enc_tbl_kr_mbtowc1 = NULL; -u16* enc_offset_kr1 = NULL; -#endif // KOREAN_BUILD - -BOOL enc_tbl_kr_loaded = FALSE; +u16* enc_offset_kr1 = NULL; +#endif // KOREAN_BUILD +BOOL enc_tbl_kr_loaded = FALSE; // Dummy out more Korean encoding stuff -u16* enc_tbl_kr_wctomb2 = NULL; -u16* enc_tbl_kr_mbtowc2 = NULL; +u16* enc_tbl_kr_wctomb2 = NULL; +u16* enc_tbl_kr_mbtowc2 = NULL; u16* enc_offset_kr2 = 0; - // Dummy out (yet again) MORE Korean encoding stuff #ifndef KOREAN_BUILD -BOOL enc_tbl_uhc_loaded = FALSE; - -u16* enc_tbl_uhc_mbtowc = NULL; - -u16* enc_offset_uhc = NULL; -#endif // KOREAN_BUILD +BOOL enc_tbl_uhc_loaded = FALSE; +u16* enc_tbl_uhc_mbtowc = NULL; +u16* enc_offset_uhc = NULL; +#endif // KOREAN_BUILD diff --git a/src/system/iplBS2Manager.cpp b/src/system/iplBS2Manager.cpp index b09f7489..36934d01 100644 --- a/src/system/iplBS2Manager.cpp +++ b/src/system/iplBS2Manager.cpp @@ -4,8 +4,8 @@ #include "iplSound.h" -#include #include +#include #include @@ -13,22 +13,11 @@ namespace ipl { namespace bs2 { - Manager::Manager(EGG::Heap* heap) : - mIPLState(IPL_STATE_NO_DISK), - mState(BS2_STT_NO_DISK), - unk_0x0C(true), - unk_0x0D(false), - unk_0x0E(false), - unk_0x0F(false), - mbIsDiagDisc(false), - unk_0x11(false), - mbHasBanner(FALSE), - mUnlockedState(BS2_STT_NO_DISK), - mbStartUpdate(false), - mEntries(NULL), - mEntrySize(1), - mEntryOffset(0) { - mpBannerBuffer = new(heap, DEFAULT_ALIGN) u8[BS2_DEFAULT_BANNER_SIZE]; + Manager::Manager(EGG::Heap* pHeap) + : mIPLState(IPL_STATE_NO_DISK), mState(BS2_STT_NO_DISK), unk_0x0C(true), unk_0x0D(false), unk_0x0E(false), unk_0x0F(false), + mbIsDiagDisc(false), unk_0x11(false), mbHasBanner(FALSE), mUnlockedState(BS2_STT_NO_DISK), mbStartUpdate(false), mEntries(NULL), + mEntrySize(1), mEntryOffset(0) { + mpBannerBuffer = new (pHeap, DEFAULT_ALIGN) u8[BS2_DEFAULT_BANNER_SIZE]; BS2SetBannerBuffer(mpBannerBuffer, BS2_DEFAULT_BANNER_SIZE); } @@ -47,8 +36,7 @@ namespace ipl { unk_0x0C = true; mIPLState = IPL_STATE_NO_DISK; unk_0x0F = false; - } - else if (unk_0x0C) { + } else if (unk_0x0C) { BOOL old = OSDisableInterrupts(); mState = BS2Tick(); @@ -93,8 +81,7 @@ namespace ipl { for (int i = 0; i < entryMax; i++) { mEntrySize += mEntries[i].size; } - } - else { + } else { mEntrySize = 1; mEntryOffset = 0; } @@ -108,8 +95,12 @@ namespace ipl { unk_0x0C = false; } - void Manager::startRVLGame() { bootNewSystem(); } - void Manager::startGCGame() { bootNewSystem(); } + void Manager::startRVLGame() { + bootNewSystem(); + } + void Manager::startGCGame() { + bootNewSystem(); + } void Manager::abort() { unk_0x0E = true; @@ -127,12 +118,14 @@ namespace ipl { return BS2CheckParentalControl(); } - void Manager::getDiskInfo(char** diskID, char** diskMaker) { + void Manager::getDiskInfo(char** pDiskID, char** pDiskMaker) { // Disc info is from BI read by BS2 OSBootInfo* bi = (OSBootInfo*)OSPhysicalToCached(OS_ADDR_BOOT_INFO); - if (diskID) *diskID = (char*)bi->DVDDiskID.gameName; - if (diskMaker) *diskMaker = (char*)bi->DVDDiskID.company; + if (pDiskID) + *pDiskID = (char*)bi->DVDDiskID.gameName; + if (pDiskMaker) + *pDiskMaker = (char*)bi->DVDDiskID.company; } BOOL Manager::isTitleAvailable(ESTitleId titleId) const { @@ -141,8 +134,7 @@ namespace ipl { BS2GetLockedTitles(NULL, &count); if (count != 0 && BS2IsTitleAvailable(titleId)) { return TRUE; - } - else { + } else { return FALSE; } } @@ -227,30 +219,20 @@ namespace ipl { if (unk_0x0D) { if (state == BS2_STT_RUN_UPDATE) { BS2StartUpdate(); - } - else { + } else { mbStartUpdate = false; } - } - else if (unk_0x0E) { - if (state == BS2_STT_NO_DISK - || state == BS2_STT_COVER_OPEN - || state == BS2_STT_55 - || state == BS2_STT_WRONG_DISK - || state == BS2_STT_66 - || state == BS2_STT_67 - || state == BS2_STT_68 - || state == BS2_STT_FATAL_ERROR - || state == BS2_STT_UPDATE_FAILED - || state == BS2_STT_DIRTY_DISK) { + } else if (unk_0x0E) { + if (state == BS2_STT_NO_DISK || state == BS2_STT_COVER_OPEN || state == BS2_STT_55 || state == BS2_STT_WRONG_DISK || + state == BS2_STT_66 || state == BS2_STT_67 || state == BS2_STT_68 || state == BS2_STT_FATAL_ERROR || + state == BS2_STT_UPDATE_FAILED || state == BS2_STT_DIRTY_DISK) { unk_0x0C = false; mIPLState = IPL_STATE_8; - } - else { + } else { BS2AbortStateMachine(); } } - + unk_0x0D = false; unk_0x0E = false; } @@ -263,8 +245,7 @@ namespace ipl { // Find the current entry for (i = 0; i < BS2GetUpdateEntryNum(); i++) { if (BS2GetCurrentEntry() != NULL) { - if (mEntries[i].titleId == BS2GetCurrentEntry()->titleId && - mEntries[i].titleVersion == BS2GetCurrentEntry()->titleVersion) { + if (mEntries[i].titleId == BS2GetCurrentEntry()->titleId && mEntries[i].titleVersion == BS2GetCurrentEntry()->titleVersion) { break; } } @@ -319,21 +300,19 @@ namespace ipl { VIFlush(); VIWaitForRetrace(); - while (!__OSSyncSram()) {} - + while (!__OSSyncSram()) { + } + // Run app! if (mState == BS2_STT_START_GAME) { BS2StartGame(); - } - else if (mState == BS2_STT_START_GC_GAME) { + } else if (mState == BS2_STT_START_GC_GAME) { BS2StartGCGame(); - } - else if (mState == BS2_STT_RESET_SYSTEM) { + } else if (mState == BS2_STT_RESET_SYSTEM) { OSReturnToMenu(); - } - else if (mState == BS2_STT_START_LOCKED_DISK) { + } else if (mState == BS2_STT_START_LOCKED_DISK) { BS2StartGame(); } } - } -} + } // namespace bs2 +} // namespace ipl diff --git a/src/system/iplCdbBackup.cpp b/src/system/iplCdbBackup.cpp index ebeea44d..cd0c9e9d 100644 --- a/src/system/iplCdbBackup.cpp +++ b/src/system/iplCdbBackup.cpp @@ -3,18 +3,13 @@ #include "iplSystem.h" namespace ipl { - const int CdbBackup::unknown = (cdb::Manager::UNKNOWN_VALUE * 0x1400000) / 100; + const int CdbBackup::unknown = (cdb::Manager::UNKNOWN_VALUE * 0x1400000) / 100; - void cdb_backup_delete_task_(void*); - void cdb_backup_move_task_(void*); + void cdb_backup_delete_task_(void*); + void cdb_backup_move_task_(void*); - CdbBackup::CdbBackup() : - mbDoneProcess(false), - mCDBResult(0), - mPrevFreeSize(0), - mTotalFreeSize(0), - mState(STATE_MOUNT_SD), - mState2(STATE_INVALID) { + CdbBackup::CdbBackup() + : mbDoneProcess(false), mCDBResult(0), mPrevFreeSize(0), mTotalFreeSize(0), mState(STATE_MOUNT_SD), mState2(STATE_INVALID) { System::getHomeButtonMenu()->disable(); System::stopReceiveSchedule(); @@ -123,14 +118,13 @@ namespace ipl { SDVFWorker* sdVfWorker = System::getCdbManager()->getSDWorker(); // ... if (System::isSafeMode()) { - } switch (sdVfWorker->get_sd_state()) { case SDVFWorker::SD_STATE_UNAVAILABLE: { break; } case SDVFWorker::SD_STATE_EJECTED: { - // @BUG Should set `bSwapSound` to true + // @bug Should set `bSwapSound` to true System::getDialog()->callBtn2(MESG_CDBBACKUP_ASK_FOR_DELETE, MESG_CMN_NO, MESG_CMN_YES); mState = STATE_DELETING; break; @@ -140,7 +134,7 @@ namespace ipl { break; } default: { - // @BUG Should set `bSwapSound` to true + // @bug Should set `bSwapSound` to true System::getDialog()->callBtn2(MESG_CDBBACKUP_ASK_FOR_BACKUP, MESG_CMN_NO, MESG_CMN_YES); mState = STATE_SD_BACKING; break; @@ -208,8 +202,7 @@ namespace ipl { if (System::getCdbManager()->getSDWorker()->get_sd_state() == SDVFWorker::SD_STATE_INSERTED) { System::getCdbManager()->getSDWorker()->mount_sd_async(); } - } - else { + } else { error_handling(); } @@ -219,15 +212,14 @@ namespace ipl { if (System::getCdbManager()->getSDWorker()->is_working()) { mState = STATE_WAIT_WORKER; mState2 = 8; - } - else { + } else { mState = STATE_SD_CHECK_ERR; } break; } // "No" case DialogWindow::RESULT_RIGHT_BUTTON: { - // @BUG Should set `bSwapSound` to true + // @bug Should set `bSwapSound` to true System::getDialog()->callBtn2(MESG_CDBBACKUP_ASK_FOR_DELETE, MESG_CMN_NO, MESG_CMN_YES); mState = STATE_DELETING_2; break; @@ -243,8 +235,7 @@ namespace ipl { System::getDialog()->callBtn1(MESG_CDBBACKUP_SD_LOCKED, MESG_CMN_OK); mState = STATE_WAIT_RET; mState2 = STATE_MOUNT_SD; - } - else { + } else { sdVfWorker->prepare_cdb_backup_to_sd_async(); mState = STATE_WAIT_WORKER; mState2 = STATE_SD_BACK_PREPARE; @@ -273,8 +264,7 @@ namespace ipl { System::getTask1()->request(cdb_backup_move_task_, this, NULL); System::getDialog()->callBtnPrg(MESG_CDBBACKUP_BACKING); mState = STATE_WAIT_SD_BACKING; - } - else { + } else { System::getDialog()->callBtn1(MESG_CDBBACKUP_SD_UNKNOWN_ERR, MESG_CMN_OK); mState = STATE_WAIT_RET; mState2 = STATE_MOUNT_SD; @@ -289,8 +279,7 @@ namespace ipl { if (mbDoneProcess) { if (fn_8135B1C0() >= 100) { System::getDialog()->setProgBarLength(100); - } - else { + } else { System::getDialog()->terminate(); } mState = STATE_DONE_SD_BACK; @@ -313,8 +302,7 @@ namespace ipl { System::getDialog()->callBtn1(MESG_CDBBACKUP_BACK_SD_FULL, MESG_CMN_OK); mState = STATE_WAIT_RET; mState2 = STATE_CLEAN_SD_BACK; - } - else { + } else { System::getDialog()->callBtn1(MESG_CDBBACKUP_BACK_FINISHED_2, MESG_CMN_OK); mState = STATE_WAIT_FINISH_MSG; mState2 = STATE_FINISHED_2; @@ -388,8 +376,7 @@ namespace ipl { if (cdbManager->isUnderFlow()) { result = FALSE; } - } - else { + } else { result = FALSE; } @@ -401,13 +388,12 @@ namespace ipl { void cdb_backup_delete_task_(void* work) { CdbBackup* cdbBackup = reinterpret_cast(work); - CDBDate beginDate = CDBMakeCDBDate(MIN_YEAR, MIN_MONTH-1, MIN_DAY, MIN_HOUR, MIN_MINUTE, MIN_SECOND); + CDBDate beginDate = CDBMakeCDBDate(MIN_YEAR, MIN_MONTH - 1, MIN_DAY, MIN_HOUR, MIN_MINUTE, MIN_SECOND); // @Bug should be MAX_MONTH-1 CDBDate endDate = CDBMakeCDBDate(MAX_YEAR, MAX_MONTH, MAX_DAY, MAX_HOUR, MAX_MINUTE, MAX_SECOND); - System::getCdbManager()->search(beginDate, endDate, - CDB_SEARCH_DIRECTION_RIGHT, CDB_RECORD_LOCATION_NAND, 0, - cdb_backup_delete_search_cb_, cdbBackup); + System::getCdbManager()->search(beginDate, endDate, CDB_SEARCH_DIRECTION_RIGHT, CDB_RECORD_LOCATION_NAND, 0, cdb_backup_delete_search_cb_, + cdbBackup); System::getCdbManager()->cleanUpEmptyDirectories(CDB_RECORD_LOCATION_NAND); @@ -432,8 +418,7 @@ namespace ipl { if (cdbManager->isUnderFlow()) { result = FALSE; } - } - else { + } else { result = FALSE; } @@ -446,7 +431,7 @@ namespace ipl { void cdb_backup_move_task_(void* work) { CdbBackup* cdbBackup = reinterpret_cast(work); - const CDBDate beginDate = CDBMakeCDBDate(MIN_YEAR, MIN_MONTH-1, MIN_DAY, MIN_HOUR, MIN_MINUTE, MIN_SECOND); + const CDBDate beginDate = CDBMakeCDBDate(MIN_YEAR, MIN_MONTH - 1, MIN_DAY, MIN_HOUR, MIN_MINUTE, MIN_SECOND); // @Bug should be MAX_MONTH-1 const CDBDate endDate = CDBMakeCDBDate(MAX_YEAR, MAX_MONTH, MAX_DAY, MAX_HOUR, MAX_MINUTE, MAX_SECOND); u32 freeSize; @@ -456,12 +441,11 @@ namespace ipl { cdbBackup->set_prev_free_size(freeSize); cdbBackup->set_free_size(freeSize); - System::getCdbManager()->search(beginDate, endDate, - CDB_SEARCH_DIRECTION_RIGHT, CDB_RECORD_LOCATION_NAND, 1, - cdb_backup_move_search_cb_, cdbBackup); + System::getCdbManager()->search(beginDate, endDate, CDB_SEARCH_DIRECTION_RIGHT, CDB_RECORD_LOCATION_NAND, 1, cdb_backup_move_search_cb_, + cdbBackup); System::getCdbManager()->cleanUpEmptyDirectories(CDB_RECORD_LOCATION_NAND); cdbBackup->set_done_process(true); } -} +} // namespace ipl diff --git a/src/system/iplCdbManager.cpp b/src/system/iplCdbManager.cpp index 995d17fc..d34468c4 100644 --- a/src/system/iplCdbManager.cpp +++ b/src/system/iplCdbManager.cpp @@ -13,10 +13,7 @@ namespace ipl { namespace cdb { const int Manager::UNKNOWN_VALUE = 50; - Manager::Manager(EGG::Heap* heap) : - mCDBResult(CDB_ERROR_OK), - mbSDMounted(false), - mSDVFWorker() { + Manager::Manager(EGG::Heap* heap) : mCDBResult(CDB_ERROR_OK), mbSDMounted(false), mSDVFWorker() { OSInitMutex(&mMutex); utility::autoMutexLock lock(mMutex); @@ -32,7 +29,7 @@ namespace ipl { getFreeSize(NULL); - mpSDVFWork = new(heap, 64) u8[SDVFWorker::WORK_SIZE]; + mpSDVFWork = new (heap, 64) u8[SDVFWorker::WORK_SIZE]; } void Manager::closeDatabase() { @@ -40,18 +37,16 @@ namespace ipl { error_handling(err, 77); } - BOOL Manager::createNewRecord(const char* recordName, const char* recordFileType, const OSCalendarTime* dateTime, u32* gameCode, u16* makerCode, - const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, u16 noReplyFlag, - const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, - const void** attachData, u32* attachSize, RBRAttachmentType* attachType) { + BOOL Manager::createNewRecord(const char* recordName, const char* recordFileType, const OSCalendarTime* dateTime, u32* gameCode, + u16* makerCode, const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, + u16 noReplyFlag, const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, + const void** attachData, u32* attachSize, RBRAttachmentType* attachType) { BOOL result = FALSE; u32 bufferSize = 0; // Create RBR buffer - u8* buffer = makeBuffer(recordPos, recordFlags, addr, addrType, noReplyFlag, - titleText, bodyText, faceData, - attachData, attachSize, attachType, - &bufferSize); + u8* buffer = makeBuffer(recordPos, recordFlags, addr, addrType, noReplyFlag, titleText, bodyText, faceData, attachData, attachSize, + attachType, &bufferSize); // Create record with RBR buffer if (buffer != NULL) { @@ -65,17 +60,17 @@ namespace ipl { return result; } - BOOL Manager::writeRecord(CDBRecord* record, const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, u16 noReplyFlag, - const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, - const void** attachData, u32* attachSize, RBRAttachmentType* attachType) { - RBRHeader rbrHeader; - u32 rbrCurOffset; - u32 rbrSize; + BOOL Manager::writeRecord(CDBRecord* record, const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, + u16 noReplyFlag, const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, const void** attachData, + u32* attachSize, RBRAttachmentType* attachType) { + RBRHeader rbrHeader; + u32 rbrCurOffset; + u32 rbrSize; - u32 titleLength; - u32 bodyLength; + u32 titleLength; + u32 bodyLength; - BOOL result = FALSE; + BOOL result = FALSE; // Reset header memset(&rbrHeader, 0, sizeof(rbrHeader)); @@ -95,7 +90,7 @@ namespace ipl { // Get text lengths titleLength = titleText == NULL || *titleText == 0 ? 0 : ((wcslen(titleText) + 4) * sizeof(wchar_t)) & ~(RBR_TITLE_LENGTH_LIMIT - 1); - bodyLength = bodyText == NULL || *bodyText == 0 ? 0 : ((wcslen(bodyText) + 4) * sizeof(wchar_t)) & ~(RBR_BODY_LENGTH_LIMIT - 1); + bodyLength = bodyText == NULL || *bodyText == 0 ? 0 : ((wcslen(bodyText) + 4) * sizeof(wchar_t)) & ~(RBR_BODY_LENGTH_LIMIT - 1); // Get description offset if (titleLength != 0) { @@ -134,7 +129,7 @@ namespace ipl { // The current offset is the size of the board record rbrSize = rbrCurOffset; - u8* buffer = new(System::getMailWorkHeap(), DEFAULT_ALIGN) u8[rbrSize]; + u8* buffer = new (System::getMailWorkHeap(), DEFAULT_ALIGN) u8[rbrSize]; if (buffer != NULL) { u8* rbrBuffer = &buffer[0]; @@ -180,15 +175,14 @@ namespace ipl { } u8* Manager::makeBuffer(const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, u16 noReplyFlag, - const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, - const void** attachData, u32* attachSize, RBRAttachmentType* attachType, - u32* bufferSize) { - RBRHeader rbrHeader; - u32 rbrCurOffset; - u32 rbrSize; + const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, const void** attachData, u32* attachSize, + RBRAttachmentType* attachType, u32* bufferSize) { + RBRHeader rbrHeader; + u32 rbrCurOffset; + u32 rbrSize; - u32 titleLength; - u32 bodyLength; + u32 titleLength; + u32 bodyLength; // Reset header memset(&rbrHeader, 0, sizeof(rbrHeader)); @@ -208,7 +202,7 @@ namespace ipl { // Get text lengths titleLength = titleText == NULL || *titleText == 0 ? 0 : ((wcslen(titleText) + 4) * sizeof(wchar_t)) & ~(RBR_TITLE_LENGTH_LIMIT - 1); - bodyLength = bodyText == NULL || *bodyText == 0 ? 0 : ((wcslen(bodyText) + 4) * sizeof(wchar_t)) & ~(RBR_BODY_LENGTH_LIMIT - 1); + bodyLength = bodyText == NULL || *bodyText == 0 ? 0 : ((wcslen(bodyText) + 4) * sizeof(wchar_t)) & ~(RBR_BODY_LENGTH_LIMIT - 1); // Get description offset if (titleLength != 0) { @@ -250,12 +244,11 @@ namespace ipl { // Add up the board record size with the record attribute to add up the total buffer size *bufferSize = rbrSize + CDB_RECORD_BUFFER_SIZE; - u8* buffer = new(System::getMailWorkHeap(), DEFAULT_ALIGN) u8[rbrSize + CDB_RECORD_BUFFER_SIZE]; + u8* buffer = new (System::getMailWorkHeap(), DEFAULT_ALIGN) u8[rbrSize + CDB_RECORD_BUFFER_SIZE]; if (buffer == NULL) { return NULL; - } - else { + } else { memset(buffer, 0, rbrSize + CDB_RECORD_BUFFER_SIZE); u8* rbrBuffer = &buffer[CDB_RECORD_BUFFER_SIZE]; @@ -310,10 +303,8 @@ namespace ipl { BOOL Manager::isValidType(const char* type) { BOOL result = FALSE; - if (RBRCompareFileType(type, RBRFileType_Txt) == 0 - || RBRCompareFileType(type, RBRFileType_Odh) == 0 - || RBRCompareFileType(type, RBRFileType_Dat) == 0 - || RBRCompareFileType(type, RBRFileType_Log) == 0) { + if (RBRCompareFileType(type, RBRFileType_Txt) == 0 || RBRCompareFileType(type, RBRFileType_Odh) == 0 || + RBRCompareFileType(type, RBRFileType_Dat) == 0 || RBRCompareFileType(type, RBRFileType_Log) == 0) { result = TRUE; } @@ -323,9 +314,8 @@ namespace ipl { BOOL Manager::isTxtValidType(const char* type) { BOOL result = FALSE; - if (RBRCompareFileType(type, RBRFileType_Txt) == 0 - || RBRCompareFileType(type, RBRFileType_Odh) == 0 - || RBRCompareFileType(type, RBRFileType_Dat) == 0) { + if (RBRCompareFileType(type, RBRFileType_Txt) == 0 || RBRCompareFileType(type, RBRFileType_Odh) == 0 || + RBRCompareFileType(type, RBRFileType_Dat) == 0) { result = TRUE; } @@ -345,14 +335,14 @@ namespace ipl { return ((mCDBFreeSize * 100) / 0x1400000) > 50; } - BOOL Manager::createAtOnce(CDBRecord* record, const char* recordName, const char* recordFileType, - u32* gameCode, u16* makerCode, const OSCalendarTime* dateTime, u8* buffer, u32 bufferSize) { + BOOL Manager::createAtOnce(CDBRecord* record, const char* recordName, const char* recordFileType, u32* gameCode, u16* makerCode, + const OSCalendarTime* dateTime, u8* buffer, u32 bufferSize) { utility::autoMutexLock lock(mMutex); CDBErr err; - char makerCodeStr[sizeof(u16)+1]=""; - char gameCodeStr[sizeof(u32)+1]=""; + char makerCodeStr[sizeof(u16) + 1] = ""; + char gameCodeStr[sizeof(u32) + 1] = ""; if (makerCode != NULL) { char* pMCStr = (char*)makerCode; @@ -370,28 +360,22 @@ namespace ipl { if (dateTime == NULL) { if (gameCode != NULL && makerCode != NULL) { - err = CDBDatabasePrivateCreateRecordAtOnce(&mDatabase, record, recordName, recordFileType, - buffer, bufferSize, makerCodeStr, gameCodeStr); - } - else { + err = CDBDatabasePrivateCreateRecordAtOnce(&mDatabase, record, recordName, recordFileType, buffer, bufferSize, makerCodeStr, + gameCodeStr); + } else { err = CDBDatabaseCreateRecordAtOnce(&mDatabase, record, recordName, recordFileType, buffer, bufferSize); } - } - else { + } else { if (gameCode != NULL && makerCode != NULL) { - err = CDBDatabasePrivateCreateRecordAtOnceEx(&mDatabase, record, recordName, recordFileType, - dateTime->year, dateTime->mon, dateTime->mday, - dateTime->hour, dateTime->min, dateTime->sec, - buffer, bufferSize, makerCodeStr, gameCodeStr); - } - else { - err = CDBDatabaseCreateRecordAtOnceEx(&mDatabase, record, recordName, recordFileType, - buffer, bufferSize, - dateTime->year, dateTime->mon, dateTime->mday, - dateTime->hour, dateTime->min, dateTime->sec); + err = CDBDatabasePrivateCreateRecordAtOnceEx(&mDatabase, record, recordName, recordFileType, dateTime->year, dateTime->mon, + dateTime->mday, dateTime->hour, dateTime->min, dateTime->sec, buffer, bufferSize, + makerCodeStr, gameCodeStr); + } else { + err = CDBDatabaseCreateRecordAtOnceEx(&mDatabase, record, recordName, recordFileType, buffer, bufferSize, dateTime->year, + dateTime->mon, dateTime->mday, dateTime->hour, dateTime->min, dateTime->sec); } } - + if (mCDBResult == CDB_ERROR_OUT_OF_SPACE) { if (close(record)) { remove(record); @@ -407,11 +391,11 @@ namespace ipl { return error_handling(err, 707); } - BOOL Manager::search(const CDBDate& begin, const CDBDate& end, - CDBSearchDirection searchDirection, CDBRecordLocation recordLocation, int unk2, - CDBSearchRecordCB searchRecordCB, void* searchRecordWork) { + BOOL Manager::search(const CDBDate& begin, const CDBDate& end, CDBSearchDirection searchDirection, CDBRecordLocation recordLocation, int unk2, + CDBSearchRecordCB searchRecordCB, void* searchRecordWork) { utility::autoMutexLock lock(mMutex); - CDBErr err = CDBDatabaseSearch(&mDatabase, begin, end, searchDirection, NULL, NULL, 0, recordLocation, unk2, searchRecordCB, searchRecordWork); + CDBErr err = + CDBDatabaseSearch(&mDatabase, begin, end, searchDirection, NULL, NULL, 0, recordLocation, unk2, searchRecordCB, searchRecordWork); return error_handling(err, 741); } @@ -505,7 +489,7 @@ namespace ipl { void Manager::getFreeSize(u32* freeSize) { utility::autoMutexLock lock(mMutex); - + mCDBFreeSize = CDBGetFreeSize(); if (mCDBFreeSize < 0) { @@ -569,5 +553,5 @@ namespace ipl { } return result; } - } -} + } // namespace cdb +} // namespace ipl diff --git a/src/system/iplCdbWrapper.cpp b/src/system/iplCdbWrapper.cpp index 7387e059..486ea527 100644 --- a/src/system/iplCdbWrapper.cpp +++ b/src/system/iplCdbWrapper.cpp @@ -1,24 +1,30 @@ #include "system/iplCdbWrapper.h" -#include #include +#include #include "system/iplPlayTimeLog.h" namespace ipl { namespace cdb { namespace wrapper { - BOOL _condition(CDBErr result, int tries); - #define MAX_TRIES 10 + BOOL _condition(CDBErr result, int tries); +#define MAX_TRIES 10 - #define CDB_WRAPPER(r) \ - int tries = 0; \ - CDBErr result; \ - do { result = r; } while (_condition(result, ++tries)); \ - if (tries == MAX_TRIES) { result = CDB_ERROR_FATAL_ERROR; } \ - return result; +#define CDB_WRAPPER(r) \ + int tries = 0; \ + CDBErr result; \ + do { \ + result = r; \ + } while (_condition(result, ++tries)); \ + if (tries == MAX_TRIES) { \ + result = CDB_ERROR_FATAL_ERROR; \ + } \ + return result; - CDBErr init(void* work) { CDB_WRAPPER(CDBInit(work)); } + CDBErr init(void* work) { + CDB_WRAPPER(CDBInit(work)); + } BOOL _condition(CDBErr result, int tries) { BOOL bTryAgain = FALSE; @@ -39,6 +45,6 @@ namespace ipl { return bTryAgain; } - } - } -} + } // namespace wrapper + } // namespace cdb +} // namespace ipl diff --git a/src/system/iplChannelManager.cpp b/src/system/iplChannelManager.cpp index 36294001..a88e154a 100644 --- a/src/system/iplChannelManager.cpp +++ b/src/system/iplChannelManager.cpp @@ -9,8 +9,8 @@ #include "config.h" -#include #include +#include #include #include @@ -18,13 +18,14 @@ namespace ipl { namespace channel { - u32 Manager::mNumFinished; - int Manager::mNumValidChannel; - bool Manager::mDiskChannelFixed; + u32 Manager::mNumFinished; + int Manager::mNumValidChannel; + bool Manager::mDiskChannelFixed; - int Manager::msCurPage; - int Manager::msCurIndex; + int Manager::msCurPage; + int Manager::msCurIndex; + // clang-format off static const u32 scLangLookup[SC_PRODUCT_AREA_MAX][16] = { // Japan { @@ -80,23 +81,19 @@ namespace ipl { -1 }, }; + // clang-format on - Manager::Manager(EGG::Heap* heap) : - mpHeap(heap), - mState(INIT), - mbCanRefresh(0), - unk_0x1B81(false), - mbSetDiskBannerInfo(false), - mPrevNandResult(NAND_RESULT_OK), - mbLoadedChJump(false) { + Manager::Manager(EGG::Heap* heap) + : mpHeap(heap), mState(INIT), mbCanRefresh(0), unk_0x1B81(false), mbSetDiskBannerInfo(false), mPrevNandResult(NAND_RESULT_OK), + mbLoadedChJump(false) { mpLockedMsgFile = NULL; memset(mChannels, 0, sizeof(mChannels)); // Setup buffers - mpDiskIconBuf = new(mpHeap, DEFAULT_ALIGN) u8[0x19000]; - mpDiskBannerBuf = new(mpHeap, DEFAULT_ALIGN) u8[0x80000]; - mpDiskSoundBuf = new(mpHeap, DEFAULT_ALIGN) u8[0x80000]; + mpDiskIconBuf = new (mpHeap, DEFAULT_ALIGN) u8[0x19000]; + mpDiskBannerBuf = new (mpHeap, DEFAULT_ALIGN) u8[0x80000]; + mpDiskSoundBuf = new (mpHeap, DEFAULT_ALIGN) u8[0x80000]; // Reset banner data for (int page = 0; page < MAX_CHANNEL_PAGE; page++) { @@ -205,19 +202,19 @@ namespace ipl { } } - if (page-1 >= 0) { - int lastInRow[MAX_CHANNEL_COLUMN] = { 3, 7, 11 }; + if (page - 1 >= 0) { + int lastInRow[MAX_CHANNEL_COLUMN] = {3, 7, 11}; for (int column = 0; column < MAX_CHANNEL_COLUMN; column++) { - if (mChannels[page-1][lastInRow[column]].state != CHAN_STATE_LOADED) { + if (mChannels[page - 1][lastInRow[column]].state != CHAN_STATE_LOADED) { return FALSE; } } } - if (page+1 < MAX_CHANNEL_PAGE) { - int firstInRow[MAX_CHANNEL_COLUMN] = { 0, 4, 8 }; + if (page + 1 < MAX_CHANNEL_PAGE) { + int firstInRow[MAX_CHANNEL_COLUMN] = {0, 4, 8}; for (int column = 0; column < MAX_CHANNEL_COLUMN; column++) { - if (mChannels[page+1][firstInRow[column]].state != CHAN_STATE_LOADED) { + if (mChannels[page + 1][firstInRow[column]].state != CHAN_STATE_LOADED) { return FALSE; } } @@ -238,8 +235,7 @@ namespace ipl { u64 typeMask; if (ES_TITLE_TYPE(titleId) != 0) { typeMask = 0xFFFFFFFFFFFFFFFF; - } - else { + } else { typeMask = 0x00000000FFFFFFFF; } @@ -248,7 +244,8 @@ namespace ipl { if (mChannels[page][index].loadedBnr) { if (mChannels[page][index].info.primaryType == channel::PRIMARY_TYPE_CHANNEL) { ESTitleId tId = ES_TITLE_ID(mChannels[page][index].info.titleType, mChannels[page][index].info.titleCode); - if (titleId == (tId & typeMask) || TITLE_NO_REGION(tId & typeMask) == TITLE_NO_REGION(titleId & typeMask) && TITLE_REGION(titleId) == TITLE_REGION_ALL) { + if (titleId == (tId & typeMask) || + TITLE_NO_REGION(tId & typeMask) == TITLE_NO_REGION(titleId & typeMask) && TITLE_REGION(titleId) == TITLE_REGION_ALL) { if (outPage) { *outPage = page; } @@ -299,10 +296,9 @@ namespace ipl { if (data != NULL) { strncpy(mChJumpData, data, NWC24_MAX_CHJP_SIZE); - mChJumpData[NWC24_MAX_CHJP_SIZE-1] = 0; + mChJumpData[NWC24_MAX_CHJP_SIZE - 1] = 0; mbLoadedChJump = true; - } - else { + } else { mbLoadedChJump = false; } @@ -320,11 +316,10 @@ namespace ipl { void* Manager::getDiskSound(bool unk) { int diskPage, diskIndex; getDiskChannelLocation(&diskPage, &diskIndex); - + if (mChannels[diskPage][diskIndex].metaHdr->blockHdr.soundSize == 0) { return NULL; - } - else { + } else { return getDiskBannerData(DISK_BANNERDATA_SOUND, unk); } } @@ -332,19 +327,17 @@ namespace ipl { nand::MetaFile* Manager::loadThumbnailAsync(EGG::Heap* heap, int page, int index) { if (!mChannels[page][index].loadedBnr || mChannels[page][index].info.primaryType == channel::PRIMARY_TYPE_DISK) { return NULL; - } - else { + } else { return System::getNandManager()->readMetaBodyAsync(heap, "/meta/icon.bin", &mChannels[page][index].arc, getTitleID(page, index), - mChannels[page][index].headerSize + mChannels[page][index].headerOffset, 0, - NULL, NULL, mChannels[page][index].ticketIdx); + mChannels[page][index].headerSize + mChannels[page][index].headerOffset, 0, NULL, + NULL, mChannels[page][index].ticketIdx); } } ESTitleId Manager::getTitleID(int page, int index) const { if (mChannels[page][index].loadedBnr) { return ES_TITLE_ID(mChannels[page][index].info.titleType, mChannels[page][index].info.titleCode); - } - else { + } else { return 0; } } @@ -352,39 +345,35 @@ namespace ipl { nand::MetaFile* Manager::loadBannerAsync(EGG::Heap* heap, int page, int index) { if (!mChannels[page][index].loadedBnr || mChannels[page][index].info.primaryType == channel::PRIMARY_TYPE_DISK) { return NULL; - } - else { + } else { return System::getNandManager()->readMetaBodyAsync(heap, "/meta/banner.bin", &mChannels[page][index].arc, getTitleID(page, index), - mChannels[page][index].headerSize + mChannels[page][index].headerOffset, 0, - NULL, NULL, mChannels[page][index].ticketIdx); + mChannels[page][index].headerSize + mChannels[page][index].headerOffset, 0, NULL, + NULL, mChannels[page][index].ticketIdx); } } nand::MetaFile* Manager::loadSoundAsync(EGG::Heap* heap, int page, int index) { - if (!mChannels[page][index].loadedBnr || mChannels[page][index].info.primaryType == channel::PRIMARY_TYPE_DISK - || mChannels[page][index].metaHdr->blockHdr.soundSize == 0) { + if (!mChannels[page][index].loadedBnr || mChannels[page][index].info.primaryType == channel::PRIMARY_TYPE_DISK || + mChannels[page][index].metaHdr->blockHdr.soundSize == 0) { return NULL; - } - else { + } else { return System::getNandManager()->readMetaBodyAsync(heap, "/meta/sound.bin", &mChannels[page][index].arc, getTitleID(page, index), - mChannels[page][index].headerSize + mChannels[page][index].headerOffset, 0, - NULL, NULL, mChannels[page][index].ticketIdx); + mChannels[page][index].headerSize + mChannels[page][index].headerOffset, 0, NULL, + NULL, mChannels[page][index].ticketIdx); } } nand::SharedFile* Manager::loadThumbnailRsoAsync(EGG::Heap* heap, int page, int index) { if (!mChannels[page][index].loadedBnr || mChannels[page][index].info.primaryType == channel::PRIMARY_TYPE_DISK) { return NULL; - } - else { + } else { u32 rsoIndex = getChannel(page, index).loadedBnr ? mChannels[page][index].metaHdr->blockHdr.iconRSOIdx : 0; if (rsoIndex == 0) { return NULL; - } - else { + } else { return System::getNandManager()->readSharedAsync(heap, "/arc/icon.rso.lz7", rsoIndex, 0, 0, getTitleID(page, index), - mChannels[page][index].ticketIdx); + mChannels[page][index].ticketIdx); } } } @@ -392,16 +381,14 @@ namespace ipl { nand::SharedFile* Manager::loadBannerRsoAsync(EGG::Heap* heap, int page, int index) { if (!mChannels[page][index].loadedBnr || mChannels[page][index].info.primaryType == channel::PRIMARY_TYPE_DISK) { return NULL; - } - else { + } else { u32 rsoIndex = mChannels[page][index].loadedBnr ? mChannels[page][index].metaHdr->blockHdr.bannerRSOIdx : 0; if (rsoIndex == 0) { return NULL; - } - else { + } else { return System::getNandManager()->readSharedAsync(heap, "/arc/banner.rso.lz7", rsoIndex, 0, 0, getTitleID(page, index), - mChannels[page][index].ticketIdx); + mChannels[page][index].ticketIdx); } } } @@ -409,16 +396,14 @@ namespace ipl { nand::SharedFile* Manager::loadThumbnailCSAsync(EGG::Heap* heap, int page, int index) { if (!mChannels[page][index].loadedBnr || mChannels[page][index].info.primaryType == channel::PRIMARY_TYPE_DISK) { return NULL; - } - else { + } else { u32 rsoIndex = mChannels[page][index].loadedBnr ? mChannels[page][index].metaHdr->blockHdr.iconCSIdx : 0; if (rsoIndex == 0) { return NULL; - } - else { + } else { return System::getNandManager()->readSharedAsync(heap, "/arc/icon.cs.lz7", rsoIndex, 0, 0, getTitleID(page, index), - mChannels[page][index].ticketIdx); + mChannels[page][index].ticketIdx); } } } @@ -426,16 +411,14 @@ namespace ipl { nand::SharedFile* Manager::loadBannerCSAsync(EGG::Heap* heap, int page, int index) { if (!mChannels[page][index].loadedBnr || mChannels[page][index].info.primaryType == channel::PRIMARY_TYPE_DISK) { return NULL; - } - else { + } else { u32 rsoIndex = mChannels[page][index].loadedBnr ? mChannels[page][index].metaHdr->blockHdr.bannerCSIdx : 0; if (rsoIndex == 0) { return NULL; - } - else { + } else { return System::getNandManager()->readSharedAsync(heap, "/arc/banner.cs.lz7", rsoIndex, 0, 0, getTitleID(page, index), - mChannels[page][index].ticketIdx); + mChannels[page][index].ticketIdx); } } } @@ -446,9 +429,9 @@ namespace ipl { delete mpLockedMsgFile; } - mpLockedMsgFile = System::getNandManager()->readMetaBodyAsync(mpHeap, "/meta/diskInMsg.bin", &mChannels[page][index].arc, getTitleID(page, index), - mChannels[page][index].headerSize + mChannels[page][index].headerOffset, 0, - NULL, NULL, mChannels[page][index].ticketIdx); + mpLockedMsgFile = System::getNandManager()->readMetaBodyAsync( + mpHeap, "/meta/diskInMsg.bin", &mChannels[page][index].arc, getTitleID(page, index), + mChannels[page][index].headerSize + mChannels[page][index].headerOffset, 0, NULL, NULL, mChannels[page][index].ticketIdx); } } @@ -513,14 +496,13 @@ namespace ipl { } BOOL Manager::checkNeedUpdate(int page, int index) const { - if (mChannels[page][index].loadedBnr && mChannels[page][index].info.primaryType == PRIMARY_TYPE_CHANNEL - && mChannels[page][index].info.titleType == TITLE_TYPE_SYSTEM_CHANNEL) { - + if (mChannels[page][index].loadedBnr && mChannels[page][index].info.primaryType == PRIMARY_TYPE_CHANNEL && + mChannels[page][index].info.titleType == TITLE_TYPE_SYSTEM_CHANNEL) { // If the news/forecast channel is below version 5 // Or, if the shop channel is below version 2 u32 code = mChannels[page][index].info.titleCode & 0xFFFFFF00; - if ((code == ES_TITLE_CODE(TITLE_NEWS) || code == ES_TITLE_CODE(TITLE_WEATHER)) && mChannels[page][index].tmdVersion <= 5 - || code == ES_TITLE_CODE(TITLE_SHOPPING) && mChannels[page][index].tmdVersion <= 2) { + if ((code == ES_TITLE_CODE(TITLE_NEWS) || code == ES_TITLE_CODE(TITLE_WEATHER)) && mChannels[page][index].tmdVersion <= 5 || + code == ES_TITLE_CODE(TITLE_SHOPPING) && mChannels[page][index].tmdVersion <= 2) { return TRUE; } } @@ -528,9 +510,8 @@ namespace ipl { } BOOL Manager::isParentalRestricted(int page, int index) const { - if (mChannels[page][index].loadedBnr && mChannels[page][index].info.primaryType == PRIMARY_TYPE_CHANNEL - && mChannels[page][index].info.titleType == TITLE_TYPE_SYSTEM_CHANNEL) { - + if (mChannels[page][index].loadedBnr && mChannels[page][index].info.primaryType == PRIMARY_TYPE_CHANNEL && + mChannels[page][index].info.titleType == TITLE_TYPE_SYSTEM_CHANNEL) { // If news channel is verson 6 or above u32 code = mChannels[page][index].info.titleCode & 0xFFFFFF00; if (code == ES_TITLE_CODE(TITLE_NEWS) && mChannels[page][index].tmdVersion >= 6) { @@ -542,7 +523,6 @@ namespace ipl { BOOL Manager::isInternetChannel(int page, int index) const { if (mChannels[page][index].loadedBnr && mChannels[page][index].info.primaryType == PRIMARY_TYPE_CHANNEL) { - u32 code = mChannels[page][index].info.titleCode & 0xFFFFFF00; if (code == ES_TITLE_CODE(TITLE_OPERA)) { return TRUE; @@ -553,9 +533,9 @@ namespace ipl { void Manager::setDiskChannelName() { int diskPage, diskIndex; - getDiskChannelLocation(&diskPage, &diskIndex); // unused + getDiskChannelLocation(&diskPage, &diskIndex); // unused - for (u32 i = 0; i <= SC_LANG_MAX-1; i++) { + for (u32 i = 0; i <= SC_LANG_MAX - 1; i++) { wcsncpy((wchar_t*)mDiskChanMetaHdr.names[i][NAME_INDEX_TITLE], System::getMessage(MESG_DISK_CHANNEL_NAME), META_CHANNEL_NAME_LENGTH); mDiskChanMetaHdr.names[i][NAME_INDEX_TITLE][META_CHANNEL_NAME_LENGTH] = 0; } @@ -592,8 +572,7 @@ namespace ipl { return UNLOCK_STATE_3; } return (System::getBS2Manager()->isTitleAvailable(title) != FALSE) + 1; - } - else { + } else { return UNLOCK_STATE_INVALID; } } @@ -626,17 +605,17 @@ namespace ipl { mgr->loadMetaHeaderAsync(page, column); } - if (page-1 >= 0) { - int lastInRow[MAX_CHANNEL_COLUMN] = { 3, 7, 11 }; + if (page - 1 >= 0) { + int lastInRow[MAX_CHANNEL_COLUMN] = {3, 7, 11}; for (int column = 0; column < MAX_CHANNEL_COLUMN; column++) { - mgr->loadMetaHeaderAsync(page-1, lastInRow[column]); + mgr->loadMetaHeaderAsync(page - 1, lastInRow[column]); } } - if (page+1 < MAX_CHANNEL_PAGE) { - int firstInRow[MAX_CHANNEL_COLUMN] = { 0, 4, 8 }; + if (page + 1 < MAX_CHANNEL_PAGE) { + int firstInRow[MAX_CHANNEL_COLUMN] = {0, 4, 8}; for (int column = 0; column < MAX_CHANNEL_COLUMN; column++) { - mgr->loadMetaHeaderAsync(page+1, firstInRow[column]); + mgr->loadMetaHeaderAsync(page + 1, firstInRow[column]); } } } @@ -648,8 +627,7 @@ namespace ipl { mgr->mTmpChannel.info.titleCode = ES_TITLE_CODE_NOMASK(tmpTitle); mgr->loadTmpMetaHeaderAsync(tmpTitle); - } - else { + } else { if (mgr->mTmpChannel.bnrFile != NULL) { delete mgr->mTmpChannel.bnrFile; } @@ -706,7 +684,7 @@ namespace ipl { if (mTmpChannel.bnrFile != NULL) { delete mTmpChannel.bnrFile; } - mTmpChannel.bnrFile = System::getNandManager()->readMetaHeaderAsync(mpHeap, titleId, 0, sizeof(SChanMgrMetaHeader)+0x100, + mTmpChannel.bnrFile = System::getNandManager()->readMetaHeaderAsync(mpHeap, titleId, 0, sizeof(SChanMgrMetaHeader) + 0x100, cbReadTmpMetaHeader, &mTmpChannel, mTmpChannel.ticketIdx); mTmpChannel.state = CHAN_STATE_LOADED_META; } @@ -716,28 +694,28 @@ namespace ipl { nand::MetaFile* bnrFile = channel->bnrFile; // Check is file was read correctly - if (bnrFile->inNand() && (bnrFile->checkData() == nand::RESULT_VERIFY_ERROR || channel->bnrFile->checkData() == nand::RESULT_OPEN_ERROR)) { + if (bnrFile->inNand() && + (bnrFile->checkData() == nand::RESULT_VERIFY_ERROR || channel->bnrFile->checkData() == nand::RESULT_OPEN_ERROR)) { memset(channel, 0, sizeof(SEntry)); delete channel->bnrFile; channel->bnrFile = NULL; - } - else { + } else { // Search for meta header channel->headerOffset = System::getChannelManager()->searchMetaHeader(channel->bnrFile->getBuffer() + META_PAD); - if (channel->headerOffset < 0 || !System::getChannelManager()->checkHeaderBase((u8*)(channel->headerOffset + channel->bnrFile->getBuffer() + META_PAD), &channel->headerSize)) { + if (channel->headerOffset < 0 || !System::getChannelManager()->checkHeaderBase( + (u8*)(channel->headerOffset + channel->bnrFile->getBuffer() + META_PAD), &channel->headerSize)) { memset(channel, 0, sizeof(SEntry)); delete channel->bnrFile; channel->bnrFile = NULL; - } - else { + } else { bnrFile = channel->bnrFile; channel->metaHdr = (SChanMgrMetaHeader*)(bnrFile->getBuffer() + channel->headerOffset); // Verify file - if ((bnrFile->inNand() && bnrFile->checkData() == nand::RESULT_VERIFY_ERROR) || !System::getChannelManager()->checkHeaderMD5((u8*)channel->metaHdr)) { + if ((bnrFile->inNand() && bnrFile->checkData() == nand::RESULT_VERIFY_ERROR) || + !System::getChannelManager()->checkHeaderMD5((u8*)channel->metaHdr)) { memset(channel, 0, sizeof(SEntry)); - } - else { + } else { // Alright, prepare the ARC! channel->arcData = (u8*)(channel->bnrFile->getBuffer() + channel->headerSize + channel->headerOffset); ARCInitHandle(channel->arcData, &channel->arc); @@ -762,8 +740,7 @@ namespace ipl { memset(&mChannels[page][index], 0, sizeof(SEntry)); mNumFinished++; mChannels[page][index].state = CHAN_STATE_LOADED; - } - else if (info.primaryType == channel::PRIMARY_TYPE_DISK) { + } else if (info.primaryType == channel::PRIMARY_TYPE_DISK) { // Load disk banner mChannels[page][index].loadedBnr = true; if (mChannels[page][index].info.sceneID == SCENE_ID_DISK_CHANNEL) { @@ -775,8 +752,7 @@ namespace ipl { mNumFinished++; mNumValidChannel++; mChannels[page][index].state = CHAN_STATE_LOADED; - } - else { + } else { // Load channel banner ESTitleId titleId = ES_TITLE_ID(mChannels[page][index].info.titleType, mChannels[page][index].info.titleCode); s32 ret = utility::ESMisc::GetValidTicketIndex(System::getMem2Sys(), titleId); @@ -804,9 +780,10 @@ namespace ipl { if (mChannels[page][index].bnrFile != NULL) { delete mChannels[page][index].bnrFile; } - mChannels[page][index].bnrFile = System::getNandManager()->readMetaHeaderAsync(mpHeap, titleId, 0, sizeof(SChanMgrMetaHeader)+0x100, - cbReadMetaHeader, &mChannels[page][index], mChannels[page][index].ticketIdx); - + mChannels[page][index].bnrFile = + System::getNandManager()->readMetaHeaderAsync(mpHeap, titleId, 0, sizeof(SChanMgrMetaHeader) + 0x100, cbReadMetaHeader, + &mChannels[page][index], mChannels[page][index].ticketIdx); + mChannels[page][index].state = CHAN_STATE_LOADED_META; } } @@ -816,28 +793,28 @@ namespace ipl { nand::MetaFile* bnrFile = channel->bnrFile; // Check is file was read correctly - if (bnrFile->inNand() && (bnrFile->checkData() == nand::RESULT_VERIFY_ERROR || channel->bnrFile->checkData() == nand::RESULT_OPEN_ERROR)) { + if (bnrFile->inNand() && + (bnrFile->checkData() == nand::RESULT_VERIFY_ERROR || channel->bnrFile->checkData() == nand::RESULT_OPEN_ERROR)) { memset(channel, 0, sizeof(SEntry)); delete channel->bnrFile; channel->bnrFile = NULL; - } - else { + } else { // Search for meta header channel->headerOffset = System::getChannelManager()->searchMetaHeader(channel->bnrFile->getBuffer() + META_PAD); - if (channel->headerOffset < 0 || !System::getChannelManager()->checkHeaderBase((u8*)(channel->headerOffset + channel->bnrFile->getBuffer() + META_PAD), &channel->headerSize)) { + if (channel->headerOffset < 0 || !System::getChannelManager()->checkHeaderBase( + (u8*)(channel->headerOffset + channel->bnrFile->getBuffer() + META_PAD), &channel->headerSize)) { memset(channel, 0, sizeof(SEntry)); delete channel->bnrFile; channel->bnrFile = NULL; - } - else { + } else { bnrFile = channel->bnrFile; channel->metaHdr = (SChanMgrMetaHeader*)(bnrFile->getBuffer() + channel->headerOffset); // Verify file - if ((bnrFile->inNand() && bnrFile->checkData() == nand::RESULT_VERIFY_ERROR) || !System::getChannelManager()->checkHeaderMD5((u8*)channel->metaHdr)) { + if ((bnrFile->inNand() && bnrFile->checkData() == nand::RESULT_VERIFY_ERROR) || + !System::getChannelManager()->checkHeaderMD5((u8*)channel->metaHdr)) { memset(channel, 0, sizeof(SEntry)); - } - else { + } else { // Alright, prepare the ARC! channel->arcData = (u8*)(channel->bnrFile->getBuffer() + channel->headerSize + channel->headerOffset); ARCInitHandle(channel->arcData, &channel->arc); @@ -856,7 +833,7 @@ namespace ipl { void Manager::makeLoadOrderList(int* list) const { int prevPage = System::getSaveData()->getPrevPage(); *list = prevPage; - int var1 = prevPage+1; + int var1 = prevPage + 1; int i = 1; do { @@ -866,8 +843,7 @@ namespace ipl { list[i++] = var1; } var1 = prevPage - var2; - } - else { + } else { if (var1 >= 0) { list[i++] = var1; } @@ -888,8 +864,7 @@ namespace ipl { SCSetInstalledChannelAppCount(mNumValidChannel); SCSetFreeChannelAppCount(MAX_CHANNEL_TOTAL - mNumValidChannel); result = SC_FLUSH; - } - else { + } else { result = FINISH; } } @@ -916,8 +891,7 @@ namespace ipl { if (state == bs2::IPL_STATE_RUN_RVL_GAME && mBS2State != bs2::IPL_STATE_RUN_RVL_GAME) { mbSetDiskBannerInfo = setDiskBannerInfo(false); unk_0x1B81 = true; - } - else if (state != bs2::IPL_STATE_RUN_RVL_GAME && state != mBS2State) { + } else if (state != bs2::IPL_STATE_RUN_RVL_GAME && state != mBS2State) { setDiskBannerInfo(true); } @@ -938,8 +912,7 @@ namespace ipl { if (next == 4) { return i - 3; } - } - else { + } else { // Otherwise, try again!! next = 0; } @@ -956,7 +929,8 @@ namespace ipl { } // Verify magic and file size - if (!NAND_CHECK_MAGIC4(header->magic, 'I','M','E','T') || myHdrSize < sizeof(SMetaBlockHeader) || myHdrSize > sizeof(SChanMgrMetaHeader)) { + if (!NAND_CHECK_MAGIC4(header->magic, 'I', 'M', 'E', 'T') || myHdrSize < sizeof(SMetaBlockHeader) || + myHdrSize > sizeof(SChanMgrMetaHeader)) { return 0; } @@ -972,7 +946,7 @@ namespace ipl { // Copy sum for (int i = 0; i < NET_MD5_DIGEST_SIZE; i++) { - md5sum[i] = buffer[(size - NET_MD5_DIGEST_SIZE)+i]; + md5sum[i] = buffer[(size - NET_MD5_DIGEST_SIZE) + i]; } // Reset padding @@ -1007,8 +981,7 @@ namespace ipl { mChannels[diskPage][diskIndex].loadedBnrData[i] = false; } return true; - } - else { + } else { if (!System::getBS2Manager()->diskHasBanner()) { return false; } @@ -1031,7 +1004,7 @@ namespace ipl { mChannels[diskPage][diskIndex].arcData = (u8*)(metaBnr) + mChannels[diskPage][diskIndex].headerSize; ARCInitHandle(mChannels[diskPage][diskIndex].arcData, &mChannels[diskPage][diskIndex].arc); - + return true; } } @@ -1057,13 +1030,11 @@ namespace ipl { ARCOpen(&mChannels[diskPage][diskIndex].arc, "/meta/icon.bin", &readFile); destData = &mpDiskIconBuf; readSize = mChannels[diskPage][diskIndex].metaHdr->blockHdr.iconSize; - } - else if (index == DISK_BANNERDATA_BANNER) { + } else if (index == DISK_BANNERDATA_BANNER) { ARCOpen(&mChannels[diskPage][diskIndex].arc, "/meta/banner.bin", &readFile); destData = &mpDiskBannerBuf; readSize = mChannels[diskPage][diskIndex].metaHdr->blockHdr.bannerSize; - } - else if (index == DISK_BANNERDATA_SOUND) { + } else if (index == DISK_BANNERDATA_SOUND) { ARCOpen(&mChannels[diskPage][diskIndex].arc, "/meta/sound.bin", &readFile); destData = &mpDiskSoundBuf; readSize = mChannels[diskPage][diskIndex].metaHdr->blockHdr.soundSize; @@ -1076,16 +1047,15 @@ namespace ipl { NETMD5Sum md5sum; // Verify MD5 magic - if (NAND_CHECK_MAGIC4(md5Block->magic, 'I','M','D','5')) { + if (NAND_CHECK_MAGIC4(md5Block->magic, 'I', 'M', 'D', '5')) { fileLen = md5Block->length; memcpy(md5sum, md5Block->md5, NET_MD5_DIGEST_SIZE); - } - else { + } else { return NULL; } // (Fakematch??) Using both 0x20 and sizeof(MD5Head) otherwise it does not match - if (NAND_CHECK_MAGIC4((u8*)srcData + 0x20, 'L','Z','7','7')) { + if (NAND_CHECK_MAGIC4((u8*)srcData + 0x20, 'L', 'Z', '7', '7')) { if (!mChannels[diskPage][diskIndex].loadedBnrData[index]) { // Uncompress data CXGetUncompressedSize((u8*)srcData + sizeof(MD5Head) + 4); @@ -1098,11 +1068,10 @@ namespace ipl { return NULL; } } - } - else { + } else { if (!mChannels[diskPage][diskIndex].loadedBnrData[index]) { memcpy(*destData, (u8*)srcData + sizeof(MD5Head), readSize); - + mChannels[diskPage][diskIndex].loadedBnrData[index] = true; // Verify MD5 @@ -1160,9 +1129,9 @@ namespace ipl { return (u16*)diskInMsgs->messages[lookup[SC_LANG_JAPANESE]]; } - // Unused?!!! force. - #pragma push - #pragma force_active on +// Unused?!!! force. +#pragma push +#pragma force_active on BOOL Manager::nand_error_handling(int code) { BOOL result = FALSE; @@ -1203,7 +1172,7 @@ namespace ipl { return result; } - #pragma pop +#pragma pop SEntry* Manager::fn_8133A4E0(ESTitleId titleId) { for (int page = 0; page < MAX_CHANNEL_PAGE; page++) { @@ -1229,8 +1198,7 @@ namespace ipl { SEntry* channel = fn_8133A4E0(titleId); if (channel != NULL) { return channel->metaHdr->blockHdr.bannerCSIdx; - } - else { + } else { return 0; } } @@ -1239,8 +1207,7 @@ namespace ipl { SEntry* channel = fn_8133A4E0(titleId); if (channel != NULL) { return channel->metaHdr->blockHdr.soundSize; - } - else { + } else { return 0; } } @@ -1249,8 +1216,7 @@ namespace ipl { SEntry* channel = fn_8133A4E0(titleId); if (channel != NULL && (channel->metaHdr->blockHdr.unk_08 << 8)) { return TRUE; - } - else { + } else { return FALSE; } } @@ -1259,8 +1225,7 @@ namespace ipl { SEntry* channel = fn_8133A4E0(titleId); if (channel != NULL && (channel->metaHdr->blockHdr.unk_14 << 14)) { return TRUE; - } - else { + } else { return FALSE; } } @@ -1269,8 +1234,7 @@ namespace ipl { SEntry* channel = fn_8133A4E0(titleId); if (channel != NULL && channel->missingTicket != FALSE) { return TRUE; - } - else { + } else { return FALSE; } } @@ -1281,12 +1245,11 @@ namespace ipl { return FALSE; } - if (channel->loadedBnr && channel->info.primaryType == channel::PRIMARY_TYPE_CHANNEL - && channel->info.titleType == ES_TITLE_TYPE(TITLE_NEWS) && (channel->info.titleCode & 0xFFFFFF00) == ES_TITLE_CODE(TITLE_NEWS) - && channel->tmdVersion >= 6) { + if (channel->loadedBnr && channel->info.primaryType == channel::PRIMARY_TYPE_CHANNEL && + channel->info.titleType == ES_TITLE_TYPE(TITLE_NEWS) && (channel->info.titleCode & 0xFFFFFF00) == ES_TITLE_CODE(TITLE_NEWS) && + channel->tmdVersion >= 6) { return TRUE; - } - else { + } else { return FALSE; } } @@ -1297,11 +1260,10 @@ namespace ipl { return FALSE; } - if (channel->loadedBnr && channel->info.primaryType == channel::PRIMARY_TYPE_CHANNEL - && (channel->info.titleCode & 0xFFFFFF00) == ES_TITLE_CODE(TITLE_OPERA)) { + if (channel->loadedBnr && channel->info.primaryType == channel::PRIMARY_TYPE_CHANNEL && + (channel->info.titleCode & 0xFFFFFF00) == ES_TITLE_CODE(TITLE_OPERA)) { return TRUE; - } - else { + } else { return FALSE; } } @@ -1314,11 +1276,9 @@ namespace ipl { if (!channel->loadedBnr || channel->info.primaryType == channel::PRIMARY_TYPE_DISK) { return NULL; - } - else { + } else { return System::getNandManager()->readMetaBodyAsync(heap, "/meta/banner.bin", &channel->arc, titleId, - channel->headerSize + channel->headerOffset, 0, - NULL, NULL, channel->ticketIdx); + channel->headerSize + channel->headerOffset, 0, NULL, NULL, channel->ticketIdx); } } @@ -1328,14 +1288,11 @@ namespace ipl { return NULL; } - if (!channel->loadedBnr || channel->info.primaryType == channel::PRIMARY_TYPE_DISK - || channel->metaHdr->blockHdr.soundSize == 0) { + if (!channel->loadedBnr || channel->info.primaryType == channel::PRIMARY_TYPE_DISK || channel->metaHdr->blockHdr.soundSize == 0) { return NULL; - } - else { + } else { return System::getNandManager()->readMetaBodyAsync(heap, "/meta/sound.bin", &channel->arc, titleId, - channel->headerSize + channel->headerOffset, 0, - NULL, NULL, channel->ticketIdx); + channel->headerSize + channel->headerOffset, 0, NULL, NULL, channel->ticketIdx); } } @@ -1347,8 +1304,7 @@ namespace ipl { if (!channel->loadedBnr || channel->info.primaryType == channel::PRIMARY_TYPE_DISK) { return NULL; - } - else { + } else { u32 index = fn_8133A57C(titleId); if (index == 0) { return NULL; @@ -1371,5 +1327,5 @@ namespace ipl { channel->loadedBnr = false; } } - } -} + } // namespace channel +} // namespace ipl diff --git a/src/system/iplChannelRsoThread.cpp b/src/system/iplChannelRsoThread.cpp index 318b6c9e..fc126e7c 100644 --- a/src/system/iplChannelRsoThread.cpp +++ b/src/system/iplChannelRsoThread.cpp @@ -2,14 +2,12 @@ #include -#define STACK_SIZE 0x8000 +#define STACK_SIZE 0x8000 namespace ipl { namespace channel { - RsoThread::RsoThread(EGG::Heap* heap) : - mbStarted(false), - mpCalcFunc(NULL) { - mpStack = new(heap, DEFAULT_ALIGN) u8[STACK_SIZE]; + RsoThread::RsoThread(EGG::Heap* heap) : mbStarted(false), mpCalcFunc(NULL) { + mpStack = new (heap, DEFAULT_ALIGN) u8[STACK_SIZE]; } RsoThread::~RsoThread() { @@ -36,5 +34,5 @@ namespace ipl { mpCalcFunc = func; OSInitMessageQueue(&mCalcQueue, &mCalcMsg, 1); } - } -} + } // namespace channel +} // namespace ipl diff --git a/src/system/iplChannelScriptManager.cpp b/src/system/iplChannelScriptManager.cpp index fe4382d3..b16cd7aa 100644 --- a/src/system/iplChannelScriptManager.cpp +++ b/src/system/iplChannelScriptManager.cpp @@ -8,9 +8,9 @@ namespace ipl { namespace channel { - int ChannelScriptManager::smCSState; - RsoThread* ChannelScriptManager::smpThread; - CHANSVm ChannelScriptManager::smCSVm; + int ChannelScriptManager::smCSState; + RsoThread* ChannelScriptManager::smpThread; + CHANSVm ChannelScriptManager::smCSVm; ChannelScriptManager::ChannelScriptManager() { mpChansWork = NULL; @@ -19,7 +19,7 @@ namespace ipl { void ChannelScriptManager::create(EGG::ExpHeap* heap) { if (mpChansWork == NULL) { - mpChansWork = new(heap, 4) u8[CHANS_VM_DEFAULT_WORK_SIZE]; + mpChansWork = new (heap, 4) u8[CHANS_VM_DEFAULT_WORK_SIZE]; } if (mpHeap == NULL) { @@ -42,35 +42,33 @@ namespace ipl { CHANSVmInit(&smCSVm, mpChansWork, CHANS_VM_DEFAULT_WORK_SIZE); - OSAssertMsg(cs::system::init(&smCSVm), "CHANSVmSystemMenuInit error\n", 101); - OSAssertMsg(cs::layout::init(&smCSVm), "VmLayoutInit error\n", 105); - OSAssertMsg(cs::pane::init(&smCSVm), "VmPaneInit error\n", 109); - OSAssertMsg(cs::material::init(&smCSVm), "VmMaterialInit error\n", 113); - OSAssertMsg(cs::texture::init(&smCSVm), "VmTextureInit error\n", 117); - OSAssertMsg(cs::savedata::init(&smCSVm), "VmSaveDataInit error\n", 121); - OSAssertMsg(cs::vec3::init(&smCSVm), "VmVec3Init error\n", 125); - OSAssertMsg(cs::mtx34::init(&smCSVm), "VmMTX34Init error\n", 129); - OSAssertMsg(cs::gx::init(&smCSVm), "VmGXInit error\n", 133); - OSAssertMsg(cs::textwriter::init(&smCSVm), "VmTextWriterInit error\n", 137); - OSAssertMsg(cs::font::init(&smCSVm), "VmFontInit error\n", 141); - OSAssertMsg(cs::rect::init(&smCSVm), "VmRectInit error\n", 145); - OSAssertMsg(cs::color::init(&smCSVm), "VmColorInit error\n", 149); - OSAssertMsg(cs::color_s10::init(&smCSVm), "VmColorS10Init error\n", 153); - OSAssertMsg(cs::size::init(&smCSVm), "VmSizeInit error\n", 157); - OSAssertMsg(cs::anim::init(&smCSVm), "VmAnimInit error\n", 161); - OSAssertMsg(cs::sound::init(&smCSVm), "VmSoundInit error\n", 165); - OSAssertMsg(cs::iplimage::init(&smCSVm), "VmIplImageInit error\n", 169); + OSAssertMsg(cs::system::init(&smCSVm), "CHANSVmSystemMenuInit error\n", 101); + OSAssertMsg(cs::layout::init(&smCSVm), "VmLayoutInit error\n", 105); + OSAssertMsg(cs::pane::init(&smCSVm), "VmPaneInit error\n", 109); + OSAssertMsg(cs::material::init(&smCSVm), "VmMaterialInit error\n", 113); + OSAssertMsg(cs::texture::init(&smCSVm), "VmTextureInit error\n", 117); + OSAssertMsg(cs::savedata::init(&smCSVm), "VmSaveDataInit error\n", 121); + OSAssertMsg(cs::vec3::init(&smCSVm), "VmVec3Init error\n", 125); + OSAssertMsg(cs::mtx34::init(&smCSVm), "VmMTX34Init error\n", 129); + OSAssertMsg(cs::gx::init(&smCSVm), "VmGXInit error\n", 133); + OSAssertMsg(cs::textwriter::init(&smCSVm), "VmTextWriterInit error\n", 137); + OSAssertMsg(cs::font::init(&smCSVm), "VmFontInit error\n", 141); + OSAssertMsg(cs::rect::init(&smCSVm), "VmRectInit error\n", 145); + OSAssertMsg(cs::color::init(&smCSVm), "VmColorInit error\n", 149); + OSAssertMsg(cs::color_s10::init(&smCSVm), "VmColorS10Init error\n", 153); + OSAssertMsg(cs::size::init(&smCSVm), "VmSizeInit error\n", 157); + OSAssertMsg(cs::anim::init(&smCSVm), "VmAnimInit error\n", 161); + OSAssertMsg(cs::sound::init(&smCSVm), "VmSoundInit error\n", 165); + OSAssertMsg(cs::iplimage::init(&smCSVm), "VmIplImageInit error\n", 169); BOOL retResult; if (CHANSVmGetFreeExeSize(&smCSVm) == 0) { retResult = FALSE; - } - else { + } else { void* freeBuf = CHANSVmGetFreeExeBufp(&smCSVm); if (freeBuf == NULL) { retResult = FALSE; - } - else { + } else { memcpy(freeBuf, file->getBuffer(), file->getLength()); if (CHANSVmAddExe(&smCSVm, 1, 0) == FALSE) { @@ -81,12 +79,10 @@ namespace ipl { retResult = TRUE; smCSState = CHANS_VM_STATE_UNK1; - } - else { + } else { retResult = FALSE; } - } - else { + } else { retResult = FALSE; } } @@ -144,7 +140,6 @@ namespace ipl { } void ChannelScriptManager::calcCSThread() { - } - } -} + } // namespace channel +} // namespace ipl diff --git a/src/system/iplDialogWindow.cpp b/src/system/iplDialogWindow.cpp index 858bdd14..57d0b33d 100644 --- a/src/system/iplDialogWindow.cpp +++ b/src/system/iplDialogWindow.cpp @@ -2,8 +2,8 @@ #include "iplSystem.h" -#include #include +#include #include "iplLayoutUI.h" #include "iplSound.h" @@ -17,6 +17,7 @@ namespace ipl { * BtnC = Button 2 - Bottom button on Btn3 */ + // clang-format off const char* DialogWindow::mscBtnName[DIALOG_BTN_TYPE_MAX] = { "B_BtnB", #define BUTTON_ONE_MAX 1 @@ -25,26 +26,15 @@ namespace ipl { "B_BtnC" #define BUTTON_THREE_MAX 3 }; + // clang-format on - #define DIALOG_BTN0_PROG_SPEED 2 +#define DIALOG_BTN0_PROG_SPEED 2 - DialogWindow::DialogWindow(EGG::Heap* heap) : - ::gui::EventHandler(), - mState(DIALOG_STATE_READY), - mResult(RESULT_NONE), mLastResult(RESULT_NONE), - mDialogType(DIALOG_TYPE_NONE), - mWaitTick(0), - mbNextState(false), - mbTerminated(false), - mbSwapSound(false), - mbIsProg(false), mbDoProgBar(false), - mProgBarLen(0), mProgBarFrame(0), - mpCurDialog(NULL), - mpCustomLayout(NULL), - mPageCount(-1), mCurPage(0), - mbNoShade(false), - mbHideBtnA(false) { - EGG::Allocator* allocator = new(heap, 4) EGG::Allocator(heap, 4); + DialogWindow::DialogWindow(EGG::Heap* heap) + : ::gui::EventHandler(), mState(DIALOG_STATE_READY), mResult(RESULT_NONE), mLastResult(RESULT_NONE), mDialogType(DIALOG_TYPE_NONE), + mWaitTick(0), mbNextState(false), mbTerminated(false), mbSwapSound(false), mbIsProg(false), mbDoProgBar(false), mProgBarLen(0), + mProgBarFrame(0), mpCurDialog(NULL), mpCustomLayout(NULL), mPageCount(-1), mCurPage(0), mbNoShade(false), mbHideBtnA(false) { + EGG::Allocator* allocator = new (heap, 4) EGG::Allocator(heap, 4); nw4r::lyt::Layout::SetAllocator(allocator); init(); @@ -52,25 +42,25 @@ namespace ipl { mpLayoutFile = System::getDlgArc(); // Dialog with no buttons - mDialog[DIALOG_TYPE_BTN0].gLayout = new(heap, 4) layout::Object(heap, mpLayoutFile, "arc", "my_DialogWindow_a0.brlyt"); - mDialog[DIALOG_TYPE_BTN0].gLayout->bindToGroup("my_DialogWindow_a0_DialogIn.brlan", "G_InOut", false); + mDialog[DIALOG_TYPE_BTN0].gLayout = new (heap, 4) layout::Object(heap, mpLayoutFile, "arc", "my_DialogWindow_a0.brlyt"); + mDialog[DIALOG_TYPE_BTN0].gLayout->bindToGroup("my_DialogWindow_a0_DialogIn.brlan", "G_InOut", false); mDialog[DIALOG_TYPE_BTN0].gLayout->bindToGroup("my_DialogWindow_a0_DialogOut.brlan", "G_InOut", false, false); - mDialog[DIALOG_TYPE_BTN0].gLayout->bindToGroup("my_DialogWindow_a0_Wait.brlan", "G_Wait", false, false); - mDialog[DIALOG_TYPE_BTN0].gLayout->bindToGroup("my_DialogWindow_a0_Progres.brlan", "G_Prog", false); + mDialog[DIALOG_TYPE_BTN0].gLayout->bindToGroup("my_DialogWindow_a0_Wait.brlan", "G_Wait", false, false); + mDialog[DIALOG_TYPE_BTN0].gLayout->bindToGroup("my_DialogWindow_a0_Progres.brlan", "G_Prog", false); mDialog[DIALOG_TYPE_BTN0].gLayout->FindPaneByName("Wait_00")->SetVisible(false); mDialog[DIALOG_TYPE_BTN0].gLayout->FindPaneByName("N_Prog")->SetVisible(false); mDialog[DIALOG_TYPE_BTN0].gLayout->finishBinding(); mDialog[DIALOG_TYPE_BTN0].guiMgr = NULL; // No user interaction for progress dialog // Dialog with one button - mDialog[DIALOG_TYPE_BTN1].gLayout = new(heap, 4) layout::Object(heap, mpLayoutFile, "arc", "my_DialogWindow_a1.brlyt"); - mDialog[DIALOG_TYPE_BTN1].gLayout->bindToGroup("my_DialogWindow_a1_DialogIn.brlan", "G_InOut", false); - mDialog[DIALOG_TYPE_BTN1].gLayout->bindToGroup("my_DialogWindow_a1_DialogOut.brlan", "G_InOut", false, false); - mDialog[DIALOG_TYPE_BTN1].gLayout->bindToGroup("my_DialogWindow_a1_FocusBtn_on.brlan", "G_FocusBtnB", false, false); - mDialog[DIALOG_TYPE_BTN1].gLayout->bindToGroup("my_DialogWindow_a1_FocusBtn_off.brlan", "G_FocusBtnB", false, false); + mDialog[DIALOG_TYPE_BTN1].gLayout = new (heap, 4) layout::Object(heap, mpLayoutFile, "arc", "my_DialogWindow_a1.brlyt"); + mDialog[DIALOG_TYPE_BTN1].gLayout->bindToGroup("my_DialogWindow_a1_DialogIn.brlan", "G_InOut", false); + mDialog[DIALOG_TYPE_BTN1].gLayout->bindToGroup("my_DialogWindow_a1_DialogOut.brlan", "G_InOut", false, false); + mDialog[DIALOG_TYPE_BTN1].gLayout->bindToGroup("my_DialogWindow_a1_FocusBtn_on.brlan", "G_FocusBtnB", false, false); + mDialog[DIALOG_TYPE_BTN1].gLayout->bindToGroup("my_DialogWindow_a1_FocusBtn_off.brlan", "G_FocusBtnB", false, false); mDialog[DIALOG_TYPE_BTN1].gLayout->bindToGroup("my_DialogWindow_a1_SelectBtn_Ac.brlan", "G_SelectBtnB", false, false); mDialog[DIALOG_TYPE_BTN1].gLayout->finishBinding(); - mDialog[DIALOG_TYPE_BTN1].guiMgr = new(heap, 4) gui::PaneManager(NULL, mDialog[DIALOG_TYPE_BTN1].gLayout->getDrawInfo(), NULL, allocator); + mDialog[DIALOG_TYPE_BTN1].guiMgr = new (heap, 4) gui::PaneManager(NULL, mDialog[DIALOG_TYPE_BTN1].gLayout->getDrawInfo(), NULL, allocator); mDialog[DIALOG_TYPE_BTN1].guiMgr->setupScene(mDialog[DIALOG_TYPE_BTN1].gLayout); mDialog[DIALOG_TYPE_BTN1].guiMgr->setAllComponentTriggerTarget(false); for (int i = 0; i <= (BUTTON_ONE_MAX - 1); i++) { @@ -78,17 +68,17 @@ namespace ipl { } // Dialog with two buttons - mDialog[DIALOG_TYPE_BTN2].gLayout = new(heap, 4) layout::Object(heap, mpLayoutFile, "arc", "my_DialogWindow_a2.brlyt"); - mDialog[DIALOG_TYPE_BTN2].gLayout->bindToGroup("my_DialogWindow_a2_DialogIn.brlan", "G_InOut", false); - mDialog[DIALOG_TYPE_BTN2].gLayout->bindToGroup("my_DialogWindow_a2_DialogOut.brlan", "G_InOut", false, false); - mDialog[DIALOG_TYPE_BTN2].gLayout->bindToGroup("my_DialogWindow_a2_FocusBtn_on.brlan", "G_FocusBtnB", false, false); - mDialog[DIALOG_TYPE_BTN2].gLayout->bindToGroup("my_DialogWindow_a2_FocusBtn_off.brlan", "G_FocusBtnB", false, false); + mDialog[DIALOG_TYPE_BTN2].gLayout = new (heap, 4) layout::Object(heap, mpLayoutFile, "arc", "my_DialogWindow_a2.brlyt"); + mDialog[DIALOG_TYPE_BTN2].gLayout->bindToGroup("my_DialogWindow_a2_DialogIn.brlan", "G_InOut", false); + mDialog[DIALOG_TYPE_BTN2].gLayout->bindToGroup("my_DialogWindow_a2_DialogOut.brlan", "G_InOut", false, false); + mDialog[DIALOG_TYPE_BTN2].gLayout->bindToGroup("my_DialogWindow_a2_FocusBtn_on.brlan", "G_FocusBtnB", false, false); + mDialog[DIALOG_TYPE_BTN2].gLayout->bindToGroup("my_DialogWindow_a2_FocusBtn_off.brlan", "G_FocusBtnB", false, false); mDialog[DIALOG_TYPE_BTN2].gLayout->bindToGroup("my_DialogWindow_a2_SelectBtn_Ac.brlan", "G_SelectBtnB", false, false); - mDialog[DIALOG_TYPE_BTN2].gLayout->bindToGroup("my_DialogWindow_a2_FocusBtn_on.brlan", "G_FocusBtnA", false, false); - mDialog[DIALOG_TYPE_BTN2].gLayout->bindToGroup("my_DialogWindow_a2_FocusBtn_off.brlan", "G_FocusBtnA", false, false); + mDialog[DIALOG_TYPE_BTN2].gLayout->bindToGroup("my_DialogWindow_a2_FocusBtn_on.brlan", "G_FocusBtnA", false, false); + mDialog[DIALOG_TYPE_BTN2].gLayout->bindToGroup("my_DialogWindow_a2_FocusBtn_off.brlan", "G_FocusBtnA", false, false); mDialog[DIALOG_TYPE_BTN2].gLayout->bindToGroup("my_DialogWindow_a2_SelectBtn_Ac.brlan", "G_SelectBtnA", false, false); mDialog[DIALOG_TYPE_BTN2].gLayout->finishBinding(); - mDialog[DIALOG_TYPE_BTN2].guiMgr = new(heap, 4) gui::PaneManager(NULL, mDialog[DIALOG_TYPE_BTN2].gLayout->getDrawInfo(), NULL, allocator); + mDialog[DIALOG_TYPE_BTN2].guiMgr = new (heap, 4) gui::PaneManager(NULL, mDialog[DIALOG_TYPE_BTN2].gLayout->getDrawInfo(), NULL, allocator); mDialog[DIALOG_TYPE_BTN2].guiMgr->setupScene(mDialog[DIALOG_TYPE_BTN2].gLayout); mDialog[DIALOG_TYPE_BTN2].guiMgr->setAllComponentTriggerTarget(false); for (int i = 0; i <= (BUTTON_TWO_MAX - 1); i++) { @@ -96,20 +86,20 @@ namespace ipl { } // Dialog with three buttons - mDialog[DIALOG_TYPE_BTN3].gLayout = new(heap, 4) layout::Object(heap, mpLayoutFile, "arc", "my_DialogWindow_a3.brlyt"); - mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_DialogIn.brlan", "G_InOut", false); - mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_DialogOut.brlan", "G_InOut", false, false); - mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_FocusBtn_on.brlan", "G_FocusBtnB", false, false); - mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_FocusBtn_off.brlan", "G_FocusBtnB", false, false); + mDialog[DIALOG_TYPE_BTN3].gLayout = new (heap, 4) layout::Object(heap, mpLayoutFile, "arc", "my_DialogWindow_a3.brlyt"); + mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_DialogIn.brlan", "G_InOut", false); + mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_DialogOut.brlan", "G_InOut", false, false); + mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_FocusBtn_on.brlan", "G_FocusBtnB", false, false); + mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_FocusBtn_off.brlan", "G_FocusBtnB", false, false); mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_SelectBtn_Ac.brlan", "G_SelectBtnB", false, false); - mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_FocusBtn_on.brlan", "G_FocusBtnA", false, false); - mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_FocusBtn_off.brlan", "G_FocusBtnA", false, false); + mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_FocusBtn_on.brlan", "G_FocusBtnA", false, false); + mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_FocusBtn_off.brlan", "G_FocusBtnA", false, false); mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_SelectBtn_Ac.brlan", "G_SelectBtnA", false, false); - mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_FocusBtn_on.brlan", "G_FocusBtnC", false, false); - mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_FocusBtn_off.brlan", "G_FocusBtnC", false, false); + mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_FocusBtn_on.brlan", "G_FocusBtnC", false, false); + mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_FocusBtn_off.brlan", "G_FocusBtnC", false, false); mDialog[DIALOG_TYPE_BTN3].gLayout->bindToGroup("my_DialogWindow_a3_SelectBtn_Ac.brlan", "G_SelectBtnC", false, false); mDialog[DIALOG_TYPE_BTN3].gLayout->finishBinding(); - mDialog[DIALOG_TYPE_BTN3].guiMgr = new(heap, 4) gui::PaneManager(NULL, mDialog[DIALOG_TYPE_BTN3].gLayout->getDrawInfo(), NULL, allocator); + mDialog[DIALOG_TYPE_BTN3].guiMgr = new (heap, 4) gui::PaneManager(NULL, mDialog[DIALOG_TYPE_BTN3].gLayout->getDrawInfo(), NULL, allocator); mDialog[DIALOG_TYPE_BTN3].guiMgr->setupScene(mDialog[DIALOG_TYPE_BTN3].gLayout); mDialog[DIALOG_TYPE_BTN3].guiMgr->setAllComponentTriggerTarget(false); for (int i = 0; i <= (BUTTON_THREE_MAX - 1); i++) { @@ -117,17 +107,17 @@ namespace ipl { } // Dialog with two buttons (alternative) - mDialog[DIALOG_TYPE_BTNS2].gLayout = new(heap, 4) layout::Object(heap, mpLayoutFile, "arc", "my_DialogWindow_b.brlyt"); - mDialog[DIALOG_TYPE_BTNS2].gLayout->bindToGroup("my_DialogWindow_b_DialogIn.brlan", "G_InOut", false); - mDialog[DIALOG_TYPE_BTNS2].gLayout->bindToGroup("my_DialogWindow_b_DialogOut.brlan", "G_InOut", false, false); - mDialog[DIALOG_TYPE_BTNS2].gLayout->bindToGroup("my_DialogWindow_b_FocusBtn_on.brlan", "G_FocusBtnB", false, false); - mDialog[DIALOG_TYPE_BTNS2].gLayout->bindToGroup("my_DialogWindow_b_FocusBtn_off.brlan", "G_FocusBtnB", false, false); + mDialog[DIALOG_TYPE_BTNS2].gLayout = new (heap, 4) layout::Object(heap, mpLayoutFile, "arc", "my_DialogWindow_b.brlyt"); + mDialog[DIALOG_TYPE_BTNS2].gLayout->bindToGroup("my_DialogWindow_b_DialogIn.brlan", "G_InOut", false); + mDialog[DIALOG_TYPE_BTNS2].gLayout->bindToGroup("my_DialogWindow_b_DialogOut.brlan", "G_InOut", false, false); + mDialog[DIALOG_TYPE_BTNS2].gLayout->bindToGroup("my_DialogWindow_b_FocusBtn_on.brlan", "G_FocusBtnB", false, false); + mDialog[DIALOG_TYPE_BTNS2].gLayout->bindToGroup("my_DialogWindow_b_FocusBtn_off.brlan", "G_FocusBtnB", false, false); mDialog[DIALOG_TYPE_BTNS2].gLayout->bindToGroup("my_DialogWindow_b_SelectBtn_Ac.brlan", "G_SelectBtnB", false, false); - mDialog[DIALOG_TYPE_BTNS2].gLayout->bindToGroup("my_DialogWindow_b_FocusBtn_on.brlan", "G_FocusBtnA", false, false); - mDialog[DIALOG_TYPE_BTNS2].gLayout->bindToGroup("my_DialogWindow_b_FocusBtn_off.brlan", "G_FocusBtnA", false, false); + mDialog[DIALOG_TYPE_BTNS2].gLayout->bindToGroup("my_DialogWindow_b_FocusBtn_on.brlan", "G_FocusBtnA", false, false); + mDialog[DIALOG_TYPE_BTNS2].gLayout->bindToGroup("my_DialogWindow_b_FocusBtn_off.brlan", "G_FocusBtnA", false, false); mDialog[DIALOG_TYPE_BTNS2].gLayout->bindToGroup("my_DialogWindow_b_SelectBtn_Ac.brlan", "G_SelectBtnA", false, false); mDialog[DIALOG_TYPE_BTNS2].gLayout->finishBinding(); - mDialog[DIALOG_TYPE_BTNS2].guiMgr = new(heap, 4) gui::PaneManager(NULL, mDialog[DIALOG_TYPE_BTNS2].gLayout->getDrawInfo(), NULL, allocator); + mDialog[DIALOG_TYPE_BTNS2].guiMgr = new (heap, 4) gui::PaneManager(NULL, mDialog[DIALOG_TYPE_BTNS2].gLayout->getDrawInfo(), NULL, allocator); mDialog[DIALOG_TYPE_BTNS2].guiMgr->setupScene(mDialog[DIALOG_TYPE_BTNS2].gLayout); mDialog[DIALOG_TYPE_BTNS2].guiMgr->setAllComponentTriggerTarget(false); for (int i = 0; i <= (BUTTON_TWO_MAX - 1); i++) { @@ -308,8 +298,7 @@ namespace ipl { break; } } - } - else { + } else { switch (mResult) { case RESULT_RIGHT_BUTTON: { anim = ANIM_SELECT_BTN_B; @@ -371,8 +360,7 @@ namespace ipl { if (mbBtnHovered[DIALOG_BTN_TYPE_BTN2] != FALSE && mpPages[mCurPage].isTwoBtn) { mpCurDialog->gLayout->getAnim(ANIM_FOCUS_BTN_A_ON)->play(); } - } - else { + } else { if (mbBtnHovered[DIALOG_BTN_TYPE_BTN1] != FALSE) { mpCurDialog->gLayout->getAnim(ANIM_FOCUS_BTN_B_ON)->play(); } @@ -398,8 +386,7 @@ namespace ipl { textBox->SetAlpha(mPageAlpha); // If the next page has the left button, make it visible (if it was invisible before) - if (mpPages[mCurPage].isTwoBtn != mpPages[mPrevPage].isTwoBtn - && mpPages[mCurPage].isTwoBtn == true) { + if (mpPages[mCurPage].isTwoBtn != mpPages[mPrevPage].isTwoBtn && mpPages[mCurPage].isTwoBtn == true) { nw4r::lyt::Pane* pBtnA = mpCurDialog->gLayout->FindPaneByName("N_BtnA"); nw4r::lyt::Pane* pBtnAPic = mpCurDialog->gLayout->FindPaneByName("N_BtnA_Pic"); @@ -412,13 +399,11 @@ namespace ipl { mbBtnHovered[DIALOG_BTN_TYPE_BTN2] = FALSE; mpCurDialog->gLayout->getAnim(ANIM_FOCUS_BTN_A_ON)->init(); } - } - else { + } else { set_alpha(pBtnAPic, 255); pBtnA->SetVisible(false); } - } - else { + } else { // Has the text changed? Fade in the text to the new one if (mpPages[mCurPage].lBtnMsgId != mpPages[mPrevPage].lBtnMsgId) { nw4r::lyt::Pane* pPane = mpCurDialog->gLayout->FindPaneByName("T_BtnA"); @@ -433,8 +418,7 @@ namespace ipl { } // Has the layout changed? Fade in to the new one. - if (mpPages[mCurPage].layoutObj != mpPages[mPrevPage].layoutObj - && mpPages[mCurPage].layoutObj) { + if (mpPages[mCurPage].layoutObj != mpPages[mPrevPage].layoutObj && mpPages[mCurPage].layoutObj) { set_alpha(mpPages[mCurPage].layoutObj->GetRootPane(), mPageAlpha); if (mpPages[mCurPage].isLytAnim && mPageAlpha == 255) { mpPages[mCurPage].layoutObj->getAnim(ANIM_DIALOG_IN)->play(); @@ -459,8 +443,7 @@ namespace ipl { textBox->SetAlpha(mPageAlpha); // If the previous page has no left button, make it invisible (if it was visible before) - if (mpPages[mCurPage].isTwoBtn != mpPages[mPrevPage].isTwoBtn - && mpPages[mPrevPage].isTwoBtn == true) { + if (mpPages[mCurPage].isTwoBtn != mpPages[mPrevPage].isTwoBtn && mpPages[mPrevPage].isTwoBtn == true) { nw4r::lyt::Pane* pBtnA = mpCurDialog->gLayout->FindPaneByName("N_BtnA"); nw4r::lyt::Pane* pBtnAPic = mpCurDialog->gLayout->FindPaneByName("N_BtnA_Pic"); @@ -472,17 +455,15 @@ namespace ipl { if (mPageAlpha != 0) { set_alpha(pBtnAPic, mPageAlpha); - } - else { + } else { // If the alpha faded out, make it invisible and init button animations...? set_alpha(pBtnAPic, 255); pBtnA->SetVisible(false); - + mbBtnHovered[DIALOG_BTN_TYPE_BTN2] = FALSE; mpCurDialog->gLayout->getAnim(ANIM_FOCUS_BTN_A_ON)->init(); } - } - else { + } else { // Has the text changed? Fade out the old text if (mpPages[mCurPage].lBtnMsgId != mpPages[mPrevPage].lBtnMsgId) { nw4r::lyt::Pane* pPane = mpCurDialog->gLayout->FindPaneByName("T_BtnA"); @@ -493,17 +474,15 @@ namespace ipl { // Has the text changed? Fade out the old text if (mpPages[mCurPage].rBtnMsgId != mpPages[mPrevPage].rBtnMsgId) { nw4r::lyt::Pane* pPane = mpCurDialog->gLayout->FindPaneByName("T_BtnB"); - pPane->SetAlpha(mPageAlpha); + pPane->SetAlpha(mPageAlpha); } // Has the layout changed? Fade out the old layout - if (mpPages[mCurPage].layoutObj != mpPages[mPrevPage].layoutObj - && mpPages[mPrevPage].layoutObj) { + if (mpPages[mCurPage].layoutObj != mpPages[mPrevPage].layoutObj && mpPages[mPrevPage].layoutObj) { nw4r::lyt::Pane* pPane = mpPages[mPrevPage].layoutObj->GetRootPane(); if (mPageAlpha != 0) { set_alpha(pPane, mPageAlpha); - } - else { + } else { if (mpPages[mPrevPage].isLytAnim) { mpPages[mPrevPage].layoutObj->getAnim()->init(); } @@ -630,8 +609,7 @@ namespace ipl { if (pPane) { if (mbNoShade) { pPane->SetVisible(false); - } - else { + } else { pPane->SetVisible(true); } } @@ -641,8 +619,7 @@ namespace ipl { if (pPane) { if (mbHideBtnA) { pPane->SetVisible(false); - } - else { + } else { pPane->SetVisible(true); } } @@ -674,10 +651,9 @@ namespace ipl { mpCurDialog->gLayout->getAnim(ANIM_BTN0_WAIT)->play(); snd::getSystem()->startSE("WIPL_SE_COPYING"); - } - else { + } else { mpCurDialog->gLayout->FindPaneByName("Wait_00")->SetVisible(false); - + snd::getSystem()->startSE("WIPL_SE_INFO_WINDOW"); } @@ -703,10 +679,9 @@ namespace ipl { mpCurDialog->gLayout->getAnim(ANIM_BTN0_WAIT)->play(); snd::getSystem()->startSE("WIPL_SE_COPYING"); - } - else { + } else { mpCurDialog->gLayout->FindPaneByName("Wait_00")->SetVisible(false); - + snd::getSystem()->startSE("WIPL_SE_INFO_WINDOW"); } @@ -735,10 +710,9 @@ namespace ipl { mpCurDialog->gLayout->getAnim(ANIM_BTN0_WAIT)->play(); snd::getSystem()->startSE("WIPL_SE_COPYING"); - } - else { + } else { mpCurDialog->gLayout->FindPaneByName("Wait_00")->SetVisible(false); - + snd::getSystem()->startSE("WIPL_SE_INFO_WINDOW"); } @@ -768,7 +742,7 @@ namespace ipl { BOOL DialogWindow::callBtn1NoShade(u32 msgId, u32 btnId) { BOOL result = FALSE; - + mbNoShade = true; if (call(DIALOG_TYPE_BTN1)) { set_dialog_size(sDlgBtn1Size); @@ -921,7 +895,7 @@ namespace ipl { if (mpPages[mCurPage].layoutObj) { mpCustomLayout = mpPages[mCurPage].layoutObj; - + mCustomLayoutPos.x = 0.0f; mCustomLayoutPos.y = mpPages[mCurPage].layoutYOff; } @@ -1114,7 +1088,7 @@ namespace ipl { mbIsProg = true; mbDoProgBar = true; - + mProgBarLen = 0; mProgBarFrame = 0; @@ -1138,8 +1112,8 @@ namespace ipl { void DialogWindow::start_point_event(const char* paneName, controller::Interface* controller) { int btnNo = get_button_no(paneName); - if (!(mState == DIALOG_STATE_PAGE_FADE || mState == DIALOG_STATE_PAGE_FADE_PREPARE) - || (btnNo != DIALOG_BTN_TYPE_BTN2 || mpPages[mCurPage].isTwoBtn == mpPages[mPrevPage].isTwoBtn)) { + if (!(mState == DIALOG_STATE_PAGE_FADE || mState == DIALOG_STATE_PAGE_FADE_PREPARE) || + (btnNo != DIALOG_BTN_TYPE_BTN2 || mpPages[mCurPage].isTwoBtn == mpPages[mPrevPage].isTwoBtn)) { if (btnNo != -1 && mbBtnHovered[btnNo] == FALSE) { int animIdx = -1; @@ -1159,8 +1133,7 @@ namespace ipl { break; } } - } - else { + } else { switch (btnNo) { case DIALOG_BTN_TYPE_BTN1: { animIdx = ANIM_FOCUS_BTN_B_ON; @@ -1190,8 +1163,8 @@ namespace ipl { void DialogWindow::start_left_event(const char* paneName) { int btnNo = get_button_no(paneName); - if (!(mState == DIALOG_STATE_PAGE_FADE || mState == DIALOG_STATE_PAGE_FADE_PREPARE) - || (btnNo != DIALOG_BTN_TYPE_BTN2 || mpPages[mCurPage].isTwoBtn == mpPages[mPrevPage].isTwoBtn)) { + if (!(mState == DIALOG_STATE_PAGE_FADE || mState == DIALOG_STATE_PAGE_FADE_PREPARE) || + (btnNo != DIALOG_BTN_TYPE_BTN2 || mpPages[mCurPage].isTwoBtn == mpPages[mPrevPage].isTwoBtn)) { if (btnNo != -1 && mbBtnHovered[btnNo] == TRUE) { int animIdx = -1; @@ -1211,8 +1184,7 @@ namespace ipl { break; } } - } - else { + } else { switch (btnNo) { case DIALOG_BTN_TYPE_BTN1: { animIdx = ANIM_FOCUS_BTN_B_OFF; @@ -1262,16 +1234,14 @@ namespace ipl { break; } } - } - else { + } else { switch (btnNo) { case DIALOG_BTN_TYPE_BTN2: { mResult = RESULT_LEFT_BUTTON; animIdx = ANIM_SELECT_BTN_A; if (mbSwapSound) { snd::getSystem()->startSE("WIPL_SE_DECIDE"); - } - else { + } else { snd::getSystem()->startSE("WIPL_SE_CANCEL"); } mPrevPage = mCurPage; @@ -1283,8 +1253,7 @@ namespace ipl { animIdx = ANIM_SELECT_BTN_B; if (mbSwapSound) { snd::getSystem()->startSE("WIPL_SE_CANCEL"); - } - else { + } else { snd::getSystem()->startSE("WIPL_SE_DECIDE"); } mPrevPage = mCurPage; @@ -1306,13 +1275,11 @@ namespace ipl { if (mCurPage < 0 || mCurPage == mPageCount) { mbNextState = true; mState = DIALOG_STATE_SELECT; - } - else { + } else { mState = DIALOG_STATE_PAGE_FADE_PREPARE; mPageState = DIALOG_PAGE_FADE_OUT; } - } - else { + } else { mbNextState = true; mState = DIALOG_STATE_SELECT; } @@ -1365,4 +1332,4 @@ namespace ipl { } return result; } -} +} // namespace ipl diff --git a/src/system/iplErrorHandler.cpp b/src/system/iplErrorHandler.cpp index d2deb25e..2aebb482 100644 --- a/src/system/iplErrorHandler.cpp +++ b/src/system/iplErrorHandler.cpp @@ -1,13 +1,13 @@ #include "system/iplErrorHandler.h" +#include #include #include -#include #include -#include "system/rvl_dec.h" #include "iplSystem.h" +#include "system/rvl_dec.h" /** These declarations are auto generated **/ @@ -24,19 +24,15 @@ extern u8 ipl_error_chn_bmg[]; extern u8 ipl_error_kor_bmg[]; namespace ipl { - ErrorHandler::ErrorHandler(EGG::Heap* heap) : - mbReady(FALSE), - mType(NONE), - mMessageID(0), - mpArcData(NULL) { + ErrorHandler::ErrorHandler(EGG::Heap* heap) : mbReady(FALSE), mType(NONE), mMessageID(0), mpArcData(NULL) { // Decompress the archive file. mArcSize = Rvl_decode_ash_size(fatalDlg_ash); - mpArcData = new(heap, DEFAULT_ALIGN) u8[mArcSize]; + mpArcData = new (heap, DEFAULT_ALIGN) u8[mArcSize]; Rvl_decode(mpArcData, fatalDlg_ash); // Create the layout from archive. - mpLayout = new(heap, 4) layout::Object(heap, mpArcData, "arc", "my_Fatal.brlyt"); + mpLayout = new (heap, 4) layout::Object(heap, mpArcData, "arc", "my_Fatal.brlyt"); } void ErrorHandler::set(Type type, u32 msgId, const char* arg1, int arg2, int arg3) { @@ -52,16 +48,14 @@ namespace ipl { if (arg1) { strncpy(unk_0x14, arg1, sizeof(unk_0x14)); unk_0x14[sizeof(unk_0x14) - 1] = 0; - } - else { + } else { memset(unk_0x14, 0, sizeof(unk_0x14)); } curThread = OSGetCurrentThread(); if (curThread == System::getMainThread()->getMessageQueue()->queueSend.tail) { check(); - } - else { + } else { OSCancelThread(curThread); } } @@ -123,9 +117,9 @@ namespace ipl { } void ErrorHandler::log(const char* type, int result, const char* file, int line) { - #ifdef NAND_LOG_TO_OSREPORT +#ifdef NAND_LOG_TO_OSREPORT OSReport("ErrorHandler::log(%s error. [%d] %s line: %d)\n", type, result, file, line); - #endif +#endif NANDLoggingAddMessageAsync(NULL, "%s error. [%d] %s line: %d", type, result, file, line); } @@ -146,4 +140,4 @@ namespace ipl { mpLayout->draw(); } } -} +} // namespace ipl diff --git a/src/system/iplException.cpp b/src/system/iplException.cpp index 148aef94..d0da934a 100644 --- a/src/system/iplException.cpp +++ b/src/system/iplException.cpp @@ -7,6 +7,7 @@ #include namespace ipl { + // clang-format off static const u32 sKeyInputs[8] = { // Left, down, down, 1, -, 2, +, down WPAD_BUTTON_LEFT, @@ -18,28 +19,25 @@ namespace ipl { WPAD_BUTTON_PLUS, WPAD_BUTTON_DOWN, }; + // clang-format on - #define LINES_ON_SCREEN_OFFSET 4 - #define LINES_ON_SCREEN_WIDTH 24 - #define LINES_ON_SCREEN_HEIGHT 18 +#define LINES_ON_SCREEN_OFFSET 4 +#define LINES_ON_SCREEN_WIDTH 24 +#define LINES_ON_SCREEN_HEIGHT 18 - #define FONT_WIDTH 46 - #define FONT_HEIGHT 48 +#define FONT_WIDTH 46 +#define FONT_HEIGHT 48 bool exception_callback_(nw4r::db::ConsoleHandle console, void* param) { Exception* exception = ((Exception*)param); exception->exception_callback(console); } - Exception::Exception(EGG::Heap* heap, const GXRenderModeObj& rMode) : - mConsole(NULL), - unk_0x04(0), - mpBuffer(), - unk_0x0C(0) { + Exception::Exception(EGG::Heap* heap, const GXRenderModeObj& rMode) : mConsole(NULL), unk_0x04(0), mpBuffer(), unk_0x0C(0) { nw4r::db::Exception_Init(); nw4r::db::DirectPrint_Init(); - mpBuffer = new(heap, 4) u8[NW4R_CONSOLE_BUFFER_SIZE(FONT_WIDTH, FONT_HEIGHT)]; + mpBuffer = new (heap, 4) u8[NW4R_CONSOLE_BUFFER_SIZE(FONT_WIDTH, FONT_HEIGHT)]; mConsole = nw4r::db::Console_Create(mpBuffer, FONT_WIDTH, FONT_HEIGHT, 18, 0, 4); setConsole(rMode); @@ -60,7 +58,7 @@ namespace ipl { void Exception::key_input() { KPADStatus cons[WPAD_MAX_CONTROLLERS]; memset(cons, 0, sizeof(cons)); - + int inputCur = 0; OSEnableInterrupts(); @@ -69,7 +67,7 @@ namespace ipl { for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) { KPADRead(i, &cons[i], 1); } - + wait(50); // todo @@ -78,8 +76,7 @@ namespace ipl { if (pressed) { if (pressed & sKeyInputs[inputCur]) { inputCur++; - } - else { + } else { inputCur = 0; } } @@ -93,7 +90,7 @@ namespace ipl { s32 line = nw4r::db::Console_GetBufferHeadLine(mConsole); s32 lineScrollMax = nw4r::db::Console_GetTotalLines(mConsole) - LINES_ON_SCREEN_HEIGHT; - key_input(); // Wait until they pressed key input + key_input(); // Wait until they pressed key input // Scroll through the exception. for (; line <= lineScrollMax; line++) { @@ -133,14 +130,11 @@ namespace ipl { // Scroll depending on what the user presses if ((held & WPAD_BUTTON_UP) && yCur > 0) { yCur--; - } - else if ((held & WPAD_BUTTON_DOWN) && yCur < lineScrollMax) { + } else if ((held & WPAD_BUTTON_DOWN) && yCur < lineScrollMax) { yCur++; - } - else if ((held & WPAD_BUTTON_RIGHT) && xCur > LINES_ON_SCREEN_OFFSET) { + } else if ((held & WPAD_BUTTON_RIGHT) && xCur > LINES_ON_SCREEN_OFFSET) { xCur -= 2; - } - else if ((held & WPAD_BUTTON_LEFT) && xCur < LINES_ON_SCREEN_WIDTH) { + } else if ((held & WPAD_BUTTON_LEFT) && xCur < LINES_ON_SCREEN_WIDTH) { xCur += 2; } } @@ -162,7 +156,7 @@ namespace ipl { // do nothing until it finished } } -} +} // namespace ipl /*********************************************************************** * TODO: Generate weak function nw4r::ut::Color::operator=(const Color&) diff --git a/src/system/iplFramework.cpp b/src/system/iplFramework.cpp index 3582ab64..66261e2e 100644 --- a/src/system/iplFramework.cpp +++ b/src/system/iplFramework.cpp @@ -5,8 +5,10 @@ #include namespace ipl { - #define DELTA_60 1.0f /* Delta for NTSC, MPAL and PAL60 */ - #define DELTA_50 1.2f /* Delta for PAL50 */ +#define DELTA_60 1.0f /* Delta for NTSC, MPAL and PAL60 */ +#define DELTA_50 1.2f /* Delta for PAL50 */ + + // clang-format off // NTSC Interlaced static GXRenderModeObj sRMO_Ntsc_640x456IntDf = { @@ -118,6 +120,8 @@ namespace ipl { 0, 0, }; + // clang-format on + Framework::Framework(EGG::Heap* heap) { mpRMode = NULL; @@ -163,11 +167,12 @@ namespace ipl { void Framework::resetRenderMode() { reset_render_mode(); - - VIFlush(); { + + VIFlush(); + { GXSetDispCopySrc(0, 0, mpRMode->fbWidth, mpRMode->efbHeight); f32 yScaleFactor = GXGetYScaleFactor(mpRMode->efbHeight, mpRMode->xfbHeight); - u32 height = GXSetDispCopyYScale(yScaleFactor); + u32 height = GXSetDispCopyYScale(yScaleFactor); GXSetDispCopyDst(mpRMode->fbWidth, height); } @@ -198,14 +203,12 @@ namespace ipl { case VI_NTSC: { if (VIGetDTVStatus() == TRUE && progressive == SC_PROGRESSIVE_MODE_ON) { mpRMode = &sRMO_Ntsc_640x456Prog; - } - else { + } else { mpRMode = &sRMO_Ntsc_640x456IntDf; } if (aspectRatio == SC_ASPECT_RATIO_16x9) { mpRMode->viWidth = 686; - } - else { + } else { mpRMode->viWidth = 670; } mpRMode->viXOrigin = (VI_MAX_WIDTH_NTSC - mpRMode->viWidth) / 2; @@ -218,8 +221,7 @@ namespace ipl { mpRMode = &sRMO_Pal60_640x456Prog; if (aspectRatio == SC_ASPECT_RATIO_16x9) { sRMO_Pal60_640x456Prog.viWidth = 686; - } - else { + } else { sRMO_Pal60_640x456Prog.viWidth = 670; } mpRMode->viXOrigin = (VI_MAX_WIDTH_EURGB60 - mpRMode->viWidth) / 2; @@ -229,8 +231,7 @@ namespace ipl { mpRMode = &sRMO_Pal60_640x456IntDf; if (aspectRatio == SC_ASPECT_RATIO_16x9) { sRMO_Pal60_640x456IntDf.viWidth = 686; - } - else { + } else { sRMO_Pal60_640x456IntDf.viWidth = 670; } mpRMode->viXOrigin = (VI_MAX_WIDTH_EURGB60 - mpRMode->viWidth) / 2; @@ -240,8 +241,7 @@ namespace ipl { mpRMode = &sRMO_Pal50_640x456IntDf; if (aspectRatio == SC_ASPECT_RATIO_16x9) { sRMO_Pal50_640x456IntDf.viWidth = 682; - } - else { + } else { sRMO_Pal50_640x456IntDf.viWidth = 666; } mpRMode->viXOrigin = (VI_MAX_WIDTH_PAL - mpRMode->viWidth) / 2; @@ -264,11 +264,12 @@ namespace ipl { // Screen burn in reduction VIEnableDimming(FALSE); VIEnableDimming((BOOL)SCGetScreenSaverMode()); - - VIFlush(); { + + VIFlush(); + { GXSetDispCopySrc(0, 0, mpRMode->fbWidth, mpRMode->efbHeight); f32 yScaleFactor = GXGetYScaleFactor(mpRMode->efbHeight, mpRMode->xfbHeight); - u32 height = GXSetDispCopyYScale(yScaleFactor); + u32 height = GXSetDispCopyYScale(yScaleFactor); GXSetDispCopyDst(mpRMode->fbWidth, height); } @@ -278,17 +279,17 @@ namespace ipl { } void Framework::init_xfb(EGG::Heap* heap) { - #ifdef VERSION_43E +#ifdef VERSION_43E GXRenderModeObj* rMode = &sRMO_Pal50_640x456IntDf; - #else +#else GXRenderModeObj* rMode = mpRMode; - #endif +#endif u32 xfbSize = VIPadFrameBufferWidth(rMode->fbWidth) * rMode->xfbHeight * VI_DISPLAY_PIX_SZ; for (int i = 0; i < 2; i++) { - mpXfb[i] = new(heap, DEFAULT_ALIGN) u8[xfbSize]; + mpXfb[i] = new (heap, DEFAULT_ALIGN) u8[xfbSize]; } mCurXfb = 0; } -} +} // namespace ipl diff --git a/src/system/iplHomeButtonMenu.cpp b/src/system/iplHomeButtonMenu.cpp index 4594f7b3..38e37437 100644 --- a/src/system/iplHomeButtonMenu.cpp +++ b/src/system/iplHomeButtonMenu.cpp @@ -1,7 +1,7 @@ #include "system/iplHomeButton.h" -#include "iplSystem.h" #include "iplSound.h" +#include "iplSystem.h" #include "config.h" @@ -20,8 +20,7 @@ namespace ipl { case HBMSEV_BEGIN_BLACKOUT: { if (exitAnm) { return snd::getSystem()->resetAllSound(); - } - else { + } else { return snd::getSystem()->pauseOffBGM(); } } @@ -37,20 +36,15 @@ namespace ipl { return event; } - HomeButtonMenu::HomeButtonMenu(EGG::Heap* heap) : - mbHbmEnabled(false), - mEnableFlag(true), - mEnableByTVRCFlag(true), - mDisableByTVRCFlag(false), - mDisableFlag(false), - mbHBMLibEnabled(false), - mbBanIconEnabled(false) { + HomeButtonMenu::HomeButtonMenu(EGG::Heap* heap) + : mbHbmEnabled(false), mEnableFlag(true), mEnableByTVRCFlag(true), mDisableByTVRCFlag(false), mDisableFlag(false), mbHBMLibEnabled(false), + mbBanIconEnabled(false) { mpMessageFile = System::getHBMMessageFile(); mpConfigFile = System::getHBMConfigFile(); mpSpeakerSoundFile = System::getHBMSpeakSoundFile(); mpBanIconFile = System::getHBMBanIconFile(); - mpHbmInfo = new(heap, 4) HBMDataInfo(); + mpHbmInfo = new (heap, 4) HBMDataInfo(); mpHbmInfo->backFlag = 0; mpHbmInfo->region = SCGetLanguage(); @@ -59,11 +53,11 @@ namespace ipl { mpHbmInfo->adjust.x = 1.3684211f; mpHbmInfo->adjust.y = 1.0f; - #ifdef IMPROVE_PAL50_HBM_DELTA +#ifdef IMPROVE_PAL50_HBM_DELTA mpHbmInfo->frameDelta = System::getAnimDelta(); - #else +#else mpHbmInfo->frameDelta = 1.0f; - #endif // IMPROVE_PAL50_HBM_DELTA +#endif // IMPROVE_PAL50_HBM_DELTA mpHbmInfo->layoutBuf = System::getHBMLayoutFile()->getBuffer(); mpHbmInfo->lytLangBuf = System::getHBMLangFile()->getBuffer(); @@ -89,7 +83,7 @@ namespace ipl { utility::Graphics::setDefaultOrtho(); TPLGetGXTexObjFromPalette((TPLPalette*)mpBanIconFile->getBuffer(), &texObj, 0); - GXColor color = (GXColor){ 255, 255, 255, alpha }; + GXColor color = (GXColor){255, 255, 255, alpha}; nw4r::ut::Rect rect(-256.0f, 188.0f, -200.0f, 132.0f); utility::Graphics::drawTexture(rect, texObj, color, 1); @@ -108,8 +102,7 @@ namespace ipl { HBMInit(); mbHbmEnabled = true; - } - else { + } else { if (!mbBanIconEnabled) { mbBanIconEnabled = true; mBanIconTime = OSGetTick(); @@ -147,8 +140,7 @@ namespace ipl { } if (!System::getResetHandler()->isResetting()) { - if (!mbHbmEnabled && !mbBanIconEnabled - && System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT) { + if (!mbHbmEnabled && !mbBanIconEnabled && System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT) { checkStart(); } @@ -160,11 +152,10 @@ namespace ipl { mConData.wiiCon[i].kpad = con->getKPADStatus(); mConData.wiiCon[i].pos.x = con->getDpdPos().x; mConData.wiiCon[i].pos.y = con->getDpdPos().y; - if (con->getType() == WPAD_DEV_CLASSIC && reinterpret_cast(con)->isValidDpdClassic()) { + if (con->getType() == WPAD_DEV_CLASSIC && reinterpret_cast(con)->isValidDpdClassic()) { mConData.wiiCon[i].use_devtype = WPAD_DEV_CLASSIC; } - } - else { + } else { mConData.wiiCon[i].kpad = NULL; } } @@ -176,11 +167,9 @@ namespace ipl { System::getResetHandler()->reset(); } } - } - else { + } else { mEnableFlag = false; - if (!mbHbmEnabled && !mbBanIconEnabled - && System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT) { + if (!mbHbmEnabled && !mbBanIconEnabled && System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT) { checkStart(); } } @@ -232,8 +221,7 @@ namespace ipl { if (mbHbmEnabled) { mDisableFlag = true; return FALSE; - } - else { + } else { mEnableFlag = false; return TRUE; } @@ -248,8 +236,7 @@ namespace ipl { if (mbHbmEnabled) { mDisableByTVRCFlag = true; return FALSE; - } - else { + } else { mEnableByTVRCFlag = false; return TRUE; } @@ -263,7 +250,7 @@ namespace ipl { HBMSelectBtnNum HomeButtonMenu::getSelectBtnNum() { HBMSelectBtnNum num = HBMGetSelectBtnNum(); - if (num >= HBM_SELECT_NULL+1) { + if (num >= HBM_SELECT_NULL + 1) { if (mDisableFlag) { mDisableFlag = false; mEnableFlag = false; @@ -273,4 +260,4 @@ namespace ipl { return num; } -} +} // namespace ipl diff --git a/src/system/iplKeyboard.cpp b/src/system/iplKeyboard.cpp index 1f2c0adf..0f26a01b 100644 --- a/src/system/iplKeyboard.cpp +++ b/src/system/iplKeyboard.cpp @@ -1,7 +1,7 @@ #include "system/iplKeyboard.h" -#include "iplSystem.h" #include "iplSound.h" +#include "iplSystem.h" #include @@ -11,6 +11,7 @@ namespace ipl { namespace keyboard { + // clang-format off static EZTXLanguageEntry sZiSysLangTable[EZTX_LANG_MAX+1] = { { ZI8_LANG_ENAM, NULL }, { ZI8_LANG_ENUK, NULL }, @@ -38,6 +39,7 @@ namespace ipl { { ZI8_LANG_ZH, NULL }, { ZI8_LANG_NONE, NULL }, }; + // clang-format on static int getFirstController() { for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) { @@ -159,9 +161,9 @@ namespace ipl { void Manager::create(nand::File* file, EGG::Heap* heap) { // Open arc - nw4r::lyt::ArcResourceLink* arcLink = new(heap, 4) nw4r::lyt::ArcResourceLink(); + nw4r::lyt::ArcResourceLink* arcLink = new (heap, 4) nw4r::lyt::ArcResourceLink(); arcLink->Set(file->getBuffer(), "arc"); - nw4r::lyt::MultiArcResourceAccessor* multiArc = new(heap, 4) nw4r::lyt::MultiArcResourceAccessor(); + nw4r::lyt::MultiArcResourceAccessor* multiArc = new (heap, 4) nw4r::lyt::MultiArcResourceAccessor(); multiArc->Attach(arcLink); nw4r::lyt::FontRefLink wbf1Public; @@ -183,7 +185,7 @@ namespace ipl { multiArc->RegistFont(&wbf2Private); // Allocators - EGG::Allocator* allocator = new(heap, 4) EGG::Allocator(heap, 4); + EGG::Allocator* allocator = new (heap, 4) EGG::Allocator(heap, 4); nw4r::lyt::Layout::SetAllocator(allocator); u8* systemDict = NULL; @@ -199,7 +201,7 @@ namespace ipl { oemDict = System::getZiOemDicData(i); } } -#endif // USE_ZI8 +#endif // USE_ZI8 #ifdef USE_ZI8 for (int i = 0; i < EZTX_LANG_MAX; i++) { @@ -216,13 +218,13 @@ namespace ipl { sZiSysLangTable[i].table = usedSystemDict; sZiOemLangTable[i].table = usedOemDict; } -#endif // USE_ZI8 +#endif // USE_ZI8 // Save data mSaveData = System::getSaveData()->getMemoSetting(); // Memo manager - mpManager = new(heap, 4) textinput::MemoManager(allocator, multiArc, &mEvent); + mpManager = new (heap, 4) textinput::MemoManager(allocator, multiArc, &mEvent); mpManager->setSaveData(mSaveData); mpManager->create(NULL); mEvent.setManager(this); @@ -262,7 +264,7 @@ namespace ipl { #ifdef JAPANESE_BUILD mpManager->setDestination(textinput::DST_JP); mpManager->setLanguage(textinput::JP); -#endif // JAPANESE_BUILD +#endif // JAPANESE_BUILD } void Manager::init() { @@ -286,8 +288,7 @@ namespace ipl { if ((u32)(SCGetAspectRatio() & 0xFF) == SC_ASPECT_RATIO_16x9) { System::getProjectionRect16x9(&projRect); mpManager->setAspectRatio(false); - } - else { + } else { System::getProjectionRect4x3(&projRect); mpManager->setAspectRatio(true); } @@ -312,18 +313,14 @@ namespace ipl { if (prevStateType == textinput::MemoManager::ST_Hidden && mState.type == textinput::MemoManager::ST_Appearing) { mState.iplType = STATE_APPEARING; mState.pressOK = false; - } - else if (prevStateType == textinput::MemoManager::ST_Appearing && mState.type == textinput::MemoManager::ST_Visible) { + } else if (prevStateType == textinput::MemoManager::ST_Appearing && mState.type == textinput::MemoManager::ST_Visible) { mState.iplType = STATE_VISIBLE; mState.pressOK = false; - } - else if (prevStateType == textinput::MemoManager::ST_Visible && mState.type == textinput::MemoManager::ST_Disappearing) { + } else if (prevStateType == textinput::MemoManager::ST_Visible && mState.type == textinput::MemoManager::ST_Disappearing) { mState.iplType = STATE_DISAPPEARING; - } - else if (prevStateType == textinput::MemoManager::ST_Disappearing && mState.type == textinput::MemoManager::ST_Hidden) { + } else if (prevStateType == textinput::MemoManager::ST_Disappearing && mState.type == textinput::MemoManager::ST_Hidden) { mState.iplType = STATE_HIDDEN_AFTER_DISAPPEAR; - } - else { + } else { mState.iplType = STATE_HIDDEN; } @@ -339,8 +336,7 @@ namespace ipl { if (con == NULL) { mpManager->updateInput(0, IPL_MATH_NULL_FLOAT, IPL_MATH_NULL_FLOAT, 0, 0, 0); - } - else { + } else { KPADStatus* kpadStatus = con->getKPADStatus(); nw4r::math::VEC2 conProjPos = con->getDpdProjectionPos(); @@ -412,8 +408,8 @@ namespace ipl { nw4r::ut::Rect projRect; System::getProjectionRect(&projRect); - if ((projRect.left > conProjPos.x || conProjPos.x > projRect.right) - || (projRect.top > conProjPos.y && conProjPos.y > projRect.bottom)) { + if ((projRect.left > conProjPos.x || conProjPos.x > projRect.right) || + (projRect.top > conProjPos.y && conProjPos.y > projRect.bottom)) { conProjPos.y = IPL_MATH_NULL_FLOAT; conProjPos.x = IPL_MATH_NULL_FLOAT; } @@ -422,8 +418,7 @@ namespace ipl { f32 posX = conProjPos.x; f32 posY = conProjPos.y; mpManager->updateInput(0, posX, -posY, trig, hold, release); - } - else { + } else { mpManager->updateInput(0, IPL_MATH_NULL_FLOAT, IPL_MATH_NULL_FLOAT, trig, hold, release); } } @@ -450,8 +445,7 @@ namespace ipl { setKeyboardType(chan, setting.type); if (setting.wcString == NULL) { mpManager->setWCString(L""); - } - else { + } else { mpManager->setWCString(setting.wcString); } mpManager->limitStringLength(setting.stringLimit); @@ -469,7 +463,8 @@ namespace ipl { mpManager->changeState(textinput::extend::memo::Manager::STL_Transition); snd::getSystem()->startSE("WIPL_SE_SK_DECIDE_CLOSE"); - if (mpManager->getConfigType() == textinput::extend::memo::Manager::CT_Letter || mpManager->getConfigType() == textinput::extend::memo::Manager::CT_PhotoLetter) { + if (mpManager->getConfigType() == textinput::extend::memo::Manager::CT_Letter || + mpManager->getConfigType() == textinput::extend::memo::Manager::CT_PhotoLetter) { doSave(); } } @@ -479,7 +474,8 @@ namespace ipl { mpManager->changeState(textinput::extend::memo::Manager::STL_Transition); snd::getSystem()->startSE("WIPL_SE_SK_CANCEL_CLOSE"); - if (mpManager->getConfigType() == textinput::extend::memo::Manager::CT_Letter || mpManager->getConfigType() == textinput::extend::memo::Manager::CT_PhotoLetter) { + if (mpManager->getConfigType() == textinput::extend::memo::Manager::CT_Letter || + mpManager->getConfigType() == textinput::extend::memo::Manager::CT_PhotoLetter) { doSave(); } } @@ -534,8 +530,7 @@ namespace ipl { case SC_LANG_ENGLISH: { if ((u32)System::getRegion() == SC_PRODUCT_AREA_EUR) { mpManager->setLanguage(textinput::UK); - } - else { + } else { mpManager->setLanguage(textinput::USA); } break; @@ -548,22 +543,9 @@ namespace ipl { } #ifdef JAPANESE_BUILD - static const char* sPredictionJP[] = { - "http://", - "www.", - ".jp", - ".co", - ".com", - ".net", - "https://", - ".ne", - ".or", - ".org", - ".html", - ".htm", - "index" - }; -#endif // JAPANESE_BUILD + static const char* sPredictionJP[] = {"http://", "www.", ".jp", ".co", ".com", ".net", "https://", + ".ne", ".or", ".org", ".html", ".htm", "index"}; +#endif // JAPANESE_BUILD void Manager::setConfigure(KeyboardType type) { mpManager->enableCompatibleFilter(true); @@ -632,14 +614,14 @@ namespace ipl { } #ifdef JAPANESE_BUILD mpManager->setDefaultPredictionJP(ARRAY_LENGTH(sPredictionJP), sPredictionJP); -#endif // JAPANESE_BUILD +#endif // JAPANESE_BUILD } void Manager::doSave() { textinput::extend::savedata::MemoSetting newSaveData = mpManager->getSaveData(); textinput::extend::savedata::MemoSetting oldSaveData = mSaveData; BOOL canSave = memcmp(&newSaveData, &oldSaveData, sizeof(textinput::extend::savedata::MemoSetting)) == 0 && mpSaveFile == NULL; - + if (canSave) { mSaveData = newSaveData; System::getSaveData()->setMemoSetting(mSaveData); @@ -668,5 +650,5 @@ namespace ipl { Manager::State* Manager::getState() { return &mState; } - } -} + } // namespace keyboard +} // namespace ipl diff --git a/src/system/iplMessage.cpp b/src/system/iplMessage.cpp index b2149fd7..f963e6e6 100644 --- a/src/system/iplMessage.cpp +++ b/src/system/iplMessage.cpp @@ -2,26 +2,27 @@ namespace ipl { namespace message { - Message::Message() - : mpInfoHeader(NULL), mpInfoData(NULL), mspMessageData(NULL) {} + Message::Message() : mpInfoHeader(NULL), mpInfoData(NULL), mspMessageData(NULL) { + } - Message::~Message() {} + Message::~Message() { + } void Message::setResource(u8* msgData) { MESGHeader* header = (MESGHeader*)(msgData); - msgData += sizeof(MESGHeader); // Start after the header + msgData += sizeof(MESGHeader); // Start after the header - for (int i = 0; i < header->sectionCount; i++) { // for every section available - #define CURRENT_SECTION ((MESGDataHeader*)(msgData)) + for (int i = 0; i < header->sectionCount; i++) { // for every section available +#define CURRENT_SECTION ((MESGDataHeader*)(msgData)) switch (CURRENT_SECTION->signature) { - case 'INF1': { // Meta Data section + case 'INF1': { // Meta Data section mpInfoHeader = (MESGInfoHeader*)(msgData); mpInfoData = (MESGInfoBlock*)(msgData + sizeof(MESGInfoHeader)); break; } - case 'DAT1': { // Data section + case 'DAT1': { // Data section mspMessageData = (u8*)(msgData + sizeof(MESGDataHeader)); break; } @@ -30,7 +31,7 @@ namespace ipl { // Next section! msgData += CURRENT_SECTION->size; - #undef CURRENT_SECTION +#undef CURRENT_SECTION } } @@ -39,5 +40,5 @@ namespace ipl { u32 off = (&mpInfoData->offset)[(u16)id]; return (wchar_t*)(mspMessageData + off); } - } -} + } // namespace message +} // namespace ipl diff --git a/src/system/iplMessageManager.cpp b/src/system/iplMessageManager.cpp index f6977bcb..9d887d64 100644 --- a/src/system/iplMessageManager.cpp +++ b/src/system/iplMessageManager.cpp @@ -7,7 +7,7 @@ namespace ipl { namespace message { Manager::Manager(EGG::Heap* heap) { - mpMessage = new(heap, 4) Message(); + mpMessage = new (heap, 4) Message(); initMessage(); } @@ -55,5 +55,5 @@ namespace ipl { } } } - } -} + } // namespace message +} // namespace ipl diff --git a/src/system/iplNand.cpp b/src/system/iplNand.cpp index cce9344e..836c715e 100644 --- a/src/system/iplNand.cpp +++ b/src/system/iplNand.cpp @@ -2,67 +2,47 @@ #include "config.h" -#include "system/rvl_dec.h" #include "iplSystem.h" #include "system/iplNandManager.h" +#include "system/rvl_dec.h" #include "iplUtility.h" -#include #include +#include #include -#define BUFFER_SIZE 0x1000 +#define BUFFER_SIZE 0x1000 -#define STANDARD_SIZE sizeof(MD5Head) -#define EXT_SIZE sizeof(MD5Head) + 0x20 +#define STANDARD_SIZE sizeof(MD5Head) +#define EXT_SIZE sizeof(MD5Head) + 0x20 namespace ipl { namespace nand { - Base::Base() {} - Base::~Base() {} + Base::Base() { + } + Base::~Base() { + } - File::File(EGG::Heap* heap, const char* fileName, ARCHandle* arc, const char* nandFileName, int offset, u32 length, bool bIsInNand) : - Base(), - mbDoneTask(FALSE), - mLastError(NAND_RESULT_OK), - mpHeap(heap), - mpArc(arc), - mFileOffset(offset), - mFileLength(length), - mFileMode(MODE_WRITE), - mFilePerms(NAND_ACCESS_NONE), - mpBuffer(NULL), mpCmpBuffer(NULL), - mResult(RESULT_NONE), - mbFatalError(false), - mbIsFullForTask(false), - mbIsNandFile(bIsInNand) { - strncpy(msFileName, fileName, NAND_MAX_PATH+1); + File::File(EGG::Heap* heap, const char* fileName, ARCHandle* arc, const char* nandFileName, int offset, u32 length, bool bIsInNand) + : Base(), mbDoneTask(FALSE), mLastError(NAND_RESULT_OK), mpHeap(heap), mpArc(arc), mFileOffset(offset), mFileLength(length), + mFileMode(MODE_WRITE), mFilePerms(NAND_ACCESS_NONE), mpBuffer(NULL), mpCmpBuffer(NULL), mResult(RESULT_NONE), mbFatalError(false), + mbIsFullForTask(false), mbIsNandFile(bIsInNand) { + strncpy(msFileName, fileName, NAND_MAX_PATH + 1); if (nandFileName) { - strncpy(msNandFileName, nandFileName, NAND_MAX_PATH+1); + strncpy(msNandFileName, nandFileName, NAND_MAX_PATH + 1); } memset(&mNandFile, 0, sizeof(NANDFileInfo)); } - File::File(EGG::Heap* heap, const char* fileName, u8* buffer, u32 length, u8 perms) : - Base(), - mbDoneTask(FALSE), - mLastError(NAND_RESULT_OK), - mpHeap(heap), - mpArc(NULL), - mFileOffset(0), - mFileLength(length), - mFileMode(MODE_READ), - mFilePerms(perms), - mpBuffer(buffer), mpCmpBuffer(NULL), - mResult(RESULT_NONE), - mbFatalError(false), - mbIsFullForTask(false), - mbIsNandFile(TRUE) { - strncpy(msFileName, fileName, NAND_MAX_PATH+1); + File::File(EGG::Heap* heap, const char* fileName, u8* buffer, u32 length, u8 perms) + : Base(), mbDoneTask(FALSE), mLastError(NAND_RESULT_OK), mpHeap(heap), mpArc(NULL), mFileOffset(0), mFileLength(length), + mFileMode(MODE_READ), mFilePerms(perms), mpBuffer(buffer), mpCmpBuffer(NULL), mResult(RESULT_NONE), mbFatalError(false), + mbIsFullForTask(false), mbIsNandFile(TRUE) { + strncpy(msFileName, fileName, NAND_MAX_PATH + 1); - mpCmpBuffer = new(mpHeap, -DEFAULT_ALIGN) u8[mFileLength]; + mpCmpBuffer = new (mpHeap, -DEFAULT_ALIGN) u8[mFileLength]; memcpy(mpCmpBuffer, mpBuffer, mFileLength); memset(&mNandFile, 0, sizeof(NANDFileInfo)); @@ -85,18 +65,15 @@ namespace ipl { } } return ARCOpen(mpArc, msFileName, &mArcFile) == TRUE; - } - else { + } else { // Is a NAND File? if (mbIsNandFile) { s32 result = wrapper::PrivateOpen(msFileName, &mNandFile, attr); return nand_error_handling(result); - } - else { // Is a System Menu file? + } else { // Is a System Menu file? if (System::getNandManager()->getDescriptor() < 0) { handle = NULL; - } - else { + } else { handle = System::getNandManager()->getArc(); } @@ -119,16 +96,14 @@ namespace ipl { result = wrapper::Read(&mNandFile, buffer, length); nand_error_handling(result); } - } - else { + } else { if (mbIsNandFile) { result = wrapper::Seek(&mNandFile, mFileOffset + offset, NAND_SEEK_BEG); nand_error_handling(result); result = wrapper::Read(&mNandFile, buffer, length); nand_error_handling(result); - } - else { + } else { arcOffset = ARCGetStartOffset(&mArcFile); result = ES_SeekContentFile(System::getNandManager()->getDescriptor(), mFileOffset + arcOffset + offset, NAND_SEEK_BEG); @@ -145,16 +120,13 @@ namespace ipl { } u32 File::getDecodeSize_(const u8* buffer) { - if (stricmp(&msFileName[strlen(msFileName) - 4], ".lz7") == 0) { // Check file extension + if (stricmp(&msFileName[strlen(msFileName) - 4], ".lz7") == 0) { // Check file extension return CXGetUncompressedSize(buffer); - } - else if (buffer[0] == 'Y') { // Is Yaz0? (.szs; horrible way to check) + } else if (buffer[0] == 'Y') { // Is Yaz0? (.szs; horrible way to check) return Rvl_decode_szs_size(buffer); - } - else if (buffer[0] == 'L') { // Is LZ77? (horrible way to check) + } else if (buffer[0] == 'L') { // Is LZ77? (horrible way to check) return CXGetUncompressedSize(&buffer[4]); - } - else { // Otherwise, it's an ASH file. + } else { // Otherwise, it's an ASH file. return Rvl_decode_ash_size(buffer); } } @@ -164,13 +136,11 @@ namespace ipl { if (mpArc) { length = ARCGetLength(&mArcFile); - } - else { + } else { if (mbIsNandFile) { s32 result = wrapper::GetLength(&mNandFile, &length); nand_error_handling(result); - } - else { + } else { length = ARCGetLength(&mArcFile); } } @@ -179,7 +149,7 @@ namespace ipl { } BOOL File::isSliCompressed(const u8* buffer) { - return NAND_CHECK_MAGIC3(buffer, 'Y','a','z'); + return NAND_CHECK_MAGIC3(buffer, 'Y', 'a', 'z'); } /* @@ -189,11 +159,11 @@ namespace ipl { */ BOOL File::isAsrCompressed(const u8* buffer) { - return NAND_CHECK_MAGIC3(buffer, 'A','S','H'); + return NAND_CHECK_MAGIC3(buffer, 'A', 'S', 'H'); } BOOL File::isAshCompressed(const u8* buffer) { - return NAND_CHECK_MAGIC3(buffer, 'A','S','R'); + return NAND_CHECK_MAGIC3(buffer, 'A', 'S', 'R'); } BOOL File::isLz7Compressed(const u8* buffer) { @@ -204,7 +174,7 @@ namespace ipl { // Check the magic else { BOOL result = FALSE; - if (NAND_CHECK_MAGIC4(buffer, 'L','Z','7','7')) { + if (NAND_CHECK_MAGIC4(buffer, 'L', 'Z', '7', '7')) { result = TRUE; } return result; @@ -214,8 +184,7 @@ namespace ipl { BOOL File::isCompressed(const u8* buffer) { if (isSliCompressed(buffer) || isAsrCompressed(buffer) || isAshCompressed(buffer) || isLz7Compressed(buffer)) { return TRUE; - } - else { + } else { return FALSE; } } @@ -223,8 +192,7 @@ namespace ipl { void File::uncompressLz7(const u8* src, u8* dest) { if (stricmp(&msFileName[strlen(msFileName) - 4], ".lz7") == 0) { CXUncompressLZ(src, dest); - } - else { + } else { CXUncompressLZ(&src[4], dest); } } @@ -242,30 +210,30 @@ namespace ipl { usedHeap = System::getMem2Root(); } - mpCmpBuffer = new(usedHeap, -DEFAULT_ALIGN) u8[mFileLength]; + mpCmpBuffer = new (usedHeap, -DEFAULT_ALIGN) u8[mFileLength]; } // Read header - u8 buffer[EXT_SIZE] ALIGN32; + u8 buffer[EXT_SIZE] ALIGN32; u8* pBuffer = buffer; readBlock_(buffer, mFileLength >= EXT_SIZE ? EXT_SIZE : STANDARD_SIZE); // For MD5 NETMD5Sum md5sum ALIGN32; - MD5Bool bHasMd5 = false; - MD5Head* md5Head = reinterpret_cast(buffer); + MD5Bool bHasMd5 = false; + MD5Head* md5Head = reinterpret_cast(buffer); u32 fileLen, fileOff = 0; // Check if the header is an MD5 file. - if (NAND_CHECK_MAGIC4(md5Head->sig, 'I','M','D','5')) { + if (NAND_CHECK_MAGIC4(md5Head->sig, 'I', 'M', 'D', '5')) { fileLen = md5Head->length; bHasMd5 = true; - memcpy(md5sum, md5Head->md5, NET_MD5_DIGEST_SIZE); // Copy MD5 sum + memcpy(md5sum, md5Head->md5, NET_MD5_DIGEST_SIZE); // Copy MD5 sum // Set offset to file data - fileOff = sizeof(MD5Head); + fileOff = sizeof(MD5Head); pBuffer += sizeof(MD5Head); } @@ -281,9 +249,8 @@ namespace ipl { // LZ77 compression if (isLz7Compressed(pBuffer)) { uncompressLz7(&mpCmpBuffer[fileOff], mpBuffer); - u32 rawSize = getRawSize_(); // Unused - } - else { // Any other compression + u32 rawSize = getRawSize_(); // Unused + } else { // Any other compression Rvl_decode(mpBuffer, &mpCmpBuffer[fileOff]); } @@ -291,8 +258,7 @@ namespace ipl { if (bHasMd5 == true) { mResult = calcMD5_(md5sum, &mpCmpBuffer[fileOff], fileLen); } - } - else { + } else { // Just read the data mpBuffer = getBuffer_(mFileLength - fileOff); readBlock_(mpBuffer, mFileLength - fileOff, fileOff); @@ -315,13 +281,14 @@ namespace ipl { u32 dummy = 0; } } - + mbDoneTask = TRUE; callback_(); } // For derived classes. - void File::callback_() {} + void File::callback_() { + } int File::calcMD5_(const u8* sum, const u8* buffer, u32 length) const { NETMD5Sum md5; @@ -343,64 +310,66 @@ namespace ipl { if (mbIsNandFile) { result = wrapper::Close(&mNandFile); return nand_error_handling(result); - } - else { + } else { return ARCClose(&mArcFile) == TRUE; } - } - else { + } else { if (mbIsNandFile) { result = wrapper::Close(&mNandFile); return nand_error_handling(result); - } - else { + } else { return ARCClose(&mArcFile) == TRUE; } } } u8* File::getBuffer_(u32 length) { - return new(mpHeap, DEFAULT_ALIGN) u8[length]; + return new (mpHeap, DEFAULT_ALIGN) u8[length]; } LangFile::LangFile(EGG::Heap* heap, const char* dirName, const char* fileName, ARCHandle* arc, bool bIsNandFile) { - char fullName[NAND_MAX_PATH+1]; - + char fullName[NAND_MAX_PATH + 1]; + mpCommonFile = NULL; mpLangFile = NULL; // Open the "common" file. - strncpy(fullName, dirName, NAND_MAX_PATH+1); - strncat(fullName, "/common/", (NAND_MAX_PATH+1) - strlen(fullName)); - strncat(fullName, fileName, (NAND_MAX_PATH+1) - strlen(fullName)); + strncpy(fullName, dirName, NAND_MAX_PATH + 1); + strncat(fullName, "/common/", (NAND_MAX_PATH + 1) - strlen(fullName)); + strncat(fullName, fileName, (NAND_MAX_PATH + 1) - strlen(fullName)); - mpCommonFile = new(heap, 4) File(heap, fullName, arc, NULL, 0, 0, bIsNandFile); + mpCommonFile = new (heap, 4) File(heap, fullName, arc, NULL, 0, 0, bIsNandFile); char* langPath = utility::Language::getPath(); // Open the language exclusive file - strncpy(fullName, dirName, NAND_MAX_PATH+1); - strncat(fullName, "/", (NAND_MAX_PATH+1) - strlen(fullName)); - strncat(fullName, langPath, (NAND_MAX_PATH+1) - strlen(fullName)); - strncat(fullName, "/", (NAND_MAX_PATH+1) - strlen(fullName)); - strncat(fullName, fileName, (NAND_MAX_PATH+1) - strlen(fullName)); + strncpy(fullName, dirName, NAND_MAX_PATH + 1); + strncat(fullName, "/", (NAND_MAX_PATH + 1) - strlen(fullName)); + strncat(fullName, langPath, (NAND_MAX_PATH + 1) - strlen(fullName)); + strncat(fullName, "/", (NAND_MAX_PATH + 1) - strlen(fullName)); + strncat(fullName, fileName, (NAND_MAX_PATH + 1) - strlen(fullName)); - mpLangFile = new(heap, 4) File(heap, fullName, arc, NULL, 0, 0, bIsNandFile); + mpLangFile = new (heap, 4) File(heap, fullName, arc, NULL, 0, 0, bIsNandFile); } LangFile::~LangFile() { - if (mpCommonFile) delete mpCommonFile; - if (mpLangFile) delete mpLangFile; + if (mpCommonFile) + delete mpCommonFile; + if (mpLangFile) + delete mpLangFile; } void LangFile::read() { - if (mpCommonFile) mpCommonFile->read(); - if (mpLangFile) mpLangFile->read(); + if (mpCommonFile) + mpCommonFile->read(); + if (mpLangFile) + mpLangFile->read(); } // `LayoutFile` is literally `LangFile` lol. LayoutFile::LayoutFile(EGG::Heap* heap, const char* dirName, const char* fileName, ARCHandle* arc, bool bIsNandFile) - : LangFile(heap, dirName, fileName, arc, bIsNandFile) {} + : LangFile(heap, dirName, fileName, arc, bIsNandFile) { + } void File::write() { u8 dummy; @@ -410,7 +379,7 @@ namespace ipl { usedHeap = System::getMem2Root(); } - u8* buffer = new(usedHeap, -DEFAULT_ALIGN) u8[BUFFER_SIZE]; + u8* buffer = new (usedHeap, -DEFAULT_ALIGN) u8[BUFFER_SIZE]; s32 result; BOOL success; @@ -442,10 +411,10 @@ namespace ipl { nand_error_handling(result); } -done: + done: delete[] buffer; delete[] mpCmpBuffer; - + mpCmpBuffer = NULL; mbDoneTask = TRUE; @@ -458,8 +427,7 @@ done: if (result >= 0) { return TRUE; - } - else { + } else { switch (result) { // If the file exists, move on. case NAND_RESULT_EXISTS: { @@ -499,7 +467,8 @@ done: } } - void Base::write() {} + void Base::write() { + } bool LangFile::isFatalError() { bool result = true; @@ -522,18 +491,22 @@ done: return result; } - bool File::isFatalError() { return mbFatalError; } + bool File::isFatalError() { + return mbFatalError; + } int LangFile::checkData() { - if (mpLangFile) return mpLangFile->checkData(); - if (mpCommonFile) return mpCommonFile->checkData(); + if (mpLangFile) + return mpLangFile->checkData(); + if (mpCommonFile) + return mpCommonFile->checkData(); return 0; } bool LangFile::isFinished() { bool result = false; bool finished = true; - + if (mpCommonFile && !mpCommonFile->isFinished()) { finished = false; } @@ -550,12 +523,20 @@ done: return result; } - - bool Base::isFatalError() { return false; } - int Base::checkData() { return 0; } - bool Base::isFinished() { return false; } - void Base::read() {} - - LayoutFile::~LayoutFile() {} - } -} + + bool Base::isFatalError() { + return false; + } + int Base::checkData() { + return 0; + } + bool Base::isFinished() { + return false; + } + void Base::read() { + } + + LayoutFile::~LayoutFile() { + } + } // namespace nand +} // namespace ipl diff --git a/src/system/iplNandManager.cpp b/src/system/iplNandManager.cpp index e1778e37..3fae0dd8 100644 --- a/src/system/iplNandManager.cpp +++ b/src/system/iplNandManager.cpp @@ -2,14 +2,14 @@ #include "system/iplNandManager.h" -#include "system/iplNandMeta.h" #include "iplSystem.h" +#include "system/iplNandMeta.h" #include #ifdef STAND_ALONE_BUILD #include "utility/iplESMisc.h" -#endif // STAND_ALONE_BUILD +#endif // STAND_ALONE_BUILD namespace ipl { namespace nand { @@ -41,9 +41,9 @@ namespace ipl { mDescriptor = ES_OpenTitleContentFile(SYSMENU_TITLE_ID, spSysMenuTik, SYSMENU_CONTENT_ID); #else mDescriptor = ES_OpenContentFile(SYSMENU_CONTENT_ID); -#endif // STAND_ALONE_BUILD +#endif // STAND_ALONE_BUILD if (mDescriptor < ES_ERR_OK) { - IPLErrorLogAndDisplay(MESG_ERR_FILE, "ES", mDescriptor, 43); + IPLErrorLogAndDisplay(MESG_ERR_FILE, "ES", mDescriptor, 43); } // Read archive header @@ -54,7 +54,7 @@ namespace ipl { } u32 bufSize = OSRoundUp32B(header.fileStart); - mpFSTBuffer = new(DEFAULT_ALIGN) u8[bufSize]; + mpFSTBuffer = new (DEFAULT_ALIGN) u8[bufSize]; // Seek to file system table offset ret = ES_SeekContentFile(mDescriptor, 0, NAND_SEEK_BEG); @@ -73,7 +73,8 @@ namespace ipl { } // Stub - void Manager::openContentsAll() {} + void Manager::openContentsAll() { + } void Manager::closeContentsAll() { #ifdef STAND_ALONE_BUILD @@ -87,18 +88,17 @@ namespace ipl { } File* Manager::readAsync(EGG::Heap* heap, const char* fileName, int offset, u32 length, bool bJamRequest) { - char fullName[NAND_MAX_PATH+1]; + char fullName[NAND_MAX_PATH + 1]; // Set up path strncpy(fullName, mNandPath, sizeof(mNandPath)); strncat(fullName, fileName, sizeof(mNandPath) - strlen(fullName)); - File* file = new(heap, 4) File(heap, fullName, NULL, NULL, offset, length, false); + File* file = new (heap, 4) File(heap, fullName, NULL, NULL, offset, length, false); if (bJamRequest) { mpTask->requestJam(doReadTask, file, NULL); - } - else { + } else { mpTask->request(doReadTask, file, NULL); } @@ -106,37 +106,40 @@ namespace ipl { } File* Manager::read(EGG::Heap* heap, const char* fileName, int offset, u32 length, bool bJamRequest) { - char fullName[NAND_MAX_PATH+1]; + char fullName[NAND_MAX_PATH + 1]; // Set up path strncpy(fullName, mNandPath, sizeof(mNandPath)); strncat(fullName, fileName, sizeof(mNandPath) - strlen(fullName)); - File* file = new(heap, 4) File(heap, fullName, NULL, NULL, offset, length, false); + File* file = new (heap, 4) File(heap, fullName, NULL, NULL, offset, length, false); file->read(); return file; } - SharedFile* Manager::readSharedAsync(EGG::Heap* heap, const char* fileName, int index, int offset, u32 length, ESTitleId titleId, int ticketIdx) { - SharedFile* file = new(heap, 4) SharedFile(heap, fileName, index, offset, length, titleId, ticketIdx); + SharedFile* Manager::readSharedAsync(EGG::Heap* heap, const char* fileName, int index, int offset, u32 length, ESTitleId titleId, + int ticketIdx) { + SharedFile* file = new (heap, 4) SharedFile(heap, fileName, index, offset, length, titleId, ticketIdx); mpTask->request(doReadTask, file, NULL); return file; } - MetaFile* Manager::readMetaHeaderAsync(EGG::Heap* heap, ESTitleId titleId, int offset, u32 length, MetaFile::Callback callback, void* callbackWork, int ticketIdx) { - MetaFile* file = new(heap, 4) MetaFile(heap, "", NULL, titleId, offset, length, callback, callbackWork, ticketIdx); + MetaFile* Manager::readMetaHeaderAsync(EGG::Heap* heap, ESTitleId titleId, int offset, u32 length, MetaFile::Callback callback, + void* callbackWork, int ticketIdx) { + MetaFile* file = new (heap, 4) MetaFile(heap, "", NULL, titleId, offset, length, callback, callbackWork, ticketIdx); System::getTask3()->request(doReadTask, file, NULL); return file; } - MetaFile* Manager::readMetaBodyAsync(EGG::Heap* heap, const char* fileName, ARCHandle* arc, ESTitleId titleId, int offset, u32 length, MetaFile::Callback callback, void* callbackWork, int ticketIdx) { - MetaFile* file = new(heap, 4) MetaFile(heap, fileName, arc, titleId, offset, length, callback, callbackWork, ticketIdx); + MetaFile* Manager::readMetaBodyAsync(EGG::Heap* heap, const char* fileName, ARCHandle* arc, ESTitleId titleId, int offset, u32 length, + MetaFile::Callback callback, void* callbackWork, int ticketIdx) { + MetaFile* file = new (heap, 4) MetaFile(heap, fileName, arc, titleId, offset, length, callback, callbackWork, ticketIdx); mpTask->request(doReadTask, file, NULL); @@ -149,8 +152,7 @@ namespace ipl { if (bJamRequest) { OSReport("Jam Request*****************************************************************\n"); mpTask->requestJam(doReadTask, file, NULL); - } - else { + } else { mpTask->request(doReadTask, file, NULL); } @@ -166,14 +168,14 @@ namespace ipl { } LayoutFile* Manager::readLayout_(EGG::Heap* heap, const char* fileName, ARCHandle* arc, bool bIsNand) { - char fullName[NAND_MAX_PATH+1]; + char fullName[NAND_MAX_PATH + 1]; // Set up path strncpy(fullName, mNandPath, sizeof(mNandPath)); strncat(fullName, "/layout", sizeof(mNandPath) - strlen(fullName)); - LayoutFile* file = new(heap, 4) LayoutFile(heap, fullName, fileName, arc, bIsNand); - + LayoutFile* file = new (heap, 4) LayoutFile(heap, fullName, fileName, arc, bIsNand); + return file; } @@ -198,12 +200,12 @@ namespace ipl { } File* Manager::write_(EGG::Heap* heap, const char* fileName, void* buffer, u32 length, u8 perms) { - char fullName[NAND_MAX_PATH+1]; + char fullName[NAND_MAX_PATH + 1]; strncpy(fullName, mNandPath, sizeof(mNandPath)); strncat(fullName, fileName, sizeof(mNandPath) - strlen(fullName)); - File* file = new(heap, 4) File(heap, fileName, (u8*)buffer, length, perms); + File* file = new (heap, 4) File(heap, fileName, (u8*)buffer, length, perms); return file; } @@ -216,7 +218,8 @@ namespace ipl { mpTask->request(doSendTokenTask, NULL, (void*)token); } - void Manager::doSendTokenTask(void* work) {} + void Manager::doSendTokenTask(void* work) { + } BOOL Manager::receiveToken(int* token) { BOOL result = FALSE; @@ -227,5 +230,5 @@ namespace ipl { return (result && msg != NULL) ? TRUE : FALSE; } - } -} + } // namespace nand +} // namespace ipl diff --git a/src/system/iplNandMeta.cpp b/src/system/iplNandMeta.cpp index 3719a4e8..0c1ef776 100644 --- a/src/system/iplNandMeta.cpp +++ b/src/system/iplNandMeta.cpp @@ -9,34 +9,29 @@ namespace ipl { namespace nand { - MetaFile::MetaFile(EGG::Heap* heap, const char* fileName, ARCHandle* arc, ESTitleId titleId, int offset, u32 length, Callback callBack, void* callBackWork, int ticketIdx) : - File(heap, fileName, arc, NULL, offset, length, false), - mDescriptor(-1), - mTitleId(titleId), - mTicket(NULL), - mTicketIdx(ticketIdx), - mbMetaInNand(false), - mCallback(callBack), - mCallbackWork(callBackWork) {} + MetaFile::MetaFile(EGG::Heap* heap, const char* fileName, ARCHandle* arc, ESTitleId titleId, int offset, u32 length, Callback callBack, + void* callBackWork, int ticketIdx) + : File(heap, fileName, arc, NULL, offset, length, false), mDescriptor(-1), mTitleId(titleId), mTicket(NULL), mTicketIdx(ticketIdx), + mbMetaInNand(false), mCallback(callBack), mCallbackWork(callBackWork) { + } - MetaFile::~MetaFile() {} + MetaFile::~MetaFile() { + } BOOL MetaFile::openNandFile_() { char fileName[48]; // Get title path - sprintf(fileName, "/meta/%08x/%08x/title.met", NANDTitleIdHi(mTitleId), NANDTitleIdLo(mTitleId)); + sprintf(fileName, "/meta/%08x/%08x/title.met", NANDTitleIdHi(mTitleId), NANDTitleIdLo(mTitleId)); if (mpArc) { s32 result = wrapper::PrivateOpen(fileName, &mNandFile, NAND_ACCESS_READ); if (nand_error_handling(result) == FALSE || ARCOpen(mpArc, msFileName, &mArcFile) == FALSE) { return FALSE; - } - else { + } else { return TRUE; } - } - else { + } else { s32 result = wrapper::PrivateOpen(fileName, &mNandFile, NAND_ACCESS_READ); return nand_error_handling(result); } @@ -49,8 +44,7 @@ namespace ipl { if (mpArc) { result = wrapper::Seek(&mNandFile, mFileOffset + ARCGetStartOffset(&mArcFile) + offset, 0); nand_error_handling(result); - } - else { + } else { result = wrapper::Seek(&mNandFile, mFileOffset + offset, 0); nand_error_handling(result); } @@ -76,8 +70,7 @@ namespace ipl { if (result < ES_ERR_OK) { line = 146; - } - else { + } else { // Open up the meta file from content index 0 (the 00000000.app file) result = ES_OpenTitleContentFile(mTitleId, mTicket, 0); mDescriptor = result; @@ -91,9 +84,9 @@ namespace ipl { // Otherwise if it could not open the file for any reason, abort. if (result < ES_ERR_OK) { line = 163; - } - else { - if (!mpArc) return TRUE; + } else { + if (!mpArc) + return TRUE; // Open up the arc file BOOL success = ARCOpen(mpArc, msFileName, &mArcFile); @@ -126,8 +119,7 @@ namespace ipl { if (result < ES_ERR_OK) { goto failed; } - } - else { + } else { result = ES_SeekContentFile(mDescriptor, mFileOffset + offset, 0); if (result < ES_ERR_OK) { goto failed; @@ -136,7 +128,7 @@ namespace ipl { // Read the file if (ES_ReadContentFile(mDescriptor, bufferOut, length) < ES_ERR_OK) { - failed: + failed: IPLErrorLogAndDisplay(MESG_ERR_FILE, "ES", 0, 230); } } @@ -148,8 +140,7 @@ namespace ipl { System::getMem2Sys()->free(mTicket); } return TRUE; - } - else { + } else { IPLErrorLogAndDisplay(MESG_ERR_FILE, "ES", 0, 253); return FALSE; } @@ -162,8 +153,7 @@ namespace ipl { BOOL MetaFile::close_() { if (mbMetaInNand) { return closeNandFile_(); - } - else { + } else { return closeTicketFile_(); } } @@ -175,8 +165,7 @@ namespace ipl { void MetaFile::readBlock_(void* buffer, int length, int offset) { if (mbMetaInNand) { readNandBlock_(buffer, length, offset); - } - else { + } else { readTicketBlock_(buffer, length, offset); } } @@ -186,5 +175,5 @@ namespace ipl { mCallback(mCallbackWork); } } - } -} + } // namespace nand +} // namespace ipl diff --git a/src/system/iplNandSDWorker.cpp b/src/system/iplNandSDWorker.cpp index 032340c5..8e0bf861 100644 --- a/src/system/iplNandSDWorker.cpp +++ b/src/system/iplNandSDWorker.cpp @@ -7,32 +7,32 @@ #include typedef struct SMetaBlockHeader { - char sig[4]; // 0x00 - u32 headSize; // 0x04 - u32 version; // 0x08 (always 3) + char sig[4]; // 0x00 + u32 headSize; // 0x04 + u32 version; // 0x08 (always 3) } SMetaBlockHeader; namespace ipl { BOOL NandSDWorker::check_header_base(const u8* bnrData, u32* headerSize) { SMetaBlockHeader* header = (SMetaBlockHeader*)(bnrData); - + u32 headSize = header->headSize; if (headerSize != NULL) { *headerSize = headSize; } - + // Check signature - if (!NAND_CHECK_MAGIC4(header->sig, 'I','M','E','T') || headSize < sizeof(channel::SMetaBlockHeader)) { + if (!NAND_CHECK_MAGIC4(header->sig, 'I', 'M', 'E', 'T') || headSize < sizeof(channel::SMetaBlockHeader)) { OSReport("BANNER WARNING: invalid signature or header size %d\n", headSize); return FALSE; } - + // Check version if (header->version != META_CURRENT_VERSION) { OSReport("BANNER WARNING: different version v.%d ( now v.%d)\n", header->version, META_CURRENT_VERSION); return FALSE; } - + return TRUE; } -} +} // namespace ipl diff --git a/src/system/iplNandShared.cpp b/src/system/iplNandShared.cpp index a50c9120..c68cc6e0 100644 --- a/src/system/iplNandShared.cpp +++ b/src/system/iplNandShared.cpp @@ -7,16 +7,13 @@ namespace ipl { namespace nand { - SharedFile::SharedFile(EGG::Heap* heap, const char* fileName, u32 index, int offset, u32 length, ESTitleId titleId, int ticketIdx) : - File(heap, fileName, NULL, NULL, offset, length, false), - mContentIdx(index), - mDescriptor(-1), - mTitleId(titleId), - mTicket(NULL), - mTicketIdx(ticketIdx), - mpFSTBuffer(NULL) {} + SharedFile::SharedFile(EGG::Heap* heap, const char* fileName, u32 index, int offset, u32 length, ESTitleId titleId, int ticketIdx) + : File(heap, fileName, NULL, NULL, offset, length, false), mContentIdx(index), mDescriptor(-1), mTitleId(titleId), mTicket(NULL), + mTicketIdx(ticketIdx), mpFSTBuffer(NULL) { + } - SharedFile::~SharedFile() {} + SharedFile::~SharedFile() { + } BOOL SharedFile::openTicketFile_() { int code = 0; @@ -29,8 +26,7 @@ namespace ipl { code = 100; goto err; } - } - else { + } else { ESTicketView* tik; u32 tikCount; @@ -41,8 +37,7 @@ namespace ipl { memcpy(mTicket, &tik[tikIdx], sizeof(ESTicketView)); System::getSharedHeap()->free(tik); } - } - else { + } else { goto err; } } @@ -56,7 +51,7 @@ namespace ipl { errcode = ret; goto err; } - + ARCHeader header ALIGN32; if (ES_ReadContentFile(mDescriptor, &header, sizeof(ARCHeader)) < ES_ERR_OK) { code = 500; @@ -66,9 +61,8 @@ namespace ipl { u32 bufSize = OSRoundUp32B(header.fileStart); mpFSTBuffer = System::getSharedHeap()->alloc(bufSize, -DEFAULT_ALIGN); - if (ES_SeekContentFile(mDescriptor, 0, NAND_SEEK_BEG) < ES_ERR_OK - || ES_ReadContentFile(mDescriptor, mpFSTBuffer, bufSize) < ES_ERR_OK - || !ARCInitHandle(mpFSTBuffer, &mArc)) { + if (ES_SeekContentFile(mDescriptor, 0, NAND_SEEK_BEG) < ES_ERR_OK || ES_ReadContentFile(mDescriptor, mpFSTBuffer, bufSize) < ES_ERR_OK || + !ARCInitHandle(mpFSTBuffer, &mArc)) { code = 600; goto err; } @@ -76,14 +70,13 @@ namespace ipl { BOOL result = ARCOpen(&mArc, msFileName, &mArcFile); if (result && ES_CloseContentFile(mDescriptor) >= ES_ERR_OK) { return result == TRUE; - } - else { - err: + } else { + err: char errString[192]; sprintf(errString, "ES %d, %llx, %llx, %x", errcode, mTitleId, erridx); IPLErrorLogAndDisplay(MESG_ERR_FILE, errString, code, 158); - + return FALSE; } } @@ -99,8 +92,7 @@ namespace ipl { } return TRUE; - } - else { + } else { IPLErrorLogAndDisplay(MESG_ERR_FILE, "ES", 0, 189); return FALSE; @@ -122,10 +114,10 @@ namespace ipl { void SharedFile::readBlock_(void* buffer, int length, int offset) { int arcOffset = ARCGetStartOffset(&mArcFile); - if (ES_SeekContentFile(mDescriptor, arcOffset + offset, NAND_SEEK_BEG) < ES_ERR_OK - || ES_ReadContentFile(mDescriptor, buffer, length) < ES_ERR_OK) { + if (ES_SeekContentFile(mDescriptor, arcOffset + offset, NAND_SEEK_BEG) < ES_ERR_OK || + ES_ReadContentFile(mDescriptor, buffer, length) < ES_ERR_OK) { IPLErrorLogAndDisplay(MESG_ERR_FILE, "ES", 0, 358); } } - } -} + } // namespace nand +} // namespace ipl diff --git a/src/system/iplNandWall.cpp b/src/system/iplNandWall.cpp index e340cc09..ddce9550 100644 --- a/src/system/iplNandWall.cpp +++ b/src/system/iplNandWall.cpp @@ -5,11 +5,11 @@ #include -#define MINIMUM_GLOBAL_NAND_BLOCKS 3592 /* 449 data management blocks */ -#define MINIMUM_GLOBAL_NAND_INODES 128 +#define MINIMUM_GLOBAL_NAND_BLOCKS 3592 /* 449 data management blocks */ +#define MINIMUM_GLOBAL_NAND_INODES 128 -#define REQUIRED_BOOT_NAND_BLOCKS 3584 /* 448 data management blocks */ -#define REQUIRED_BOOT_NAND_INODES 96 +#define REQUIRED_BOOT_NAND_BLOCKS 3584 /* 448 data management blocks */ +#define REQUIRED_BOOT_NAND_INODES 96 namespace ipl { namespace nandwall { @@ -43,8 +43,7 @@ namespace ipl { // Check if NAND is full if (!isNandCapacity()) { System::setNandFull(true); - } - else { + } else { System::setNandFull(false); } } @@ -56,9 +55,8 @@ namespace ipl { if (user_used_fsblocks <= NAND_MAX_USER_BLOCKS && user_used_inodes <= NAND_MAX_USER_INODES && global_free_fsblock >= MINIMUM_GLOBAL_NAND_BLOCKS && global_free_inode >= MINIMUM_GLOBAL_NAND_INODES) { return TRUE; // We have enough free space! - } - else { - return FALSE; // We do not have enough free space! + } else { + return FALSE; // We do not have enough free space! } } @@ -68,7 +66,7 @@ namespace ipl { u32 used = status->usedBlocks; u32 exclude = bad + reserved + NAND_CRITICAL_BLOCKS; - *freeINodes = (NAND_MAX_INODES) - status->usedInodes; + *freeINodes = (NAND_MAX_INODES)-status->usedInodes; *freeBlocks = (NAND_MAX_BLOCKS - exclude) - status->usedBlocks; } @@ -89,14 +87,13 @@ namespace ipl { // Exclude the amount of blocks used in the "tmp" folder freeBlocks += excludedBlocks; freeINodes += excludedINodes - 1; - + // Check if we have enough to boot an application if (freeBlocks >= REQUIRED_BOOT_NAND_BLOCKS && freeINodes >= REQUIRED_BOOT_NAND_INODES) { return TRUE; - } - else { + } else { return FALSE; } } - } -} + } // namespace nandwall +} // namespace ipl diff --git a/src/system/iplNandWrapper.cpp b/src/system/iplNandWrapper.cpp index 3108e7f8..7ace2093 100644 --- a/src/system/iplNandWrapper.cpp +++ b/src/system/iplNandWrapper.cpp @@ -4,52 +4,108 @@ namespace ipl { namespace nand { namespace wrapper { BOOL _condition(int result, int tries); - - #define MAX_TRIES 10 - #define NAND_WRAPPER(r) \ - int tries = 0; \ - s32 result; \ - do { result = r; } while (_condition(result, ++tries)); \ - if (tries == MAX_TRIES) { result = NAND_RESULT_FATAL_ERROR; } \ - return result; +#define MAX_TRIES 10 - #define NAND_SAFE_WRAPPER(r) \ - s32 result = r; \ - if (result != NAND_RESULT_OK) { result = NAND_RESULT_FATAL_ERROR; } \ - return result; +#define NAND_WRAPPER(r) \ + int tries = 0; \ + s32 result; \ + do { \ + result = r; \ + } while (_condition(result, ++tries)); \ + if (tries == MAX_TRIES) { \ + result = NAND_RESULT_FATAL_ERROR; \ + } \ + return result; +#define NAND_SAFE_WRAPPER(r) \ + s32 result = r; \ + if (result != NAND_RESULT_OK) { \ + result = NAND_RESULT_FATAL_ERROR; \ + } \ + return result; - s32 Create(const char* path, u8 perm, u8 attr) { NAND_WRAPPER(NANDCreate(path, perm, attr)); } - s32 Open(const char* path, NANDFileInfo* info, u8 accType) { NAND_WRAPPER(NANDOpen(path, info, accType)); } - s32 Close(NANDFileInfo* info) { NAND_WRAPPER(NANDClose(info)); } - s32 Read(NANDFileInfo* info, void* buffer, u32 length) { NAND_WRAPPER(NANDRead(info, buffer, length)); } - s32 Write(NANDFileInfo* info, const void* buffer, u32 length) { NAND_WRAPPER(NANDWrite(info, buffer, length)); } - s32 Seek(NANDFileInfo* info, s32 offset, s32 whence) { NAND_WRAPPER(NANDSeek(info, offset, whence)); } - s32 GetLength(NANDFileInfo* info, u32* length) { NAND_WRAPPER(NANDGetLength(info, length)); } - s32 SafeClose(NANDFileInfo* info) { NAND_SAFE_WRAPPER(NANDSafeClose(info)); } - s32 ReadDir(const char* path, char* nameList, u32* num) { NAND_WRAPPER(NANDReadDir(path, nameList, num)); } - s32 CreateDir(const char* path, u8 perm, u8 attr) { NAND_WRAPPER(NANDCreateDir(path, perm, attr)); } - s32 ChangeDir(const char* path) { NAND_WRAPPER(NANDChangeDir(path)); } - s32 Delete(const char* path) { NAND_WRAPPER(NANDDelete(path)); } - s32 GetStatus(const char* path, NANDStatus* status) { NAND_WRAPPER(NANDGetStatus(path, status)); } - s32 GetType(const char* path, u8* type) { NAND_WRAPPER(NANDGetType(path, type)); } + s32 Create(const char* path, u8 perm, u8 attr) { + NAND_WRAPPER(NANDCreate(path, perm, attr)); + } + s32 Open(const char* path, NANDFileInfo* info, u8 accType) { + NAND_WRAPPER(NANDOpen(path, info, accType)); + } + s32 Close(NANDFileInfo* info) { + NAND_WRAPPER(NANDClose(info)); + } + s32 Read(NANDFileInfo* info, void* buffer, u32 length) { + NAND_WRAPPER(NANDRead(info, buffer, length)); + } + s32 Write(NANDFileInfo* info, const void* buffer, u32 length) { + NAND_WRAPPER(NANDWrite(info, buffer, length)); + } + s32 Seek(NANDFileInfo* info, s32 offset, s32 whence) { + NAND_WRAPPER(NANDSeek(info, offset, whence)); + } + s32 GetLength(NANDFileInfo* info, u32* length) { + NAND_WRAPPER(NANDGetLength(info, length)); + } + s32 SafeClose(NANDFileInfo* info) { + NAND_SAFE_WRAPPER(NANDSafeClose(info)); + } + s32 ReadDir(const char* path, char* nameList, u32* num) { + NAND_WRAPPER(NANDReadDir(path, nameList, num)); + } + s32 CreateDir(const char* path, u8 perm, u8 attr) { + NAND_WRAPPER(NANDCreateDir(path, perm, attr)); + } + s32 ChangeDir(const char* path) { + NAND_WRAPPER(NANDChangeDir(path)); + } + s32 Delete(const char* path) { + NAND_WRAPPER(NANDDelete(path)); + } + s32 GetStatus(const char* path, NANDStatus* status) { + NAND_WRAPPER(NANDGetStatus(path, status)); + } + s32 GetType(const char* path, u8* type) { + NAND_WRAPPER(NANDGetType(path, type)); + } - s32 PrivateCreate(const char* path, u8 perm, u8 attr) { NAND_WRAPPER(NANDPrivateCreate(path, perm, attr)); } - s32 PrivateOpen(const char* path, NANDFileInfo* info, u8 accType) { NAND_WRAPPER(NANDPrivateOpen(path, info, accType)); } - s32 PrivateSafeOpen(const char* path, NANDFileInfo* info, u8 accType, void* buffer, u32 length) { NAND_SAFE_WRAPPER(NANDPrivateSafeOpen(path, info, accType, buffer, length)); } - s32 PrivateReadDir(const char* path, char* nameList, u32* num) { NAND_WRAPPER(NANDPrivateReadDir(path, nameList, num)); } - s32 PrivateCreateDir(const char* path, u8 perm, u8 attr) { NAND_WRAPPER(NANDPrivateCreateDir(path, perm, attr)); } - s32 PrivateDelete(const char* path) { NAND_WRAPPER(NANDPrivateDelete(path)); } - s32 PrivateMove(const char* path, const char* destDir) { NAND_WRAPPER(NANDPrivateMove(path, destDir)); } - s32 PrivateGetType(const char* path, u8* type) { NAND_WRAPPER(NANDPrivateGetType(path, type)); } + s32 PrivateCreate(const char* path, u8 perm, u8 attr) { + NAND_WRAPPER(NANDPrivateCreate(path, perm, attr)); + } + s32 PrivateOpen(const char* path, NANDFileInfo* info, u8 accType) { + NAND_WRAPPER(NANDPrivateOpen(path, info, accType)); + } + s32 PrivateSafeOpen(const char* path, NANDFileInfo* info, u8 accType, void* buffer, u32 length) { + NAND_SAFE_WRAPPER(NANDPrivateSafeOpen(path, info, accType, buffer, length)); + } + s32 PrivateReadDir(const char* path, char* nameList, u32* num) { + NAND_WRAPPER(NANDPrivateReadDir(path, nameList, num)); + } + s32 PrivateCreateDir(const char* path, u8 perm, u8 attr) { + NAND_WRAPPER(NANDPrivateCreateDir(path, perm, attr)); + } + s32 PrivateDelete(const char* path) { + NAND_WRAPPER(NANDPrivateDelete(path)); + } + s32 PrivateMove(const char* path, const char* destDir) { + NAND_WRAPPER(NANDPrivateMove(path, destDir)); + } + s32 PrivateGetType(const char* path, u8* type) { + NAND_WRAPPER(NANDPrivateGetType(path, type)); + } - s32 SecretGetUsage(const char* path, u32* usedBlocks, u32* usedINodes) { NAND_WRAPPER(NANDSecretGetUsage(path, usedBlocks, usedINodes)); } - s32 SecretGetUserUsage(u32* usedUserBlocks, u32* usedUserINodes) { NAND_WRAPPER(NANDSecretGetUserUsage(usedUserBlocks, usedUserINodes)); } - s32 SecretGetSystemAvailableArea(const NANDFileSystemStatus *status, u32 usedSystemBlocks, u32 usedSystemINode, u32 *freeSystemBlocks, u32 *freeSystemINode) { + s32 SecretGetUsage(const char* path, u32* usedBlocks, u32* usedINodes) { + NAND_WRAPPER(NANDSecretGetUsage(path, usedBlocks, usedINodes)); + } + s32 SecretGetUserUsage(u32* usedUserBlocks, u32* usedUserINodes) { + NAND_WRAPPER(NANDSecretGetUserUsage(usedUserBlocks, usedUserINodes)); + } + s32 SecretGetSystemAvailableArea(const NANDFileSystemStatus* status, u32 usedSystemBlocks, u32 usedSystemINode, u32* freeSystemBlocks, + u32* freeSystemINode) { NAND_WRAPPER(NANDSecretGetSystemAvailableArea(status, usedSystemBlocks, usedSystemINode, freeSystemBlocks, freeSystemINode)); } - s32 SecretGetFileSystemStatus(NANDFileSystemStatus *status) { NAND_WRAPPER(NANDSecretGetFileSystemStatus(status)); } + s32 SecretGetFileSystemStatus(NANDFileSystemStatus* status) { + NAND_WRAPPER(NANDSecretGetFileSystemStatus(status)); + } BOOL _condition(int result, int tries) { BOOL bTryAgain = FALSE; @@ -64,6 +120,6 @@ namespace ipl { return bTryAgain; } - } - } -} + } // namespace wrapper + } // namespace nand +} // namespace ipl diff --git a/src/system/iplNigaoe.cpp b/src/system/iplNigaoe.cpp index 9c6c8998..bd88dd1e 100644 --- a/src/system/iplNigaoe.cpp +++ b/src/system/iplNigaoe.cpp @@ -10,21 +10,13 @@ namespace ipl { namespace nigaoe { - Object::Object(EGG::Heap* heap, int width, int height, int faceId, MakeIconCallback callback, void* callbackWork) : - mFaceId(faceId), - mpCharData(NULL), - mCallBack(callback), - mpCallBackWork(callbackWork), - mbCreated(false) { + Object::Object(EGG::Heap* heap, int width, int height, int faceId, MakeIconCallback callback, void* callbackWork) + : mFaceId(faceId), mpCharData(NULL), mCallBack(callback), mpCallBackWork(callbackWork), mbCreated(false) { init(heap, width, height); } - Object::Object(EGG::Heap* heap, int width, int height, RFLiCharData* faceData, MakeIconCallback callback, void* callbackWork) : - mFaceId(-1), - mpCharData(faceData), - mCallBack(callback), - mpCallBackWork(callbackWork), - mbCreated(false) { + Object::Object(EGG::Heap* heap, int width, int height, RFLiCharData* faceData, MakeIconCallback callback, void* callbackWork) + : mFaceId(-1), mpCharData(faceData), mCallBack(callback), mpCallBackWork(callbackWork), mbCreated(false) { init(heap, width, height); } @@ -32,17 +24,17 @@ namespace ipl { // Prepare icon settings mIconSettings.width = width; mIconSettings.height = height; - + mIconSettings.bgType = RFLIconBG_Direct; mIconSettings.bgColor = (GXColor){0, 0, 0, 0}; - + mIconSettings.drawXluOnly = FALSE; // Prepare icon buffer. u32 iconSize = width * height * GX_RGB5A3_SIZE; mIconSize = iconSize; - - mpIconTex = new(heap, DEFAULT_ALIGN) u8[iconSize]; + + mpIconTex = new (heap, DEFAULT_ALIGN) u8[iconSize]; } Object::~Object() { @@ -50,30 +42,29 @@ namespace ipl { } void Object::make_icon() { - GXRenderModeObj *rMode; + GXRenderModeObj* rMode; RFLErrcode err = RFLErrcode_Success; - + if (mpCharData != NULL) { RFLiMakeIconFromData(mpIconTex, mpCharData, RFLExp_Normal, &mIconSettings); - } - else { + } else { err = RFLMakeIcon(mpIconTex, RFLDataSource_Official, NULL, mFaceId, RFLExp_Normal, &mIconSettings); } - + if (err != RFLErrcode_Success) { memset(mpIconTex, 0, mIconSize); DCStoreRange(mpIconTex, mIconSize); } - + rMode = System::getRenderModeObj(); - + GXSetCopyFilter(rMode->aa, rMode->sample_pattern, GX_TRUE, rMode->vfilter); GXSetDither(GX_TRUE); - + GXInitTexObj(&mFaceTexObj, mpIconTex, mIconSettings.width, mIconSettings.height, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE); - + mbCreated = true; mCallBack(this, mpCallBackWork); } - } -} + } // namespace nigaoe +} // namespace ipl diff --git a/src/system/iplNigaoeManager.cpp b/src/system/iplNigaoeManager.cpp index 074f91bd..57df9419 100644 --- a/src/system/iplNigaoeManager.cpp +++ b/src/system/iplNigaoeManager.cpp @@ -14,7 +14,7 @@ namespace ipl { namespace nigaoe { - #define IPL_NIGAOE_ICON_MAX 10 +#define IPL_NIGAOE_ICON_MAX 10 Manager::Manager(EGG::Heap* heap) { mResFile = System::getRFLArc(); @@ -24,18 +24,18 @@ namespace ipl { mErrcode = RFLInitRes(work, mResFile->getBuffer(), mResFile->getLength(), FALSE); nw4r::ut::List_Init(&mObjects, offsetof(Object, mLink)); - + { // Init arrays unsigned char mac[NCD_MAC_ADDRESS_LENGTH + 1]; - mac[6] = mac[5] = mac[4] = mac[3] = mac[2] = mac[1] = mac[0] = 0; + mac[6] = mac[5] = mac[4] = mac[3] = mac[2] = mac[1] = mac[0] = 0; unsigned char temp[3]; temp[2] = temp[1] = temp[0] = 0; // Setup work unsigned char* ncd_mac = ncd::NCDSetting::getMacAddr(); - + // Get mac values for (int i = 1; i < NCD_MAC_ADDRESS_LENGTH; i++) { memcpy(temp, &ncd_mac[i * ARRAY_LENGTH(temp)], sizeof(temp) - 1); @@ -48,21 +48,22 @@ namespace ipl { Object* Manager::create(EGG::Heap* heap, int width, int height, int faceId, Object::MakeIconCallback callback, void* callbackWork) { // Create mii and append to list - Object* obj = new(heap, 4) Object(heap, width, height, faceId, callback, callbackWork); + Object* obj = new (heap, 4) Object(heap, width, height, faceId, callback, callbackWork); nw4r::ut::List_Append(&mObjects, obj); return obj; } - Object* Manager::create(EGG::Heap* heap, int width, int height, RFLiCharData* faceData, Object::MakeIconCallback callback, void* callbackWork) { + Object* Manager::create(EGG::Heap* heap, int width, int height, RFLiCharData* faceData, Object::MakeIconCallback callback, + void* callbackWork) { // Create mii and append to list - Object* obj = new(heap, 4) Object(heap, width, height, faceData, callback, callbackWork); + Object* obj = new (heap, 4) Object(heap, width, height, faceData, callback, callbackWork); nw4r::ut::List_Append(&mObjects, obj); return obj; } void Manager::makeIcon() { int i = 0; - + if (RFLGetAsyncStatus() != RFLErrcode_Busy) { Object* obj; for (; (obj = reinterpret_cast(nw4r::ut::List_GetFirst(&mObjects))) != NULL && i < IPL_NIGAOE_ICON_MAX; i++) { @@ -102,7 +103,7 @@ namespace ipl { if (!RFLiCheckValidInfo(&info)) { result = FALSE; } - + return result; } @@ -113,9 +114,9 @@ namespace ipl { void Manager::commitHiddenDB() { nwc24::Manager* nwc24Manager = System::getNwc24Manager(); - - RFLiCharData charData; - NWC24MsgObj msgObj; + + RFLiCharData charData; + NWC24MsgObj msgObj; if (nwc24Manager) { if (nwc24Manager->open()) { @@ -127,5 +128,5 @@ namespace ipl { } } } - } -} + } // namespace nigaoe +} // namespace ipl diff --git a/src/system/iplNwc24Manager.cpp b/src/system/iplNwc24Manager.cpp index 049180e8..3edb0ea5 100644 --- a/src/system/iplNwc24Manager.cpp +++ b/src/system/iplNwc24Manager.cpp @@ -14,33 +14,29 @@ namespace ipl { namespace nwc24 { - Manager::Arg Manager::smArg; + Manager::Arg Manager::smArg; - #if defined(VERSION_43U) - static const NWC24EncodingRegion ENCODING_REGION = NWC24_ENCODING_REGION_USA; - #elif defined(VERSION_43E) - static const NWC24EncodingRegion ENCODING_REGION = NWC24_ENCODING_REGION_EUR; - #elif defined(VERSION_43J) - static const NWC24EncodingRegion ENCODING_REGION = NWC24_ENCODING_REGION_JPN; - #elif defined(VERSION_43K) - static const NWC24EncodingRegion ENCODING_REGION = NWC24_ENCODING_REGION_KOR; - #else - static const NWC24EncodingRegion ENCODING_REGION = NWC24_ENCODING_REGION_NON; - #endif +#if defined(VERSION_43U) + static const NWC24EncodingRegion ENCODING_REGION = NWC24_ENCODING_REGION_USA; +#elif defined(VERSION_43E) + static const NWC24EncodingRegion ENCODING_REGION = NWC24_ENCODING_REGION_EUR; +#elif defined(VERSION_43J) + static const NWC24EncodingRegion ENCODING_REGION = NWC24_ENCODING_REGION_JPN; +#elif defined(VERSION_43K) + static const NWC24EncodingRegion ENCODING_REGION = NWC24_ENCODING_REGION_KOR; +#else + static const NWC24EncodingRegion ENCODING_REGION = NWC24_ENCODING_REGION_NON; +#endif - #define FILE_ERROR_OK \ - (((mLastError > NWC24_ERR_FILE_OPEN || mLastError < NWC24_ERR_FILE_OTHER) && mLastError != NWC24_ERR_NAND_CORRUPT) \ - && (mLastError != NWC24_ERR_FILE_EXISTS && mLastError != NWC24_ERR_INTERNAL_VF && mLastError != NWC24_ERR_FILE_BROKEN)) +#define FILE_ERROR_OK \ + (((mLastError > NWC24_ERR_FILE_OPEN || mLastError < NWC24_ERR_FILE_OTHER) && mLastError != NWC24_ERR_NAND_CORRUPT) && \ + (mLastError != NWC24_ERR_FILE_EXISTS && mLastError != NWC24_ERR_INTERNAL_VF && mLastError != NWC24_ERR_FILE_BROKEN)) - Manager::Manager(EGG::Heap* heap) : - mbReviecedMsg(false), - unk_0xA31(false), - mbReceivePaused(false), - unk_0xA33(false) { + Manager::Manager(EGG::Heap* heap) : mbReviecedMsg(false), unk_0xA31(false), mbReceivePaused(false), unk_0xA33(false) { OSInitMutex(&mLock); OSInitMutex(&mAutoLock); - mpLibWork = new(heap, DEFAULT_ALIGN) u8[0x4000]; + mpLibWork = new (heap, DEFAULT_ALIGN) u8[0x4000]; memset(&smArg, 0, sizeof(smArg)); @@ -94,7 +90,8 @@ namespace ipl { return error_handling(err, 295); } - BOOL Manager::setMsgSubjectAndTextPublic(NWC24MsgObj* msg, const u16* subject, u32 subjectLen, const u16* text, u32 textLen, u8* work, u32 workSize) { + BOOL Manager::setMsgSubjectAndTextPublic(NWC24MsgObj* msg, const u16* subject, u32 subjectLen, const u16* text, u32 textLen, u8* work, + u32 workSize) { NWC24Err err = NWC24SetMsgSubjectAndTextPublic(msg, subject, subjectLen, text, textLen, ENCODING_REGION, -1, work, workSize); return error_handling(err, 418); } @@ -123,22 +120,22 @@ namespace ipl { NWC24Err err = NWC24GetNumMsgs(msgBoxType, numMsgs); return error_handling(err, 492); } - + BOOL Manager::getMsgIdList(const NWC24MBoxType msgBoxType, u32* msgIds, u32 maxLength) { NWC24Err err = NWC24GetMsgIdList(msgBoxType, msgIds, maxLength); return error_handling(err, 505); } - + BOOL Manager::getMsgObj(NWC24MsgObj* msg, NWC24MBoxType msgBoxType, u32 index) { NWC24Err err = NWC24GetMsgObj(msg, msgBoxType, index); return error_handling(err, 518); } - + BOOL Manager::getMsgType(const NWC24MsgObj* msg, NWC24MsgType* type) { NWC24Err err = NWC24GetMsgType(msg, type); return error_handling(err, 530); } - + BOOL Manager::getMsgAppId(const NWC24MsgObj* msg, u32* appId) { NWC24Err err = NWC24GetMsgAppId(msg, appId); return error_handling(err, 542); @@ -153,7 +150,7 @@ namespace ipl { NWC24Err err = NWC24GetMsgTextSize(msg, textLen); return error_handling(err, 566); } - + BOOL Manager::getMsgSubjectSize(const NWC24MsgObj* msg, u32* subjectLen) { NWC24Err err = NWC24GetMsgSubjectSize(msg, subjectLen); return error_handling(err, 578); @@ -238,7 +235,7 @@ namespace ipl { NWC24Err err = NWC24ReadMsgMBUpdateSW(msg, mbUpdateSW); return error_handling_ignore_file(err, 869); } - + BOOL Manager::readMsgMBOptOutFlag(const NWC24MsgObj* msg, BOOL* mbOptOutFlag, u32* appId) { NWC24Err err = NWC24ReadMsgMBOptOutFlag(msg, mbOptOutFlag, appId); return error_handling_ignore_file(err, 882); @@ -259,11 +256,9 @@ namespace ipl { BOOL result; if (err == FALSE) { result = FALSE; - } - else if (err == TRUE) { + } else if (err == TRUE) { result = TRUE; - } - else { + } else { return error_handling(err, 920); } return result; @@ -494,22 +489,22 @@ namespace ipl { NWC24iGetSchedulerStat(&smArg.mScheduleStat, sizeof(NWC24ScdStat)); // Print Scheduler status - OSReport("permission %d\n",smArg.mScheduleStat.permission); - OSReport("last task err %d\n",smArg.mScheduleStat.lastCriticalError); - OSReport("new msg flag %d\n",smArg.mScheduleStat.newMsgFlag); - OSReport("cur task err %d\n",smArg.mScheduleStat.taskStage); - OSReport("err num %d\n",smArg.mScheduleStat.numErrors); - OSReport("send msg num %d\n",smArg.mScheduleStat.numMsgSent); - OSReport("recv msg num %d\n",smArg.mScheduleStat.numMsgReceived); - OSReport("save msg num %d\n",smArg.mScheduleStat.numMsgSaved); - OSReport("refuse msg num %d\n",smArg.mScheduleStat.numMsgRejected); - OSReport("filter msg num %d\n",smArg.mScheduleStat.numMsgFiltered); - OSReport("confirm task num %d\n",smArg.mScheduleStat.countMailChk); - OSReport("recv task num %d\n",smArg.mScheduleStat.countMailRcv); - OSReport("save task num %d\n",smArg.mScheduleStat.countMailSav); - OSReport("send task num %d\n",smArg.mScheduleStat.countMailSnd); - OSReport("download task num %d\n",smArg.mScheduleStat.countDL); - OSReport("friend %d\n",smArg.mScheduleStat.countEstablished); + OSReport("permission %d\n", smArg.mScheduleStat.permission); + OSReport("last task err %d\n", smArg.mScheduleStat.lastCriticalError); + OSReport("new msg flag %d\n", smArg.mScheduleStat.newMsgFlag); + OSReport("cur task err %d\n", smArg.mScheduleStat.taskStage); + OSReport("err num %d\n", smArg.mScheduleStat.numErrors); + OSReport("send msg num %d\n", smArg.mScheduleStat.numMsgSent); + OSReport("recv msg num %d\n", smArg.mScheduleStat.numMsgReceived); + OSReport("save msg num %d\n", smArg.mScheduleStat.numMsgSaved); + OSReport("refuse msg num %d\n", smArg.mScheduleStat.numMsgRejected); + OSReport("filter msg num %d\n", smArg.mScheduleStat.numMsgFiltered); + OSReport("confirm task num %d\n", smArg.mScheduleStat.countMailChk); + OSReport("recv task num %d\n", smArg.mScheduleStat.countMailRcv); + OSReport("save task num %d\n", smArg.mScheduleStat.countMailSav); + OSReport("send task num %d\n", smArg.mScheduleStat.countMailSnd); + OSReport("download task num %d\n", smArg.mScheduleStat.countDL); + OSReport("friend %d\n", smArg.mScheduleStat.countEstablished); // Open NWC24 Library if (!open()) { @@ -532,7 +527,7 @@ namespace ipl { int iconNewCount = 0; int iconNewIndex = 0; - + u8 recordFlags; // Now begin!!! @@ -573,8 +568,7 @@ namespace ipl { readFriendInfo(&friendInfo, index); wcsncpy(msgFriendName, (wchar_t*)friendInfo.attr.name, 12); } - } - else { + } else { u32 index = 0; getMsgFromId(&msgObj, &msgFriendAddr.wiiId); msgFriendType = msgFriendAddr.wiiId == myUserId ? NWC24_FRIENDTYPE_NONE : NWC24_FRIENDTYPE_WII; @@ -615,8 +609,7 @@ namespace ipl { // Get Mii data if (msgAppId == ES_TITLE_CODE(TITLE_NIGAOE_ALL)) { RFLiCharData charData; - if (RFLiNWC24Msg2CharData(&charData, &msgObj) - && System::getMiiManager()->isValid(&charData)) { + if (RFLiNWC24Msg2CharData(&charData, &msgObj) && System::getMiiManager()->isValid(&charData)) { System::getMiiManager()->addHiddenDB(&msgObj); } @@ -643,8 +636,7 @@ namespace ipl { else { if (msgBoardUpdateSW) { recordFlags = RBRRecordType_SWUpdate; - } - else { + } else { recordFlags = RBRRecordType_Letter; } } @@ -670,8 +662,7 @@ namespace ipl { // Skip message if we have not passed the delay timer continue; } - } - else if (!FILE_ERROR_OK) { + } else if (!FILE_ERROR_OK) { goto out; } @@ -688,8 +679,7 @@ namespace ipl { msgMbRegDate.year = msgYear; msgMbRegDate.mon = msgMonth - 1; msgMbRegDate.mday = msgDay; - } - else if (!FILE_ERROR_OK) { + } else if (!FILE_ERROR_OK) { goto out; } @@ -715,8 +705,7 @@ namespace ipl { // Get Mii data bool msgHasMii = false; RFLiCharData msgCharData; - if (RFLiNWC24Msg2CharData(&msgCharData, &msgObj) - && System::getMiiManager()->isValid(&msgCharData)) { + if (RFLiNWC24Msg2CharData(&msgCharData, &msgObj) && System::getMiiManager()->isValid(&msgCharData)) { System::getMiiManager()->addHiddenDB(&msgObj); msgHasMii = true; } @@ -739,7 +728,7 @@ namespace ipl { // Get attachment data for (int attachIndex = 0; attachIndex < msgNumAttached; attachIndex++) { getMsgAttachedSize(&msgObj, attachIndex, &mAttachSize[attachIndex]); - mAttachData[attachIndex] = new(heap, DEFAULT_ALIGN) u8[mAttachSize[attachIndex]]; + mAttachData[attachIndex] = new (heap, DEFAULT_ALIGN) u8[mAttachSize[attachIndex]]; if (mAttachData[attachIndex] == NULL) { mAttachSize[attachIndex] = 0; break; @@ -758,8 +747,7 @@ namespace ipl { if (encode_odh(heap, attachIndex)) { msgAttachTypes[attachIndex] = RBRAttachmentType_Picture; rbrFileType = RBRFileType_Odh; - } - else { + } else { if (mAttachData[attachIndex] != NULL) { delete mAttachData[attachIndex]; mAttachData[attachIndex] = NULL; @@ -771,15 +759,14 @@ namespace ipl { mAttachSize[attachIndex] = System::getInvalidJpegImage()->getLength(); - mAttachData[attachIndex] = new(heap, DEFAULT_ALIGN) u8[mAttachSize[attachIndex]]; + mAttachData[attachIndex] = new (heap, DEFAULT_ALIGN) u8[mAttachSize[attachIndex]]; memcpy(mAttachData[attachIndex], invalidJpegImage->getBuffer(), mAttachSize[attachIndex]); - + // Attempt to convert to ODH (AJPG) if (encode_odh(heap, attachIndex)) { msgAttachTypes[attachIndex] = RBRAttachmentType_Picture; rbrFileType = RBRFileType_Odh; - } - else { + } else { // Failed to do that too? Don't use it. if (mAttachData[attachIndex] != NULL) { delete mAttachData[attachIndex]; @@ -788,8 +775,7 @@ namespace ipl { mAttachSize[attachIndex] = 0; } } - } - else { + } else { delete[] mAttachData[attachIndex]; mAttachData[attachIndex] = NULL; mAttachSize[attachIndex] = 0; @@ -798,11 +784,10 @@ namespace ipl { } // For ODH files case NWC24_X_WII_PICTURE: { - if (strcmp(rbrFileType, RBRFileType_Txt) == 0 && mAttachSize[attachIndex] < NWC24_ATTACH_PICTURE_MAX+0x1400) { + if (strcmp(rbrFileType, RBRFileType_Txt) == 0 && mAttachSize[attachIndex] < NWC24_ATTACH_PICTURE_MAX + 0x1400) { msgAttachTypes[attachIndex] = RBRAttachmentType_Picture; rbrFileType = RBRFileType_Odh; - } - else { + } else { delete[] mAttachData[attachIndex]; mAttachData[attachIndex] = NULL; mAttachSize[attachIndex] = 0; @@ -814,8 +799,7 @@ namespace ipl { if (isMsgBoardData == false && mAttachSize[attachIndex] < NWC24_ATTACH_MSGBOARD_MAX) { msgAttachTypes[attachIndex] = RBRAttachmentType_MsgBoard; isMsgBoardData = true; - } - else { + } else { delete[] mAttachData[attachIndex]; mAttachData[attachIndex] = NULL; mAttachSize[attachIndex] = 0; @@ -827,8 +811,7 @@ namespace ipl { if (strcmp(rbrFileType, RBRFileType_Txt) == 0 && mAttachSize[attachIndex] < NWC24_ATTACH_MINIDATA_MAX) { msgAttachTypes[attachIndex] = RBRAttachmentType_MiniData; rbrFileType = RBRFileType_Dat; - } - else { + } else { delete[] mAttachData[attachIndex]; mAttachData[attachIndex] = NULL; mAttachSize[attachIndex] = 0; @@ -850,8 +833,7 @@ namespace ipl { // Decide position f32 left, right, top, bottom; RBRGetPosRect(&left, &right, &top, &bottom); - math::VEC2 msgBoardPos(left + (right - left) * System::getRndm()->get_f01(), - top + (bottom - top ) * System::getRndm()->get_f01()); + math::VEC2 msgBoardPos(left + (right - left) * System::getRndm()->get_f01(), top + (bottom - top) * System::getRndm()->get_f01()); // Get current time (For backup incase we have not got the message date) BOOL enabled = OSDisableInterrupts(); @@ -859,32 +841,23 @@ namespace ipl { OSRestoreInterrupts(enabled); // Decide record flags - RBRRecordFlags msgRecordFlags = { 0 }; + RBRRecordFlags msgRecordFlags = {0}; msgRecordFlags.type = recordFlags; if (msgBoardCanOptOut) { msgRecordFlags.optOut |= TRUE; } // And now lets create a CDBRecord of the message! - System::getCdbManager()->createNewRecord("ripl_board_record", - rbrFileType, - msgUseMbRegDate ? &msgMbRegDate : &currTime, - msgGroupId == 1 || msgGroupId == 0 ? NULL : &msgAppId, - msgGroupId == 1 || msgGroupId == 0 ? NULL : &msgGroupId, - msgBoardPos, - msgRecordFlags.data, - msgFriendAddr, - msgFriendType, - msgNoReply, - msgTitleText[0] != 0 ? msgTitleText : msgFriendName, - msgBodyText, - msgHasMii ? &msgCharData : NULL, - (const void**)mAttachData, mAttachSize, msgAttachTypes); + System::getCdbManager()->createNewRecord( + "ripl_board_record", rbrFileType, msgUseMbRegDate ? &msgMbRegDate : &currTime, + msgGroupId == 1 || msgGroupId == 0 ? NULL : &msgAppId, msgGroupId == 1 || msgGroupId == 0 ? NULL : &msgGroupId, msgBoardPos, + msgRecordFlags.data, msgFriendAddr, msgFriendType, msgNoReply, msgTitleText[0] != 0 ? msgTitleText : msgFriendName, + msgBodyText, msgHasMii ? &msgCharData : NULL, (const void**)mAttachData, mAttachSize, msgAttachTypes); -out2: + out2: mbReviecedMsg = true; -out: + out: if (msgBodyText != NULL) { delete[] msgBodyText; } @@ -905,8 +878,7 @@ out: if (System::getCdbManager()->isOverFlow() || mbReceivePaused) { break; } - } - else if (msgType == NWC24_MSGTYPE_WII_APP || msgType == NWC24_MSGTYPE_WII_APP_HIDDEN) { + } else if (msgType == NWC24_MSGTYPE_WII_APP || msgType == NWC24_MSGTYPE_WII_APP_HIDDEN) { u32 iconNewSign; if (getMsgIconNewSign(&msgObj, &iconNewSign) && iconNewCount < MAX_MESSAGES_COUNT) { iconNewCount++; @@ -935,19 +907,19 @@ out: if (++i > 1000) { break; } -start: + start: if (open()) { char fullDlUrl[64]; memset(fullDlUrl, 0, sizeof(fullDlUrl)); - NWC24DlId dlIds[4] = { 0, 1, 5, 6 }; - u16 dlIntervals[4] = { 240, 240, 240, 240 }; - u8 dlPrios[4] = { 128, 160, 200, 240 }; + NWC24DlId dlIds[4] = {0, 1, 5, 6}; + u16 dlIntervals[4] = {240, 240, 240, 240}; + u8 dlPrios[4] = {128, 160, 200, 240}; for (int j = 0; j < 4; j++) { // Add DL task for announcements - snprintf(fullDlUrl, sizeof(fullDlUrl)/sizeof(char), - "http://cfh.wapp.wii.com/announce/%03d/%d/%d.bin", address.id >> SC_SIMPLE_ADDRESS_ID_COUNTRY, System::getLanguage(), j+1); + snprintf(fullDlUrl, sizeof(fullDlUrl) / sizeof(char), "http://cfh.wapp.wii.com/announce/%03d/%d/%d.bin", + address.id >> SC_SIMPLE_ADDRESS_ID_COUNTRY, System::getLanguage(), j + 1); add_dl_task(dlIds[j], fullDlUrl, dlIntervals[j], dlPrios[j]); } @@ -970,8 +942,7 @@ start: initDlTask(&dlTask, NWC24_DLTYPE_MULTIPART_V2); setDlId(&dlTask, id); setDlFlags(&dlTask, 0); - } - else { + } else { return; } } @@ -982,8 +953,7 @@ start: if (newTask) { addDlTask(&dlTask); - } - else { + } else { updateDlTask(&dlTask); } @@ -1032,7 +1002,7 @@ start: mAttachData[attachIndex] = NULL; mJpegSize = NWC24_ATTACH_PICTURE_MAX; - mJpegData = new(heap, DEFAULT_ALIGN) u8[NWC24_ATTACH_PICTURE_MAX]; + mJpegData = new (heap, DEFAULT_ALIGN) u8[NWC24_ATTACH_PICTURE_MAX]; if (mJpegData != NULL) { // Then encode ODH with the decoded JPEG @@ -1042,21 +1012,18 @@ start: result = TRUE; mAttachData[attachIndex] = mJpegData; mAttachSize[attachIndex] = mJpegSize; - } - else { + } else { delete[] mJpegData; mJpegData = NULL; } } jpegDecoder->clear(); - } - else { + } else { delete[] mAttachData[attachIndex]; mAttachData[attachIndex] = NULL; } - } - else { + } else { delete[] mAttachData[attachIndex]; mAttachData[attachIndex] = NULL; } @@ -1065,31 +1032,35 @@ start: } wchar_t* Manager::make_text(EGG::Heap* heap, const NWC24MsgObj* msg, bool bIncludeSubject, u32* failFlag) { - wchar_t* fullText = NULL; + wchar_t* fullText = NULL; - u32 subjectGotSize = 0; - wchar_t* subject = NULL; - u32 subjectLen = 0; - u8* subjectWork = NULL; + u32 subjectGotSize = 0; + wchar_t* subject = NULL; + u32 subjectLen = 0; + u8* subjectWork = NULL; - u32 textGotSize = 0; - wchar_t* text = NULL; - u32 textLen = 0; - u8* textWork = NULL; + u32 textGotSize = 0; + wchar_t* text = NULL; + u32 textLen = 0; + u8* textWork = NULL; *failFlag = FALSE; // Read subject text if (bIncludeSubject) { getMsgSubjectSize(msg, &subjectGotSize); + if (subjectGotSize > 1) { subjectLen = NWC24_MSG_SUBJECT_LENGTH; - subject = new(heap, -4) wchar_t[NWC24_MSG_SUBJECT_LENGTH+1]; - subjectWork = new(heap, -4) u8[NWC24_SUBJECT_PUBLIC_WORK_SIZE+4]; + subject = new (heap, -4) wchar_t[NWC24_MSG_SUBJECT_LENGTH + 1]; + subjectWork = new (heap, -4) u8[NWC24_SUBJECT_PUBLIC_WORK_SIZE + 4]; + if (subject != NULL && subjectWork != NULL) { - memset(subject, 0, (NWC24_MSG_SUBJECT_LENGTH+1) * sizeof(wchar_t)); - memset(subjectWork, 0, NWC24_SUBJECT_PUBLIC_WORK_SIZE+4); + memset(subject, 0, (NWC24_MSG_SUBJECT_LENGTH + 1) * sizeof(wchar_t)); + memset(subjectWork, 0, NWC24_SUBJECT_PUBLIC_WORK_SIZE + 4); + readMsgSubjectPublic(msg, (u16*)subject, &subjectLen, subjectWork, NWC24_SUBJECT_PUBLIC_WORK_SIZE); + if (!FILE_ERROR_OK) { *failFlag = TRUE; goto out; @@ -1102,19 +1073,20 @@ start: getMsgTextSize(msg, &textGotSize); if (textGotSize != 0) { textLen = NWC24_MSG_TEXT_LENGTH; - text = new(heap, -4) wchar_t[NWC24_MSG_TEXT_LENGTH+1]; - textWork = new(heap, -4) u8[NWC24_TEXT_PUBLIC_WORK_SIZE+4]; + text = new (heap, -4) wchar_t[NWC24_MSG_TEXT_LENGTH + 1]; + textWork = new (heap, -4) u8[NWC24_TEXT_PUBLIC_WORK_SIZE + 4]; + if (text != NULL && textWork != NULL) { - memset(text, 0, (NWC24_MSG_TEXT_LENGTH+1) * sizeof(wchar_t)); - memset(textWork, 0, NWC24_TEXT_PUBLIC_WORK_SIZE+4); + memset(text, 0, (NWC24_MSG_TEXT_LENGTH + 1) * sizeof(wchar_t)); + memset(textWork, 0, NWC24_TEXT_PUBLIC_WORK_SIZE + 4); + if (bIncludeSubject) { readMsgTextPublic(msg, (u16*)text, &textLen, textWork, NWC24_TEXT_PUBLIC_WORK_SIZE); if (!FILE_ERROR_OK) { *failFlag = TRUE; goto out; } - } - else { + } else { NWC24Charset charset; NWC24Encoding encoding; readMsgText(msg, (char*)text, textLen * sizeof(wchar_t), &charset, &encoding); @@ -1129,9 +1101,11 @@ start: // Combine subject and text if (subjectLen != 0 || textLen != 0) { int fullTextLen = subjectLen + textLen + 4; - fullText = new(heap, 4) wchar_t[fullTextLen]; + fullText = new (heap, 4) wchar_t[fullTextLen]; + if (fullText != NULL) { memset(fullText, 0, fullTextLen * (int)sizeof(wchar_t)); + if (bIncludeSubject && subjectLen != 0 && subjectGotSize > 1) { wcsncat(fullText, subject, fullTextLen - wcslen(fullText)); wcsncat(fullText, L"\n\n", fullTextLen - wcslen(fullText)); @@ -1142,7 +1116,7 @@ start: } } -out: + out: if (subject != NULL) { delete[] subject; } @@ -1163,7 +1137,7 @@ out: return TRUE; } - char appIdStr[sizeof(appId)+sizeof(groupId)]; + char appIdStr[sizeof(appId) + sizeof(groupId)]; memset(appIdStr, 0, sizeof(appIdStr)); strncpy(appIdStr, (char*)&appId, sizeof(appId)); @@ -1227,5 +1201,5 @@ out: } return error_handling(code, line); } - } -} + } // namespace nwc24 +} // namespace ipl diff --git a/src/system/iplPlayTimeLog.cpp b/src/system/iplPlayTimeLog.cpp index 3638bf14..aee5669c 100644 --- a/src/system/iplPlayTimeLog.cpp +++ b/src/system/iplPlayTimeLog.cpp @@ -33,24 +33,23 @@ namespace ipl { if (smArg.mDateTime.year > MAX_YEAR) { smArg.mDateTime.year = MAX_YEAR; - smArg.mDateTime.mon = MAX_MONTH-1; + smArg.mDateTime.mon = MAX_MONTH - 1; smArg.mDateTime.mday = MAX_DAY; OSTime time = OSCalendarTimeToTicks(&smArg.mDateTime); - OSTicksToCalendarTime(time ,&smArg.mDateTime); - } - else if (smArg.mDateTime.year < MIN_YEAR) { + OSTicksToCalendarTime(time, &smArg.mDateTime); + } else if (smArg.mDateTime.year < MIN_YEAR) { smArg.mDateTime.year = MIN_YEAR; - smArg.mDateTime.mon = MIN_MONTH-1; + smArg.mDateTime.mon = MIN_MONTH - 1; smArg.mDateTime.mday = MIN_DAY; OSTime time = OSCalendarTimeToTicks(&smArg.mDateTime); - OSTicksToCalendarTime(time ,&smArg.mDateTime); + OSTicksToCalendarTime(time, &smArg.mDateTime); } smArg.mbCheckSucceed = false; CDBDate begin = CDBMakeCDBDate(smArg.mDateTime.year, smArg.mDateTime.mon, smArg.mDateTime.mday, MIN_HOUR, MIN_MINUTE, MIN_SECOND); CDBDate end = CDBMakeCDBDate(smArg.mDateTime.year, smArg.mDateTime.mon, smArg.mDateTime.mday, MAX_HOUR, MAX_MINUTE, MAX_SECOND); - + cdbManager->search(begin, end, CDB_SEARCH_DIRECTION_RIGHT, CDB_RECORD_LOCATION_NAND, 0, search_cb_, &smArg); if (!smArg.mbCheckSucceed) { @@ -80,7 +79,7 @@ namespace ipl { smArg.mDateTime = System::getCurrentTime(); memset(smArg.mFriendNameBuf, 0, sizeof(smArg.mFriendNameBuf)); - wcsncpy(smArg.mFriendNameBuf, stringBuf, NWC24_FRIEND_NAME_LENGTH-2); + wcsncpy(smArg.mFriendNameBuf, stringBuf, NWC24_FRIEND_NAME_LENGTH - 2); cdb::Manager* cdbManager = System::getCdbManager(); @@ -88,7 +87,7 @@ namespace ipl { CDBDate begin = CDBMakeCDBDate(smArg.mDateTime.year, smArg.mDateTime.mon, smArg.mDateTime.mday, MIN_HOUR, MIN_MINUTE, MIN_SECOND); CDBDate end = CDBMakeCDBDate(smArg.mDateTime.year, smArg.mDateTime.mon, smArg.mDateTime.mday, MAX_HOUR, MAX_MINUTE, MAX_SECOND); - + cdbManager->search(begin, end, CDB_SEARCH_DIRECTION_RIGHT, CDB_RECORD_LOCATION_NAND, 0, search_cb_, &smArg); if (!smArg.mbCheckSucceed) { @@ -99,7 +98,7 @@ namespace ipl { BOOL PlayTimeLog::check(CDBRecord* record) { BOOL result = TRUE; - cdb::Manager* cdbManager = System::getCdbManager(); // unused + cdb::Manager* cdbManager = System::getCdbManager(); // unused char type[RBR_FILETYPE_LENGTH] = ""; @@ -126,7 +125,7 @@ namespace ipl { void PlayTimeLog::set_time_str(wchar_t* timeStr, u32 time) { u32 hour = time / 60; u32 minute = time % 60; - + const wchar_t* msg = System::getMessage(MESG_PLAY_TIME_TIME_SEPERATOR); int msgLen = wcslen(msg); @@ -146,7 +145,7 @@ namespace ipl { timeStr[i++] = 0; } - void PlayTimeLog::set_num_str(wchar_t* numStr, u32 num) { + void PlayTimeLog::set_num_str(wchar_t* numStr, u32 num) { u32 result; int index; @@ -173,7 +172,7 @@ namespace ipl { } wchar_t* PlayTimeLog::create_text(const EventBuffer* event) { - wchar_t* string = new(System::getMailWorkHeap(), 4) wchar_t[STRINGBUF_LIMIT]; + wchar_t* string = new (System::getMailWorkHeap(), 4) wchar_t[STRINGBUF_LIMIT]; memset(string, 0, STRINGBUF_LIMIT * sizeof(wchar_t)); // Create log buffer @@ -213,8 +212,7 @@ namespace ipl { u32 time = OSTicksToSeconds(logBuffer->entries[i].playRecord.playTime - logBuffer->entries[i].playRecord.playStartTime) / 60; if (time == 0) { time = 1; - } - else if ((time / 60) >= 24) { + } else if ((time / 60) >= 24) { time = 1439; } set_time_str(timeStr, time); @@ -332,7 +330,7 @@ namespace ipl { memset(&event.sendMsg, 0, sizeof(SendMsgBuffer)); memset(event.sendMsg.entries[0].friendName, 0, sizeof(event.sendMsg.entries[0].friendName)); - wcsncpy(event.sendMsg.entries[0].friendName, stringBuf, NWC24_FRIEND_NAME_LENGTH-2); + wcsncpy(event.sendMsg.entries[0].friendName, stringBuf, NWC24_FRIEND_NAME_LENGTH - 2); event.sendMsg.entries[0].alreadyAdded = true; create_new_record(&event); @@ -341,44 +339,25 @@ namespace ipl { // https://decomp.me/scratch/sRhsi // Some sort of hellhole with loading arguments for createNewRecord?? void PlayTimeLog::create_new_record(const EventBuffer* event) { - cdb::Manager* cdbManager = System::getCdbManager(); + cdb::Manager* cdbManager = System::getCdbManager(); - const wchar_t* bodyText = create_text(event); - const wchar_t* titleText = System::getMessage(MESG_PLAY_TIME_TITLE); + const wchar_t* bodyText = create_text(event); + const wchar_t* titleText = System::getMessage(MESG_PLAY_TIME_TITLE); - math::VEC2 recordPos(0, 0); + math::VEC2 recordPos(0, 0); - const void* attachData[RBR_ATTACHMENT_MAX] = { - (void*)event, - NULL - }; + const void* attachData[RBR_ATTACHMENT_MAX] = {(void*)event, NULL}; - u32 attachSize[RBR_ATTACHMENT_MAX] = { - sizeof(EventBuffer), - 0 - }; + u32 attachSize[RBR_ATTACHMENT_MAX] = {sizeof(EventBuffer), 0}; - RBRAttachmentType attachType[RBR_ATTACHMENT_MAX] = { - RBRAttachmentType_PlayTimeLog, - RBRAttachmentType_None - }; + RBRAttachmentType attachType[RBR_ATTACHMENT_MAX] = {RBRAttachmentType_PlayTimeLog, RBRAttachmentType_None}; NWC24FriendAddr friendAddr; memset(&friendAddr, 0, sizeof(NWC24FriendAddr)); - cdbManager->createNewRecord("playtimelog", - RBRFileType_Log, - &mDateTime, - NULL, - NULL, - recordPos, - RBR_MAKE_RECORDFLAGS(RBRRecordType_PlayTimeLog, FALSE), - friendAddr, - NWC24_FRIENDTYPE_NONE, - RBRReplyFlag_NotAvailable, - titleText, bodyText, - NULL, - attachData, attachSize, attachType); + cdbManager->createNewRecord("playtimelog", RBRFileType_Log, &mDateTime, NULL, NULL, recordPos, + RBR_MAKE_RECORDFLAGS(RBRRecordType_PlayTimeLog, FALSE), friendAddr, NWC24_FRIENDTYPE_NONE, + RBRReplyFlag_NotAvailable, titleText, bodyText, NULL, attachData, attachSize, attachType); delete[] bodyText; } @@ -424,7 +403,7 @@ namespace ipl { for (int i = 0; i < LOG_MAX_ENTRIES; i++) { if (!event.sendMsg.entries[i].alreadyAdded) { memset(event.sendMsg.entries[i].friendName, 0, sizeof(smArg.mFriendNameBuf)); - wcsncpy(event.sendMsg.entries[i].friendName, stringBuf, NWC24_FRIEND_NAME_LENGTH-2); + wcsncpy(event.sendMsg.entries[i].friendName, stringBuf, NWC24_FRIEND_NAME_LENGTH - 2); result = event.sendMsg.entries[i].alreadyAdded = true; break; } @@ -448,7 +427,7 @@ namespace ipl { u32 recordSize; cdbManager->getDataSize(record, &recordSize); - buffer = new(System::getMailWorkHeap(), 4) u8[recordSize]; + buffer = new (System::getMailWorkHeap(), 4) u8[recordSize]; cdbManager->read(record, buffer, recordSize); RBRHeader* header = (RBRHeader*)buffer; @@ -468,26 +447,19 @@ namespace ipl { } void PlayTimeLog::write_record(CDBRecord* record, EventBuffer* event, u8* buffer) { - cdb::Manager* cdbManager = System::getCdbManager(); + cdb::Manager* cdbManager = System::getCdbManager(); - const wchar_t* bodyText = create_text(event); + const wchar_t* bodyText = create_text(event); - const void* attachData[RBR_ATTACHMENT_MAX] = { (void*)event, NULL }; - u32 attachSize[RBR_ATTACHMENT_MAX] = { sizeof(EventBuffer), 0 }; - RBRAttachmentType attachType[RBR_ATTACHMENT_MAX] = { RBRAttachmentType_PlayTimeLog, RBRAttachmentType_None }; + const void* attachData[RBR_ATTACHMENT_MAX] = {(void*)event, NULL}; + u32 attachSize[RBR_ATTACHMENT_MAX] = {sizeof(EventBuffer), 0}; + RBRAttachmentType attachType[RBR_ATTACHMENT_MAX] = {RBRAttachmentType_PlayTimeLog, RBRAttachmentType_None}; - RBRHeader* header = (RBRHeader*)buffer; + RBRHeader* header = (RBRHeader*)buffer; cdbManager->seek(record, 0, CDB_SEEK_BEGIN); - cdbManager->writeRecord(record, math::VEC2(header->xPos, header->yPos), - header->flags.data, - header->addr, - header->addrType, - header->noReplyFlag, - (wchar_t*)&buffer[header->titleOffset], - bodyText, - NULL, - attachData, attachSize, attachType); + cdbManager->writeRecord(record, math::VEC2(header->xPos, header->yPos), header->flags.data, header->addr, header->addrType, + header->noReplyFlag, (wchar_t*)&buffer[header->titleOffset], bodyText, NULL, attachData, attachSize, attachType); delete[] bodyText; delete[] buffer; @@ -500,5 +472,5 @@ namespace ipl { math::VEC2 ForceCTORWeak() { return math::VEC2(NULL, NULL); } -#endif // NON_MATCHING -} +#endif // NON_MATCHING +} // namespace ipl diff --git a/src/system/iplPointer.cpp b/src/system/iplPointer.cpp index ca50c102..e7037436 100644 --- a/src/system/iplPointer.cpp +++ b/src/system/iplPointer.cpp @@ -1,14 +1,16 @@ #include "system/iplPointer.h" +#include #include #include -#include #include "iplSystem.h" namespace ipl { - #define MIN_LENGTH 32.f - #define MAX_LENGTH 128.f +#define MIN_LENGTH 32.f +#define MAX_LENGTH 128.f + + // clang-format off enum { POINT_DOWN = 0, @@ -42,17 +44,14 @@ namespace ipl { "my_BScroll_a.brlyt" }; - Pointer::Pointer(EGG::Heap* heap) : - mIsScrolling(POINT_NOT_SCROLLING), - mOriginPos(0.f, 0.f), - mArrowLength(MIN_LENGTH), - mPointDirection(POINT_DOWN), - mbScrolling(false), - mbVisible(true), - mCore() { + // clang-format on + + Pointer::Pointer(EGG::Heap* heap) + : mIsScrolling(POINT_NOT_SCROLLING), mOriginPos(0.f, 0.f), mArrowLength(MIN_LENGTH), mPointDirection(POINT_DOWN), mbScrolling(false), + mbVisible(true), mCore() { mpLayoutArchive = System::getNandManager()->readLayout(heap, "cursor.ash"); for (int i = 0; i < MAX_LAYOUT_FILES; i++) { - mpLayout[i] = new(heap, 4) layout::Object(heap, mpLayoutArchive, "arc", scLayoutName[i]); + mpLayout[i] = new (heap, 4) layout::Object(heap, mpLayoutArchive, "arc", scLayoutName[i]); mpLayout[i]->finishBinding(); } } @@ -72,8 +71,8 @@ namespace ipl { pOriginPane->SetTranslate(mOriginPos); // Arrow Length - nw4r::lyt::Size arrowSize = pLengthPane->GetSize(); - arrowSize.height = IPL_MATH_CLAMP(mArrowLength, MIN_LENGTH, MAX_LENGTH); + nw4r::lyt::Size arrowSize = pLengthPane->GetSize(); + arrowSize.height = IPL_MATH_CLAMP(mArrowLength, MIN_LENGTH, MAX_LENGTH); pLengthPane->SetSize(arrowSize); // Arrow Scale @@ -82,8 +81,7 @@ namespace ipl { f32 arrowDirection; if (mPointDirection == POINT_DOWN) { arrowDirection = 1.0f; - } - else { + } else { arrowDirection = -1.0f; } pRootPane->SetScale(math::VEC2(1.0f, arrowDirection)); @@ -100,7 +98,7 @@ namespace ipl { void Pointer::draw() { if (mbVisible) { mCore.draw(); - + // Draw the scroller if (mIsScrolling >= POINT_SCROLLING) { mpLayout[LYT_SCROLLER_ID]->draw(); @@ -132,4 +130,4 @@ namespace ipl { return mpLayout[grabId + chan]; } -} +} // namespace ipl diff --git a/src/system/iplPointerCore.cpp b/src/system/iplPointerCore.cpp index f4b0e524..de59c8af 100644 --- a/src/system/iplPointerCore.cpp +++ b/src/system/iplPointerCore.cpp @@ -2,20 +2,17 @@ #include -#include #include +#include #include "iplSystem.h" #include "iplUtility.h" namespace ipl { - PointerCoreObject::PointerCoreObject() : - mpLayout(NULL), - mState(PointerType::StateNoScroll), - mLayoutType(PointerType::LayoutMax), - mChan(0), - unused_0x10(0) {} + PointerCoreObject::PointerCoreObject() + : mpLayout(NULL), mState(PointerType::StateNoScroll), mLayoutType(PointerType::LayoutMax), mChan(0), unused_0x10(0) { + } void PointerCoreObject::calc(Pointer* pointer, const controller::Interface* pController) { mpLayout = NULL; @@ -30,7 +27,7 @@ namespace ipl { // Rotation math::VEC2 cursorHorizon(pController->getHorizon()); math::VEC3 cursorRotateVec(0.f, 0.f, nw4r::math::Atan2Deg(-cursorHorizon.y, cursorHorizon.x)); - nw4r::lyt::Pane *pRotatePane = mpLayout->FindPaneByName("N_Rot"); + nw4r::lyt::Pane* pRotatePane = mpLayout->FindPaneByName("N_Rot"); nw4r::lyt::Pane* pRotateShadowPane = mpLayout->FindPaneByName("N_SRot"); pRotatePane->SetRotate(cursorRotateVec); @@ -84,4 +81,4 @@ namespace ipl { void PointerCore::changeType(int chan, int type) { mCursors[chan].changeType(type); } -} +} // namespace ipl diff --git a/src/system/iplPostmanManager.cpp b/src/system/iplPostmanManager.cpp index 62e406ac..8a46624f 100644 --- a/src/system/iplPostmanManager.cpp +++ b/src/system/iplPostmanManager.cpp @@ -1,22 +1,17 @@ #include "system/iplPostmanManager.h" -#include "utility/iplMessageBase.h" +#include "iplSystem.h" #include "system/iplPlayTimeLog.h" #include "system/iplSocketSetting.h" -#include "iplSystem.h" +#include "utility/iplMessageBase.h" #include "config.h" -#define POSTMANReport(...) OSReport("[POSTMAN] "__VA_ARGS__); +#define POSTMANReport(...) OSReport("[POSTMAN] "__VA_ARGS__); namespace ipl { namespace postman { - Manager::Manager(EGG::Heap* heap) : - ut_thread(), - mpHeap(heap), - mpThreadStack(NULL), - mState(STATE_NONE), - mMessage() { + Manager::Manager(EGG::Heap* heap) : ut_thread(), mpHeap(heap), mpThreadStack(NULL), mState(STATE_NONE), mMessage() { OSCreateAlarm(&mAlarm); } @@ -196,8 +191,7 @@ namespace ipl { } } set_alarm_(); - } - else { + } else { POSTMANReport("IGNORED: receive_immediately_\n"); } } @@ -223,20 +217,19 @@ namespace ipl { void Manager::set_nwc24_permission_() { SCParentalControlsInfo pcInfo; u8 nwc24Permission = NCD_NWC24_PERMISSION_NONE; - + SCGetParentalControl(&pcInfo); if ((SCGetWCFlags() & SC_WC_FLAGS_ENABLED) == SC_WC_FLAGS_ENABLED && SCGetEULA()) { POSTMANReport("PERMISSION_DOWNLOAD_ON\n"); nwc24Permission |= NCD_NWC24_PERMISSION_DOWNLOAD; - if ((pcInfo.enable & SC_PARENTAL_FLAG_ENABLED) != SC_PARENTAL_FLAG_ENABLED - || (SCGetNetContentRestrictions() & SC_NET_RESTRICTIONS_MSG_BOARD) != SC_NET_RESTRICTIONS_MSG_BOARD) { + if ((pcInfo.enable & SC_PARENTAL_FLAG_ENABLED) != SC_PARENTAL_FLAG_ENABLED || + (SCGetNetContentRestrictions() & SC_NET_RESTRICTIONS_MSG_BOARD) != SC_NET_RESTRICTIONS_MSG_BOARD) { POSTMANReport("PERMISSION_MESSAGE_ON\n"); nwc24Permission |= NCD_NWC24_PERMISSION_MESSAGE; } - } - else { + } else { POSTMANReport("PERMISSION_ALL_OFF\n"); } @@ -292,5 +285,5 @@ namespace ipl { POSTMANReport("Network State: %d\n", NCDGetLinkStatus()); ncd_debug_print_(); } - } -} + } // namespace postman +} // namespace ipl diff --git a/src/system/iplResetHandler.cpp b/src/system/iplResetHandler.cpp index 462f2e10..7497f888 100644 --- a/src/system/iplResetHandler.cpp +++ b/src/system/iplResetHandler.cpp @@ -2,8 +2,8 @@ #include -#include #include +#include #include "iplSystem.h" #include "system/iplTVRCManager.h" @@ -55,12 +55,11 @@ namespace ipl { TVRCManager::getHandle()->resetProcessAsync(TRUE); } - if ((System::getSceneManager() == NULL || System::getSceneManager()->isResetAcceptable()) - && (System::getSaveData() == NULL || System::getSaveData()->isResetAcceptable()) - && System::isResetAcceptable()) { + if ((System::getSceneManager() == NULL || System::getSceneManager()->isResetAcceptable()) && + (System::getSaveData() == NULL || System::getSaveData()->isResetAcceptable()) && System::isResetAcceptable()) { if (TVRCManager::getHandle() == NULL || TVRCManager::getHandle()->waitResetProcessCompleted()) { - if (System::getPostmanManager()->IsUnknown() - || (System::getSceneManager() != NULL && System::getScene(scene::SCENE_ADDRESS) != NULL)) { + if (System::getPostmanManager()->IsUnknown() || + (System::getSceneManager() != NULL && System::getScene(scene::SCENE_ADDRESS) != NULL)) { if (System::getNwc24Manager() != NULL && !System::isNandFull()) { if (System::createdAfterAndLibMgr() && !System::getNwc24Manager()->isUnk0xA31()) { return; @@ -69,15 +68,14 @@ namespace ipl { WPADGetStatus(); - if (System::getResetFader()->fadeOut() - || System::getResetFader()->getStatus() == EGG::Fader::PREPARE_IN) { - #ifdef VERSION_43E + if (System::getResetFader()->fadeOut() || System::getResetFader()->getStatus() == EGG::Fader::PREPARE_IN) { +#ifdef VERSION_43E if (System::getMasterController()->down(controller::REVO_BTN_DOWN)) { SCSetEuRgb60Mode(FALSE); SCSetProgressiveMode(FALSE); SCFlush(); } - #endif +#endif mUpdateState = RESET_STATE_SHUTDOWN_VIDEO; @@ -102,8 +100,8 @@ namespace ipl { } // Shutdown video case RESET_STATE_SHUTDOWN_VIDEO: { - if (System::getResetFader()->getStatus() == EGG::Fader::PREPARE_IN - && (System::getSceneManager() == NULL || System::getSceneManager()->isResetProcessDone())) { + if (System::getResetFader()->getStatus() == EGG::Fader::PREPARE_IN && + (System::getSceneManager() == NULL || System::getSceneManager()->isResetProcessDone())) { mUpdateState = RESET_STATE_SHUTDOWN_SYSTEM; VISetBlack(TRUE); VIFlush(); @@ -121,8 +119,7 @@ namespace ipl { VIWaitForRetrace(); if (mbReturnToMenu) { OSReturnToMenu(); - } - else { + } else { OSRebootSystem(); } } @@ -191,4 +188,4 @@ namespace ipl { } } } -} +} // namespace ipl diff --git a/src/system/iplSDVFWorker.cpp b/src/system/iplSDVFWorker.cpp index 73b43e93..0f0d19d7 100644 --- a/src/system/iplSDVFWorker.cpp +++ b/src/system/iplSDVFWorker.cpp @@ -6,20 +6,17 @@ namespace ipl { SDVFWorker::WorkSDState SDVFWorker::s_sd_state; - bool SDVFWorker::s_sd_inserted = false; + bool SDVFWorker::s_sd_inserted = false; - SDVFWorker::SDVFWorker() : - myWork(NULL) {} + SDVFWorker::SDVFWorker() : myWork(NULL) { + } void SDVFWorker::create(void* work, int priority) { Work* workArg = reinterpret_cast(work); myWork = workArg; - /* @BUG: Stack should be threadStack, not the thread itself! */ - OSCreateThread(&workArg->thread, - thread_main, this, - &myWork->thread, STACK_SIZE, - priority, OS_THREAD_ATTR_DETACH); + /* @bug: Stack should be threadStack, not the thread itself! */ + OSCreateThread(&workArg->thread, thread_main, this, &myWork->thread, STACK_SIZE, priority, OS_THREAD_ATTR_DETACH); OSInitMessageQueue(&myWork->msgQueue, myWork->messages, 8); OSInitMutex(&myWork->mutex); @@ -65,8 +62,7 @@ namespace ipl { BOOL SDVFWorker::is_sd_write_protected() { if (s_sd_state == SD_STATE_AVAILABLE) { return myWork->isWriteProtected; - } - else { + } else { return FALSE; } } @@ -97,11 +93,11 @@ namespace ipl { } void* SDVFWorker::run() { - FAError faErr; + FAError faErr; - CDBErr cdbErr; - - bool started = false; + CDBErr cdbErr; + + bool started = false; while (true) { switch (wait_work()) { @@ -122,8 +118,7 @@ namespace ipl { if (s_sd_state == SD_STATE_BROKEN || s_sd_state == SD_STATE_ERROR) { myWork->prevAsyncResult = myWork->asyncResult; - } - else { + } else { myWork->prevAsyncResult = RESULT_STILL_WORKING; } break; @@ -144,12 +139,11 @@ namespace ipl { } System::getCdbManager()->mountSD_safe(); - + cdbErr = System::getCdbManager()->getCDBResult(); if (cdbErr == CDB_ERROR_OK || cdbErr == CDB_ERROR_SD_IS_MOUNTED) { myWork->asyncResult = RESULT_SUCCESS; - } - else { + } else { OSReport("SDVFWorker: CDBMountSD failed [%d]\n", cdbErr); myWork->asyncResult = RESULT_FATAL_SD_ERROR; } @@ -162,8 +156,7 @@ namespace ipl { cdbErr = System::getCdbManager()->getCDBResult(); if (cdbErr == CDB_ERROR_OK || cdbErr == CDB_ERROR_SD_IS_NOT_MOUNTED) { myWork->asyncResult = RESULT_SUCCESS; - } - else { + } else { OSReport("SDVFWorker: CDBUnmountSD failed [%d]\n", cdbErr); myWork->asyncResult = RESULT_FATAL_SD_ERROR; } @@ -204,28 +197,24 @@ namespace ipl { FAInit(FA_FLAG_FILENAME_CHECK); FASetThreadPriority(myWork->priority); FARegistCB(FA_DEVICE_SD, sd_insert_callback, sd_eject_callback); - + faErr = FAAttach(FA_DEVICE_SD, NULL, 0, &myWork->driveTable); if (faErr == FA_ERR_SUCCESS) { OSReport("SDVFWorker: attach SD card drive = %c\n", myWork->driveTable.drive); - + int result = call_fa_mount(); if (result == RESULT_SUCCESS) { s_sd_state = SD_STATE_AVAILABLE; - } - else if (result == RESULT_SD_BROKEN) { + } else if (result == RESULT_SD_BROKEN) { s_sd_state = SD_STATE_BROKEN; - } - else if (result == RESULT_SD_ERROR) { + } else if (result == RESULT_SD_ERROR) { s_sd_state = SD_STATE_ERROR; - } - else { + } else { s_sd_state = SD_STATE_EJECTED; s_sd_inserted = false; } myWork->asyncResult = result; - } - else { + } else { OSReport("SDVFWorker: FAAttach failed.[%d]\n", FAErrnum()); s_sd_state = SD_STATE_UNAVAILABLE; myWork->asyncResult = RESULT_FA_ERROR; @@ -235,8 +224,7 @@ namespace ipl { case SD_STATE_EJECTED: { if (myWork->prevAsyncResult == RESULT_STILL_WORKING) { myWork->asyncResult = RESULT_FATAL_SD_ERROR; - } - else { + } else { myWork->asyncResult = myWork->prevAsyncResult; } break; @@ -245,11 +233,9 @@ namespace ipl { int result = call_fa_mount(); if (result == RESULT_SUCCESS) { s_sd_state = SD_STATE_AVAILABLE; - } - else if (result == RESULT_SD_BROKEN) { + } else if (result == RESULT_SD_BROKEN) { s_sd_state = SD_STATE_BROKEN; - } - else { + } else { s_sd_state = result == RESULT_SD_ERROR ? SD_STATE_ERROR : SD_STATE_EJECTED; } myWork->asyncResult = result; @@ -286,19 +272,16 @@ namespace ipl { if (faErr == FA_ERR_SUCCESS) { myWork->isWriteProtected = FALSE; result = RESULT_SUCCESS; - } - else { + } else { if (FAErrnum() == FA_ERR_EWRTPROTECT) { OSReport("SDVFWorker: SD card is write protected.\n"); result = RESULT_SUCCESS; myWork->isWriteProtected = TRUE; - } - else { + } else { result = handle_sd_error(faErr); } } - } - else { + } else { faErr = FAErrnum(); OSReport("SDVFWorker: FAMount failed.[%d]\n", faErr); if (faErr == FA_ERR_ENOEXEC) { @@ -306,22 +289,18 @@ namespace ipl { if (FA_INSERTED(myWork->driveTable)) { result = RESULT_SD_BROKEN; } - } - else if (faErr == FA_ERR_EINVAL) { + } else if (faErr == FA_ERR_EINVAL) { result = RESULT_FATAL_SD_ERROR; - } - else if (faErr == FA_ERR_EIO) { + } else if (faErr == FA_ERR_EIO) { if (s_sd_state == SD_STATE_EJECTED) { result = RESULT_FATAL_SD_ERROR; - } - else { + } else { result = RESULT_FATAL_SD_ERROR; if (s_sd_inserted) { result = RESULT_SD_ERROR; } } - } - else { + } else { result = RESULT_SD_ERROR; } } @@ -349,8 +328,7 @@ namespace ipl { if (myWork->asyncResult == RESULT_SUCCESS) { OSReport("SDVFWorker: successfully format sd.\n"); - } - else { + } else { OSReport("SDVFWorker: FAFormat failed.[%d]\n", myWork->asyncResult); } } @@ -453,4 +431,4 @@ namespace ipl { } return result; } -} +} // namespace ipl diff --git a/src/system/iplSaveDataManager.cpp b/src/system/iplSaveDataManager.cpp index 0547d114..ca2de185 100644 --- a/src/system/iplSaveDataManager.cpp +++ b/src/system/iplSaveDataManager.cpp @@ -16,6 +16,7 @@ #include "config.h" namespace ipl { + // clang-format off #define DISK_CHANNEL CHANNEL_INFO(channel::PRIMARY_TYPE_DISK, channel::SECONARY_TYPE_SYSTEM, 0x0000000F, 0) #define NIGAOE_CHANNEL CHANNEL_INFO(channel::PRIMARY_TYPE_CHANNEL, channel::SECONARY_TYPE_SYSTEM, 0x0000000E, TITLE_NIGAOE_ALL) #define PHOTO_CHANNEL CHANNEL_INFO(channel::PRIMARY_TYPE_CHANNEL, channel::SECONARY_TYPE_SYSTEM, 0x0000000E, TITLE_PHOTO_ALL) @@ -24,7 +25,7 @@ namespace ipl { #define NEWS_CHANNEL CHANNEL_INFO(channel::PRIMARY_TYPE_CHANNEL, channel::SECONARY_TYPE_SYSTEM, 0x0000000E, TITLE_NEWS_ALL) #define NO_CHANNEL CHANNEL_INFO_NULL - #define DEFAULT_CHANNEL_COUNT 6 + #define DEFAULT_CHANNEL_COUNT 6 static const channel::SInfo cDefaultChanList/*[MAX_CHANNEL_PAGE][MAX_CHANNEL_INDEX]*/[MAX_CHANNEL_TOTAL] = { // Page 1 //{ @@ -67,6 +68,7 @@ namespace ipl { /* =============================================================*/ //}, }; + // clang-format on static const char* csSavePath = "/title/00000001/00000002/data/iplsave.bin"; @@ -85,7 +87,7 @@ namespace ipl { mLastError = 0; } - + Manager::~Manager() { if (mpUpdatedFile) { delete mpUpdatedFile; @@ -135,16 +137,16 @@ namespace ipl { u64 typeMask; if (ES_TITLE_TYPE(titleId) != 0) { typeMask = 0xFFFFFFFFFFFFFFFF; - } - else { + } else { typeMask = 0x00000000FFFFFFFF; } - + for (int page = 0; page < MAX_CHANNEL_PAGE; page++) { for (int index = 0; index < MAX_CHANNEL_INDEX; index++) { if (mData.chanInfo[page][index].primaryType == channel::PRIMARY_TYPE_CHANNEL) { ESTitleId tId = ES_TITLE_ID(mData.chanInfo[page][index].titleType, mData.chanInfo[page][index].titleCode); - if (titleId == (tId & typeMask) || TITLE_NO_REGION(tId & typeMask) == TITLE_NO_REGION(titleId & typeMask) && TITLE_REGION(titleId) == TITLE_REGION_ALL) { + if (titleId == (tId & typeMask) || + TITLE_NO_REGION(tId & typeMask) == TITLE_NO_REGION(titleId & typeMask) && TITLE_REGION(titleId) == TITLE_REGION_ALL) { if (outIndex) { *outIndex = index; } @@ -171,12 +173,11 @@ namespace ipl { } return count; } - + BOOL Manager::isResetAcceptable() { if (mpFile == NULL || mpFile->isFinished() || mpFile->isFatalError()) { return TRUE; - } - else { + } else { return FALSE; } } @@ -203,37 +204,30 @@ namespace ipl { if (fileLenCheck == 0) { // Create a new file if blank bCreateNew = TRUE; - } - else { + } else { // Read header ret = nand::wrapper::Read(&fileInfo, &manager->mData, 0x20); manager->nand_error_handling(ret); - if (manager->mLastError == NAND_RESULT_AUTHENTICATION - || manager->mLastError == NAND_RESULT_ECC_CRIT) { + if (manager->mLastError == NAND_RESULT_AUTHENTICATION || manager->mLastError == NAND_RESULT_ECC_CRIT) { // Access to file is broken, create new ret = nand::wrapper::Delete(csSavePath); manager->nand_error_handling(ret); bCreateNew = TRUE; - } - else { + } else { if (manager->mData.version > SAVEDATA_VERSION) { // Save data too high, create new bCreateNew = TRUE; - } - else { - if (!NAND_CHECK_MAGIC4(manager->mData.sig, 'R','I','P','L')) { + } else { + if (!NAND_CHECK_MAGIC4(manager->mData.sig, 'R', 'I', 'P', 'L')) { // Signature incorrect, create new bCreateNew = TRUE; - } - else { + } else { ret = nand::wrapper::GetLength(&fileInfo, &fileLen); - if (ret != NAND_RESULT_OK - || manager->mData.fileSize < 0x20 || manager->mData.fileSize > fileLen) { + if (ret != NAND_RESULT_OK || manager->mData.fileSize < 0x20 || manager->mData.fileSize > fileLen) { // Invalid filesize, create new bCreateNew = TRUE; - } - else { + } else { fileLen = manager->mData.fileSize; ret = nand::wrapper::Seek(&fileInfo, 0, NAND_SEEK_BEG); @@ -241,14 +235,12 @@ namespace ipl { ret = nand::wrapper::Read(&fileInfo, &manager->mData, fileLen); manager->nand_error_handling(ret); - if (manager->mLastError == NAND_RESULT_AUTHENTICATION - || manager->mLastError == NAND_RESULT_ECC_CRIT) { + if (manager->mLastError == NAND_RESULT_AUTHENTICATION || manager->mLastError == NAND_RESULT_ECC_CRIT) { // Access to file is broken, create new ret = nand::wrapper::Delete(csSavePath); manager->nand_error_handling(ret); bCreateNew = TRUE; - } - else { + } else { NETMD5Sum md5; NETCalcMD5(md5, &manager->mData, fileLen - NET_MD5_DIGEST_SIZE); @@ -267,13 +259,11 @@ namespace ipl { } ret = nand::wrapper::Close(&fileInfo); manager->nand_error_handling(ret); - } - else { + } else { if (manager->mLastError == NAND_RESULT_NOEXISTS) { // Create a new file if it does not exist bCreateNew = TRUE; - } - else { + } else { // Otherwise something is wrong IPLErrorLogAndDisplay(MESG_ERR_FILE, "NAND", manager->mLastError, 450); } @@ -282,8 +272,7 @@ namespace ipl { if (bCreateNew) { manager->setDefaultSaveData(); bNeedFlush = TRUE; - } - else { + } else { u32 oldVersion = manager->mData.version; if (oldVersion < SAVEDATA_VERSION) { manager->updateVersion(SAVEDATA_VERSION, oldVersion); @@ -342,25 +331,25 @@ namespace ipl { } void Manager::setDefaultKeyboard() { - mData.memoSetting.uRevisionAndType = 0x11; + mData.memoSetting.uRevisionAndType = 0x11; - mData.memoSetting.uDictionary = 0xFA; - mData.memoSetting.uPredictOnOff = 0x00; - mData.memoSetting.uSignPage = 0x00; + mData.memoSetting.uDictionary = 0xFA; + mData.memoSetting.uPredictOnOff = 0x00; + mData.memoSetting.uSignPage = 0x00; - mData.memoSetting.uKeitaiUpperCaseJP = TRUE; - mData.memoSetting.uKeitaiInputMode = 0x02; + mData.memoSetting.uKeitaiUpperCaseJP = TRUE; + mData.memoSetting.uKeitaiInputMode = 0x02; - mData.memoSetting.uQwertyABC = FALSE; + mData.memoSetting.uQwertyABC = FALSE; - mData.memoSetting.uABCInputMode = 0x01; - mData.memoSetting.uAIUInputMode = 0x00; + mData.memoSetting.uABCInputMode = 0x01; + mData.memoSetting.uAIUInputMode = 0x00; - mData.memoSetting.uNumLockOff = FALSE; + mData.memoSetting.uNumLockOff = FALSE; - mData.memoSetting.uReserve2 = 0x00; - mData.memoSetting.uReserve3 = 0x00; - mData.memoSetting.uReserve4 = 0x00; + mData.memoSetting.uReserve2 = 0x00; + mData.memoSetting.uReserve3 = 0x00; + mData.memoSetting.uReserve4 = 0x00; } void Manager::setDefaultTVRC() { @@ -374,7 +363,7 @@ namespace ipl { u32 titleCount; ES_ListTitlesOnCard(NULL, &titleCount); - u64* titleIds = new(mpHeap, -DEFAULT_ALIGN) u64[titleCount]; + u64* titleIds = new (mpHeap, -DEFAULT_ALIGN) u64[titleCount]; s32 ret = ES_ListTitlesOnCard(titleIds, &titleCount); if (ret != ES_ERR_OK) { @@ -391,7 +380,7 @@ namespace ipl { checkSpecialTitles(titleIds, titleCount); checkTmpTitle(titleIds, titleCount); - ESTitleId unk[MAX_CHANNEL_TOTAL] = { 0 }; + ESTitleId unk[MAX_CHANNEL_TOTAL] = {0}; makePriorTitleIDList(unk, titleIds, titleCount); integrateTitleIDList(unk, titleIds, titleCount); @@ -404,15 +393,13 @@ namespace ipl { void Manager::deleteInvalidTitle(ESTitleId* titleIds, u32 titleCount) { for (int i = 0; i < titleCount; i++) { s32 ret; - if ((ESTitleId32)ES_TITLE_TYPE(titleIds[i]) != TITLE_TYPE_CHANNEL - && (ESTitleId32)ES_TITLE_TYPE(titleIds[i]) != TITLE_TYPE_SYSTEM_CHANNEL - && (ESTitleId32)ES_TITLE_TYPE(titleIds[i]) != TITLE_TYPE_DISC - && (ESTitleId32)ES_TITLE_TYPE(titleIds[i]) != TITLE_TYPE_DISC_CHANNEL - && (ESTitleId32)ES_TITLE_TYPE(titleIds[i]) != TITLE_TYPE_UNK6 - && (ESTitleId32)ES_TITLE_TYPE(titleIds[i]) != TITLE_TYPE_UNK3) { + if ((ESTitleId32)ES_TITLE_TYPE(titleIds[i]) != TITLE_TYPE_CHANNEL && + (ESTitleId32)ES_TITLE_TYPE(titleIds[i]) != TITLE_TYPE_SYSTEM_CHANNEL && + (ESTitleId32)ES_TITLE_TYPE(titleIds[i]) != TITLE_TYPE_DISC && + (ESTitleId32)ES_TITLE_TYPE(titleIds[i]) != TITLE_TYPE_DISC_CHANNEL && + (ESTitleId32)ES_TITLE_TYPE(titleIds[i]) != TITLE_TYPE_UNK6 && (ESTitleId32)ES_TITLE_TYPE(titleIds[i]) != TITLE_TYPE_UNK3) { titleIds[i] = TITLE_NULL; - } - else { + } else { ESTmdView* tmd = NULL; ret = utility::ESMisc::GetTmdView(mpHeap, titleIds[i], &tmd); if (ret == ES_ERR_OK) { @@ -433,13 +420,11 @@ namespace ipl { if (tmd) { mpHeap->free(tmd); } - } - else if (TITLE_NO_REGION(titleIds[i]) == TITLE_PHOTO_2) { + } else if (TITLE_NO_REGION(titleIds[i]) == TITLE_PHOTO_2) { if (checkValidApp(titleIds[i])) { mbPhoto2 = true; } - } - else if (TITLE_NO_REGION(titleIds[i]) == TITLE_PHOTO_2_CHECK) { + } else if (TITLE_NO_REGION(titleIds[i]) == TITLE_PHOTO_2_CHECK) { if (checkValidApp(titleIds[i])) { mbPhoto2Check = true; } @@ -456,22 +441,18 @@ namespace ipl { if (mbPhoto2 && mbPhoto2Check) { if (titleIdNoRegion == TITLE_PHOTO) { titleIds[i] = 0; - } - else if (titleIdNoRegion == TITLE_PHOTO_2_CHECK) { + } else if (titleIdNoRegion == TITLE_PHOTO_2_CHECK) { titleIds[i] = 0; } - } - else if (!mbPhoto2 && mbPhoto2Check) { + } else if (!mbPhoto2 && mbPhoto2Check) { if (titleIdNoRegion == TITLE_PHOTO) { titleIds[i] = 0; } - } - else if (mbPhoto2 && !mbPhoto2Check && mbPhotoMP3) { + } else if (mbPhoto2 && !mbPhoto2Check && mbPhotoMP3) { if (titleIdNoRegion == TITLE_PHOTO) { titleIds[i] = 0; } - } - else if (mbPhoto2 && !mbPhoto2Check && !mbPhotoMP3) { + } else if (mbPhoto2 && !mbPhoto2Check && !mbPhotoMP3) { if (titleIdNoRegion == TITLE_PHOTO_2) { titleIds[i] = 0; } @@ -481,19 +462,16 @@ namespace ipl { if (mbPhoto2 && mbPhoto2Check) { mPhotoId = TITLE_PHOTO_2; - } - else if (!mbPhoto2 && mbPhoto2Check) { + } else if (!mbPhoto2 && mbPhoto2Check) { mPhotoId = TITLE_PHOTO_2_CHECK; - } - else if (mbPhoto2 && !mbPhoto2Check && mbPhotoMP3) { + } else if (mbPhoto2 && !mbPhoto2Check && mbPhotoMP3) { mPhotoId = TITLE_PHOTO_2; - } - else if (mbPhoto2 && !mbPhoto2Check && !mbPhotoMP3) { + } else if (mbPhoto2 && !mbPhoto2Check && !mbPhotoMP3) { mPhotoId = TITLE_PHOTO; } } } - + void Manager::checkTmpTitle(ESTitleId* titleIds, u32 titleCount) { bool foundTmp = false; @@ -511,8 +489,7 @@ namespace ipl { SCSetTmpTitleID(TITLE_NULL); SCFlush(); } - } - else { + } else { SCSetTmpTitleID(TITLE_NULL); SCFlush(); } @@ -526,12 +503,10 @@ namespace ipl { s32 ret = ES_GetTicketViews(titleId, NULL, &tikCount); if (ret < ES_ERR_OK && tikCount == 0) { result = FALSE; - } - else { + } else { if (!utility::ESMisc::PrivateContentsExist(titleId)) { result = FALSE; - } - else { + } else { ESTmdView* tmd = NULL; ret = utility::ESMisc::GetTmdView(mpHeap, titleId, &tmd); if (ret != ES_ERR_OK && ret != ES_ERR_NO_TMD_FILE_FOUND) { @@ -580,17 +555,13 @@ namespace ipl { int Manager::isEqualChannel(ESTitleId titleId0, ESTitleId titleId1) { if (titleId0 == titleId1) { return -2; - } - else if (TITLE_NO_REGION(titleId0) == TITLE_NO_REGION(titleId1)) { + } else if (TITLE_NO_REGION(titleId0) == TITLE_NO_REGION(titleId1)) { return -1; - } - else if (TITLE_REGION(titleId0) != TITLE_REGION_ALL && TITLE_REGION(titleId1) == TITLE_REGION_ALL) { + } else if (TITLE_REGION(titleId0) != TITLE_REGION_ALL && TITLE_REGION(titleId1) == TITLE_REGION_ALL) { return 0; - } - else if (TITLE_REGION(titleId0) != TITLE_REGION_ALL || TITLE_REGION(titleId1) == TITLE_REGION_ALL) { + } else if (TITLE_REGION(titleId0) != TITLE_REGION_ALL || TITLE_REGION(titleId1) == TITLE_REGION_ALL) { return 1; - } - else { + } else { return -1; } } @@ -646,8 +617,7 @@ namespace ipl { mLastError = code; if (code >= NAND_RESULT_OK) { return TRUE; - } - else { + } else { switch (code) { case NAND_RESULT_AUTHENTICATION: case NAND_RESULT_NOEXISTS: @@ -678,5 +648,5 @@ namespace ipl { return result; } - } -} + } // namespace savedata +} // namespace ipl diff --git a/src/system/iplSocketSetting.cpp b/src/system/iplSocketSetting.cpp index c3010a89..f60cb091 100644 --- a/src/system/iplSocketSetting.cpp +++ b/src/system/iplSocketSetting.cpp @@ -6,17 +6,17 @@ #include -#define HEAP_BUFFER_SIZE 0x4000 +#define HEAP_BUFFER_SIZE 0x4000 namespace ipl { namespace socket { - char SocketSetting::mMac[64]; + char SocketSetting::mMac[64]; - MEMHeapHandle SocketSetting::mpHeap; - void* SocketSetting::mpHeapBuf; + MEMHeapHandle SocketSetting::mpHeap; + void* SocketSetting::mpHeapBuf; - u8 SocketSetting::mMacAddr[NCD_MAC_ADDRESS_LENGTH]; - bool SocketSetting::isMacAddr; + u8 SocketSetting::mMacAddr[NCD_MAC_ADDRESS_LENGTH]; + bool SocketSetting::isMacAddr; const char* SocketSetting::getLANMacAddrUtf8() { if (!isMacAddr) { @@ -68,8 +68,7 @@ namespace ipl { } void SocketSetting::convertLANMacAddr() { - sprintf(mMac, "%02x-%02x-%02x-%02x-%02x-%02x", - mMacAddr[0], mMacAddr[1], mMacAddr[2], mMacAddr[3], mMacAddr[4], mMacAddr[5]); + sprintf(mMac, "%02x-%02x-%02x-%02x-%02x-%02x", mMacAddr[0], mMacAddr[1], mMacAddr[2], mMacAddr[3], mMacAddr[4], mMacAddr[5]); } void SocketSetting::obtainLANMacAddr(void* work) { @@ -129,5 +128,5 @@ namespace ipl { memset(macAddr, 0, NCD_MAC_ADDRESS_LENGTH); return !(memcmp(mMacAddr, macAddr, NCD_MAC_ADDRESS_LENGTH) == 0); } - } -} + } // namespace socket +} // namespace ipl diff --git a/src/system/iplSystem.cpp b/src/system/iplSystem.cpp index 4142263c..3418ab81 100644 --- a/src/system/iplSystem.cpp +++ b/src/system/iplSystem.cpp @@ -11,17 +11,17 @@ #include "scene/setting/iplNCDSetting.h" -#include #include +#include -#include #include +#include #include -#include -#include #include +#include +#include #include @@ -69,8 +69,7 @@ namespace ipl { OSReport("*****************************\n"); smArg.mpMem2Root = EGG::ExpHeap::create((void*)mem2Lo, ((u32)mem2Hi - (u32)mem2Lo), MEM_HEAP_OPT_DEBUG_FILL); - } - else { + } else { smArg.mpTreasureHeap = EGG::ExpHeap::create((void*)0x93440000, 0xC0000, MEM_HEAP_OPT_DEBUG_FILL); OSReport("*****************************\n"); @@ -121,10 +120,10 @@ namespace ipl { void* System::constructFontSub_(void* fontData) { u32 workSize = nw4r::ut::ArchiveFont::GetRequireBufferSize(fontData); - u8* work = new(getMem2Sys(), DEFAULT_ALIGN) u8[OSRoundUp32B(workSize)]; + u8* work = new (getMem2Sys(), DEFAULT_ALIGN) u8[OSRoundUp32B(workSize)]; + + nw4r::ut::ArchiveFont* font = new (getMem1Sys(), 4) nw4r::ut::ArchiveFont(); - nw4r::ut::ArchiveFont* font = new(getMem1Sys(), 4) nw4r::ut::ArchiveFont(); - font->Construct(work, workSize, fontData); return font; } @@ -133,11 +132,11 @@ namespace ipl { smArg.mpFontArena = getMem2App()->alloc(0x400000, -DEFAULT_ALIGN); smArg.mpFontHeap = EGG::ExpHeap::create(smArg.mpFontArena, 0x400000, 0); - #ifndef VERSION_43K +#ifndef VERSION_43K smArg.mResources.file[Arg::FONT] = getNandManager()->readAsync(getMem2Sys(), "/font/font.ash"); - #else +#else smArg.mResources.file[Arg::FONT] = getNandManager()->readAsync(getMem2Sys(), "/font/font_kr.ash"); - #endif +#endif smArg.mpWBF1File = getNandManager()->readSharedAsync(getFontHeap(), "wbf1.brfna", 5); smArg.mpWBF2File = getNandManager()->readSharedAsync(getFontHeap(), "wbf2.brfna", 5); @@ -156,8 +155,7 @@ namespace ipl { } void System::constructSND_(void* work) { - snd::getSystem()->initOnMemory(smArg.mResources.file[Arg::SOUND]->getBuffer(), - getSoundHeap(), getSoundHeap()->getAllocatableSize(32)); + snd::getSystem()->initOnMemory(smArg.mResources.file[Arg::SOUND]->getBuffer(), getSoundHeap(), getSoundHeap()->getAllocatableSize(32)); smArg.mbSndResLoaded = true; } @@ -176,29 +174,29 @@ namespace ipl { } void System::constructZiDIC_(void* work) { - #if defined(VERSION_43U) - smArg.mZiDicData.sys[EZTX_LANG_ENAM] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemENAM.zsd"); - smArg.mZiDicData.sys[EZTX_LANG_FRCA] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemFRCA.zsd"); - smArg.mZiDicData.sys[EZTX_LANG_ESSA] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemESSA.zsd"); +#if defined(VERSION_43U) + smArg.mZiDicData.sys[EZTX_LANG_ENAM] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemENAM.zsd"); + smArg.mZiDicData.sys[EZTX_LANG_FRCA] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemFRCA.zsd"); + smArg.mZiDicData.sys[EZTX_LANG_ESSA] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemESSA.zsd"); - smArg.mZiDicData.oem[EZTX_LANG_ENAM] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoENAM.znd"); - smArg.mZiDicData.oem[EZTX_LANG_FRCA] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoFRCA.znd"); - smArg.mZiDicData.oem[EZTX_LANG_ESSA] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoESSA.znd"); - #elif defined(VERSION_43E) - smArg.mZiDicData.sys[EZTX_LANG_ENUK] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemENUK.zsd"); - smArg.mZiDicData.sys[EZTX_LANG_DE] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemDE.zsd"); - smArg.mZiDicData.sys[EZTX_LANG_FREU] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemFREU.zsd"); - smArg.mZiDicData.sys[EZTX_LANG_ESEU] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemESEU.zsd"); - smArg.mZiDicData.sys[EZTX_LANG_IT] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemIT.zsd"); - smArg.mZiDicData.sys[EZTX_LANG_NL] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemNL.zsd"); + smArg.mZiDicData.oem[EZTX_LANG_ENAM] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoENAM.znd"); + smArg.mZiDicData.oem[EZTX_LANG_FRCA] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoFRCA.znd"); + smArg.mZiDicData.oem[EZTX_LANG_ESSA] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoESSA.znd"); +#elif defined(VERSION_43E) + smArg.mZiDicData.sys[EZTX_LANG_ENUK] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemENUK.zsd"); + smArg.mZiDicData.sys[EZTX_LANG_DE] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemDE.zsd"); + smArg.mZiDicData.sys[EZTX_LANG_FREU] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemFREU.zsd"); + smArg.mZiDicData.sys[EZTX_LANG_ESEU] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemESEU.zsd"); + smArg.mZiDicData.sys[EZTX_LANG_IT] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemIT.zsd"); + smArg.mZiDicData.sys[EZTX_LANG_NL] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::ZI_DICT]->getBuffer(), "eZTSystemNL.zsd"); - smArg.mZiDicData.oem[EZTX_LANG_ENUK] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoENUK.znd"); - smArg.mZiDicData.oem[EZTX_LANG_DE] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoDE.znd"); - smArg.mZiDicData.oem[EZTX_LANG_FREU] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoFREU.znd"); - smArg.mZiDicData.oem[EZTX_LANG_ESEU] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoESEU.znd"); - smArg.mZiDicData.oem[EZTX_LANG_IT] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoIT.znd"); - smArg.mZiDicData.oem[EZTX_LANG_NL] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoNL.znd"); - #endif + smArg.mZiDicData.oem[EZTX_LANG_ENUK] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoENUK.znd"); + smArg.mZiDicData.oem[EZTX_LANG_DE] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoDE.znd"); + smArg.mZiDicData.oem[EZTX_LANG_FREU] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoFREU.znd"); + smArg.mZiDicData.oem[EZTX_LANG_ESEU] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoESEU.znd"); + smArg.mZiDicData.oem[EZTX_LANG_IT] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoIT.znd"); + smArg.mZiDicData.oem[EZTX_LANG_NL] = (u8*)loadZiDIC_(smArg.mResources.file[Arg::NINTENDO_DICT]->getBuffer(), "eZTNintendoNL.znd"); +#endif smArg.mbZi8ResLoaded = true; } @@ -217,36 +215,33 @@ namespace ipl { void System::createFolders_(void* work) { // Init VF - u8* workData = new(getMem1Sys(), DEFAULT_ALIGN) u8[VF_WORK_SIZE]; + u8* workData = new (getMem1Sys(), DEFAULT_ALIGN) u8[VF_WORK_SIZE]; VFInitEx(workData, VF_WORK_SIZE); // Init CDB - workData = new(getMem1Sys(), 64) u8[CDB_SYSTEM_WORK_SIZE]; + workData = new (getMem1Sys(), 64) u8[CDB_SYSTEM_WORK_SIZE]; if (!SCGetConfigDoneFlag() && !SCGetConfigDoneFlag2()) { - // @BUG Should use the full path + // @bug Should use the full path nand::wrapper::Delete("cdb.vff"); } cdb::wrapper::init(workData); - // @BUG: Reports free MEM1 size and how many NWC24 needs, yet it uses MEM2 instead. + // @bug: Reports free MEM1 size and how many NWC24 needs, yet it uses MEM2 instead. OSReport("MEM1SYS Free:%d NWC24 Need %d\n", getMem1Sys()->getAllocatableSize(4), NWC24_LIB_WORK_SIZE); - workData = new(getMem2Sys(), -DEFAULT_ALIGN) u8[NWC24_LIB_WORK_SIZE]; + workData = new (getMem2Sys(), -DEFAULT_ALIGN) u8[NWC24_LIB_WORK_SIZE]; // Init NWC24 if (!SCGetConfigDoneFlag() && !SCGetConfigDoneFlag2()) { NWC24InitFiles(workData, TRUE); - } - else { + } else { if (!SCGetConfigDoneFlag2()) { NWC24InitFiles(workData, FALSE); - } - else { + } else { NWC24Err err = NWC24OpenLib(workData); NWC24CloseLib(); - if (err == NWC24_ERR_BROKEN - || (err == NWC24_ERR_FILE_OTHER || err == NWC24_ERR_FILE_NOEXISTS || err == NWC24_ERR_FILE_WRITE - || err == NWC24_ERR_FILE_READ || err == NWC24_ERR_FILE_CLOSE || err == NWC24_ERR_FILE_OPEN)) { + if (err == NWC24_ERR_BROKEN || (err == NWC24_ERR_FILE_OTHER || err == NWC24_ERR_FILE_NOEXISTS || err == NWC24_ERR_FILE_WRITE || + err == NWC24_ERR_FILE_READ || err == NWC24_ERR_FILE_CLOSE || err == NWC24_ERR_FILE_OPEN)) { NWC24InitFiles(workData, FALSE); smArg.mbNWC24LibError = true; } @@ -302,15 +297,15 @@ namespace ipl { smArg.mResources.file[Arg::INVALID_JPEG] = getNandManager()->readAsync(getMem2Sys(), "/my_question.jpg"); // Load ZI dictionary - #if defined(VERSION_43U) +#if defined(VERSION_43U) smArg.mResources.sharedFile[Arg::ZI_DICT] = getNandManager()->readSharedAsync(getMem2Sys(), "eZTSystemNA.arc", 6); smArg.mResources.sharedFile[Arg::NINTENDO_DICT] = getNandManager()->readSharedAsync(getMem2Sys(), "eZTNintendoNA.arc", 7); getNandManager()->getTask()->request(requestCreateInstance, (void*)constructZiDIC_, NULL); - #elif defined(VERSION_43E) +#elif defined(VERSION_43E) smArg.mResources.sharedFile[Arg::ZI_DICT] = getNandManager()->readSharedAsync(getMem2Sys(), "eZTSystemEU.arc", 6); smArg.mResources.sharedFile[Arg::NINTENDO_DICT] = getNandManager()->readSharedAsync(getMem2Sys(), "eZTNintendoEU.arc", 7); getNandManager()->getTask()->request(requestCreateInstance, (void*)constructZiDIC_, NULL); - #endif +#endif // We are done! getNandManager()->getTask()->request(resourceLoaded_, NULL, NULL); @@ -327,13 +322,13 @@ namespace ipl { smArg.mpMem1Sys->unkUnline1(); // Create important instances - smArg.mpDialog = new(getMem1Sys(), 4) DialogWindow(getMem2Sys()); - smArg.mpWarningHandler = new(getMem1Sys(), 4) WarningHandler(getMem2Sys()); - smArg.mpMiiManager = new(getMem1Sys(), 4) nigaoe::Manager(getMem2Sys()); - smArg.mpKeyboardMgr = new(getMem1Sys(), 4) keyboard::Manager(); + smArg.mpDialog = new (getMem1Sys(), 4) DialogWindow(getMem2Sys()); + smArg.mpWarningHandler = new (getMem1Sys(), 4) WarningHandler(getMem2Sys()); + smArg.mpMiiManager = new (getMem1Sys(), 4) nigaoe::Manager(getMem2Sys()); + smArg.mpKeyboardMgr = new (getMem1Sys(), 4) keyboard::Manager(); smArg.mpKeyboardMgr->create(smArg.mResources.file[Arg::SOFT_KEYBOARD], getMem2Sys()); smArg.mpKeyboardMgr->init(); - smArg.mpHomeButton = new(getMem1Sys(), 4) HomeButtonMenu(getMem2Sys()); + smArg.mpHomeButton = new (getMem1Sys(), 4) HomeButtonMenu(getMem2Sys()); if (old != NULL) { old->unkUnline1(); @@ -349,8 +344,8 @@ namespace ipl { smArg.mpMem1Sys->unkUnline1(); // Create NWC24 and mail instances - smArg.mpCdbManager = new(getMem1Sys(), 4) cdb::Manager(getMem2Sys()); - smArg.mpNwc24Manager = new(getMem1Sys(), 4) nwc24::Manager(getMem2Sys()); + smArg.mpCdbManager = new (getMem1Sys(), 4) cdb::Manager(getMem2Sys()); + smArg.mpNwc24Manager = new (getMem1Sys(), 4) nwc24::Manager(getMem2Sys()); getMiiManager()->commitHiddenDB(); @@ -443,7 +438,7 @@ namespace ipl { smArg.mRegistState = Arg::REGIST_STATE_START; smArg.mRegistErrCode = 0; } - + BOOL System::processNWC24Regist() { switch (smArg.mRegistState) { case Arg::REGIST_STATE_START: { @@ -471,7 +466,7 @@ namespace ipl { char rsoListPath[OSRoundUp32B(64)]; OSCalendarTime newDateTime; - __OSInIPL = TRUE; // Yes we are in the IPL! (... this is already set to TRUE in BS2Init) + __OSInIPL = TRUE; // Yes we are in the IPL! (... this is already set to TRUE in BS2Init) // Initialize OS (... this is already done in `main`) OSInit(); @@ -495,9 +490,9 @@ namespace ipl { SCSetAspectRatio(SC_ASPECT_RATIO_4x3); SCSetWpadSensorBarPosition(0); - #ifdef VERSION_43U +#ifdef VERSION_43U SCSetBtDpdSensibility(3); - #endif // VERSION_43U +#endif // VERSION_43U SCSetScreenSaverMode(FALSE); VIEnableDimming(SCGetScreenSaverMode()); @@ -556,8 +551,7 @@ namespace ipl { SCSetNetContentRestrictions(SC_NET_RESTRICTIONS_NONE); SCSetWwwRestriction(FALSE); - } - else if (!SCGetConfigDoneFlag2()) { + } else if (!SCGetConfigDoneFlag2()) { switch (SCGetProductArea()) { case SC_PRODUCT_AREA_JPN: { setCountry(SC_COUNTRY_JP); @@ -605,7 +599,7 @@ namespace ipl { // Create FIFO EGG::GraphicsFifo::create(0x40000, NULL); GXSetPixelFmt(GX_PF_RGBA6_Z24, GX_ZC_LINEAR); - smArg.mpFramework = new(getMem1Sys(), 4) Framework(getMem1Sys()); + smArg.mpFramework = new (getMem1Sys(), 4) Framework(getMem1Sys()); // Fast cast OSInitFastCast(); @@ -619,16 +613,16 @@ namespace ipl { // Faders GXRenderModeObj* rMode = getRenderModeObj(); - smArg.mpFader = new(getMem1Sys(), 4) EGG::ColorFader(0.0f, 0.0f, rMode->fbWidth, rMode->efbHeight); - smArg.mpResetFader = new(getMem1Sys(), 4) EGG::ColorFader(0.0f, 0.0f, rMode->fbWidth, rMode->efbHeight); - + smArg.mpFader = new (getMem1Sys(), 4) EGG::ColorFader(0.0f, 0.0f, rMode->fbWidth, rMode->efbHeight); + smArg.mpResetFader = new (getMem1Sys(), 4) EGG::ColorFader(0.0f, 0.0f, rMode->fbWidth, rMode->efbHeight); + // Main thread EGG::Thread::initialize(); - smArg.mpMainThread = new(getMem1Sys(), 4) EGG::Thread(OSGetCurrentThread(), 4); + smArg.mpMainThread = new (getMem1Sys(), 4) EGG::Thread(OSGetCurrentThread(), 4); - smArg.mpControllerManager = new(getMem1Sys(), 4) controller::Manager(getMem2Sys()); - smArg.mpResetHandler = new(getMem1Sys(), 4) ResetHandler(getMem2Sys()); - smArg.mpErrorHandler = new(getMem1Sys(), 4) ErrorHandler(getMem2Sys()); + smArg.mpControllerManager = new (getMem1Sys(), 4) controller::Manager(getMem2Sys()); + smArg.mpResetHandler = new (getMem1Sys(), 4) ResetHandler(getMem2Sys()); + smArg.mpErrorHandler = new (getMem1Sys(), 4) ErrorHandler(getMem2Sys()); // ES Library BOOL initResult = ES_InitLib() != ES_ERR_OK; @@ -645,14 +639,14 @@ namespace ipl { smArg.mpTask3 = EGG::TaskThread::create(0x31, 20, 0x10000, getMem1Sys()); // Postman - smArg.mpPostmanManager = new(getMem1Sys(), 4) postman::Manager(getMem1Sys()); + smArg.mpPostmanManager = new (getMem1Sys(), 4) postman::Manager(getMem1Sys()); smArg.mpPostmanManager->InitManager(); // Set current time setToday_(); // BS2 Management - smArg.mpBS2Manager = new(getMem1Sys(), 4) bs2::Manager(getMem2Sys()); + smArg.mpBS2Manager = new (getMem1Sys(), 4) bs2::Manager(getMem2Sys()); if (isNandFull()) { getBS2Manager()->abort(); } @@ -666,10 +660,10 @@ namespace ipl { CNTCACHEInit(0, 0); // Random manager - smArg.mpRandom = new(getMem1Sys(), 4) math::Random(OSGetTick()); + smArg.mpRandom = new (getMem1Sys(), 4) math::Random(OSGetTick()); // NAND manager - smArg.mpNandManager = new(getMem1Sys(), 4) nand::Manager(getMem1Sys()); + smArg.mpNandManager = new (getMem1Sys(), 4) nand::Manager(getMem1Sys()); // Symbol list for RSO modules snprintf(rsoListPath, sizeof(rsoListPath), "/%s/%s/main.sel", SYSMENU_BUILD_TYPE, SYSMENU_BUILD_VERSION); @@ -677,7 +671,7 @@ namespace ipl { RSOListInit(smArg.mResources.file[Arg::RSO_SYM_LIST]->getBuffer()); // Load messages - #ifndef VERSION_43E +#ifndef VERSION_43E smArg.mResources.file[Arg::MESG_ENG] = getNandManager()->read(getMem2Sys(), "/message/eng/ipl_common.bmg"); smArg.mResources.file[Arg::MESG_FRA] = getNandManager()->read(getMem2Sys(), "/message/fra/ipl_common.bmg"); smArg.mResources.file[Arg::MESG_GER] = getNandManager()->read(getMem2Sys(), "/message/ger/ipl_common.bmg"); @@ -687,7 +681,7 @@ namespace ipl { smArg.mResources.file[Arg::MESG_SPA] = getNandManager()->read(getMem2Sys(), "/message/spa/ipl_common.bmg"); smArg.mResources.file[Arg::MESG_KOR] = getNandManager()->read(getMem2Sys(), "/message/kor/ipl_common.bmg"); smArg.mResources.file[Arg::MESG_CHN] = getNandManager()->read(getMem2Sys(), "/message/chn/ipl_common.bmg"); - #else +#else // Load European messages smArg.mResources.file[Arg::MESG_ENG] = getNandManager()->read(getMem2Sys(), "/message/eng/ipl_common_noe.bmg"); smArg.mResources.file[Arg::MESG_FRA] = getNandManager()->read(getMem2Sys(), "/message/fra/ipl_common_noe.bmg"); @@ -698,31 +692,31 @@ namespace ipl { smArg.mResources.file[Arg::MESG_SPA] = getNandManager()->read(getMem2Sys(), "/message/spa/ipl_common_noe.bmg"); smArg.mResources.file[Arg::MESG_KOR] = getNandManager()->read(getMem2Sys(), "/message/kor/ipl_common.bmg"); smArg.mResources.file[Arg::MESG_CHN] = getNandManager()->read(getMem2Sys(), "/message/chn/ipl_common.bmg"); - #endif // VERSION_43E +#endif // VERSION_43E // Setup more stuff - smArg.mpException = new(getMem1Sys(), 4) Exception(getMem2Sys(), *System::getRenderModeObj()); - smArg.mpPointer = new(getMem1Sys(), 4) Pointer(getMem2Sys()); - smArg.mpTVRCManager = new(getMem2Sys(), 4) TVRCManager(getMem2Sys()); + smArg.mpException = new (getMem1Sys(), 4) Exception(getMem2Sys(), *System::getRenderModeObj()); + smArg.mpPointer = new (getMem1Sys(), 4) Pointer(getMem2Sys()); + smArg.mpTVRCManager = new (getMem2Sys(), 4) TVRCManager(getMem2Sys()); ncd::NCDSetting::makeMacAddr(); - smArg.mpJpegDecoder = new(getMem1Sys(), 4) utility::JpegDecoder(getMem2Sys()); + smArg.mpJpegDecoder = new (getMem1Sys(), 4) utility::JpegDecoder(getMem2Sys()); // Load system resources loadResource_(NULL); - smArg.mpMessageMgr = new(getMem1Sys(), 4) message::Manager(getMem2Sys()); - smArg.mpSceneManager = new(getMem1Sys(), 4) scene::Manager(smArg.mpSceneHeap); + smArg.mpMessageMgr = new (getMem1Sys(), 4) message::Manager(getMem2Sys()); + smArg.mpSceneManager = new (getMem1Sys(), 4) scene::Manager(smArg.mpSceneHeap); // IPL save data - smArg.mpSaveDataManager = new(getMem1Sys(), DEFAULT_ALIGN) savedata::Manager(getMem2Sys()); + smArg.mpSaveDataManager = new (getMem1Sys(), DEFAULT_ALIGN) savedata::Manager(getMem2Sys()); smArg.mpSaveDataManager->initManager(); // TVRC Database TVRCManager::getHandle()->loadDatabase(); // Channel instances - smArg.mpChannelScriptManager = new(getMem1Sys(), 4) channel::ChannelScriptManager(); - smArg.mpChannelManager = new(getMem1Sys(), 4) channel::Manager(smArg.mpChannelHeap); + smArg.mpChannelScriptManager = new (getMem1Sys(), 4) channel::ChannelScriptManager(); + smArg.mpChannelManager = new (getMem1Sys(), 4) channel::Manager(smArg.mpChannelHeap); smArg.mpChannelManager->initManager(); // Setup scenary @@ -736,13 +730,13 @@ namespace ipl { smArg.mpFramework->endFrame(); } - #if defined(VERSION_43K) || !defined(TURN_OFF_CK2_VERIFY) +#if defined(VERSION_43K) || !defined(TURN_OFF_CK2_VERIFY) // And finally... homebrew's fear. BOOL hasKoreanKey = ES_VerifyCK2() == ES_ERR_OK; if (hasKoreanKey) { IPLErrorLogAndDisplay(MESG_ERR_KEY2, "ES", hasKoreanKey, 1446); } - #endif +#endif } BOOL System::isResetAcceptable() { @@ -812,8 +806,7 @@ namespace ipl { getSceneManager()->calc(); getFader()->calc(); getResetFader()->calc(); - } - else { + } else { // Update log depending on HOME Menu state if (getHomeButtonMenu() != NULL && !getHomeButtonMenu()->isEnable()) { getSceneManager()->calc(); @@ -823,8 +816,7 @@ namespace ipl { getPointer()->calc(); getFader()->calc(); getResetFader()->calc(); - } - else { + } else { getHomeButtonMenu()->calc(); getPointer()->calc(); getFader()->calc(); @@ -1132,8 +1124,7 @@ namespace ipl { // Pop old state if (isVisible) { System::getPointer()->setVisible(true); - } - else { + } else { System::getPointer()->setVisible(false); } @@ -1262,7 +1253,7 @@ namespace ipl { return lang; } - + s32 System::getRegion() { s32 product = SCGetProductArea(); @@ -1280,7 +1271,6 @@ namespace ipl { // NTSC-K case SC_PRODUCT_AREA_KOR: { return SC_PRODUCT_AREA_KOR; - } // Unreleased iQue version case SC_PRODUCT_AREA_CHN: { @@ -1304,7 +1294,7 @@ namespace ipl { OSTicksToCalendarTime(OSGetTime(), &smArg.mCurrentTime); if (smArg.mCurrentTime.year > MAX_YEAR) { smArg.mCurrentTime.year = MAX_YEAR; - smArg.mCurrentTime.mon = MAX_MONTH-1; + smArg.mCurrentTime.mon = MAX_MONTH - 1; smArg.mCurrentTime.mday = MAX_DAY; OSTicksToCalendarTime(OSCalendarTimeToTicks(&smArg.mCurrentTime), &smArg.mCurrentTime); } @@ -1325,13 +1315,13 @@ namespace ipl { // Internet settings if (smArg.mBS2LaunchCode == LAUNCH_CODE_SETTING && BS2GetArgc() > 1) { strncpy(smArg.mBS2FirstArgv, BS2GetArgv()[1], sizeof(smArg.mBS2FirstArgv)); - smArg.mBS2FirstArgv[sizeof(smArg.mBS2FirstArgv)-1] = 0; + smArg.mBS2FirstArgv[sizeof(smArg.mBS2FirstArgv) - 1] = 0; smArg.mpNetSettingArg = smArg.mBS2FirstArgv; } // Data management else if (smArg.mBS2LaunchCode == LAUNCH_CODE_DATA_MANAGER && BS2GetArgc() > 1) { strncpy(smArg.mBS2FirstArgv, BS2GetArgv()[1], sizeof(smArg.mBS2FirstArgv)); - smArg.mBS2FirstArgv[sizeof(smArg.mBS2FirstArgv)-1] = 0; + smArg.mBS2FirstArgv[sizeof(smArg.mBS2FirstArgv) - 1] = 0; smArg.mpDataManageArg = smArg.mBS2FirstArgv; smArg.mbGoingToDataManager = true; @@ -1340,4 +1330,4 @@ namespace ipl { } } } -} +} // namespace ipl diff --git a/src/system/iplTVRCManager.cpp b/src/system/iplTVRCManager.cpp index 2ca018ea..e184d4b4 100644 --- a/src/system/iplTVRCManager.cpp +++ b/src/system/iplTVRCManager.cpp @@ -12,5 +12,5 @@ namespace ipl { } return result; } - } -} + } // namespace utility +} // namespace ipl diff --git a/src/system/iplWarningHandler.cpp b/src/system/iplWarningHandler.cpp index f520346b..f806d009 100644 --- a/src/system/iplWarningHandler.cpp +++ b/src/system/iplWarningHandler.cpp @@ -3,10 +3,8 @@ #include "iplSystem.h" namespace ipl { - WarningHandler::WarningHandler(EGG::Heap* heap) : - mType(NONE), - mMessageID(0) { - mpDialog = new(heap, 4) DialogWindow(heap); + WarningHandler::WarningHandler(EGG::Heap* heap) : mType(NONE), mMessageID(0) { + mpDialog = new (heap, 4) DialogWindow(heap); } void WarningHandler::set(Type type, u32 msgId) { @@ -34,4 +32,4 @@ namespace ipl { BOOL WarningHandler::check() { return mpDialog->getLastResult(); } -} +} // namespace ipl diff --git a/src/system/main.cpp b/src/system/main.cpp index e2520d5f..1f8c697c 100644 --- a/src/system/main.cpp +++ b/src/system/main.cpp @@ -15,4 +15,4 @@ s32 NANDCheck(u32 fsblock, u32 inode, u32* answer) { return NAND_RESULT_OK; } -} // extern "C" +} // extern "C" diff --git a/src/system/odh.cpp b/src/system/odh.cpp index d2739afb..905c24fd 100644 --- a/src/system/odh.cpp +++ b/src/system/odh.cpp @@ -16,12 +16,12 @@ enum { }; class CArGBAOdh { - public: - s32 decompressGbaOdh(u8* src, int srcSize, u8* dest, int destSize, u8* work, int unk, int format); - s32 compressGbaOdh(u8* src, u8* dest, int width, int height, int quality, u32 sizeLimit, u8* work, int format); + public: + s32 decompressGbaOdh(u8* src, int srcSize, u8* dest, int destSize, u8* work, int unk, int format); + s32 compressGbaOdh(u8* src, u8* dest, int width, int height, int quality, u32 sizeLimit, u8* work, int format); - private: - s32 ScaleLimit(s32 scale); + private: + s32 ScaleLimit(s32 scale); }; int ODHEncodeRGB565(u8* src, u8* dest, int width, int height, u32 sizeLimit, int quality, u8* work) { @@ -67,13 +67,12 @@ int ODHGetHeight(u8* data) { s32 CArGBAOdh::ScaleLimit(s32 scale) { s32 newScale = scale; - + if (newScale < 0) { newScale = 0; - } - else if (scale > 255) { + } else if (scale > 255) { newScale = 255; } - + return newScale; } diff --git a/src/system/rvl_dec.c b/src/system/rvl_dec.c index 34717893..b18ccca4 100644 --- a/src/system/rvl_dec.c +++ b/src/system/rvl_dec.c @@ -1,14 +1,16 @@ #include "system/rvl_dec.h" -#define SZS_SIGNATURE 0x0059617A /* 'Yaz */ -#define ASH_SIGNATURE 0x00415348 /* 'ASH' */ -#define ASR_SIGNATURE 0x00415352 /* 'ASR' */ +#define SZS_SIGNATURE 0x0059617A /* 'Yaz */ +#define ASH_SIGNATURE 0x00415348 /* 'ASH' */ +#define ASR_SIGNATURE 0x00415352 /* 'ASR' */ int Rvl_decode(u8* out, u8* in) { #ifdef TARGET_RVL // Original ASM Implementation register u8* dataIn = in; + + // clang-format off #ifdef __MWERKS__ asm volatile { // Get magic @@ -34,6 +36,8 @@ int Rvl_decode(u8* out, u8* in) { beq Rvl_decode_asr }; #endif // __MWERKS__ + // clang-format on + // Otherwise return 0; #else @@ -59,10 +63,16 @@ int Rvl_decode(u8* out, u8* in) { return 0; } } -#endif // TARGET_RVL +#endif // TARGET_RVL } /* TODO !!! */ -int Rvl_decode_szs(u8* out, u8* in) { return 0; } -int Rvl_decode_ash(u8* out, u8* in) { return 0; } -int Rvl_decode_asr(u8* out, u8* in) { return 0; } +int Rvl_decode_szs(u8* out, u8* in) { + return 0; +} +int Rvl_decode_ash(u8* out, u8* in) { + return 0; +} +int Rvl_decode_asr(u8* out, u8* in) { + return 0; +} diff --git a/src/utility/iplCSFlags.cpp b/src/utility/iplCSFlags.cpp index 82245615..22514540 100644 --- a/src/utility/iplCSFlags.cpp +++ b/src/utility/iplCSFlags.cpp @@ -2,14 +2,14 @@ #include "utility/iplMisc.h" -#include #include +#include #include #include -#define FLAG_FILE_PATH "/shared2/sys/flags.dat" +#define FLAG_FILE_PATH "/shared2/sys/flags.dat" namespace ipl { namespace utility { @@ -18,11 +18,10 @@ namespace ipl { bool createFile = false; s32 result = NANDPrivateGetType(FLAG_FILE_PATH, (u8*)&dummy); - + if (result == NAND_RESULT_NOEXISTS) { createFile = true; - } - else if (result != NAND_RESULT_OK) { + } else if (result != NAND_RESULT_OK) { OSReport("CSFlags::CreateFlagsFile: the flag file is bad status: %d\n", result); result = NANDPrivateDelete(FLAG_FILE_PATH); @@ -35,8 +34,8 @@ namespace ipl { } if (createFile) { - NANDFileInfo file; - CSFlagsData data ALIGN32; + NANDFileInfo file; + CSFlagsData data ALIGN32; // Create file @@ -80,8 +79,8 @@ namespace ipl { } s32 CSFlags::ReadFlags(CSFlagsData* outData) { - NANDFileInfo file; - CSFlagsData data ALIGN32; + NANDFileInfo file; + CSFlagsData data ALIGN32; // Opne file @@ -116,8 +115,8 @@ namespace ipl { } s32 CSFlags::WriteFlags(CSFlagsData* inData) { - NANDFileInfo file; - CSFlagsData data ALIGN32; + NANDFileInfo file; + CSFlagsData data ALIGN32; // Opne file @@ -128,7 +127,7 @@ namespace ipl { } // Write contents - + memcpy(&data, inData, sizeof(data)); result = NANDWrite(&file, &data, sizeof(data)); if (result != sizeof(data)) { @@ -178,7 +177,7 @@ namespace ipl { OSReport("CSFlags::UpdateFlagsFile: failed to write the flag: %d\n", result); return result; } - + // Finished. return result; @@ -187,10 +186,9 @@ namespace ipl { void CSFlags::SetEULAFlag(CSFlagsData* data) { if (SCGetEULA()) { utility::setBit(&data->flags, CSFlagsData::FLAG_SYSCONF_EULA); - } - else { + } else { utility::clearBit(&data->flags, CSFlagsData::FLAG_SYSCONF_EULA); } } - } -} + } // namespace utility +} // namespace ipl diff --git a/src/utility/iplCapture.cpp b/src/utility/iplCapture.cpp index d17bc7cc..6cab79cf 100644 --- a/src/utility/iplCapture.cpp +++ b/src/utility/iplCapture.cpp @@ -4,14 +4,10 @@ namespace ipl { namespace utility { - Capture::Capture(EGG::Heap* heap, int x, int y, int width, int height, GXTexFmt texFmt) : - mXPos(x), - mYPos(y), - mTextureWidth(width), - mTextureHeight(height), - mTextureFormat(texFmt) { + Capture::Capture(EGG::Heap* heap, int x, int y, int width, int height, GXTexFmt texFmt) + : mXPos(x), mYPos(y), mTextureWidth(width), mTextureHeight(height), mTextureFormat(texFmt) { mTextureSize = GXGetTexBufferSize(width, height, texFmt, GX_FALSE, 1); - mTextureBuffer = new(heap, DEFAULT_ALIGN) u8[mTextureSize]; + mTextureBuffer = new (heap, DEFAULT_ALIGN) u8[mTextureSize]; GXInitTexObj(&mTexObj, mTextureBuffer, mTextureWidth, mTextureHeight, mTextureFormat, GX_CLAMP, GX_CLAMP, GX_FALSE); } @@ -22,22 +18,22 @@ namespace ipl { void Capture::capture(BOOL disableFilter) { DCInvalidateRange(mTextureBuffer, mTextureSize); - + if (!disableFilter) { GXRenderModeObj* pRmode = System::getRenderModeObj(); GXSetCopyFilter(GX_FALSE, pRmode->sample_pattern, GX_FALSE, pRmode->vfilter); } - + GXSetTexCopySrc(mXPos, mYPos, mTextureWidth, mTextureHeight); GXSetTexCopyDst(mTextureWidth, mTextureHeight, mTextureFormat, GX_FALSE); - + GXCopyTex(mTextureBuffer, GX_FALSE); GXPixModeSync(); - + if (!disableFilter) { GXRenderModeObj* pRmode = System::getRenderModeObj(); GXSetCopyFilter(pRmode->aa, pRmode->sample_pattern, GX_TRUE, pRmode->vfilter); } } - } -} + } // namespace utility +} // namespace ipl diff --git a/src/utility/iplESMisc.cpp b/src/utility/iplESMisc.cpp index abc71d79..3bd18cea 100644 --- a/src/utility/iplESMisc.cpp +++ b/src/utility/iplESMisc.cpp @@ -5,8 +5,8 @@ #include -#include #include +#include #include @@ -14,19 +14,18 @@ #include "config.h" -#define TMD_FILE "/title/00000001/00000002/data/tmds.sys" +#define TMD_FILE "/title/00000001/00000002/data/tmds.sys" namespace ipl { namespace utility { - // meh - #define ES_ERR_REPORT(msg, ...) \ - OSReport("%s::%s: "msg"\n", __FILE__, __FUNCTION__, __VA_ARGS__); \ +// meh +#define ES_ERR_REPORT(msg, ...) OSReport("%s::%s: " msg "\n", __FILE__, __FUNCTION__, __VA_ARGS__); ESError ESMisc::GetTmdView(EGG::Heap* heap, ESTitleId titleId, ESTmdView** outTmdView) { - ESTmdView* tmdView; - u32 tmdViewSize = 0; + ESTmdView* tmdView; + u32 tmdViewSize = 0; - ESError ret; + ESError ret; ret = ES_GetTmdView(titleId, NULL, &tmdViewSize); if (ret < ES_ERR_OK) { @@ -47,15 +46,15 @@ namespace ipl { goto out; } -out: + out: return ret; } ESError ESMisc::GetTicketViewList(EGG::Heap* heap, ESTitleId titleId, ESTicketView** outTicketViews, u32* outNumTicketViews) { - ESTicketView* ticketViews; - u32 numTicketViews = 0; + ESTicketView* ticketViews; + u32 numTicketViews = 0; - ESError ret; + ESError ret; ret = ES_GetTicketViews(titleId, NULL, &numTicketViews); if (ret < ES_ERR_OK) { @@ -87,10 +86,10 @@ out: } ESError ESMisc::GetTicketView(EGG::Heap* heap, ESTitleId titleId, ESTicketView* ticketView, int numTicketViews) { - u32 inNumTicketViews = 0; - ESTicketView* inTicketView = NULL; - - ESError ret; + u32 inNumTicketViews = 0; + ESTicketView* inTicketView = NULL; + + ESError ret; ret = GetTicketViewList(heap, titleId, &inTicketView, &inNumTicketViews); if (numTicketViews >= inNumTicketViews) { @@ -102,7 +101,7 @@ out: if (ret == ES_ERR_OK) { memcpy(ticketView, inTicketView + numTicketViews, sizeof(ESTicketView)); } -out: + out: if (inTicketView != NULL) { heap->free(inTicketView); } @@ -110,12 +109,12 @@ out: } s32 ESMisc::PrivateContentsExist(ESTitleId titleId) { - char path[96] ALIGN32; + char path[96] ALIGN32; - u32 usedBlocks = 0; - u32 usedINodes = 0; + u32 usedBlocks = 0; + u32 usedINodes = 0; - s32 ret; + s32 ret; sprintf(path, "/title/%08x/%08x/content", NANDTitleIdHi(titleId), NANDTitleIdLo(titleId)); ret = NANDSecretGetUsage(path, &usedBlocks, &usedINodes); @@ -204,9 +203,9 @@ out: DECOMP_FORCE_ACTIVE(iplESMisc_cpp, "DeleteSharedContent: ES_DeleteSharedContent err %d\n"); BOOL ESMisc::IsLastTicketExpired(ESTitleId* titleId) { - s32 ret; - NANDFileInfo file; - ESTitleId readTitleId ALIGN32; + s32 ret; + NANDFileInfo file; + ESTitleId readTitleId ALIGN32; if (BS2GetBootType() != 1) { DeleteExpiredFlagFile(); @@ -282,7 +281,7 @@ out: char path[64] ALIGN32; snprintf(path, sizeof(path), "/title/%08x/%08x/data", NANDTitleIdHi(titleId), NANDTitleIdLo(titleId)); - + u32 nodes; s32 ret = NANDPrivateReadDir(path, NULL, &nodes); @@ -294,7 +293,7 @@ out: result = nodes; } -out: + out: if (changedUid) { ChangeUid(SYSMENU_TITLE_ID); } @@ -315,7 +314,7 @@ out: ES_ERR_REPORT("Backup TMD failed: %d", ret); goto do_proc; } -do_proc: + do_proc: ret = ES_DeleteTitle(titleId); if (ret != ES_ERR_OK) { ES_ERR_REPORT("ES_DeleteTitle failed: %d for %016llx", ret, titleId); @@ -325,7 +324,7 @@ do_proc: } s32 ESMisc::DeleteMetaContent(ESTitleId titleId) { - char metaPath[64]=""; + char metaPath[64] = ""; snprintf(metaPath, sizeof(metaPath), "/meta/%08x/%08x/title.met", NANDTitleIdHi(titleId), NANDTitleIdLo(titleId)); return NANDPrivateDelete(metaPath); } @@ -340,10 +339,7 @@ do_proc: return FALSE; } - TMDFile::TMDFile(EGG::Heap* heap) : - mpHeap(heap), - mbFileOpen(FALSE), - mFileLength(0) { + TMDFile::TMDFile(EGG::Heap* heap) : mpHeap(heap), mbFileOpen(FALSE), mFileLength(0) { memset(&mFile, 0, sizeof(mFile)); } @@ -388,8 +384,8 @@ do_proc: } BOOL TMDFile::Exist(ESTitleId titleId, u32* tmdOffset, u32* tmdSize) { - u32 offset = 0; - EntryHead entry ALIGN32; + u32 offset = 0; + EntryHead entry ALIGN32; if (!mbFileOpen) { return FALSE; @@ -423,9 +419,9 @@ do_proc: } s32 TMDFile::Backup(ESTitleId titleId) { - s32 ret = NAND_RESULT_OK; - u32 entryLen; - EntryHead* entry = NULL; + s32 ret = NAND_RESULT_OK; + u32 entryLen; + EntryHead* entry = NULL; if (!mbFileOpen) { return -1; @@ -433,7 +429,7 @@ do_proc: u32 fileLen; u32 tmdSize; - + // Is the TMD already in the backup database? if (!Exist(titleId, NULL, NULL)) { // If not, let's back you up! @@ -496,7 +492,7 @@ do_proc: mFileLength += entryLen; goto out; } -out: + out: if (entry != NULL) { mpHeap->free(entry); } @@ -504,12 +500,12 @@ out: } s32 TMDFile::Restore(ESTitleId titleId) { - s32 ret = NAND_RESULT_OK; + s32 ret = NAND_RESULT_OK; - u32 fileLen; - u32 tmdOffset = 0; - u32 tmdSize = 0; - void* tmdBuffer = NULL; + u32 fileLen; + u32 tmdOffset = 0; + u32 tmdSize = 0; + void* tmdBuffer = NULL; if (!mbFileOpen) { return -1; @@ -558,11 +554,11 @@ out: goto out; } } -out: + out: if (tmdBuffer != NULL) { mpHeap->free(tmdBuffer); } return ret; } - } -} + } // namespace utility +} // namespace ipl diff --git a/src/utility/iplFrameController.cpp b/src/utility/iplFrameController.cpp index a1564185..b8dde4ae 100644 --- a/src/utility/iplFrameController.cpp +++ b/src/utility/iplFrameController.cpp @@ -1,5 +1,5 @@ -#include "iplSystem.h" #include "utility/iplFrameController.h" +#include "iplSystem.h" namespace ipl { namespace utility { @@ -22,8 +22,7 @@ namespace ipl { float frame; if (mAnmType == ANIM_TYPE_BACKWARD) { frame = mMaxFrame; - } - else { + } else { frame = mMinFrame; } mFrame = frame; @@ -66,8 +65,7 @@ namespace ipl { mFrame = mMaxFrame; mbAlternateBack = true; } - } - else { + } else { if ((mFrame -= speed) <= mMinFrame) { mFrame = mMinFrame; mbAlternateBack = false; @@ -76,10 +74,9 @@ namespace ipl { break; } } - } - else if (mState == ANIM_STATE_STOP_REQ) { + } else if (mState == ANIM_STATE_STOP_REQ) { mState = ANIM_STATE_STOP; } } - } -} + } // namespace utility +} // namespace ipl diff --git a/src/utility/iplGraphics.cpp b/src/utility/iplGraphics.cpp index a6b601dd..5040a5db 100644 --- a/src/utility/iplGraphics.cpp +++ b/src/utility/iplGraphics.cpp @@ -8,11 +8,9 @@ namespace ipl { namespace utility { - Graphics::Arg Graphics::mArg; + Graphics::Arg Graphics::mArg; - Graphics::Arg::Arg() : - mOrthoTrans(0, 0, 0), - mOrthoScale(1, 1) { + Graphics::Arg::Arg() : mOrthoTrans(0, 0, 0), mOrthoScale(1, 1) { nw4r::math::MTX44Identity(&mProjMtx); nw4r::math::MTX34Identity(&mViewMtx); } @@ -35,27 +33,20 @@ namespace ipl { } void Graphics::setOrthoProjection(const math::VEC3& translate, const math::VEC2& scale) { - nw4r::ut::Rect projRect(0, 0, 0, 0); + nw4r::ut::Rect projRect(0, 0, 0, 0); System::getProjectionRect(&projRect); - f32 temp_f9 = projRect.right / scale.x; + f32 temp_f9 = projRect.right / scale.x; f32 temp_f7 = projRect.left / scale.x; - MTXOrtho(mArg.mProjMtx, - translate.y - (projRect.top / scale.y), - translate.y - (projRect.bottom / scale.y), - translate.x + temp_f7, - translate.x + temp_f9, - -100.0f, 100.0f); + MTXOrtho(mArg.mProjMtx, translate.y - (projRect.top / scale.y), translate.y - (projRect.bottom / scale.y), translate.x + temp_f7, + translate.x + temp_f9, -100.0f, 100.0f); GXSetProjection(mArg.mProjMtx, GX_ORTHOGRAPHIC); } void Graphics::setOrthoProjection(u32 id) { GXRenderModeObj* rMode = System::getRenderModeObj(); - MTXOrtho(mArg.mProjMtx, - rMode->efbHeight / 2, -rMode->efbHeight / 2, - -rMode->fbWidth / 2, rMode->fbWidth / 2, - -100.0f, 100.0f); + MTXOrtho(mArg.mProjMtx, rMode->efbHeight / 2, -rMode->efbHeight / 2, -rMode->fbWidth / 2, rMode->fbWidth / 2, -100.0f, 100.0f); GXSetProjection(mArg.mProjMtx, GX_ORTHOGRAPHIC); calcOrthoCamera(); @@ -71,12 +62,12 @@ namespace ipl { GXSetCurrentMtx(id); } - void Graphics::drawPolygon(const nw4r::ut::Rect &rect, GXColor color) { + void Graphics::drawPolygon(const nw4r::ut::Rect& rect, GXColor color) { GXClearVtxDesc(); GXInvalidateVtxCache(); GXInvalidateTexAll(); - + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); @@ -109,7 +100,8 @@ namespace ipl { GXSetTevColor(GX_TEVREG0, color); - GXBegin(GX_QUADS, GX_VTXFMT0, 4); { + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + { GXPosition3f32(rect.left, rect.top, 0.0f); GXColor4u8(255, 255, 255, 255); GXPosition3f32(rect.left, rect.bottom, 0.0f); @@ -118,14 +110,15 @@ namespace ipl { GXColor4u8(255, 255, 255, 255); GXPosition3f32(rect.right, rect.top, 0.0f); GXColor4u8(255, 255, 255, 255); - } GXEnd(); + } + GXEnd(); } - void Graphics::drawTexture(const nw4r::ut::Rect &rect, const GXTexObj& texObj, GXColor color, u8 texScale, Orientation ori) { - u8 leftTop_x, leftTop_y; - u8 leftBottom_x, leftBottom_y; + void Graphics::drawTexture(const nw4r::ut::Rect& rect, const GXTexObj& texObj, GXColor color, u8 texScale, Orientation ori) { + u8 leftTop_x, leftTop_y; + u8 leftBottom_x, leftBottom_y; u8 rightBottom_x, rightBottom_y; - u8 rightTop_x, rightTop_y; + u8 rightTop_x, rightTop_y; switch (ori) { case ORI_NONE: { @@ -201,7 +194,8 @@ namespace ipl { GXSetTevColor(GX_TEVREG0, color); - GXBegin(GX_QUADS, GX_VTXFMT0, 4); { + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + { GXPosition3f32(rect.left, rect.top, 0.0f); GXTexCoord2u8(leftTop_x, leftTop_y); GXPosition3f32(rect.left, rect.bottom, 0.0f); @@ -210,7 +204,8 @@ namespace ipl { GXTexCoord2u8(rightBottom_x, rightBottom_y); GXPosition3f32(rect.right, rect.top, 0.0f); GXTexCoord2u8(rightTop_x, rightTop_y); - } GXEnd(); + } + GXEnd(); } - } -} + } // namespace utility +} // namespace ipl diff --git a/src/utility/iplMessageBase.cpp b/src/utility/iplMessageBase.cpp index 773a9367..cd187a84 100644 --- a/src/utility/iplMessageBase.cpp +++ b/src/utility/iplMessageBase.cpp @@ -17,7 +17,5 @@ namespace ipl { void ut_message_base::InitMessageQueue(OSMessage* pMsg, s32 msgCount) { OSInitMessageQueue(&mpMsgQueue, pMsg, msgCount); } - } -} - - + } // namespace utility +} // namespace ipl diff --git a/src/utility/iplThread.cpp b/src/utility/iplThread.cpp index 011df7eb..5b17094e 100644 --- a/src/utility/iplThread.cpp +++ b/src/utility/iplThread.cpp @@ -4,17 +4,16 @@ namespace ipl { namespace utility { void* ut_thread::ThreadMain_(void* param) { OSInitFastCast(); - + ut_thread* thread = reinterpret_cast(param); return thread->Run(); } - ut_thread::ut_thread() : - mpStack(NULL), - mStackSize(0), - mPriority(16) {} + ut_thread::ut_thread() : mpStack(NULL), mStackSize(0), mPriority(16) { + } - ut_thread::~ut_thread() {} + ut_thread::~ut_thread() { + } void ut_thread::Create(void* pStack, u32 stackSize, int priority, bool bStartThread) { mStackSize = stackSize; @@ -52,7 +51,5 @@ namespace ipl { bool ut_thread::SetThreadPriority(int priority) { return OSSetThreadPriority(&mThread, priority); } - } -} - - + } // namespace utility +} // namespace ipl diff --git a/src/utility/iplTree.cpp b/src/utility/iplTree.cpp index 7c9c144d..df49a425 100644 --- a/src/utility/iplTree.cpp +++ b/src/utility/iplTree.cpp @@ -2,9 +2,8 @@ namespace ipl { namespace utility { - Tree::Tree() : - mpParent(), mpChild(), - mpNext(), mpPrev() {} + Tree::Tree() : mpParent(), mpChild(), mpNext(), mpPrev() { + } void Tree::attach(Tree* tree) { Tree* child = mpChild; @@ -12,8 +11,7 @@ namespace ipl { if (child == empty()) { mpChild = tree; tree->mpParent = this; - } - else { + } else { while (child->mpNext != empty()) { child = child->mpNext; } @@ -48,5 +46,5 @@ namespace ipl { mpPrev->mpNext = mpNext; } } - } -} + } // namespace utility +} // namespace ipl diff --git a/src/utility/iplUtility.cpp b/src/utility/iplUtility.cpp index b61f53e7..f020e540 100644 --- a/src/utility/iplUtility.cpp +++ b/src/utility/iplUtility.cpp @@ -1,6 +1,5 @@ #include "iplUtility.h" namespace ipl { - namespace utility { - } -} + namespace utility {} +} // namespace ipl