hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
108
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
1d3a7864125a9f8653c1e33370a551b3b100b823
1,401
hpp
C++
external/boost_1_60_0/qsboost/type_traits/decay.hpp
wouterboomsma/quickstep
a33447562eca1350c626883f21c68125bd9f776c
[ "MIT" ]
1
2019-06-27T17:54:13.000Z
2019-06-27T17:54:13.000Z
external/boost_1_60_0/qsboost/type_traits/decay.hpp
wouterboomsma/quickstep
a33447562eca1350c626883f21c68125bd9f776c
[ "MIT" ]
null
null
null
external/boost_1_60_0/qsboost/type_traits/decay.hpp
wouterboomsma/quickstep
a33447562eca1350c626883f21c68125bd9f776c
[ "MIT" ]
null
null
null
// (C) Copyright John Maddock & Thorsten Ottosen 2005. // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). // // See http://www.boost.org/libs/type_traits for most recent version including documentation. #ifndef QSBOOST_TT_DECAY_HPP_INCLUDED #define QSBOOST_TT_DECAY_HPP_INCLUDED #include <qsboost/type_traits/is_array.hpp> #include <qsboost/type_traits/is_function.hpp> #include <qsboost/type_traits/remove_bounds.hpp> #include <qsboost/type_traits/add_pointer.hpp> #include <qsboost/type_traits/remove_reference.hpp> #include <qsboost/type_traits/remove_cv.hpp> namespace qsboost { namespace detail { template <class T, bool Array, bool Function> struct decay_imp { typedef typename remove_cv<T>::type type; }; template <class T> struct decay_imp<T, true, false> { typedef typename remove_bounds<T>::type* type; }; template <class T> struct decay_imp<T, false, true> { typedef T* type; }; } template< class T > struct decay { private: typedef typename remove_reference<T>::type Ty; public: typedef typename qsboost::detail::decay_imp<Ty, qsboost::is_array<Ty>::value, qsboost::is_function<Ty>::value>::type type; }; } // namespace boost #endif // BOOST_TT_DECAY_HPP_INCLUDED
31.840909
129
0.729479
wouterboomsma
1d3caba3140464c20119ea3004da1c4e46ecf5eb
2,808
cpp
C++
oneflow/core/kernel/wait_and_send_ids_kernel.cpp
xmyqsh/oneflow
18baa096d72bf2b99f03330f7b2c19f2b41f5bc9
[ "Apache-2.0" ]
null
null
null
oneflow/core/kernel/wait_and_send_ids_kernel.cpp
xmyqsh/oneflow
18baa096d72bf2b99f03330f7b2c19f2b41f5bc9
[ "Apache-2.0" ]
null
null
null
oneflow/core/kernel/wait_and_send_ids_kernel.cpp
xmyqsh/oneflow
18baa096d72bf2b99f03330f7b2c19f2b41f5bc9
[ "Apache-2.0" ]
null
null
null
/* Copyright 2020 The OneFlow Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "oneflow/core/kernel/wait_and_send_ids_kernel.h" #include "oneflow/core/common/buffer_manager.h" #include "oneflow/core/job/job_instance.h" #include "oneflow/core/job/global_for.h" namespace oneflow { template<typename T> void WaitAndSendIdsKernel<T>::VirtualKernelInit(KernelContext* ctx) { ctx->set_state(new WaitAndSendIdsStatus); } template<typename T> void WaitAndSendIdsKernel<T>::DestroyState(void* state) const { delete static_cast<WaitAndSendIdsStatus*>(state); } template<typename T> void WaitAndSendIdsKernel<T>::ForwardDataContent(const KernelContext* ctx) const { CHECK(ctx->state()); auto* status = static_cast<WaitAndSendIdsStatus*>(ctx->state()); const auto& conf = this->op_conf().wait_and_send_ids_conf(); if (status->out_idx_ >= status->out_num_) { if (CHECK_JUST(*Global<Maybe<bool>, MultiClient>::Get())) { CHECK(this->op_conf().wait_and_send_ids_conf().has_job_name()); const auto& job_name = this->op_conf().wait_and_send_ids_conf().job_name(); auto* buffer_mgr = Global<BufferMgr<std::shared_ptr<JobInstance>>>::Get(); auto* buffer = buffer_mgr->Get(GetSourceTickBufferName(job_name)); status->in_id_ = 0; { std::shared_ptr<JobInstance> job_instance; status->buffer_status_ = buffer->Receive(&job_instance); } if (status->buffer_status_ == kBufferStatusErrorClosed) { return; } status->out_idx_ = 0; status->out_num_ = 1; } else { auto* buffer_mgr = Global<BufferMgr<int64_t>>::Get(); status->buffer_status_ = buffer_mgr->Get(conf.wait_buffer_name())->Receive(&status->in_id_); if (status->buffer_status_ == kBufferStatusErrorClosed) { return; } status->out_idx_ = 0; status->out_num_ = conf.id_list(status->in_id_).value_size(); } } if (CHECK_JUST(*Global<Maybe<bool>, MultiClient>::Get())) { *ctx->BnInOp2Blob("out")->mut_dptr<T>() = 0; } else { *ctx->BnInOp2Blob("out")->mut_dptr<T>() = conf.id_list(status->in_id_).value(status->out_idx_); } ++status->out_idx_; } ADD_CPU_DEFAULT_KERNEL_CREATOR(OperatorConf::kWaitAndSendIdsConf, WaitAndSendIdsKernel, INT_DATA_TYPE_SEQ); } // namespace oneflow
37.945946
99
0.715456
xmyqsh
1d3e96adeca92c0ed35baf7e1012a7cfa898e84c
90,071
cpp
C++
ds/security/services/ca/ocmsetup/csocm.cpp
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
ds/security/services/ca/ocmsetup/csocm.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
ds/security/services/ca/ocmsetup/csocm.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
//+------------------------------------------------------------------------- // // Microsoft Windows // // Copyright (C) Microsoft Corporation, 1997 - 1999 // // File: csocm.cpp // // Contents: OCM component DLL for running the Certificate // Server setup. // // Functions: // // History: 12/13/96 TedM Created Original Version // 04/07/97 JerryK Rewrite for Cert Server // 04/??/97 JerryK Stopped updating these comments since // every other line changes every day. // 08/98 XTan Major structure change // // Notes: // // This sample OCM component DLL can be the component DLL // for multiple components. It assumes that a companion sample INF // is being used as the per-component INF, with private data in the // following form. // // [<pwszComponent>,<pwszSubComponent>] // Bitmap = <bitmapresourcename> // VerifySelect = 0/1 // VerifyDeselect = 0/1 // ; // ; follow this with install stuff such as CopyFiles= sections, etc. // //------------------------------------------------------------------------------ #include "pch.cpp" #pragma hdrstop #include <common.ver> #include "msg.h" #include "certmsg.h" #include "setuput.h" #include "setupids.h" #include "clibres.h" #include "csresstr.h" // defines #define cwcMESSAGETEXT 250 #define cwcINFVALUE 250 #define wszSMALLICON L"_SmallIcon" #define wszUNINSTALL L"_Uninstall" #define wszUPGRADE L"_Upgrade" #define wszINSTALL L"_Install" #define wszVERIFYSELECT L"_VerifySelect" #define wszVERIFYDESELECT L"_VerifyDeselect" #define wszCONFIGTITLE L"Title" #define wszCONFIGCOMMAND L"ConfigCommand" #define wszCONFIGARGS L"ConfigArgs" #define wszCONFIGTITLEVAL L"Certificate Services" #define wszCONFIGCOMMANDVAL L"sysocmgr.exe" #define wszCONFIGARGSVAL L"/i:certmast.inf /x" #define __dwFILE__ __dwFILE_OCMSETUP_CSOCM_CPP__ // globals PER_COMPONENT_DATA g_Comp; // Top Level component HINSTANCE g_hInstance; // get rid of it???? // find out if certsrv post setup is finished by checking // registry entries. ie. finish CYS? HRESULT CheckPostBaseInstallStatus( OUT BOOL *pfFinished) { HRESULT hr; HKEY hKey = NULL; DWORD dwSize = 0; DWORD dwType = REG_NONE; //init *pfFinished = TRUE; if (ERROR_SUCCESS == RegOpenKeyEx( HKEY_LOCAL_MACHINE, wszREGKEYCERTSRVTODOLIST, 0, KEY_READ, &hKey)) { if (ERROR_SUCCESS == RegQueryValueEx( hKey, wszCONFIGCOMMAND, NULL, &dwType, NULL, // only query size &dwSize) && REG_SZ == dwType) { dwType = REG_NONE; if (ERROR_SUCCESS == RegQueryValueEx( hKey, wszCONFIGARGS, NULL, &dwType, NULL, // only query size &dwSize) && REG_SZ == dwType) { dwType = REG_NONE; if (ERROR_SUCCESS == RegQueryValueEx( hKey, wszCONFIGTITLE, NULL, &dwType, NULL, // only query size &dwSize) && REG_SZ == dwType) { //all entries exist *pfFinished = FALSE; } } } } hr = S_OK; //error: if (NULL != hKey) { RegCloseKey(hKey); } return hr; } HRESULT InitComponentAttributes( IN OUT PER_COMPONENT_DATA *pComp, IN HINSTANCE hDllHandle) { HRESULT hr; ZeroMemory(pComp, sizeof(PER_COMPONENT_DATA)); pComp->hInstance = hDllHandle; g_hInstance = hDllHandle; //get rid of it???? pComp->hrContinue = S_OK; pComp->pwszCustomMessage = NULL; pComp->fUnattended = FALSE; pComp->pwszUnattendedFile = NULL; pComp->pwszServerName = NULL; pComp->pwszServerNameOld = NULL; pComp->dwInstallStatus = 0x0; pComp->fPostBase = FALSE; (pComp->CA).pServer = NULL; (pComp->CA).pClient = NULL; pComp->hinfCAPolicy = INVALID_HANDLE_VALUE; hr = S_OK; //error: return hr; } //+------------------------------------------------------------------------ // // Function: DllMain( . . . . ) // // Synopsis: DLL Entry Point. // // Arguments: [DllHandle] DLL module handle. // [Reason] Reasons for entry into DLL. // [Reserved] Reserved. // // Returns: BOOL // // History: 04/07/97 JerryK Created (again) // //------------------------------------------------------------------------- BOOL WINAPI DllMain( IN HMODULE DllHandle, IN DWORD Reason, IN LPVOID Reserved) { BOOL b; UNREFERENCED_PARAMETER(Reserved); b = TRUE; switch(Reason) { case DLL_PROCESS_ATTACH: DBGPRINT((DBG_SS_CERTOCMI, "Process Attach\n")); // component initialization InitComponentAttributes(&g_Comp, DllHandle); // Fall through to process first thread case DLL_THREAD_ATTACH: b = TRUE; break; case DLL_PROCESS_DETACH: DBGPRINT((DBG_SS_CERTOCMI, "Process Detach\n")); if(INVALID_HANDLE_VALUE != g_Comp.hinfCAPolicy) myInfCloseFile(g_Comp.hinfCAPolicy); myInfClearError(); myFreeResourceStrings("certocm.dll"); myFreeColumnDisplayNames(); myRegisterMemDump(); csiLogClose(); break; case DLL_THREAD_DETACH: break; } return b; } extern UNATTENDPARM aUnattendParmClient[]; extern UNATTENDPARM aUnattendParmServer[]; SUBCOMP g_aSubComp[] = { { L"certsrv", // pwszSubComponent cscTopLevel, // cscSubComponent 0, // InstallFlags 0, // UninstallFlags 0, // ChangeFlags 0, // UpgradeFlags 0, // EnabledFlags 0, // SetupStatusFlags FALSE, // fDefaultInstallUnattend FALSE, // fInstallUnattend NULL // aUnattendParm }, { wszSERVERSECTION, // pwszSubComponent cscServer, // cscSubComponent IS_SERVER_INSTALL, // InstallFlags IS_SERVER_REMOVE, // UninstallFlags IS_SERVER_CHANGE, // ChangeFlags IS_SERVER_UPGRADE, // UpgradeFlags IS_SERVER_ENABLED, // EnabledFlags SETUP_SERVER_FLAG, // SetupStatusFlags TRUE, // fDefaultInstallUnattend FALSE, // fInstallUnattend aUnattendParmServer // aUnattendParm }, { wszCLIENTSECTION, // pwszSubComponent cscClient, // cscSubComponent IS_CLIENT_INSTALL, // InstallFlags IS_CLIENT_REMOVE, // UninstallFlags IS_CLIENT_CHANGE, // ChangeFlags IS_CLIENT_UPGRADE, // UpgradeFlags IS_CLIENT_ENABLED, // EnabledFlags SETUP_CLIENT_FLAG, // SetupStatusFlags TRUE, // fDefaultInstallUnattend FALSE, // fInstallUnattend aUnattendParmClient // aUnattendParm }, { NULL, // pwszSubComponent } }; SUBCOMP * TranslateSubComponent( IN WCHAR const *pwszComponent, OPTIONAL IN WCHAR const *pwszSubComponent) { SUBCOMP *psc; if (NULL == pwszSubComponent) { pwszSubComponent = pwszComponent; } for (psc = g_aSubComp; NULL != psc->pwszSubComponent; psc++) { if (0 == mylstrcmpiL(psc->pwszSubComponent, pwszSubComponent)) { break; } } if (NULL == psc->pwszSubComponent) { psc = NULL; } return(psc); } SUBCOMP const * LookupSubComponent( IN CertSubComponent SubComp) { SUBCOMP const *psc; for (psc = g_aSubComp; NULL != psc->pwszSubComponent; psc++) { if (psc->cscSubComponent == SubComp) { break; } } CSASSERT(NULL != psc); return(psc); } BOOL fDebugSupress = TRUE; HRESULT UpdateSubComponentInstallStatus( IN WCHAR const *pwszComponent, IN WCHAR const *pwszSubComponent, IN OUT PER_COMPONENT_DATA *pComp) { HRESULT hr; BOOL fWasEnabled; BOOL fIsEnabled; DWORD InstallFlags; SUBCOMP const *psc; psc = TranslateSubComponent(pwszComponent, pwszSubComponent); if (NULL == psc) { hr = E_INVALIDARG; _JumpError(hr, error, "Internal error: unsupported component"); } fWasEnabled = certocmWasEnabled(pComp, psc->cscSubComponent); fIsEnabled = certocmIsEnabled(pComp, psc->cscSubComponent); CSILOGDWORD(IDS_LOG_WAS_ENABLED, fWasEnabled); CSILOGDWORD(IDS_LOG_IS_ENABLED, fIsEnabled); InstallFlags = psc->InstallFlags | psc->ChangeFlags | psc->EnabledFlags; if (!fWasEnabled) { if (fIsEnabled) { // install case pComp->dwInstallStatus |= InstallFlags; } else // !fIsEnabled { // this is from check then uncheck, should remove the bit // turn off both bits pComp->dwInstallStatus &= ~InstallFlags; } } else // fWasEnabled { if (pComp->fPostBase && (pComp->Flags & SETUPOP_STANDALONE) ) { // was installed, invoke from post setup // this is install case pComp->dwInstallStatus |= InstallFlags; } else if (pComp->Flags & SETUPOP_NTUPGRADE) { // if was installed and now in upgrade mode, upgrade case pComp->dwInstallStatus |= psc->UpgradeFlags | psc->EnabledFlags; } else if (!fIsEnabled) { // uninstall case pComp->dwInstallStatus &= ~psc->EnabledFlags; pComp->dwInstallStatus |= psc->UninstallFlags | psc->ChangeFlags; } else // fIsEnabled { pComp->dwInstallStatus |= psc->EnabledFlags; #if DBG_CERTSRV BOOL fUpgrade = FALSE; hr = myGetCertRegDWValue( NULL, NULL, NULL, L"EnforceUpgrade", (DWORD *) &fUpgrade); if (S_OK == hr && fUpgrade) { pComp->dwInstallStatus |= psc->UpgradeFlags; } #endif //DBG_CERTSRV } // end fIsEnabled else } // end fWasEnabled else // after all of this, change upgrade->uninstall if not supported // detect illegal upgrade if (pComp->dwInstallStatus & IS_SERVER_UPGRADE) { hr = DetermineServerUpgradePath(pComp); _JumpIfError(hr, error, "DetermineServerUpgradePath"); } else if (pComp->dwInstallStatus & IS_CLIENT_UPGRADE) { hr = DetermineClientUpgradePath(pComp); _JumpIfError(hr, error, "LoadAndDetermineClientUpgradeInfo"); } if ((pComp->dwInstallStatus & IS_SERVER_UPGRADE) || (pComp->dwInstallStatus & IS_CLIENT_UPGRADE)) { CSASSERT(pComp->UpgradeFlag != CS_UPGRADE_UNKNOWN); if (CS_UPGRADE_UNSUPPORTED == pComp->UpgradeFlag) { pComp->dwInstallStatus &= ~InstallFlags; pComp->dwInstallStatus |= psc->UninstallFlags | psc->ChangeFlags; } } CSILOG( S_OK, IDS_LOG_INSTALL_STATE, pwszSubComponent, NULL, &pComp->dwInstallStatus); hr = S_OK; error: return hr; } HRESULT certocmOcPreInitialize( IN WCHAR const *DBGPARMREFERENCED(pwszComponent), IN UINT Flags, OUT ULONG_PTR *pulpRet) { HRESULT hr; *pulpRet = 0; DBGPRINT((DBG_SS_CERTOCMI, "OC_PREINITIALIZE(%ws, %x)\n", pwszComponent, Flags)); myVerifyResourceStrings(g_hInstance); // Return value is flag telling OCM which char width we want to run in. #ifdef UNICODE *pulpRet = OCFLAG_UNICODE & Flags; #else *pulpRet = OCFLAG_ANSI & Flags; #endif hr = S_OK; //error: return hr; } // Allocate and initialize a new component. // // Return code is Win32 error indicating outcome. ERROR_CANCELLED tells OCM to // cancel the installation. HRESULT certocmOcInitComponent( IN HWND hwnd, IN WCHAR const *pwszComponent, IN OUT SETUP_INIT_COMPONENT *pInitComponent, IN OUT PER_COMPONENT_DATA *pComp, OUT ULONG_PTR *pulpRet) { HRESULT hr; BOOL fCoInit = FALSE; HKEY hkey = NULL; WCHAR awc[30]; WCHAR *pwc; DBGPRINT(( DBG_SS_CERTOCMI, "OC_INIT_COMPONENT(%ws, %p)\n", pwszComponent, pInitComponent)); hr = CoInitialize(NULL); if (S_OK != hr && S_FALSE != hr) { _JumpError(hr, error, "CoInitialize"); } fCoInit = TRUE; *pulpRet = ERROR_CANCELLED; if (OCMANAGER_VERSION <= pInitComponent->OCManagerVersion) { pInitComponent->OCManagerVersion = OCMANAGER_VERSION; } // Allocate a new component string. pComp->pwszComponent = (WCHAR *) LocalAlloc(LPTR, (wcslen(pwszComponent) + 1) * sizeof(WCHAR)); _JumpIfOutOfMemory(hr, error, pComp->pwszComponent); wcscpy(pComp->pwszComponent, pwszComponent); // OCM passes in some information that we want to save, like the open // handle to our per-component INF. As long as we have a per-component INF, // append-open any layout file that is associated with it, in preparation // for later inf-based file queueing operations. // // We save away certain other stuff that gets passed to us now, since OCM // doesn't guarantee that the SETUP_INIT_COMPONENT will persist beyond the // processing of this one interface routine. if (INVALID_HANDLE_VALUE != pInitComponent->ComponentInfHandle && NULL != pInitComponent->ComponentInfHandle) { pComp->MyInfHandle = pInitComponent->ComponentInfHandle; } else { hr = E_INVALIDARG; _JumpError(hr, error, "invalid inf handle"); } if (NULL != pComp->MyInfHandle) { if (!SetupOpenAppendInfFile(NULL, pComp->MyInfHandle, NULL)) { // SetupOpenAppendInfFile: // If Filename (Param1) is NULL, the INF filename is // retrieved from the LayoutFile value of the Version // section in the existing INF file. // // If FileName was not specified and there was no // LayoutFile value in the Version section of the // existing INF File, GetLastError returns ERROR_INVALID_DATA. hr = myHLastError(); _PrintErrorStr(hr, "SetupOpenAppendInfFile", pwszComponent); } } pComp->HelperRoutines = pInitComponent->HelperRoutines; pComp->Flags = pInitComponent->SetupData.OperationFlags; pwc = awc; pwc += wsprintf(pwc, L"0x"); if (0 != (DWORD) (pComp->Flags >> 32)) { pwc += wsprintf(pwc, L"%x:", (DWORD) (pComp->Flags >> 32)); } wsprintf(pwc, L"%08x", (DWORD) pComp->Flags); CSILOG(S_OK, IDS_LOG_OPERATIONFLAGS, awc, NULL, NULL); CSILOGDWORD(IDS_LOG_POSTBASE, pComp->fPostBase); hr = RegOpenKey(HKEY_LOCAL_MACHINE, wszREGKEYOCMSUBCOMPONENTS, &hkey); if (S_OK == hr) { DWORD dwType; DWORD dwValue; DWORD cb; DWORD const *pdw; cb = sizeof(dwValue); hr = RegQueryValueEx( hkey, wszSERVERSECTION, 0, &dwType, (BYTE *) &dwValue, &cb); pdw = NULL; if (S_OK == hr && REG_DWORD == dwType && sizeof(dwValue) == cb) { pdw = &dwValue; } CSILOG(hr, IDS_LOG_REGSTATE, wszSERVERSECTION, NULL, pdw); cb = sizeof(dwValue); hr = RegQueryValueEx( hkey, wszCLIENTSECTION, 0, &dwType, (BYTE *) &dwValue, &cb); pdw = NULL; if (S_OK == hr && REG_DWORD == dwType && sizeof(dwValue) == cb) { pdw = &dwValue; } CSILOG(hr, IDS_LOG_REGSTATE, wszCLIENTSECTION, NULL, pdw); cb = sizeof(dwValue); hr = RegQueryValueEx( hkey, wszOLDDOCCOMPONENT, 0, &dwType, (BYTE *) &dwValue, &cb); pdw = NULL; if (S_OK == hr && REG_DWORD == dwType && sizeof(dwValue) == cb) { CSILOG(hr, IDS_LOG_REGSTATE, wszOLDDOCCOMPONENT, NULL, &dwValue); } } pComp->fUnattended = (pComp->Flags & SETUPOP_BATCH)? TRUE : FALSE; CSILOG( S_OK, IDS_LOG_UNATTENDED, pComp->fUnattended? pInitComponent->SetupData.UnattendFile : NULL, NULL, (DWORD const *) &pComp->fUnattended); if (pComp->fUnattended) { pComp->pwszUnattendedFile = (WCHAR *) LocalAlloc( LMEM_FIXED, (wcslen(pInitComponent->SetupData.UnattendFile) + 1) * sizeof(WCHAR)); _JumpIfOutOfMemory(hr, error, pComp->pwszUnattendedFile); wcscpy( pComp->pwszUnattendedFile, pInitComponent->SetupData.UnattendFile); } // initialize ca setup data hr = InitCASetup(hwnd, pComp); _JumpIfError(hr, error, "InitCASetup"); hr = S_OK; *pulpRet = NO_ERROR; error: if (NULL != hkey) { RegCloseKey(hkey); } if (fCoInit) { CoUninitialize(); } return(hr); } HRESULT certocmReadInfString( IN HINF hInf, IN WCHAR const *pwszSection, IN WCHAR const *pwszName, IN OUT WCHAR **ppwszValue) { INFCONTEXT InfContext; HRESULT hr; WCHAR wszBuffer[cwcINFVALUE]; WCHAR *pwsz; if (NULL != *ppwszValue) { // free old LocalFree(*ppwszValue); *ppwszValue = NULL; } if (!SetupFindFirstLine(hInf, pwszSection, pwszName, &InfContext)) { hr = myHLastError(); _JumpErrorStr(hr, error, "SetupFindFirstLine", pwszSection); } if (!SetupGetStringField( &InfContext, 1, wszBuffer, sizeof(wszBuffer)/sizeof(wszBuffer[0]), NULL)) { hr = myHLastError(); _JumpErrorStr(hr, error, "SetupGetStringField", pwszName); } pwsz = (WCHAR *) LocalAlloc( LMEM_FIXED, (wcslen(wszBuffer) + 1) * sizeof(WCHAR)); _JumpIfOutOfMemory(hr, error, pwsz); wcscpy(pwsz, wszBuffer); *ppwszValue = pwsz; hr = S_OK; error: return(hr); } HRESULT certocmReadInfInteger( IN HINF hInf, OPTIONAL IN WCHAR const *DBGPARMREFERENCED(pwszFile), IN WCHAR const *pwszSection, IN WCHAR const *pwszName, OUT INT *pValue) { INFCONTEXT InfContext; HRESULT hr = S_OK; *pValue = 0; if (!SetupFindFirstLine(hInf, pwszSection, pwszName, &InfContext)) { hr = myHLastError(); DBGPRINT(( DBG_SS_CERTOCMI, __FILE__ "(%u): %ws%wsSetupFindFirstLine([%ws] %ws) failed! -> %x\n", __LINE__, NULL != pwszFile? pwszFile : L"", NULL != pwszFile? L": " : L"", pwszSection, pwszName, hr)); goto error; } if (!SetupGetIntField(&InfContext, 1, pValue)) { hr = myHLastError(); DBGPRINT(( DBG_SS_CERTOCM, __FILE__ "(%u): %ws%wsSetupGetIntField([%ws] %ws) failed! -> %x\n", __LINE__, NULL != pwszFile? pwszFile : L"", NULL != pwszFile? L": " : L"", pwszSection, pwszName, hr)); goto error; } DBGPRINT(( DBG_SS_CERTOCMI, "%ws%ws[%ws] %ws = %u\n", NULL != pwszFile? pwszFile : L"", NULL != pwszFile? L": " : L"", pwszSection, pwszName, *pValue)); error: return(hr); } // Return the GDI handle of a small bitmap to be used. NULL means an error // occurred -- OCM will use a default bitmap. // // Demonstrates use of private data in a per-component inf. We will look in // our per-component inf to determine the resource name for the bitmap for this // component, and then go fetch it from the resources. // // Other possibilities would be to simply return the same hbitmap for all // cases, or to return NULL, in which case OCM uses a default. Note that we // ignore the requested width and height and our bitmaps are not language // dependent. HRESULT certocmOcQueryImage( IN WCHAR const *DBGPARMREFERENCED(pwszComponent), OPTIONAL IN WCHAR const *DBGPARMREFERENCED(pwszSubComponent), IN SubComponentInfo wSubComp, IN UINT DBGPARMREFERENCED(wWidth), IN UINT DBGPARMREFERENCED(wHeight), IN OUT PER_COMPONENT_DATA *pComp, OUT HBITMAP *pulpRet) { HBITMAP hRet = NULL; HRESULT hr; DBGPRINT(( DBG_SS_CERTOCMI, "OC_QUERY_IMAGE(%ws, %ws, %hx, %x, %x)\n", pwszComponent, pwszSubComponent, wSubComp, wWidth, wHeight)); if (SubCompInfoSmallIcon != wSubComp) { goto done; } hRet = LoadBitmap(pComp->hInstance, MAKEINTRESOURCE(IDB_APP)); if (NULL == hRet) { hr = myHLastError(); _JumpError(hr, error, "LoadBitmap"); } done: hr = S_OK; error: *pulpRet = hRet; return hr; } // Return the number of wizard pages the current component places in the // SETUP_REQUEST_PAGES structure. HRESULT certocmOcRequestPages( IN WCHAR const *DBGPARMREFERENCED(pwszComponent), IN WizardPagesType WizPagesType, IN OUT SETUP_REQUEST_PAGES *pRequestPages, IN PER_COMPONENT_DATA *pComp, OUT ULONG_PTR *pulpRet) { HRESULT hr; *pulpRet = 0; DBGPRINT(( DBG_SS_CERTOCMI, "OC_REQUEST_PAGES(%ws, %x, %p)\n", pwszComponent, WizPagesType, pRequestPages)); // don't invoke wiz apge if unattended // or if running from base setup/upgrade setup if ((!pComp->fUnattended) && (SETUPOP_STANDALONE & pComp->Flags)) { *pulpRet = myDoPageRequest(pComp, WizPagesType, pRequestPages); } else { DBGPRINT(( DBG_SS_CERTOCMI, "Not adding wizard pages, %ws\n", pComp->fUnattended? L"Unattended" : L"GUI Setup")); } hr = S_OK; //error: return hr; } HRESULT IsIA5DnsMachineName() { WCHAR *pwszDnsName = NULL; CRL_DIST_POINTS_INFO CRLDistInfo; CRL_DIST_POINT DistPoint; CERT_ALT_NAME_ENTRY AltNameEntry; BYTE *pbEncoded = NULL; DWORD cbEncoded; static HRESULT s_hr = S_FALSE; if (S_FALSE != s_hr) { goto error; } s_hr = myGetMachineDnsName(&pwszDnsName); _JumpIfError(s_hr, error, "myGetMachineDnsName"); CRLDistInfo.cDistPoint = 1; CRLDistInfo.rgDistPoint = &DistPoint; ZeroMemory(&DistPoint, sizeof(DistPoint)); DistPoint.DistPointName.dwDistPointNameChoice = CRL_DIST_POINT_FULL_NAME; DistPoint.DistPointName.FullName.cAltEntry = 1; DistPoint.DistPointName.FullName.rgAltEntry = &AltNameEntry; ZeroMemory(&AltNameEntry, sizeof(AltNameEntry)); AltNameEntry.dwAltNameChoice = CERT_ALT_NAME_URL; AltNameEntry.pwszURL = pwszDnsName; if (!myEncodeObject( X509_ASN_ENCODING, X509_CRL_DIST_POINTS, &CRLDistInfo, 0, CERTLIB_USE_LOCALALLOC, &pbEncoded, &cbEncoded)) { s_hr = myHLastError(); _JumpIfError(s_hr, error, "myEncodeObject"); } CSASSERT(S_OK == s_hr); error: if (NULL != pwszDnsName) { LocalFree(pwszDnsName); } if (NULL != pbEncoded) { LocalFree(pbEncoded); } return(s_hr); } // Return boolean to indicate whether to allow selection state change. As // demonstrated, again we'll go out to our per-component inf to see whether it // wants us to validate. Note that unattended mode must be respected. HRESULT certocmOcQueryChangeSelState( HWND hwnd, IN WCHAR const *pwszComponent, OPTIONAL IN WCHAR const *pwszSubComponent, IN BOOL fSelectedNew, IN DWORD Flags, IN OUT PER_COMPONENT_DATA *pComp, OUT ULONG_PTR *pulpRet) { INT fVerify; TCHAR wszText[cwcMESSAGETEXT]; const WCHAR* Args[2]; SUBCOMP const *psc; HRESULT hr; WCHAR awc[cwcDWORDSPRINTF]; WCHAR awc2[cwcDWORDSPRINTF]; DWORD fRet; BOOL fServerWasInstalled; BOOL fWebClientWasInstalled; int iMsg = 0; static BOOL s_fWarned = FALSE; *pulpRet = FALSE; DBGPRINT(( DBG_SS_CERTOCMI, "OC_QUERY_CHANGE_SEL_STATE(%ws, %ws, %x, %x)\n", pwszComponent, pwszSubComponent, fSelectedNew, Flags)); // disallow some selection changes fServerWasInstalled = certocmWasEnabled(pComp, cscServer); fWebClientWasInstalled = certocmWasEnabled(pComp, cscClient); if (fWebClientWasInstalled && (OCQ_ACTUAL_SELECTION & Flags)) { if (fSelectedNew) { // check if (!fServerWasInstalled && (0 == LSTRCMPIS(pwszSubComponent, wszSERVERSECTION) || 0 == LSTRCMPIS(pwszSubComponent, wszCERTSRVSECTION)) ) { // case: web client installed and try install server iMsg = IDS_WRN_UNINSTALL_CLIENT; } if (fServerWasInstalled && 0 == LSTRCMPIS(pwszSubComponent, wszCLIENTSECTION)) { // case: uncheck both then check web client iMsg = IDS_WRN_UNINSTALL_BOTH; } } else { // uncheck if (fServerWasInstalled && 0 == LSTRCMPIS(pwszSubComponent, wszSERVERSECTION)) { // case: full certsrv installed and try leave only web client iMsg = IDS_WRN_UNINSTALL_BOTH; } } } // not a server sku if (!FIsServer()) { iMsg = IDS_WRN_SERVER_ONLY; } if (0 != iMsg) { CertWarningMessageBox( pComp->hInstance, pComp->fUnattended, hwnd, iMsg, 0, NULL); goto done; } if (fSelectedNew) { hr = IsIA5DnsMachineName(); if (S_OK != hr) { CertMessageBox( pComp->hInstance, pComp->fUnattended, hwnd, IDS_ERR_NONIA5DNSNAME, hr, MB_OK | MB_ICONERROR, NULL); goto done; } if ((OCQ_ACTUAL_SELECTION & Flags) && 0 != LSTRCMPIS(pwszSubComponent, wszCLIENTSECTION)) { if (!s_fWarned) { DWORD dwSetupStatus; hr = GetSetupStatus(NULL, &dwSetupStatus); if (S_OK == hr) { if ((SETUP_CLIENT_FLAG | SETUP_SERVER_FLAG) & dwSetupStatus) { s_fWarned = TRUE; } CSILOG( hr, IDS_LOG_QUERYCHANGESELSTATE, NULL, NULL, &dwSetupStatus); } } if (!s_fWarned) { if (IDYES != CertMessageBox( pComp->hInstance, pComp->fUnattended, hwnd, IDS_WRN_NONAMECHANGE, S_OK, MB_YESNO | MB_ICONWARNING | CMB_NOERRFROMSYS, NULL)) { goto done; } s_fWarned = TRUE; } } } *pulpRet = TRUE; if (pComp->fUnattended) { goto done; } psc = TranslateSubComponent(pwszComponent, pwszSubComponent); if (NULL == psc) { hr = E_INVALIDARG; _JumpError(hr, error, "Internal error: unsupported component"); } hr = certocmReadInfInteger( pComp->MyInfHandle, NULL, psc->pwszSubComponent, fSelectedNew? wszVERIFYSELECT : wszVERIFYDESELECT, &fVerify); if (S_OK != hr || !fVerify) { goto done; } // Don't pass specific lang id to FormatMessage, as it fails if there's no // msg in that language. Instead, set the thread locale, which will get // FormatMessage to use a search algorithm to find a message of the // appropriate language, or use a reasonable fallback msg if there's none. Args[0] = pwszComponent; Args[1] = pwszSubComponent; FormatMessage( FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_ARGUMENT_ARRAY, pComp->hInstance, fSelectedNew? MSG_SURE_SELECT : MSG_SURE_DESELECT, 0, wszText, sizeof(wszText)/sizeof(wszText[0]), (va_list *) Args); *pulpRet = (IDYES == CertMessageBox( pComp->hInstance, pComp->fUnattended, hwnd, 0, S_OK, MB_YESNO | MB_ICONWARNING | MB_TASKMODAL | CMB_NOERRFROMSYS, wszText)); done: hr = S_OK; error: wsprintf(awc, L"%u", fSelectedNew); wsprintf(awc2, L"0x%08x", Flags); fRet = (DWORD) *pulpRet; CSILOG(hr, IDS_LOG_QUERYCHANGESELSTATE, awc, awc2, &fRet); return hr; } // Calculate disk space for the component being added or removed. Return a // Win32 error code indicating outcome. In our case the private section for // this component/subcomponent pair is a simple standard inf install section, // so we can use high-level disk space list API to do what we want. HRESULT certocmOcCalcDiskSpace( IN WCHAR const *pwszComponent, OPTIONAL IN WCHAR const *pwszSubComponent, IN BOOL fAddComponent, IN HDSKSPC hDiskSpace, IN OUT PER_COMPONENT_DATA *pComp, OUT ULONG_PTR *pulpRet) { HRESULT hr; WCHAR *pwsz = NULL; SUBCOMP const *psc; static fServerFirstCall = TRUE; static fClientFirstCall = TRUE; DBGPRINT(( DBG_SS_CERTOCMI, "OC_CALC_DISK_SPACE(%ws, %ws, %x, %p)\n", pwszComponent, pwszSubComponent, fAddComponent, hDiskSpace)); psc = TranslateSubComponent(pwszComponent, pwszSubComponent); if (NULL == psc) { hr = E_INVALIDARG; _JumpError(hr, error, "Internal error: unsupported component"); } // Being installed or uninstalled. Fetch INSTALL section name, // so we can add or remove the files being INSTALLed from the disk // space list. hr = certocmReadInfString( pComp->MyInfHandle, psc->pwszSubComponent, wszINSTALL, &pwsz); _JumpIfError(hr, error, "certocmReadInfString"); if (fAddComponent) // Adding { if (!SetupAddInstallSectionToDiskSpaceList( hDiskSpace, pComp->MyInfHandle, NULL, pwsz, 0, 0)) { hr = myHLastError(); _JumpErrorStr(hr, error, "SetupAddInstallSectionToDiskSpaceList", pwsz); } } else // Removing { if (!SetupRemoveInstallSectionFromDiskSpaceList( hDiskSpace, pComp->MyInfHandle, NULL, pwsz, 0, 0)) { hr = myHLastError(); _JumpErrorStr(hr, error, "SetupRemoveInstallSectionFromDiskSpaceList", pwsz); } } hr = S_OK; error: if (NULL != pwsz) { LocalFree(pwsz); } *pulpRet = hr; return(hr); } // OCM calls this routine when ready for files to be copied to effect the // changes the user requested. The component DLL must figure out whether it is // being installed or uninstalled and take appropriate action. For this // sample, we look in the private data section for this component/subcomponent // pair, and get the name of an uninstall section for the uninstall case. // // Note that OCM calls us once for the *entire* component and then once per // subcomponent. We ignore the first call. // // Return value is Win32 error code indicating outcome. HRESULT certocmOcQueueFileOps( IN HWND hwnd, IN WCHAR const *pwszComponent, OPTIONAL IN WCHAR const *pwszSubComponent, IN HSPFILEQ hFileQueue, IN OUT PER_COMPONENT_DATA *pComp, OUT ULONG_PTR *pulpRet) { HRESULT hr; SUBCOMP const *psc; BOOL fRemoveFile = FALSE; // TRUE for uninstall; FALSE for install/upgrade WCHAR *pwszAction; WCHAR *pwsz = NULL; static BOOL s_fPreUninstall = FALSE; // preuninstall once DBGPRINT(( DBG_SS_CERTOCMI, "OC_QUEUE_FILE_OPS(%ws, %ws, %p)\n", pwszComponent, pwszSubComponent, hFileQueue)); if (NULL == pwszSubComponent) { // Do no work for top level component goto done; } psc = TranslateSubComponent(pwszComponent, pwszSubComponent); if (NULL == psc) { hr = E_INVALIDARG; _JumpError(hr, error, "Internal error: unsupported component"); } // if unattended, not upgrade, & not uninstall, load if (pComp->fUnattended && !(pComp->Flags & SETUPOP_NTUPGRADE) ) { // retrieve unattended attributes hr = certocmRetrieveUnattendedText( pwszComponent, pwszSubComponent, pComp); if (S_OK != hr && 0x0 != (pComp->Flags & SETUPOP_STANDALONE)) { // only error out if it is from add/remove or post because // it could fail regular ntbase in unattended mode without certsrv _JumpError(hr, error, "certocmRetrieveUnattendedText"); } // Init install status (must be done after retrieving unattended text) hr = UpdateSubComponentInstallStatus(pwszComponent, pwszSubComponent, pComp); _JumpIfError(hr, error, "UpdateSubComponentInstallStatus"); if (psc->fInstallUnattend) // make sure ON { if (certocmWasEnabled(pComp, psc->cscSubComponent) && !pComp->fPostBase) { // the case to run install with component ON twice or more hr = HRESULT_FROM_WIN32(ERROR_INVALID_STATE); _JumpError(hr, error, "You must uninstall before install"); } if (SETUPOP_STANDALONE & pComp->Flags) { // only prepare and validate unattende attr in standalone mode // in other word, don't call following if NT base hr = PrepareUnattendedAttributes( hwnd, pwszComponent, pwszSubComponent, pComp); _JumpIfError(hr, error, "PrepareUnattendedAttributes"); } } } else { // Initialize the install status hr = UpdateSubComponentInstallStatus(pwszComponent, pwszSubComponent, pComp); _JumpIfError(hr, error, "UpdateSubComponentInstallStatus"); } // If we're not doing base setup or an upgrade, check to see if we already // copied files during base setup, by checking to see if base setup // left an entry in the ToDo List. if(pComp->fPostBase) { DBGPRINT(( DBG_SS_CERTOCMI, "File Queueing Skipped, files already installed by GUI setup")); goto done; } /* //--- Talk with OCM guys and put this functionality into a notification routine //--- This will allow us to pop compatibility error to user before unattended upgrade begins // detect illegal upgrade if (pComp->dwInstallStatus & IS_SERVER_UPGRADE) { hr = DetermineServerUpgradePath(pComp); _JumpIfError(hr, error, "DetermineServerUpgradePath"); } else if (pComp->dwInstallStatus & IS_CLIENT_UPGRADE) { hr = DetermineClientUpgradePath(pComp); _JumpIfError(hr, error, "LoadAndDetermineClientUpgradeInfo"); } if ((pComp->dwInstallStatus & IS_SERVER_UPGRADE) || (pComp->dwInstallStatus & IS_CLIENT_UPGRADE)) { // block if attempting upgrade that is not Win2K or Whistler // lodge a complaint in the log; upgrade all bits and if ((CS_UPGRADE_NO != pComp->UpgradeFlag) && (CS_UPGRADE_WHISTLER != pComp->UpgradeFlag) && (CS_UPGRADE_WIN2000 != pComp->UpgradeFlag)) { hr = HRESULT_FROM_WIN32(ERROR_OLD_WIN_VERSION); CertErrorMessageBox( pComp->hInstance, pComp->fUnattended, hwnd, IDS_ERR_UPGRADE_NOT_SUPPORTED, hr, NULL); // _JumpError(hr, error, "Unsupported upgrade"); // continue uninstall/reinstall } } */ if ((pComp->dwInstallStatus & psc->ChangeFlags) || (pComp->dwInstallStatus & psc->UpgradeFlags) ) { // for ChangeFlags, either install or uninstall // all cases, copy file or remove file if (pComp->dwInstallStatus & psc->UninstallFlags) { fRemoveFile = TRUE; } // Uninstall the core if: // this subcomponent is being uninstalled, and // this is a core subcomponent (client or server), and // this is the server subcomponent, or the server isn't being removed or // upgrade if (((pComp->dwInstallStatus & psc->UninstallFlags) || (pComp->dwInstallStatus & psc->UpgradeFlags) ) && (cscServer == psc->cscSubComponent || !(IS_SERVER_REMOVE & pComp->dwInstallStatus) ) ) { // if fall into here, either need to overwrite or // delete certsrv files so unreg all related dlls if (cscServer == psc->cscSubComponent && (pComp->dwInstallStatus & psc->UpgradeFlags) ) { // if this is server upgrade, determine upgrade path hr = DetermineServerUpgradePath(pComp); _JumpIfError(hr, error, "DetermineServerUpgradePath"); // determine custom policy module hr = DetermineServerCustomModule( pComp, TRUE); // policy _JumpIfError(hr, error, "DetermineServerCustomModule"); // determine custom exit module hr = DetermineServerCustomModule( pComp, FALSE); // exit _JumpIfError(hr, error, "DetermineServerCustomModule"); } if (!s_fPreUninstall) { hr = PreUninstallCore(hwnd, pComp); _JumpIfError(hr, error, "PreUninstallCore"); s_fPreUninstall = TRUE; } } if ((pComp->dwInstallStatus & psc->ChangeFlags) || (pComp->dwInstallStatus & psc->UpgradeFlags) ) { // Being installed or uninstalled. // Fetch [un]install/upgrade section name. if (pComp->dwInstallStatus & psc->InstallFlags) { pwszAction = wszINSTALL; } else if (pComp->dwInstallStatus & psc->UninstallFlags) { pwszAction = wszUNINSTALL; } else if (pComp->dwInstallStatus & psc->UpgradeFlags) { pwszAction = wszUPGRADE; } else { hr = E_INVALIDARG; _JumpError(hr, error, "Internal error"); } hr = certocmReadInfString( pComp->MyInfHandle, psc->pwszSubComponent, pwszAction, &pwsz); _JumpIfError(hr, error, "certocmReadInfString"); // If uninstalling, copy files without version checks. if (!SetupInstallFilesFromInfSection( pComp->MyInfHandle, NULL, hFileQueue, pwsz, NULL, fRemoveFile? 0 : SP_COPY_NEWER)) { hr = myHLastError(); _JumpIfError(hr, error, "SetupInstallFilesFromInfSection"); } } } done: hr = S_OK; error: if (NULL != pwsz) { LocalFree(pwsz); } if (S_OK != hr) { SetLastError(hr); } *pulpRet = hr; return(hr); } // OCM calls this routine when it wants to find out how much work the component // wants to perform for nonfile operations to install/uninstall a component or // subcomponent. It is called once for the *entire* component and then once // for each subcomponent in the component. One could get arbitrarily fancy // here but we simply return 1 step per subcomponent. We ignore the "entire // component" case. // // Return value is an arbitrary 'step' count or -1 if error. HRESULT certocmOcQueryStepCount( IN WCHAR const *DBGPARMREFERENCED(pwszComponent), OPTIONAL IN WCHAR const *pwszSubComponent, OUT ULONG_PTR *pulpRet) { HRESULT hr; *pulpRet = 0; DBGPRINT(( DBG_SS_CERTOCMI, "OC_QUERY_STEP_COUNT(%ws, %ws)\n", pwszComponent, pwszSubComponent)); // Ignore all but "entire component" case. if (NULL != pwszSubComponent) { goto done; } *pulpRet = SERVERINSTALLTICKS; done: hr = S_OK; //error: return hr; } // OCM calls this routine when it wants the component dll to perform nonfile // ops to install/uninstall a component/subcomponent. It is called once for // the *entire* component and then once for each subcomponent in the component. // Our install and uninstall actions are based on simple standard inf install // sections. We ignore the "entire component" case. Note how similar this // code is to the OC_QUEUE_FILE_OPS case. HRESULT certocmOcCompleteInstallation( IN HWND hwnd, IN WCHAR const *pwszComponent, OPTIONAL IN WCHAR const *pwszSubComponent, IN OUT PER_COMPONENT_DATA *pComp, OUT ULONG_PTR *pulpRet) { HRESULT hr; TCHAR wszBuffer[cwcINFVALUE]; SUBCOMP const *psc; DWORD dwSetupStatusFlags; CASERVERSETUPINFO *pServer = pComp->CA.pServer; WCHAR *pwszActiveCA = NULL; static BOOL fStoppedW3SVC = FALSE; *pulpRet = 0; DBGPRINT(( DBG_SS_CERTOCMI, "OC_COMPLETE_INSTALLATION(%ws, %ws)\n", pwszComponent, pwszSubComponent)); // Do no work for top level component if (NULL == pwszSubComponent) { goto done; } psc = TranslateSubComponent(pwszComponent, pwszSubComponent); if (NULL == psc) { hr = E_INVALIDARG; _JumpError(hr, error, "Internal error: unsupported component"); } if (pComp->dwInstallStatus & IS_SERVER_REMOVE) { // for uninstall, check if active ca use DS hr = myGetCertRegStrValue(NULL, NULL, NULL, wszREGACTIVE, &pwszActiveCA); if (S_OK == hr && NULL != pwszActiveCA) { hr = myGetCertRegDWValue(pwszActiveCA, NULL, NULL, wszREGCAUSEDS, (DWORD*)&pServer->fUseDS); _PrintIfError(hr, "myGetCertRegDWValue"); } } DBGPRINT(( DBG_SS_CERTOCMI, "certocmOcCompleteInstallation: pComp->dwInstallStatus: %lx, pComp->Flags: %lx\n", pComp->dwInstallStatus, pComp->Flags)); if ((pComp->dwInstallStatus & psc->ChangeFlags) || (pComp->dwInstallStatus & psc->UpgradeFlags) ) { // for unattended, make sure w3svc is stopped before file copy if (!fStoppedW3SVC && pComp->fUnattended && !(pComp->Flags & SETUPOP_NTUPGRADE) && !(pComp->dwInstallStatus & psc->UninstallFlags) ) { //fStoppedW3SVC makes stop only once //don't do this in upgrade // this happens for unattended // also not during uninstall hr = StartAndStopService(pComp->hInstance, pComp->fUnattended, hwnd, wszW3SVCNAME, TRUE, FALSE, 0, // doesn't matter since no confirmation &g_fW3SvcRunning); _PrintIfError(hr, "StartAndStopService"); fStoppedW3SVC = TRUE; } // certsrv file copy if (!SetupInstallFromInfSection( NULL, pComp->MyInfHandle, wszBuffer, SPINST_INIFILES | SPINST_REGISTRY, NULL, NULL, 0, NULL, NULL, NULL, NULL)) { hr = myHLastError(); _JumpError(hr, error, "SetupInstallFromInfSection"); } // Finish uninstalling the core if: // this subcomponent is being uninstalled, and // this is a core subcomponent (client or server), and // this is the server subcomponent, or the server isn't being removed. if ( (pComp->dwInstallStatus & psc->UninstallFlags) && (cscServer == psc->cscSubComponent || !(IS_SERVER_REMOVE & pComp->dwInstallStatus) ) ) { // Do uninstall work hr = UninstallCore( hwnd, pComp, 0, 100, certocmPreserving(pComp, cscClient), TRUE, FALSE); _JumpIfError(hr, error, "UninstallCore"); if (certocmPreserving(pComp, cscClient)) { hr = SetSetupStatus(NULL, SETUP_CLIENT_FLAG, TRUE); _JumpIfError(hr, error, "SetSetupStatus"); } else { // unmark all hr = SetSetupStatus(NULL, 0xFFFFFFFF, FALSE); _JumpIfError(hr, error, "SetSetupStatus"); } } // Finish installing the core if: // this subcomponent is being installed, and // this is a core subcomponent (client or server), and // this is the server subcomponent, or the server isn't being installed. // and this is not base setup (we'll do it later if it is) else if ((pComp->dwInstallStatus & psc->InstallFlags) && (cscServer == psc->cscSubComponent || !(IS_SERVER_INSTALL & pComp->dwInstallStatus)) && (0 != (pComp->Flags & SETUPOP_STANDALONE))) { DBGPRINT(( DBG_SS_CERTOCMI, "Performing standalone server installation\n")); hr = InstallCore(hwnd, pComp, cscServer == psc->cscSubComponent); _JumpIfError(hr, error, "InstallCore"); // last enough to mark complete if (pComp->dwInstallStatus & IS_SERVER_INSTALL) { // machine hr = SetSetupStatus(NULL, SETUP_SERVER_FLAG, TRUE); _JumpIfError(hr, error, "SetSetupStatus"); // ca hr = SetSetupStatus( pServer->pwszSanitizedName, SETUP_SERVER_FLAG, TRUE); _JumpIfError(hr, error, "SetSetupStatus"); if(IsEnterpriseCA(pServer->CAType)) { hr = SetSetupStatus( pServer->pwszSanitizedName, SETUP_UPDATE_CAOBJECT_SVRTYPE, TRUE); _JumpIfError(hr, error, "SetSetupStatus SETUP_UPDATE_CAOBJECT_SVRTYPE"); } hr = GetSetupStatus(pServer->pwszSanitizedName, &dwSetupStatusFlags); _JumpIfError(hr, error, "SetSetupStatus"); // Only start the server if: // 1: we're not waiting for the CA cert to be issued, and // 2: this is not base setup -- SETUP_STANDALONE means we're // running from the Control Panel or were manually invoked. // The server will not start during base setup due to an // access denied error from JetInit during base setup. if (0 == (SETUP_SUSPEND_FLAG & dwSetupStatusFlags) && (0 != (SETUPOP_STANDALONE & pComp->Flags))) { hr = StartCertsrvService(FALSE); _PrintIfError(hr, "failed in starting cert server service"); } // during base setup: f=0 sus=8 DBGPRINT(( DBG_SS_CERTOCMI, "InstallCore: f=%x sus=%x\n", pComp->Flags, dwSetupStatusFlags)); hr = EnableVRootsAndShares(FALSE, FALSE, TRUE, pComp, hwnd); if(REGDB_E_CLASSNOTREG == hr || HRESULT_FROM_WIN32(ERROR_SERVICE_DOES_NOT_EXIST) == hr || HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) == hr) { CertWarningMessageBox( pComp->hInstance, pComp->fUnattended, hwnd, IDS_WRN_IIS_NOT_INSTALLED, 0, NULL); hr = S_OK; } _JumpIfError(hr, error, "failed creating VRoots/shares"); } if (pComp->dwInstallStatus & IS_CLIENT_INSTALL) { hr = SetSetupStatus(NULL, SETUP_CLIENT_FLAG, TRUE); _JumpIfError(hr, error, "SetSetupStatus"); } if ((pComp->dwInstallStatus & IS_SERVER_INSTALL) && (pComp->dwInstallStatus & IS_CLIENT_INSTALL)) { hr = SetSetupStatus( pServer->pwszSanitizedName, SETUP_CLIENT_FLAG, TRUE); _JumpIfError(hr, error, "SetSetupStatus"); } // in case we're doing a post-base setup, // we always clear the post-base to-do list RegDeleteKey(HKEY_LOCAL_MACHINE, wszREGKEYCERTSRVTODOLIST); } else if ((pComp->dwInstallStatus & psc->InstallFlags) && (cscServer == psc->cscSubComponent || !(IS_SERVER_INSTALL & pComp->dwInstallStatus)) && (0 == (pComp->Flags & (SETUPOP_STANDALONE | SETUPOP_WIN31UPGRADE | SETUPOP_WIN95UPGRADE | SETUPOP_NTUPGRADE) ))) { HKEY hkToDoList = NULL; WCHAR *pwszConfigTitleVal = NULL; WCHAR *pwszArgsValTemp = NULL; WCHAR *pwszArgsVal = wszCONFIGARGSVAL; BOOL fFreeTitle = FALSE; DWORD disp; DWORD err; DBGPRINT(( DBG_SS_CERTOCMI, "Adding Certificate Services to ToDoList\n")); // We're installing base, so create // the ToDoList entry stating that we copied files. err = ::RegCreateKeyEx(HKEY_LOCAL_MACHINE, wszREGKEYCERTSRVTODOLIST, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkToDoList, &disp); hr = HRESULT_FROM_WIN32(err); _JumpIfError(hr, error, "RegCreateKeyEx"); hr = myLoadRCString( g_hInstance, IDS_TODO_TITLE, &pwszConfigTitleVal); if (S_OK == hr) { fFreeTitle = TRUE; } else { // If there was no resource, get something... pwszConfigTitleVal = wszCONFIGTITLEVAL; } // config title err = RegSetValueEx(hkToDoList, wszCONFIGTITLE, 0, REG_SZ, (PBYTE)pwszConfigTitleVal, sizeof(WCHAR)*(wcslen(pwszConfigTitleVal)+1)); hr = HRESULT_FROM_WIN32(err); _PrintIfErrorStr(hr, "RegSetValueEx", wszCONFIGTITLE); CSILOG(hr, IDS_LOG_TODOLIST, wszCONFIGTITLE, pwszConfigTitleVal, NULL); // config command err = RegSetValueEx(hkToDoList, wszCONFIGCOMMAND, 0, REG_SZ, (PBYTE)wszCONFIGCOMMANDVAL, sizeof(WCHAR)*(wcslen(wszCONFIGCOMMANDVAL)+1)); hr = HRESULT_FROM_WIN32(err); _PrintIfErrorStr(hr, "RegSetValueEx", wszCONFIGCOMMAND); CSILOG(hr, IDS_LOG_TODOLIST, wszCONFIGCOMMAND, wszCONFIGCOMMANDVAL, NULL); // config args if (pComp->fUnattended && NULL != pComp->pwszUnattendedFile) { // if nt base is in unattended mode, expand args with // unattended answer file name pwszArgsValTemp = (WCHAR*)LocalAlloc(LMEM_FIXED, (wcslen(pwszArgsVal) + wcslen(pComp->pwszUnattendedFile) + 5) * sizeof(WCHAR)); _JumpIfOutOfMemory(hr, error, pwszArgsValTemp); wcscpy(pwszArgsValTemp, pwszArgsVal); wcscat(pwszArgsValTemp, L" /u:"); wcscat(pwszArgsValTemp, pComp->pwszUnattendedFile); pwszArgsVal = pwszArgsValTemp; } err = RegSetValueEx(hkToDoList, wszCONFIGARGS, 0, REG_SZ, (PBYTE)pwszArgsVal, sizeof(WCHAR)*(wcslen(pwszArgsVal)+1)); hr = HRESULT_FROM_WIN32(err); _PrintIfErrorStr(hr, "RegSetValueEx", wszCONFIGARGS); CSILOG(hr, IDS_LOG_TODOLIST, wszCONFIGARGS, pwszArgsVal, NULL); // free stuff if (NULL != pwszConfigTitleVal && fFreeTitle) { LocalFree(pwszConfigTitleVal); } if (NULL != pwszArgsValTemp) { LocalFree(pwszArgsValTemp); } if (NULL != hkToDoList) { RegCloseKey(hkToDoList); } } else if (pComp->dwInstallStatus & psc->UpgradeFlags) { BOOL fFinishCYS; hr = CheckPostBaseInstallStatus(&fFinishCYS); _JumpIfError(hr, error, "CheckPostBaseInstallStatus"); // if post mode is true, don't execute setup upgrade path if (fFinishCYS) { BOOL fServer = FALSE; // upgrade if (cscServer == psc->cscSubComponent) { hr = UpgradeServer(hwnd, pComp); _JumpIfError(hr, error, "UpgradeServer"); fServer = TRUE; } else if (cscClient == psc->cscSubComponent) { hr = UpgradeClient(hwnd, pComp); _JumpIfError(hr, error, "UpgradeClient"); } // mark setup status hr = SetSetupStatus(NULL, psc->SetupStatusFlags, TRUE); _PrintIfError(hr, "SetSetupStatus"); if (fServer) { // ca level hr = SetSetupStatus( pServer->pwszSanitizedName, psc->SetupStatusFlags, TRUE); _PrintIfError(hr, "SetSetupStatus"); if(IsEnterpriseCA(pServer->CAType)) { hr = SetSetupStatus( pServer->pwszSanitizedName, SETUP_UPDATE_CAOBJECT_SVRTYPE, TRUE); _JumpIfError(hr, error, "SetSetupStatus SETUP_UPDATE_CAOBJECT_SVRTYPE"); } } if (fServer && pServer->fCertSrvWasRunning) { hr = StartCertsrvService(TRUE); _PrintIfError(hr, "failed in starting cert server service"); } } } } done: hr = S_OK; error: if (NULL != pwszActiveCA) { LocalFree(pwszActiveCA); } *pulpRet = hr; return(hr); } HRESULT certocmOcCommitQueue( IN HWND hwnd, IN WCHAR const *pwszComponent, IN WCHAR const *pwszSubComponent, IN PER_COMPONENT_DATA *pComp) { HRESULT hr; SUBCOMP *pSub; CASERVERSETUPINFO *pServer = pComp->CA.pServer; DBGPRINT(( DBG_SS_CERTOCMI, "OC_ABOUT_TO_COMMIT_QUEUE(%ws, %ws)\n", pwszComponent, pwszSubComponent)); pSub = TranslateSubComponent(pwszComponent, pwszSubComponent); if (NULL == pSub) { goto done; } // setup will satrt soon, mark it incomplete if ((pSub->InstallFlags & pComp->dwInstallStatus) && cscServer == pSub->cscSubComponent) { hr = SetSetupStatus(NULL, pSub->SetupStatusFlags, FALSE); _PrintIfError(hr, "SetSetupStatus"); hr = SetSetupStatus( pServer->pwszSanitizedName, pSub->SetupStatusFlags, FALSE); _PrintIfError(hr, "SetSetupStatus"); } if ((cscServer == pSub->cscSubComponent) && (pSub->UpgradeFlags & pComp->dwInstallStatus) ) { // upgrade case, no UI, stop existing certsrv hr = StartAndStopService(pComp->hInstance, pComp->fUnattended, hwnd, wszSERVICE_NAME, TRUE, // stop the service FALSE, // no confirm 0, //doesn't matter since no confirm &pServer->fCertSrvWasRunning); _PrintIfError(hr, "ServiceExists"); } done: hr = S_OK; //error: return hr; } // Component dll is being unloaded. VOID certocmOcCleanup( IN WCHAR const *pwszComponent, IN PER_COMPONENT_DATA *pComp) { DBGPRINT((DBG_SS_CERTOCMI, "OC_CLEANUP(%ws)\n", pwszComponent)); if (NULL != pComp->pwszComponent) { if (0 == mylstrcmpiL(pComp->pwszComponent, pwszComponent)) { FreeCAComponentInfo(pComp); } } // also free some globals FreeCAGlobals(); } ///////////////////////////////////////////////////////////////////////////// //++ // // certocmOcQueryState // // Routine Description: // This funcion sets the original, current, and final selection states of the // CertSrv service optional component. // // Return Value: // SubcompOn - indicates that the checkbox should be set // SubcompOff - indicates that the checkbox should be clear // SubcompUseOCManagerDefault - OC Manager should set the state of the checkbox // according to state information that is maintained // internally by OC Manager itself. // // Note: // By the time this function gets called OnOcInitComponent has already determined // that Terminal Services is not installed. It is only necessary to determine // whether Terminal Services is selected for installation. //-- ///////////////////////////////////////////////////////////////////////////// HRESULT certocmOcQueryState( IN WCHAR const *pwszComponent, OPTIONAL IN WCHAR const *pwszSubComponent, IN DWORD SelectionState, IN PER_COMPONENT_DATA *pComp, OUT ULONG_PTR *pulpRet) { HRESULT hr; SubComponentState stateRet = SubcompUseOcManagerDefault; DWORD status; WCHAR awc[cwcDWORDSPRINTF]; BOOL fFinished; DBGPRINT(( DBG_SS_CERTOCMI, "OC_QUERY_STATE(%ws, %ws, %x)\n", pwszComponent, pwszSubComponent, SelectionState)); if (NULL == pwszSubComponent) { goto done; } switch(SelectionState) { case OCSELSTATETYPE_ORIGINAL: { // check to see if the post link exist hr = CheckPostBaseInstallStatus(&fFinished); _JumpIfError(hr, error, "CheckPostBaseInstallStatus"); if (!pComp->fPostBase && (SETUPOP_STANDALONE & pComp->Flags) ) { // install through Components button if (!fFinished) { // don't honor local reg SetupStatus break; } } // Return the initial installation state of the subcomponent if (!pComp->fPostBase && ((SETUPOP_STANDALONE & pComp->Flags) || (SETUPOP_NTUPGRADE & pComp->Flags)) ) { //there is chance for user installed certsrv during base setup //and then upgrade without finishing CYS if (fFinished) { // If this is an upgrade or a standalone, query the registry to // get the current installation status // XTAN, 7/99 // currently certsrv_server has Needs relationship with // certsrv_client. OCM gathers success for certsrv_client before // certsrv_server is complete so we don't trust OCM state info // about certsrv_client and we check our reg SetupStatus here. // our certsrv_server Needs define is incorrect. If we take it // out, we probably don't need to reg SetupStatus at // Configuration level at all and we can trust OCM state info hr = GetSetupStatus(NULL, &status); if (S_OK == hr) { if ( (0 == LSTRCMPIS(pwszSubComponent, wszSERVERSECTION) && !(SETUP_SERVER_FLAG & status)) || (0 == LSTRCMPIS(pwszSubComponent, wszCLIENTSECTION) && !(SETUP_CLIENT_FLAG & status)) ) { // overwrite OCM default stateRet = SubcompOff; } } } } break; } case OCSELSTATETYPE_CURRENT: { break; } case OCSELSTATETYPE_FINAL: { SUBCOMP const *psc; BOOL fWasEnabled; if (S_OK != pComp->hrContinue && !pComp->fUnattended) { stateRet = SubcompOff; } //get component install info psc = TranslateSubComponent(pwszComponent, pwszSubComponent); if (NULL == psc) { hr = E_INVALIDARG; _JumpError(hr, error, "Internal error: unsupported component"); } fWasEnabled = certocmWasEnabled(pComp, psc->cscSubComponent); // after all of this, change upgrade->uninstall if not supported if ((SETUPOP_NTUPGRADE & pComp->Flags) && fWasEnabled) { CSASSERT(pComp->UpgradeFlag != CS_UPGRADE_UNKNOWN); if (CS_UPGRADE_UNSUPPORTED == pComp->UpgradeFlag) stateRet = SubcompOff; } break; } } done: hr = S_OK; error: wsprintf(awc, L"%u", SelectionState); CSILOG(S_OK, IDS_LOG_SELECTIONSTATE, awc, NULL, (DWORD const *) &stateRet); *pulpRet = stateRet; return(hr); } //+------------------------------------------------------------------------ // // Function: CertSrvOCProc( . . . . ) // // Synopsis: Service procedure for Cert Server OCM Setup. // // Arguments: [pwszComponent] // [pwszSubComponent] // [Function] // [Param1] // [Param2] // // Returns: DWORD // // History: 04/07/97 JerryK Created // //------------------------------------------------------------------------- ULONG_PTR CertSrvOCProc( IN WCHAR const *pwszComponent, IN WCHAR const *pwszSubComponent, IN UINT Function, IN UINT_PTR Param1, IN OUT VOID *Param2) { ULONG_PTR ulpRet = 0; WCHAR const *pwszFunction = NULL; BOOL fReturnErrCode = TRUE; DWORD ErrorLine; __try { switch (Function) { // OC_PREINITIALIZE: // pwszComponent = WCHAR top level component string // pwszSubComponent = CHAR top level component string // Param1 = char width flags // Param2 = unused // // Return code is char width allowed flags case OC_PREINITIALIZE: csiLogOpen("+certocm.log"); CSILOGFILEVERSION(0, L"certocm.dll", szCSVER_STR); pwszFunction = L"OC_PREINITIALIZE"; fReturnErrCode = FALSE; // Make sure IDS_LOG_BEGIN & IDS_LOG_END see a Unicode string: pwszSubComponent = pwszComponent; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); _LeaveIfError(g_Comp.hrContinue, "OC_PREINITIALIZE"); g_Comp.hrContinue = myInfOpenFile(NULL, &g_Comp.hinfCAPolicy, &ErrorLine); if(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) == g_Comp.hrContinue) { g_Comp.hrContinue = S_OK; } _LeaveIfError(g_Comp.hrContinue, "myInfOpenFile"); g_Comp.hrContinue = certocmOcPreInitialize( pwszComponent, (UINT)Param1, //cast to UINT, use as flags &ulpRet); _PrintIfError(g_Comp.hrContinue, "certocmOcPreInitialize"); break; // OC_INIT_COMPONENT: // pwszComponent = WCHAR top level component string // pwszSubComponent = unused // Param1 = unused // Param2 = points to IN OUT SETUP_INIT_COMPONENT structure // // Return code is Win32 error indicating outcome. case OC_INIT_COMPONENT: pwszFunction = L"OC_INIT_COMPONENT"; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); _LeaveIfError(g_Comp.hrContinue, "OC_INIT_COMPONENT"); g_Comp.hrContinue = certocmOcInitComponent( NULL, // probably have to pass null hwnd pwszComponent, (SETUP_INIT_COMPONENT *) Param2, &g_Comp, &ulpRet); _PrintIfError(g_Comp.hrContinue, "certocmOcInitComponent"); break; case OC_SET_LANGUAGE: pwszFunction = L"OC_SET_LANGUAGE"; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); _LeaveIfError(g_Comp.hrContinue, "OC_SET_LANGUAGE"); DBGPRINT(( DBG_SS_CERTOCMI, "OC_SET_LANGUAGE(%ws, %ws, %x, %x)\n", pwszComponent, pwszSubComponent, Param1, Param2)); break; // OC_QUERY_IMAGE: // // obsolete (only called on x86 if IMAGE_EX fails) // use OC_QUERY_IMAGE_EX instead // // pwszComponent = WCHAR top level component string // pwszSubComponent = WCHAR sub-component string // Param1 = low 16 bits specify image; only small icon supported // Param2 = low 16 bits = desired width, high 16 bits = desired height // // Return value is the GDI handle of a small bitmap to be used. case OC_QUERY_IMAGE: pwszFunction = L"OC_QUERY_IMAGE"; fReturnErrCode = FALSE; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); _LeaveIfError(g_Comp.hrContinue, "OC_QUERY_IMAGE"); g_Comp.hrContinue = certocmOcQueryImage( pwszComponent, pwszSubComponent, (SubComponentInfo) LOWORD(Param1), LOWORD((ULONG_PTR) Param2), HIWORD((ULONG_PTR) Param2), &g_Comp, (HBITMAP*)&ulpRet); _PrintIfError(g_Comp.hrContinue, "certocmOcQueryImage"); break; // OC_QUERY_IMAGE_EX: // // pwszComponent = WCHAR top level component string // pwszSubComponent = WCHAR sub-component string // Param1 = [in] OC_QUERY_IMAGE_INFO* // Param2 = [in,out] HBITMAP* // // Return value is S_OK or ERROR_CALL_COMPONENT case OC_QUERY_IMAGE_EX: pwszFunction = L"OC_QUERY_IMAGE_EX"; fReturnErrCode = FALSE; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); { OC_QUERY_IMAGE_INFO *pocQueryImageInfo = (OC_QUERY_IMAGE_INFO *) Param1; g_Comp.hrContinue = certocmOcQueryImage( pwszComponent, pwszSubComponent, pocQueryImageInfo->ComponentInfo, pocQueryImageInfo->DesiredWidth, pocQueryImageInfo->DesiredHeight, &g_Comp, (HBITMAP *) Param2); _PrintIfError(g_Comp.hrContinue, "certocmOcQueryImage"); ulpRet = (S_OK == g_Comp.hrContinue)? TRUE:FALSE; } break; // OC_REQUEST_PAGES: // pwszComponent = WCHAR top level component string // pwszSubComponent = unused // Param1 = Type of wiz pages being requested (WizardPagesType enum) // Param2 = points to IN OUT SETUP_REQUEST_PAGES structure // // Return value is number of pages the component places in the // SETUP_REQUEST_PAGES structure. case OC_REQUEST_PAGES: pwszFunction = L"OC_REQUEST_PAGES"; fReturnErrCode = FALSE; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); _LeaveIfError(g_Comp.hrContinue, "OC_REQUEST_PAGES"); g_Comp.hrContinue = certocmOcRequestPages( pwszComponent, (WizardPagesType) Param1, (SETUP_REQUEST_PAGES *) Param2, &g_Comp, &ulpRet); _PrintIfError(g_Comp.hrContinue, "certocmOcRequestPages"); break; // OC_QUERY_CHANGE_SEL_STATE: // pwszComponent = WCHAR top level component string // pwszSubComponent = WCHAR sub-component string // Param1 = proposed new sel state; 0 = unselected, non 0 = selected // Param2 = flags -- OCQ_ACTUAL_SELECTION // // Return boolean to indicate whether to allow selection state change case OC_QUERY_CHANGE_SEL_STATE: pwszFunction = L"OC_QUERY_CHANGE_SEL_STATE"; fReturnErrCode = FALSE; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); _LeaveIfError(g_Comp.hrContinue, "OC_QUERY_CHANGE_SEL_STATE"); g_Comp.hrContinue = certocmOcQueryChangeSelState( g_Comp.HelperRoutines.QueryWizardDialogHandle(g_Comp.HelperRoutines.OcManagerContext), pwszComponent, pwszSubComponent, (BOOL) Param1, (DWORD) (ULONG_PTR) Param2, &g_Comp, &ulpRet); _PrintIfError(g_Comp.hrContinue, "certocmOcQueryChangeSelState"); break; // OC_CALC_DISK_SPACE: // pwszComponent = WCHAR top level component string // pwszSubComponent = WCHAR sub-component string // Param1 = 0 for removing component or non 0 for adding component // Param2 = HDSKSPC to operate on // // Return value is Win32 error code indicating outcome. case OC_CALC_DISK_SPACE: pwszFunction = L"OC_CALC_DISK_SPACE"; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); _LeaveIfError(g_Comp.hrContinue, "OC_CALC_DISK_SPACE"); g_Comp.hrContinue = certocmOcCalcDiskSpace( pwszComponent, pwszSubComponent, (BOOL) Param1, (HDSKSPC) Param2, &g_Comp, &ulpRet); _PrintIfError(g_Comp.hrContinue, "certocmOcCalcDiskSpace"); break; // OC_QUEUE_FILE_OPS: // pwszComponent = WCHAR top level component string // pwszSubComponent = WCHAR sub-component string // Param1 = unused // Param2 = HSPFILEQ to operate on // // Return value is Win32 error code indicating outcome. case OC_QUEUE_FILE_OPS: pwszFunction = L"OC_QUEUE_FILE_OPS"; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); _LeaveIfError(g_Comp.hrContinue, "OC_QUEUE_FILE_OPS"); g_Comp.hrContinue = certocmOcQueueFileOps( g_Comp.HelperRoutines.QueryWizardDialogHandle(g_Comp.HelperRoutines.OcManagerContext), pwszComponent, pwszSubComponent, (HSPFILEQ) Param2, &g_Comp, &ulpRet); _PrintIfError(g_Comp.hrContinue, "certocmOcQueueFileOps"); break; // Params? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // OC_NOTIFICATION_FROM_QUEUE: // pwszComponent = WCHAR top level component string // pwszSubComponent = unused // Param1 = unused // Param2 = unused // // Return value is ??? case OC_NOTIFICATION_FROM_QUEUE: pwszFunction = L"OC_NOTIFICATION_FROM_QUEUE"; fReturnErrCode = FALSE; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); DBGPRINT(( DBG_SS_CERTOCMI, "OC_NOTIFICATION_FROM_QUEUE(%ws, %ws, %x, %x)\n", pwszComponent, pwszSubComponent, Param1, Param2)); break; // OC_QUERY_STEP_COUNT: // pwszComponent = WCHAR top level component string // pwszSubComponent = WCHAR sub-component string // Param1 = unused // Param2 = unused // // Return value is an arbitrary 'step' count or -1 if error. case OC_QUERY_STEP_COUNT: pwszFunction = L"OC_QUERY_STEP_COUNT"; fReturnErrCode = FALSE; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); _LeaveIfError(g_Comp.hrContinue, "OC_QUERY_STEP_COUNT"); g_Comp.hrContinue = (DWORD) certocmOcQueryStepCount( pwszComponent, pwszSubComponent, &ulpRet); _PrintIfError(g_Comp.hrContinue, "certocmOcQueryStepCount"); break; // OC_COMPLETE_INSTALLATION: // pwszComponent = WCHAR top level component string // pwszSubComponent = WCHAR sub-component string // Param1 = reserved for future expansion // Param2 = unused // // Return value is Win32 error code indicating outcome. case OC_COMPLETE_INSTALLATION: pwszFunction = L"OC_COMPLETE_INSTALLATION"; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); _LeaveIfError(g_Comp.hrContinue, "OC_COMPLETE_INSTALLATION"); g_Comp.hrContinue = certocmOcCompleteInstallation( g_Comp.HelperRoutines.QueryWizardDialogHandle(g_Comp.HelperRoutines.OcManagerContext), pwszComponent, pwszSubComponent, &g_Comp, &ulpRet); _PrintIfError(g_Comp.hrContinue, "certocmOcCompleteInstallation"); break; // OC_CLEANUP: // pwszComponent = WCHAR top level component string // pwszSubComponent = unused // Param1 = unused // Param2 = unused // // Return value is ignored case OC_CLEANUP: // don't _LeaveIfError(g_Comp.hrContinue, "OC_CLEANUP"); // avoid memory leaks pwszFunction = L"OC_CLEANUP"; fReturnErrCode = FALSE; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); certocmOcCleanup(pwszComponent, &g_Comp); break; // Params? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // OC_QUERY_STATE: // pwszComponent = WCHAR top level component string // pwszSubComponent = WCHAR sub-component string // Param1 = unused? (but Index Server uses it for current state)! // Param2 = unused // // Return value is from the SubComponentState enumerated type case OC_QUERY_STATE: pwszFunction = L"OC_QUERY_STATE"; fReturnErrCode = FALSE; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); //don't _LeaveIfError(g_Comp.hrContinue, "OC_QUERY_STATE"); certocmOcQueryState( pwszComponent, pwszSubComponent, (DWORD)Param1, //cast to DWORD, use as flags &g_Comp, &ulpRet); break; // Params? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // OC_NEED_MEDIA: // pwszComponent = WCHAR top level component string // pwszSubComponent = WCHAR sub-component string // Param1 = unused // Param2 = unused // // Return value is ??? case OC_NEED_MEDIA: pwszFunction = L"OC_NEED_MEDIA"; fReturnErrCode = FALSE; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); DBGPRINT(( DBG_SS_CERTOCMI, "OC_NEED_MEDIA(%ws, %ws, %x, %x)\n", pwszComponent, pwszSubComponent, Param1, Param2)); break; // OC_ABOUT_TO_COMMIT_QUEUE: // pwszComponent = WCHAR top level component string // pwszSubComponent = WCHAR sub-component string // Param1 = reserved for future expansion // Param2 = unused // // Return value is Win32 error code indicating outcome. case OC_ABOUT_TO_COMMIT_QUEUE: pwszFunction = L"OC_ABOUT_TO_COMMIT_QUEUE"; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); _LeaveIfError(g_Comp.hrContinue, "OC_ABOUT_TO_COMMIT_QUEUE"); g_Comp.hrContinue = certocmOcCommitQueue( g_Comp.HelperRoutines.QueryWizardDialogHandle(g_Comp.HelperRoutines.OcManagerContext), pwszComponent, pwszSubComponent, &g_Comp); _PrintIfError(g_Comp.hrContinue, "certocmOcCommitQueue"); break; // OC_QUERY_SKIP_PAGE: // pwszComponent = WCHAR top level component string // pwszSubComponent = unused // Param1 = OcManagerPage page indicator // Param2 = unused // // Return value is a boolean -- 0 for display or non 0 for skip case OC_QUERY_SKIP_PAGE: pwszFunction = L"OC_QUERY_SKIP_PAGE"; fReturnErrCode = FALSE; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); DBGPRINT(( DBG_SS_CERTOCMI, "OC_QUERY_SKIP_PAGE(%ws, %x)\n", pwszComponent, (OcManagerPage) Param1)); _LeaveIfError(g_Comp.hrContinue, "OC_QUERY_SKIP_PAGE"); if (g_Comp.fPostBase && (WizardPagesType) Param1 == WizPagesWelcome) { ulpRet = 1; // non 0 to skip wiz page } break; // OC_WIZARD_CREATED: // pwszComponent = WCHAR top level component string // pwszSubComponent = ??? // Param1 = ??? // Param2 = ??? // // Return value is ??? case OC_WIZARD_CREATED: pwszFunction = L"OC_WIZARD_CREATED"; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); _LeaveIfError(g_Comp.hrContinue, "OC_WIZARD_CREATED"); break; // OC_EXTRA_ROUTINES: // pwszComponent = WCHAR top level component string // pwszSubComponent = ??? // Param1 = ??? // Param2 = ??? // // Return value is ??? case OC_EXTRA_ROUTINES: pwszFunction = L"OC_EXTRA_ROUTINES"; CSILOG(g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, NULL); _LeaveIfError(g_Comp.hrContinue, "OC_EXTRA_ROUTINES"); break; // Some other notification: default: fReturnErrCode = FALSE; CSILOG( g_Comp.hrContinue, IDS_LOG_BEGIN, pwszFunction, pwszSubComponent, (DWORD const *) &Function); DBGPRINT(( DBG_SS_CERTOCMI, "DEFAULT(0x%x: %ws, %ws, %x, %x)\n", Function, pwszComponent, pwszSubComponent, Param1, Param2)); break; } } __except(ulpRet = myHEXCEPTIONCODE(), EXCEPTION_EXECUTE_HANDLER) { if (S_OK == g_Comp.hrContinue) { g_Comp.hrContinue = (HRESULT)ulpRet; } _PrintError((HRESULT)ulpRet, "Exception"); } DBGPRINT((DBG_SS_CERTOCMI, "return %p\n", ulpRet)); // make sure to get a pop up in case of fatal error if (S_OK != g_Comp.hrContinue) { if (!g_Comp.fShownErr) { int iMsgId = g_Comp.iErrMsg; if (0 == iMsgId) { // use generic one iMsgId = IDS_ERR_CERTSRV_SETUP_FAIL; } CertErrorMessageBox( g_Comp.hInstance, g_Comp.fUnattended, NULL, // null hwnd iMsgId, g_Comp.hrContinue, g_Comp.pwszCustomMessage); g_Comp.fShownErr = TRUE; } // anything fails, cancel install HRESULT hr2 = CancelCertsrvInstallation(NULL, &g_Comp); _PrintIfError(hr2, "CancelCertsrvInstallation"); } CSILOG( fReturnErrCode? (HRESULT) ulpRet : S_OK, IDS_LOG_END, pwszFunction, pwszSubComponent, fReturnErrCode? NULL : (DWORD const *) &ulpRet); return(ulpRet); } ULONG_PTR CertSrvOCPostProc( IN WCHAR const *pwszComponent, IN WCHAR const *pwszSubComponent, IN UINT Function, IN UINT Param1, IN OUT VOID *Param2) { // post setup entry point // by going through this path, we know it is invoked in post setup g_Comp.fPostBase = TRUE; return CertSrvOCProc( pwszComponent, pwszSubComponent, Function, Param1, Param2); } VOID certocmBumpGasGauge( OPTIONAL IN PER_COMPONENT_DATA *pComp, IN DWORD PerCentComplete DBGPARM(IN WCHAR const *pwszSource)) { static DWORD dwTickCount = 0; if (NULL != pComp) { DWORD NewCount; NewCount = (PerCentComplete * SERVERINSTALLTICKS)/100; DBGPRINT(( DBG_SS_CERTOCMI, "certocmBumpGasGauge(%ws, %u%%) %d ticks: %d --> %d\n", pwszSource, PerCentComplete, NewCount - dwTickCount, dwTickCount, NewCount)); if (SERVERINSTALLTICKS < NewCount) { NewCount = SERVERINSTALLTICKS; } while (dwTickCount < NewCount) { (*pComp->HelperRoutines.TickGauge)( pComp->HelperRoutines.OcManagerContext); dwTickCount++; } } } BOOL certocmEnabledSub( PER_COMPONENT_DATA *pComp, CertSubComponent SubComp, DWORD SelectionStateType) { SUBCOMP const *psc; BOOL bRet = FALSE; psc = LookupSubComponent(SubComp); if (NULL != psc->pwszSubComponent) { if (pComp->fUnattended && OCSELSTATETYPE_CURRENT == SelectionStateType && 0 == (pComp->Flags & SETUPOP_NTUPGRADE) ) { // unattended case, flags from unattended file // upgrade is automatically in unattended mode and make sure // to exclude it bRet = psc->fInstallUnattend; } else { bRet = (*pComp->HelperRoutines.QuerySelectionState)( pComp->HelperRoutines.OcManagerContext, psc->pwszSubComponent, SelectionStateType); } } return(bRet); } BOOL certocmIsEnabled( PER_COMPONENT_DATA *pComp, CertSubComponent SubComp) { BOOL bRet; bRet = certocmEnabledSub(pComp, SubComp, OCSELSTATETYPE_CURRENT); if (!fDebugSupress) { DBGPRINT(( DBG_SS_CERTOCMI, "certocmIsEnabled(%ws) Is %ws\n", LookupSubComponent(SubComp)->pwszSubComponent, bRet? L"Enabled" : L"Disabled")); } return(bRet); } BOOL certocmWasEnabled( PER_COMPONENT_DATA *pComp, CertSubComponent SubComp) { BOOL bRet; bRet = certocmEnabledSub(pComp, SubComp, OCSELSTATETYPE_ORIGINAL); if (!fDebugSupress) { DBGPRINT(( DBG_SS_CERTOCMI, "certocmWasEnabled(%ws) Was %ws\n", LookupSubComponent(SubComp)->pwszSubComponent, bRet? L"Enabled" : L"Disabled")); } return(bRet); } BOOL certocmUninstalling( PER_COMPONENT_DATA *pComp, CertSubComponent SubComp) { BOOL bRet; fDebugSupress++; bRet = certocmWasEnabled(pComp, SubComp) && !certocmIsEnabled(pComp, SubComp); fDebugSupress--; if (!fDebugSupress) { DBGPRINT(( DBG_SS_CERTOCMI, "certocmUninstalling(%ws) %ws\n", LookupSubComponent(SubComp)->pwszSubComponent, bRet? L"TRUE" : L"False")); } return(bRet); } BOOL certocmInstalling( PER_COMPONENT_DATA *pComp, CertSubComponent SubComp) { BOOL bRet; fDebugSupress++; bRet = !certocmWasEnabled(pComp, SubComp) && certocmIsEnabled(pComp, SubComp); fDebugSupress--; if (!fDebugSupress) { DBGPRINT(( DBG_SS_CERTOCMI, "certocmInstalling(%ws) %ws\n", LookupSubComponent(SubComp)->pwszSubComponent, bRet? L"TRUE" : L"False")); } return(bRet); } BOOL certocmPreserving( PER_COMPONENT_DATA *pComp, CertSubComponent SubComp) { BOOL bRet; fDebugSupress++; bRet = certocmWasEnabled(pComp, SubComp) && certocmIsEnabled(pComp, SubComp); fDebugSupress--; if (!fDebugSupress) { DBGPRINT(( DBG_SS_CERTOCMI, "certocmPreserving(%ws) %ws\n", LookupSubComponent(SubComp)->pwszSubComponent, bRet? L"TRUE" : L"False")); } return(bRet); }
30.962874
97
0.544837
npocmaka
1d3f3d901d7ad035721f3e56757df46247341e57
11,190
cpp
C++
components/common/sources/licensing/core/licensing_manager.cpp
untgames/funner
c91614cda55fd00f5631d2bd11c4ab91f53573a3
[ "MIT" ]
7
2016-03-30T17:00:39.000Z
2017-03-27T16:04:04.000Z
components/common/sources/licensing/core/licensing_manager.cpp
untgames/Funner
c91614cda55fd00f5631d2bd11c4ab91f53573a3
[ "MIT" ]
4
2017-11-21T11:25:49.000Z
2018-09-20T17:59:27.000Z
components/common/sources/licensing/core/licensing_manager.cpp
untgames/Funner
c91614cda55fd00f5631d2bd11c4ab91f53573a3
[ "MIT" ]
4
2016-11-29T15:18:40.000Z
2017-03-27T16:04:08.000Z
#include "license_manager_shared.h" #ifdef _MSC_VER #include <time.h> #endif using namespace common; namespace { /* Константы */ const size_t COMPONENTS_ARRAY_RESERVE_SIZE = 64; //резервируемое количество компонентов const char* ALLOWED_COMPONENTS [] = { "common.*" }; const char* IGNORED_PROPERTIES [] = { "CheckFiles", "LicenseHash", "AllowedComponents" }; const size_t IGNORED_PROPERTIES_COUNT = sizeof (IGNORED_PROPERTIES) / sizeof (*IGNORED_PROPERTIES); /* Описание реализации менеджера лицензий */ class LicenseManagerImpl { public: ///Конструктор LicenseManagerImpl () : license_loaded (false), till_time (0) { allowed_components.Reserve (COMPONENTS_ARRAY_RESERVE_SIZE); } ///Загрузка лицензии void Load (const char* license_path) { license_loaded = false; try { if (!license_path) throw xtl::make_null_argument_exception ("", "license_path"); properties.Clear (); allowed_components.Clear (); Parser p (license_path, "xml"); ParseLog log = p.Log (); ParseNode root = p.Root ().First ("License"); if (!root) log.Error (p.Root (), "No root 'License' tag"); for (size_t i = 0; i < log.MessagesCount (); i++) switch (log.MessageType (i)) { case ParseLogMessageType_Error: case ParseLogMessageType_FatalError: throw xtl::format_operation_exception ("", log.Message (i)); default: break; } //чтение периода действия лицензии const char *since_date_string = common::get<const char*> (root, "SinceDate", ""), *till_date_string = common::get<const char*> (root, "TillDate", ""), *license_hash = common::get<const char*> (root, "LicenseHash"); time_t current_time; time (&current_time); if (xtl::xstrlen (since_date_string)) { time_t since_time; ParseDate (since_date_string, since_time); if (difftime (current_time, since_time) < 0) throw xtl::format_operation_exception ("", "License '%s' is not valid yet", license_path); } if (xtl::xstrlen (till_date_string)) { ParseDate (till_date_string, till_time); if (difftime (till_time, current_time) < 0) throw xtl::format_operation_exception ("", "License '%s' has expired", license_path); } //чтение произвольных свойств for (ParseNode node = root.First (); node; node = node.Next ()) AddNodeProperties (node, ""); //чтение разрешенных компонентов for (Parser::NamesakeIterator component_iter = root.First ("AllowedComponents.Component"); component_iter; ++component_iter) allowed_components.Add (common::get<const char*> (*component_iter, "Wildcard")); stl::string allowed_components_property_string; for (size_t i = 0, count = allowed_components.Size (); i < count; i++) allowed_components_property_string += allowed_components [i]; properties.SetProperty ("AllowedComponents", allowed_components_property_string.c_str ()); //проверка корректности содержимого лицензии stl::vector<CheckFile> check_files_list; for (Parser::NamesakeIterator check_file_iter = root.First ("CheckFiles.File"); check_file_iter; ++check_file_iter) check_files_list.push_back (CheckFile (common::get<const char*> (*check_file_iter, "Path"), common::get<size_t> (*check_file_iter, "HashSize", 0))); unsigned char check_string_hash [16]; calculate_license_hash (check_files_list, properties, check_string_hash); stl::string hex_check_string_hash; for (size_t i = 0; i < 16; i++) hex_check_string_hash += common::format ("%02x", check_string_hash [i]); if (hex_check_string_hash != license_hash) throw xtl::format_operation_exception ("", "Invalid license file '%s', hash mismatch", license_path); } catch (xtl::exception& exception) { exception.touch ("common::LicenseManager::Load"); throw; } license_loaded = true; } ///Проверка состояния int DaysToExpiration () { static const char* METHOD_NAME = "common::LicenseManager::DaysToExpiration"; LoadDefaultLicenses (); if (!license_loaded) throw xtl::format_operation_exception (METHOD_NAME, "License not loaded"); if (!till_time) return INT_MAX; time_t current_time; time (&current_time); return (int)(difftime (till_time, current_time) / (60.f * 60.f * 24.f)); } ///Работа с предопределенными свойствами bool IsComponentAllowed (const char* component_name) { static const char* METHOD_NAME = "common::LicenseManager::IsComponentAllowed"; for (size_t i = 0, count = sizeof (ALLOWED_COMPONENTS) / sizeof (*ALLOWED_COMPONENTS); i < count; i++) if (common::wcmatch (component_name, ALLOWED_COMPONENTS [i])) return true; LoadDefaultLicenses (); if (!license_loaded) throw xtl::format_operation_exception (METHOD_NAME, "License not loaded"); for (size_t i = 0, count = allowed_components.Size (); i < count; i++) if (common::wcmatch (component_name, allowed_components [i])) return true; return false; } ///Работа со свойствами const char* GetProperty (const char* property_name) { static const char* METHOD_NAME = "common::LicenseManager::GetProperty"; LoadDefaultLicenses (); if (!license_loaded) throw xtl::format_operation_exception (METHOD_NAME, "License not loaded"); return properties.GetString (property_name); } const char* GetProperty (size_t property_index) { static const char* METHOD_NAME = "common::LicenseManager::GetProperty"; LoadDefaultLicenses (); if (!license_loaded) throw xtl::format_operation_exception (METHOD_NAME, "License not loaded"); return properties.GetString (property_index); } const char* GetPropertyName (size_t property_index) { static const char* METHOD_NAME = "common::LicenseManager::GetPropertyName"; LoadDefaultLicenses (); if (!license_loaded) throw xtl::format_operation_exception (METHOD_NAME, "License not loaded"); return properties.PropertyName (property_index); } bool HasProperty (const char* property_name) { static const char* METHOD_NAME = "common::LicenseManager::HasProperty"; LoadDefaultLicenses (); if (!license_loaded) throw xtl::format_operation_exception (METHOD_NAME, "License not loaded"); return properties.IsPresent (property_name); } size_t PropertiesCount () { static const char* METHOD_NAME = "common::LicenseManager::PropertiesCount"; LoadDefaultLicenses (); if (!license_loaded) throw xtl::format_operation_exception (METHOD_NAME, "License not loaded"); return properties.Size (); } private: void AddNodeProperties (ParseNode node, const char* base_name) { for (size_t i = 0; i < IGNORED_PROPERTIES_COUNT; i++) if (!xtl::xstrcmp (node.Name (), IGNORED_PROPERTIES [i])) return; stl::string node_full_name = base_name; if (!node_full_name.empty ()) node_full_name.append ("."); node_full_name.append (node.Name ()); if (node.AttributesCount ()) { if (properties.IsPresent (node_full_name.c_str ())) throw xtl::format_operation_exception ("common::LicenseManager::AddNodeProperty", "Duplicate property '%s'", node_full_name.c_str ()); stl::string property_value; for (size_t i = 0, count = node.AttributesCount (); i < count; i++) property_value += node.Attribute (i); properties.SetProperty (node_full_name.c_str (), property_value.c_str ()); } for (ParseNode child = node.First (); child; child = child.Next ()) AddNodeProperties (child, node_full_name.c_str ()); } void ParseDate (const char* date_string, time_t& result_date) { static const char* METHOD_NAME = "common::LicenseManager::ParseDate"; if (!rematch (date_string, "[12][[:digit:]][[:digit:]][[:digit:]]\\-[01][[:digit:]]\\-[0-3][[:digit:]]")) throw xtl::format_operation_exception (METHOD_NAME, "Invalid date string '%s' format, must be yyyy-mm-dd", date_string); tm tm_date; memset (&tm_date, 0, sizeof (tm_date)); tm_date.tm_mday = atoi (date_string + 8); tm_date.tm_mon = atoi (date_string + 5) - 1; tm_date.tm_year = atoi (date_string) - 1900; #if defined (ANDROID) || defined (__MINGW32__) || defined (WINCE) || defined (TABLETOS) time_t date = mktime (&tm_date); #elif defined (_MSC_VER) time_t date = _mkgmtime32 (&tm_date); #else time_t date = timegm (&tm_date); #endif if (date == -1) throw xtl::format_operation_exception (METHOD_NAME, "Can't convert date string '%s'", date_string); result_date = date; } void LoadDefaultLicenses () { static ComponentLoader loader ("common.licensing.loaders.*"); } private: bool license_loaded; StringArray allowed_components; PropertyMap properties; time_t till_time; }; typedef common::Singleton<LicenseManagerImpl> LicenseManagerSingleton; } /* Загрузка лицензии */ void LicenseManager::Load (const char* license_path) { LicenseManagerSingleton::Instance ()->Load (license_path); } /* Проверка состояния */ int LicenseManager::DaysToExpiration () { return LicenseManagerSingleton::Instance ()->DaysToExpiration (); } /* Работа с предопределенными свойствами */ bool LicenseManager::IsComponentAllowed (const char* component_name) { return LicenseManagerSingleton::Instance ()->IsComponentAllowed (component_name); } /* Работа со свойствами */ const char* LicenseManager::GetProperty (const char* property_name) { return LicenseManagerSingleton::Instance ()->GetProperty (property_name); } const char* LicenseManager::GetProperty (size_t property_index) { return LicenseManagerSingleton::Instance ()->GetProperty (property_index); } const char* LicenseManager::GetPropertyName (size_t property_index) { return LicenseManagerSingleton::Instance ()->GetPropertyName (property_index); } bool LicenseManager::HasProperty (const char* property_name) { return LicenseManagerSingleton::Instance ()->HasProperty (property_name); } size_t LicenseManager::PropertiesCount () { return LicenseManagerSingleton::Instance ()->PropertiesCount (); }
30
159
0.632529
untgames
1d40ffb1da64bc022b52654c32bb2fc3c866483b
281
cpp
C++
Scripts/233.cpp
zzz0906/LeetCode
cd0b4a4fd03d0dff585c9ef349984eba1922ece0
[ "MIT" ]
17
2018-08-23T08:53:56.000Z
2021-04-17T00:06:13.000Z
Scripts/233.cpp
zzz0906/LeetCode
cd0b4a4fd03d0dff585c9ef349984eba1922ece0
[ "MIT" ]
null
null
null
Scripts/233.cpp
zzz0906/LeetCode
cd0b4a4fd03d0dff585c9ef349984eba1922ece0
[ "MIT" ]
null
null
null
class Solution { public: int countDigitOne(int n) { int res = 0, a = 1, b = 1; while (n > 0) { res += (n + 8) / 10 * a + (n % 10 == 1) * b; b += n % 10 * a; a *= 10; n /= 10; } return res; } };
21.615385
56
0.320285
zzz0906
1d41e19dc0a730e7803fdfcda45aa1c481b8ca90
1,559
cpp
C++
aslam_cv/aslam_cameras/src/FovDistortion.cpp
chengfzy/kalibr
fe9705b380b160dc939607135f7d30efa64ea2e9
[ "BSD-4-Clause" ]
null
null
null
aslam_cv/aslam_cameras/src/FovDistortion.cpp
chengfzy/kalibr
fe9705b380b160dc939607135f7d30efa64ea2e9
[ "BSD-4-Clause" ]
null
null
null
aslam_cv/aslam_cameras/src/FovDistortion.cpp
chengfzy/kalibr
fe9705b380b160dc939607135f7d30efa64ea2e9
[ "BSD-4-Clause" ]
null
null
null
#include <aslam/cameras/FovDistortion.hpp> #include <sm/serialization_macros.hpp> namespace aslam { namespace cameras { FovDistortion::FovDistortion() : _w(1.0) { SM_ASSERT_TRUE(std::runtime_error, areParametersValid(_w), "Invalid distortion parameter"); } FovDistortion::FovDistortion(double w) : _w(w) { SM_ASSERT_TRUE(std::runtime_error, areParametersValid(w), "Invalid distortion parameter"); } FovDistortion::FovDistortion(const sm::PropertyTree& config) { _w = config.getDouble("w"); SM_ASSERT_TRUE(std::runtime_error, areParametersValid(_w), "Invalid distortion parameter"); } FovDistortion::~FovDistortion() {} // aslam::backend compatibility void FovDistortion::update(const double* v) { _w += v[0]; SM_ASSERT_TRUE(std::runtime_error, areParametersValid(_w), "Invalid distortion parameter"); } int FovDistortion::minimalDimensions() const { return IntrinsicsDimension; } void FovDistortion::getParameters(Eigen::MatrixXd& S) const { S.resize(1, 1); S(0, 0) = _w; } void FovDistortion::setParameters(const Eigen::MatrixXd& S) { _w = S(0, 0); SM_ASSERT_TRUE(std::runtime_error, areParametersValid(_w), "Invalid distortion parameter"); } Eigen::Vector2i FovDistortion::parameterSize() const { return Eigen::Vector2i(1, 1); } bool FovDistortion::isBinaryEqual(const FovDistortion& rhs) const { return SM_CHECKMEMBERSSAME(rhs, _w); } FovDistortion FovDistortion::getTestDistortion() { return FovDistortion(1.0); } void FovDistortion::clear() { _w = 1.0; } } // namespace cameras } // namespace aslam
31.816327
106
0.738935
chengfzy
1d44ce57aab3ebc7f7358fbcea1cfec04270b000
350
hpp
C++
cpp/inc/header.hpp
KCNyu/UnixTaskbook
f653ca435b8b4a6739aed184f81e7661934070f8
[ "MIT" ]
null
null
null
cpp/inc/header.hpp
KCNyu/UnixTaskbook
f653ca435b8b4a6739aed184f81e7661934070f8
[ "MIT" ]
null
null
null
cpp/inc/header.hpp
KCNyu/UnixTaskbook
f653ca435b8b4a6739aed184f81e7661934070f8
[ "MIT" ]
null
null
null
#ifndef HEADER_HPP #define HEADER_HPP #include <iostream> #include <string> #include <vector> #include <algorithm> #include <fstream> #include <fcntl.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/stat.h> #include <cassert> #include <cstring> #include <ctime> #include "error.hpp" #include "cmdline.hpp" #endif
15.217391
22
0.722857
KCNyu
1d44e69ebf330562f5585661a267f67a4e94c7b1
10,210
cpp
C++
CrazyCanvas/Source/ECS/Systems/Player/WeaponSystemClient.cpp
IbexOmega/CrazyCanvas
f60f01aaf9c988e4da8990dc1ef3caac20cecf7e
[ "MIT" ]
18
2020-09-04T08:00:54.000Z
2021-08-29T23:04:45.000Z
CrazyCanvas/Source/ECS/Systems/Player/WeaponSystemClient.cpp
IbexOmega/LambdaEngine
f60f01aaf9c988e4da8990dc1ef3caac20cecf7e
[ "MIT" ]
32
2020-09-12T19:24:50.000Z
2020-12-11T14:29:44.000Z
CrazyCanvas/Source/ECS/Systems/Player/WeaponSystemClient.cpp
IbexOmega/LambdaEngine
f60f01aaf9c988e4da8990dc1ef3caac20cecf7e
[ "MIT" ]
2
2020-12-15T15:36:13.000Z
2021-03-27T14:27:02.000Z
#include "ECS/Systems/Player/WeaponSystemClient.h" #include "ECS/Components/Player/Player.h" #include "ECS/ECSCore.h" #include "Application/API/Events/EventQueue.h" #include "Resources/Material.h" #include "Resources/ResourceManager.h" #include "Input/API/InputActionSystem.h" #include "Math/Random.h" #include "Lobby/PlayerManagerClient.h" #include "Match/Match.h" #include "Resources/ResourceCatalog.h" /* * WeaponSystemClients */ WeaponSystemClient::WeaponSystemClient() { LambdaEngine::EventQueue::RegisterEventHandler<PlayerAliveUpdatedEvent>(this, &WeaponSystemClient::OnPlayerAliveUpdated); } WeaponSystemClient::~WeaponSystemClient() { LambdaEngine::EventQueue::UnregisterEventHandler<PlayerAliveUpdatedEvent>(this, &WeaponSystemClient::OnPlayerAliveUpdated); } void WeaponSystemClient::Tick(LambdaEngine::Timestamp deltaTime) { using namespace LambdaEngine; UNREFERENCED_VARIABLE(deltaTime); ECSCore* pECS = ECSCore::GetInstance(); const ComponentArray<WeaponComponent>* pWeaponComponents = pECS->GetComponentArray<WeaponComponent>(); ComponentArray<PositionComponent>* pPositionComponents = pECS->GetComponentArray<PositionComponent>(); ComponentArray<RotationComponent>* pRotationComponents = pECS->GetComponentArray<RotationComponent>(); ComponentArray<ScaleComponent>* pScaleComponent = pECS->GetComponentArray<ScaleComponent>(); for (Entity weaponEntity : m_WeaponEntities) { const WeaponComponent& weaponComponent = pWeaponComponents->GetConstData(weaponEntity); PositionComponent& weaponPositionComponent = pPositionComponents->GetData(weaponEntity); RotationComponent& weaponRotationComponent = pRotationComponents->GetData(weaponEntity); ScaleComponent& weaponScaleComponent = pScaleComponent->GetData(weaponEntity); PositionComponent playerPositionComponent; RotationComponent playerRotationComponent; ScaleComponent playerScaleComponent; if (pPositionComponents->GetConstIf(weaponComponent.WeaponOwner, playerPositionComponent) && pRotationComponents->GetConstIf(weaponComponent.WeaponOwner, playerRotationComponent) && pScaleComponent->GetConstIf(weaponComponent.WeaponOwner, playerScaleComponent)) { weaponPositionComponent.Position = playerPositionComponent.Position; weaponRotationComponent.Quaternion = playerRotationComponent.Quaternion; weaponScaleComponent.Scale = playerScaleComponent.Scale; } } } void WeaponSystemClient::FixedTick(LambdaEngine::Timestamp deltaTime) { using namespace LambdaEngine; const float32 dt = (float32)deltaTime.AsSeconds(); ECSCore* pECS = ECSCore::GetInstance(); ComponentArray<PacketComponent<PacketPlayerAction>>* pPlayerActionPackets = pECS->GetComponentArray<PacketComponent<PacketPlayerAction>>(); ComponentArray<PacketComponent<PacketPlayerActionResponse>>* pPlayerResponsePackets = pECS->GetComponentArray<PacketComponent<PacketPlayerActionResponse>>(); ComponentArray<WeaponComponent>* pWeaponComponents = pECS->GetComponentArray<WeaponComponent>(); const ComponentArray<TeamComponent>* pTeamComponents = pECS->GetComponentArray<TeamComponent>(); // TODO: Check local response and maybe roll back for (Entity weaponEntity : m_WeaponEntities) { WeaponComponent& weaponComponent = pWeaponComponents->GetData(weaponEntity); Entity playerEntity = weaponComponent.WeaponOwner; TeamComponent teamComponent; if (pTeamComponents->GetConstIf(playerEntity, teamComponent)) { // Foreign Players if (m_ForeignPlayerEntities.HasElement(playerEntity)) { PacketComponent<PacketPlayerActionResponse>& packets = pPlayerResponsePackets->GetData(playerEntity); const TArray<PacketPlayerActionResponse>& receivedPackets = packets.GetPacketsReceived(); for (const PacketPlayerActionResponse& response : receivedPackets) { if (response.FiredAmmo != EAmmoType::AMMO_TYPE_NONE) { Fire(weaponEntity, weaponComponent, response.FiredAmmo, response.WeaponPosition, response.WeaponVelocity, teamComponent.TeamIndex, response.Angle); } } continue; } // Local Player PacketComponent<PacketPlayerAction>& playerActions = pPlayerActionPackets->GetData(playerEntity); auto waterAmmo = weaponComponent.WeaponTypeAmmo.find(EAmmoType::AMMO_TYPE_WATER); VALIDATE(waterAmmo != weaponComponent.WeaponTypeAmmo.end()) auto paintAmmo = weaponComponent.WeaponTypeAmmo.find(EAmmoType::AMMO_TYPE_PAINT); VALIDATE(paintAmmo != weaponComponent.WeaponTypeAmmo.end()) const bool hasNoAmmo = (waterAmmo->second.first <= 0) || (paintAmmo->second.first <= 0); const bool hasFullAmmo = (waterAmmo->second.first >= waterAmmo->second.second) && (paintAmmo->second.first >= paintAmmo->second.second); const bool isReloading = weaponComponent.ReloadClock > 0.0f; const bool onCooldown = weaponComponent.CurrentCooldown > 0.0f; if (hasNoAmmo && !isReloading) { StartReload(weaponComponent, playerActions); } if (!PlayerManagerClient::GetPlayerLocal()->IsDead()) { // Reload if we are not reloading if (InputActionSystem::IsActive(EAction::ACTION_ATTACK_RELOAD) && !isReloading && !hasFullAmmo) { StartReload(weaponComponent, playerActions); } else if (!onCooldown) // If we did not hit the reload try and shoot { if (InputActionSystem::IsActive(EAction::ACTION_ATTACK_PRIMARY)) { TryFire(EAmmoType::AMMO_TYPE_PAINT, weaponEntity); } else if (InputActionSystem::IsActive(EAction::ACTION_ATTACK_SECONDARY)) { TryFire(EAmmoType::AMMO_TYPE_WATER, weaponEntity); } } } // Update reload and cooldown timers UpdateWeapon(weaponComponent, dt); } } } void WeaponSystemClient::Fire(LambdaEngine::Entity weaponEntity, WeaponComponent& weaponComponent, EAmmoType ammoType, const glm::vec3& position, const glm::vec3& velocity, uint8 playerTeam, uint32 angle) { using namespace LambdaEngine; WeaponSystem::Fire(weaponEntity, weaponComponent, ammoType, position, velocity, playerTeam, angle); // Play gun fire and spawn particles ECSCore* pECS = ECSCore::GetInstance(); const auto* pWeaponLocalComponents = pECS->GetComponentArray<WeaponLocalComponent>(); // Play 2D sound if local player shooting else play 3D sound if (pWeaponLocalComponents != nullptr && pWeaponLocalComponents->HasComponent(weaponEntity)) { ISoundEffect2D* pSound = ResourceManager::GetSoundEffect2D(ResourceCatalog::WEAPON_SOUND_GUNFIRE_2D_GUID); pSound->PlayOnce(0.5f); } else { ISoundEffect3D* pSound = ResourceManager::GetSoundEffect3D(ResourceCatalog::WEAPON_SOUND_GUNFIRE_3D_GUID); pSound->PlayOnceAt(position, velocity, 0.25f, 1.0f); } } bool WeaponSystemClient::OnPlayerAliveUpdated(const PlayerAliveUpdatedEvent& event) { using namespace LambdaEngine; const Player* pPlayer = PlayerManagerClient::GetPlayerLocal(); if (event.pPlayer == pPlayer) { ECSCore* pECS = ECSCore::GetInstance(); ComponentArray<WeaponComponent>* pWeaponComponents = pECS->GetComponentArray<WeaponComponent>(); for (Entity weaponEntity : m_WeaponEntities) { WeaponComponent& weaponComponent = pWeaponComponents->GetData(weaponEntity); if (weaponComponent.WeaponOwner == pPlayer->GetEntity()) { for (auto& ammo : weaponComponent.WeaponTypeAmmo) { ammo.second.first = AMMO_CAPACITY; } } } } return false; } bool WeaponSystemClient::InitInternal() { using namespace LambdaEngine; // Register system { PlayerGroup playerGroup; playerGroup.Position.Permissions = R; playerGroup.Scale.Permissions = R; playerGroup.Rotation.Permissions = R; playerGroup.Velocity.Permissions = R; SystemRegistration systemReg = {}; WeaponSystem::CreateBaseSystemRegistration(systemReg); systemReg.SubscriberRegistration.EntitySubscriptionRegistrations.PushBack( { .pSubscriber = &m_ForeignPlayerEntities, .ComponentAccesses = { { NDA, PlayerForeignComponent::Type() }, { RW, PacketComponent<PacketPlayerActionResponse>::Type() } }, .ComponentGroups = { &playerGroup } } ); systemReg.SubscriberRegistration.EntitySubscriptionRegistrations.PushBack( { .pSubscriber = &m_LocalPlayerEntities, .ComponentAccesses = { { NDA, PlayerLocalComponent::Type() }, { RW, PacketComponent<PacketPlayerAction>::Type() } }, .ComponentGroups = { &playerGroup } } ); RegisterSystem(TYPE_NAME(WeaponSystemClient), systemReg); } return true; } bool WeaponSystemClient::TryFire(EAmmoType ammoType, LambdaEngine::Entity weaponEntity) { using namespace LambdaEngine; // Add cooldown ECSCore* pECS = ECSCore::GetInstance(); WeaponComponent& weaponComponent = pECS->GetComponent<WeaponComponent>(weaponEntity); weaponComponent.CurrentCooldown = 1.0f / weaponComponent.FireRate; auto ammoState = weaponComponent.WeaponTypeAmmo.find(ammoType); VALIDATE(ammoState != weaponComponent.WeaponTypeAmmo.end()); const bool hasAmmo = (ammoState->second.first > 0); if (Match::HasBegun() && hasAmmo) { // If we try to shoot when reloading we abort the reload const bool isReloading = weaponComponent.ReloadClock > 0.0f; if (isReloading) { AbortReload(weaponComponent); } //Calculate Weapon Fire Properties (Position, Velocity and Team) glm::vec3 firePosition; glm::vec3 fireVelocity; uint8 playerTeam; CalculateWeaponFireProperties(weaponEntity, firePosition, fireVelocity, playerTeam); uint32 angle = Random::UInt32(0, 360); // For creating entity Fire(weaponEntity, weaponComponent, ammoType, firePosition, fireVelocity, playerTeam, angle); // Send action to server PacketComponent<PacketPlayerAction>& packets = pECS->GetComponent<PacketComponent<PacketPlayerAction>>(weaponComponent.WeaponOwner); TQueue<PacketPlayerAction>& actions = packets.GetPacketsToSend(); if (!actions.empty()) { actions.back().FiredAmmo = ammoType; actions.back().Angle = angle; } return true; } else { // Play out of ammo ISoundEffect2D* pSound = ResourceManager::GetSoundEffect2D(ResourceCatalog::WEAPON_SOUND_OUTOFAMMO_2D_GUID); pSound->PlayOnce(1.0f, 1.0f); return false; } }
33.47541
204
0.760333
IbexOmega
1d490289541c1f9a95e8a96554b9e424bf3d146d
5,187
cpp
C++
test/Math/Test_Statistics.cpp
petiaccja/DSPBB
405d43c4458adfc16ffad68dac4bcd7e1735407f
[ "MIT" ]
2
2021-03-11T13:34:33.000Z
2022-02-08T20:25:20.000Z
test/Math/Test_Statistics.cpp
MoeSzyslak98/DSPBB
405d43c4458adfc16ffad68dac4bcd7e1735407f
[ "MIT" ]
56
2021-08-14T11:02:23.000Z
2022-02-25T15:41:31.000Z
test/Math/Test_Statistics.cpp
MoeSzyslak98/DSPBB
405d43c4458adfc16ffad68dac4bcd7e1735407f
[ "MIT" ]
2
2021-03-29T14:32:16.000Z
2022-02-08T20:25:15.000Z
#include <dspbb/Math/Statistics.hpp> #include <dspbb/Primitives/Signal.hpp> #include <catch2/catch.hpp> #include <complex> using namespace dspbb; using namespace std::complex_literals; TEST_CASE("CentralMoment #0 and #1", "[Statistics]") { Signal<float> s = { 2, 4, 4, 4, 5, 5, 7, 9 }; REQUIRE(0 == CentralMoment(s, 0)); REQUIRE(0 == CentralMoment(s, 1)); } TEST_CASE("CentralMoment #2", "[Statistics]") { Signal<float> s = { 2, 4, 4, 4, 5, 5, 7, 9 }; REQUIRE(Approx(4) == CentralMoment(s, 2)); } TEST_CASE("CentralMoment #3", "[Statistics]") { Signal<float> s = { 2, 4, 4, 4, 5, 5, 7, 9 }; REQUIRE(Approx(5.25) == CentralMoment(s, 3)); } TEST_CASE("CentralMoment #4", "[Statistics]") { Signal<float> s = { 2, 4, 4, 4, 5, 5, 7, 9 }; REQUIRE(Approx(44.5) == CentralMoment(s, 4)); } TEST_CASE("CentralMoment #5", "[Statistics]") { Signal<float> s = { 2, 4, 4, 4, 5, 5, 7, 9 }; REQUIRE(Approx(101.25) == CentralMoment(s, 5)); } TEST_CASE("StandardizedMoment #1", "[Statistics]") { Signal<float> s = { 2, 4, 4, 4, 5, 5, 7, 9 }; REQUIRE(Approx(0) == StandardizedMoment(s, 1)); } TEST_CASE("StandardizedMoment #2", "[Statistics]") { Signal<float> s = { 2, 4, 4, 4, 5, 5, 7, 9 }; REQUIRE(Approx(1) == StandardizedMoment(s, 2)); } TEST_CASE("Standard deviation", "[Statistics]") { Signal<float> s = { 2, 4, 4, 4, 5, 5, 7, 9 }; REQUIRE(Approx(2) == StandardDeviation(s)); } TEST_CASE("Variance", "[Statistics]") { Signal<float> s = { 2, 4, 4, 4, 5, 5, 7, 9 }; REQUIRE(Approx(4) == Variance(s)); } TEST_CASE("Skewness", "[Statistics]") { Signal<float> s = { 2, 4, 4, 4, 5, 5, 7, 9 }; REQUIRE(Approx(5.25f / 8.f) == Skewness(s)); } TEST_CASE("Kurtosis", "[Statistics]") { Signal<float> s = { 2, 4, 4, 4, 5, 5, 7, 9 }; REQUIRE(Approx(44.5f / 16.f) == Kurtosis(s)); } TEST_CASE("Corrected standard deviation", "[Statistics]") { Signal<float> s = { 2, 4, 4, 4, 5, 5, 7, 9 }; REQUIRE(Approx(2.138089935) == CorrectedStandardDeviation(s)); } TEST_CASE("Corrected variance", "[Statistics]") { Signal<float> s = { 2, 4, 4, 4, 5, 5, 7, 9 }; REQUIRE(Approx(4.571428571) == CorrectedVariance(s)); } TEST_CASE("Corrected skewness", "[Statistics]") { Signal<float> s = { 2, 4, 4, 4, 5, 5, 7, 9 }; REQUIRE(Approx(0.818487553) == CorrectedSkewness(s)); } TEST_CASE("Corrected kurtosis", "[Statistics]") { Signal<float> s(1000000); std::mt19937 rne(762375); std::normal_distribution<float> rng; for (auto& v : s) { v = rng(rne); } // Kurtosis of normal distribution should be 3. REQUIRE(Approx(3.0f).epsilon(0.01f) == CorrectedKurtosis(s)); } TEST_CASE("Sum", "[Statistics]") { Signal<float> s = { 1, 3, 2, 4, 5, 6, 7, 8, 9, 10 }; REQUIRE(Approx(55) == Sum(s)); } TEST_CASE("Mean", "[Statistics]") { Signal<float> s = { 1, 3, 2, 4, 5, 6, 7, 8, 9, 10 }; REQUIRE(Approx(5.5f) == Mean(s)); } TEST_CASE("SumSquare", "[Statistics]") { Signal<float> s = { 1, 3, 2, 4, 5, 6, 7, 8, 9, 10 }; REQUIRE(Approx(385) == SumSquare(s)); } TEST_CASE("MeanSquare", "[Statistics]") { Signal<float> s = { 1, 3, 2, 4, 5, 6, 7, 8, 9, 10 }; REQUIRE(Approx(38.5f) == MeanSquare(s)); } TEST_CASE("RootMeanSquare", "[Statistics]") { Signal<float> s = { 1, 3, 2, 4, 5, 6, 7, 8, 9, 10 }; REQUIRE(Approx(std::sqrt(38.5f)) == RootMeanSquare(s)); } TEST_CASE("Norm", "[Statistics]") { Signal<float> s = { 1, 3, 2, 4, 5, 6, 7, 8, 9, 10 }; REQUIRE(Approx(std::sqrt(385.f)) == Norm(s)); } TEST_CASE("Max", "[Statistics]") { Signal<float> s = { 1, 3, 2, 4, 8, 9, 10, 5, 6, 7 }; REQUIRE(Approx(10) == Max(s)); } TEST_CASE("Min", "[Statistics]") { Signal<float> s = { 1, 3, 2, 4, 8, 9, 10, 5, 6, 7 }; REQUIRE(Approx(1) == Min(s)); } TEST_CASE("Covariance self", "[Statistics]") { Signal<float> s = { 1, 3, 2, 4, 8, 9, 10, 5, 6, 7 }; Signal<float> t = { 1, 3, 2, 4, 8, 9, 10, 5, 6, 7 }; REQUIRE(Approx(Variance(s)) == Covariance(s, t)); } TEST_CASE("Covariance anti", "[Statistics]") { Signal<float> base = { 1, 3, 2, 4, 8, 9, 10, 5, 6, 7 }; Signal<float> s = base - Mean(base); Signal<float> t = Mean(base) - base; REQUIRE(Approx(-Variance(s)) == Covariance(s, t)); } TEST_CASE("Covariance middle", "[Statistics]") { Signal<float> s = { 1, 3, 2, 4, 8, 9, 10, 5, 6, 7 }; Signal<float> t = { 3, 4, 5, 6, 3, 7, 3, 7, 4, 5 }; REQUIRE(Approx(0.15f) == Covariance(s, t)); } TEST_CASE("Corrected covariance self", "[Statistics]") { Signal<float> s = { 1, 3, 2, 4, 8, 9, 10, 5, 6, 7 }; Signal<float> t = { 1, 3, 2, 4, 8, 9, 10, 5, 6, 7 }; REQUIRE(Approx(CorrectedVariance(s)) == CorrectedCovariance(s, t)); } TEST_CASE("Correlation self", "[Statistics]") { Signal<float> s = { 1, 3, 2, 4, 8, 9, 10, 5, 6, 7 }; Signal<float> t = { 1, 3, 2, 4, 8, 9, 10, 5, 6, 7 }; REQUIRE(Approx(1) == Correlation(s, t)); } TEST_CASE("Correlation anti", "[Statistics]") { Signal<float> base = { 1, 3, 2, 4, 8, 9, 10, 5, 6, 7 }; Signal<float> s = base - Mean(base); Signal<float> t = Mean(base) - base; REQUIRE(Approx(-1) == Correlation(s, t)); } TEST_CASE("Correlation middle", "[Statistics]") { Signal<float> s = { 1, 3, 2, 4, 8, 9, 10, 5, 6, 7 }; Signal<float> t = { 3, 4, 5, 6, 3, 7, 3, 7, 4, 5 }; REQUIRE(Approx(0.15f / 4.27f) == Correlation(s, t)); }
27.887097
68
0.585117
petiaccja
1d4b0293cf006e7061b39800d8f7c57d62a36701
17,122
cpp
C++
libs/leaf/test/error_code_test.cpp
armdevvel/boost
30d0930951181ef5bc5aad2231ebac8575db0720
[ "BSL-1.0" ]
1
2020-04-28T15:15:28.000Z
2020-04-28T15:15:28.000Z
libs/leaf/test/error_code_test.cpp
armdevvel/boost
30d0930951181ef5bc5aad2231ebac8575db0720
[ "BSL-1.0" ]
2
2017-05-23T08:01:11.000Z
2019-09-06T20:49:05.000Z
libs/leaf/test/error_code_test.cpp
armdevvel/boost
30d0930951181ef5bc5aad2231ebac8575db0720
[ "BSL-1.0" ]
8
2015-11-03T14:12:19.000Z
2020-09-22T19:20:54.000Z
// Copyright (c) 2018-2020 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include <boost/leaf/handle_errors.hpp> #include <boost/leaf/pred.hpp> #include <boost/leaf/result.hpp> #include "_test_res.hpp" #include "lightweight_test.hpp" namespace leaf = boost::leaf; struct e_wrapped_error_code { std::error_code value; }; template <class R> void test() { #if __cplusplus >= 201703L { int r = leaf::try_handle_all( []() -> R { return make_error_code(errc_a::a0); }, []( leaf::match<std::error_code, leaf::category<errc_a>, leaf::category<errc_b>> code ) { std::error_code const & ec = code.matched; BOOST_TEST_EQ(&ec.category(), &cat_errc_a()); BOOST_TEST_EQ(ec, errc_a::a0); return 42; }, [] { return -42; } ); BOOST_TEST_EQ(r, 42); } { int r = leaf::try_handle_all( []() -> R { return make_error_code(errc_b::b0); }, []( leaf::match<std::error_code, leaf::category<errc_a>, leaf::category<errc_b>> code ) { std::error_code const & ec = code.matched; BOOST_TEST_EQ(&ec.category(), &cat_errc_b()); BOOST_TEST_EQ(ec, errc_b::b0); return 42; }, [] { return -42; } ); BOOST_TEST_EQ(r, 42); } { int r = leaf::try_handle_all( []() -> R { return make_error_code(errc_b::b0); }, []( leaf::match<std::error_code, leaf::category<errc_a>, errc_b::b0> code ) { std::error_code const & ec = code.matched; BOOST_TEST_EQ(&ec.category(), &cat_errc_b()); BOOST_TEST_EQ(ec, errc_b::b0); return 42; }, [] { return -42; } ); BOOST_TEST_EQ(r, 42); } #endif { int r = leaf::try_handle_all( []() -> R { return errc_a::a0; // testing without make_error_code }, []( std::error_code const & ec ) { BOOST_TEST(!leaf::is_error_id(ec)); BOOST_TEST_EQ(ec, errc_a::a0); return 42; }, [] { return -42; } ); BOOST_TEST_EQ(r, 42); } { int r = leaf::try_handle_all( []() -> R { return make_error_code(errc_a::a0); }, []( leaf::match<leaf::condition<errc_a>, errc_a::a0> code ) { std::error_code const & ec = code.matched; BOOST_TEST_EQ(ec, errc_a::a0); return 42; }, [] { return -42; } ); BOOST_TEST_EQ(r, 42); } #if __cplusplus >= 201703L { int r = leaf::try_handle_all( []() -> R { return make_error_code(errc_a::a0); }, []( leaf::match<std::error_code, errc_a::a0> code ) { std::error_code const & ec = code.matched; BOOST_TEST_EQ(ec, errc_a::a0); return 42; }, [] { return -42; } ); BOOST_TEST_EQ(r, 42); } #endif { int r = leaf::try_handle_all( []() -> R { return make_error_code(errc_a::a0); }, []( leaf::match<leaf::condition<errc_a>, errc_a::a0> code ) { std::error_code const & ec = code.matched; BOOST_TEST_EQ(ec, errc_a::a0); return 42; }, [] { return -42; } ); BOOST_TEST_EQ(r, 42); } { int r = leaf::try_handle_all( []() -> R { return make_error_code(errc_a::a0); }, []( leaf::match<leaf::condition<cond_x>, cond_x::x00> cond ) { std::error_code const & ec = cond.matched; BOOST_TEST_EQ(ec, errc_a::a0); BOOST_TEST(ec==make_error_condition(cond_x::x00)); return 42; }, [] { return -42; } ); BOOST_TEST_EQ(r, 42); } #if __cplusplus >= 201703L { int r = leaf::try_handle_all( []() -> R { return make_error_code(errc_a::a0); }, []( leaf::match<std::error_code, cond_x::x00> cond ) { std::error_code const & ec = cond.matched; BOOST_TEST_EQ(ec, errc_a::a0); BOOST_TEST(ec==make_error_condition(cond_x::x00)); return 42; }, [] { return -42; } ); BOOST_TEST_EQ(r, 42); } #endif { int r = leaf::try_handle_all( []() -> R { return leaf::new_error( e_wrapped_error_code { make_error_code(errc_a::a0) } ).to_error_code(); }, []( e_wrapped_error_code const & wec ) { std::error_code const & ec = wec.value; BOOST_TEST_EQ(ec, errc_a::a0); return 42; }, [] { return -42; } ); BOOST_TEST_EQ(r, 42); } { int r = leaf::try_handle_all( []() -> R { return leaf::new_error( e_wrapped_error_code { make_error_code(errc_a::a0) } ).to_error_code(); }, []( leaf::match_value<leaf::condition<e_wrapped_error_code, errc_a>, errc_a::a0> code ) { e_wrapped_error_code const & wec = code.matched; std::error_code const & ec = wec.value; BOOST_TEST_EQ(ec, errc_a::a0); return 42; }, [] { return -42; } ); BOOST_TEST_EQ(r, 42); } #if __cplusplus >= 201703L { int r = leaf::try_handle_all( []() -> R { return leaf::new_error( e_wrapped_error_code { make_error_code(errc_a::a0) } ).to_error_code(); }, []( leaf::match_value<e_wrapped_error_code, errc_a::a0> code ) { e_wrapped_error_code const & wec = code.matched; std::error_code const & ec = wec.value; BOOST_TEST_EQ(ec, errc_a::a0); return 42; }, [] { return -42; } ); BOOST_TEST_EQ(r, 42); } #endif { int r = leaf::try_handle_all( []() -> R { return leaf::new_error( e_wrapped_error_code { make_error_code(errc_a::a0) } ).to_error_code(); }, []( leaf::match_value<leaf::condition<e_wrapped_error_code, cond_x>, cond_x::x00> cond ) { e_wrapped_error_code const & wec = cond.matched; std::error_code const & ec = wec.value; BOOST_TEST_EQ(ec, errc_a::a0); BOOST_TEST(ec==make_error_condition(cond_x::x00)); return 42; }, [] { return -42; } ); BOOST_TEST_EQ(r, 42); } #if __cplusplus >= 201703L { int r = leaf::try_handle_all( []() -> R { return leaf::new_error( e_wrapped_error_code { make_error_code(errc_a::a0) } ).to_error_code(); }, []( leaf::match_value<e_wrapped_error_code, cond_x::x00> cond ) { e_wrapped_error_code const & wec = cond.matched; std::error_code const & ec = wec.value; BOOST_TEST_EQ(ec, errc_a::a0); BOOST_TEST(ec==make_error_condition(cond_x::x00)); return 42; }, [] { return -42; } ); BOOST_TEST_EQ(r, 42); } #endif } template <class R> void test_void() { #if __cplusplus >= 201703L { int r = 0; leaf::try_handle_all( []() -> R { return make_error_code(errc_a::a0); }, [&]( leaf::match<std::error_code, leaf::category<errc_a>, leaf::category<errc_b>> code ) { std::error_code const & ec = code.matched; BOOST_TEST_EQ(&ec.category(), &cat_errc_a()); BOOST_TEST_EQ(ec, errc_a::a0); r = 42; }, [&] { r = -42; } ); BOOST_TEST_EQ(r, 42); } { int r = 0; leaf::try_handle_all( []() -> R { return make_error_code(errc_b::b0); }, [&]( leaf::match<std::error_code, leaf::category<errc_a>, leaf::category<errc_b>> code ) { std::error_code const & ec = code.matched; BOOST_TEST_EQ(&ec.category(), &cat_errc_b()); BOOST_TEST_EQ(ec, errc_b::b0); r = 42; }, [&] { r = -42; } ); BOOST_TEST_EQ(r, 42); } { int r = 0; leaf::try_handle_all( []() -> R { return make_error_code(errc_b::b0); }, [&]( leaf::match<std::error_code, leaf::category<errc_a>, errc_b::b0> code ) { std::error_code const & ec = code.matched; BOOST_TEST_EQ(&ec.category(), &cat_errc_b()); BOOST_TEST_EQ(ec, errc_b::b0); r = 42; }, [&] { r = -42; } ); BOOST_TEST_EQ(r, 42); } #endif { int r = 0; leaf::try_handle_all( [&]() -> R { return errc_a::a0; // testing without make_error_code }, [&]( std::error_code const & ec ) { BOOST_TEST(!leaf::is_error_id(ec)); BOOST_TEST_EQ(ec, errc_a::a0); r = 42; }, [&] { r = -42; } ); BOOST_TEST_EQ(r, 42); } { int r = 0; leaf::try_handle_all( []() -> R { return make_error_code(errc_a::a0); }, [&]( leaf::match<leaf::condition<errc_a>, errc_a::a0> code ) { std::error_code const & ec = code.matched; BOOST_TEST_EQ(ec, errc_a::a0); r = 42; }, [&] { r = -42; } ); BOOST_TEST_EQ(r, 42); } #if __cplusplus >= 201703L { int r = 0; leaf::try_handle_all( []() -> R { return make_error_code(errc_a::a0); }, [&]( leaf::match<std::error_code, errc_a::a0> code ) { std::error_code const & ec = code.matched; BOOST_TEST_EQ(ec, errc_a::a0); r = 42; }, [&] { r = -42; } ); BOOST_TEST_EQ(r, 42); } #endif { int r = 0; leaf::try_handle_all( []() -> R { return make_error_code(errc_a::a0); }, [&]( leaf::match<leaf::condition<errc_a>, errc_a::a0> code ) { std::error_code const & ec = code.matched; BOOST_TEST_EQ(ec, errc_a::a0); r = 42; }, [&] { r = -42; } ); BOOST_TEST_EQ(r, 42); } { int r = 0; leaf::try_handle_all( []() -> R { return make_error_code(errc_a::a0); }, [&]( leaf::match<leaf::condition<cond_x>, cond_x::x00> cond ) { std::error_code const & ec = cond.matched; BOOST_TEST_EQ(ec, errc_a::a0); BOOST_TEST(ec==make_error_condition(cond_x::x00)); r = 42; }, [&] { r = -42; } ); BOOST_TEST_EQ(r, 42); } #if __cplusplus >= 201703L { int r = 0; leaf::try_handle_all( []() -> R { return make_error_code(errc_a::a0); }, [&]( leaf::match<std::error_code, cond_x::x00> cond ) { std::error_code const & ec = cond.matched; BOOST_TEST_EQ(ec, errc_a::a0); BOOST_TEST(ec==make_error_condition(cond_x::x00)); r = 42; }, [&] { r = -42; } ); BOOST_TEST_EQ(r, 42); } #endif { int r = 0; leaf::try_handle_all( []() -> R { return leaf::new_error( e_wrapped_error_code { make_error_code(errc_a::a0) } ).to_error_code(); }, [&]( e_wrapped_error_code const & wec ) { std::error_code const & ec = wec.value; BOOST_TEST_EQ(ec, errc_a::a0); r = 42; }, [&] { r = -42; } ); BOOST_TEST_EQ(r, 42); } { int r = 0; leaf::try_handle_all( []() -> R { return leaf::new_error( e_wrapped_error_code { make_error_code(errc_a::a0) } ).to_error_code(); }, [&]( leaf::match_value<leaf::condition<e_wrapped_error_code, errc_a>, errc_a::a0> code ) { e_wrapped_error_code const & wec = code.matched; std::error_code const & ec = wec.value; BOOST_TEST_EQ(ec, errc_a::a0); r = 42; }, [&] { r = -42; } ); BOOST_TEST_EQ(r, 42); } #if __cplusplus >= 201703L { int r = 0; leaf::try_handle_all( []() -> R { return leaf::new_error( e_wrapped_error_code { make_error_code(errc_a::a0) } ).to_error_code(); }, [&]( leaf::match_value<e_wrapped_error_code, errc_a::a0> code ) { e_wrapped_error_code const & wec = code.matched; std::error_code const & ec = wec.value; BOOST_TEST_EQ(ec, errc_a::a0); r = 42; }, [&] { r = -42; } ); BOOST_TEST_EQ(r, 42); } #endif { int r = 0; leaf::try_handle_all( []() -> R { return leaf::new_error( e_wrapped_error_code { make_error_code(errc_a::a0) } ).to_error_code(); }, [&]( leaf::match_value<leaf::condition<e_wrapped_error_code, cond_x>, cond_x::x00> cond ) { e_wrapped_error_code const & wec = cond.matched; std::error_code const & ec = wec.value; BOOST_TEST_EQ(ec, errc_a::a0); BOOST_TEST(ec==make_error_condition(cond_x::x00)); r = 42; }, [&] { r = -42; } ); BOOST_TEST_EQ(r, 42); } #if __cplusplus >= 201703L { int r = 0; leaf::try_handle_all( []() -> R { return leaf::new_error( e_wrapped_error_code { make_error_code(errc_a::a0) } ).to_error_code(); }, [&]( leaf::match_value<e_wrapped_error_code, cond_x::x00> cond ) { e_wrapped_error_code const & wec = cond.matched; std::error_code const & ec = wec.value; BOOST_TEST_EQ(ec, errc_a::a0); BOOST_TEST(ec==make_error_condition(cond_x::x00)); r = 42; }, [&] { r = -42; } ); BOOST_TEST_EQ(r, 42); } #endif } int main() { test<leaf::result<int>>(); test<test_res<int, std::error_code>>(); test_void<leaf::result<void>>(); test_void<test_res<void, std::error_code>>(); return boost::report_errors(); }
28.632107
111
0.414846
armdevvel
1d4b82cf08c158b401a1dba6a9ec2070a7e9ad03
2,945
cpp
C++
Library/BigFix/ArchiveWriter.cpp
bigfix/bfarchive
6cff4e3a5688d665704c353f31072b72059e1865
[ "Apache-2.0" ]
5
2015-11-07T01:21:58.000Z
2022-03-10T11:15:50.000Z
Library/BigFix/ArchiveWriter.cpp
bigfix/bfarchive
6cff4e3a5688d665704c353f31072b72059e1865
[ "Apache-2.0" ]
5
2015-02-26T23:21:09.000Z
2015-11-30T19:16:33.000Z
Library/BigFix/ArchiveWriter.cpp
bigfix/bfarchive
6cff4e3a5688d665704c353f31072b72059e1865
[ "Apache-2.0" ]
2
2017-05-09T10:10:54.000Z
2020-01-21T18:26:56.000Z
/* Copyright 2014 International Business Machines, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "ArchiveWriter.h" #include "BigFix/DataRef.h" #include "BigFix/DateTime.h" #include "BigFix/Error.h" #include "BigFix/Filesystem.h" #include "BigFix/Number.h" #include "BigFix/Stream.h" #include "BigFix/UTF8.h" #include <limits> #include <string.h> namespace BigFix { ArchiveWriter::ArchiveWriter( Stream& output ) : m_output( output ) { } void ArchiveWriter::Directory( const char* path, const DateTime& mtime ) { std::string pathWithSlash = path; pathWithSlash += "/"; WriteHeader( pathWithSlash.c_str(), mtime, 0 ); } Stream& ArchiveWriter::File( const char* path, const DateTime& mtime, uint64_t length ) { WriteHeader( path, mtime, length ); m_append.Reset( m_output ); return m_append; } void ArchiveWriter::End() { m_output.Write( DataRef( "_\0" ) ); m_output.End(); } void ArchiveWriter::WriteHeader( const char* path, const DateTime& mtime, uint64_t length ) { uint8_t buffer[8]; if ( !IsAscii( path ) ) m_output.Write( DataRef( "2" ) ); if ( !IsValidUTF8( path ) ) throw Error( "Failed to write archive: path is not valid UTF-8: " + std::string( path ) ); if ( length > std::numeric_limits<uint32_t>::max() ) m_output.Write( DataRef( "1" ) ); else m_output.Write( DataRef( "_" ) ); size_t pathLengthWithNull = strlen( path ) + 1; if ( pathLengthWithNull > 255 ) throw Error( "Failed to write archive: path is greater than 254 characters: " + std::string( path ) ); WriteLittleEndian( pathLengthWithNull, buffer, 1 ); m_output.Write( DataRef( buffer, buffer + 1 ) ); m_output.Write( DataRef( reinterpret_cast<const uint8_t*>( path ), reinterpret_cast<const uint8_t*>( path ) + pathLengthWithNull ) ); std::string mtimeString = mtime.ToString(); WriteLittleEndian( mtimeString.size(), buffer, 1 ); m_output.Write( DataRef( buffer, buffer + 1 ) ); m_output.Write( DataRef( mtimeString ) ); if ( length > std::numeric_limits<uint32_t>::max() ) { WriteLittleEndian( length, buffer, 8 ); m_output.Write( DataRef( buffer, buffer + 8 ) ); } else { WriteLittleEndian( length, buffer, 4 ); m_output.Write( DataRef( buffer, buffer + 4 ) ); } } }
26.531532
79
0.653311
bigfix
1d4d16333ee38b5bdc4bffda28be477c9c6631fc
755
cpp
C++
problems/sliding_window_maximum/solution.cpp
sauravchandra1/Leetcode
be89c7d8d93083326a94906a28bfad2342aa1dfe
[ "MIT" ]
null
null
null
problems/sliding_window_maximum/solution.cpp
sauravchandra1/Leetcode
be89c7d8d93083326a94906a28bfad2342aa1dfe
[ "MIT" ]
null
null
null
problems/sliding_window_maximum/solution.cpp
sauravchandra1/Leetcode
be89c7d8d93083326a94906a28bfad2342aa1dfe
[ "MIT" ]
null
null
null
class Solution { public: vector<int> maxSlidingWindow(vector<int>& nums, int k) { deque<pair<int, int>> dq; int len = nums.size(); auto get = [&](int i) { while (!dq.empty() && dq.front().second < (i - k + 1)) dq.pop_front(); if (dq.empty()) dq.push_back({nums[i], i}); else { while (!dq.empty() && dq.back().first <= nums[i]) dq.pop_back(); dq.push_back({nums[i], i}); } }; for (int i = 0; i < k - 1; i++) get(i); vector<int> ans; for (int i = k - 1; i < len; i++) { get(i); ans.push_back(dq.front().first); } return ans; } };
31.458333
67
0.405298
sauravchandra1
1d4d7f8023f673b3f184d1aed3d450aa2550d4ca
1,797
cpp
C++
DNS with Benefits/main.cpp
SFaghihi/DNSWithBenefits
2553866c0a634313eab00f1a6eb485fa3eb7ab14
[ "Apache-2.0" ]
null
null
null
DNS with Benefits/main.cpp
SFaghihi/DNSWithBenefits
2553866c0a634313eab00f1a6eb485fa3eb7ab14
[ "Apache-2.0" ]
null
null
null
DNS with Benefits/main.cpp
SFaghihi/DNSWithBenefits
2553866c0a634313eab00f1a6eb485fa3eb7ab14
[ "Apache-2.0" ]
null
null
null
// // main.cpp // DNS with Benefits // // Created by Soroush Faghihi on 5/26/18. // Copyright © 2018 sorco. All rights reserved. // #include <iostream> #include <arpa/inet.h> #include <sys/time.h> #include "cxxopts.hpp" #include "DBRoutingSystem.hpp" #include "DBDNSHypervisor.hpp" // Cammand line options structure struct CMDOpt { public: const char *listen_host; int listen_port; bool verbose; const char *conf_file; CMDOpt(int argc, const char *argv[]) : listen_host("127.0.0.1"), listen_port(53), verbose(false), conf_file("") { } void usage() { } }; int main(int argc, char * argv[]) { // Parse the command line options cxxopts::Options options("DNS With Benefits", "DNS Resolver Server With Filtering Capabilities."); options.add_options() ("a,addr", "IP Address to listen on", cxxopts::value<std::string>()->default_value("127.0.0.1")) ("f,conf", "Routing Config File name", cxxopts::value<std::string>()->default_value("")) ("p,port", "Routing Config File name", cxxopts::value<uint16_t>()->default_value("53")) ("v,verbose", "Verbose Logging") ; auto result = options.parse(argc, argv); // Setup the networking configurations in_addr listen_host; inet_aton(result["addr"].as<std::string>().c_str(), &listen_host); sockaddr_in addr = {sizeof(sockaddr_in), AF_INET, htons(result["port"].as<uint16_t>()), listen_host, 0}; // Construct the routing system DBRoutingSystem routing_system(result["conf"].as<std::string>()); // Construct the DNS hypervisor DBDNSHypervisor dns_hypervisor((sockaddr *)&addr, &routing_system); // Start the threads dns_hypervisor.start_threads(); for (;;) sleep(1); return 0; }
26.043478
108
0.64552
SFaghihi
1d4e88fb7edf1f44f945bbe7d41d4cdab68cec8d
1,662
cpp
C++
BlockChain.cpp
tryingsomestuff/blockchain
c3fb445d4e3512282dc05f59159d17e531c16eaa
[ "MIT" ]
null
null
null
BlockChain.cpp
tryingsomestuff/blockchain
c3fb445d4e3512282dc05f59159d17e531c16eaa
[ "MIT" ]
null
null
null
BlockChain.cpp
tryingsomestuff/blockchain
c3fb445d4e3512282dc05f59159d17e531c16eaa
[ "MIT" ]
null
null
null
#include "BlockChain.h" #include <cassert> #include <iostream> BlockChain::BlockChain(const uint32_t difficulty): difficulty(difficulty > 0 ? difficulty : defaultDifficulty_) { Block b0(0, "Zero!"); b0.prevHash = std::string(64,'0'); b0.mine(BlockChain::difficulty); chain_.push_back(b0); } void BlockChain::addBlock(Block&& b) { b.prevHash = last_().hash; b.mine(difficulty); chain_.push_back(b); } Block BlockChain::last_() const { return chain_.back(); } Block& BlockChain::operator[](const size_t index) { assert(index < chain_.size()); return chain_[index]; } const Block& BlockChain::operator[](const size_t index) const { assert(index < chain_.size()); return chain_[index]; } bool BlockChain::isValidBlock(const size_t index) const { assert(index < chain_.size()); return chain_[index].isValid(difficulty); } bool BlockChain::isValidChain() const { bool ret = true; for (size_t i = 0; i < chain_.size(); ++i) { ret &= chain_[i].isValid(difficulty); if (i > 0) { ret &= chain_[i].prevHash == chain_[i - 1].computeHash(); } if (!ret) std::cout << "Invalid block in chain at position " << i << std::endl; } return ret; } void BlockChain::dump(std::ostream & os)const{ std::cout << "Dumping chain" << std::endl; writeIt(os, chain_.size()); for(const auto & b : chain_){ b.dump(os); } } void BlockChain::load(std::istream & is){ std::cout << "Loading chain" << std::endl; chain_.clear(); size_t s = 0; readIt(is, s); for(size_t i = 0; i < s; ++i){ Block b(-1,""); b.load(is); if(b.isValid(difficulty)) chain_.push_back(b); } }
25.96875
113
0.628761
tryingsomestuff
1d506e52c962aa1f6af0305e003bf4af4f9ea683
6,046
cc
C++
third_party/blink/renderer/core/frame/dom_visual_viewport.cc
sarang-apps/darshan_browser
173649bb8a7c656dc60784d19e7bb73e07c20daa
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
third_party/blink/renderer/core/frame/dom_visual_viewport.cc
sarang-apps/darshan_browser
173649bb8a7c656dc60784d19e7bb73e07c20daa
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
third_party/blink/renderer/core/frame/dom_visual_viewport.cc
sarang-apps/darshan_browser
173649bb8a7c656dc60784d19e7bb73e07c20daa
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
/* * Copyright (C) 2016 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "third_party/blink/renderer/core/frame/dom_visual_viewport.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h" #include "third_party/blink/renderer/core/frame/visual_viewport.h" #include "third_party/blink/renderer/core/layout/adjust_for_absolute_zoom.h" #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/style/computed_style.h" namespace blink { DOMVisualViewport::DOMVisualViewport(LocalDOMWindow* window) : window_(window) {} DOMVisualViewport::~DOMVisualViewport() = default; void DOMVisualViewport::Trace(Visitor* visitor) { visitor->Trace(window_); EventTargetWithInlineData::Trace(visitor); } const AtomicString& DOMVisualViewport::InterfaceName() const { return event_target_names::kVisualViewport; } ExecutionContext* DOMVisualViewport::GetExecutionContext() const { return window_->GetExecutionContext(); } float DOMVisualViewport::offsetLeft() const { LocalFrame* frame = window_->GetFrame(); if (!frame || !frame->IsMainFrame()) return 0; if (Page* page = frame->GetPage()) return page->GetVisualViewport().OffsetLeft(); return 0; } float DOMVisualViewport::offsetTop() const { LocalFrame* frame = window_->GetFrame(); if (!frame || !frame->IsMainFrame()) return 0; if (Page* page = frame->GetPage()) return page->GetVisualViewport().OffsetTop(); return 0; } float DOMVisualViewport::pageLeft() const { LocalFrame* frame = window_->GetFrame(); if (!frame) return 0; Page* page = frame->GetPage(); if (!page) return 0; LocalFrameView* view = frame->View(); if (!view || !view->LayoutViewport()) return 0; frame->GetDocument()->UpdateStyleAndLayout(DocumentUpdateReason::kJavaScript); float viewport_x = page->GetVisualViewport().GetScrollOffset().Width() + view->LayoutViewport()->GetScrollOffset().Width(); return AdjustForAbsoluteZoom::AdjustScroll(viewport_x, frame->PageZoomFactor()); } float DOMVisualViewport::pageTop() const { LocalFrame* frame = window_->GetFrame(); if (!frame) return 0; Page* page = frame->GetPage(); if (!page) return 0; LocalFrameView* view = frame->View(); if (!view || !view->LayoutViewport()) return 0; frame->GetDocument()->UpdateStyleAndLayout(DocumentUpdateReason::kJavaScript); float viewport_y = page->GetVisualViewport().GetScrollOffset().Height() + view->LayoutViewport()->GetScrollOffset().Height(); return AdjustForAbsoluteZoom::AdjustScroll(viewport_y, frame->PageZoomFactor()); } double DOMVisualViewport::width() const { LocalFrame* frame = window_->GetFrame(); if (!frame) return 0; if (!frame->IsMainFrame()) { // Update layout to ensure scrollbars are up-to-date. frame->GetDocument()->UpdateStyleAndLayout( DocumentUpdateReason::kJavaScript); auto* scrollable_area = frame->View()->LayoutViewport(); float width = scrollable_area->VisibleContentRect(kExcludeScrollbars).Width(); return AdjustForAbsoluteZoom::AdjustInt(clampTo<int>(ceilf(width)), frame->PageZoomFactor()); } if (Page* page = frame->GetPage()) return page->GetVisualViewport().Width(); return 0; } double DOMVisualViewport::height() const { LocalFrame* frame = window_->GetFrame(); if (!frame) return 0; if (!frame->IsMainFrame()) { // Update layout to ensure scrollbars are up-to-date. frame->GetDocument()->UpdateStyleAndLayout( DocumentUpdateReason::kJavaScript); auto* scrollable_area = frame->View()->LayoutViewport(); float height = scrollable_area->VisibleContentRect(kExcludeScrollbars).Height(); return AdjustForAbsoluteZoom::AdjustInt(clampTo<int>(ceilf(height)), frame->PageZoomFactor()); } if (Page* page = frame->GetPage()) return page->GetVisualViewport().Height(); return 0; } double DOMVisualViewport::scale() const { LocalFrame* frame = window_->GetFrame(); if (!frame) return 0; if (!frame->IsMainFrame()) return 1; if (Page* page = window_->GetFrame()->GetPage()) return page->GetVisualViewport().ScaleForVisualViewport(); return 0; } } // namespace blink
33.588889
80
0.70559
sarang-apps
1d514992f8433121040c9cdc0a3b8932a2bef787
3,104
cc
C++
pagespeed/kernel/thread/scheduler_sequence.cc
PeterDaveHello/incubator-pagespeed-mod
885f4653e204e1152cb3928f0755d93ec5fdceae
[ "Apache-2.0" ]
null
null
null
pagespeed/kernel/thread/scheduler_sequence.cc
PeterDaveHello/incubator-pagespeed-mod
885f4653e204e1152cb3928f0755d93ec5fdceae
[ "Apache-2.0" ]
null
null
null
pagespeed/kernel/thread/scheduler_sequence.cc
PeterDaveHello/incubator-pagespeed-mod
885f4653e204e1152cb3928f0755d93ec5fdceae
[ "Apache-2.0" ]
1
2020-03-14T15:50:55.000Z
2020-03-14T15:50:55.000Z
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ #include "pagespeed/kernel/thread/scheduler_sequence.h" #include "base/logging.h" #include "pagespeed/kernel/base/abstract_mutex.h" #include "pagespeed/kernel/base/function.h" #include "pagespeed/kernel/base/thread_system.h" #include "pagespeed/kernel/base/timer.h" #include "pagespeed/kernel/thread/scheduler.h" namespace net_instaweb { Scheduler::Sequence::Sequence(Scheduler* scheduler) : scheduler_(scheduler), forwarding_sequence_(nullptr) { } Scheduler::Sequence::~Sequence() { while (!work_queue_.empty()) { Function* function = work_queue_.front(); work_queue_.pop_front(); function->CallCancel(); } } void Scheduler::Sequence::Add(Function* function) { net_instaweb::Sequence* forwarding_sequence = nullptr; { ScopedMutex lock(scheduler_->mutex()); if (forwarding_sequence_ != nullptr) { forwarding_sequence = forwarding_sequence_; } else { work_queue_.push_back(function); scheduler_->Signal(); } } if (forwarding_sequence != nullptr) { forwarding_sequence->Add(function); } } bool Scheduler::Sequence::RunTasksUntil(int64 timeout_ms, bool* done) { scheduler_->mutex()->DCheckLocked(); DCHECK(forwarding_sequence_ == nullptr); Timer* timer = scheduler_->timer(); int64 start_time_ms = timer->NowMs(); int64 end_ms = timeout_ms + start_time_ms; while (!*done) { if (!work_queue_.empty()) { Function* function = work_queue_.front(); work_queue_.pop_front(); scheduler_->mutex()->Unlock(); function->CallRun(); scheduler_->mutex()->Lock(); } else { int64 now_ms = timer->NowMs(); int64 remaining_ms = end_ms - now_ms; if (remaining_ms <= 0) { return false; } scheduler_->BlockingTimedWaitMs(remaining_ms); } } return true; } void Scheduler::Sequence::ForwardToSequence( net_instaweb::Sequence* forwarding_sequence) { scheduler_->mutex()->DCheckLocked(); DCHECK(forwarding_sequence != nullptr); forwarding_sequence_ = forwarding_sequence; while (!work_queue_.empty()) { Function* function = work_queue_.front(); work_queue_.pop_front(); // Takes forwarding_sequence's mutex while holding scheduler_->mutex(). forwarding_sequence->Add(function); } } } // namespace net_instaweb
31.04
75
0.708763
PeterDaveHello
1d52b958b776ab13ef1d7080c954fccbbf50fc08
740
cpp
C++
3_OOP/ThucHanh-T3/Bai01/Bai01.cpp
SummerSad/HCMUS-Lectures
b376e144e2601a73684e2ff437ab5c94a943909c
[ "MIT" ]
8
2020-05-11T09:48:40.000Z
2022-03-28T13:43:27.000Z
3_OOP/ThucHanh-T3/Bai01/Bai01.cpp
SummerSad/HCMUS-Lectures
b376e144e2601a73684e2ff437ab5c94a943909c
[ "MIT" ]
null
null
null
3_OOP/ThucHanh-T3/Bai01/Bai01.cpp
SummerSad/HCMUS-Lectures
b376e144e2601a73684e2ff437ab5c94a943909c
[ "MIT" ]
4
2021-04-13T04:01:50.000Z
2021-12-10T01:12:15.000Z
// 1612180 // Nguyen Tran Hau // Bai 1 ngay #include "Date.h" void main() { Date d1; // Current date: 2/11/2012 Date d2(2012); // 1/1/2012 Date d3(2012, 8); // 01/08/2012 Date d4(2012, 10, 17); // 17/10/2012 Date d5(d2); Date d6; d6 = d3; d6 = d3.Tomorrow(); d5 = d2.Yesterday(); cout << (d6 == d4) << endl; cout << (d6 != d4) << endl; cout << (d6 >= d4) << endl; cout << (d6 <= d4) << endl; cout << (d6 > d4) << endl; cout << (d6 < d4) << endl; d3 = d2 + 1; d2 = d3 - 2; d4++; ++d2; d5--; --d6; cout << d3 << endl; cin >> d4; cout << (int)d3 << endl; // from the first day of current year cout << (long)d4 << endl; // from 1/1/1 Date d7; d7 += 7; d2 -= 6; }
19.473684
65
0.474324
SummerSad
1d563649559e46343699dff0a1ae835fef984928
141,826
cpp
C++
src/gmatutil/util/FileManager.cpp
saichikine/GMAT
80bde040e12946a61dae90d9fc3538f16df34190
[ "Apache-2.0" ]
null
null
null
src/gmatutil/util/FileManager.cpp
saichikine/GMAT
80bde040e12946a61dae90d9fc3538f16df34190
[ "Apache-2.0" ]
null
null
null
src/gmatutil/util/FileManager.cpp
saichikine/GMAT
80bde040e12946a61dae90d9fc3538f16df34190
[ "Apache-2.0" ]
1
2021-12-05T05:40:15.000Z
2021-12-05T05:40:15.000Z
//$Id$ //------------------------------------------------------------------------------ // FileManager //------------------------------------------------------------------------------ // GMAT: General Mission Analysis Tool // // Copyright (c) 2002 - 2018 United States Government as represented by the // Administrator of the National Aeronautics and Space Administration. // All Other Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. // You may obtain a copy of the License at: // http://www.apache.org/licenses/LICENSE-2.0. // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either // express or implied. See the License for the specific language // governing permissions and limitations under the License. // // Developed jointly by NASA/GSFC and Thinking Systems, Inc. under contract // number S-67573-G // // Author: Linda Jun, NASA/GSFC // Created: 2004/04/02 /** * Implements FileManager class. This is singleton class which manages * list of file paths and names. */ //------------------------------------------------------------------------------ #include "FileManager.hpp" #include "MessageInterface.hpp" #include "UtilityException.hpp" #include "StringUtil.hpp" #include "FileTypes.hpp" // for GmatFile::MAX_PATH_LEN #include "FileUtil.hpp" // for GmatFileUtil:: #include "StringTokenizer.hpp" // for StringTokenizer() #include "GmatGlobal.hpp" // for SetTestingMode() #include <fstream> #include <sstream> #include <iomanip> #include <algorithm> // Required for GCC 4.3 #ifndef _MSC_VER // if not Microsoft Visual C++ #include <dirent.h> #endif // For adding default input path and files //#define __FM_ADD_DEFAULT_INPUT__ //#define DEBUG_FILE_MANAGER //#define DEBUG_GMAT_PATH //#define DEBUG_ADD_FILETYPE //#define DEBUG_ABS_PATH //#define DEBUG_FILE_PATH //#define DEBUG_SET_PATH //#define DEBUG_READ_STARTUP_FILE //#define DEBUG_WRITE_STARTUP_FILE //#define DEBUG_PLUGIN_DETECTION //#define DEBUG_FILE_RENAME //#define DEBUG_MAPPING //#define DEBUG_STARTUP_WITH_ABSOLUTE_PATH //#define DEBUG_BIN_DIR //#define DEBUG_TEXTURE_FILE //#define DEBUG_3DMODEL_FILE //#define DEBUG_FIND_PATH //#define DEBUG_FIND_INPUT_PATH //#define DEBUG_FIND_OUTPUT_PATH //#define DEBUG_REFRESH_FILES //--------------------------------- // static data //--------------------------------- const std::string FileManager::FILE_TYPE_STRING[FileTypeCount] = { // File path "BEGIN_OF_PATH", "ROOT_PATH", // Input path "TIME_PATH", "PLANETARY_COEFF_PATH", "PLANETARY_EPHEM_DE_PATH", "PLANETARY_EPHEM_SPK_PATH", "VEHICLE_EPHEM_PATH", "VEHICLE_EPHEM_SPK_PATH", "VEHICLE_EPHEM_CCSDS_PATH", "EARTH_POT_PATH", "LUNA_POT_PATH", "VENUS_POT_PATH", "MARS_POT_PATH", "OTHER_POT_PATH", "TEXTURE_PATH", "BODY_3D_MODEL_PATH", "MEASUREMENT_PATH", "GUI_CONFIG_PATH", "SPLASH_PATH", "ICON_PATH", "STAR_PATH", "VEHICLE_MODEL_PATH", "SPAD_PATH", "ATMOSPHERE_PATH", "FILE_UPDATE_PATH", // Output path "OUTPUT_PATH", "END_OF_PATH", // General file name "LOG_FILE", "REPORT_FILE", "EPHEM_OUTPUT_FILE", "SPLASH_FILE", "TIME_COEFF_FILE", // Specific file name "DE405_FILE", "DE421_FILE", "DE424_FILE", "DE430_FILE", "IAUSOFA_FILE", "ICRF_FILE", "PLANETARY_SPK_FILE", "JGM2_FILE", "JGM3_FILE", "EGM96_FILE", "LP165P_FILE", "MGNP180U_FILE", "MARS50C_FILE", "EOP_FILE", "PLANETARY_COEFF_FILE", "NUTATION_COEFF_FILE", "PLANETARY_PCK_FILE", "EARTH_LATEST_PCK_FILE", "EARTH_PCK_PREDICTED_FILE", "EARTH_PCK_CURRENT_FILE", "LUNA_PCK_CURRENT_FILE", "LUNA_FRAME_KERNEL_FILE", "LEAP_SECS_FILE", "LSK_FILE", "PERSONALIZATION_FILE", "MAIN_ICON_FILE", "STAR_FILE", "CONSTELLATION_FILE", "SPACECRAFT_MODEL_FILE", "SPAD_SRP_FILE", "CSSI_FLUX_FILE", "SCHATTEN_FILE", "MARINI_TROPO_FILE", "HELP_FILE",}; FileManager* FileManager::theInstance = NULL; //--------------------------------- // public methods //--------------------------------- //------------------------------------------------------------------------------ // FileManager* Instance(const std::string &appName = "GMAT.exe") //------------------------------------------------------------------------------ FileManager* FileManager::Instance(const std::string &appName) { if (theInstance == NULL) theInstance = new FileManager(appName); return theInstance; } //------------------------------------------------------------------------------ // ~FileManager() //------------------------------------------------------------------------------ FileManager::~FileManager() { for (std::map<std::string, FileInfo*>::iterator pos = mFileMap.begin(); pos != mFileMap.end(); ++pos) { if (pos->second) { #ifdef DEBUG_FILE_MANAGER MessageInterface::ShowMessage ("FileManager::~FileManager deleting %s\n", pos->first.c_str()); #endif delete pos->second; } } } //------------------------------------------------------------------------------ // std::string GetBinDirectory(const std::string &appName = "GMAT.exe") //------------------------------------------------------------------------------ std::string FileManager::GetBinDirectory(const std::string &appName) { #ifdef DEBUG_BIN_DIR MessageInterface::ShowMessage ("FileManager::GetBinDirectory() entered, appName = %s, mAbsBinDir = '%s'\n", appName.c_str(), mAbsBinDir.c_str()); #endif if (mAbsBinDir == "") SetBinDirectory(appName); #ifdef DEBUG_BIN_DIR MessageInterface::ShowMessage ("FileManager::GetBinDirectory() returning '%s'\n", mAbsBinDir.c_str()); #endif return mAbsBinDir; } //------------------------------------------------------------------------------ // bool SetBinDirectory(const std::string &appName = "GMAT.exe", // const std::string &binDir = "") //------------------------------------------------------------------------------ /** * Sets bin directory where GMAT.exe reside. It sets only once when GMAT.exe * found in the directory. If input binDir is blank, it will try with * GmatFileUtil::GetApplicationPath(). */ //------------------------------------------------------------------------------ bool FileManager::SetBinDirectory(const std::string &appName, const std::string &binDir) { #ifdef DEBUG_BIN_DIR MessageInterface::ShowMessage ("FileManager::SetBinDirectory() entered, appName = '%s', binDir = '%s', mAbsBinDir = '%s'\n", appName.c_str(), binDir.c_str(), mAbsBinDir.c_str()); #endif if (mAbsBinDir == "") { std::string appFullPath = binDir; if (binDir == "") appFullPath = GmatFileUtil::GetApplicationPath(); #ifdef DEBUG_BIN_DIR MessageInterface::ShowMessage(" appFullPath = '%s'\n", appFullPath.c_str()); #endif // Set absolute bin directory if it is not relative path and appName found if (appFullPath[0] != '.') { std::string appPath = GmatFileUtil::ParsePathName(appFullPath); std::string newPath = appPath + appName; if (GmatFileUtil::DoesFileExist(newPath)) { mAbsBinDir = appPath; #ifdef DEBUG_BIN_DIR MessageInterface::ShowMessage ("FileManager::SetBinDirectory() returning true, bin directory set to '%s'\n", mAbsBinDir.c_str()); #endif return true; } else { #ifdef DEBUG_BIN_DIR MessageInterface::ShowMessage (" The file '%s' does not exist\n", newPath.c_str()); #endif } } } else { #ifdef DEBUG_BIN_DIR MessageInterface::ShowMessage (" The bin directory already set to '%s'\n", mAbsBinDir.c_str()); #endif } #ifdef DEBUG_BIN_DIR MessageInterface::ShowMessage ("FileManager::SetBinDirectory() returning false, mAbsBinDir = '%s'\n", mAbsBinDir.c_str()); #endif return false; } //------------------------------------------------------------------------------ // std::string GetGmatWorkingDirectory() //------------------------------------------------------------------------------ /** * Returns GMAT working directory. This is the directory where script is passed * to GMAT from the command line. */ //------------------------------------------------------------------------------ std::string FileManager::GetGmatWorkingDirectory() { return mGmatWorkingDir; } //------------------------------------------------------------------------------ // bool SetGmatWorkingDirectory(const std::string &newDir = "") //------------------------------------------------------------------------------ /** * Sets GMAT working directory. This is the directory where script resides. */ //------------------------------------------------------------------------------ bool FileManager::SetGmatWorkingDirectory(const std::string &newDir) { // Allow resetting on purpose if (newDir == "") { mGmatWorkingDir = newDir; } else { if (DoesDirectoryExist(newDir)) { mGmatWorkingDir = newDir; AddGmatIncludePath(newDir); // Add GMAT working directory to MATLAB search path so that this directory // will have higher priority in search path for the new file path implementation. // (LOJ: 2014.07.09) AddMatlabFunctionPath(newDir); // Also add it to GmatFunction path (LOJ: 2015.09.18) AddGmatFunctionPath(newDir); // //Python // AddPythonModulePath(newDir); } else return false; } return true; } //------------------------------------------------------------------------------ // std::string GetCurrentWorkingDirectory() //------------------------------------------------------------------------------ /** * @return System's current working directory of the process */ //------------------------------------------------------------------------------ std::string FileManager::GetCurrentWorkingDirectory() { return GmatFileUtil::GetCurrentWorkingDirectory(); } //------------------------------------------------------------------------------ // bool SetCurrentWorkingDirectory(const std::string &newDir = "") //------------------------------------------------------------------------------ /** * Sets system's current working directory of the process. */ //------------------------------------------------------------------------------ bool FileManager::SetCurrentWorkingDirectory(const std::string &newDir) { return GmatFileUtil::SetCurrentWorkingDirectory(newDir); } //------------------------------------------------------------------------------ // std::string FindPath(const std::string &fileName, const FileType type, // bool forInput, bool writeWarning = false, bool writeInfo = false, // const std::string &objName) //------------------------------------------------------------------------------ /** * Finds path for requested fileName using the file path search order. * This method calls FindPath() taking type name. * * @return path found using search order */ //------------------------------------------------------------------------------ std::string FileManager::FindPath(const std::string &fileName, const FileType type, bool forInput, bool writeWarning, bool writeInfo, const std::string &objName) { #ifdef DEBUG_FIND_PATH MessageInterface::ShowMessage ("FileManager::FindPath() entered, fileName = '%s', type = %d, forInput = %d, " "writeWarning = %d, writeInfo = %d\n", fileName.c_str(), type, forInput, writeWarning, writeInfo); #endif std::string typeName; if (type >=0 && type < FileTypeCount) { typeName = FILE_TYPE_STRING[type]; } else { std::stringstream ss(""); ss << "*** INTERNAL ERROR *** FileManager::FindPath() enum type: " << type << " is out of bounds\n"; throw UtilityException(ss.str()); } return FindPath(fileName, typeName, forInput, writeWarning, writeInfo, objName); } //------------------------------------------------------------------------------ // std::string FindPath(const std::string &fileName, const std::string &fileType, // bool forInput, bool writeWarning = false, bool writeInfo = false, // const std::string &objName = "") //------------------------------------------------------------------------------ /** * Finds path for requested fileName. If fileName has a absolute path, it will * return fileName or blank if path not found. If fileName has a relative path or * no path, it will find path using the following file path search order. * For Input: * 1) Current GMAT working directory * 2) Directory from the startup file in the application directory * For Output: * 1) Current GMAT working directory if it has relative path * 2) Directory from the startup file in the application directory * if no path found * 3) Application directory * * It returns blank if filename is blank * It returns blank if path not found for input file. * If input fileName is blank, it uses default filename using the type * * @param fileName The requested filename to be searched * Enter blank name if default name to be used for the type * @param fileType The file type name of the input file * @param forInput Set to true if filename is for input * @param writeWarning Set to true if warning should be written when no path found * @param writeInfo Set to true if information should be written for output path (currently not used) * @param objName The name of the calling object to be written to informational message * * @return full path name using search order */ //------------------------------------------------------------------------------ std::string FileManager::FindPath(const std::string &fileName, const std::string &fileType, bool forInput, bool writeWarning, bool writeInfo, const std::string &objName) { #ifdef DEBUG_FIND_PATH MessageInterface::ShowMessage ("FileManager::FindPath() entered\n fileName = '%s'\n fileType = '%s', forInput = %d, " "writeWarning = %d, writeInfo = %d, objName = '%s'\n", fileName.c_str(), fileType.c_str(), forInput, writeWarning, writeInfo, objName.c_str()); #endif mLastFilePathMessage = ""; std::string fullname = fileName; bool writeFilePathInfo = GmatGlobal::Instance()->IsWritingFilePathInfo(); #ifdef DEBUG_FIND_PATH MessageInterface::ShowMessage(" writeFilePathInfo = %d\n", writeFilePathInfo); #endif // If input filename is blank, get default name using type try { if (fileName == "") fullname = GetFilename(fileType); } catch (BaseException &be) { #ifdef DEBUG_FIND_PATH MessageInterface::ShowMessage(be.GetFullMessage()); #endif } // Cannot handle blank, return blank if (fullname == "") { #ifdef DEBUG_FIND_PATH MessageInterface::ShowMessage ("FileManager::FindPath() cannot find default filename for type '%s', " "so just returning blank\n", fileType.c_str()); #endif return ""; } fullname = GmatFileUtil::ConvertToOsFileName(fullname); std::string pathOnly = GmatFileUtil::ParsePathName(fullname); std::string fileOnly = GmatFileUtil::ParseFileName(fullname); std::string gmatPath = GmatFileUtil::ConvertToOsFileName(mGmatWorkingDir); // Get default path for file type std::string defaultPath; try { defaultPath = GmatFileUtil::ConvertToOsFileName(GetPathname(fileType)); } catch (BaseException &be) { #ifdef DEBUG_FIND_PATH MessageInterface::ShowMessage("*** WARNING *** %s\n", be.GetFullMessage().c_str()); #endif // If *_POT_PATH, try OTHER_POT_PATH std::string::size_type potLoc = fileType.find("_POT_PATH"); if (potLoc != fileType.npos) { #ifdef DEBUG_FIND_PATH MessageInterface::ShowMessage("Trying OTHER_POT_PATH\n"); #endif std::string oldPot = fileType.substr(0, potLoc+1); std::string newPotPath = GmatStringUtil::Replace(fileType, oldPot, "OTHER_"); defaultPath = GmatFileUtil::ConvertToOsFileName(GetPathname(newPotPath)); } } std::string tempPath1, tempPath2; std::string pathToReturn; #ifdef DEBUG_FIND_PATH MessageInterface::ShowMessage (" fullname = '%s'\n pathOnly = '%s'\n fileOnly = '%s'\n gmatpath = '%s'\n" " defaultpath = '%s'\n", fullname.c_str(), pathOnly.c_str(), fileOnly.c_str(), gmatPath.c_str(), defaultPath.c_str()); #endif if (GmatFileUtil::IsPathAbsolute(fullname)) { #ifdef DEBUG_FIND_PATH MessageInterface::ShowMessage(" The filename has absolute path\n"); #endif if (GmatFileUtil::DoesFileExist(fullname)) { pathToReturn = fullname; } else { #ifdef DEBUG_FIND_PATH MessageInterface::ShowMessage(" The filename does not exist\n"); #endif if (forInput) { pathToReturn = ""; if (writeWarning && gmatPath != "" && writeFilePathInfo) { MessageInterface::ShowMessage ("The input file '%s' does not exist\n", fullname.c_str()); } } else // for output { #ifdef DEBUG_FIND_PATH MessageInterface::ShowMessage (" It is for output, so checking if directory '%s' exist\n", pathOnly.c_str()); #endif if (DoesDirectoryExist(pathOnly, false)) { #ifdef DEBUG_FIND_PATH MessageInterface::ShowMessage(" The directory exist\n"); #endif pathToReturn = fullname; } else { pathToReturn = ""; if (writeWarning && gmatPath != "" && writeFilePathInfo) { mLastFilePathMessage = "Cannot open output file '" + fullname + "', the path '" + pathOnly + "' does not exist."; MessageInterface::ShowMessage(mLastFilePathMessage + "\n"); } } } } } else // filename without absolute path { #ifdef DEBUG_FIND_PATH MessageInterface::ShowMessage(" The filename does not have absolute path\n"); #endif if (forInput) { // First search in GMAT working directory. // If GMAT directory is blank give some dummy name so that it can be failed to search if (gmatPath == "") tempPath1 = "__000_gmat_working_dir_is_blank_000__" + fullname; else tempPath1 = gmatPath + fullname; #ifdef DEBUG_FIND_INPUT_PATH MessageInterface::ShowMessage(" => first search Path = '%s'\n", tempPath1.c_str()); #endif if (GmatFileUtil::DoesFileExist(tempPath1)) { pathToReturn = tempPath1; } else { #ifdef DEBUG_FIND_INPUT_PATH MessageInterface::ShowMessage (" '%s' does not exist, so search in default path\n", tempPath1.c_str()); MessageInterface::ShowMessage (" BinDirectory = '%s'\n", mAbsBinDir.c_str()); MessageInterface::ShowMessage (" CurrentWorkingDirectory = '%s'\n", GetCurrentWorkingDirectory().c_str()); #endif if (GmatFileUtil::IsPathRelative(fullname)) tempPath2 = mAbsBinDir + fullname; else tempPath2 = defaultPath + fullname; #ifdef DEBUG_FIND_INPUT_PATH MessageInterface::ShowMessage (" => next search path = '%s' \n", tempPath2.c_str()); #endif if (writeWarning && gmatPath != "" && writeFilePathInfo) MessageInterface::ShowMessage ("The input file '%s' does not exist in GMAT " "working directory\n '%s', so trying default path from the " "startup file\n '%s'\n", fullname.c_str(), tempPath1.c_str(), tempPath2.c_str()); if (GmatFileUtil::DoesFileExist(tempPath2)) { pathToReturn = tempPath2; } else { pathToReturn = ""; if (writeWarning && gmatPath != "" && writeFilePathInfo) MessageInterface::ShowMessage ("*** WARNING *** The input file '%s' does not exist in default " "path from the startup file '%s'\n", fullname.c_str(), tempPath2.c_str()); } } } else // for output { if (GmatFileUtil::IsPathRelative(fullname)) { #ifdef DEBUG_FIND_OUTPUT_PATH MessageInterface::ShowMessage(" The output filename has relative path\n"); #endif // Check GMAT working (script) directory std::string tempPath = gmatPath + fullname; std::string outPath1 = GmatFileUtil::ParsePathName(tempPath); #ifdef DEBUG_FIND_OUTPUT_PATH MessageInterface::ShowMessage(" Checking if '%s' exist...\n", outPath1.c_str()); #endif if (DoesDirectoryExist(outPath1, false)) { pathToReturn = tempPath; } else { tempPath = defaultPath + fullname; std::string outPath2 = GmatFileUtil::ParsePathName(tempPath); #ifdef DEBUG_FIND_OUTPUT_PATH MessageInterface::ShowMessage (" '%s' does not exist.\n So checking if '%s' exist ...\n", outPath1.c_str(), outPath2.c_str()); #endif if (DoesDirectoryExist(outPath2, false)) { pathToReturn = tempPath; } else { pathToReturn = mAbsBinDir + fileOnly; #ifdef DEBUG_FIND_OUTPUT_PATH MessageInterface::ShowMessage (" '%s' does not exist.\n So set to use bin directory '%s'\n", outPath2.c_str(), mAbsBinDir.c_str()); #endif } } } else // filename without any path { if (DoesDirectoryExist(defaultPath, false)) pathToReturn = defaultPath + fullname; else pathToReturn = mAbsBinDir + fullname; } } } // Write info only if file path debug is on from the startup file (LOJ: 2014.09.22) // Write information about file location if file path debug mode is on std::string ioType = "output"; std::string fType = ""; std::string rwType = "written to"; std::string oName = ""; if (fileType.find("_FILE") != fileType.npos) fType = fileType + " "; if (forInput) { ioType = "input"; rwType = "read from"; } if (objName != "") oName = " for the object '" + objName + "'"; // Write message where output goes or input from if (pathToReturn != "") { if (writeFilePathInfo) MessageInterface::ShowMessage ("*** The %s %sfile '%s'%s will be %s \n '%s'\n", ioType.c_str(), fType.c_str(), fullname.c_str(), oName.c_str(), rwType.c_str(), pathToReturn.c_str()); } else { mLastFilePathMessage = "Cannot open " + ioType + " " + fType + "'" + fullname + "'"; if (writeFilePathInfo) MessageInterface::ShowMessage(mLastFilePathMessage + "\n"); } #ifdef DEBUG_FIND_PATH MessageInterface::ShowMessage ("FileManager::FindPath() returning '%s'\n", pathToReturn.c_str()); #endif return pathToReturn; } // FindPath() //------------------------------------------------------------------------------ // std::string FindMainIconFile(bool writeInfo = true) //------------------------------------------------------------------------------ std::string FileManager::FindMainIconFile(bool writeInfo) { // Changed not to write warning per GMAT session (LOJ: 2014.10.29) #ifdef __WRITE_WARNING_PER_SESSION_ static bool writeWarning = true; std::string fullpath = FindPath("", MAIN_ICON_FILE, true, writeWarning, writeInfo); if (mGmatWorkingDir != "") writeWarning = false; #else std::string fullpath = FindPath("", MAIN_ICON_FILE, true, false, writeInfo); #endif return fullpath; } //------------------------------------------------------------------------------ // std::string GetPathSeparator() //------------------------------------------------------------------------------ /** * @return path separator; "/" or "\\" dependends on the platform */ //------------------------------------------------------------------------------ std::string FileManager::GetPathSeparator() { // Changed back to return FileUtil::GetPathSeparator(); (LOJ: 2014.06.09) // Just return "/" for all operating system for consistency (LOJ: 2011.03.18) //return "/"; return GmatFileUtil::GetPathSeparator(); } //------------------------------------------------------------------------------ // bool DoesDirectoryExist(const std::string &dirPath, bool isBlankOk = true) //------------------------------------------------------------------------------ /* * @return true If directory exist, false otherwise */ //------------------------------------------------------------------------------ bool FileManager::DoesDirectoryExist(const std::string &dirPath, bool isBlankOk) { return GmatFileUtil::DoesDirectoryExist(dirPath, isBlankOk); } //------------------------------------------------------------------------------ // bool DoesFileExist(const std::string &filename) //------------------------------------------------------------------------------ bool FileManager::DoesFileExist(const std::string &filename) { return GmatFileUtil::DoesFileExist(filename); } //------------------------------------------------------------------------------ // bool RenameFile(const std::string &oldName, const std::string &newName, // Integer &retCode, bool overwriteIfExists = false) //------------------------------------------------------------------------------ bool FileManager::RenameFile(const std::string &oldName, const std::string &newName, Integer &retCode, bool overwriteIfExists) { retCode = 0; bool oldExists = DoesFileExist(oldName); bool newExists = DoesFileExist(newName); #ifdef DEBUG_FILE_RENAME MessageInterface::ShowMessage("FM::Rename, old file (%s) exists = %s\n", oldName.c_str(), (oldExists? "true" : "false")); MessageInterface::ShowMessage("FM::Rename, new file (%s) exists = %s\n", newName.c_str(), (newExists? "true" : "false")); #endif // if a file with the old name does not exist, we cannot do anything if (!oldExists) { std::string errmsg = "Error renaming file \""; errmsg += oldName + "\" to \""; errmsg += newName + "\": file \""; errmsg += oldName + "\" does not exist.\n"; throw UtilityException(errmsg); } // if a file with the new name does not exist, or exists but we are // supposed to overwrite it, try to do the rename if ((!newExists) || (newExists && overwriteIfExists)) { #ifdef DEBUG_FILE_RENAME MessageInterface::ShowMessage("FM::Rename, attempting to rename %s to %s\n", oldName.c_str(), newName.c_str()); #endif retCode = rename(oldName.c_str(), newName.c_str()); // overwriting is platform-dependent!!!! if (retCode == 0) { return true; } else { return false; } } else // it exists but we are not to overwrite it return false; } //------------------------------------------------------------------------------ // bool CopyFile(const std::string &oldName, const std::string &newName, // Integer &retCode, bool overwriteIfExists = false) //------------------------------------------------------------------------------ bool FileManager::CopyFile(const std::string &oldName, const std::string &newName, Integer &retCode, bool overwriteIfExists) { retCode = 0; if (oldName == newName) return true; bool oldExists = DoesFileExist(oldName); bool newExists = DoesFileExist(newName); #ifdef DEBUG_FILE_RENAME MessageInterface::ShowMessage("FM::Copy, old file (%s) exists = %s\n", oldName.c_str(), (oldExists? "true" : "false")); MessageInterface::ShowMessage("FM::Copy, new file (%s) exists = %s\n", newName.c_str(), (newExists? "true" : "false")); #endif // if a file with the old name does not exist, we cannot do anything if (!oldExists) { std::string errmsg = "Error copying file \""; errmsg += oldName + "\" to \""; errmsg += newName + "\": file \""; errmsg += oldName + "\" does not exist.\n"; throw UtilityException(errmsg); } // if a file with the new name does not exist, or exists but we are // supposed to overwrite it, try to do the rename if ((!newExists) || (newExists && overwriteIfExists)) { #ifdef DEBUG_FILE_RENAME MessageInterface::ShowMessage("FM::Copy, attempting to copy %s to %s\n", oldName.c_str(), newName.c_str()); #endif std::ifstream src(oldName.c_str(), std::ios::binary); std::ofstream dest(newName.c_str(), std::ios::binary); dest << src.rdbuf(); retCode = src && dest; return retCode == 1; } else // it exists but we are not to overwrite it return false; } //------------------------------------------------------------------------------ // std::string GetStartupFileDir() //------------------------------------------------------------------------------ /* * Returns startup file directory without name. */ //------------------------------------------------------------------------------ std::string FileManager::GetStartupFileDir() { return mStartupFileDir; } //------------------------------------------------------------------------------ // std::string GetStartupFileName() //------------------------------------------------------------------------------ /* * Returns startup file name without directory. */ //------------------------------------------------------------------------------ std::string FileManager::GetStartupFileName() { return mStartupFileName; } //------------------------------------------------------------------------------ // std::string GetFullStartupFilePath() //------------------------------------------------------------------------------ /* * Returns startup file directory and name */ //------------------------------------------------------------------------------ std::string FileManager::GetFullStartupFilePath() { #ifdef DEBUG_STARTUP_FILE MessageInterface::ShowMessage ("FileManager::GetFullStartupFilePath() mStartupFileDir='%s', " "mStartupFileName='%s'\n", mStartupFileDir.c_str(), mStartupFileName.c_str()); #endif if (mStartupFileDir == "") return mStartupFileName; else { mStartupFileDir = GmatFileUtil::GetCurrentWorkingDirectory() + mPathSeparator; return mStartupFileDir + mStartupFileName; } } //void FileManager::ReadStartupFile(const char *fileName) //{ // ReadStartupFile(std::string(fileName)); //} //------------------------------------------------------------------------------ // void ReadStartupFile(const std::string &fileName = "") //------------------------------------------------------------------------------ /** * Reads GMAT startup file. * * @param <fileName> startup file name. * */ //------------------------------------------------------------------------------ void FileManager::ReadStartupFile(const std::string &fileName) { #ifdef DEBUG_READ_STARTUP_FILE MessageInterface::ShowMessage ("FileManager::ReadStartupFile() entered, fileName='%s'\n", fileName.c_str()); #endif RefreshFiles(); // Set bin directory SetBinDirectory(); // get current path and application path std::string currPath = GmatFileUtil::GetCurrentWorkingDirectory(); std::string appFullPath = GmatFileUtil::GetApplicationPath(); #ifdef DEBUG_READ_STARTUP_FILE MessageInterface::ShowMessage(" currPath = '%s'\n", currPath.c_str()); MessageInterface::ShowMessage(" appFullPath = '%s'\n", appFullPath.c_str()); #endif std::string line; mSavedComments.clear(); std::string tmpStartupDir; std::string tmpStartupFile; std::string tmpStartupFilePath; if (GmatFileUtil::DoesFileExist(fileName)) { #ifdef DEBUG_READ_STARTUP_FILE MessageInterface::ShowMessage(" startup file '%s' exist.\n", fileName.c_str()); #endif tmpStartupFilePath = fileName; } else { #ifdef DEBUG_READ_STARTUP_FILE MessageInterface::ShowMessage (" startup file '%s' does not exist, \n so look in bin directory '%s'\n", fileName.c_str(), appFullPath.c_str()); #endif // Search application directory for startup file std::string appPath = GmatFileUtil::ParsePathName(appFullPath); std::string newPath = appPath + "gmat_startup_file.txt"; #ifdef DEBUG_READ_STARTUP_FILE MessageInterface::ShowMessage(" appPath = '%s'\n", appPath.c_str()); MessageInterface::ShowMessage(" new startup file path = '%s'\n", newPath.c_str()); #endif if (GmatFileUtil::DoesFileExist(newPath)) { tmpStartupFilePath = newPath; // set current directory to new path if (SetCurrentWorkingDirectory(appPath)) { MessageInterface::ShowMessage ("GMAT working directory set to '%s'\n", appPath.c_str()); } else { UtilityException ue; ue.SetDetails("FileManager::ReadStartupFile() cannot set working " "directory to: \"%s\"", appPath.c_str()); throw ue; } } else { tmpStartupFilePath = newPath; } } tmpStartupDir = GmatFileUtil::ParsePathName(tmpStartupFilePath); tmpStartupFile = GmatFileUtil::ParseFileName(tmpStartupFilePath); #ifdef DEBUG_READ_STARTUP_FILE MessageInterface::ShowMessage(" tmpStartupDir = '%s'\n", tmpStartupDir.c_str()); MessageInterface::ShowMessage(" tmpStartupFile = '%s'\n", tmpStartupFile.c_str()); #endif if (tmpStartupDir == "") tmpStartupFilePath = tmpStartupFile; else tmpStartupFilePath = tmpStartupDir + mPathSeparator + tmpStartupFile; // // Reworked this part above so removed(LOJ: 2011.12.14) // #if 0 // if (fileName == "") // { // tmpStartupDir = ""; // tmpStartupFile = mStartupFileName; // tmpStartupFilePath = mStartupFileName; // } // else // { // tmpStartupDir = GmatFileUtil::ParsePathName(fileName); // tmpStartupFile = GmatFileUtil::ParseFileName(fileName); // // if (tmpStartupDir == "") // tmpStartupFilePath = tmpStartupFile; // else // tmpStartupFilePath = tmpStartupDir + mPathSeparator + tmpStartupFile; // } // #endif #ifdef DEBUG_READ_STARTUP_FILE MessageInterface::ShowMessage ("FileManager::ReadStartupFile() reading '%s'\n", tmpStartupFilePath.c_str()); #endif std::ifstream mInStream(tmpStartupFilePath.c_str()); if (!mInStream) { UtilityException ue; ue.SetDetails("FileManager::ReadStartupFile() cannot open GMAT startup " "file: \"%s\"", tmpStartupFilePath.c_str()); throw ue; } // Read startup file while (!mInStream.eof()) { // Use cross-platform GetLine GmatFileUtil::GetLine(&mInStream, line); #ifdef DEBUG_READ_STARTUP_FILE MessageInterface::ShowMessage("line=%s\n", line.c_str()); #endif // Skip empty line or comment line if (line.length() > 0) // Crashes in VS 2010 debugger without this { if (line[0] == '\0' || line[0] == '#') { // save line with ## in the first col if (line.size() > 1 && line[1] == '#') mSavedComments.push_back(line); continue; } } else continue; std::string type, equal, name; std::stringstream ss(""); ss << line; ss >> type >> equal; if (equal != "=") { mInStream.close(); throw UtilityException ("FileManager::ReadStartupFile() expecting '=' at line:\n" + std::string(line) + "\n"); } // To fix bug 1916 (LOJ: 2010.10.08) // Since >> uses space as deliminter, we cannot use it. // So use GmatStringUtil::DecomposeBy() instead. //ss >> name; StringArray parts = GmatStringUtil::DecomposeBy(line, "="); name = parts[1]; name = GmatStringUtil::Trim(name); #ifdef DEBUG_READ_STARTUP_FILE MessageInterface::ShowMessage("type=%s, name=%s\n", type.c_str(), name.c_str()); #endif if (type == "RUN_MODE") { mRunMode = name; if (name == "TESTING") GmatGlobal::Instance()->SetRunMode(GmatGlobal::TESTING); else if (name == "TESTING_NO_PLOTS") GmatGlobal::Instance()->SetRunMode(GmatGlobal::TESTING_NO_PLOTS); else if (name == "EXIT_AFTER_RUN") GmatGlobal::Instance()->SetRunMode(GmatGlobal::EXIT_AFTER_RUN); } else if (type == "PLOT_MODE") { mPlotMode = name; if (name == "TILE") GmatGlobal::Instance()->SetPlotMode(GmatGlobal::TILED_PLOT); } else if (type == "MATLAB_MODE") { mMatlabMode = name; if (name == "SINGLE") GmatGlobal::Instance()->SetMatlabMode(GmatGlobal::SINGLE_USE); else if (name == "SHARED") GmatGlobal::Instance()->SetMatlabMode(GmatGlobal::SHARED); else if (name == "NO_MATLAB") GmatGlobal::Instance()->SetMatlabMode(GmatGlobal::NO_MATLAB); } else if (type == "DEBUG_MATLAB") { if (name == "ON") { mDebugMatlab = name; GmatGlobal::Instance()->SetMatlabDebug(true); } } else if (type == "DEBUG_MISSION_TREE") { if (name == "ON") { mDebugMissionTree = name; GmatGlobal::Instance()->SetMissionTreeDebug(true); } } else if (type == "DEBUG_PARAMETERS") { if (name == "ON") { mWriteParameterInfo = name; GmatGlobal::Instance()->SetWriteParameterInfo(true); } } else if (type == "DEBUG_FILE_PATH") { if (name == "ON") { mWriteFilePathInfo = name; GmatGlobal::Instance()->SetWriteFilePathInfo(true); } } else if (type == "WRITE_GMAT_KEYWORD") { if (name == "OFF") { mWriteGmatKeyword = name; GmatGlobal::Instance()->SetWriteGmatKeyword(false); } } else if (type == "WRITE_PERSONALIZATION_FILE") { if (name == "ON") GmatGlobal::Instance()->SetWritePersonalizationFile(true); else GmatGlobal::Instance()->SetWritePersonalizationFile(false); } else if (type == "HIDE_SAVEMISSION") { if (name == "TRUE") GmatGlobal::Instance()->AddHiddenCommand("SaveMission"); else GmatGlobal::Instance()->RemoveHiddenCommand("SaveMission"); } else if (type == "ECHO_COMMANDS") { if (name == "TRUE") GmatGlobal::Instance()->SetCommandEchoMode(true); else GmatGlobal::Instance()->SetCommandEchoMode(false); } else if (type == "NO_SPLASH") { if (name == "TRUE") GmatGlobal::Instance()->SetSkipSplashMode(true); else GmatGlobal::Instance()->SetSkipSplashMode(false); } else { // Ignore old VERSION specification (2011.03.18) if (type != "VERSION") AddFileType(type, name); } } // end While() // Since we set all output to ./ as default, we don't need this (LOJ: 2011.03.17) // Set VEHICLE_EPHEM_CCSDS_PATH to OUTPUT_PATH from the startup file if not set // so that ./output directory is not required when writing the ephemeris file. // if (mPathMap["VEHICLE_EPHEM_CCSDS_PATH"] == "./output/" && // mPathMap["OUTPUT_PATH"] != "./files/output/") // { // mPathMap["VEHICLE_EPHEM_CCSDS_PATH"] = mPathMap["OUTPUT_PATH"]; // #ifdef DEBUG_READ_STARTUP_FILE // MessageInterface::ShowMessage // ("==> VEHICLE_EPHEM_CCSDS_PATH set to '%s'\n", mPathMap["VEHICLE_EPHEM_CCSDS_PATH"].c_str()); // #endif // } // add potential files by type names AddAvailablePotentialFiles(); // save good startup file mStartupFileDir = tmpStartupDir; mStartupFileName = tmpStartupFile; // Check first to see if the user has set a log file on the command line - // that would take prcedence over a log file specified in the startup // file. Also, check to see if the command-line-specified file exists and // if so, make sure it is a log file (i.e. starts with the correct text). // TBD // now use log file from the startup file if applicable std::string startupLog = GetAbsPathname("LOG_FILE"); GmatGlobal *gmatGlobal = GmatGlobal::Instance(); gmatGlobal->SetLogfileName(GmatGlobal::STARTUP, startupLog); Integer logSrc = gmatGlobal->GetLogfileSource(); if (logSrc == GmatGlobal::CMD_LINE) { std::string cmdLineLog = gmatGlobal->GetLogfileName(GmatGlobal::CMD_LINE); MessageInterface::SetLogFile(cmdLineLog); } else // can't be SCRIPT yet since startup is read before scripts are parsed { MessageInterface::SetLogFile(startupLog); } MessageInterface::SetLogEnable(true); mInStream.close(); /// @todo This code replaces relative paths with absolute. It was implemented to /// address an issue in R2014a, but the side effects were to severe for /// the release. It is commented out so that post release, we can asses how /// to proceed addressing path issues in GMAT. // SetPathsAbsolute(); // Validate PATHs ValidatePaths(); #ifdef DEBUG_MAPPING ShowMaps("In ReadStartupFile()"); #endif } //void FileManager::WriteStartupFile(const char *fileName) //{ // WriteStartupFile(std::string(fileName)); //} //------------------------------------------------------------------------------ // void WriteStartupFile(const std::string &fileName = "") //------------------------------------------------------------------------------ /** * Reads GMAT startup file. * * @param <fileName> startup file name. * * @exception UtilityException thrown if file cannot be opened */ //------------------------------------------------------------------------------ void FileManager::WriteStartupFile(const std::string &fileName) { std::string outFileName = "gmat_startup_file.new.txt"; mPathWrittenOuts.clear(); mFileWrittenOuts.clear(); if (fileName != "") outFileName = fileName; #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage ("FileManager::WriteStartupFile() entered, outFileName = %s\n", outFileName.c_str()); #endif std::ofstream outStream(outFileName.c_str()); if (!outStream) throw UtilityException ("FileManager::WriteStartupFile() cannot open:" + fileName); //--------------------------------------------- // write header //--------------------------------------------- WriteHeader(outStream); // set left justified outStream.setf(std::ios::left); // don't write CURRENT_PATH mPathWrittenOuts.push_back("CURRENT_PATH"); //--------------------------------------------- // write RUN_MODE if not blank //--------------------------------------------- if (mRunMode != "") { #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing RUN_MODE\n"); #endif outStream << std::setw(22) << "RUN_MODE" << " = " << mRunMode << "\n"; } // Write other option as comments outStream << std::setw(22) << "#RUN_MODE" << " = TESTING\n"; outStream << std::setw(22) << "#RUN_MODE" << " = TESTING_NO_PLOTS\n"; outStream << std::setw(22) << "#RUN_MODE" << " = EXIT_AFTER_RUN\n"; //--------------------------------------------- // write PLOT_MODE if not blank //--------------------------------------------- if (mPlotMode != "") { #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing PLOT_MODE\n"); #endif outStream << std::setw(22) << "PLOT_MODE" << " = " << mRunMode << "\n"; } // Write other option as comments // There are no other options implemented for now //outStream << std::setw(22) << "#PLOT_MODE" << " = TILE\n"; //--------------------------------------------- // write MATLAB_MODE if not blank //--------------------------------------------- if (mMatlabMode != "") { #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing MATLAB_MODE\n"); #endif outStream << std::setw(22) << "MATLAB_MODE" << " = " << mMatlabMode << "\n"; } // Write other option as comments outStream << std::setw(22) << "#MATLAB_MODE" << " = SINGLE\n"; outStream << std::setw(22) << "#MATLAB_MODE" << " = SHARED\n"; outStream << std::setw(22) << "#MATLAB_MODE" << " = NO_MATLAB\n"; //--------------------------------------------- // write DEBUG_MATLAB if not blank //--------------------------------------------- if (mDebugMatlab != "") { #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing DEBUG_MATLAB\n"); #endif outStream << std::setw(22) << "DEBUG_MATLAB" << " = " << mDebugMatlab << "\n"; } //--------------------------------------------- // write DEBUG_MISSION_TREE if not blank //--------------------------------------------- if (mDebugMissionTree != "") { #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing DEBUG_MISSION_TREE\n"); #endif outStream << std::setw(22) << "DEBUG_MISSION_TREE" << " = " << mDebugMissionTree << "\n"; } if (mRunMode != "" || mPlotMode != "" || mMatlabMode != "" || mDebugMatlab != "" || mDebugMissionTree != "") outStream << "#-----------------------------------------------------------\n"; //--------------------------------------------- // write DEBUG_PARAMETERS if not blank //--------------------------------------------- if (mWriteParameterInfo != "") { #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing PARAMETER_INFO\n"); #endif outStream << std::setw(22) << "DEBUG_PARAMETERS" << " = " << mWriteParameterInfo << "\n"; } if (mRunMode != "" || mPlotMode != "" || mMatlabMode != "" || mDebugMatlab != "" || mDebugMissionTree != "" || mWriteParameterInfo != "") outStream << "#-----------------------------------------------------------\n"; //--------------------------------------------- // write DEBUG_FILE_PATH if not blank //--------------------------------------------- if (mWriteFilePathInfo != "") { #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing FILE_PATH_INFO\n"); #endif outStream << std::setw(22) << "DEBUG_FILE_PATH" << " = " << mWriteFilePathInfo << "\n"; } if (mRunMode != "" || mPlotMode != "" || mMatlabMode != "" || mDebugMatlab != "" || mDebugMissionTree != "" || mWriteParameterInfo != "" || mWriteFilePathInfo != "") outStream << "#-----------------------------------------------------------\n"; //--------------------------------------------- // write WRITE_GMAT_KEYWORD if not blank //--------------------------------------------- if (mWriteGmatKeyword != "") { #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing GMAT_KEYWORD_INFO\n"); #endif outStream << std::setw(22) << "WRITE_GMAT_KEYWORD" << " = " << mWriteGmatKeyword << "\n"; } if (mRunMode != "" || mPlotMode != "" || mMatlabMode != "" || mDebugMatlab != "" || mDebugMissionTree != "" || mWriteParameterInfo != "" || mWriteFilePathInfo != "" || mWriteGmatKeyword != "" ) outStream << "#-----------------------------------------------------------\n"; //--------------------------------------------- // write ROOT_PATH next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing ROOT_PATH path\n"); #endif outStream << std::setw(22) << "ROOT_PATH" << " = " << mPathMap["ROOT_PATH"] << "\n"; outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("ROOT_PATH"); //--------------------------------------------- // write PLUGIN next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing PLUGIN\n"); #endif if (mPluginList.size() > 0) { for (UnsignedInt i = 0; i < mPluginList.size(); ++i) { outStream << std::setw(22) << "PLUGIN" << " = " << mPluginList[i] << "\n"; } outStream << "#-----------------------------------------------------------\n"; } //--------------------------------------------- // write OUTPUT_PATH and output files next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing OUTPUT_PATH paths\n"); #endif outStream << std::setw(22) << "OUTPUT_PATH" << " = " << mPathMap["OUTPUT_PATH"] << "\n"; WriteFiles(outStream, "LOG_"); WriteFiles(outStream, "REPORT_"); WriteFiles(outStream, "SCREENSHOT_"); outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("OUTPUT_PATH"); //--------------------------------------------- // write MEASUREMENT_PATH next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing MEASUREMENT_PATH paths\n"); #endif outStream << std::setw(22) << "MEASUREMENT_PATH" << " = " << mPathMap["MEASUREMENT_PATH"] << "\n"; outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("MEASUREMENT_PATH"); //--------------------------------------------- // write the VEHICLE_EPHEM_CCSDS_PATH next if set //--------------------------------------------- if (mPathMap["VEHICLE_EPHEM_CCSDS_PATH"] != "./output/") { #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing VEHICLE_EPHEM_CCSDS_PATH path\n"); #endif outStream << std::setw(22) << "VEHICLE_EPHEM_CCSDS_PATH" << " = " << mPathMap["VEHICLE_EPHEM_CCSDS_PATH"]; outStream << "\n#---------------------------------------------" "--------------\n"; mPathWrittenOuts.push_back("VEHICLE_EPHEM_CCSDS_PATH"); } //--------------------------------------------- // write GMAT_INCLUDE_PATH next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing GMAT_INCLUDE_PATH paths\n"); #endif bool isEmptyPath = true; for (std::map<std::string, std::string>::iterator pos = mPathMap.begin(); pos != mPathMap.end(); ++pos) { if (pos->first == "GMAT_INCLUDE_PATH") { // Write all GmatInclude paths std::list<std::string>::iterator listpos = mGmatIncludePaths.begin(); while (listpos != mGmatIncludePaths.end()) { outStream << std::setw(22) << pos->first << " = " << *listpos << "\n"; ++listpos; } isEmptyPath = false; break; } } if (isEmptyPath) outStream << std::setw(22) << "#GMAT_INCLUDE_PATH " << " = " << "\n"; outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("GMAT_INCLUDE_PATH"); //--------------------------------------------- // write GMAT_FUNCTION_PATH next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing GMAT_FUNCTION_PATH paths\n"); #endif isEmptyPath = true; for (std::map<std::string, std::string>::iterator pos = mPathMap.begin(); pos != mPathMap.end(); ++pos) { if (pos->first == "GMAT_FUNCTION_PATH") { // Write all GmatFunction paths std::list<std::string>::iterator listpos = mGmatFunctionPaths.begin(); while (listpos != mGmatFunctionPaths.end()) { outStream << std::setw(22) << pos->first << " = " << *listpos << "\n"; ++listpos; } isEmptyPath = false; break; } } if (isEmptyPath) outStream << std::setw(22) << "#GMAT_FUNCTION_PATH " << " = " << "\n"; outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("GMAT_FUNCTION_PATH"); //--------------------------------------------- // write MATLAB_FUNCTION_PATH next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing MATLAB_FUNCTION_PATH paths\n"); #endif isEmptyPath = true; for (std::map<std::string, std::string>::iterator pos = mPathMap.begin(); pos != mPathMap.end(); ++pos) { if (pos->first == "MATLAB_FUNCTION_PATH") { // Write all GmatFunction paths std::list<std::string>::iterator listpos = mMatlabFunctionPaths.begin(); while (listpos != mMatlabFunctionPaths.end()) { outStream << std::setw(22) << pos->first << " = " << *listpos << "\n"; ++listpos; } break; } } if (isEmptyPath) outStream << std::setw(22) << "#MATLAB_FUNCTION_PATH " << " = " << "\n"; outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("MATLAB_FUNCTION_PATH"); //--------------------------------------------- // write DATA_PATH next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing DATA_PATH path\n"); #endif outStream << std::setw(22) << "DATA_PATH" << " = " << mPathMap["DATA_PATH"] << "\n"; outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("DATA_PATH"); //--------------------------------------------- // write any relative path used in PLANETARY_EPHEM_SPK_PATH //--------------------------------------------- std::string spkPath = mPathMap["PLANETARY_EPHEM_SPK_PATH"]; if (spkPath.find("_PATH") != spkPath.npos) { std::string relPath = GmatFileUtil::ParseFirstPathName(spkPath, false); if (find(mPathWrittenOuts.begin(), mPathWrittenOuts.end(), relPath) == mPathWrittenOuts.end()) { #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing %s\n", relPath.c_str()); #endif outStream << std::setw(22) << relPath << " = " << mPathMap[relPath] << "\n"; outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back(relPath); } } //--------------------------------------------- // write the PLANETARY_EPHEM_SPK_PATH and SPK file next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing SPK path\n"); #endif outStream << std::setw(22) << "PLANETARY_EPHEM_SPK_PATH" << " = " << mPathMap["PLANETARY_EPHEM_SPK_PATH"] << "\n"; WriteFiles(outStream, "PLANETARY SPK"); outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("PLANETARY_EPHEM_SPK_PATH"); //--------------------------------------------- // write the PLANETARY_EPHEM_DE_PATH and DE file next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing DE path\n"); #endif outStream << std::setw(22) << "PLANETARY_EPHEM_DE_PATH" << " = " << mPathMap["PLANETARY_EPHEM_DE_PATH"] << "\n"; WriteFiles(outStream, "DE405"); outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("PLANETARY_EPHEM_DE_PATH"); //--------------------------------------------- // write the PLANETARY_COEFF_PATH and files next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing PLANETARY_COEFF_PATH path\n"); #endif outStream << std::setw(22) << "PLANETARY_COEFF_PATH" << " = " << mPathMap["PLANETARY_COEFF_PATH"] << "\n"; WriteFiles(outStream, "EOP_FILE"); WriteFiles(outStream, "PLANETARY_COEFF_FILE"); WriteFiles(outStream, "NUTATION_COEFF_FILE"); WriteFiles(outStream, "PLANETARY_PCK_FILE"); WriteFiles(outStream, "EARTH_LATEST_PCK_FILE"); WriteFiles(outStream, "EARTH_PCK_PREDICTED_FILE"); WriteFiles(outStream, "EARTH_PCK_CURRENT_FILE"); WriteFiles(outStream, "LUNA_PCK_CURRENT_FILE"); WriteFiles(outStream, "LUNA_FRAME_KERNEL_FILE"); outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("PLANETARY_COEFF_PATH"); //--------------------------------------------- // write the TIME_PATH and TIME file next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing TIME path\n"); #endif outStream << std::setw(22) << "TIME_PATH" << " = " << mPathMap["TIME_PATH"] << "\n"; WriteFiles(outStream, "LEAP_"); WriteFiles(outStream, "LSK_"); outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("TIME_PATH"); //--------------------------------------------- // write the ATMOSPHERE_PATH and CSSI FLUX file next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing ATMOSPHERE path\n"); #endif outStream << std::setw(22) << "ATMOSPHERE_PATH" << " = " << mPathMap["ATMOSPHERE_PATH"] << "\n"; WriteFiles(outStream, "CSSI_FLUX_"); WriteFiles(outStream, "SCHATTEN_"); outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("ATMOSPHERE_PATH"); //--------------------------------------------- // write *_POT_PATH and files next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing *_POT_PATH paths\n"); #endif for (std::map<std::string, std::string>::iterator pos = mPathMap.begin(); pos != mPathMap.end(); ++pos) { if (pos->first.find("_POT_") != std::string::npos) { outStream << std::setw(22) << pos->first << " = " << pos->second << "\n"; mPathWrittenOuts.push_back(pos->first); } } outStream << "#-----------------------------------------------------------\n"; WriteFiles(outStream, "POT_FILE"); WriteFiles(outStream, "EGM96"); WriteFiles(outStream, "JGM"); WriteFiles(outStream, "MARS50C"); WriteFiles(outStream, "MGNP180U"); WriteFiles(outStream, "LP165P"); outStream << "#-----------------------------------------------------------\n"; //--------------------------------------------- // write the GUI_CONFIG_PATH and files next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing GUI_CONFIG_PATH path\n"); #endif outStream << std::setw(22) << "GUI_CONFIG_PATH" << " = " << mPathMap["GUI_CONFIG_PATH"] << "\n"; WriteFiles(outStream, "PERSONALIZATION_FILE"); outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("GUI_CONFIG_PATH"); //--------------------------------------------- // write the ICON_PATH and files next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing ICON_PATH path\n"); #endif outStream << std::setw(22) << "ICON_PATH" << " = " << mPathMap["ICON_PATH"] << "\n"; WriteFiles(outStream, "ICON_FILE"); outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("ICON_PATH"); //--------------------------------------------- // write the SPLASH_PATH and files next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing SPLASH_PATH path\n"); #endif outStream << std::setw(22) << "SPLASH_PATH" << " = " << mPathMap["SPLASH_PATH"] << "\n"; WriteFiles(outStream, "SPLASH_FILE"); outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("SPLASH_PATH"); //--------------------------------------------- // write the TEXTURE_PATH and files next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing TEXTURE_PATH path\n"); #endif outStream << std::setw(22) << "TEXTURE_PATH" << " = " << mPathMap["TEXTURE_PATH"] << "\n"; WriteFiles(outStream, "TEXTURE_FILE"); outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("TEXTURE_PATH"); //--------------------------------------------- // write the STAR_PATH and files next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing STAR_PATH path\n"); #endif outStream << std::setw(22) << "STAR_PATH" << " = " << mPathMap["STAR_PATH"] << "\n"; WriteFiles(outStream, "STAR_FILE"); WriteFiles(outStream, "CONSTELLATION_FILE"); outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("STAR_PATH"); //--------------------------------------------- // write the VEHICLE_EPHEM_SPK_PATH and files next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing VEHICLE_EPHEM_SPK_PATH path\n"); #endif outStream << std::setw(22) << "VEHICLE_EPHEM_SPK_PATH" << " = " << mPathMap["VEHICLE_EPHEM_SPK_PATH"] << "\n"; outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("VEHICLE_EPHEM_SPK_PATH"); //--------------------------------------------- // write the VEHICLE_MODEL_PATH and files next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing VEHICLE_MODEL_PATH path\n"); #endif outStream << std::setw(22) << "VEHICLE_MODEL_PATH" << " = " << mPathMap["VEHICLE_MODEL_PATH"] << "\n"; WriteFiles(outStream, "SPACECRAFT_MODEL_FILE"); outStream << "#-----------------------------------------------------------\n"; mPathWrittenOuts.push_back("VEHICLE_MODEL_PATH"); //--------------------------------------------- // write the HELP_FILE next //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing HELP_FILE\n"); #endif if (GetFilename("HELP_FILE") == "") outStream << std::setw(22) << "#HELP_FILE " << " = " << "\n"; else WriteFiles(outStream, "HELP_FILE"); outStream << "#-----------------------------------------------------------\n"; mFileWrittenOuts.push_back("HELP_FILE"); //--------------------------------------------- // write rest of paths and files //--------------------------------------------- #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing rest of paths and files\n"); #endif WriteFiles(outStream, "-OTHER-PATH-"); WriteFiles(outStream, "-OTHER-"); outStream << "#-----------------------------------------------------------\n"; //--------------------------------------------- // write saved comments //--------------------------------------------- if (!mSavedComments.empty()) { #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing saved comments\n"); #endif outStream << "# Saved Comments\n"; outStream << "#-----------------------------------------------------------\n"; for (UnsignedInt i=0; i<mSavedComments.size(); i++) outStream << mSavedComments[i] << "\n"; outStream << "#-----------------------------------------------------------\n"; } outStream << "\n"; outStream.close(); #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage("FileManager::WriteStartupFile() exiting\n"); #endif } //------------------------------------------------------------------------------ // std::string GetRootPath() //------------------------------------------------------------------------------ /** * Retrives root pathname. * * @return file pathname if path type found. */ //------------------------------------------------------------------------------ std::string FileManager::GetRootPath() { return mPathMap["ROOT_PATH"]; } //------------------------------------------------------------------------------ // bool GetTextureMapFile(const std::string &inFileName, const std::string &bodyName, // const std::string &objName, std::string &outFileName, // std::string &outFullPathName, bool writeWarning) //------------------------------------------------------------------------------ bool FileManager::GetTextureMapFile(const std::string &inFileName, const std::string &bodyName, const std::string &objName, std::string &outFileName, std::string &outFullPathName, bool writeWarning) { #ifdef DEBUG_TEXTURE_FILE MessageInterface::ShowMessage ("\nFileManager::GetTextureMapFile() entered\n inFileName = '%s'\n " "bodyName = '%s', objName = '%s', writeWarning = %d\n", inFileName.c_str(), bodyName.c_str(), objName.c_str(), writeWarning); #endif bool retval = true; std::string actualFile = inFileName; std::string fullPath; std::string mapFileType = GmatStringUtil::ToUpper(bodyName) + "_TEXTURE_FILE"; mLastFilePathMessage = ""; bool writeInfo = false; outFileName = inFileName; #ifdef DEBUG_TEXTURE_FILE MessageInterface::ShowMessage(" actualFile = '%s'\n", actualFile.c_str()); MessageInterface::ShowMessage(" mapFileType = '%s'\n", mapFileType.c_str()); #endif try { if (inFileName == "") actualFile = GetFilename(mapFileType); fullPath = FindPath(actualFile, mapFileType, true, writeWarning, writeInfo, objName); #ifdef DEBUG_TEXTURE_FILE MessageInterface::ShowMessage(" actualFile = '%s'\n", actualFile.c_str()); MessageInterface::ShowMessage(" fullPath = '%s'\n", fullPath.c_str()); #endif // If fullPath is blank, try with TEXTURE_PATH since non-standard bodies' // texture map file may not be available such as SOMECOMET1_TEXTURE_FILE if (fullPath == "") { fullPath = FindPath(actualFile, "TEXTURE_PATH", true, false, writeInfo, objName); } if (fullPath == "") { if (inFileName == "") { mLastFilePathMessage = GetLastFilePathMessage() + ", so using " + actualFile + "."; } else { mLastFilePathMessage = GetLastFilePathMessage(); retval = false; } } else if (inFileName == "") { outFileName = actualFile; std::string msg = "*** WARNING *** There is no texture map file " "specified for " + objName + ", so using " + actualFile; mLastFilePathMessage = msg; if (writeWarning) MessageInterface::ShowMessage(msg + "\n"); } outFullPathName = fullPath; } catch (BaseException &be) { #ifdef DEBUG_TEXTURE_FILE MessageInterface::ShowMessage("%s\n", be.GetFullMessage().c_str()); #endif if (inFileName == "") { actualFile = "GenericCelestialBody.jpg"; std::string msg = "*** WARNING *** There is no texture map file " "specified for " + objName + ", so using " + actualFile; mLastFilePathMessage = msg; if (writeWarning) MessageInterface::ShowMessage(msg + "\n"); fullPath = FileManager::Instance()->FindPath(actualFile, "TEXTURE_PATH", true, false, writeInfo, objName); outFileName = actualFile; outFullPathName = fullPath; } else { outFullPathName = ""; retval = false; } } #ifdef DEBUG_TEXTURE_FILE MessageInterface::ShowMessage (" outFileName = '%s'\n outFullPathName = '%s'\n mLastFilePathMessage = '%s'\n", outFileName.c_str(), outFullPathName.c_str(), mLastFilePathMessage.c_str()); MessageInterface::ShowMessage("FileManager::GetTextureMapFile() returnng %d\n\n", retval); #endif return retval; } //------------------------------------------------------------------------------ // bool GetBody3dModelFile(const std::string &inFileName, const std::string &bodyName, // const std::string &objName, std::string &outFileName, // std::string &outFullPathName, bool writeWarning) //------------------------------------------------------------------------------ bool FileManager::GetBody3dModelFile(const std::string &inFileName, const std::string &bodyName, const std::string &objName, std::string &outFileName, std::string &outFullPathName, bool writeWarning) { #ifdef DEBUG_3DMODEL_FILE MessageInterface::ShowMessage ("\nFileManager::GetBody3dModelFile() entered\n inFileName = '%s'\n " "bodyName = '%s', objName = '%s', writeWarning = %d\n", inFileName.c_str(), bodyName.c_str(), objName.c_str(), writeWarning); #endif bool retval = true; std::string actualFile = inFileName; std::string fullPath; std::string modelFileType = GmatStringUtil::ToUpper(bodyName) + "3D_MODEL_FILE"; mLastFilePathMessage = ""; bool writeInfo = false; outFileName = inFileName; #ifdef DEBUG_3DMODEL_FILE MessageInterface::ShowMessage(" actualFile = '%s'\n", actualFile.c_str()); MessageInterface::ShowMessage(" modelFileType = '%s'\n", modelFileType.c_str()); #endif try { if (inFileName == "") actualFile = GetFilename(modelFileType); fullPath = FindPath(actualFile, modelFileType, true, writeWarning, writeInfo, objName); #ifdef DEBUG_3DMODEL_FILE MessageInterface::ShowMessage(" actualFile = '%s'\n", actualFile.c_str()); MessageInterface::ShowMessage(" fullPath = '%s'\n", fullPath.c_str()); #endif // If fullPath is blank, try with BODY_3D_MODEL_PATH since non-standard bodies' // 3d file may not be available such as SOMECOMET1_3D_MODEL_FILE if (fullPath == "") { fullPath = FindPath(actualFile, "BODY_3D_MODEL_PATH", true, false, writeInfo, objName); } if (fullPath == "") { if (inFileName == "") { mLastFilePathMessage = GetLastFilePathMessage() + ", so using " + actualFile + "."; } else { mLastFilePathMessage = GetLastFilePathMessage(); retval = false; } } else if (inFileName == "") { outFileName = actualFile; std::string msg = "*** WARNING *** There is no 3D model file " "specified for " + objName + ", so using " + actualFile; mLastFilePathMessage = msg; if (writeWarning) MessageInterface::ShowMessage(msg + "\n"); } outFullPathName = fullPath; } catch (BaseException &be) { #ifdef DEBUG_3DMODEL_FILE MessageInterface::ShowMessage("%s\n", be.GetFullMessage().c_str()); #endif if (inFileName == "") { actualFile = ""; std::string msg = "*** WARNING *** There is no 3d model file " "specified for " + objName + ", so using " + actualFile; mLastFilePathMessage = msg; if (writeWarning) MessageInterface::ShowMessage(msg + "\n"); fullPath = FileManager::Instance()->FindPath(actualFile, "BODY_3D_MODEL_PATH", true, false, writeInfo, objName); outFileName = actualFile; outFullPathName = fullPath; } else { outFullPathName = ""; retval = false; } } #ifdef DEBUG_3DMODEL_FILE MessageInterface::ShowMessage (" outFileName = '%s'\n outFullPathName = '%s'\n mLastFilePathMessage = '%s'\n", outFileName.c_str(), outFullPathName.c_str(), mLastFilePathMessage.c_str()); MessageInterface::ShowMessage("FileManager::GetBody3dModelFile() returnng %d\n\n", retval); #endif return retval; } //------------------------------------------------------------------------------ // std::string GetPathname(const FileType type) //------------------------------------------------------------------------------ /** * Retrives absolute path for the type without filename. * * @param <type> enum file type of which path to be returned. * * @return file pathname if path type found. * @exception thrown if enum type is out of bounds. */ //------------------------------------------------------------------------------ std::string FileManager::GetPathname(const FileType type) { if (type >=0 && type < FileTypeCount) return GetPathname(FILE_TYPE_STRING[type]); std::stringstream ss(""); ss << "FileManager::GetPathname() enum type: " << type << " is out of bounds\n"; throw UtilityException(ss.str()); } //------------------------------------------------------------------------------ // std::string GetPathname(const std::string &typeName) //------------------------------------------------------------------------------ /** * Retrives absolute pathname for the type name without filename. * * @param <typeName> file type name of which pathname to be returned. * * @return pathname if type found. * @exception thrown if type cannot be found. */ //------------------------------------------------------------------------------ std::string FileManager::GetPathname(const std::string &typeName) { std::string fileType = GmatStringUtil::ToUpper(typeName); #ifdef DEBUG_FILE_PATH MessageInterface::ShowMessage ("FileManager::GetPathname() entered, flleType='%s'\n", fileType.c_str()); #endif std::string pathname; bool nameFound = false; // if typeName contains _PATH if (fileType.find("_PATH") != fileType.npos) { if (mPathMap.find(fileType) != mPathMap.end()) { pathname = mPathMap[fileType]; nameFound = true; } } else { // typeName contains _FILE if (mFileMap.find(fileType) != mFileMap.end()) { pathname = mFileMap[fileType]->mPath; nameFound = true; } } if (nameFound) { #ifdef DEBUG_FILE_PATH MessageInterface::ShowMessage(" pathname = '%s'\n", pathname.c_str()); #endif // Replace relative path with absolute path std::string abspath = ConvertToAbsPath(pathname); #ifdef DEBUG_FILE_PATH MessageInterface::ShowMessage ("FileManager::GetPathname() returning '%s'\n", abspath.c_str()); #endif return abspath; } else { throw UtilityException("FileManager::GetPathname() file type: " + typeName + " is unknown\n"); } } //------------------------------------------------------------------------------ // std::string GetFilename(const FileType type) //------------------------------------------------------------------------------ /** * Retrives filename for the type without path. * * @param <type> enum file type of which filename to be returned. * * @return file filename if file type found * @exception thrown if enum type is out of bounds */ //------------------------------------------------------------------------------ std::string FileManager::GetFilename(const FileType type) { bool nameFound = false; std::string name; if (type >=0 && type < FileTypeCount) { name = GetFilename(FILE_TYPE_STRING[type]); nameFound = true; } if (nameFound) { name = GmatFileUtil::ParseFileName(name); return name; } std::stringstream ss(""); ss << "FileManager::GetFilename() enum type: " << type << " is out of bounds\n"; throw UtilityException(ss.str()); } //------------------------------------------------------------------------------ // std::string GetFilename(const std::string &typeName) //------------------------------------------------------------------------------ /** * Retrives filename for the type name without path. * * @param <type> file type name of which filename to be returned. * * @return file filename if file type found * @exception thrown if type cannot be found. */ //------------------------------------------------------------------------------ std::string FileManager::GetFilename(const std::string &typeName) { #ifdef DEBUG_GET_FILENAME MessageInterface::ShowMessage ("FileManager::GetFilename() entered, typeName = '%s'\n", typeName.c_str()); #endif bool nameFound = false; std::string name; if (mFileMap.find(typeName) != mFileMap.end()) { name = mFileMap[typeName]->mFile; nameFound = true; } if (nameFound) { name = GmatFileUtil::ParseFileName(name); #ifdef DEBUG_GET_FILENAME MessageInterface::ShowMessage ("FileManager::GetFilename() returning '%s'\n", name.c_str()); #endif return name; } throw UtilityException("FileManager::GetFilename() file type: " + typeName + " is unknown\n"); } //------------------------------------------------------------------------------ // std::string GetFullPathname(const FileType type) //------------------------------------------------------------------------------ /** * Retrieves full pathname for the type. * * @param <type> file type of which filename to be returned. * * @return file pathname if file type found * @exception thrown if enum type is out of bounds */ //------------------------------------------------------------------------------ std::string FileManager::GetFullPathname(const FileType type) { return GetAbsPathname(type); } //------------------------------------------------------------------------------ // std::string GetFullPathname(const std::string &typeName) //------------------------------------------------------------------------------ /** * Retrives full pathname for the type name. * * @param <type> file type name of which filename to be returned. * * @return file pathname if file type name found * @exception thrown if type cannot be found. */ //------------------------------------------------------------------------------ std::string FileManager::GetFullPathname(const std::string &typeName) { return GetAbsPathname(typeName); } //------------------------------------------------------------------------------ // std::string GetAbsPathname(const FileType type) //------------------------------------------------------------------------------ /** * Retrieves full pathname for the type. * * @param <type> file type of which filename to be returned. * * @return file pathname if file type found * @exception thrown if enum type is out of bounds */ //------------------------------------------------------------------------------ std::string FileManager::GetAbsPathname(const FileType type) { if (type >=0 && type < FileTypeCount) return GetAbsPathname(FILE_TYPE_STRING[type]); std::stringstream ss(""); ss << "FileManager::GetAbsPathname() enum type: " << type << " is out of bounds\n"; throw UtilityException(ss.str()); } //------------------------------------------------------------------------------ // std::string GetAbsPathname(const std::string &typeName) //------------------------------------------------------------------------------ /** * Retrieves full pathname for the type name. * * @param <type> file type name of which filename to be returned. * * @return file pathname if file type name found * @exception thrown if type cannot be found. */ //------------------------------------------------------------------------------ std::string FileManager::GetAbsPathname(const std::string &typeName) { std::string fileType = GmatStringUtil::ToUpper(typeName); std::string absPath; #ifdef DEBUG_ABS_PATH MessageInterface::ShowMessage ("FileManager::GetAbsPathname() typeName='%s', fileType='%s'\n", typeName.c_str(), fileType.c_str()); #endif // typeName contains _PATH if (fileType.find("_PATH") != fileType.npos) { if (mPathMap.find(fileType) != mPathMap.end()) { absPath = ConvertToAbsPath(fileType); #ifdef DEBUG_ABS_PATH MessageInterface::ShowMessage ("FileManager::GetAbsPathname() with _PATH returning '%s'\n", absPath.c_str()); #endif return absPath; } } else { if (mFileMap.find(fileType) != mFileMap.end()) { std::string path = GetPathname(fileType); absPath = path + mFileMap[fileType]->mFile; } else if (mFileMap.find(fileType + "_ABS") != mFileMap.end()) { absPath = mFileMap[typeName]->mFile; } #ifdef DEBUG_ABS_PATH MessageInterface::ShowMessage ("FileManager::GetAbsPathname() without _PATH returning '%s'\n", absPath.c_str()); #endif return absPath; } throw UtilityException (GmatStringUtil::ToUpper(typeName) + " not in the gmat_startup_file\n"); } //------------------------------------------------------------------------------ // std::string ConvertToAbsPath(const std::string &relPath, bool appendPathSep = true) //------------------------------------------------------------------------------ /** * Converts relative path to absolute path */ //------------------------------------------------------------------------------ std::string FileManager::ConvertToAbsPath(const std::string &relPath, bool appendPathSep) { #ifdef DEBUG_FILE_PATH MessageInterface::ShowMessage ("FileManager::ConvertToAbsPath() relPath='%s'\n", relPath.c_str()); #endif //std::string absPath = relPath; std::string absPath; bool startsWithSeparator = false; if ((relPath[0] == '\\') || (relPath[0] == '/')) startsWithSeparator = true; StringTokenizer st(relPath, "/\\"); StringArray allNames = st.GetAllTokens(); StringArray pathNames; #ifdef DEBUG_FILE_PATH Integer numNames = allNames.size(); MessageInterface::ShowMessage("There are %d names in relPath\n", numNames); for (int i = 0; i < numNames; i++) MessageInterface::ShowMessage(" allNames[%d] = '%s'\n", i, allNames[i].c_str()); #endif for (UnsignedInt i = 0; i < allNames.size(); i++) { std::string name = allNames[i]; #ifdef DEBUG_FILE_PATH MessageInterface::ShowMessage(" allNames[%d] = '%s'\n", i, name.c_str()); #endif absPath = name; if (GmatStringUtil::EndsWith(name, "_PATH")) { #ifdef DEBUG_FILE_PATH MessageInterface::ShowMessage(" _PATH found\n"); #endif if (mPathMap.find(name) != mPathMap.end()) absPath = mPathMap[name]; #ifdef DEBUG_FILE_PATH MessageInterface::ShowMessage(" 1st absPath = '%s'\n", absPath.c_str()); #endif // If _PATH found and it is not the same as original name, // Call ConvertToAbsPath() again if (absPath.find("_PATH") != absPath.npos && absPath != name) absPath = ConvertToAbsPath(absPath); #ifdef DEBUG_FILE_PATH MessageInterface::ShowMessage(" 2nd absPath = '%s'\n", absPath.c_str()); #endif pathNames.push_back(absPath); } else { #ifdef DEBUG_FILE_PATH MessageInterface::ShowMessage(" _PATH not found\n"); MessageInterface::ShowMessage(" absPath = '%s'\n", absPath.c_str()); #endif pathNames.push_back(absPath); } } absPath = ""; // For paths that already started with the separator (were already absolute paths) if (startsWithSeparator) absPath += mPathSeparator; for (UnsignedInt i = 0; i < pathNames.size(); i++) { if (i < pathNames.size() - 1) { if (GmatStringUtil::EndsWithPathSeparator(pathNames[i])) absPath = absPath + pathNames[i]; else absPath = absPath + pathNames[i] + "/"; } else { if (GmatStringUtil::EndsWithPathSeparator(pathNames[i])) absPath = absPath + pathNames[i]; else { if (appendPathSep) absPath = absPath + pathNames[i] + "/"; else absPath = absPath + pathNames[i]; } } } // Convert path to absolute by prepending bin dir (LOJ: 2014.06.18) if (absPath != "" && absPath[0] == '.') absPath = mAbsBinDir + absPath; // Conver to OS path name absPath = GmatFileUtil::ConvertToOsFileName(absPath); #ifdef DEBUG_FILE_PATH MessageInterface::ShowMessage ("FileManager::ConvertToAbsPath() returning '%s'\n", absPath.c_str()); #endif return absPath; } //------------------------------------------------------------------------------ // void SetAbsPathname(const FileType type, const char *newpath) //------------------------------------------------------------------------------ /** * Sets absoulute pathname for the type. * * @param <type> file type of which path to be set. * @param <newpath> new pathname. * * @exception thrown if enum type is out of bounds */ //------------------------------------------------------------------------------ void FileManager::SetAbsPathname(const FileType type, const char *newpath) { SetAbsPathname(type, std::string(newpath)); } //------------------------------------------------------------------------------ // void SetAbsPathname(const FileType type, const std::string &newpath) //------------------------------------------------------------------------------ /** * Sets absoulute pathname for the type. * * @param <type> file type of which path to be set. * @param <newpath> new pathname. * * @exception thrown if enum type is out of bounds */ //------------------------------------------------------------------------------ void FileManager::SetAbsPathname(const FileType type, const std::string &newpath) { if (type >= BEGIN_OF_PATH && type <= END_OF_PATH) { SetAbsPathname(FILE_TYPE_STRING[type], newpath); } else { std::stringstream ss(""); ss << "FileManager::SetAbsPathname() enum type: " << type << " is out of bounds of file path\n"; throw UtilityException(ss.str()); } } //------------------------------------------------------------------------------ // void SetAbsPathname(const std::string &type, const char *newpath) //------------------------------------------------------------------------------ /** * Sets absolute pathname for the type. * * @param <type> type name of which path to be set. * @param <newpath> new pathname. * * @exception thrown if enum type is out of bounds */ //------------------------------------------------------------------------------ void FileManager::SetAbsPathname(const std::string &type, const char *newpath) { SetAbsPathname(type, std::string(newpath)); } //------------------------------------------------------------------------------ // void SetAbsPathname(const std::string &type, const std::string &newpath) //------------------------------------------------------------------------------ /** * Sets absolute pathname for the type. * * @param <type> type name of which path to be set. * @param <newpath> new pathname. * * @exception thrown if enum type is out of bounds */ //------------------------------------------------------------------------------ void FileManager::SetAbsPathname(const std::string &type, const std::string &newpath) { if (mPathMap.find(type) != mPathMap.end()) { if (type.find("_PATH") != type.npos) { std::string str2 = newpath; // append '/' if not there std::string::size_type index = str2.find_last_of("/\\"); if (index != str2.length() - 1) { str2 = str2 + mPathSeparator; } else { index = str2.find_last_not_of("/\\"); str2 = str2.substr(0, index+1) + mPathSeparator; } mPathMap[type] = str2; #ifdef DEBUG_SET_PATH MessageInterface::ShowMessage ("FileManager::SetAbsPathname() %s set to %s\n", type.c_str(), str2.c_str()); #endif } else { throw UtilityException ("FileManager::SetAbsPathname() type doesn't contain _PATH"); } } } //------------------------------------------------------------------------------ // void ClearGmatIncludePath() //------------------------------------------------------------------------------ void FileManager::ClearGmatIncludePath() { mGmatIncludePaths.clear(); } //------------------------------------------------------------------------------ // void AddGmatIncludePath(const char *path, bool addFront) //------------------------------------------------------------------------------ void FileManager::AddGmatIncludePath(const char *path, bool addFront) { return AddGmatIncludePath(std::string(path), addFront); } //------------------------------------------------------------------------------ // void AddGmatIncludePath(const std::string &path, bool addFront, bool addFront) //------------------------------------------------------------------------------ /* * If new path it adds to the GmatInclude path list. * If path already exist, it moves to the front or back of the list, depends on * addFront flag. * * @param path path name to be added * @param addFront if set to true, it adds to the front, else adds to the back (true) */ //------------------------------------------------------------------------------ void FileManager::AddGmatIncludePath(const std::string &path, bool addFront) { #ifdef DEBUG_GMAT_PATH MessageInterface::ShowMessage ("FileManager::AddGmatIncludePath() Adding %s to GmatIncludePath\n " "addFront=%d\n", path.c_str(), addFront); #endif std::string pathname = path; // if path has full pathname (directory and filename), remove filename first if (path.find(".") != path.npos) pathname = GmatFileUtil::ParsePathName(path); std::list<std::string>::iterator pos = find(mGmatIncludePaths.begin(), mGmatIncludePaths.end(), pathname); if (pos == mGmatIncludePaths.end()) { #ifdef DEBUG_GMAT_PATH MessageInterface::ShowMessage (" the pathname <%s> is new, so adding to %s\n", pathname.c_str(), addFront ? "front" : "back"); #endif // if new pathname, add to front or back of the list if (addFront) mGmatIncludePaths.push_front(pathname); else mGmatIncludePaths.push_back(pathname); } else { // if existing pathname remove and add front or back of the list #ifdef DEBUG_GMAT_PATH MessageInterface::ShowMessage (" the pathname <%s> already exists, so moving to %s\n", pathname.c_str(), addFront ? "front" : "back"); #endif std::string oldPath = *pos; mGmatIncludePaths.erase(pos); if (addFront) mGmatIncludePaths.push_front(oldPath); else mGmatIncludePaths.push_back(oldPath); } #ifdef DEBUG_GMAT_PATH pos = mGmatIncludePaths.begin(); while (pos != mGmatIncludePaths.end()) { MessageInterface::ShowMessage ("------ mGmatIncludePaths = %s\n", (*pos).c_str()); ++pos; } #endif } //------------------------------------------------------------------------------ // std::string GetGmatIncludePath(const char *incName) //------------------------------------------------------------------------------ std::string FileManager::GetGmatIncludePath(const char *incName) { return GetGmatPath(GMAT_INCLUDE, mGmatIncludePaths, std::string(incName)); } //------------------------------------------------------------------------------ // std::string GetGmatIncludePath(const std::string &incName) //------------------------------------------------------------------------------ /* * Returns the absolute path that has Include filename. * It searches in the most recently added path first which is at the top of * the list. * * @param incName Include filename to be located * @return Path Path that has Include filename */ //------------------------------------------------------------------------------ std::string FileManager::GetGmatIncludePath(const std::string &incName) { return GetGmatPath(GMAT_INCLUDE, mGmatIncludePaths, incName); } //------------------------------------------------------------------------------ // const StringArray& GetAllGmatIncludePaths() //------------------------------------------------------------------------------ const StringArray& FileManager::GetAllGmatIncludePaths() { mGmatIncludeFullPaths.clear(); std::list<std::string>::iterator listpos = mGmatIncludePaths.begin(); while (listpos != mGmatIncludePaths.end()) { mGmatIncludeFullPaths.push_back(ConvertToAbsPath(*listpos)); ++listpos; } return mGmatIncludeFullPaths; } //------------------------------------------------------------------------------ // void ClearGmatFunctionPath() //------------------------------------------------------------------------------ void FileManager::ClearGmatFunctionPath() { mGmatFunctionPaths.clear(); } //------------------------------------------------------------------------------ // void AddGmatFunctionPath(const char *path, bool addFront) //------------------------------------------------------------------------------ void FileManager::AddGmatFunctionPath(const char *path, bool addFront) { return AddGmatFunctionPath(std::string(path), addFront); } //------------------------------------------------------------------------------ // void AddGmatFunctionPath(const std::string &path, bool addFront, bool addFront) //------------------------------------------------------------------------------ /* * If new path it adds to the GmatFunction path list. * If path already exist, it moves to the front or back of the list, depends on * addFront flag. * * @param path path name to be added * @param addFront if set to true, it adds to the front, else adds to the back (true) */ //------------------------------------------------------------------------------ void FileManager::AddGmatFunctionPath(const std::string &path, bool addFront) { #ifdef DEBUG_GMAT_PATH MessageInterface::ShowMessage ("FileManager::AddGmatFunctionPath() Adding %s to GmatFunctionPath\n " "addFront=%d\n", path.c_str(), addFront); #endif std::string pathname = path; // if path has full pathname (directory and filename), remove filename first if (path.find(".") != path.npos) pathname = GmatFileUtil::ParsePathName(path); std::list<std::string>::iterator pos = find(mGmatFunctionPaths.begin(), mGmatFunctionPaths.end(), pathname); if (pos == mGmatFunctionPaths.end()) { #ifdef DEBUG_GMAT_PATH MessageInterface::ShowMessage (" the pathname <%s> is new, so adding to %s\n", pathname.c_str(), addFront ? "front" : "back"); #endif // if new pathname, add to front or back of the list if (addFront) mGmatFunctionPaths.push_front(pathname); else mGmatFunctionPaths.push_back(pathname); } else { // if existing pathname remove and add front or back of the list #ifdef DEBUG_GMAT_PATH MessageInterface::ShowMessage (" the pathname <%s> already exists, so moving to %s\n", pathname.c_str(), addFront ? "front" : "back"); #endif std::string oldPath = *pos; mGmatFunctionPaths.erase(pos); if (addFront) mGmatFunctionPaths.push_front(oldPath); else mGmatFunctionPaths.push_back(oldPath); } #ifdef DEBUG_GMAT_PATH pos = mGmatFunctionPaths.begin(); while (pos != mGmatFunctionPaths.end()) { MessageInterface::ShowMessage ("------ mGmatFunctionPaths = %s\n", (*pos).c_str()); ++pos; } #endif } //------------------------------------------------------------------------------ // std::string GetGmatFunctionPath(const char *funcName) //------------------------------------------------------------------------------ std::string FileManager::GetGmatFunctionPath(const char *funcName) { return GetGmatPath(GMAT_FUNCTION, mGmatFunctionPaths, std::string(funcName)); } //------------------------------------------------------------------------------ // std::string GetGmatFunctionPath(const std::string &funcName) //------------------------------------------------------------------------------ /* * Returns the absolute path that has GmatFunction name. * It searches in the most recently added path first which is at the top of * the list. * * @param funcName Name of the GmatFunction to be located * @return Path that has GmatFunction name */ //------------------------------------------------------------------------------ std::string FileManager::GetGmatFunctionPath(const std::string &funcName) { return GetGmatPath(GMAT_FUNCTION, mGmatFunctionPaths, funcName); } //------------------------------------------------------------------------------ // const StringArray& GetAllGmatFunctionPaths() //------------------------------------------------------------------------------ const StringArray& FileManager::GetAllGmatFunctionPaths() { mGmatFunctionFullPaths.clear(); std::list<std::string>::iterator listpos = mGmatFunctionPaths.begin(); while (listpos != mGmatFunctionPaths.end()) { mGmatFunctionFullPaths.push_back(ConvertToAbsPath(*listpos)); ++listpos; } return mGmatFunctionFullPaths; } //------------------------------------------------------------------------------ // void ClearMatlabFunctionPath() //------------------------------------------------------------------------------ void FileManager::ClearMatlabFunctionPath() { mMatlabFunctionPaths.clear(); } void FileManager::AddMatlabFunctionPath(const char *path, bool addFront) { return AddMatlabFunctionPath(std::string(path), addFront); } //------------------------------------------------------------------------------ // void AddMatlabFunctionPath(const std::string &path, bool addFront = true) //------------------------------------------------------------------------------ /* * If new path it adds to the MatlabFunction path list. * If path already exist, it moves to the front or back of the list, depends on * addFront flag. * * @param path path name to be added * @param addFront if set to true, it adds to the front, else adds to the back [true] */ //------------------------------------------------------------------------------ void FileManager::AddMatlabFunctionPath(const std::string &path, bool addFront) { #ifdef DEBUG_GMAT_PATH MessageInterface::ShowMessage ("FileManager::AddMatlabFunctionPath() Adding %s to MatlabFunctionPath\n", path.c_str()); #endif std::list<std::string>::iterator pos = find(mMatlabFunctionPaths.begin(), mMatlabFunctionPaths.end(), path); if (pos == mMatlabFunctionPaths.end()) { // if new path, add to front or back of the list if (addFront) mMatlabFunctionPaths.push_front(path); else mMatlabFunctionPaths.push_back(path); } else { // if existing path remove and add front or back of the list std::string oldPath = *pos; mMatlabFunctionPaths.erase(pos); if (addFront) mMatlabFunctionPaths.push_front(oldPath); else mMatlabFunctionPaths.push_back(oldPath); } #ifdef DEBUG_GMAT_PATH pos = mMatlabFunctionPaths.begin(); while (pos != mMatlabFunctionPaths.end()) { MessageInterface::ShowMessage (" mMatlabFunctionPaths=%s\n",(*pos).c_str()); ++pos; } #endif } std::string FileManager::GetMatlabFunctionPath(const char *funcName) { return GetMatlabFunctionPath(std::string(funcName)); } //------------------------------------------------------------------------------ // std::string GetMatlabFunctionPath(const std::string &funcName) //------------------------------------------------------------------------------ /* * Returns the absolute path that has MatlabFunction name. * It searches in the most recently added path first which is at the top of * the list. * * @param funcName Name of the MatlabFunction to be located * @return Path that has MatlabFunction name */ //------------------------------------------------------------------------------ std::string FileManager::GetMatlabFunctionPath(const std::string &funcName) { std::string path = GetGmatPath(MATLAB_FUNCTION, mMatlabFunctionPaths, funcName); // Write informational message if debug is turned on from the startup file if (mWriteFilePathInfo == "ON") { if (path == "") MessageInterface::ShowMessage ("*** Using MATLAB built-in function '%s'\n", funcName.c_str()); else MessageInterface::ShowMessage ("*** Using MATLAB function '%s' from '%s'\n", funcName.c_str(), path.c_str()); } return path; } //------------------------------------------------------------------------------ // const StringArray& GetAllMatlabFunctionPaths() //------------------------------------------------------------------------------ const StringArray& FileManager::GetAllMatlabFunctionPaths() { mMatlabFunctionFullPaths.clear(); std::list<std::string>::iterator listpos = mMatlabFunctionPaths.begin(); while (listpos != mMatlabFunctionPaths.end()) { mMatlabFunctionFullPaths.push_back(ConvertToAbsPath(*listpos)); ++listpos; } return mMatlabFunctionFullPaths; } //------------------------------------------------------------------------------ // void AddPythonModulePath(const std::string& path) //------------------------------------------------------------------------------ /** * Adds a folder to the buffer for the Python search path * * @param path The new folder that may contain Python modules */ //------------------------------------------------------------------------------ void FileManager::AddPythonModulePath(const std::string& path) { #ifdef DEBUG_GMAT_PATH MessageInterface::ShowMessage ("FileManager::AddPythonModulePath() Adding %s to PythonModulePath\n", path.c_str()); #endif std::list<std::string>::iterator pos = find(mPythonModulePaths.begin(), mPythonModulePaths.end(), path); if (pos == mPythonModulePaths.end()) { mPythonModulePaths.push_back(path); } #ifdef DEBUG_GMAT_PATH pos = mPythonModulePaths.begin(); while (pos != mPythonModulePaths.end()) { MessageInterface::ShowMessage (" mPythonModulePaths=%s\n", (*pos).c_str()); ++pos; } #endif } // ------------------------------------------------------------------------------ // const StringArray& GetAllPythonModulePaths() //------------------------------------------------------------------------------ const StringArray& FileManager::GetAllPythonModulePaths() { mPythonModuleFullPaths.clear(); std::list<std::string>::iterator listpos = mPythonModulePaths.begin(); while (listpos != mPythonModulePaths.end()) { mPythonModuleFullPaths.push_back(ConvertToAbsPath(*listpos)); ++listpos; } return mPythonModuleFullPaths; } //------------------------------------------------------------------------------ // std::string GetLastFilePathMessage() //------------------------------------------------------------------------------ /** * Returns the last file path message set from FindPath(). */ //------------------------------------------------------------------------------ std::string FileManager::GetLastFilePathMessage() { return mLastFilePathMessage; } //------------------------------------------------------------------------------ // const StringArray& GetPluginList() //------------------------------------------------------------------------------ /** * Accesses the list of plug-in libraries parsed from the startup file. * * @return The list of plug-in libraries */ //------------------------------------------------------------------------------ const StringArray& FileManager::GetPluginList() { return mPluginList; } //------------------------------------------------------------------------------ // void AdjustSettings(const std::string &suffix, const StringArray &forEntries) //------------------------------------------------------------------------------ /** * Appends a suffix to a list of settings stored in the file manager * * @param suffix The suffix to be appended to the setting * @param forEntries A list of entries that receive the suffix */ //------------------------------------------------------------------------------ void FileManager::AdjustSettings(const std::string &suffix, const StringArray &forEntries) { std::string temp; for (UnsignedInt i = 0; i < forEntries.size(); ++i) { // Adjust if path temp = mPathMap[forEntries[i]]; if (temp != "") { std::string trailingSlash = ""; if ((temp[temp.length()-1] == '/') || (temp[temp.length()-1] == '\\')) { trailingSlash = temp.substr(temp.length()-1); temp = temp.substr(0, temp.length()-1); } temp += suffix; temp += trailingSlash; mPathMap[forEntries[i]] = temp; } else // Adjust if file { FileInfo *tempFI = mFileMap[forEntries[i]]; temp = tempFI->mFile; std::string extension = ""; if (temp.find(".") != std::string::npos) { extension = temp.substr(temp.find(".")); temp = temp.substr(0, temp.find(".")); } if (temp != "") { temp += suffix + extension; tempFI->mFile = temp; } } } } //--------------------------------- // private methods //--------------------------------- //------------------------------------------------------------------------------ // std::string GetGmatPath(GmatPathType type, const std::list<std::string> &pathList // const std::string &name) //------------------------------------------------------------------------------ /* * Searches proper GMAT path list from the top and return first path found. * * @param type type of function (MATLAB_FUNCTION, GMAT_FUNCTION) * @param pathList function path list to use in search * @param name name of the function to search */ //------------------------------------------------------------------------------ std::string FileManager::GetGmatPath(GmatPathType type, std::list<std::string> &pathList, const std::string &name) { #ifdef DEBUG_GMAT_PATH MessageInterface::ShowMessage ("FileManager::GetGmatPath(%s) with type %d entered\n", name.c_str(), type); #endif std::string name1 = name; if (type == GMAT_FUNCTION) { if (name.find(".gmf") == name.npos) name1 = name1 + ".gmf"; } else if (type == MATLAB_FUNCTION) { if (name.find(".m") == name.npos) name1 = name1 + ".m"; } else if (type == GMAT_INCLUDE) { // GMAT include file can be any extension name1 = name; // If include name contains absolute path, just return the blank path if (GmatFileUtil::IsPathAbsolute(name1)) { std::string blankPath; #ifdef DEBUG_GMAT_PATH MessageInterface::ShowMessage ("FileManager::GetGmatPath(%s) returning '%s'\n", name.c_str(), path.c_str()); #endif return blankPath; } } else { UtilityException ue; ue.SetDetails("*** INTERNAL ERROR *** FileManager::GetGmatPath() The path " "type %d is undefined\n", type); throw ue; } // Search through pathList // The most recent path added to the last, so search backwards std::string pathName, fullPath; bool fileFound = false; // Search from the top of the list, which is the most recently added path // The search order goes from top to bottom. (loj: 2008.10.02) std::list<std::string>::iterator pos = pathList.begin(); while (pos != pathList.end()) { pathName = *pos; fullPath = ConvertToAbsPath(pathName) + name1; #ifdef DEBUG_GMAT_PATH MessageInterface::ShowMessage(" pathName='%s'\n", pathName.c_str()); MessageInterface::ShowMessage(" fullPath='%s'\n", fullPath.c_str()); #endif if (GmatFileUtil::DoesFileExist(fullPath)) { fileFound = true; break; } pos++; } if (fileFound) fullPath = GmatFileUtil::ParsePathName(fullPath); else fullPath = ""; #ifdef DEBUG_GMAT_PATH MessageInterface::ShowMessage ("FileManager::GetGmatPath(%s) returning '%s'\n", name.c_str(), fullPath.c_str()); #endif return fullPath; } //------------------------------------------------------------------------------ // void AddFileType(const std::string &type, const std::string &name) //------------------------------------------------------------------------------ /** * Adds file type, path, name to the list. If typeName ends with _PATH, it is * added to path map. If typeName ends with _FILE, it is added to file map, an * exception is throw otherwise. * * @param <type> file type * @param <name> file path or name * * @excepton thrown if typeName does not end with _PATH or _FILE */ //------------------------------------------------------------------------------ void FileManager::AddFileType(const std::string &type, const std::string &name) { #ifdef DEBUG_ADD_FILETYPE MessageInterface::ShowMessage ("FileManager::AddFileType() entered, type=%s, name=%s\n", type.c_str(), name.c_str()); #endif if (type.find("_PATH") != type.npos) { std::string str2 = name; // append '/' if '\\' or '/' not there if (!GmatStringUtil::EndsWithPathSeparator(str2)) str2 = str2 + mPathSeparator; mPathMap[type] = str2; #ifdef DEBUG_ADD_FILETYPE MessageInterface::ShowMessage (" Adding %s = %s to mPathMap\n", type.c_str(), str2.c_str()); #endif // Handle Gmat and Matlab Function path if (type == "GMAT_FUNCTION_PATH") AddGmatFunctionPath(str2, false); else if (type == "MATLAB_FUNCTION_PATH") AddMatlabFunctionPath(str2, false); else if (type == "PYTHON_MODULE_PATH") AddPythonModulePath(str2); } else if (type.find("_FILE_ABS") != type.npos) { mFileMap[type] = new FileInfo("", name); } else if (type.find("_FILE") != type.npos) { std::string pathName; std::string fileName; // file name std::string::size_type pos = name.find_last_of("/"); if (pos == name.npos) pos = name.find_last_of("\\"); if (pos != name.npos) { std::string pathName = name.substr(0, pos); std::string fileName = name.substr(pos+1, name.npos); mFileMap[type] = new FileInfo(pathName, fileName); #ifdef DEBUG_ADD_FILETYPE MessageInterface::ShowMessage (" Adding %s and %s to mFileMap\n", pathName.c_str(), fileName.c_str()); #endif } else { //loj: Should we add current path? std::string pathName = "CURRENT_PATH"; mPathMap[pathName] = "./"; std::string fileName = name; mFileMap[type] = new FileInfo(pathName, fileName); #ifdef DEBUG_ADD_FILETYPE MessageInterface::ShowMessage (" Adding %s and %s to mFileMap\n", pathName.c_str(), fileName.c_str()); MessageInterface::ShowMessage (" 'PATH/' not found in line:\n %s = %s\n So adding CURRENT_PATH = ./\n", type.c_str(), name.c_str()); #endif //loj: Should we just throw an exception? //mInStream.close(); //throw UtilityException // ("FileManager::AddFileType() expecting 'PATH/' in line:\n" + // type + " = " + name); } } else if (type == "PLUGIN") { #ifdef DEBUG_PLUGIN_DETECTION MessageInterface::ShowMessage("Adding plug-in %s to plugin list\n", name.c_str()); #endif mPluginList.push_back(name); } else { throw UtilityException ("FileManager::AddFileType() file type should have '_PATH' or '_FILE'" " in:\n" + type); } #ifdef DEBUG_ADD_FILETYPE MessageInterface::ShowMessage("FileManager::AddFileType() leaving\n"); #endif } //------------------------------------------------------------------------------ // void AddAvailablePotentialFiles() //------------------------------------------------------------------------------ void FileManager::AddAvailablePotentialFiles() { // add available potential files // earth gravity files if (mFileMap.find("JGM2_FILE") == mFileMap.end()) AddFileType("JGM2_FILE", "EARTH_POT_PATH/JGM2.cof"); if (mFileMap.find("JGM3_FILE") == mFileMap.end()) AddFileType("JGM3_FILE", "EARTH_POT_PATH/JGM3.cof"); if (mFileMap.find("EGM96_FILE") == mFileMap.end()) AddFileType("EGM96_FILE", "EARTH_POT_PATH/EGM96low.cof"); // luna gravity files if (mFileMap.find("LP165P_FILE") == mFileMap.end()) AddFileType("LP165P_FILE", "LUNA_POT_PATH/LP165P.cof"); // venus gravity files if (mFileMap.find("MGNP180U_FILE") == mFileMap.end()) AddFileType("MGNP180U_FILE", "VENUS_POT_PATH/MGNP180U.cof"); // mars gravity files if (mFileMap.find("MARS50C_FILE") == mFileMap.end()) AddFileType("MARS50C_FILE", "MARS_POT_PATH/Mars50c.cof"); } //------------------------------------------------------------------------------ // void WriteHeader(std::ofstream &outStream) //------------------------------------------------------------------------------ void FileManager::WriteHeader(std::ofstream &outStream) { outStream << "#-------------------------------------------------------------------------------\n"; outStream << "# General Mission Analysis Tool (GMAT) startup file\n"; outStream << "#-------------------------------------------------------------------------------\n"; outStream << "# Comment line starts with #\n"; outStream << "# Comment line starting with ## will be saved when saving startup file.\n"; outStream << "#\n"; outStream << "# Path/File naming convention:\n"; outStream << "# - Path name should end with _PATH\n"; outStream << "# - File name should end with _FILE\n"; outStream << "# - Path/File names are case sensative\n"; outStream << "#\n"; outStream << "# You can add potential and texture files by following the naming convention.\n"; outStream << "# - Potential file should begin with planet name and end with _POT_FILE\n"; outStream << "# - Texture file should begin with planet name and end with _TEXTURE_FILE\n"; outStream << "#\n"; outStream << "# If same _FILE is specified multiple times, it will use the last one.\n"; outStream << "#\n"; outStream << "# You can have more than one line containing GMAT_FUNCTION_PATH. GMAT will store \n"; outStream << "# the multiple paths you specify and scan for GMAT Functions using the paths \n"; outStream << "# in top to bottom order and use the first function found from the search paths.\n"; outStream << "#\n"; outStream << "# In order for an object plugin to work inside GMAT, the plugin dynamic link libraries; \n"; outStream << "# Windows(.dll), Linux(.so) and Mac(.dylib), must be placed in the folder containing\n"; outStream << "# the GMAT executable or application. Once placed in the correct folder \n"; outStream << "# the PLUGIN line below must be set equal to the plugin name without the dynamic link \n"; outStream << "# library extension with the comment (#) removed from the front of the line.\n"; outStream << "#\n"; outStream << "# Some available PLUGINs are:\n"; outStream << "# PLUGIN = libMatlabInterface\n"; outStream << "# PLUGIN = libFminconOptimizer\n"; outStream << "# PLUGIN = libVF13Optimizer\n"; outStream << "# PLUGIN = libDataFile\n"; outStream << "# PLUGIN = libCcsdsEphemerisFile\n"; outStream << "# PLUGIN = libGmatEstimation\n"; outStream << "#\n"; outStream << "#===============================================================================\n"; } //------------------------------------------------------------------------------ // void WriteFiles(std::ofstream &outStream, const std::string &type) //------------------------------------------------------------------------------ void FileManager::WriteFiles(std::ofstream &outStream, const std::string &type) { #ifdef DEBUG_WRITE_STARTUP_FILE MessageInterface::ShowMessage(" .....Writing %s file\n", type.c_str()); #endif std::string realPath; // Write remainder of path if (type == "-OTHER-PATH-") { for (std::map<std::string, std::string>::iterator pos = mPathMap.begin(); pos != mPathMap.end(); ++pos) { // if name not found in already written out list, then write if (find(mPathWrittenOuts.begin(), mPathWrittenOuts.end(), pos->first) == mPathWrittenOuts.end()) { if (pos->second != "") { realPath = pos->second; mPathWrittenOuts.push_back(pos->first); outStream << std::setw(22) << pos->first << " = " << realPath << "\n"; } } } return; } // Write remainder of files if (type == "-OTHER-") { for (std::map<std::string, FileInfo*>::iterator pos = mFileMap.begin(); pos != mFileMap.end(); ++pos) { // if name not found in already written out list, then write if (find(mFileWrittenOuts.begin(), mFileWrittenOuts.end(), pos->first) == mFileWrittenOuts.end()) { if (pos->second) { realPath = pos->second->mPath; if (realPath == "CURRENT_PATH") realPath = ""; else realPath = realPath + mPathSeparator; mFileWrittenOuts.push_back(pos->first); outStream << std::setw(22) << pos->first << " = " << realPath << pos->second->mFile << "\n"; } } } return; } for (std::map<std::string, FileInfo*>::iterator pos = mFileMap.begin(); pos != mFileMap.end(); ++pos) { if (pos->first.find(type) != std::string::npos) { if (pos->second) { realPath = pos->second->mPath; if (realPath == "CURRENT_PATH") realPath = ""; else realPath = realPath + mPathSeparator; mFileWrittenOuts.push_back(pos->first); outStream << std::setw(22) << pos->first << " = " << realPath << pos->second->mFile << "\n"; } } } } //------------------------------------------------------------------------------ // void RefreshFiles() //------------------------------------------------------------------------------ void FileManager::RefreshFiles() { mRunMode = ""; mPlotMode = ""; mMatlabMode = ""; mDebugMatlab = ""; mDebugMissionTree = ""; mWriteParameterInfo = ""; mWriteFilePathInfo = ""; mWriteGmatKeyword = ""; mLastFilePathMessage = ""; mPathMap.clear(); mGmatFunctionPaths.clear(); mMatlabFunctionPaths.clear(); mGmatFunctionFullPaths.clear(); mSavedComments.clear(); mPluginList.clear(); for (std::map<std::string, FileInfo*>::iterator iter = mFileMap.begin(); iter != mFileMap.begin(); ++iter) delete iter->second; mFileMap.clear(); //------------------------------------------------------- // add root and data path //------------------------------------------------------- AddFileType("ROOT_PATH", "../"); AddFileType("DATA_PATH", "ROOT_PATH/data"); AddFileType("FILE_UPDATE_PATH", "ROOT_PATH/data"); //------------------------------------------------------- // add default output paths and files //------------------------------------------------------- std::string defOutPath = "../output"; if (!DoesDirectoryExist(defOutPath)) defOutPath = "./"; AddFileType("OUTPUT_PATH", defOutPath); AddFileType("LOG_FILE", "OUTPUT_PATH/GmatLog.txt"); AddFileType("REPORT_FILE", "OUTPUT_PATH/ReportFile.txt"); AddFileType("EPHEM_OUTPUT_FILE", "OUTPUT_PATH/EphemerisFile.eph"); AddFileType("MEASUREMENT_PATH", "OUTPUT_PATH"); AddFileType("VEHICLE_EPHEM_CCSDS_PATH", "OUTPUT_PATH"); AddFileType("SCREENSHOT_FILE", "OUTPUT_PATH"); // Should we add default input paths and files? // Yes, for now in case of startup file doesn't specify all the required // input path and files (LOJ: 2011.03.21) // Currently #define __FM_ADD_DEFAULT_INPUT__ was commented out #ifdef __FM_ADD_DEFAULT_INPUT__ #ifdef DEBUG_REFRESH_FILES MessageInterface::ShowMessage ("FileManager::RefreshFiles() creatng default input paths and files\n"); #endif //------------------------------------------------------- // create default input paths and files //------------------------------------------------------- // planetary de files AddFileType("PLANETARY_EPHEM_DE_PATH", "DATA_PATH/planetary_ephem/de/"); AddFileType("DE405_FILE", "PLANETARY_EPHEM_DE_PATH/leDE1941.405"); // planetary spk files AddFileType("PLANETARY_EPHEM_SPK_PATH", "DATA_PATH/planetary_ephem/spk/"); AddFileType("PLANETARY_SPK_FILE", "PLANETARY_EPHEM_SPK_PATH/de421.bsp"); // vehicle spk files AddFileType("VEHICLE_EPHEM_SPK_PATH", "DATA_PATH/vehicle/ephem/spk/"); // earth gravity files AddFileType("EARTH_POT_PATH", "DATA_PATH/gravity/earth/"); AddFileType("JGM2_FILE", "EARTH_POT_PATH/JGM2.cof"); AddFileType("JGM3_FILE", "EARTH_POT_PATH/JGM3.cof"); AddFileType("EGM96_FILE", "EARTH_POT_PATH/EGM96.cof"); // luna gravity files AddFileType("LUNA_POT_PATH", "DATA_PATH/gravity/luna/"); AddFileType("LP165P_FILE", "LUNA_POT_PATH/lp165p.cof"); // venus gravity files AddFileType("VENUS_POT_PATH", "DATA_PATH/gravity/venus/"); AddFileType("MGNP180U_FILE", "VENUS_POT_PATH/MGNP180U.cof"); // mars gravity files AddFileType("MARS_POT_PATH", "DATA_PATH/gravity/mars/"); AddFileType("MARS50C_FILE", "MARS_POT_PATH/Mars50c.cof"); // planetary coeff. files AddFileType("PLANETARY_COEFF_PATH", "DATA_PATH/planetary_coeff/"); AddFileType("EOP_FILE", "PLANETARY_COEFF_PATH/eopc04.62-now"); // wcs 2013.03.04 PLANETARY_COEFF_FILE is CURRENTLY not used, since our // default is PLANETARY_1980 and PLANETARY_1996 is not allowed; however, // we will leave this here as a placeholder anyway AddFileType("PLANETARY_COEFF_FILE", "PLANETARY_COEFF_PATH/NUT85.DAT"); AddFileType("NUTATION_COEFF_FILE", "PLANETARY_COEFF_PATH/NUTATION.DAT"); AddFileType("PLANETARY_PCK_FILE", "PLANETARY_COEFF_PATH/SPICEPlanetaryConstantsKernel.tpc"); AddFileType("EARTH_LATEST_PCK_FILE", "PLANETARY_COEFF_PATH/earth_latest_high_prec.bpc"); AddFileType("EARTH_PCK_PREDICTED_FILE", "PLANETARY_COEFF_PATH/SPICEEarthPredictedKernel.bpc"); AddFileType("EARTH_PCK_CURRENT_FILE", "PLANETARY_COEFF_PATH/SPICEEarthCurrentKernel.bpc"); AddFileType("LUNA_PCK_CURRENT_FILE", "PLANETARY_COEFF_PATH/SPICELunaCurrentKernel.bpc"); AddFileType("LUNA_FRAME_KERNEL_FILE", "PLANETARY_COEFF_PATH/SPICELunaFrameKernel.tf"); // time path and files AddFileType("TIME_PATH", "DATA_PATH/time/"); AddFileType("LEAP_SECS_FILE", "TIME_PATH/tai-utc.dat"); AddFileType("LSK_FILE", "TIME_PATH/naif0010.tls"); // atmosphere path and files AddFileType("ATMOSPHERE_PATH", "DATA_PATH/atmosphere/earth/"); AddFileType("CSSI_FLUX_FILE", "ATMOSPHERE_PATH/CSSI_2004To2026.txt"); AddFileType("SCHATTEN_FILE", "ATMOSPHERE_PATH/SchattenPredict.txt"); AddFileType("MARINI_TROPO_FILE", "ATMOSPHERE_PATH/marini.dat"); // gui config file path AddFileType("GUI_CONFIG_PATH", "DATA_PATH/gui_config/"); // personalization file AddFileType("PERSONALIZATION_FILE", "OUTPUT_PATH/MyGmat.ini"); // icon path and main icon file AddFileType("ICON_PATH", "DATA_PATH/graphics/icons/"); #if defined __WXMSW__ AddFileType("MAIN_ICON_FILE", "ICON_PATH/GMATWin32.ico"); #elif defined __WXGTK__ AddFileType("MAIN_ICON_FILE", "ICON_PATH/GMATLinux48.xpm"); #elif defined __WXMAC__ AddFileType("MAIN_ICON_FILE", "ICON_PATH/GMATIcon.icns"); #endif // splash file path AddFileType("SPLASH_PATH", "DATA_PATH/graphics/splash/"); AddFileType("SPLASH_FILE", "SPLASH_PATH/GMATSplashScreen.tif"); // texture file path AddFileType("TEXTURE_PATH", "DATA_PATH/graphics/texture/"); AddFileType("SUN_TEXTURE_FILE", "TEXTURE_PATH/Sun.jpg"); AddFileType("MERCURY_TEXTURE_FILE", "TEXTURE_PATH/Mercury_JPLCaltech.jpg"); AddFileType("EARTH_TEXTURE_FILE", "TEXTURE_PATH/ModifiedBlueMarble.jpg"); AddFileType("MARS_TEXTURE_FILE", "TEXTURE_PATH/Mars_JPLCaltechUSGS.jpg"); AddFileType("JUPITER_TEXTURE_FILE", "TEXTURE_PATH/Jupiter_HermesCelestiaMotherlode.jpg"); AddFileType("SATRUN_TEXTURE_FILE", "TEXTURE_PATH/Saturn_gradiusCelestiaMotherlode.jpg"); AddFileType("URANUS_TEXTURE_FILE", "TEXTURE_PATH/Uranus_JPLCaltech.jpg"); AddFileType("NEPTUNE_TEXTURE_FILE", "TEXTURE_PATH/Neptune_BjornJonsson.jpg"); AddFileType("PLUTO_TEXTURE_FILE", "TEXTURE_PATH/Pluto_JPLCaltech.jpg"); AddFileType("LUNA_TEXTURE_FILE", "TEXTURE_PATH/Moon_HermesCelestiaMotherlode.jpg"); // star path and files AddFileType("STAR_PATH", "DATA_PATH/graphics/stars/"); AddFileType("STAR_FILE", "STAR_PATH/inp_StarCatalog.txt"); AddFileType("CONSTELLATION_FILE", "STAR_PATH/inp_Constellation.txt"); // models AddFileType("VEHICLE_MODEL_PATH", "DATA_PATH/vehicle/models/"); AddFileType("SPACECRAFT_MODEL_FILE", "VEHICLE_MODEL_PATH/aura.3ds"); // help file AddFileType("HELP_FILE", ""); #endif } //------------------------------------------------------------------------------ // void ShowMaps(const std::string &msg) //------------------------------------------------------------------------------ void FileManager::ShowMaps(const std::string &msg) { MessageInterface::ShowMessage("%s\n", msg.c_str()); MessageInterface::ShowMessage("Here is path map, there are %d items\n", mPathMap.size()); for (std::map<std::string, std::string>::iterator pos = mPathMap.begin(); pos != mPathMap.end(); ++pos) { MessageInterface::ShowMessage("%20s: %s\n", (pos->first).c_str(), (pos->second).c_str()); } MessageInterface::ShowMessage("Here is file map, there are %d items\n", mFileMap.size()); for (std::map<std::string, FileInfo*>::iterator pos = mFileMap.begin(); pos != mFileMap.end(); ++pos) { MessageInterface::ShowMessage ("%20s: %20s %s\n", (pos->first).c_str(), (pos->second)->mPath.c_str(), (pos->second)->mFile.c_str()); } } //------------------------------------------------------------------------------ // FileManager(const std::string &appName = "GMAT.exe") //------------------------------------------------------------------------------ /* * Constructor */ //------------------------------------------------------------------------------ FileManager::FileManager(const std::string &appName) { MessageInterface::SetLogEnable(false); // so that debug can be written from here #ifdef DEBUG_FILE_MANAGER MessageInterface::ShowMessage ("FileManager::FileManager() entered, MAX_PATH = %d, MAX_PATH_LEN = %d\n", MAX_PATH, GmatFile::MAX_PATH_LEN); #endif // Set only bin directory SetBinDirectory(appName); // Set platform dependent data mIsOsWindows = GmatFileUtil::IsOsWindows(); mPathSeparator = GetPathSeparator(); mStartupFileDir = GmatFileUtil::GetCurrentWorkingDirectory() + mPathSeparator; // Set GMAT startup file mStartupFileName = "gmat_startup_file.txt"; GmatGlobal::Instance()->AddHiddenCommand("SaveMission"); #ifdef DEBUG_STARTUP_FILE MessageInterface::ShowMessage ("FileManager::FileManager() entered, mPathSeparator='%s', " "mStartupFileDir='%s', mStartupFileName='%s'\n", mPathSeparator.c_str(), mStartupFileDir.c_str(), mStartupFileName.c_str()); #endif RefreshFiles(); } //------------------------------------------------------------------------------ // void SetPathsAbsolute() //------------------------------------------------------------------------------ /* * Sets the paths read from the startup file to absolute paths * * This method is separate from ReadStartupFile so that if it is broken, it can * just be commented out. */ //------------------------------------------------------------------------------ void FileManager::SetPathsAbsolute() { std::string mGmatBinDir = GmatFileUtil::GetGmatPath(); #ifdef DEBUG_STARTUP_WITH_ABSOLUTE_PATH MessageInterface::ShowMessage("Real bin folder = %s\nPaths:\n", mGmatBinDir.c_str()); for (std::map<std::string, std::string>::iterator path = mPathMap.begin(); path != mPathMap.end(); ++path) MessageInterface::ShowMessage(" %s\n", path->second.c_str()); MessageInterface::ShowMessage("Files:\n"); for (std::map<std::string, FileInfo*>::iterator file = mFileMap.begin(); file != mFileMap.end(); ++file) MessageInterface::ShowMessage(" %s %s\n", file->second->mPath.c_str(), file->second->mFile.c_str()); #endif for (std::map<std::string, std::string>::iterator path = mPathMap.begin(); path != mPathMap.end(); ++path) { #ifdef DEBUG_STARTUP_WITH_ABSOLUTE_PATH MessageInterface::ShowMessage("Checking %s: ", path->second.c_str()); #endif const char* setting = path->second.c_str(); if (setting[0] == '.') { path->second = mGmatBinDir + path->second; #ifdef DEBUG_STARTUP_WITH_ABSOLUTE_PATH MessageInterface::ShowMessage("reset to %s", path->second.c_str()); #endif } #ifdef DEBUG_STARTUP_WITH_ABSOLUTE_PATH MessageInterface::ShowMessage("\n"); #endif } #ifdef DEBUG_STARTUP_WITH_ABSOLUTE_PATH MessageInterface::ShowMessage("Paths:\n"); for (std::map<std::string, std::string>::iterator path = mPathMap.begin(); path != mPathMap.end(); ++path) MessageInterface::ShowMessage(" %s\n", path->second.c_str()); MessageInterface::ShowMessage("Files:\n"); for (std::map<std::string, FileInfo*>::iterator file = mFileMap.begin(); file != mFileMap.end(); ++file) MessageInterface::ShowMessage(" %s %s\n", file->second->mPath.c_str(), file->second->mFile.c_str()); #endif } //------------------------------------------------------------------------------ // void ValidatePaths() //------------------------------------------------------------------------------ /* * Validate all paths in file manager */ //------------------------------------------------------------------------------ bool FileManager::ValidatePaths() { std::string s = ""; int i = 0; FileType type; for ( int fooInt = BEGIN_OF_PATH; fooInt != END_OF_PATH; fooInt++ ) { type = FileType(fooInt); switch (type) { case BEGIN_OF_PATH: case END_OF_PATH: break; // non fatal paths? case TEXTURE_PATH: case BODY_3D_MODEL_PATH: case MEASUREMENT_PATH: case GUI_CONFIG_PATH: case SPLASH_PATH: case ICON_PATH: case VEHICLE_MODEL_PATH: try { if (!DoesDirectoryExist(GetFullPathname(type))) { MessageInterface::ShowMessage("%s directory does not exist: %s", FileManager::FILE_TYPE_STRING[type].c_str(), GetFullPathname(type).c_str()); } } catch (UtilityException &e) { MessageInterface::ShowMessage("%s directory not specified in gmat_startup_file", FileManager::FILE_TYPE_STRING[type].c_str()); } break; default: try { if (!DoesDirectoryExist(GetFullPathname(type))) { i++; if (i > 9) goto loopexit; if (i > 1) s = s + "\n"; s = s + FileManager::FILE_TYPE_STRING[type] + " = " + GetFullPathname(type); } } catch (UtilityException &e) { i++; if (i > 9) goto loopexit; if (i > 1) s = s + "\n"; s = s + FileManager::FILE_TYPE_STRING[type] + " = MISSING in gmat_startup_file"; } } } loopexit: UtilityException ue; if (i == 1) { ue.SetDetails("The following directory does not exist:\n%s", s.c_str()); throw ue; } else if (i > 1) { ue.SetDetails("At least %d directories do not exist, including:\n%s", i, s.c_str()); throw ue; } return i == 0; }
36.217058
113
0.510774
saichikine
1d59edc709c378b84a287bcf43f2028ea41d680f
1,326
cpp
C++
sevenfw/anti_arp_tab.cpp
codereba/bittrace
6826559565aaafc9412d20427d21b73e23febcfe
[ "Unlicense" ]
10
2018-11-09T01:08:15.000Z
2020-06-21T05:39:54.000Z
sevenfw/anti_arp_tab.cpp
codereba/bittrace
6826559565aaafc9412d20427d21b73e23febcfe
[ "Unlicense" ]
null
null
null
sevenfw/anti_arp_tab.cpp
codereba/bittrace
6826559565aaafc9412d20427d21b73e23febcfe
[ "Unlicense" ]
4
2018-11-09T03:29:52.000Z
2021-07-23T03:30:03.000Z
/* * Copyright 2010 JiJie Shi * * This file is part of NetMonitor. * * NetMonitor is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * NetMonitor is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NetMonitor. If not, see <http://www.gnu.org/licenses/>. * * * 2007.6.10 Ji Jie Shi modified it for this ui lib. */ #include "common_func.h" #include "ui_ctrl.h" #include "anti_arp_tab.h" INT32 anti_arp_ui_output( ULONG ui_action_id, INT32 ret_val, PBYTE data, ULONG length, PVOID param ) { INT32 ret; anti_arp_tab *output_wnd; ret = 0; switch( ui_action_id ) { case ANTI_ARP_INIT: break; case ANTI_ARP_GET_ARP_INFO: output_wnd = ( anti_arp_tab* )param; ret = output_wnd->output_arp_info( ( PARP_HOST_MAC_LISTS ) data ); break; } return ret; }
25.5
72
0.674208
codereba
1d5a74b971140fa7f04ed54d1d66f635bf3bfb49
439
cpp
C++
GlacierFormats/src/Export/PNGExporter.cpp
pawREP/GlacierFormats
9eece4541d863e288fc950087c4f6ec111258fe9
[ "MIT" ]
3
2020-04-03T00:01:35.000Z
2021-02-04T04:20:58.000Z
GlacierFormats/src/Export/PNGExporter.cpp
pawREP/GlacierFormats
9eece4541d863e288fc950087c4f6ec111258fe9
[ "MIT" ]
1
2021-03-02T05:31:10.000Z
2021-03-02T05:31:10.000Z
GlacierFormats/src/Export/PNGExporter.cpp
pawREP/GlacierFormats
9eece4541d863e288fc950087c4f6ec111258fe9
[ "MIT" ]
null
null
null
#include "PNGExporter.h" using namespace GlacierFormats; using namespace GlacierFormats::Export; void PNGExporter::operator()(const IRenderAsset& asset, const std::filesystem::path& export_dir) const { for (const auto& material : asset.materials()) { for (int i = 0; i < material->getTextureCount(); ++i) { auto texd = material->getTextureResourceByIndex(i); if (!texd) continue; texd->saveToTGAFile(export_dir); } } }
29.266667
104
0.712984
pawREP
1d5ca670aaa3d5ded10453cc0fa0951db647dca4
9,287
hpp
C++
src/include/miopen/conv/asm_implicit_gemm.hpp
j4yan/MIOpen
dc38f79bee97e047d866d9c1e25289cba86fab56
[ "MIT" ]
745
2017-07-01T22:03:25.000Z
2022-03-26T23:46:27.000Z
src/include/miopen/conv/asm_implicit_gemm.hpp
j4yan/MIOpen
dc38f79bee97e047d866d9c1e25289cba86fab56
[ "MIT" ]
1,348
2017-07-02T12:37:48.000Z
2022-03-31T23:45:51.000Z
src/include/miopen/conv/asm_implicit_gemm.hpp
j4yan/MIOpen
dc38f79bee97e047d866d9c1e25289cba86fab56
[ "MIT" ]
158
2017-07-01T19:37:04.000Z
2022-03-30T11:57:04.000Z
/******************************************************************************* * * MIT License * * Copyright (c) 2020 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * *******************************************************************************/ #ifndef CK_ASM_IMPLICITGEMM_HPP_ #define CK_ASM_IMPLICITGEMM_HPP_ #include <string> #include <ostream> #include <tuple> #include <vector> #include <limits> namespace miopen { namespace solver { struct TunableImplicitGemmGTCDynamic_t { std::string direction = " "; miopenDataType_t precision = miopenFloat; int nxb = 0; int nxe = 0; int gemm_m_per_block = 0; int gemm_n_per_block = 0; int gemm_k_per_block = 0; int wave_tile_m = 0; int wave_tile_n = 0; int wave_tile_k = 0; int wave_step_m = 0; int wave_step_n = 0; int wave_repeat_m = 0; int wave_repeat_n = 0; int tensor_a_thread_lengths[4] = {0, 0, 0, 0}; int tensor_a_cluster_lengths[4] = {0, 0, 0, 0}; int tensor_b_thread_lengths[4] = {0, 0, 0, 0}; int tensor_b_cluster_lengths[4] = {0, 0, 0, 0}; int gemm_k_global_split = 0; int GetBlockSize() const { const auto WaveSize = 64; const auto divisor_m = wave_tile_m * wave_step_m * wave_repeat_m; const auto divisor_n = wave_tile_n * wave_step_n * wave_repeat_n; assert(divisor_m != 0 && divisor_n != 0); return (gemm_m_per_block / divisor_m) * (gemm_n_per_block / divisor_n) * WaveSize; } std::string GetKernelName() const { std::ostringstream kernel_name; std::string kernel_precision = precision == miopenFloat ? "fp32" : "fp16"; kernel_name << "igemm_" << direction << "_gtcx_nchw_" << kernel_precision << "_bx" << nxb << "_ex" << nxe << "_bt" << gemm_m_per_block << "x" << gemm_n_per_block << "x" << gemm_k_per_block << "_wt" << wave_tile_m << "x" << wave_tile_n << "x" << wave_tile_k << "_ws" << wave_step_m << "x" << wave_step_n << "_wr" << wave_repeat_m << "x" << wave_repeat_n << "_ta" << tensor_a_thread_lengths[0] << "x" << tensor_a_thread_lengths[1] << "x" << tensor_a_thread_lengths[2] << "x" << tensor_a_thread_lengths[3] << "_" << tensor_a_cluster_lengths[0] << "x" << tensor_a_cluster_lengths[1] << "x" << tensor_a_cluster_lengths[2] << "x" << tensor_a_cluster_lengths[3] << "_tb" << tensor_b_thread_lengths[0] << "x" << tensor_b_thread_lengths[1] << "x" << tensor_b_thread_lengths[2] << "x" << tensor_b_thread_lengths[3] << "_" << tensor_b_cluster_lengths[0] << "x" << tensor_b_cluster_lengths[1] << "x" << tensor_b_cluster_lengths[2] << "x" << tensor_b_cluster_lengths[3]; if(this->gemm_k_global_split != 0) kernel_name << "_gkgs"; return kernel_name.str(); } }; // calculate log2_gemm_k_global_splits // with assumption that dimension_0, _1 will merge into a single dimension, and do split only along // dimension_0 static inline size_t ComputeLog2GemmKGlobalSplitsWith2DMerge(size_t current_grid_size, size_t max_grid_size, size_t merge_dimension_0, size_t merge_dimensoin_1, size_t gemm_k_per_block, size_t max_log2_splits) { size_t log2_gemm_k_global_splits = 0; for(size_t gs = 0; gs < max_log2_splits; gs++) { if((current_grid_size << gs) > max_grid_size) break; if((merge_dimension_0 % (1 << gs)) != 0) { break; } if((merge_dimension_0 >> gs) * merge_dimensoin_1 % gemm_k_per_block != 0) { break; } log2_gemm_k_global_splits = gs; } return log2_gemm_k_global_splits; } // calculate gemm_k_global_splits // with assumption that some dimensions will merge into a single dimension static inline size_t ComputeGemmKGlobalSplitsWith2DMerge(size_t current_grid_size, // size_t merge_dimension, // size_t gemm_k_per_block, size_t occupancy, size_t num_cus) { size_t gemm_k_global_splits = num_cus * occupancy / current_grid_size; // int gemm_k_per_wg = math::integer_divide_ceil(merge_dimension / gemm_k_global_splits); // gemm_k_per_wg = (gemm_k_per_wg + gemm_k_per_block - 1) / gemm_k_per_block * gemm_k_per_block; // gemm_k_global_splits = math::integer_divide_ceil(merge_dimension / gemm_k_per_wg); return gemm_k_global_splits; } static inline size_t ComputeMatrixPadSize(size_t col, size_t col_per_block, size_t row, size_t row_per_block) { size_t col_padded = ((col + col_per_block - 1) / col_per_block) * col_per_block; size_t row_padded = ((row + row_per_block - 1) / row_per_block) * row_per_block; size_t col_extra = col_padded - col; size_t row_extra = row_padded - row; return col_extra * row + row_extra * col + col_extra * row_extra; } static inline std::tuple<int, int, int> // m_per_block, n_per_block, k_per_block HeuristicInitMacroTileNoPadGemmK(size_t gemm_m, size_t gemm_n, size_t gemm_k, const std::vector<std::tuple<int, int, int>>& tile_list) { int m_per_block, n_per_block, k_per_block; bool found = false; // find exact divide for(const auto& tile : tile_list) { int mpb, npb, kpb; std::tie(mpb, npb, kpb) = tile; if(gemm_m % mpb == 0 && gemm_n % npb == 0 && gemm_k % kpb == 0) { m_per_block = mpb; n_per_block = npb; k_per_block = kpb; found = true; break; } } if(!found) { size_t min_pad_pixel = std::numeric_limits<std::size_t>::max(); int mpb_pad = 0; int npb_pad = 0; // first try gemm_m, gemm_n padding for(const auto& tile : tile_list) { int mpb, npb, kpb; std::tie(mpb, npb, kpb) = tile; if(gemm_k % kpb != 0) continue; size_t cur_pad_pixel = ComputeMatrixPadSize(gemm_m, mpb, gemm_k, kpb) + ComputeMatrixPadSize(gemm_n, npb, gemm_k, kpb) + ComputeMatrixPadSize(gemm_m, mpb, gemm_n, npb); if(cur_pad_pixel < min_pad_pixel) { min_pad_pixel = cur_pad_pixel; mpb_pad = mpb; npb_pad = npb; } } // second, we need find the max k_per_block among the same mpb/npb per block for(const auto& tile : tile_list) { int mpb, npb, kpb; std::tie(mpb, npb, kpb) = tile; if(mpb == mpb_pad && npb == npb_pad) { if(gemm_k % kpb == 0) { m_per_block = mpb; n_per_block = npb; k_per_block = kpb; found = true; break; } } } } if(found) return std::make_tuple(m_per_block, n_per_block, k_per_block); else return std::make_tuple(0, 0, 0); } template <int L, int H> inline static bool IsLinear(const int v) { static_assert(L <= H, "L <= H"); return L <= v && v <= H; } template <int L, int H> inline static bool NextLinear(int& v) { assert((IsLinear<L, H>(v))); if(H == v) { v = L; return true; } ++v; return false; } } // namespace solver } // namespace miopen #endif
37.447581
100
0.555077
j4yan
1d5d88e523272fa832c7c041a317b8b86657295f
3,916
cpp
C++
test/test_list.cpp
Junology/tsukimade
f76ca34f54796c3254655d5fba9015a60604d890
[ "MIT" ]
null
null
null
test/test_list.cpp
Junology/tsukimade
f76ca34f54796c3254655d5fba9015a60604d890
[ "MIT" ]
null
null
null
test/test_list.cpp
Junology/tsukimade
f76ca34f54796c3254655d5fba9015a60604d890
[ "MIT" ]
null
null
null
/*! * \file test_list.cpp * \brief A test with elementary operations on simple lists. * \details * The aim of the test is to verify the following functionality of the library: * - to pass pointers to data structures to Lua; * - to manipulate passed data structures in Lua; * - to receive functions as arguments; * - received functions may admit arguments of function types; * - to push and check enum data. * * \copyright (c) 2019 Jun Yoshida. * The project is released under MIT License. * \date April 29, 2019: created */ #include <iostream> extern "C" { #include "list.h" } #include "common.hpp" void reg_enum_Ordering(lua_State* L) { // Create empty table lua_newtable(L); // Create metatable lua_newtable(L); lua_pushstring(L, "__index"); tsukimade::push_enum_table( L, tsukimade::MK_ENUMENTRY(LT), tsukimade::MK_ENUMENTRY(GT), tsukimade::MK_ENUMENTRY(EQ) ); lua_rawset(L, -3); lua_pushstring(L, "__newindex"); lua_pushcfunction(L, lua_error); lua_rawset(L, -3); lua_pushstring(L, "__metatable"); lua_pushboolean(L, 0); lua_rawset(L, -3); lua_setmetatable(L, -2); lua_setglobal(L, "Ordering"); } simple_flist* create_empty_list() { return nullptr; } int main(int argc, char** argv) { if(argc <= 1) { std::cerr << "Too few arguments." << std::endl; return -1; } const luaL_Reg testlib[] = { REGISTER(create_empty_list), REGISTER(get_last), REGISTER(get_length), REGISTER(get_value), REGISTER(push_front), REGISTER(pop_front), REGISTER(push_back), REGISTER(pop_back), REGISTER(destroy), REGISTER(filter), REGISTER(order_canonical), REGISTER(order_opposite), REGISTER(bubble_sort), REGISTER(get_median), {NULL, NULL} }; TestEnv env; env.register_library(testlib, "list"); reg_enum_Ordering(env.get_luastate()); /* Basic test for list library */ { simple_flist* testlist = nullptr; testlist = push_back(testlist, 3); testlist = push_back(testlist, 1); testlist = push_front(testlist, 4); testlist = push_back(testlist, 1); testlist = push_front(testlist, 5); testlist = push_front(testlist, 9); testlist = push_back(testlist, 2); testlist = push_back(testlist, 6); testlist = push_front(testlist, 5); testlist = push_front(testlist, 3); testlist = push_back(testlist, 5); testlist = push_front(testlist, 8); testlist = push_back(testlist, 9); testlist = push_back(testlist, 7); testlist = push_front(testlist, 9); // 9, 8, 3, 5, 9, 5, 4, 3, 1, 1, 2, 6, 5, 9, 7 // sorted -> 1, 1, 2, 3, 3, 4, 5, 5, 5, 6, 7, 8, 9, 9, 9 try { if(get_length(testlist) != 15 && get_value(testlist, 3) != 5) throw __LINE__; testlist = push_front(testlist, 57); if(get_length(testlist) != 16 && get_value(testlist, 0) != 57) throw __LINE__; testlist = pop_back(testlist); if(get_length(testlist) != 15) throw __LINE__; testlist = push_back(testlist, 128); testlist = bubble_sort(testlist, order_opposite); if(get_value(testlist, 0) != 128) throw __LINE__; int med = get_median(testlist, order_canonical, bubble_sort); if(med != 5) throw __LINE__; } catch (int line) { std::cerr << "Error in basic test at line " << line << std::endl; env.write_result(false); } destroy(testlist); } int error = env.dofile(argv[1]); if(error) std::cerr << "Error: " << env.get_errmsg() << std::endl; return env.get_result() ? 0 : -1; }
27.77305
79
0.586568
Junology
1d62174fbed0986cfa385a1edbbd3852aac7e5e8
851
cpp
C++
public/plagiarism_plugin/input/24/24/24 24 5113100152--Bounce.cpp
laurensiusadi/elearning-pweb
c72ae1fc414895919ef71ae370686353d9086bce
[ "MIT" ]
null
null
null
public/plagiarism_plugin/input/24/24/24 24 5113100152--Bounce.cpp
laurensiusadi/elearning-pweb
c72ae1fc414895919ef71ae370686353d9086bce
[ "MIT" ]
null
null
null
public/plagiarism_plugin/input/24/24/24 24 5113100152--Bounce.cpp
laurensiusadi/elearning-pweb
c72ae1fc414895919ef71ae370686353d9086bce
[ "MIT" ]
null
null
null
#include "wx/wx.h" #include "Bounce.h" Bounce::Bounce(void) { // TODO Auto-generated constructor stub } Bounce::~Bounce(void) { // TODO Auto-generated destructor stub } void Bounce::Render(wxDc *dc){ dc->SetPen(*wxWHITE_PEN); dc->Setbrush(*this->brush); x = x + speedX; y = y + speedY; dc = DrawCircle(x, y, radius); t += 0.01f; } void Bounce::HitWallTest(int x1, int y1, int x2, int y2) { if ((y - radius) < y1 || (y + radius) > y2) { speedY = -speedY; } if ((x - radius) < x1 || (x + radius) > x2) { speedX = -speedX; } } void Bounce::Collides(Ball *otherBall) { int xd = x - otherBall->x; int yd = y - otherBall->y; float sumRadius = radius + otherBall->radius; float sqrRadius = sumRadius = sumRadius*sumRadius; float distSqr = (xd*xd) + (yd*yd); if (distSqr <= sqrRadius) { speedX *= -1; speedY *= -1; } }
16.056604
56
0.608696
laurensiusadi
1d63d521b59af187f8a678ed49b23f4b07a26784
2,559
cpp
C++
cvt/gfx/ifilter/BrightnessContrast.cpp
tuxmike/cvt
c6a5df38af4653345e795883b8babd67433746e9
[ "MIT" ]
11
2017-04-04T16:38:31.000Z
2021-08-04T11:31:26.000Z
cvt/gfx/ifilter/BrightnessContrast.cpp
tuxmike/cvt
c6a5df38af4653345e795883b8babd67433746e9
[ "MIT" ]
null
null
null
cvt/gfx/ifilter/BrightnessContrast.cpp
tuxmike/cvt
c6a5df38af4653345e795883b8babd67433746e9
[ "MIT" ]
8
2016-04-11T00:58:27.000Z
2022-02-22T07:35:40.000Z
/* The MIT License (MIT) Copyright (c) 2011 - 2013, Philipp Heise and Sebastian Klose Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <cvt/gfx/ifilter/BrightnessContrast.h> #include <cvt/cl/kernel/BC.h> namespace cvt { static ParamInfo* _params[ 4 ] = { new ParamInfoTyped<Image*>( "Input", true /* inputParam */ ), new ParamInfoTyped<Image*>( "Output", false ), new ParamInfoTyped<float>( "Brightness", -1.0f /* min */, 1.0f /* max */, 0.0f /* default */, true ), new ParamInfoTyped<float>( "Contrast", -1.0f /* min */, 1.0f /* max */, 0.0f /* default */, true ) }; BrightnessContrast::BrightnessContrast() : IFilter( "BrightnessContrast", _params, 4, IFILTER_OPENCL ), _kernelBC( _BC_source, "BC" ) { } BrightnessContrast::~BrightnessContrast() { } void BrightnessContrast::apply( const ParamSet* set, IFilterType t ) const { Image * in = set->arg<Image*>( 0 ); Image * out = set->arg<Image*>( 1 ); float b = set->arg<float>( 2 ); float c = set->arg<float>( 3 ); switch ( t ) { case IFILTER_OPENCL: this->applyOpenCL( *out, *in, b, c ); break; default: throw CVTException( "Not implemented" ); } } void BrightnessContrast::applyOpenCL( Image& dst, const Image& src, float brightness, float contrast ) const { size_t w, h; w = src.width(); h = src.height(); _kernelBC.setArg( 0, dst ); _kernelBC.setArg( 1, src ); _kernelBC.setArg( 2, brightness ); _kernelBC.setArg( 3, contrast ); _kernelBC.run( CLNDRange( w, h ), CLNDRange( 8, 8 ) ); } }
34.581081
134
0.692849
tuxmike
1d6d076af710df8b40ce11d5a994c9143cebbf99
4,875
cpp
C++
modules/core/statistics/unit/scalar/expinv.cpp
psiha/nt2
5e829807f6b57b339ca1be918a6b60a2507c54d0
[ "BSL-1.0" ]
34
2017-05-19T18:10:17.000Z
2022-01-04T02:18:13.000Z
modules/core/statistics/unit/scalar/expinv.cpp
psiha/nt2
5e829807f6b57b339ca1be918a6b60a2507c54d0
[ "BSL-1.0" ]
null
null
null
modules/core/statistics/unit/scalar/expinv.cpp
psiha/nt2
5e829807f6b57b339ca1be918a6b60a2507c54d0
[ "BSL-1.0" ]
7
2017-12-02T12:59:17.000Z
2021-07-31T12:46:14.000Z
//============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #include <nt2/include/functions/expinv.hpp> #include <nt2/include/functions/expcdf.hpp> #include <nt2/include/constants/zero.hpp> #include <nt2/include/constants/one.hpp> #include <nt2/include/functions/ones.hpp> #include <nt2/include/constants/nan.hpp> #include <nt2/include/constants/log_2.hpp> #include <nt2/include/functions/size.hpp> #include <nt2/include/functions/transpose.hpp> #include <nt2/include/functions/cons.hpp> #include <nt2/sdk/unit/tests/ulp.hpp> #include <nt2/sdk/unit/module.hpp> #include <nt2/table.hpp> NT2_TEST_CASE_TPL ( expinv_1, NT2_REAL_TYPES) { using nt2::expinv; using nt2::tag::expinv_; using nt2::_; using nt2::container::table; // specific values tests NT2_TEST_ULP_EQUAL(expinv(nt2::Nan<T>()), nt2::Nan<T>(), 0); NT2_TEST_ULP_EQUAL(expinv(nt2::One<T>()), nt2::Inf<T>(), 0); NT2_TEST_ULP_EQUAL(expinv(nt2::Zero<T>()), nt2::Zero<T>(), 0); NT2_TEST_ULP_EQUAL(expinv(nt2::Half<T>()), nt2::Log_2<T>(), 0); table<T> a = _(T(0), T(0.5), T(5))/T(5); NT2_TEST_ULP_EQUAL(a, nt2::expcdf(expinv(a)), T(3)); table<T> b = _(T(0), T(0.5), T(10))/T(5); NT2_TEST_ULP_EQUAL(b, nt2::expinv(nt2::expcdf(b)), T(3)); } // end of test for floating_ NT2_TEST_CASE_TPL ( expinv_2, NT2_REAL_TYPES) { using nt2::expinv; using nt2::tag::expinv_; using nt2::_; using nt2::container::table; // specific values tests NT2_TEST_ULP_EQUAL(expinv(nt2::Nan<T>(), nt2::One<T>()), nt2::Nan<T>(), 0); NT2_TEST_ULP_EQUAL(expinv(nt2::Zero<T>(), nt2::One<T>() ), nt2::Zero<T>(), 0); NT2_TEST_ULP_EQUAL(expinv(nt2::One<T>(), nt2::One<T>()), nt2::Inf<T>(), 0); NT2_TEST_ULP_EQUAL(expinv(nt2::Half<T>(), nt2::One<T>()), nt2::Log_2<T>(), 0); table<T> a = _(T(0), T(1), T(10))/T(10); table<T> r, plo, pup; a = nt2::reshape(_(T(1), T(16)), 4, 4)/T(16); table<T> z = expinv(a, a+T(10)); table<T> zz = nt2::trans(nt2::cons<T>(nt2::of_size(4, 4), 0.64941886894681000175, 3.8640261973645477767, 8.7317924292609419012, 18.099870187993698067, 1.3520053503232916103, 4.8762876534245069848, 10.42131081324959041, 22.61392676576821259, 2.1153260286783659438, 6.0053632624309258858, 12.431174279798213433, 30.325189149497607133, 2.9487412426307542113, 7.2780453958794257829, 14.902664382038823376, nt2::Inf<double>() )); NT2_TEST_ULP_EQUAL(z, zz, 1); a = _(T(0), T(1), T(10))/T(10); table<T> b = _(T(1), T(1), T(11)); nt2::tie(r, plo, pup) = nt2::expinv(a, nt2::ones(nt2::size(a), nt2::meta::as_<T>()), T(0.5), T(0.05)); table<T> rr = nt2::cons<T>(0.0, 0.10536051565782630912, 0.22314355131420976486, 0.35667494393873239167, 0.51082562376599072174, 0.69314718055994528623, 0.91629073187415499557, 1.2039728043259358969, 1.6094379124341005038, 2.3025850929940459011, nt2::Inf<double>()); table<T> pplo = nt2:: cons<T>(0.0, 0.026350417712275989168, 0.055807678523765377743, 0.08920356645568566778, 0.12775628972890218371, 0.17335448322176297276, 0.22916216174552833662, 0.30111077295066512871, 0.40251664496729139264, 0.57587112818905439315, nt2::Inf<double>()); table<T> ppup = nt2::cons<T>(0.0,0.42127750614410425234, 0.89222569026793119296, 1.4261427058176698868, 2.0425046661078845034, 2.7715061358037331729, 3.6637318260716642548, 4.8140108019116167881, 6.4352379618753978718, 9.2067440976791310447, nt2::Inf<double>()); NT2_TEST_ULP_EQUAL(r, rr, 1); NT2_TEST_ULP_EQUAL(plo, pplo, 2); NT2_TEST_ULP_EQUAL(pup, ppup, 2); r = nt2::expinv(a, nt2::ones(nt2::size(a), nt2::meta::as_<T>()), T(0.5), T(0.05)); rr = nt2::cons<T>(0.0,0.10536051565782630912, 0.22314355131420976486, 0.35667494393873239167, 0.51082562376599072174, 0.69314718055994528623, 0.91629073187415499557, 1.2039728043259358969, 1.6094379124341005038, 2.3025850929940459011, nt2::Inf<double>()); NT2_TEST_ULP_EQUAL(r, rr, 1); } // end of test for floating_
50.78125
137
0.592615
psiha
1d6f09547fe34fe925ed2ddfaaaadc319a635016
1,538
cpp
C++
app/src/plasp-app/main.cpp
rkaminsk/plasp
02b00cba67e4fe1f1edc0e31d8be70388fcef866
[ "MIT" ]
29
2016-07-07T16:23:24.000Z
2021-12-24T03:14:37.000Z
app/src/plasp-app/main.cpp
rkaminsk/plasp
02b00cba67e4fe1f1edc0e31d8be70388fcef866
[ "MIT" ]
5
2017-11-15T14:30:16.000Z
2020-12-17T00:34:59.000Z
app/src/plasp-app/main.cpp
rkaminsk/plasp
02b00cba67e4fe1f1edc0e31d8be70388fcef866
[ "MIT" ]
12
2016-10-28T08:58:09.000Z
2022-03-30T11:37:22.000Z
#include <algorithm> #include <iostream> #include <string> #include <cxxopts.hpp> #include <colorlog/Logger.h> #include <colorlog/Priority.h> #include <plasp-app/Command.h> #include <plasp-app/CommandType.h> #include <plasp-app/Version.h> //////////////////////////////////////////////////////////////////////////////////////////////////// // // Main // //////////////////////////////////////////////////////////////////////////////////////////////////// int main(int argc, char **argv) { colorlog::Logger logger; if (argc < 2) { CommandHelp().run(argc - 1, &argv[1]); return EXIT_FAILURE; } try { switch (parseCommandType(argv[1])) { case CommandType::Help: return CommandHelp().run(argc - 1, &argv[1]); case CommandType::Version: return CommandVersion().run(argc - 1, &argv[1]); case CommandType::Translate: return CommandTranslate().run(argc - 1, &argv[1]); case CommandType::Normalize: return CommandNormalize().run(argc - 1, &argv[1]); case CommandType::Beautify: return CommandBeautify().run(argc - 1, &argv[1]); case CommandType::CheckSyntax: return CommandCheckSyntax().run(argc - 1, &argv[1]); default: logger.log(colorlog::Priority::Error, std::string("command “") + argv[1] + "” not yet implemented"); exit(EXIT_FAILURE); } } catch (std::exception &exception) { logger.log(colorlog::Priority::Error, exception.what()); std::cout << std::endl; CommandHelp().run(argc - 1, &argv[1]); return EXIT_FAILURE; } return EXIT_FAILURE; }
21.971429
104
0.572822
rkaminsk
1d71f2fc2d32771424c328540fda08a7d035076f
1,388
hpp
C++
Examples/Telemetry/recorder.hpp
raving-bots/expansim-sdk
22f5c794523abbe9c27688963b607b13671ff118
[ "BSL-1.0" ]
1
2020-01-17T14:10:22.000Z
2020-01-17T14:10:22.000Z
Examples/Telemetry/recorder.hpp
raving-bots/expansim-sdk
22f5c794523abbe9c27688963b607b13671ff118
[ "BSL-1.0" ]
null
null
null
Examples/Telemetry/recorder.hpp
raving-bots/expansim-sdk
22f5c794523abbe9c27688963b607b13671ff118
[ "BSL-1.0" ]
null
null
null
// Copyright Raving Bots 2018-2020 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file SDK-LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt) #pragma once #include <fstream> #include <filesystem> namespace xsim { struct BodyTelemetryDataV1; struct RigidTransformV1; struct VehicleSetupInfoV1; struct DashboardStateV1; } namespace plugin { struct TelemetryRecorder final { TelemetryRecorder(const TelemetryRecorder& other) = delete; TelemetryRecorder(TelemetryRecorder&& other) noexcept = delete; TelemetryRecorder& operator=(const TelemetryRecorder& other) = delete; TelemetryRecorder& operator=(TelemetryRecorder&& other) noexcept = delete; explicit TelemetryRecorder(const std::filesystem::path& basePath); ~TelemetryRecorder() = default; void Start(const xsim::VehicleSetupInfoV1& vehicleSetup); void RecordTelemetry( float dt, const xsim::RigidTransformV1& transform, const xsim::BodyTelemetryDataV1& telemetry ); void RecordDashboard( float dt, const xsim::DashboardStateV1& dashboard ); private: std::filesystem::path m_OutputPath{}; std::ofstream m_TelemetryFile{}; std::ofstream m_DashboardFile{}; float m_TelemetryTime{}; float m_TelemetryFlushTime{}; float m_DashboardTime{}; float m_DashboardFlushTime{}; }; }
25.703704
88
0.731988
raving-bots
1d72f491b71728130b623288a39f21da371c1c83
18,794
cc
C++
mozy/src/help/help_cache.cc
wrcad/xictools
f46ba6d42801426739cc8b2940a809b74f1641e2
[ "Apache-2.0" ]
73
2017-10-26T12:40:24.000Z
2022-03-02T16:59:43.000Z
mozy/src/help/help_cache.cc
chris-ayala/xictools
4ea72c118679caed700dab3d49a8d36445acaec3
[ "Apache-2.0" ]
12
2017-11-01T10:18:22.000Z
2022-03-20T19:35:36.000Z
mozy/src/help/help_cache.cc
chris-ayala/xictools
4ea72c118679caed700dab3d49a8d36445acaec3
[ "Apache-2.0" ]
34
2017-10-06T17:04:21.000Z
2022-02-18T16:22:03.000Z
/*========================================================================* * * * Distributed by Whiteley Research Inc., Sunnyvale, California, USA * * http://wrcad.com * * Copyright (C) 2017 Whiteley Research Inc., all rights reserved. * * Author: Stephen R. Whiteley, except as indicated. * * * * As fully as possible recognizing licensing terms and conditions * * imposed by earlier work from which this work was derived, if any, * * this work is released under the Apache License, Version 2.0 (the * * "License"). You may not use this file except in compliance with * * the License, and compliance with inherited licenses which are * * specified in a sub-header below this one if applicable. A copy * * of the License is provided with this distribution, or you may * * obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * See the License for the specific language governing permissions * * and limitations under the License. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON- * * INFRINGEMENT. IN NO EVENT SHALL WHITELEY RESEARCH INCORPORATED * * OR STEPHEN R. WHITELEY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * * USE OR OTHER DEALINGS IN THE SOFTWARE. * * * *========================================================================* * XicTools Integrated Circuit Design System * * * * Help System Files * * * *========================================================================* $Id:$ *========================================================================*/ #include "config.h" #include "help_cache.h" #include "miscutil/filestat.h" #include "miscutil/pathlist.h" #include <string.h> #include <errno.h> #include <sys/stat.h> #include <unistd.h> #include <stdlib.h> // default cache size (number of saved files) int HLPcache::cache_size = CACHE_NUMFILES; /*======================================================================= = = The URL Cache Functions = =======================================================================*/ HLPcache::HLPcache() { dirname = 0; tagcnt = 0; nocache_ent = 0; entries = new HLPcacheEnt* [cache_size]; memset(entries, 0, cache_size*sizeof(HLPcacheEnt*)); memset(table, 0, sizeof(table)); use_ext = true; set_dir(); load(); } // The "front end" functions get(), add(), set_complete(), and // remove() constitute the basic interface to the application. The // dump()/load() functions are used to write/read the directory file // directly, and should be used with care if called by the // application. The external functions (suffixed with "_ext") are // similar, but maintain the external directory file. These are // called from the non-suffixed functions if "use_ext" is set, in // which case we have an internal "local" cache, and an external cache // with state maintained in the directory file. // Get the entry for url from the cache, or return 0 if not found. If // the entry is found, the directory is consulted to make sure that it // is still current, if use_ext is set. Note that this function always // fails if nocache is set. // HLPcacheEnt * HLPcache::get(const char *url, bool nocache) { if (!nocache) { int ix = tab_get(url); if (ix >= 0) { if (!entries[ix]) // shouldn't happen tab_remove(url); else { if (use_ext) { HLPcache *c = new HLPcache; c->load(); HLPcacheEnt *ce = c->get_ext(url, nocache); if (!ce || c->entries[ix] != ce) { // Not found in ext cache, or has a different // index from the ext cache, not acceptable so // delete entry tab_remove(url); delete entries[ix]; entries[ix] = 0; // pop_up_cache(0, MODE_UPD); } delete c; } return (entries[ix]); } } } return (0); } // Get the entry for url from the cache, or return 0 if not found. // Note that this function always fails if nocache is set. // HLPcacheEnt * HLPcache::get_ext(const char *url, bool nocache) { if (!nocache) { int ix = tab_get(url); if (ix >= 0) { if (!entries[ix]) // shouldn't happen tab_remove(url); else return (entries[ix]); } } return (0); } // Add en entry for url into the cache, and return the new entry. The // set_complete() function should be called once the file status is // known. The HLPcacheEnt pointer is returned, which provides the name // of the file associated with this url. If nocache is set, the // return value points to a single struct which is used for all // accesses. // HLPcacheEnt * HLPcache::add(const char *url, bool nocache) { set_dir(); if (!nocache) { if (dirname) { int ix = tab_get(url); if (ix >= 0) { // entry exists, delete old one tab_remove(url); delete entries[ix]; entries[ix] = 0; } if (use_ext) { HLPcache *c = new HLPcache; c->load(); c->add_ext(url, nocache); tagcnt = c->tagcnt - 1; delete c; } const char *fn = CACHE_DIR + 1; ix = tagcnt % cache_size; char buf[256]; sprintf(buf, "%s/%s%d", dirname, fn, ix); if (entries[ix]) { tab_remove(entries[ix]->url); delete entries[ix]; } entries[ix] = new HLPcacheEnt(url, buf); tab_add(entries[ix]->url, ix); if (!use_ext) tagcnt++; // pop_up_cache(0, MODE_UPD); return (entries[ix]); } } // If we get here, we aren't caching. Create a single entry with // a temp file to use. // if (!nocache_ent) nocache_ent = new HLPcacheEnt(url, 0); else { delete [] nocache_ent->url; nocache_ent->url = lstring::copy(url); delete [] nocache_ent->filename; } nocache_ent->filename = filestat::make_temp("htp"); filestat::queue_deletion(nocache_ent->filename); return (nocache_ent); } // Add en entry for url into the cache, update the directory, and // return the new entry. The set_complete_ext() function should be // called once the file status is known. The HLPcacheEnt pointer is // returned, which provides the name of the file associated with this // url. If nocache is set, the return value points to a single struct // which is used for all accesses. // HLPcacheEnt * HLPcache::add_ext(const char *url, bool nocache) { set_dir(); if (!nocache) { if (dirname) { HLPcacheEnt *ctmp = 0; int ix = tab_get(url); if (ix >= 0) { // old version exists, delete it and save file for // deletion *after* the directory is updated tab_remove(url); ctmp = entries[ix]; entries[ix] = 0; int iy = tagcnt % cache_size; if ((ix == cache_size-1 && iy == 0) || ix == iy - 1) // slot was at top, so it can be reused tagcnt--; } const char *fn = CACHE_DIR + 1; ix = tagcnt % cache_size; char buf[256]; sprintf(buf, "%s/%s%d", dirname, fn, ix); if (entries[ix]) { // slot has prior entry, delete it, no need to delete // file since it is done anyway tab_remove(entries[ix]->url); delete entries[ix]; } entries[ix] = new HLPcacheEnt(url, buf); tab_add(entries[ix]->url, ix); tagcnt++; dump(); unlink(buf); if (ctmp) { unlink(ctmp->filename); delete ctmp; } return (entries[ix]); } } // If we get here, we aren't caching. Create a single entry with // a temp file to use. // if (!nocache_ent) nocache_ent = new HLPcacheEnt(url, 0); else { delete [] nocache_ent->url; nocache_ent->url = lstring::copy(url); delete [] nocache_ent->filename; } nocache_ent->filename = filestat::make_temp("htp"); filestat::queue_deletion(nocache_ent->filename); return (nocache_ent); } // After calling HLPcache::add(), one must supply the file named in the // struct returned. When this is done (ok is true), or if it can't be // done (ok is false) this function completes the add process // void HLPcache::set_complete(HLPcacheEnt *cent, DLstatus status) { if (cent) { DLstatus old_status = cent->get_status(); cent->set_status(status); if (status == DLnogo) // The external cache doesn't use nogo, so we can try download // again after reloading external cache status = DLincomplete; if (use_ext && old_status != status) { HLPcache *c = new HLPcache; c->load(); int ix = c->tab_get(cent->url); if (ix >= 0) c->set_complete_ext(c->entries[ix], status); delete c; } } } // After calling HLPcache::add_ext(), one must supply the file named in the // struct returned. When this is done (ok is true), or if it can't be // done (ok is false) this function completes the add process, updating // the directory // void HLPcache::set_complete_ext(HLPcacheEnt *cent, DLstatus status) { if (cent) { cent->set_status(status); dump(); } } // Remove the entry for url from the cache, return true if the object was // deleted. The directory is modified only if the entry existed in the // local cache, and use_ext is set. If nocache is set, nothing is done. // bool HLPcache::remove(const char *url, bool nocache) { if (!nocache) { int ix = tab_get(url); if (ix >= 0) { tab_remove(url); if (use_ext) { HLPcache *c = new HLPcache; c->load(); c->remove_ext(url, nocache); delete c; } delete entries[ix]; entries[ix] = 0; // pop_up_cache(0, MODE_UPD); return (true); } } return (false); } // Remove the entry for url from the cache, and update the directory. // If an entry was removed, true is returned. This is a no-op if // nocache is set. // bool HLPcache::remove_ext(const char *url, bool nocache) { if (!nocache) { int ix = tab_get(url); if (ix >= 0) { tab_remove(url); HLPcacheEnt *ctmp = entries[ix]; entries[ix] = 0; dump(); unlink(ctmp->filename); delete ctmp; return (true); } } return (false); } // Clear the cache. This clears only the cache struct and does not touch // the directory. // void HLPcache::clear() { for (int i = 0; i < CACHE_NUMHASH; i++) { HLPcacheTabEnt *t = table[i]; while (t) { HLPcacheTabEnt *tn = t->next; delete t; t = tn; } table[i] = 0; } for (int i = 0; i < cache_size; i++) { delete entries[i]; entries[i] = 0; } tagcnt = 0; // pop_up_cache(0, MODE_UPD); } // Create a file named "directory" in the cache directory, and dump a // listing of the current cache contents. The first line of the file // contains the file prefix, and the current integer index (two tokens). // Additional lines describe the entries (three tokens): the first token // is the index, the second token is '0' if the file is ok, '1' otherwise, // and the third token is the url. // // Note that calling this function overwrites the directory, so the // previous contents should be read and merged first. // void HLPcache::dump() { char buf[256]; if (dirname) { sprintf(buf, "%s/%s", dirname, "directory"); FILE *fp = fopen(buf, "w"); if (fp) { fprintf(fp, "%s %d\n", CACHE_DIR + 1, tagcnt % cache_size); for (int i = 0; i < cache_size; i++) { if (entries[i]) fprintf(fp, "%-4d %d %s\n", i, entries[i]->get_status(), entries[i]->url); } fclose (fp); } } } // Initialize the cache from the "directory" file. The cache is cleared // before reading the directory. // void HLPcache::load() { char buf[256]; set_dir(); if (dirname) { const char *fn = CACHE_DIR + 1; sprintf(buf, "%s/%s", dirname, "directory"); FILE *fp = fopen(buf, "r"); if (fp) { int tc = 0; if (fgets(buf, 256, fp) != 0) { if (!lstring::prefix(fn, buf)) { fclose (fp); return; } if (sscanf(buf, "%*s %d", &tc) < 1 || tc < 0) { fclose (fp); return; } if (tc >= cache_size) tc = 0; } clear(); tagcnt = tc; char tbuf[256]; sprintf(tbuf, "%s/%s", dirname, CACHE_DIR + 1); int fend = strlen(tbuf); while (fgets(buf, 256, fp) != 0) { char *s = buf; char *fnum = lstring::gettok(&s); char *inc = lstring::gettok(&s); char *url = lstring::gettok(&s); if (!url) { delete [] fnum; delete [] inc; continue; } int ix; if (sscanf(fnum, "%d", &ix) < 1 || ix < 0 || ix >= cache_size) { delete [] url; delete [] inc; delete [] fnum; break; } strcpy(tbuf + fend, fnum); entries[ix] = new HLPcacheEnt(url, tbuf); if (*inc == '0') entries[ix]->set_status(DLok); tab_add(entries[ix]->url, ix); delete [] url; delete [] inc; delete [] fnum; } // pop_up_cache(0, MODE_UPD); fclose(fp); } } } // Resize the cache size to newsize // void HLPcache::resize(int newsize) { if (newsize == cache_size) return; HLPcacheEnt **tmp = new HLPcacheEnt* [newsize]; if (newsize > cache_size) { int i; for (i = 0; i < cache_size; i++) tmp[i] = entries[i]; for ( ; i < newsize; i++) tmp[i] = 0; delete [] entries; entries = tmp; } else { int i; for (i = 0; i < newsize; i++) tmp[i] = entries[i]; for ( ; i < cache_size; i++) { tab_remove(entries[i]->url); delete entries[i]; } delete [] entries; entries = tmp; if (tagcnt >= newsize) tagcnt = 0; } cache_size = newsize; // pop_up_cache(0, MODE_UPD); } // Private function to remove the url from the hash table // void HLPcache::tab_remove(const char *url) { int i = hash(url); HLPcacheTabEnt *ctep = 0; for (HLPcacheTabEnt *cte = table[i]; cte; cte = cte->next) { if (!strcmp(url, cte->url)) { if (ctep) ctep->next = cte->next; else table[i] = cte->next; delete cte; return; } ctep = cte; } } // Private function to obtain the directory where cache files are // stored // void HLPcache::set_dir() { if (!dirname) { char *home = pathlist::get_home(0); if (home) { char *pbuf = pathlist::mk_path(home, CACHE_DIR); delete [] home; struct stat st; if (stat(pbuf, &st)) { if (errno != ENOENT || #ifdef WIN32 mkdir(pbuf)) { #else mkdir(pbuf, 0755)) { #endif delete [] pbuf; return; } } else if (!S_ISDIR(st.st_mode)) { delete [] pbuf; return; } dirname = pbuf; } } } // Return a string list of the current valid entries. // stringlist * HLPcache::list_entries() { stringlist *s0 = 0, *se = 0; int c1 = 2; if (HLPcache::cache_size > 99) c1 = 3; if (HLPcache::cache_size > 999) c1 = 4; for (int i = 0; i < cache_size; i++) { if (entries[i] && entries[i]->get_status() == DLok) { int len = strlen(entries[i]->url); char *buf = new char[len + 12]; sprintf(buf, "%-*d %s", c1, i, entries[i]->url); stringlist *s = new stringlist(buf, 0); if (s0) { se->next = s; se = se->next; } else s0 = se = s; } } return (s0); } // End of HLPcache functions
31.375626
76
0.481803
wrcad
1d76067a750b361e65b85753922d415b7dac0769
987
hpp
C++
include/boost/sql/detail/service_base.hpp
purpleKarrot/async-db
172124e5657e3085e8ac7729c4e578c0d766bf7b
[ "BSL-1.0" ]
5
2016-09-19T01:02:33.000Z
2019-10-23T07:15:00.000Z
include/boost/sql/detail/service_base.hpp
purpleKarrot/async-db
172124e5657e3085e8ac7729c4e578c0d766bf7b
[ "BSL-1.0" ]
null
null
null
include/boost/sql/detail/service_base.hpp
purpleKarrot/async-db
172124e5657e3085e8ac7729c4e578c0d766bf7b
[ "BSL-1.0" ]
null
null
null
/************************************************************** * Copyright (c) 2008-2009 Daniel Pfeifer * * * * Distributed under the Boost Software License, Version 1.0. * **************************************************************/ #ifndef BOOST_SQL_DETAIL_SERVICE_BASE_HPP #define BOOST_SQL_DETAIL_SERVICE_BASE_HPP #include <boost/asio/io_service.hpp> namespace boost { namespace sql { namespace detail { template<typename Type> class service_id: public asio::io_service::id { }; template<typename Type> class service_base: public asio::io_service::service { public: static service_id<Type> id; protected: service_base(asio::io_service& io_service) : asio::io_service::service(io_service) { } }; template<typename Type> service_id<Type> service_base<Type>::id; } // end namespace detail } // end namespace sql } // end namespace boost #endif /* BOOST_SQL_DETAIL_SERVICE_BASE_HPP */
21.933333
64
0.599797
purpleKarrot
1d7b2fe6b0f1d1621736cc7491c56aaf6abb0c71
164
cpp
C++
Society2.0/Society2.0/ProposeMeetingToPersonUI.cpp
simsim314/Society2.0
a95e42122e2541b7544dd641247681996f1e625a
[ "Unlicense" ]
1
2019-07-11T13:10:43.000Z
2019-07-11T13:10:43.000Z
Society2.0/Society2.0/ProposeMeetingToPersonUI.cpp
mdheller/Society2.0
a95e42122e2541b7544dd641247681996f1e625a
[ "Unlicense" ]
1
2019-02-19T12:32:52.000Z
2019-03-07T20:49:50.000Z
Society2.0/Society2.0/ProposeMeetingToPersonUI.cpp
mdheller/Society2.0
a95e42122e2541b7544dd641247681996f1e625a
[ "Unlicense" ]
1
2020-01-10T12:37:30.000Z
2020-01-10T12:37:30.000Z
#include "ProposeMeetingToPersonUI.h" ProposeMeetingToPersonUI::ProposeMeetingToPersonUI() { } ProposeMeetingToPersonUI::~ProposeMeetingToPersonUI() { }
16.4
54
0.780488
simsim314
1d7bb55de785b8146ac241ca0fe4c04b117bbddf
820
cpp
C++
naive_simulation_works/systemc_for_dummies/full_adder/main.cpp
VSPhaneendraPaluri/pvsdrudgeworks
5827f45567eecbcf0bb606de6adb1fb94fe2d8c6
[ "MIT" ]
null
null
null
naive_simulation_works/systemc_for_dummies/full_adder/main.cpp
VSPhaneendraPaluri/pvsdrudgeworks
5827f45567eecbcf0bb606de6adb1fb94fe2d8c6
[ "MIT" ]
null
null
null
naive_simulation_works/systemc_for_dummies/full_adder/main.cpp
VSPhaneendraPaluri/pvsdrudgeworks
5827f45567eecbcf0bb606de6adb1fb94fe2d8c6
[ "MIT" ]
null
null
null
#include <systemc.h> #include "Full_Adder.h" #include "MyTestBenchDriver.h" #include "MyTestBenchMonitor.h" int sc_main(int sc_argc, char* sc_argv[]) { sc_signal<bool> pb_a, pb_b, pb_c_in, pb_sum, pb_c_out; Full_Adder MyFullAdder("MyFullAdder"); MyFullAdder.a(pb_a); MyFullAdder.b(pb_b); MyFullAdder.c_in(pb_c_in); MyFullAdder.sum_out(pb_sum); MyFullAdder.c_out(pb_c_out); MyTestBenchDriver MyTBDriver("MyTBDriver"); MyTBDriver.TBDriver_a(pb_a); MyTBDriver.TBDriver_b(pb_b); MyTBDriver.TBDriver_c(pb_c_in); MyTestBenchMonitor MyTBMonitor("MyTBMonitor"); MyTBMonitor.TBMonitor_a(pb_a); MyTBMonitor.TBMonitor_b(pb_b); MyTBMonitor.TBMonitor_c(pb_c_in); MyTBMonitor.TBMonitor_sum(pb_sum); MyTBMonitor.TBMonitor_carry(pb_c_out); sc_set_time_resolution(1, SC_NS); sc_start(100.0, SC_NS); return 0; }
24.117647
55
0.780488
VSPhaneendraPaluri
1d7e864e133c0e01805f410caad1669adec00b6b
2,131
cpp
C++
src/utils.cpp
SohilZidan/point-cloud-registration
5e7f52fbf04f3a58238a2c92393143d5e110c8e4
[ "MIT" ]
null
null
null
src/utils.cpp
SohilZidan/point-cloud-registration
5e7f52fbf04f3a58238a2c92393143d5e110c8e4
[ "MIT" ]
1
2021-11-27T17:52:07.000Z
2021-11-28T07:04:05.000Z
src/utils.cpp
SohilZidan/point-cloud-registration
5e7f52fbf04f3a58238a2c92393143d5e110c8e4
[ "MIT" ]
null
null
null
#include <vector> #include <tuple> #include <cmath> #include <numeric> #include <Eigen/Dense> #include "../happly.h" #include "../nanoflann.hpp" #include "utils.hpp" float icp::mse_cost(std::vector<std::tuple<float, int, int>>& distances, float xi) { size_t Np = distances.size(); size_t Npo = xi*Np; float Sts = std::accumulate(distances.begin(), distances.begin() + Npo, 0, tupleAccumulateOP); xi = (float)std::pow(xi, 3); float e = Sts/Npo; return e/xi; } bool icp::comparePairs(const std::tuple<float, int, int>& lhs, const std::tuple<float, int, int>& rhs) { return std::get<0>(lhs) < std::get<0>(rhs); } float icp::tupleAccumulateOP(const float &a, const std::tuple<float, int, int> &b) { return a+std::get<0>(b); } icp::PointCloud icp::readPointCloud(const std::string filename) { //"../data/fountain_a.ply" happly::PLYData plyData(filename); // auto propsNames = plyData.getElement("vertex").getPropertyNames(); std::vector<std::array<double, 3>> vPos = plyData.getVertexPositions(); size_t dim = 3; size_t N = vPos.size(); icp::PointCloud mat(N, dim); mat.resize(N, dim); for (size_t i = 0; i < N; i++) for (size_t d = 0; d < dim; d++) mat(i, d) = vPos[i][d]; // for(const auto& prop: propsNames) // std::cout<<prop<<std::endl; return mat; } icp::PointCloud icp::addNoise(icp::PointCloud M) { // get dimentions size_t rows = M.rows(); size_t cols = M.cols(); return icp::PointCloud::Random(rows, cols); } // rotation Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> icp::rotate(icp::PointCloud& M, float deg, Eigen::Vector3f axis) { // float deg = 10.f; float rad = deg * M_PI / 180; // Eigen::Vector3f axis(0,1,1); Eigen::Transform<float, 3, Eigen::Affine> t; Eigen::AngleAxis<float> rot(rad, axis); t = rot; // std::cout<<t.linear()<<std::endl; // std::cout<<t.linear().inverse()<<std::endl; // std::cout<<t.linear().inverse().matrix()<<std::endl; M = (t.linear() * M.transpose()).transpose(); return t.linear().matrix(); }
27.320513
117
0.610042
SohilZidan
1d7f338e73721230a354e4e7bf9154ddc45c5558
7,955
cpp
C++
framework/src/media/MediaPlayerImpl.cpp
Acidburn0zzz/TizenRT
45f955fe8e19e2bdffc9c31fa5dbc3a032bacc39
[ "Apache-2.0" ]
1
2018-04-23T12:39:01.000Z
2018-04-23T12:39:01.000Z
framework/src/media/MediaPlayerImpl.cpp
Acidburn0zzz/TizenRT
45f955fe8e19e2bdffc9c31fa5dbc3a032bacc39
[ "Apache-2.0" ]
null
null
null
framework/src/media/MediaPlayerImpl.cpp
Acidburn0zzz/TizenRT
45f955fe8e19e2bdffc9c31fa5dbc3a032bacc39
[ "Apache-2.0" ]
null
null
null
/* **************************************************************** * * Copyright 2018 Samsung Electronics All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************/ #include <media/MediaPlayer.h> #include "PlayerWorker.h" #include "MediaPlayerImpl.h" #include <debug.h> #include "audio/audio_manager.h" namespace media { MediaPlayerImpl::MediaPlayerImpl() { mPlayerObserver = nullptr; mCurState = PLAYER_STATE_NONE; mBuffer = nullptr; mInputDataSource = nullptr; static int playerId = 1; mId = playerId++; } player_result_t MediaPlayerImpl::create() { std::unique_lock<std::mutex> lock(mCmdMtx); medvdbg("MediaPlayer create\n"); if (mCurState != PLAYER_STATE_NONE) { meddbg("MediaPlayer create fail : wrong state\n"); return PLAYER_ERROR; } PlayerWorker& mpw = PlayerWorker::getWorker(); mpw.startWorker(); mpw.getQueue().enQueue(&MediaPlayerImpl::notifySync, shared_from_this()); mSyncCv.wait(lock); mCurState = PLAYER_STATE_IDLE; return PLAYER_OK; } player_result_t MediaPlayerImpl::destroy() { std::unique_lock<std::mutex> lock(mCmdMtx); medvdbg("MediaPlayer destroy\n"); if (mCurState != PLAYER_STATE_IDLE) { meddbg("MediaPlayer destroy fail : wrong state\n"); return PLAYER_ERROR; } PlayerWorker& mpw = PlayerWorker::getWorker(); mpw.getQueue().enQueue(&MediaPlayerImpl::notifySync, shared_from_this()); mSyncCv.wait(lock); mpw.stopWorker(); PlayerObserverWorker& pow = PlayerObserverWorker::getWorker(); pow.stopWorker(); mCurState = PLAYER_STATE_NONE; return PLAYER_OK; } player_result_t MediaPlayerImpl::prepare() { std::unique_lock<std::mutex> lock(mCmdMtx); medvdbg("MediaPlayer prepare\n"); if (mCurState != PLAYER_STATE_IDLE) { meddbg("MediaPlayer prepare fail : wrong state\n"); return PLAYER_ERROR; } PlayerWorker& mpw = PlayerWorker::getWorker(); mpw.getQueue().enQueue(&MediaPlayerImpl::notifySync, shared_from_this()); mSyncCv.wait(lock); if (mInputDataSource == nullptr) { meddbg("MediaPlayer prepare fail : mInputDataSource is not set\n"); return PLAYER_ERROR; } if (!mInputDataSource->open()) { meddbg("MediaPlayer prepare fail : file open fail\n"); return PLAYER_ERROR; } if (set_audio_stream_out(mInputDataSource->getChannels(), mInputDataSource->getSampleRate(), mInputDataSource->getPcmFormat()) != AUDIO_MANAGER_SUCCESS) { meddbg("MediaPlayer prepare fail : set_audio_stream_out fail\n"); return PLAYER_ERROR; } mBufSize = get_output_frames_byte_size(get_output_frame_count()); medvdbg("MediaPlayer mBuffer size : %d\n", mBufSize); mBuffer = new unsigned char[mBufSize]; if (!mBuffer) { meddbg("MediaPlayer prepare fail : mBuffer allocation fail\n"); return PLAYER_ERROR; } mCurState = PLAYER_STATE_READY; return PLAYER_OK; } player_result_t MediaPlayerImpl::unprepare() { std::unique_lock<std::mutex> lock(mCmdMtx); medvdbg("MediaPlayer unprepare\n"); if (mCurState == PLAYER_STATE_NONE || mCurState == PLAYER_STATE_IDLE) { meddbg("MediaPlayer unprepare fail : wrong state\n"); return PLAYER_ERROR; } PlayerWorker& mpw = PlayerWorker::getWorker(); mpw.getQueue().enQueue(&MediaPlayerImpl::notifySync, shared_from_this()); mSyncCv.wait(lock); if (mBuffer) { delete[] mBuffer; mBuffer = nullptr; } mBufSize = 0; if (reset_audio_stream_out() != AUDIO_MANAGER_SUCCESS) { meddbg("MediaPlayer unprepare fail : reset_audio_stream_out fail\n"); return PLAYER_ERROR; } if (destroy_audio_stream_out() != AUDIO_MANAGER_SUCCESS) { meddbg("MediaPlayer unprepare fail : destroy_audio_stream_out fail\n"); return PLAYER_ERROR; } mInputDataSource->close(); mCurState = PLAYER_STATE_IDLE; return PLAYER_OK; } player_result_t MediaPlayerImpl::start() { std::lock_guard<std::mutex> lock(mCmdMtx); medvdbg("MediaPlayer start\n"); PlayerWorker& mpw = PlayerWorker::getWorker(); mpw.getQueue().enQueue(&PlayerWorker::startPlayer, &mpw, shared_from_this()); return PLAYER_OK; } player_result_t MediaPlayerImpl::stop() { std::lock_guard<std::mutex> lock(mCmdMtx); medvdbg("MediaPlayer stop\n"); PlayerWorker& mpw = PlayerWorker::getWorker(); mpw.getQueue().enQueue(&PlayerWorker::stopPlayer, &mpw, shared_from_this()); return PLAYER_OK; } player_result_t MediaPlayerImpl::pause() { std::lock_guard<std::mutex> lock(mCmdMtx); medvdbg("MediaPlayer pause\n"); PlayerWorker& mpw = PlayerWorker::getWorker(); mpw.getQueue().enQueue(&PlayerWorker::pausePlayer, &mpw, shared_from_this()); return PLAYER_OK; } int MediaPlayerImpl::getVolume() { std::lock_guard<std::mutex> lock(mCmdMtx); medvdbg("MediaPlayer getVolume\n"); if (mCurState == PLAYER_STATE_NONE) { meddbg("MediaPlayer getVolume fail : wrong state\n"); return -1; } return get_audio_volume(); } player_result_t MediaPlayerImpl::setVolume(int vol) { std::lock_guard<std::mutex> lock(mCmdMtx); medvdbg("MediaPlayer setVolume\n"); if (mCurState == PLAYER_STATE_NONE) { meddbg("MediaPlayer setVolume fail : wrong state\n"); return PLAYER_ERROR; } if (vol < 0 || vol > 31) { meddbg("MediaPlayer setVolume fail : invalid argument. volume level should be 0(Min) ~ 31(Max)\n"); return PLAYER_ERROR; } if (!set_audio_volume(vol)) { mCurVolume = vol; return PLAYER_OK; } else { return PLAYER_ERROR; } } void MediaPlayerImpl::setDataSource(std::unique_ptr<stream::InputDataSource> source) { std::lock_guard<std::mutex> lock(mCmdMtx); medvdbg("MediaPlayer setDataSource\n"); mInputDataSource = std::move(source); } void MediaPlayerImpl::setObserver(std::shared_ptr<MediaPlayerObserverInterface> observer) { std::unique_lock<std::mutex> lock(mCmdMtx); medvdbg("MediaPlayer setObserver\n"); PlayerWorker& mpw = PlayerWorker::getWorker(); mpw.getQueue().enQueue(&MediaPlayerImpl::notifySync, shared_from_this()); mSyncCv.wait(lock); PlayerObserverWorker& pow = PlayerObserverWorker::getWorker(); pow.startWorker(); mPlayerObserver = observer; } player_state_t MediaPlayerImpl::getState() { medvdbg("MediaPlayer getState\n"); return mCurState; } player_result_t MediaPlayerImpl::seekTo(int msec) { medvdbg("MediaPlayer seekTo %d msec\n", msec); // TODO : implementation of seekTo return PLAYER_OK; } void MediaPlayerImpl::notifySync() { mSyncCv.notify_one(); } void MediaPlayerImpl::notifyObserver(player_observer_command_t cmd) { if (mPlayerObserver != nullptr) { PlayerObserverWorker& pow = PlayerObserverWorker::getWorker(); switch (cmd) { case PLAYER_OBSERVER_COMMAND_STARTED: pow.getQueue().enQueue(&MediaPlayerObserverInterface::onPlaybackStarted, mPlayerObserver, mId); break; case PLAYER_OBSERVER_COMMAND_FINISHIED: pow.getQueue().enQueue(&MediaPlayerObserverInterface::onPlaybackFinished, mPlayerObserver, mId); break; case PLAYER_OBSERVER_COMMAND_ERROR: pow.getQueue().enQueue(&MediaPlayerObserverInterface::onPlaybackError, mPlayerObserver, mId); break; } } } int MediaPlayerImpl::playback(int size) { return start_audio_stream_out(mBuffer, get_output_bytes_frame_count(size)); } MediaPlayerImpl::~MediaPlayerImpl() { player_result_t ret; if (mCurState > PLAYER_STATE_IDLE) { ret = unprepare(); if (ret != PLAYER_OK) { meddbg("~MediaPlayer fail : unprepare fail\n"); } } if (mCurState == PLAYER_STATE_IDLE) { ret = destroy(); if (ret != PLAYER_OK) { meddbg("~MediaPlayer fail : destroy fail\n"); } } } } // namespace media
26.784512
101
0.730735
Acidburn0zzz
1d86650d1d6904f114f7114b4d8211bde89cc8de
5,315
hpp
C++
include/ssGUI/GUIObjectClasses/GUIObject.hpp
Neko-Box-Coder/ssGUI
25e218fd79fea105a30737a63381cf8d0be943f6
[ "Apache-2.0" ]
15
2022-01-21T10:48:04.000Z
2022-03-27T17:55:11.000Z
include/ssGUI/GUIObjectClasses/GUIObject.hpp
Neko-Box-Coder/ssGUI
25e218fd79fea105a30737a63381cf8d0be943f6
[ "Apache-2.0" ]
null
null
null
include/ssGUI/GUIObjectClasses/GUIObject.hpp
Neko-Box-Coder/ssGUI
25e218fd79fea105a30737a63381cf8d0be943f6
[ "Apache-2.0" ]
4
2022-01-21T10:48:05.000Z
2022-01-22T15:42:34.000Z
#ifndef SSGUI_GUI_OBJECT #define SSGUI_GUI_OBJECT #include "ssGUI/Enums/GUIObjectType.hpp" #include "ssGUI/DataClasses/Transform.hpp" #include "ssGUI/DataClasses/Renderer.hpp" #include "ssGUI/DataClasses/Hierarchy.hpp" #include "ssGUI/DataClasses/ExtensionManager.hpp" #include "ssGUI/DataClasses/EventCallbackManager.hpp" #include "ssGUI/EventCallbacks/EventCallback.hpp" #include "glm/vec4.hpp" #include <vector> #include <list> #include <limits> #include <unordered_set> #include <unordered_map> //namespace: ssGUI namespace ssGUI { class Menu; /*class: ssGUI::GUIObject This is the implementation class for <ssGUI::GUIObject>. See <ssGUI::GUIObject> for more details about the functions Variables & Constructor: ============================== C++ ============================== protected: glm::vec2 LastGlobalPosition;//Cache rendering std::unordered_set<std::string> CurrentTags; ssGUI::Menu* RightClickMenu; ================================================================= ============================== C++ ============================== GUIObject::GUIObject(GUIObject const& other) : Transform(other), Renderer(other), Hierarchy(other), ExtensionManager(other), EventCallbackManager(other) { LastGlobalPosition = other.LastGlobalPosition; CurrentTags = other.CurrentTags;// std::unordered_set<std::string>(); RightClickMenu = other.RightClickMenu; SetupComponents(); SetParent(other.GetParent()); //Note : Reason of using SetParent is to inform the parent to add this as a child } ================================================================= */ class GUIObject : public Transform, public Renderer, public Hierarchy, public ExtensionManager, public EventCallbackManager { private: GUIObject& operator=(GUIObject const& other); protected: glm::vec2 LastGlobalPosition;//Cache rendering std::unordered_set<std::string> CurrentTags; ssGUI::Menu* RightClickMenu; GUIObject(GUIObject const& other); virtual void SetupComponents(); virtual ssGUI::GUIObject* CloneChildren(ssGUI::GUIObject* originalRoot, ssGUI::GUIObject* clonedRoot); virtual void CloneExtensionsAndEventCallbacks(ssGUI::GUIObject* clonedObj); virtual void CheckRightClickMenu(ssGUI::Backend::BackendSystemInputInterface* inputInterface, ssGUI::InputStatus& globalInputStatus, ssGUI::InputStatus& windowInputStatus, ssGUI::GUIObject* mainWindow); virtual void MainLogic(ssGUI::Backend::BackendSystemInputInterface* inputInterface, ssGUI::InputStatus& globalInputStatus, ssGUI::InputStatus& windowInputStatus, ssGUI::GUIObject* mainWindow); public: //TODO : Maybe make this thread safe? inline static std::vector<ssGUI::GUIObject*> ObjsToDelete = std::vector<ssGUI::GUIObject*>(); GUIObject(); virtual ~GUIObject(); //function: GetType //Returns the type of this GUI Object. Note that <ssGUI::Enums::GUIObjectType> is a bit-operated enum class. virtual ssGUI::Enums::GUIObjectType GetType() const; //function: AddTag //Adds a tag to this GUI Object virtual void AddTag(std::string tag); //function: RemoveTag //Removes the tag on this GUI Object virtual void RemoveTag(std::string tag); //function: HasTag //Returns true if the tag exists on this GUI Object virtual bool HasTag(std::string tag) const; //function: RegisterRightClickMenu //Register this GUI Object to a menu that can be triggered by right click virtual void RegisterRightClickMenu(ssGUI::Menu* menu); //function: ClearRightClickMenu //Clears the right click menu virtual void ClearRightClickMenu(); //function: Internal_Draw //(Internal ssGUI function) Draw function called by <ssGUIManager> virtual void Internal_Draw(ssGUI::Backend::BackendDrawingInterface* drawingInterface, ssGUI::GUIObject* mainWindow, glm::vec2 mainWindowPositionOffset); //function: Internal_Update //(Internal ssGUI function) Update function called by <ssGUIManager> virtual void Internal_Update(ssGUI::Backend::BackendSystemInputInterface* inputInterface, ssGUI::InputStatus& globalInputStatus, ssGUI::InputStatus& windowInputStatus, ssGUI::GUIObject* mainWindow); //function: Clone //Clone function for cloning the object. Use this function instead of assignment operator or copy constructor. //The cloned object will be allocated on the heap and the clean up will be managed by ssGUI. //Setting cloneChildren will clone all the children recursively with all the ObjectsReferences respectively. virtual GUIObject* Clone(bool cloneChildren); }; } #endif
45.42735
211
0.621825
Neko-Box-Coder
1d87cdc304e12262f8bd72bc10ce67210914e054
427
hpp
C++
library/ATF/CCheckSumBaseConverter.hpp
lemkova/Yorozuya
f445d800078d9aba5de28f122cedfa03f26a38e4
[ "MIT" ]
29
2017-07-01T23:08:31.000Z
2022-02-19T10:22:45.000Z
library/ATF/CCheckSumBaseConverter.hpp
kotopes/Yorozuya
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
[ "MIT" ]
90
2017-10-18T21:24:51.000Z
2019-06-06T02:30:33.000Z
library/ATF/CCheckSumBaseConverter.hpp
kotopes/Yorozuya
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
[ "MIT" ]
44
2017-12-19T08:02:59.000Z
2022-02-24T23:15:01.000Z
// This file auto generated by plugin for ida pro. Generated code only for x64. Please, dont change manually #pragma once #include <common/common.h> START_ATF_NAMESPACE struct CCheckSumBaseConverter { public: long double ProcCode(char byIndex, unsigned int dwSerial, long double dValue); unsigned int ProcCode(char byIndex, unsigned int dwSerial, unsigned int dwValue); }; END_ATF_NAMESPACE
28.466667
108
0.740047
lemkova
1d88d66879b023868d6d0b1812b4e63e4203bf9c
343
cpp
C++
tools/tests/dataMemberAccumulation.cpp
ouankou/rose
76f2a004bd6d8036bc24be2c566a14e33ba4f825
[ "BSD-3-Clause" ]
488
2015-01-09T08:54:48.000Z
2022-03-30T07:15:46.000Z
tools/tests/dataMemberAccumulation.cpp
WildeGeist/rose
17db6454e8baba0014e30a8ec23df1a11ac55a0c
[ "BSD-3-Clause" ]
174
2015-01-28T18:41:32.000Z
2022-03-31T16:51:05.000Z
tools/tests/dataMemberAccumulation.cpp
WildeGeist/rose
17db6454e8baba0014e30a8ec23df1a11ac55a0c
[ "BSD-3-Clause" ]
146
2015-04-27T02:48:34.000Z
2022-03-04T07:32:53.000Z
// accumulation of data members // // // typedef struct BLK { double * ccl; double *cbr; double *cbc; double *cbl; } Block_t; void foo (int nnalls, Block_t* mblk, double dtn) { for ( int i = 0 ; i < nnalls ; i++ ) { mblk->ccl[i] *= dtn ; mblk->cbr[i] *= dtn ; mblk->cbc[i] *= dtn ; mblk->cbl[i] *= dtn ; } }
14.913043
48
0.524781
ouankou
1d8a38af7e296e995cbd7a78019d63a48fed2a82
1,954
cpp
C++
prismdll/menu_nodes/BGCheckbox.cpp
MagneticPrism/prismdll
d00d45fa7017d48cae8ce9e30542ac43ed3936cd
[ "CC0-1.0" ]
null
null
null
prismdll/menu_nodes/BGCheckbox.cpp
MagneticPrism/prismdll
d00d45fa7017d48cae8ce9e30542ac43ed3936cd
[ "CC0-1.0" ]
null
null
null
prismdll/menu_nodes/BGCheckbox.cpp
MagneticPrism/prismdll
d00d45fa7017d48cae8ce9e30542ac43ed3936cd
[ "CC0-1.0" ]
null
null
null
#include "BGCheckbox.hpp" bool BGCheckbox::init(const char* _text) { if (!cocos2d::CCNode::init()) return false; this->m_pBGLayer = cocos2d::extension::CCScale9Sprite::create( "square02b_001.png", { 0.0f, 0.0f, 80.0f, 80.0f } ); this->m_pBGLayer->setScale(.5f); this->m_pBGLayer->setColor({ 0, 0, 0 }); this->m_pBGLayer->setOpacity(75); auto menu = cocos2d::CCMenu::create(); float fMenuPadding = 5.0f; auto pToggleOnSpr = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOn_001.png"); auto pToggleOffSpr = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkOff_001.png"); pToggleOnSpr->setScale(.8f); pToggleOffSpr->setScale(.8f); this->m_pToggler = gd::CCMenuItemToggler::create( pToggleOffSpr, pToggleOnSpr, this, nullptr ); menu->addChild(this->m_pToggler); this->m_pLabel = cocos2d::CCLabelBMFont::create(_text, "bigFont.fnt"); this->m_pLabel->setScale(.6f); menu->addChild(this->m_pLabel); menu->alignItemsHorizontallyWithPadding(fMenuPadding); menu->setContentSize({ this->m_pLabel->getScaledContentSize().width + this->m_pToggler->getScaledContentSize().width + fMenuPadding + 20.0f, 40.0f }); menu->setPosition(0, 0); this->m_pBGLayer->setContentSize(menu->getContentSize() * 2); this->setContentSize(menu->getContentSize()); this->addChild(this->m_pBGLayer); this->addChild(menu); return true; } void BGCheckbox::setEnabled(bool _e) { this->m_pToggler->setEnabled(_e); this->m_pLabel->setColor( _e ? cocos2d::ccColor3B { 255, 255, 255 } : cocos2d::ccColor3B { 130, 130, 130 } ); } BGCheckbox* BGCheckbox::create(const char* _text) { auto pRet = new BGCheckbox(); if (pRet && pRet->init(_text)) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return nullptr; }
25.710526
93
0.642784
MagneticPrism
1d8e16a65d2c190eb51fdfcf0198278739ee2b9f
9,172
cc
C++
src/demo/hud.cc
auygun/kaliber
c6501323cf5c447334a2bfb6b7a5899dea0776e6
[ "MIT" ]
3
2020-06-22T19:37:49.000Z
2020-11-14T10:45:27.000Z
src/demo/hud.cc
auygun/kaliber
c6501323cf5c447334a2bfb6b7a5899dea0776e6
[ "MIT" ]
1
2020-06-03T13:05:24.000Z
2020-06-03T13:05:24.000Z
src/demo/hud.cc
auygun/kaliber
c6501323cf5c447334a2bfb6b7a5899dea0776e6
[ "MIT" ]
null
null
null
#include "hud.h" #include "../base/interpolation.h" #include "../base/log.h" #include "../base/vecmath.h" #include "../engine/engine.h" #include "../engine/font.h" #include "../engine/image.h" #include "demo.h" using namespace std::string_literals; using namespace base; using namespace eng; namespace { constexpr float kHorizontalMargin = 0.07f; constexpr float kVerticalMargin = 0.025f; const Vector4f kPprogressBarColor[2] = {{0.256f, 0.434f, 0.72f, 1}, {0.905f, 0.493f, 0.194f, 1}}; const Vector4f kTextColor = {0.895f, 0.692f, 0.24f, 1}; void SetupFadeOutAnim(Animator& animator, float delay) { animator.SetEndCallback(Animator::kTimer, [&]() -> void { animator.SetBlending({1, 1, 1, 0}, 0.5f, std::bind(Acceleration, std::placeholders::_1, -1)); animator.Play(Animator::kBlending, false); }); animator.SetEndCallback(Animator::kBlending, [&]() -> void { animator.SetVisible(false); }); animator.SetTimer(delay); } } // namespace Hud::Hud() = default; Hud::~Hud() = default; bool Hud::Initialize() { Engine& engine = Engine::Get(); const Font& font = static_cast<Demo*>(engine.GetGame())->GetFont(); int tmp; font.CalculateBoundingBox("big_enough_text", max_text_width_, tmp); Engine::Get().SetImageSource("text0", std::bind(&Hud::CreateScoreImage, this)); Engine::Get().SetImageSource("text1", std::bind(&Hud::CreateWaveImage, this)); Engine::Get().SetImageSource("message", std::bind(&Hud::CreateMessageImage, this)); Engine::Get().SetImageSource("bonus_tex", std::bind(&Hud::CreateBonusImage, this)); for (int i = 0; i < 2; ++i) { text_[i].Create("text"s + std::to_string(i)); text_[i].SetZOrder(30); text_[i].SetColor(kTextColor * Vector4f(1, 1, 1, 0)); Vector2f pos = (engine.GetScreenSize() / 2 - text_[i].GetSize() / 2); pos -= engine.GetScreenSize() * Vector2f(kHorizontalMargin, kVerticalMargin); Vector2f scale = engine.GetScreenSize() * Vector2f(1, 0); scale -= engine.GetScreenSize() * Vector2f(kHorizontalMargin * 4, 0); scale += text_[0].GetSize() * Vector2f(0, 0.3f); progress_bar_[i].SetZOrder(30); progress_bar_[i].SetSize(scale); progress_bar_[i].Translate(pos * Vector2f(0, 1)); progress_bar_[i].SetColor(kPprogressBarColor[i] * Vector4f(1, 1, 1, 0)); pos -= progress_bar_[i].GetSize() * Vector2f(0, 4); text_[i].Translate(pos * Vector2f(i ? 1 : -1, 1)); progress_bar_animator_[i].Attach(&progress_bar_[i]); text_animator_cb_[i] = [&, i]() -> void { text_animator_[i].SetEndCallback(Animator::kBlending, nullptr); text_animator_[i].SetBlending( kTextColor, 2, std::bind(Acceleration, std::placeholders::_1, -1)); text_animator_[i].Play(Animator::kBlending, false); }; text_animator_[i].Attach(&text_[i]); } message_.Create("message"); message_.SetZOrder(30); message_animator_.SetEndCallback(Animator::kTimer, [&]() -> void { message_animator_.SetEndCallback(Animator::kBlending, [&]() -> void { message_animator_.SetVisible(false); }); message_animator_.SetBlending({1, 1, 1, 0}, 0.5f); message_animator_.Play(Animator::kBlending, false); }); message_animator_.Attach(&message_); bonus_.Create("bonus_tex"); bonus_.SetZOrder(30); SetupFadeOutAnim(bonus_animator_, 1.0f); bonus_animator_.SetMovement({0, Engine::Get().GetScreenSize().y / 2}, 2.0f); bonus_animator_.Attach(&bonus_); return true; } void Hud::Pause(bool pause) { message_animator_.PauseOrResumeAll(pause); bonus_animator_.PauseOrResumeAll(pause); } void Hud::Show() { if (text_[0].IsVisible() && text_[1].IsVisible() && progress_bar_[0].IsVisible() && progress_bar_[1].IsVisible()) return; for (int i = 0; i < 2; ++i) { progress_bar_[i].SetVisible(true); text_[i].SetVisible(true); progress_bar_animator_[i].SetBlending(kPprogressBarColor[i], 0.5f); progress_bar_animator_[i].Play(Animator::kBlending, false); } } void Hud::Hide() { if (!text_[0].IsVisible() && !text_[1].IsVisible() && !progress_bar_[0].IsVisible() && !progress_bar_[1].IsVisible()) return; for (int i = 0; i < 2; ++i) { text_animator_[i].SetEndCallback(Animator::kBlending, [&, i]() -> void { text_animator_[i].SetEndCallback(Animator::kBlending, nullptr); text_[i].SetVisible(false); }); text_animator_[i].SetBlending(kTextColor * Vector4f(1, 1, 1, 0), 0.5f); text_animator_[i].Play(Animator::kBlending, false); } HideProgress(); } void Hud::HideProgress() { if (!progress_bar_[0].IsVisible()) return; for (int i = 0; i < 2; ++i) { progress_bar_animator_[i].SetEndCallback( Animator::kBlending, [&, i]() -> void { progress_bar_animator_[i].SetEndCallback(Animator::kBlending, nullptr); progress_bar_animator_[1].SetVisible(false); }); progress_bar_animator_[i].SetBlending( kPprogressBarColor[i] * Vector4f(1, 1, 1, 0), 0.5f); progress_bar_animator_[i].Play(Animator::kBlending, false); } } void Hud::SetScore(size_t score, bool flash) { last_score_ = score; Engine::Get().RefreshImage("text0"); if (flash) { text_animator_[0].SetEndCallback(Animator::kBlending, text_animator_cb_[0]); text_animator_[0].SetBlending( {1, 1, 1, 1}, 0.1f, std::bind(Acceleration, std::placeholders::_1, 1)); text_animator_[0].Play(Animator::kBlending, false); } } void Hud::SetWave(int wave, bool flash) { last_wave_ = wave; Engine::Get().RefreshImage("text1"); if (flash) { text_animator_[1].SetEndCallback(Animator::kBlending, text_animator_cb_[1]); text_animator_[1].SetBlending( {1, 1, 1, 1}, 0.1f, std::bind(Acceleration, std::placeholders::_1, 1)); text_animator_[1].Play(Animator::kBlending, false); } } void Hud::SetProgress(float progress) { progress = std::min(std::max(0.0f, progress), 1.0f); last_progress_ = progress; Vector2f s = progress_bar_[0].GetSize() * Vector2f(progress, 1); float t = (s.x - progress_bar_[1].GetSize().x) / 2; progress_bar_[1].SetSize(s); progress_bar_[1].Translate({t, 0}); } void Hud::ShowMessage(const std::string& text, float duration) { message_text_ = text; Engine::Get().RefreshImage("message"); message_.AutoScale(); message_.Scale(1.5f); message_.SetColor({1, 1, 1, 0}); message_.SetVisible(true); message_animator_.SetEndCallback( Animator::kBlending, [&, duration]() -> void { message_animator_.SetTimer(duration); message_animator_.Play(Animator::kTimer, false); }); message_animator_.SetBlending({1, 1, 1, 1}, 0.5f); message_animator_.Play(Animator::kBlending, false); } void Hud::ShowBonus(size_t bonus) { bonus_score_ = bonus; Engine::Get().RefreshImage("bonus_tex"); bonus_.AutoScale(); bonus_.Scale(1.3f); bonus_.SetColor({1, 1, 1, 1}); bonus_.SetVisible(true); bonus_animator_.Play(Animator::kTimer | Animator::kMovement, false); } std::unique_ptr<eng::Image> Hud::CreateScoreImage() { return Print(0, std::to_string(last_score_)); } std::unique_ptr<eng::Image> Hud::CreateWaveImage() { return Print(1, "wave "s + std::to_string(last_wave_)); } std::unique_ptr<Image> Hud::CreateMessageImage() { const Font& font = static_cast<Demo*>(Engine::Get().GetGame())->GetFont(); auto image = std::make_unique<Image>(); image->Create(max_text_width_, font.GetLineHeight()); image->GradientV({0.80f, 0.87f, 0.93f, 0}, {0.003f, 0.91f, 0.99f, 0}, font.GetLineHeight()); int w, h; font.CalculateBoundingBox(message_text_.c_str(), w, h); float x = (image->GetWidth() - w) / 2; font.Print(x, 0, message_text_.c_str(), image->GetBuffer(), image->GetWidth()); image->Compress(); return image; } std::unique_ptr<Image> Hud::CreateBonusImage() { const Font& font = static_cast<Demo*>(Engine::Get().GetGame())->GetFont(); if (bonus_score_ == 0) return nullptr; std::string text = std::to_string(bonus_score_); int width, height; font.CalculateBoundingBox(text.c_str(), width, height); auto image = std::make_unique<Image>(); image->Create(width, height); image->Clear({1, 1, 1, 0}); font.Print(0, 0, text.c_str(), image->GetBuffer(), image->GetWidth()); image->Compress(); return image; } std::unique_ptr<Image> Hud::Print(int i, const std::string& text) { const Font& font = static_cast<Demo*>(Engine::Get().GetGame())->GetFont(); auto image = CreateImage(); float x = 0; if (i == 1) { int w, h; font.CalculateBoundingBox(text.c_str(), w, h); x = image->GetWidth() - w; } font.Print(x, 0, text.c_str(), image->GetBuffer(), image->GetWidth()); return image; } std::unique_ptr<Image> Hud::CreateImage() { const Font& font = static_cast<Demo*>(Engine::Get().GetGame())->GetFont(); auto image = std::make_unique<Image>(); image->Create(max_text_width_, font.GetLineHeight()); image->Clear({1, 1, 1, 0}); return image; }
30.986486
80
0.646097
auygun
1d924e4a4b07e61bcfe8b3c5a376d846f332bdd7
72,472
inl
C++
GameJam_v3.2/GameEngineBase/externals/Havok/includes/Source/Common/Base/Math/Vector/Fpu/hkFpuVector4d.inl
aditgoyal19/Tropical-Go-Kart-Bananas
ed3c0489402f8a559c77b56545bd8ebc79c4c563
[ "MIT" ]
null
null
null
GameJam_v3.2/GameEngineBase/externals/Havok/includes/Source/Common/Base/Math/Vector/Fpu/hkFpuVector4d.inl
aditgoyal19/Tropical-Go-Kart-Bananas
ed3c0489402f8a559c77b56545bd8ebc79c4c563
[ "MIT" ]
null
null
null
GameJam_v3.2/GameEngineBase/externals/Havok/includes/Source/Common/Base/Math/Vector/Fpu/hkFpuVector4d.inl
aditgoyal19/Tropical-Go-Kart-Bananas
ed3c0489402f8a559c77b56545bd8ebc79c4c563
[ "MIT" ]
null
null
null
/* * * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's * prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok. * Product and Trade Secret source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2013 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ /* quad, here for inlining */ #ifndef HK_DISABLE_MATH_CONSTRUCTORS HK_FORCE_INLINE hkVector4d::hkVector4d(hkDouble64 a, hkDouble64 b, hkDouble64 c, hkDouble64 d) { m_quad.v[0] = a; m_quad.v[1] = b; m_quad.v[2] = c; m_quad.v[3] = d; } HK_FORCE_INLINE hkVector4d::hkVector4d(const hkQuadDouble64& q) { m_quad.v[0] = q.v[0]; m_quad.v[1] = q.v[1]; m_quad.v[2] = q.v[2]; m_quad.v[3] = q.v[3]; } HK_FORCE_INLINE hkVector4d::hkVector4d( const hkVector4d& v) { m_quad.v[0] = v.m_quad.v[0]; m_quad.v[1] = v.m_quad.v[1]; m_quad.v[2] = v.m_quad.v[2]; m_quad.v[3] = v.m_quad.v[3]; } #endif HK_FORCE_INLINE void hkVector4d::set(hkDouble64 a, hkDouble64 b, hkDouble64 c, hkDouble64 d) { m_quad.v[0] = a; m_quad.v[1] = b; m_quad.v[2] = c; m_quad.v[3] = d; } HK_FORCE_INLINE void hkVector4d::set( hkSimdDouble64Parameter a, hkSimdDouble64Parameter b, hkSimdDouble64Parameter c, hkSimdDouble64Parameter d ) { m_quad.v[0] = a.getReal(); m_quad.v[1] = b.getReal(); m_quad.v[2] = c.getReal(); m_quad.v[3] = d.getReal(); } HK_FORCE_INLINE void hkVector4d::setAll(const hkDouble64& a) { m_quad.v[0] = a; m_quad.v[1] = a; m_quad.v[2] = a; m_quad.v[3] = a; } HK_FORCE_INLINE void hkVector4d::setAll(hkSimdDouble64Parameter a) { setAll( a.getReal() ); } HK_FORCE_INLINE void hkVector4d::setZero() { m_quad.v[0] = hkDouble64(0); m_quad.v[1] = hkDouble64(0); m_quad.v[2] = hkDouble64(0); m_quad.v[3] = hkDouble64(0); } template <int I> HK_FORCE_INLINE void hkVector4d::zeroComponent() { HK_VECTOR4d_SUBINDEX_CHECK; m_quad.v[I] = hkDouble64(0); } HK_FORCE_INLINE void hkVector4d::zeroComponent(const int i) { HK_MATH_ASSERT(0x3bc36625, (i>=0) && (i<4), "Component index out of range"); m_quad.v[i] = hkDouble64(0); } HK_FORCE_INLINE void hkVector4d::setAdd(hkVector4dParameter v0, hkVector4dParameter v1) { m_quad.v[0] = v0.m_quad.v[0] + v1.m_quad.v[0]; m_quad.v[1] = v0.m_quad.v[1] + v1.m_quad.v[1]; m_quad.v[2] = v0.m_quad.v[2] + v1.m_quad.v[2]; m_quad.v[3] = v0.m_quad.v[3] + v1.m_quad.v[3]; } HK_FORCE_INLINE void hkVector4d::setSub(hkVector4dParameter v0, hkVector4dParameter v1) { m_quad.v[0] = v0.m_quad.v[0] - v1.m_quad.v[0]; m_quad.v[1] = v0.m_quad.v[1] - v1.m_quad.v[1]; m_quad.v[2] = v0.m_quad.v[2] - v1.m_quad.v[2]; m_quad.v[3] = v0.m_quad.v[3] - v1.m_quad.v[3]; } HK_FORCE_INLINE void hkVector4d::setMul(hkVector4dParameter v0, hkVector4dParameter v1) { m_quad.v[0] = v0.m_quad.v[0] * v1.m_quad.v[0]; m_quad.v[1] = v0.m_quad.v[1] * v1.m_quad.v[1]; m_quad.v[2] = v0.m_quad.v[2] * v1.m_quad.v[2]; m_quad.v[3] = v0.m_quad.v[3] * v1.m_quad.v[3]; } HK_FORCE_INLINE void hkVector4d::setMul(hkVector4dParameter a, hkSimdDouble64Parameter rs) { const hkDouble64 r = rs.getReal(); m_quad.v[0] = r * a.m_quad.v[0]; m_quad.v[1] = r * a.m_quad.v[1]; m_quad.v[2] = r * a.m_quad.v[2]; m_quad.v[3] = r * a.m_quad.v[3]; } HK_FORCE_INLINE void hkVector4d::setSubMul(hkVector4dParameter a, hkVector4dParameter b, hkSimdDouble64Parameter r) { const hkDouble64 rr = r.getReal(); m_quad.v[0] = a.m_quad.v[0] - rr * b.m_quad.v[0]; m_quad.v[1] = a.m_quad.v[1] - rr * b.m_quad.v[1]; m_quad.v[2] = a.m_quad.v[2] - rr * b.m_quad.v[2]; m_quad.v[3] = a.m_quad.v[3] - rr * b.m_quad.v[3]; } HK_FORCE_INLINE void hkVector4d::setAddMul(hkVector4dParameter a, hkVector4dParameter b, hkSimdDouble64Parameter r) { const hkDouble64 rr = r.getReal(); m_quad.v[0] = a.m_quad.v[0] + rr * b.m_quad.v[0]; m_quad.v[1] = a.m_quad.v[1] + rr * b.m_quad.v[1]; m_quad.v[2] = a.m_quad.v[2] + rr * b.m_quad.v[2]; m_quad.v[3] = a.m_quad.v[3] + rr * b.m_quad.v[3]; } HK_FORCE_INLINE void hkVector4d::setAddMul(hkVector4dParameter a, hkVector4dParameter m0, hkVector4dParameter m1) { m_quad.v[0] = a.m_quad.v[0] + m0.m_quad.v[0] * m1.m_quad.v[0]; m_quad.v[1] = a.m_quad.v[1] + m0.m_quad.v[1] * m1.m_quad.v[1]; m_quad.v[2] = a.m_quad.v[2] + m0.m_quad.v[2] * m1.m_quad.v[2]; m_quad.v[3] = a.m_quad.v[3] + m0.m_quad.v[3] * m1.m_quad.v[3]; } HK_FORCE_INLINE void hkVector4d::setSubMul(hkVector4dParameter a, hkVector4dParameter m0, hkVector4dParameter m1) { m_quad.v[0] = a.m_quad.v[0] - m0.m_quad.v[0] * m1.m_quad.v[0]; m_quad.v[1] = a.m_quad.v[1] - m0.m_quad.v[1] * m1.m_quad.v[1]; m_quad.v[2] = a.m_quad.v[2] - m0.m_quad.v[2] * m1.m_quad.v[2]; m_quad.v[3] = a.m_quad.v[3] - m0.m_quad.v[3] * m1.m_quad.v[3]; } HK_FORCE_INLINE void hkVector4d::setCross( hkVector4dParameter v1, hkVector4dParameter v2 ) { const hkDouble64 nx = v1.m_quad.v[1]*v2.m_quad.v[2] - v1.m_quad.v[2]*v2.m_quad.v[1]; const hkDouble64 ny = v1.m_quad.v[2]*v2.m_quad.v[0] - v1.m_quad.v[0]*v2.m_quad.v[2]; const hkDouble64 nz = v1.m_quad.v[0]*v2.m_quad.v[1] - v1.m_quad.v[1]*v2.m_quad.v[0]; set( nx, ny, nz , hkDouble64(0) ); } HK_FORCE_INLINE const hkVector4dComparison hkVector4d::equal(hkVector4dParameter a) const { hkVector4dComparison ret; ret.m_mask = ((m_quad.v[0]==a.m_quad.v[0]) ? hkVector4ComparisonMask::MASK_X : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[1]==a.m_quad.v[1]) ? hkVector4ComparisonMask::MASK_Y : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[2]==a.m_quad.v[2]) ? hkVector4ComparisonMask::MASK_Z : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[3]==a.m_quad.v[3]) ? hkVector4ComparisonMask::MASK_W : hkVector4ComparisonMask::MASK_NONE); return ret; } HK_FORCE_INLINE const hkVector4dComparison hkVector4d::notEqual(hkVector4dParameter a) const { hkVector4dComparison ret; ret.m_mask = ((m_quad.v[0]==a.m_quad.v[0]) ? hkVector4ComparisonMask::MASK_NONE : hkVector4ComparisonMask::MASK_X) | ((m_quad.v[1]==a.m_quad.v[1]) ? hkVector4ComparisonMask::MASK_NONE : hkVector4ComparisonMask::MASK_Y) | ((m_quad.v[2]==a.m_quad.v[2]) ? hkVector4ComparisonMask::MASK_NONE : hkVector4ComparisonMask::MASK_Z) | ((m_quad.v[3]==a.m_quad.v[3]) ? hkVector4ComparisonMask::MASK_NONE : hkVector4ComparisonMask::MASK_W); return ret; } HK_FORCE_INLINE const hkVector4dComparison hkVector4d::less(hkVector4dParameter a) const { hkVector4dComparison ret; ret.m_mask = ((m_quad.v[0]<a.m_quad.v[0]) ? hkVector4ComparisonMask::MASK_X : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[1]<a.m_quad.v[1]) ? hkVector4ComparisonMask::MASK_Y : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[2]<a.m_quad.v[2]) ? hkVector4ComparisonMask::MASK_Z : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[3]<a.m_quad.v[3]) ? hkVector4ComparisonMask::MASK_W : hkVector4ComparisonMask::MASK_NONE); return ret; } HK_FORCE_INLINE const hkVector4dComparison hkVector4d::lessEqual(hkVector4dParameter a) const { hkVector4dComparison ret; ret.m_mask = ((m_quad.v[0]<=a.m_quad.v[0]) ? hkVector4ComparisonMask::MASK_X : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[1]<=a.m_quad.v[1]) ? hkVector4ComparisonMask::MASK_Y : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[2]<=a.m_quad.v[2]) ? hkVector4ComparisonMask::MASK_Z : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[3]<=a.m_quad.v[3]) ? hkVector4ComparisonMask::MASK_W : hkVector4ComparisonMask::MASK_NONE); return ret; } HK_FORCE_INLINE const hkVector4dComparison hkVector4d::greater(hkVector4dParameter a) const { hkVector4dComparison ret; ret.m_mask = ((m_quad.v[0]>a.m_quad.v[0]) ? hkVector4ComparisonMask::MASK_X : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[1]>a.m_quad.v[1]) ? hkVector4ComparisonMask::MASK_Y : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[2]>a.m_quad.v[2]) ? hkVector4ComparisonMask::MASK_Z : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[3]>a.m_quad.v[3]) ? hkVector4ComparisonMask::MASK_W : hkVector4ComparisonMask::MASK_NONE); return ret; } HK_FORCE_INLINE const hkVector4dComparison hkVector4d::greaterEqual(hkVector4dParameter a) const { hkVector4dComparison ret; ret.m_mask = ((m_quad.v[0]>=a.m_quad.v[0]) ? hkVector4ComparisonMask::MASK_X : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[1]>=a.m_quad.v[1]) ? hkVector4ComparisonMask::MASK_Y : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[2]>=a.m_quad.v[2]) ? hkVector4ComparisonMask::MASK_Z : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[3]>=a.m_quad.v[3]) ? hkVector4ComparisonMask::MASK_W : hkVector4ComparisonMask::MASK_NONE); return ret; } HK_FORCE_INLINE const hkVector4dComparison hkVector4d::lessZero() const { hkVector4dComparison ret; ret.m_mask = ((m_quad.v[0]<hkDouble64(0)) ? hkVector4ComparisonMask::MASK_X : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[1]<hkDouble64(0)) ? hkVector4ComparisonMask::MASK_Y : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[2]<hkDouble64(0)) ? hkVector4ComparisonMask::MASK_Z : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[3]<hkDouble64(0)) ? hkVector4ComparisonMask::MASK_W : hkVector4ComparisonMask::MASK_NONE); return ret; } HK_FORCE_INLINE const hkVector4dComparison hkVector4d::lessEqualZero() const { hkVector4dComparison ret; ret.m_mask = ((m_quad.v[0]<=hkDouble64(0)) ? hkVector4ComparisonMask::MASK_X : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[1]<=hkDouble64(0)) ? hkVector4ComparisonMask::MASK_Y : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[2]<=hkDouble64(0)) ? hkVector4ComparisonMask::MASK_Z : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[3]<=hkDouble64(0)) ? hkVector4ComparisonMask::MASK_W : hkVector4ComparisonMask::MASK_NONE); return ret; } HK_FORCE_INLINE const hkVector4dComparison hkVector4d::greaterZero() const { hkVector4dComparison ret; ret.m_mask = ((m_quad.v[0]>hkDouble64(0)) ? hkVector4ComparisonMask::MASK_X : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[1]>hkDouble64(0)) ? hkVector4ComparisonMask::MASK_Y : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[2]>hkDouble64(0)) ? hkVector4ComparisonMask::MASK_Z : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[3]>hkDouble64(0)) ? hkVector4ComparisonMask::MASK_W : hkVector4ComparisonMask::MASK_NONE); return ret; } HK_FORCE_INLINE const hkVector4dComparison hkVector4d::greaterEqualZero() const { hkVector4dComparison ret; ret.m_mask = ((m_quad.v[0]>=hkDouble64(0)) ? hkVector4ComparisonMask::MASK_X : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[1]>=hkDouble64(0)) ? hkVector4ComparisonMask::MASK_Y : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[2]>=hkDouble64(0)) ? hkVector4ComparisonMask::MASK_Z : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[3]>=hkDouble64(0)) ? hkVector4ComparisonMask::MASK_W : hkVector4ComparisonMask::MASK_NONE); return ret; } HK_FORCE_INLINE const hkVector4dComparison hkVector4d::equalZero() const { hkVector4dComparison ret; ret.m_mask = ((m_quad.v[0]==hkDouble64(0)) ? hkVector4ComparisonMask::MASK_X : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[1]==hkDouble64(0)) ? hkVector4ComparisonMask::MASK_Y : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[2]==hkDouble64(0)) ? hkVector4ComparisonMask::MASK_Z : hkVector4ComparisonMask::MASK_NONE) | ((m_quad.v[3]==hkDouble64(0)) ? hkVector4ComparisonMask::MASK_W : hkVector4ComparisonMask::MASK_NONE); return ret; } HK_FORCE_INLINE const hkVector4dComparison hkVector4d::notEqualZero() const { hkVector4dComparison ret; ret.m_mask = ((m_quad.v[0]==hkDouble64(0)) ? hkVector4ComparisonMask::MASK_NONE : hkVector4ComparisonMask::MASK_X) | ((m_quad.v[1]==hkDouble64(0)) ? hkVector4ComparisonMask::MASK_NONE : hkVector4ComparisonMask::MASK_Y) | ((m_quad.v[2]==hkDouble64(0)) ? hkVector4ComparisonMask::MASK_NONE : hkVector4ComparisonMask::MASK_Z) | ((m_quad.v[3]==hkDouble64(0)) ? hkVector4ComparisonMask::MASK_NONE : hkVector4ComparisonMask::MASK_W); return ret; } HK_FORCE_INLINE void hkVector4d::setSelect( hkVector4dComparisonParameter comp, hkVector4dParameter trueValue, hkVector4dParameter falseValue ) { m_quad.v[0] = comp.anyIsSet<hkVector4ComparisonMask::MASK_X>() ? trueValue.m_quad.v[0] : falseValue.m_quad.v[0]; m_quad.v[1] = comp.anyIsSet<hkVector4ComparisonMask::MASK_Y>() ? trueValue.m_quad.v[1] : falseValue.m_quad.v[1]; m_quad.v[2] = comp.anyIsSet<hkVector4ComparisonMask::MASK_Z>() ? trueValue.m_quad.v[2] : falseValue.m_quad.v[2]; m_quad.v[3] = comp.anyIsSet<hkVector4ComparisonMask::MASK_W>() ? trueValue.m_quad.v[3] : falseValue.m_quad.v[3]; } template<hkVector4ComparisonMask::Mask M> HK_FORCE_INLINE void hkVector4d::setSelect( hkVector4dParameter trueValue, hkVector4dParameter falseValue ) { m_quad.v[0] = (M & hkVector4ComparisonMask::MASK_X) ? trueValue.m_quad.v[0] : falseValue.m_quad.v[0]; m_quad.v[1] = (M & hkVector4ComparisonMask::MASK_Y) ? trueValue.m_quad.v[1] : falseValue.m_quad.v[1]; m_quad.v[2] = (M & hkVector4ComparisonMask::MASK_Z) ? trueValue.m_quad.v[2] : falseValue.m_quad.v[2]; m_quad.v[3] = (M & hkVector4ComparisonMask::MASK_W) ? trueValue.m_quad.v[3] : falseValue.m_quad.v[3]; } HK_FORCE_INLINE void hkVector4d::zeroIfFalse( hkVector4dComparisonParameter comp ) { m_quad.v[0] = comp.anyIsSet<hkVector4ComparisonMask::MASK_X>() ? m_quad.v[0] : hkDouble64(0); m_quad.v[1] = comp.anyIsSet<hkVector4ComparisonMask::MASK_Y>() ? m_quad.v[1] : hkDouble64(0); m_quad.v[2] = comp.anyIsSet<hkVector4ComparisonMask::MASK_Z>() ? m_quad.v[2] : hkDouble64(0); m_quad.v[3] = comp.anyIsSet<hkVector4ComparisonMask::MASK_W>() ? m_quad.v[3] : hkDouble64(0); } HK_FORCE_INLINE void hkVector4d::zeroIfTrue( hkVector4dComparisonParameter comp ) { m_quad.v[0] = comp.anyIsSet<hkVector4ComparisonMask::MASK_X>() ? hkDouble64(0) : m_quad.v[0]; m_quad.v[1] = comp.anyIsSet<hkVector4ComparisonMask::MASK_Y>() ? hkDouble64(0) : m_quad.v[1]; m_quad.v[2] = comp.anyIsSet<hkVector4ComparisonMask::MASK_Z>() ? hkDouble64(0) : m_quad.v[2]; m_quad.v[3] = comp.anyIsSet<hkVector4ComparisonMask::MASK_W>() ? hkDouble64(0) : m_quad.v[3]; } template <int N> HK_FORCE_INLINE void hkVector4d::setNeg(hkVector4dParameter v) { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; m_quad.v[0] = (N>0) ? -v.m_quad.v[0] : v.m_quad.v[0]; m_quad.v[1] = (N>1) ? -v.m_quad.v[1] : v.m_quad.v[1]; m_quad.v[2] = (N>2) ? -v.m_quad.v[2] : v.m_quad.v[2]; m_quad.v[3] = (N>3) ? -v.m_quad.v[3] : v.m_quad.v[3]; } HK_FORCE_INLINE void hkVector4d::setAbs(hkVector4dParameter v) { m_quad.v[0] = hkMath::fabs(v.m_quad.v[0]); m_quad.v[1] = hkMath::fabs(v.m_quad.v[1]); m_quad.v[2] = hkMath::fabs(v.m_quad.v[2]); m_quad.v[3] = hkMath::fabs(v.m_quad.v[3]); } HK_FORCE_INLINE void hkVector4d::setMin(hkVector4dParameter a, hkVector4dParameter b) { m_quad.v[0] = hkMath::min2(a.m_quad.v[0], b.m_quad.v[0]); m_quad.v[1] = hkMath::min2(a.m_quad.v[1], b.m_quad.v[1]); m_quad.v[2] = hkMath::min2(a.m_quad.v[2], b.m_quad.v[2]); m_quad.v[3] = hkMath::min2(a.m_quad.v[3], b.m_quad.v[3]); } HK_FORCE_INLINE void hkVector4d::setMax(hkVector4dParameter a, hkVector4dParameter b) { m_quad.v[0] = hkMath::max2(a.m_quad.v[0], b.m_quad.v[0]); m_quad.v[1] = hkMath::max2(a.m_quad.v[1], b.m_quad.v[1]); m_quad.v[2] = hkMath::max2(a.m_quad.v[2], b.m_quad.v[2]); m_quad.v[3] = hkMath::max2(a.m_quad.v[3], b.m_quad.v[3]); } HK_FORCE_INLINE void hkVector4d::_setRotatedDir(const hkMatrix3d& r, hkVector4dParameter v ) { const hkSimdDouble64 v0 = v.getComponent<0>(); const hkSimdDouble64 v1 = v.getComponent<1>(); const hkSimdDouble64 v2 = v.getComponent<2>(); setMul(r.getColumn<0>(),v0); addMul(r.getColumn<1>(),v1); addMul(r.getColumn<2>(),v2); } template <int N> HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::dot(hkVector4dParameter a) const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkDouble64 sum = m_quad.v[0] * a.m_quad.v[0]; if (N>1)sum += m_quad.v[1] * a.m_quad.v[1]; if (N>2)sum += m_quad.v[2] * a.m_quad.v[2]; if (N>3)sum += m_quad.v[3] * a.m_quad.v[3]; return hkSimdDouble64::convert(sum); } HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::dot4xyz1(hkVector4dParameter a) const { return hkSimdDouble64::convert( (m_quad.v[0] * a.m_quad.v[0]) + (m_quad.v[1] * a.m_quad.v[1]) + (m_quad.v[2] * a.m_quad.v[2]) + m_quad.v[3] ); } HK_FORCE_INLINE void hkVector4d::_setRotatedInverseDir(const hkMatrix3d& r, hkVector4dParameter v ) { const hkSimdDouble64 d0 = r.getColumn<0>().dot<3>(v); const hkSimdDouble64 d1 = r.getColumn<1>().dot<3>(v); const hkSimdDouble64 d2 = r.getColumn<2>().dot<3>(v); set(d0,d1,d2,d2); } template <int N> HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::horizontalAdd() const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkDouble64 sum = m_quad.v[0]; if (N>1)sum += m_quad.v[1]; if (N>2)sum += m_quad.v[2]; if (N>3)sum += m_quad.v[3]; return hkSimdDouble64::convert(sum); } template <int N> HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::horizontalMul() const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkDouble64 product = m_quad.v[0]; if (N>1) product *= m_quad.v[1]; if (N>2) product *= m_quad.v[2]; if (N>3) product *= m_quad.v[3]; return hkSimdDouble64::convert(product); } template <> HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::horizontalMax<1>() const { return getComponent<0>(); } template <> HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::horizontalMax<2>() const { return hkSimdDouble64::convert(hkMath::max2(m_quad.v[0], m_quad.v[1])); } template <> HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::horizontalMax<3>() const { const hkDouble64 m = hkMath::max2(m_quad.v[0], m_quad.v[1]); return hkSimdDouble64::convert(hkMath::max2(m, m_quad.v[2])); } template <> HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::horizontalMax<4>() const { const hkDouble64 ma = hkMath::max2(m_quad.v[0], m_quad.v[1]); const hkDouble64 mb = hkMath::max2(m_quad.v[2], m_quad.v[3]); return hkSimdDouble64::convert(hkMath::max2(ma, mb)); } template <int N> HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::horizontalMax() const { HK_VECTOR4d_NOT_IMPLEMENTED; return hkSimdDouble64::getConstant<HK_QUADREAL_0>(); } template <> HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::horizontalMin<1>() const { return getComponent<0>(); } template <> HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::horizontalMin<2>() const { return hkSimdDouble64::convert(hkMath::min2(m_quad.v[0], m_quad.v[1])); } template <> HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::horizontalMin<3>() const { const hkDouble64 m = hkMath::min2(m_quad.v[0], m_quad.v[1]); return hkSimdDouble64::convert(hkMath::min2(m, m_quad.v[2])); } template <> HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::horizontalMin<4>() const { const hkDouble64 ma = hkMath::min2(m_quad.v[0], m_quad.v[1]); const hkDouble64 mb = hkMath::min2(m_quad.v[2], m_quad.v[3]); return hkSimdDouble64::convert(hkMath::min2(ma, mb)); } template <int N> HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::horizontalMin() const { HK_VECTOR4d_NOT_IMPLEMENTED; return hkSimdDouble64::getConstant<HK_QUADREAL_0>(); } /* operator () */ HK_FORCE_INLINE hkDouble64& hkVector4d::operator() (int a) { HK_MATH_ASSERT(0x6d0c31d7, a>=0 && a<4, "index out of bounds for component access"); return m_quad.v[a]; } HK_FORCE_INLINE const hkDouble64& hkVector4d::operator() (int a) const { HK_MATH_ASSERT(0x6d0c31d7, a>=0 && a<4, "index out of bounds for component access"); return const_cast<const hkDouble64&>(m_quad.v[a]); } HK_FORCE_INLINE void hkVector4d::setXYZ_W(hkVector4dParameter xyz, hkVector4dParameter ww) { m_quad.v[0] = xyz.m_quad.v[0]; m_quad.v[1] = xyz.m_quad.v[1]; m_quad.v[2] = xyz.m_quad.v[2]; m_quad.v[3] = ww.m_quad.v[3]; } HK_FORCE_INLINE void hkVector4d::setXYZ_W(hkVector4dParameter xyz, hkSimdDouble64Parameter ww) { m_quad.v[0] = xyz.m_quad.v[0]; m_quad.v[1] = xyz.m_quad.v[1]; m_quad.v[2] = xyz.m_quad.v[2]; m_quad.v[3] = ww.getReal(); } HK_FORCE_INLINE void hkVector4d::setW(hkVector4dParameter w) { m_quad.v[3] = w.m_quad.v[3]; } HK_FORCE_INLINE void hkVector4d::setXYZ(hkVector4dParameter xyz) { m_quad.v[0] = xyz.m_quad.v[0]; m_quad.v[1] = xyz.m_quad.v[1]; m_quad.v[2] = xyz.m_quad.v[2]; } HK_FORCE_INLINE void hkVector4d::addXYZ(hkVector4dParameter xyz) { m_quad.v[0] += xyz.m_quad.v[0]; m_quad.v[1] += xyz.m_quad.v[1]; m_quad.v[2] += xyz.m_quad.v[2]; #if defined(HK_REAL_IS_DOUBLE) HK_ON_DEBUG( *((hkUint64*)&(m_quad.v[3])) = 0xffffffffffffffffull; ) #else HK_ON_DEBUG( *((hkUint32*)&(m_quad.v[3])) = 0xffffffff; ) #endif } HK_FORCE_INLINE void hkVector4d::subXYZ(hkVector4dParameter xyz) { m_quad.v[0] -= xyz.m_quad.v[0]; m_quad.v[1] -= xyz.m_quad.v[1]; m_quad.v[2] -= xyz.m_quad.v[2]; #if defined(HK_REAL_IS_DOUBLE) HK_ON_DEBUG( *((hkUint64*)&(m_quad.v[3])) = 0xffffffffffffffffull; ) #else HK_ON_DEBUG( *((hkUint32*)&(m_quad.v[3])) = 0xffffffff; ) #endif } HK_FORCE_INLINE void hkVector4d::setXYZ(hkDouble64 v) { m_quad.v[0] = v; m_quad.v[1] = v; m_quad.v[2] = v; } HK_FORCE_INLINE void hkVector4d::setXYZ(hkSimdDouble64Parameter vv) { setXYZ( vv.getReal() ); } HK_FORCE_INLINE void hkVector4d::setXYZ_0(hkVector4dParameter xyz) { setXYZ( xyz ); m_quad.v[3] = hkDouble64(0); } HK_FORCE_INLINE void hkVector4d::setBroadcastXYZ(const int i, hkVector4dParameter v) { HK_MATH_ASSERT(0x6d0c31d7, i>=0 && i<4, "index out of bounds for component access"); setXYZ( v.m_quad.v[i] ); #if defined(HK_REAL_IS_DOUBLE) HK_ON_DEBUG( *((hkUint64*)&(m_quad.v[3])) = 0xffffffffffffffffull; ) #else HK_ON_DEBUG( *((hkUint32*)&(m_quad.v[3])) = 0xffffffff; ) #endif } HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::getComponent(const int i) const { HK_MATH_ASSERT(0x6d0c31d7, i>=0 && i<4, "index out of bounds for component access"); return hkSimdDouble64::convert(m_quad.v[i]); } template <int I> HK_FORCE_INLINE const hkSimdDouble64 hkVector4d::getComponent() const { HK_VECTOR4d_SUBINDEX_CHECK; return hkSimdDouble64::convert(m_quad.v[I]); } HK_FORCE_INLINE void hkVector4d::setComponent(const int i, hkSimdDouble64Parameter val) { HK_MATH_ASSERT(0x6d0c31d7, i>=0 && i<4, "index out of bounds for component access"); m_quad.v[i] = val.getReal(); } template <int I> HK_FORCE_INLINE void hkVector4d::setComponent(hkSimdDouble64Parameter val) { HK_VECTOR4d_SUBINDEX_CHECK; m_quad.v[I] = val.getReal(); } HK_FORCE_INLINE void hkVector4d::reduceToHalfPrecision() { #if defined(HK_HALF_IS_FLOAT) #if defined(HK_REAL_IS_DOUBLE) static const hkUint64 precisionMask = 0xffffffff00000000ull; const hkUint64* src = reinterpret_cast<const hkUint64*>( &m_quad ); hkUint64* dest = reinterpret_cast<hkUint64*>( &m_quad ); dest[0] = src[0] & precisionMask; dest[1] = src[1] & precisionMask; dest[2] = src[2] & precisionMask; dest[3] = src[3] & precisionMask; #endif #else static const hkUint32 precisionMask = 0xffff0000; #if defined(HK_REAL_IS_DOUBLE) hkFloat32 fsrc[4]; fsrc[0] = hkFloat32(m_quad.v[0]); fsrc[1] = hkFloat32(m_quad.v[1]); fsrc[2] = hkFloat32(m_quad.v[2]); fsrc[3] = hkFloat32(m_quad.v[3]); const hkUint32* src = reinterpret_cast<const hkUint32*>( fsrc ); hkUint32* dest = reinterpret_cast<hkUint32*>( fsrc ); dest[0] = src[0] & precisionMask; dest[1] = src[1] & precisionMask; dest[2] = src[2] & precisionMask; dest[3] = src[3] & precisionMask; m_quad.v[0] = hkDouble64(fsrc[0]); m_quad.v[1] = hkDouble64(fsrc[1]); m_quad.v[2] = hkDouble64(fsrc[2]); m_quad.v[3] = hkDouble64(fsrc[3]); #else const hkUint32* src = reinterpret_cast<const hkUint32*>( &m_quad ); hkUint32* dest = reinterpret_cast<hkUint32*>( &m_quad ); dest[0] = src[0] & precisionMask; dest[1] = src[1] & precisionMask; dest[2] = src[2] & precisionMask; dest[3] = src[3] & precisionMask; #endif #endif } template <int N> HK_FORCE_INLINE hkBool32 hkVector4d::isOk() const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; if ( !hkMath::isFinite(m_quad.v[0]) ) return false; if ((N>1)&&(!hkMath::isFinite(m_quad.v[1]))) return false; if ((N>2)&&(!hkMath::isFinite(m_quad.v[2]))) return false; if ((N>3)&&(!hkMath::isFinite(m_quad.v[3]))) return false; return true; } template <> HK_FORCE_INLINE void hkVector4d::setPermutation<hkVectorPermutation::XYZW>(hkVector4dParameter v) { m_quad = v.m_quad; } template <hkVectorPermutation::Permutation P> HK_FORCE_INLINE void hkVector4d::setPermutation(hkVector4dParameter v) { // Store in regs before writing to the destination - to handle case when v and this are the same const hkDouble64 t0 = v.m_quad.v[(P & 0x3000) >> 12]; const hkDouble64 t1 = v.m_quad.v[(P & 0x0300) >> 8]; const hkDouble64 t2 = v.m_quad.v[(P & 0x0030) >> 4]; const hkDouble64 t3 = v.m_quad.v[(P & 0x0003) >> 0]; m_quad.v[0] = t0; m_quad.v[1] = t1; m_quad.v[2] = t2; m_quad.v[3] = t3; } HK_FORCE_INLINE const hkVector4dComparison hkVector4d::signBitSet() const { hkVector4dComparison mask; mask.m_mask = hkVector4ComparisonMask::MASK_NONE; mask.m_mask |= hkMath::signBitSet(m_quad.v[0]) ? hkVector4ComparisonMask::MASK_X : hkVector4ComparisonMask::MASK_NONE; mask.m_mask |= hkMath::signBitSet(m_quad.v[1]) ? hkVector4ComparisonMask::MASK_Y : hkVector4ComparisonMask::MASK_NONE; mask.m_mask |= hkMath::signBitSet(m_quad.v[2]) ? hkVector4ComparisonMask::MASK_Z : hkVector4ComparisonMask::MASK_NONE; mask.m_mask |= hkMath::signBitSet(m_quad.v[3]) ? hkVector4ComparisonMask::MASK_W : hkVector4ComparisonMask::MASK_NONE; return mask; } HK_FORCE_INLINE const hkVector4dComparison hkVector4d::signBitClear() const { hkVector4dComparison mask; mask.m_mask = hkVector4ComparisonMask::MASK_NONE; mask.m_mask |= hkMath::signBitSet(m_quad.v[0]) ? hkVector4ComparisonMask::MASK_NONE : hkVector4ComparisonMask::MASK_X; mask.m_mask |= hkMath::signBitSet(m_quad.v[1]) ? hkVector4ComparisonMask::MASK_NONE : hkVector4ComparisonMask::MASK_Y; mask.m_mask |= hkMath::signBitSet(m_quad.v[2]) ? hkVector4ComparisonMask::MASK_NONE : hkVector4ComparisonMask::MASK_Z; mask.m_mask |= hkMath::signBitSet(m_quad.v[3]) ? hkVector4ComparisonMask::MASK_NONE : hkVector4ComparisonMask::MASK_W; return mask; } HK_FORCE_INLINE void hkVector4d::setFlipSign(hkVector4dParameter v, hkVector4dComparisonParameter mask) { m_quad.v[0] = mask.anyIsSet<hkVector4ComparisonMask::MASK_X>() ? -v.m_quad.v[0] : v.m_quad.v[0]; m_quad.v[1] = mask.anyIsSet<hkVector4ComparisonMask::MASK_Y>() ? -v.m_quad.v[1] : v.m_quad.v[1]; m_quad.v[2] = mask.anyIsSet<hkVector4ComparisonMask::MASK_Z>() ? -v.m_quad.v[2] : v.m_quad.v[2]; m_quad.v[3] = mask.anyIsSet<hkVector4ComparisonMask::MASK_W>() ? -v.m_quad.v[3] : v.m_quad.v[3]; } HK_FORCE_INLINE void hkVector4d::setFlipSign(hkVector4dParameter a, hkVector4dParameter signs) { m_quad.v[0] = hkMath::signBitSet(signs.m_quad.v[0]) ? -a.m_quad.v[0] : a.m_quad.v[0]; m_quad.v[1] = hkMath::signBitSet(signs.m_quad.v[1]) ? -a.m_quad.v[1] : a.m_quad.v[1]; m_quad.v[2] = hkMath::signBitSet(signs.m_quad.v[2]) ? -a.m_quad.v[2] : a.m_quad.v[2]; m_quad.v[3] = hkMath::signBitSet(signs.m_quad.v[3]) ? -a.m_quad.v[3] : a.m_quad.v[3]; } HK_FORCE_INLINE void hkVector4d::setFlipSign(hkVector4dParameter a, hkSimdDouble64Parameter sharedSign) { const bool flip = hkMath::signBitSet(sharedSign.getReal()); if (flip) { m_quad.v[0] = -a.m_quad.v[0]; m_quad.v[1] = -a.m_quad.v[1]; m_quad.v[2] = -a.m_quad.v[2]; m_quad.v[3] = -a.m_quad.v[3]; } else { m_quad.v[0] = a.m_quad.v[0]; m_quad.v[1] = a.m_quad.v[1]; m_quad.v[2] = a.m_quad.v[2]; m_quad.v[3] = a.m_quad.v[3]; } } // // advanced interface // namespace hkVector4_AdvancedInterface { template <hkMathAccuracyMode A, hkMathDivByZeroMode D> struct unrolld_setReciprocal { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a) { HK_VECTOR4d_TEMPLATE_CONFIG_NOT_IMPLEMENTED; } }; template <hkMathAccuracyMode A> struct unrolld_setReciprocal<A, HK_DIV_IGNORE> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a) { switch (A) { case HK_ACC_23_BIT: { self.v[0] = hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[0]))); self.v[1] = hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[1]))); self.v[2] = hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[2]))); self.v[3] = hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[3]))); } break; case HK_ACC_12_BIT: { self.v[0] = hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[0]))); self.v[1] = hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[1]))); self.v[2] = hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[2]))); self.v[3] = hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[3]))); } break; default: { self.v[0] = hkDouble64(1) / a.m_quad.v[0]; self.v[1] = hkDouble64(1) / a.m_quad.v[1]; self.v[2] = hkDouble64(1) / a.m_quad.v[2]; self.v[3] = hkDouble64(1) / a.m_quad.v[3]; } break; // HK_ACC_FULL } } }; template <hkMathAccuracyMode A> struct unrolld_setReciprocal<A, HK_DIV_SET_ZERO> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a) { switch (A) { case HK_ACC_23_BIT: { self.v[0] = ((a.m_quad.v[0] == hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[0])))); self.v[1] = ((a.m_quad.v[1] == hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[1])))); self.v[2] = ((a.m_quad.v[2] == hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[2])))); self.v[3] = ((a.m_quad.v[3] == hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[3])))); } break; case HK_ACC_12_BIT: { self.v[0] = ((a.m_quad.v[0] == hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[0])))); self.v[1] = ((a.m_quad.v[1] == hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[1])))); self.v[2] = ((a.m_quad.v[2] == hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[2])))); self.v[3] = ((a.m_quad.v[3] == hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[3])))); } break; default: { self.v[0] = ((a.m_quad.v[0] == hkDouble64(0)) ? hkDouble64(0) : hkDouble64(1) / a.m_quad.v[0]); self.v[1] = ((a.m_quad.v[1] == hkDouble64(0)) ? hkDouble64(0) : hkDouble64(1) / a.m_quad.v[1]); self.v[2] = ((a.m_quad.v[2] == hkDouble64(0)) ? hkDouble64(0) : hkDouble64(1) / a.m_quad.v[2]); self.v[3] = ((a.m_quad.v[3] == hkDouble64(0)) ? hkDouble64(0) : hkDouble64(1) / a.m_quad.v[3]); } break; // HK_ACC_FULL } } }; template <hkMathAccuracyMode A> struct unrolld_setReciprocal<A, HK_DIV_SET_HIGH> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a) { hkDouble64 high0 = hkMath::signBitSet(a.m_quad.v[0]) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH; hkDouble64 high1 = hkMath::signBitSet(a.m_quad.v[1]) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH; hkDouble64 high2 = hkMath::signBitSet(a.m_quad.v[2]) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH; hkDouble64 high3 = hkMath::signBitSet(a.m_quad.v[3]) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH; switch (A) { case HK_ACC_23_BIT: { self.v[0] = ((a.m_quad.v[0] == hkDouble64(0)) ? high0 : hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[0])))); self.v[1] = ((a.m_quad.v[1] == hkDouble64(0)) ? high1 : hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[1])))); self.v[2] = ((a.m_quad.v[2] == hkDouble64(0)) ? high2 : hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[2])))); self.v[3] = ((a.m_quad.v[3] == hkDouble64(0)) ? high3 : hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[3])))); } break; case HK_ACC_12_BIT: { self.v[0] = ((a.m_quad.v[0] == hkDouble64(0)) ? high0 : hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[0])))); self.v[1] = ((a.m_quad.v[1] == hkDouble64(0)) ? high1 : hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[1])))); self.v[2] = ((a.m_quad.v[2] == hkDouble64(0)) ? high2 : hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[2])))); self.v[3] = ((a.m_quad.v[3] == hkDouble64(0)) ? high3 : hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[3])))); } break; default: { self.v[0] = ((a.m_quad.v[0] == hkDouble64(0)) ? high0 : hkDouble64(1) / a.m_quad.v[0]); self.v[1] = ((a.m_quad.v[1] == hkDouble64(0)) ? high1 : hkDouble64(1) / a.m_quad.v[1]); self.v[2] = ((a.m_quad.v[2] == hkDouble64(0)) ? high2 : hkDouble64(1) / a.m_quad.v[2]); self.v[3] = ((a.m_quad.v[3] == hkDouble64(0)) ? high3 : hkDouble64(1) / a.m_quad.v[3]); } break; // HK_ACC_FULL } } }; template <hkMathAccuracyMode A> struct unrolld_setReciprocal<A, HK_DIV_SET_MAX> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a) { hkDouble64 max0 = hkMath::signBitSet(a.m_quad.v[0]) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX; hkDouble64 max1 = hkMath::signBitSet(a.m_quad.v[1]) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX; hkDouble64 max2 = hkMath::signBitSet(a.m_quad.v[2]) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX; hkDouble64 max3 = hkMath::signBitSet(a.m_quad.v[3]) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX; switch (A) { case HK_ACC_23_BIT: { self.v[0] = ((a.m_quad.v[0] == hkDouble64(0)) ? max0 : hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[0])))); self.v[1] = ((a.m_quad.v[1] == hkDouble64(0)) ? max1 : hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[1])))); self.v[2] = ((a.m_quad.v[2] == hkDouble64(0)) ? max2 : hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[2])))); self.v[3] = ((a.m_quad.v[3] == hkDouble64(0)) ? max3 : hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(a.m_quad.v[3])))); } break; case HK_ACC_12_BIT: { self.v[0] = ((a.m_quad.v[0] == hkDouble64(0)) ? max0 : hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[0])))); self.v[1] = ((a.m_quad.v[1] == hkDouble64(0)) ? max1 : hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[1])))); self.v[2] = ((a.m_quad.v[2] == hkDouble64(0)) ? max2 : hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[2])))); self.v[3] = ((a.m_quad.v[3] == hkDouble64(0)) ? max3 : hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(a.m_quad.v[3])))); } break; default: { self.v[0] = ((a.m_quad.v[0] == hkDouble64(0)) ? max0 : hkDouble64(1) / a.m_quad.v[0]); self.v[1] = ((a.m_quad.v[1] == hkDouble64(0)) ? max1 : hkDouble64(1) / a.m_quad.v[1]); self.v[2] = ((a.m_quad.v[2] == hkDouble64(0)) ? max2 : hkDouble64(1) / a.m_quad.v[2]); self.v[3] = ((a.m_quad.v[3] == hkDouble64(0)) ? max3 : hkDouble64(1) / a.m_quad.v[3]); } break; // HK_ACC_FULL } } }; template <hkMathAccuracyMode A> struct unrolld_setReciprocal<A, HK_DIV_SET_ZERO_AND_ONE> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a) { hkQuadDouble64 val; unrolld_setReciprocal<A, HK_DIV_SET_ZERO>::apply(val,a); hkQuadDouble64 absValLessOne; absValLessOne.v[0] = hkMath::fabs(val.v[0] - hkDouble64(1)); absValLessOne.v[1] = hkMath::fabs(val.v[1] - hkDouble64(1)); absValLessOne.v[2] = hkMath::fabs(val.v[2] - hkDouble64(1)); absValLessOne.v[3] = hkMath::fabs(val.v[3] - hkDouble64(1)); self.v[0] = ((absValLessOne.v[0] <= HK_DOUBLE_EPSILON) ? hkDouble64(1) : val.v[0]); self.v[1] = ((absValLessOne.v[1] <= HK_DOUBLE_EPSILON) ? hkDouble64(1) : val.v[1]); self.v[2] = ((absValLessOne.v[2] <= HK_DOUBLE_EPSILON) ? hkDouble64(1) : val.v[2]); self.v[3] = ((absValLessOne.v[3] <= HK_DOUBLE_EPSILON) ? hkDouble64(1) : val.v[3]); } }; } // namespace template <hkMathAccuracyMode A, hkMathDivByZeroMode D> HK_FORCE_INLINE void hkVector4d::setReciprocal(hkVector4dParameter v) { hkVector4_AdvancedInterface::unrolld_setReciprocal<A,D>::apply(m_quad,v); } HK_FORCE_INLINE void hkVector4d::setReciprocal(hkVector4dParameter v) { hkVector4_AdvancedInterface::unrolld_setReciprocal<HK_ACC_23_BIT,HK_DIV_IGNORE>::apply(m_quad,v); } namespace hkVector4_AdvancedInterface { template <hkMathAccuracyMode A, hkMathDivByZeroMode D> struct unrolld_setDiv { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a, hkVector4dParameter b) { HK_VECTOR4d_TEMPLATE_CONFIG_NOT_IMPLEMENTED; } }; template <hkMathAccuracyMode A> struct unrolld_setDiv<A, HK_DIV_IGNORE> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a, hkVector4dParameter b) { switch (A) { case HK_ACC_23_BIT: { self.v[0] = a.m_quad.v[0] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[0]))); self.v[1] = a.m_quad.v[1] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[1]))); self.v[2] = a.m_quad.v[2] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[2]))); self.v[3] = a.m_quad.v[3] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[3]))); } break; case HK_ACC_12_BIT: { self.v[0] = a.m_quad.v[0] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[0]))); self.v[1] = a.m_quad.v[1] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[1]))); self.v[2] = a.m_quad.v[2] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[2]))); self.v[3] = a.m_quad.v[3] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[3]))); } break; default: { self.v[0] = a.m_quad.v[0] / b.m_quad.v[0]; self.v[1] = a.m_quad.v[1] / b.m_quad.v[1]; self.v[2] = a.m_quad.v[2] / b.m_quad.v[2]; self.v[3] = a.m_quad.v[3] / b.m_quad.v[3]; } break; // HK_ACC_FULL } } }; template <hkMathAccuracyMode A> struct unrolld_setDiv<A, HK_DIV_SET_ZERO> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a, hkVector4dParameter b) { switch (A) { case HK_ACC_23_BIT: { self.v[0] = ((b.m_quad.v[0] == hkDouble64(0)) ? hkDouble64(0) : (a.m_quad.v[0] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[0]))))); self.v[1] = ((b.m_quad.v[1] == hkDouble64(0)) ? hkDouble64(0) : (a.m_quad.v[1] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[1]))))); self.v[2] = ((b.m_quad.v[2] == hkDouble64(0)) ? hkDouble64(0) : (a.m_quad.v[2] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[2]))))); self.v[3] = ((b.m_quad.v[3] == hkDouble64(0)) ? hkDouble64(0) : (a.m_quad.v[3] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[3]))))); } break; case HK_ACC_12_BIT: { self.v[0] = ((b.m_quad.v[0] == hkDouble64(0)) ? hkDouble64(0) : (a.m_quad.v[0] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[0]))))); self.v[1] = ((b.m_quad.v[1] == hkDouble64(0)) ? hkDouble64(0) : (a.m_quad.v[1] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[1]))))); self.v[2] = ((b.m_quad.v[2] == hkDouble64(0)) ? hkDouble64(0) : (a.m_quad.v[2] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[2]))))); self.v[3] = ((b.m_quad.v[3] == hkDouble64(0)) ? hkDouble64(0) : (a.m_quad.v[3] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[3]))))); } break; default: { self.v[0] = ((b.m_quad.v[0] == hkDouble64(0)) ? hkDouble64(0) : (a.m_quad.v[0] / b.m_quad.v[0])); self.v[1] = ((b.m_quad.v[1] == hkDouble64(0)) ? hkDouble64(0) : (a.m_quad.v[1] / b.m_quad.v[1])); self.v[2] = ((b.m_quad.v[2] == hkDouble64(0)) ? hkDouble64(0) : (a.m_quad.v[2] / b.m_quad.v[2])); self.v[3] = ((b.m_quad.v[3] == hkDouble64(0)) ? hkDouble64(0) : (a.m_quad.v[3] / b.m_quad.v[3])); } break; // HK_ACC_FULL } } }; template <hkMathAccuracyMode A> struct unrolld_setDiv<A, HK_DIV_SET_HIGH> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a, hkVector4dParameter b) { switch (A) { case HK_ACC_23_BIT: { self.v[0] = ((b.m_quad.v[0] == hkDouble64(0)) ? ((a.m_quad.v[0] < hkDouble64(0)) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH) : (a.m_quad.v[0] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[0]))))); self.v[1] = ((b.m_quad.v[1] == hkDouble64(0)) ? ((a.m_quad.v[1] < hkDouble64(0)) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH) : (a.m_quad.v[1] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[1]))))); self.v[2] = ((b.m_quad.v[2] == hkDouble64(0)) ? ((a.m_quad.v[2] < hkDouble64(0)) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH) : (a.m_quad.v[2] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[2]))))); self.v[3] = ((b.m_quad.v[3] == hkDouble64(0)) ? ((a.m_quad.v[3] < hkDouble64(0)) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH) : (a.m_quad.v[3] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[3]))))); } break; case HK_ACC_12_BIT: { self.v[0] = ((b.m_quad.v[0] == hkDouble64(0)) ? ((a.m_quad.v[0] < hkDouble64(0)) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH) : (a.m_quad.v[0] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[0]))))); self.v[1] = ((b.m_quad.v[1] == hkDouble64(0)) ? ((a.m_quad.v[1] < hkDouble64(0)) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH) : (a.m_quad.v[1] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[1]))))); self.v[2] = ((b.m_quad.v[2] == hkDouble64(0)) ? ((a.m_quad.v[2] < hkDouble64(0)) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH) : (a.m_quad.v[2] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[2]))))); self.v[3] = ((b.m_quad.v[3] == hkDouble64(0)) ? ((a.m_quad.v[3] < hkDouble64(0)) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH) : (a.m_quad.v[3] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[3]))))); } break; default: { self.v[0] = ((b.m_quad.v[0] == hkDouble64(0)) ? ((a.m_quad.v[0] < hkDouble64(0)) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH) : (a.m_quad.v[0] / b.m_quad.v[0])); self.v[1] = ((b.m_quad.v[1] == hkDouble64(0)) ? ((a.m_quad.v[1] < hkDouble64(0)) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH) : (a.m_quad.v[1] / b.m_quad.v[1])); self.v[2] = ((b.m_quad.v[2] == hkDouble64(0)) ? ((a.m_quad.v[2] < hkDouble64(0)) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH) : (a.m_quad.v[2] / b.m_quad.v[2])); self.v[3] = ((b.m_quad.v[3] == hkDouble64(0)) ? ((a.m_quad.v[3] < hkDouble64(0)) ? -HK_DOUBLE_HIGH : HK_DOUBLE_HIGH) : (a.m_quad.v[3] / b.m_quad.v[3])); } break; // HK_ACC_FULL } } }; template <hkMathAccuracyMode A> struct unrolld_setDiv<A, HK_DIV_SET_MAX> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a, hkVector4dParameter b) { switch (A) { case HK_ACC_23_BIT: { self.v[0] = ((b.m_quad.v[0] == hkDouble64(0)) ? ((a.m_quad.v[0] < hkDouble64(0)) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX) : (a.m_quad.v[0] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[0]))))); self.v[1] = ((b.m_quad.v[1] == hkDouble64(0)) ? ((a.m_quad.v[1] < hkDouble64(0)) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX) : (a.m_quad.v[1] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[1]))))); self.v[2] = ((b.m_quad.v[2] == hkDouble64(0)) ? ((a.m_quad.v[2] < hkDouble64(0)) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX) : (a.m_quad.v[2] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[2]))))); self.v[3] = ((b.m_quad.v[3] == hkDouble64(0)) ? ((a.m_quad.v[3] < hkDouble64(0)) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX) : (a.m_quad.v[3] * hkDouble64(hkMath::rcpF32Approx23Bit(hkFloat32(b.m_quad.v[3]))))); } break; case HK_ACC_12_BIT: { self.v[0] = ((b.m_quad.v[0] == hkDouble64(0)) ? ((a.m_quad.v[0] < hkDouble64(0)) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX) : (a.m_quad.v[0] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[0]))))); self.v[1] = ((b.m_quad.v[1] == hkDouble64(0)) ? ((a.m_quad.v[1] < hkDouble64(0)) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX) : (a.m_quad.v[1] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[1]))))); self.v[2] = ((b.m_quad.v[2] == hkDouble64(0)) ? ((a.m_quad.v[2] < hkDouble64(0)) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX) : (a.m_quad.v[2] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[2]))))); self.v[3] = ((b.m_quad.v[3] == hkDouble64(0)) ? ((a.m_quad.v[3] < hkDouble64(0)) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX) : (a.m_quad.v[3] * hkDouble64(hkMath::rcpF32Approx12Bit(hkFloat32(b.m_quad.v[3]))))); } break; default: { self.v[0] = ((b.m_quad.v[0] == hkDouble64(0)) ? ((a.m_quad.v[0] < hkDouble64(0)) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX) : (a.m_quad.v[0] / b.m_quad.v[0])); self.v[1] = ((b.m_quad.v[1] == hkDouble64(0)) ? ((a.m_quad.v[1] < hkDouble64(0)) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX) : (a.m_quad.v[1] / b.m_quad.v[1])); self.v[2] = ((b.m_quad.v[2] == hkDouble64(0)) ? ((a.m_quad.v[2] < hkDouble64(0)) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX) : (a.m_quad.v[2] / b.m_quad.v[2])); self.v[3] = ((b.m_quad.v[3] == hkDouble64(0)) ? ((a.m_quad.v[3] < hkDouble64(0)) ? -HK_DOUBLE_MAX : HK_DOUBLE_MAX) : (a.m_quad.v[3] / b.m_quad.v[3])); } break; // HK_ACC_FULL } } }; template <hkMathAccuracyMode A> struct unrolld_setDiv<A, HK_DIV_SET_ZERO_AND_ONE> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a, hkVector4dParameter b) { hkQuadDouble64 val; unrolld_setDiv<A, HK_DIV_SET_ZERO>::apply(val,a,b); hkQuadDouble64 absValLessOne; absValLessOne.v[0] = hkMath::fabs(val.v[0]) - hkDouble64(1); absValLessOne.v[1] = hkMath::fabs(val.v[1]) - hkDouble64(1); absValLessOne.v[2] = hkMath::fabs(val.v[2]) - hkDouble64(1); absValLessOne.v[3] = hkMath::fabs(val.v[3]) - hkDouble64(1); self.v[0] = ((absValLessOne.v[0] <= HK_DOUBLE_EPSILON) ? hkDouble64(1) : val.v[0]); self.v[1] = ((absValLessOne.v[1] <= HK_DOUBLE_EPSILON) ? hkDouble64(1) : val.v[1]); self.v[2] = ((absValLessOne.v[2] <= HK_DOUBLE_EPSILON) ? hkDouble64(1) : val.v[2]); self.v[3] = ((absValLessOne.v[3] <= HK_DOUBLE_EPSILON) ? hkDouble64(1) : val.v[3]); } }; } // namespace template <hkMathAccuracyMode A, hkMathDivByZeroMode D> HK_FORCE_INLINE void hkVector4d::setDiv(hkVector4dParameter v0, hkVector4dParameter v1) { hkVector4_AdvancedInterface::unrolld_setDiv<A,D>::apply(m_quad,v0,v1); } HK_FORCE_INLINE void hkVector4d::setDiv(hkVector4dParameter v0, hkVector4dParameter v1) { hkVector4_AdvancedInterface::unrolld_setDiv<HK_ACC_23_BIT,HK_DIV_IGNORE>::apply(m_quad,v0,v1); } template <hkMathAccuracyMode A, hkMathDivByZeroMode D> HK_FORCE_INLINE void hkVector4d::div(hkVector4dParameter a) { setDiv<A,D>( *this, a ); } HK_FORCE_INLINE void hkVector4d::div(hkVector4dParameter a) { setDiv( *this, a ); } namespace hkVector4_AdvancedInterface { template <hkMathAccuracyMode A, hkMathNegSqrtMode S> struct unrolld_setSqrt { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a) { HK_VECTOR4d_TEMPLATE_CONFIG_NOT_IMPLEMENTED; } }; template <hkMathAccuracyMode A> struct unrolld_setSqrt<A, HK_SQRT_IGNORE> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a) { switch (A) { case HK_ACC_23_BIT: { self.v[0] = hkDouble64(hkMath::rcpF32Approx23Bit(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[0])))); self.v[1] = hkDouble64(hkMath::rcpF32Approx23Bit(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[1])))); self.v[2] = hkDouble64(hkMath::rcpF32Approx23Bit(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[2])))); self.v[3] = hkDouble64(hkMath::rcpF32Approx23Bit(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[3])))); } break; case HK_ACC_12_BIT: { self.v[0] = hkDouble64(hkMath::rcpF32Approx12Bit(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[0])))); self.v[1] = hkDouble64(hkMath::rcpF32Approx12Bit(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[1])))); self.v[2] = hkDouble64(hkMath::rcpF32Approx12Bit(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[2])))); self.v[3] = hkDouble64(hkMath::rcpF32Approx12Bit(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[3])))); } break; default: { self.v[0] = hkMath::sqrt(a.m_quad.v[0]); self.v[1] = hkMath::sqrt(a.m_quad.v[1]); self.v[2] = hkMath::sqrt(a.m_quad.v[2]); self.v[3] = hkMath::sqrt(a.m_quad.v[3]); } break; // HK_ACC_FULL } } }; template <hkMathAccuracyMode A> struct unrolld_setSqrt<A, HK_SQRT_SET_ZERO> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a) { switch (A) { case HK_ACC_23_BIT: { self.v[0] = ((a.m_quad.v[0] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx23Bit(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[0]))))); self.v[1] = ((a.m_quad.v[1] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx23Bit(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[1]))))); self.v[2] = ((a.m_quad.v[2] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx23Bit(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[2]))))); self.v[3] = ((a.m_quad.v[3] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx23Bit(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[3]))))); } break; case HK_ACC_12_BIT: { self.v[0] = ((a.m_quad.v[0] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx12Bit(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[0]))))); self.v[1] = ((a.m_quad.v[1] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx12Bit(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[1]))))); self.v[2] = ((a.m_quad.v[2] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx12Bit(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[2]))))); self.v[3] = ((a.m_quad.v[3] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::rcpF32Approx12Bit(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[3]))))); } break; default: { self.v[0] = ((a.m_quad.v[0] <= hkDouble64(0)) ? hkDouble64(0) : hkMath::sqrt(a.m_quad.v[0])); self.v[1] = ((a.m_quad.v[1] <= hkDouble64(0)) ? hkDouble64(0) : hkMath::sqrt(a.m_quad.v[1])); self.v[2] = ((a.m_quad.v[2] <= hkDouble64(0)) ? hkDouble64(0) : hkMath::sqrt(a.m_quad.v[2])); self.v[3] = ((a.m_quad.v[3] <= hkDouble64(0)) ? hkDouble64(0) : hkMath::sqrt(a.m_quad.v[3])); } break; // HK_ACC_FULL } } }; } // namespace template <hkMathAccuracyMode A, hkMathNegSqrtMode S> HK_FORCE_INLINE void hkVector4d::setSqrt(hkVector4dParameter a) { hkVector4_AdvancedInterface::unrolld_setSqrt<A,S>::apply(m_quad, a); } HK_FORCE_INLINE void hkVector4d::setSqrt(hkVector4dParameter a) { hkVector4_AdvancedInterface::unrolld_setSqrt<HK_ACC_23_BIT,HK_SQRT_SET_ZERO>::apply(m_quad, a); } namespace hkVector4_AdvancedInterface { template <hkMathAccuracyMode A, hkMathNegSqrtMode S> struct unrolld_setSqrtInverse { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a) { HK_VECTOR4d_TEMPLATE_CONFIG_NOT_IMPLEMENTED; } }; template <hkMathAccuracyMode A> struct unrolld_setSqrtInverse<A, HK_SQRT_IGNORE> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a) { switch (A) { case HK_ACC_23_BIT: { self.v[0] = hkDouble64(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[0]))); self.v[1] = hkDouble64(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[1]))); self.v[2] = hkDouble64(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[2]))); self.v[3] = hkDouble64(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[3]))); } break; case HK_ACC_12_BIT: { self.v[0] = hkDouble64(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[0]))); self.v[1] = hkDouble64(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[1]))); self.v[2] = hkDouble64(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[2]))); self.v[3] = hkDouble64(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[3]))); } break; default: { self.v[0] = hkMath::sqrtInverse(a.m_quad.v[0]); self.v[1] = hkMath::sqrtInverse(a.m_quad.v[1]); self.v[2] = hkMath::sqrtInverse(a.m_quad.v[2]); self.v[3] = hkMath::sqrtInverse(a.m_quad.v[3]); } break; // HK_ACC_FULL } } }; template <hkMathAccuracyMode A> struct unrolld_setSqrtInverse<A, HK_SQRT_SET_ZERO> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, hkVector4dParameter a) { switch (A) { case HK_ACC_23_BIT: { self.v[0] = ((a.m_quad.v[0] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[0])))); self.v[1] = ((a.m_quad.v[1] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[1])))); self.v[2] = ((a.m_quad.v[2] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[2])))); self.v[3] = ((a.m_quad.v[3] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::invSqrtF32Approx23Bit(hkFloat32(a.m_quad.v[3])))); } break; case HK_ACC_12_BIT: { self.v[0] = ((a.m_quad.v[0] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[0])))); self.v[1] = ((a.m_quad.v[1] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[1])))); self.v[2] = ((a.m_quad.v[2] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[2])))); self.v[3] = ((a.m_quad.v[3] <= hkDouble64(0)) ? hkDouble64(0) : hkDouble64(hkMath::invSqrtF32Approx12Bit(hkFloat32(a.m_quad.v[3])))); } break; default: { self.v[0] = ((a.m_quad.v[0] <= hkDouble64(0)) ? hkDouble64(0) : hkMath::sqrtInverse(a.m_quad.v[0])); self.v[1] = ((a.m_quad.v[1] <= hkDouble64(0)) ? hkDouble64(0) : hkMath::sqrtInverse(a.m_quad.v[1])); self.v[2] = ((a.m_quad.v[2] <= hkDouble64(0)) ? hkDouble64(0) : hkMath::sqrtInverse(a.m_quad.v[2])); self.v[3] = ((a.m_quad.v[3] <= hkDouble64(0)) ? hkDouble64(0) : hkMath::sqrtInverse(a.m_quad.v[3])); } break; // HK_ACC_FULL } } }; } // namespace template <hkMathAccuracyMode A, hkMathNegSqrtMode S> HK_FORCE_INLINE void hkVector4d::setSqrtInverse(hkVector4dParameter a) { hkVector4_AdvancedInterface::unrolld_setSqrtInverse<A,S>::apply(m_quad, a); } HK_FORCE_INLINE void hkVector4d::setSqrtInverse(hkVector4dParameter a) { hkVector4_AdvancedInterface::unrolld_setSqrtInverse<HK_ACC_23_BIT,HK_SQRT_SET_ZERO>::apply(m_quad, a); } namespace hkVector4_AdvancedInterface { template <int N, hkMathIoMode A> struct unrolld_load { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkFloat32* HK_RESTRICT p) { HK_VECTOR4d_TEMPLATE_CONFIG_NOT_IMPLEMENTED; } }; template <int N, hkMathIoMode A> struct unrolld_load_D { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkDouble64* HK_RESTRICT p) { HK_VECTOR4d_TEMPLATE_CONFIG_NOT_IMPLEMENTED; } }; template <int N> struct unrolld_load<N, HK_IO_BYTE_ALIGNED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkFloat32* HK_RESTRICT p) { self.v[0] = hkDouble64(p[0]); if ( N >= 2){ self.v[1] = hkDouble64(p[1]); } if ( N >= 3){ self.v[2] = hkDouble64(p[2]); } if ( N >= 4){ self.v[3] = hkDouble64(p[3]); } #if defined(HK_DEBUG) #if defined(HK_REAL_IS_DOUBLE) for(int i=N; i<4; ++i) *((hkUint64*)&(self.v[i])) = 0xffffffffffffffffull; #else for(int i=N; i<4; ++i) *((hkUint32*)&(self.v[i])) = 0xffffffff; #endif #endif } }; template <int N> struct unrolld_load_D<N, HK_IO_BYTE_ALIGNED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkDouble64* HK_RESTRICT p) { self.v[0] = hkDouble64(p[0]); if ( N >= 2){ self.v[1] = hkDouble64(p[1]); } if ( N >= 3){ self.v[2] = hkDouble64(p[2]); } if ( N >= 4){ self.v[3] = hkDouble64(p[3]); } #if defined(HK_DEBUG) #if defined(HK_REAL_IS_DOUBLE) for(int i=N; i<4; ++i) *((hkUint64*)&(self.v[i])) = 0xffffffffffffffffull; #else for(int i=N; i<4; ++i) *((hkUint32*)&(self.v[i])) = 0xffffffff; #endif #endif } }; template <int N> struct unrolld_load<N, HK_IO_NATIVE_ALIGNED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkFloat32* HK_RESTRICT p) { HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & (sizeof(hkFloat32)-1) ) == 0, "pointer must be aligned to native size of hkFloat32."); unrolld_load<N, HK_IO_BYTE_ALIGNED>::apply(self,p); } }; template <int N> struct unrolld_load_D<N, HK_IO_NATIVE_ALIGNED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkDouble64* HK_RESTRICT p) { HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & (sizeof(hkDouble64)-1) ) == 0, "pointer must be aligned to native size of hkDouble64."); unrolld_load_D<N, HK_IO_BYTE_ALIGNED>::apply(self,p); } }; template <int N> struct unrolld_load<N, HK_IO_SIMD_ALIGNED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkFloat32* HK_RESTRICT p) { #if !defined(HK_ALIGN_RELAX_CHECKS) HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & ((sizeof(hkFloat32)*(N!=3?N:4) )-1) ) == 0, "pointer must be aligned for SIMD."); #endif unrolld_load<N, HK_IO_NATIVE_ALIGNED>::apply(self,p); } }; template <int N> struct unrolld_load_D<N, HK_IO_SIMD_ALIGNED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkDouble64* HK_RESTRICT p) { #if !defined(HK_ALIGN_RELAX_CHECKS) HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & ((sizeof(hkDouble64)*(N!=3?N:4) )-1) ) == 0, "pointer must be aligned for SIMD."); #endif unrolld_load_D<N, HK_IO_NATIVE_ALIGNED>::apply(self,p); } }; template <int N> struct unrolld_load<N, HK_IO_NOT_CACHED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkFloat32* HK_RESTRICT p) { unrolld_load<N, HK_IO_SIMD_ALIGNED>::apply(self,p); } }; template <int N> struct unrolld_load_D<N, HK_IO_NOT_CACHED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkDouble64* HK_RESTRICT p) { unrolld_load_D<N, HK_IO_SIMD_ALIGNED>::apply(self,p); } }; } // namespace template <int N, hkMathIoMode A> HK_FORCE_INLINE void hkVector4d::load(const hkFloat32* p) { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_load<N,A>::apply(m_quad, p); } template <int N, hkMathIoMode A> HK_FORCE_INLINE void hkVector4d::load(const hkDouble64* p) { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_load_D<N,A>::apply(m_quad, p); } template <int N> HK_FORCE_INLINE void hkVector4d::load(const hkFloat32* p) { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_load<N,HK_IO_SIMD_ALIGNED>::apply(m_quad, p); } template <int N> HK_FORCE_INLINE void hkVector4d::load(const hkDouble64* p) { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_load_D<N,HK_IO_SIMD_ALIGNED>::apply(m_quad, p); } namespace hkVector4_AdvancedInterface { template <int N, hkMathIoMode A> struct unrolld_loadH { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkHalf* HK_RESTRICT p) { HK_VECTOR4d_TEMPLATE_CONFIG_NOT_IMPLEMENTED; } }; template <int N> struct unrolld_loadH<N, HK_IO_BYTE_ALIGNED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkHalf* HK_RESTRICT p) { switch (N) { case 4: self.v[3] = p[3].getReal(); case 3: self.v[2] = p[2].getReal(); case 2: self.v[1] = p[1].getReal(); default: self.v[0] = p[0].getReal(); break; } #if defined(HK_REAL_IS_DOUBLE) for(int i=N; i<4; ++i) *((hkUint64*)&(self.v[i])) = 0xffffffffffffffffull; #else for(int i=N; i<4; ++i) *((hkUint32*)&(self.v[i])) = 0xffffffff; #endif } }; template <int N> struct unrolld_loadH<N, HK_IO_NATIVE_ALIGNED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkHalf* HK_RESTRICT p) { HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & (sizeof(hkHalf)-1) ) == 0, "pointer must be aligned to native size of hkHalf."); unrolld_loadH<N, HK_IO_BYTE_ALIGNED>::apply(self,p); } }; template <int N> struct unrolld_loadH<N, HK_IO_SIMD_ALIGNED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkHalf* HK_RESTRICT p) { #if !defined(HK_ALIGN_RELAX_CHECKS) HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & ((sizeof(hkHalf)*(N!=3?N:4) )-1) ) == 0, "pointer must be aligned for SIMD."); #endif unrolld_loadH<N, HK_IO_NATIVE_ALIGNED>::apply(self,p); } }; template <int N> struct unrolld_loadH<N, HK_IO_NOT_CACHED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkHalf* HK_RESTRICT p) { unrolld_loadH<N, HK_IO_SIMD_ALIGNED>::apply(self,p); } }; } // namespace template <int N, hkMathIoMode A> HK_FORCE_INLINE void hkVector4d::load(const hkHalf* p) { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_loadH<N,A>::apply(m_quad, p); } template <int N> HK_FORCE_INLINE void hkVector4d::load(const hkHalf* p) { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_loadH<N,HK_IO_SIMD_ALIGNED>::apply(m_quad, p); } namespace hkVector4_AdvancedInterface { template <int N, hkMathIoMode A> struct unrolld_loadF16 { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkFloat16* HK_RESTRICT p) { HK_VECTOR4d_TEMPLATE_CONFIG_NOT_IMPLEMENTED; } }; template <int N> struct unrolld_loadF16<N, HK_IO_BYTE_ALIGNED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkFloat16* HK_RESTRICT p) { switch (N) { case 4: self.v[3] = p[3].getReal(); case 3: self.v[2] = p[2].getReal(); case 2: self.v[1] = p[1].getReal(); default: self.v[0] = p[0].getReal(); break; } #if defined(HK_DEBUG) #if defined(HK_REAL_IS_DOUBLE) for(int i=N; i<4; ++i) *((hkUint64*)&(self.v[i])) = 0xffffffffffffffffull; #else for(int i=N; i<4; ++i) *((hkUint32*)&(self.v[i])) = 0xffffffff; #endif #endif } }; template <int N> struct unrolld_loadF16<N, HK_IO_NATIVE_ALIGNED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkFloat16* HK_RESTRICT p) { HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & (sizeof(hkFloat16)-1) ) == 0, "pointer must be aligned to native size of hkFloat16."); unrolld_loadF16<N, HK_IO_BYTE_ALIGNED>::apply(self,p); } }; template <int N> struct unrolld_loadF16<N, HK_IO_SIMD_ALIGNED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkFloat16* HK_RESTRICT p) { #if !defined(HK_ALIGN_RELAX_CHECKS) HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & ((sizeof(hkFloat16)*(N!=3?N:4) )-1) ) == 0, "pointer must be aligned for SIMD."); #endif unrolld_loadF16<N, HK_IO_NATIVE_ALIGNED>::apply(self,p); } }; template <int N> struct unrolld_loadF16<N, HK_IO_NOT_CACHED> { HK_FORCE_INLINE static void apply(hkQuadDouble64& self, const hkFloat16* HK_RESTRICT p) { unrolld_loadF16<N, HK_IO_SIMD_ALIGNED>::apply(self,p); } }; } // namespace template <int N, hkMathIoMode A> HK_FORCE_INLINE void hkVector4d::load(const hkFloat16* p) { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_loadF16<N,A>::apply(m_quad, p); } template <int N> HK_FORCE_INLINE void hkVector4d::load(const hkFloat16* p) { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_loadF16<N,HK_IO_SIMD_ALIGNED>::apply(m_quad, p); } namespace hkVector4_AdvancedInterface { template <int N, hkMathIoMode A> struct unrolld_store { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkFloat32* HK_RESTRICT p) { HK_VECTOR4d_TEMPLATE_CONFIG_NOT_IMPLEMENTED; } }; template <int N, hkMathIoMode A> struct unrolld_store_D { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkDouble64* HK_RESTRICT p) { HK_VECTOR4d_TEMPLATE_CONFIG_NOT_IMPLEMENTED; } }; template <int N> struct unrolld_store<N, HK_IO_BYTE_ALIGNED> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkFloat32* HK_RESTRICT p) { p[0] = hkFloat32(self.v[0]); if ( N >= 2){ p[1] = hkFloat32(self.v[1]); } if ( N >= 3){ p[2] = hkFloat32(self.v[2]); } if ( N >= 4){ p[3] = hkFloat32(self.v[3]); } } }; template <int N> struct unrolld_store_D<N, HK_IO_BYTE_ALIGNED> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkDouble64* HK_RESTRICT p) { p[0] = hkDouble64(self.v[0]); if ( N >= 2){ p[1] = hkDouble64(self.v[1]); } if ( N >= 3){ p[2] = hkDouble64(self.v[2]); } if ( N >= 4){ p[3] = hkDouble64(self.v[3]); } } }; template <int N> struct unrolld_store<N, HK_IO_NATIVE_ALIGNED> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkFloat32* HK_RESTRICT p) { HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & (sizeof(hkFloat32)-1) ) == 0, "pointer must be aligned to native size of hkFloat32."); unrolld_store<N, HK_IO_BYTE_ALIGNED>::apply(self,p); } }; template <int N> struct unrolld_store_D<N, HK_IO_NATIVE_ALIGNED> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkDouble64* HK_RESTRICT p) { HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & (sizeof(hkDouble64)-1) ) == 0, "pointer must be aligned to native size of hkDouble64."); unrolld_store_D<N, HK_IO_BYTE_ALIGNED>::apply(self,p); } }; template <int N> struct unrolld_store<N, HK_IO_SIMD_ALIGNED> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkFloat32* HK_RESTRICT p) { #if !defined(HK_ALIGN_RELAX_CHECKS) HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & ((sizeof(hkFloat32)*(N!=3?N:4) )-1) ) == 0, "pointer must be aligned for SIMD."); #endif unrolld_store<N, HK_IO_NATIVE_ALIGNED>::apply(self,p); } }; template <int N> struct unrolld_store_D<N, HK_IO_SIMD_ALIGNED> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkDouble64* HK_RESTRICT p) { #if !defined(HK_ALIGN_RELAX_CHECKS) HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & ((sizeof(hkDouble64)*(N!=3?N:4) )-1) ) == 0, "pointer must be aligned for SIMD."); #endif unrolld_store_D<N, HK_IO_NATIVE_ALIGNED>::apply(self,p); } }; template <int N> struct unrolld_store<N, HK_IO_NOT_CACHED> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkFloat32* HK_RESTRICT p) { unrolld_store<N, HK_IO_SIMD_ALIGNED>::apply(self,p); } }; template <int N> struct unrolld_store_D<N, HK_IO_NOT_CACHED> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkDouble64* HK_RESTRICT p) { unrolld_store_D<N, HK_IO_SIMD_ALIGNED>::apply(self,p); } }; } // namespace template <int N, hkMathIoMode A, hkMathRoundingMode R> HK_FORCE_INLINE void hkVector4d::store(hkFloat32* p) const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_store<N,A>::apply(m_quad, p); } template <int N, hkMathIoMode A, hkMathRoundingMode R> HK_FORCE_INLINE void hkVector4d::store(hkDouble64* p) const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_store_D<N,A>::apply(m_quad, p); } template <int N, hkMathIoMode A> HK_FORCE_INLINE void hkVector4d::store(hkFloat32* p) const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_store<N,A>::apply(m_quad, p); } template <int N, hkMathIoMode A> HK_FORCE_INLINE void hkVector4d::store(hkDouble64* p) const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_store_D<N,A>::apply(m_quad, p); } template <int N> HK_FORCE_INLINE void hkVector4d::store(hkFloat32* p) const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_store<N,HK_IO_SIMD_ALIGNED>::apply(m_quad, p); } template <int N> HK_FORCE_INLINE void hkVector4d::store(hkDouble64* p) const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_store_D<N,HK_IO_SIMD_ALIGNED>::apply(m_quad, p); } namespace hkVector4_AdvancedInterface { template <int N, hkMathIoMode A, hkMathRoundingMode R> struct unrolld_storeH { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkHalf* HK_RESTRICT p) { HK_VECTOR4d_TEMPLATE_CONFIG_NOT_IMPLEMENTED; } }; template <int N, hkMathRoundingMode R> struct unrolld_storeH<N, HK_IO_BYTE_ALIGNED, R> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkHalf* HK_RESTRICT p) { switch (N) { case 4: p[3].set<(R == HK_ROUND_NEAREST)>(self.v[3]); case 3: p[2].set<(R == HK_ROUND_NEAREST)>(self.v[2]); case 2: p[1].set<(R == HK_ROUND_NEAREST)>(self.v[1]); default: p[0].set<(R == HK_ROUND_NEAREST)>(self.v[0]); break; } } }; template <int N, hkMathRoundingMode R> struct unrolld_storeH<N, HK_IO_NATIVE_ALIGNED, R> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkHalf* HK_RESTRICT p) { HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & (sizeof(hkHalf)-1) ) == 0, "pointer must be aligned to native size of hkHalf."); unrolld_storeH<N, HK_IO_BYTE_ALIGNED, R>::apply(self,p); } }; template <int N, hkMathRoundingMode R> struct unrolld_storeH<N, HK_IO_SIMD_ALIGNED, R> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkHalf* HK_RESTRICT p) { #if !defined(HK_ALIGN_RELAX_CHECKS) HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & ((sizeof(hkHalf)*(N!=3?N:4) )-1) ) == 0, "pointer must be aligned for SIMD."); #endif unrolld_storeH<N, HK_IO_NATIVE_ALIGNED, R>::apply(self,p); } }; template <int N, hkMathRoundingMode R> struct unrolld_storeH<N, HK_IO_NOT_CACHED, R> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkHalf* HK_RESTRICT p) { unrolld_storeH<N, HK_IO_SIMD_ALIGNED, R>::apply(self,p); } }; } // namespace template <int N, hkMathIoMode A, hkMathRoundingMode R> HK_FORCE_INLINE void hkVector4d::store(hkHalf* p) const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_storeH<N,A,R>::apply(m_quad, p); } template <int N, hkMathIoMode A> HK_FORCE_INLINE void hkVector4d::store(hkHalf* p) const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_storeH<N,A,HK_ROUND_DEFAULT>::apply(m_quad, p); } template <int N> HK_FORCE_INLINE void hkVector4d::store(hkHalf* p) const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_storeH<N,HK_IO_SIMD_ALIGNED,HK_ROUND_DEFAULT>::apply(m_quad, p); } namespace hkVector4_AdvancedInterface { template <int N, hkMathIoMode A, hkMathRoundingMode R> struct unrolld_storeF16 { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkFloat16* HK_RESTRICT p) { HK_VECTOR4d_TEMPLATE_CONFIG_NOT_IMPLEMENTED; } }; template <int N, hkMathRoundingMode R> struct unrolld_storeF16<N, HK_IO_BYTE_ALIGNED, R> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkFloat16* HK_RESTRICT p) { switch (N) { case 4: p[3].setReal<(R == HK_ROUND_NEAREST)>(self.v[3]); case 3: p[2].setReal<(R == HK_ROUND_NEAREST)>(self.v[2]); case 2: p[1].setReal<(R == HK_ROUND_NEAREST)>(self.v[1]); default: p[0].setReal<(R == HK_ROUND_NEAREST)>(self.v[0]); break; } } }; template <int N, hkMathRoundingMode R> struct unrolld_storeF16<N, HK_IO_NATIVE_ALIGNED, R> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkFloat16* HK_RESTRICT p) { HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & (sizeof(hkFloat16)-1) ) == 0, "pointer must be aligned to native size of hkFloat16."); unrolld_storeF16<N, HK_IO_BYTE_ALIGNED, R>::apply(self,p); } }; template <int N, hkMathRoundingMode R> struct unrolld_storeF16<N, HK_IO_SIMD_ALIGNED, R> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkFloat16* HK_RESTRICT p) { #if !defined(HK_ALIGN_RELAX_CHECKS) HK_MATH_ASSERT(0x64211c2f, ( ((hkUlong)p) & ((sizeof(hkFloat16)*(N!=3?N:4) )-1) ) == 0, "pointer must be aligned for SIMD."); #endif unrolld_storeF16<N, HK_IO_NATIVE_ALIGNED, R>::apply(self,p); } }; template <int N, hkMathRoundingMode R> struct unrolld_storeF16<N, HK_IO_NOT_CACHED, R> { HK_FORCE_INLINE static void apply(const hkQuadDouble64& self, hkFloat16* HK_RESTRICT p) { unrolld_storeF16<N, HK_IO_SIMD_ALIGNED, R>::apply(self,p); } }; } // namespace template <int N, hkMathIoMode A, hkMathRoundingMode R> HK_FORCE_INLINE void hkVector4d::store(hkFloat16* p) const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_storeF16<N,A,R>::apply(m_quad, p); } template <int N, hkMathIoMode A> HK_FORCE_INLINE void hkVector4d::store(hkFloat16* p) const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_storeF16<N,A,HK_ROUND_DEFAULT>::apply(m_quad, p); } template <int N> HK_FORCE_INLINE void hkVector4d::store(hkFloat16* p) const { HK_VECTOR4d_UNSUPPORTED_LENGTH_CHECK; hkVector4_AdvancedInterface::unrolld_storeF16<N,HK_IO_SIMD_ALIGNED,HK_ROUND_DEFAULT>::apply(m_quad, p); } /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20130718) * * Confidential Information of Havok. (C) Copyright 1999-2013 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok * Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership * rights, and intellectual property rights in the Havok software remain in * Havok and/or its suppliers. * * Use of this software for evaluation purposes is subject to and indicates * acceptance of the End User licence Agreement for this product. A copy of * the license is included with this software and is also available at www.havok.com/tryhavok. * */
41.014148
251
0.711682
aditgoyal19
1d93653231cf943e781ad1604b86d76d83d0a698
1,150
cpp
C++
src/btr/native_io.win.cpp
vector-of-bool/batteries
8be07c729e0461e8e0b50c89c5ac9b90e48452a8
[ "BSL-1.0" ]
2
2021-08-02T15:04:33.000Z
2021-08-10T05:07:46.000Z
src/btr/native_io.win.cpp
vector-of-bool/batteries
8be07c729e0461e8e0b50c89c5ac9b90e48452a8
[ "BSL-1.0" ]
null
null
null
src/btr/native_io.win.cpp
vector-of-bool/batteries
8be07c729e0461e8e0b50c89c5ac9b90e48452a8
[ "BSL-1.0" ]
null
null
null
#include "./native_io.hpp" #include "./syserror.hpp" using namespace btr; #if _WIN32 #include <windows.h> void win32_handle_traits::close(HANDLE h) noexcept { ::CloseHandle(h); } std::size_t win32_handle_traits::write(HANDLE h, const_buffer buf) { neo_assert(expects, h != null_handle, "Attempted to write data to a closed HANDLE", std::string_view(buf), buf.size()); DWORD nwritten = 0; auto okay = ::WriteFile(h, buf.data(), static_cast<DWORD>(buf.size()), &nwritten, nullptr); if (!okay) { throw_current_error("::WriteFile() failed"); } return static_cast<std::size_t>(nwritten); } std::size_t win32_handle_traits::read(HANDLE h, mutable_buffer buf) { neo_assert(expects, h != null_handle, "Attempted to read data from a closed HANDLE", buf.size()); DWORD nread = 0; auto okay = ::ReadFile(h, buf.data(), static_cast<DWORD>(buf.size()), &nread, nullptr); if (!okay) { throw_current_error("::ReadFile() failed"); } return static_cast<std::size_t>(nread); } #endif
28.04878
100
0.607826
vector-of-bool
1d9a3bf76307b2b683cd7bfa51518af752ce649d
3,354
cpp
C++
components/button/xitembutton.cpp
pavelvasev/Xclu
6cdbb7040c057b3c1107f7a039acf0a72046ed83
[ "MIT" ]
null
null
null
components/button/xitembutton.cpp
pavelvasev/Xclu
6cdbb7040c057b3c1107f7a039acf0a72046ed83
[ "MIT" ]
null
null
null
components/button/xitembutton.cpp
pavelvasev/Xclu
6cdbb7040c057b3c1107f7a039acf0a72046ed83
[ "MIT" ]
null
null
null
#include "xitembutton.h" #include "xguibutton.h" #include "incl_cpp.h" #include "moduleinterface.h" #include "registrarxitem.h" #include "module.h" REGISTER_XITEM(XItemButton, button) //--------------------------------------------------------------------- //in button Execute execute XItemButton::XItemButton(ModuleInterface *interf, const XItemPreDescription &pre_description) : XItem_<int>(interf, pre_description) { //Button не может быть out xc_assert(pre_description.qualifier != XQualifierOut, "button can't have 'out' qualifier, '" + pre_description.title + "'"); //page Main_page name_ = pre_description.line_to_parse; //reset value, in opposite case can be "random" value reset_value(); } //--------------------------------------------------------------------- //графический интерфейс XGui *XItemButton::create_gui(XGuiPageBuilder &page_builder) { gui__ = new XGuiButton(page_builder, this); return gui__; } //--------------------------------------------------------------------- //вызывается из gui при нажатии кнопки void XItemButton::callback_button_pressed() { //Проверка, что parent не нулевой - возможно, в конструкторе это не очень хорошо, но все же лучше проверить:) xc_assert(interf(), "Internal error in XItemButton::callback_button_pressed, empty 'interf()' at '" + name() + "'"); //hit_value() will be called from there interf()->callback_button_pressed(name()); } //--------------------------------------------------------------------- //значение - нажатие считывается один раз, затем стирается int XItemButton::value_int() { int res = value_read().data(); reset_value(); return res; } //--------------------------------------------------------------------- //Function for setting value using link void XItemButton::set_value_from_link(XLinkResolved *linkres) { xc_assert(linkres, "set_value_from_link for `" + name() + "` - linkres is nullptr"); Module *mod = linkres->module_ptr(); set_value_int(mod->geti(linkres)); } //--------------------------------------------------------------------- void XItemButton::hit_value() { //set that button was pressed if (value_read().data() == 0) { value_write().data() = 1; } } //--------------------------------------------------------------------- void XItemButton::reset_value() { //reset that button was pressed if (value_read().data() != 0) { value_write().data() = 0; } } //--------------------------------------------------------------------- //получение значения из gui void XItemButton::gui_to_var_internal() { if (((XGuiButton *)gui__)->value()) { hit_value(); } } //--------------------------------------------------------------------- //установка значения в gui void XItemButton::var_to_gui_internal() { //gui_->set_value(value()); } //--------------------------------------------------------------------- //C++ void XItemButton::export_interface(QStringList &file) { export_interface_template(file, false, true, "Button ", true, "int ", "i", "geti", "seti", false, false, false); //export button name file.append(QString("QString button_%1() { return \"%1\"; }").arg(name())); file.append(""); } //---------------------------------------------------------------------
33.207921
128
0.514311
pavelvasev
1d9b166eeec7f68c1980cd5ca87ef948fb1af0b4
13,570
cpp
C++
Co-Simulation/Sumo/sumo-1.7.0/src/router/ROVehicle.cpp
uruzahe/carla
940c2ab23cce1eda1ef66de35f66b42d40865fb1
[ "MIT" ]
null
null
null
Co-Simulation/Sumo/sumo-1.7.0/src/router/ROVehicle.cpp
uruzahe/carla
940c2ab23cce1eda1ef66de35f66b42d40865fb1
[ "MIT" ]
null
null
null
Co-Simulation/Sumo/sumo-1.7.0/src/router/ROVehicle.cpp
uruzahe/carla
940c2ab23cce1eda1ef66de35f66b42d40865fb1
[ "MIT" ]
null
null
null
/****************************************************************************/ // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo // Copyright (C) 2002-2020 German Aerospace Center (DLR) and others. // This program and the accompanying materials are made available under the // terms of the Eclipse Public License 2.0 which is available at // https://www.eclipse.org/legal/epl-2.0/ // This Source Code may also be made available under the following Secondary // Licenses when the conditions for such availability set forth in the Eclipse // Public License 2.0 are satisfied: GNU General Public License, version 2 // or later which is available at // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later /****************************************************************************/ /// @file ROVehicle.cpp /// @author Daniel Krajzewicz /// @author Axel Wegener /// @author Michael Behrisch /// @author Jakob Erdmann /// @date Sept 2002 /// // A vehicle as used by router /****************************************************************************/ #include <config.h> #include <string> #include <iostream> #include <utils/common/StringUtils.h> #include <utils/common/ToString.h> #include <utils/common/MsgHandler.h> #include <utils/geom/GeoConvHelper.h> #include <utils/vehicle/SUMOVTypeParameter.h> #include <utils/options/OptionsCont.h> #include <utils/iodevices/OutputDevice.h> #include "RORouteDef.h" #include "RORoute.h" #include "ROHelper.h" #include "RONet.h" #include "ROLane.h" #include "ROVehicle.h" // =========================================================================== // method definitions // =========================================================================== ROVehicle::ROVehicle(const SUMOVehicleParameter& pars, RORouteDef* route, const SUMOVTypeParameter* type, const RONet* net, MsgHandler* errorHandler) : RORoutable(pars, type), myRoute(route) { getParameter().stops.clear(); if (route != nullptr && route->getFirstRoute() != nullptr) { for (std::vector<SUMOVehicleParameter::Stop>::const_iterator s = route->getFirstRoute()->getStops().begin(); s != route->getFirstRoute()->getStops().end(); ++s) { addStop(*s, net, errorHandler); } } for (std::vector<SUMOVehicleParameter::Stop>::const_iterator s = pars.stops.begin(); s != pars.stops.end(); ++s) { addStop(*s, net, errorHandler); } if (pars.via.size() != 0) { // via takes precedence over stop edges // XXX check for inconsistencies #2275 myStopEdges.clear(); for (std::vector<std::string>::const_iterator it = pars.via.begin(); it != pars.via.end(); ++it) { assert(net->getEdge(*it) != 0); myStopEdges.push_back(net->getEdge(*it)); } } } void ROVehicle::addStop(const SUMOVehicleParameter::Stop& stopPar, const RONet* net, MsgHandler* errorHandler) { const ROEdge* stopEdge = net->getEdgeForLaneID(stopPar.lane); assert(stopEdge != 0); // was checked when parsing the stop if (stopEdge->prohibits(this)) { if (errorHandler != nullptr) { errorHandler->inform("Stop edge '" + stopEdge->getID() + "' does not allow vehicle '" + getID() + "'."); } return; } // where to insert the stop std::vector<SUMOVehicleParameter::Stop>::iterator iter = getParameter().stops.begin(); ConstROEdgeVector::iterator edgeIter = myStopEdges.begin(); if (stopPar.index == STOP_INDEX_END || stopPar.index >= static_cast<int>(getParameter().stops.size())) { if (getParameter().stops.size() > 0) { iter = getParameter().stops.end(); edgeIter = myStopEdges.end(); } } else { if (stopPar.index == STOP_INDEX_FIT) { const ConstROEdgeVector edges = myRoute->getFirstRoute()->getEdgeVector(); ConstROEdgeVector::const_iterator stopEdgeIt = std::find(edges.begin(), edges.end(), stopEdge); if (stopEdgeIt == edges.end()) { iter = getParameter().stops.end(); edgeIter = myStopEdges.end(); } else { while (iter != getParameter().stops.end()) { if (edgeIter > stopEdgeIt || (edgeIter == stopEdgeIt && iter->endPos >= stopPar.endPos)) { break; } ++iter; ++edgeIter; } } } else { iter += stopPar.index; edgeIter += stopPar.index; } } getParameter().stops.insert(iter, stopPar); myStopEdges.insert(edgeIter, stopEdge); } ROVehicle::~ROVehicle() {} const ROEdge* ROVehicle:: getDepartEdge() const { return myRoute->getFirstRoute()->getFirst(); } void ROVehicle::computeRoute(const RORouterProvider& provider, const bool removeLoops, MsgHandler* errorHandler) { SUMOAbstractRouter<ROEdge, ROVehicle>& router = provider.getVehicleRouter(getVClass()); std::string noRouteMsg = "The vehicle '" + getID() + "' has no valid route."; RORouteDef* const routeDef = getRouteDefinition(); // check if the route definition is valid if (routeDef == nullptr) { errorHandler->inform(noRouteMsg); myRoutingSuccess = false; return; } RORoute* current = routeDef->buildCurrentRoute(router, getDepartureTime(), *this); if (current == nullptr || current->size() == 0) { delete current; if (current == nullptr || !routeDef->discardSilent()) { errorHandler->inform(noRouteMsg); } myRoutingSuccess = false; return; } // check whether we have to evaluate the route for not containing loops if (removeLoops) { const ROEdge* requiredStart = (getParameter().departPosProcedure == DepartPosDefinition::GIVEN || getParameter().departLaneProcedure == DepartLaneDefinition::GIVEN ? current->getEdgeVector().front() : 0); const ROEdge* requiredEnd = (getParameter().arrivalPosProcedure == ArrivalPosDefinition::GIVEN || getParameter().arrivalLaneProcedure == ArrivalLaneDefinition::GIVEN ? current->getEdgeVector().back() : 0); current->recheckForLoops(getMandatoryEdges(requiredStart, requiredEnd)); // check whether the route is still valid if (current->size() == 0) { delete current; errorHandler->inform(noRouteMsg + " (after removing loops)"); myRoutingSuccess = false; return; } } // add built route routeDef->addAlternative(router, this, current, getDepartureTime()); myRoutingSuccess = true; } ConstROEdgeVector ROVehicle::getMandatoryEdges(const ROEdge* requiredStart, const ROEdge* requiredEnd) const { ConstROEdgeVector mandatory; if (requiredStart) { mandatory.push_back(requiredStart); } for (const ROEdge* e : getStopEdges()) { if (e->isInternal()) { // the edges before and after the internal edge are mandatory const ROEdge* before = e->getNormalBefore(); const ROEdge* after = e->getNormalAfter(); if (mandatory.size() == 0 || after != mandatory.back()) { mandatory.push_back(before); mandatory.push_back(after); } } else { if (mandatory.size() == 0 || e != mandatory.back()) { mandatory.push_back(e); } } } if (requiredEnd) { if (mandatory.size() < 2 || mandatory.back() != requiredEnd) { mandatory.push_back(requiredEnd); } } return mandatory; } void ROVehicle::saveAsXML(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options) const { if (typeos != nullptr && getType() != nullptr && !getType()->saved) { getType()->write(*typeos); getType()->saved = true; } if (getType() != nullptr && !getType()->saved) { getType()->write(os); getType()->saved = asAlternatives; } const bool writeTrip = options.exists("write-trips") && options.getBool("write-trips"); const bool writeGeoTrip = writeTrip && options.getBool("write-trips.geo"); const bool writeJunctions = writeTrip && options.getBool("write-trips.junctions"); // write the vehicle (new style, with included routes) getParameter().write(os, options, writeTrip ? SUMO_TAG_TRIP : SUMO_TAG_VEHICLE); // save the route if (writeTrip) { const ConstROEdgeVector edges = myRoute->getFirstRoute()->getEdgeVector(); const ROEdge* from = nullptr; const ROEdge* to = nullptr; if (edges.size() > 0) { if (edges.front()->isTazConnector()) { if (edges.size() > 1) { from = edges[1]; if (from->isTazConnector() && writeJunctions && edges.front()->getSuccessors().size() > 0) { // routing was skipped from = edges.front()->getSuccessors(getVClass()).front(); } } } else { from = edges[0]; } if (edges.back()->isTazConnector()) { if (edges.size() > 1) { to = edges[edges.size() - 2]; if (to->isTazConnector() && writeJunctions && edges.back()->getPredecessors().size() > 0) { // routing was skipped to = edges.back()->getPredecessors().front(); } } } else { to = edges[edges.size() - 1]; } } if (from != nullptr) { if (writeGeoTrip) { Position fromPos = from->getLanes()[0]->getShape().positionAtOffset2D(0); if (GeoConvHelper::getFinal().usingGeoProjection()) { os.setPrecision(gPrecisionGeo); GeoConvHelper::getFinal().cartesian2geo(fromPos); os.writeAttr(SUMO_ATTR_FROMLONLAT, fromPos); os.setPrecision(gPrecision); } else { os.writeAttr(SUMO_ATTR_FROMXY, fromPos); } } else if (writeJunctions) { os.writeAttr(SUMO_ATTR_FROMJUNCTION, from->getFromJunction()->getID()); } else { os.writeAttr(SUMO_ATTR_FROM, from->getID()); } } if (to != nullptr) { if (writeGeoTrip) { Position toPos = to->getLanes()[0]->getShape().positionAtOffset2D(to->getLanes()[0]->getShape().length2D()); if (GeoConvHelper::getFinal().usingGeoProjection()) { os.setPrecision(gPrecisionGeo); GeoConvHelper::getFinal().cartesian2geo(toPos); os.writeAttr(SUMO_ATTR_TOLONLAT, toPos); os.setPrecision(gPrecision); } else { os.writeAttr(SUMO_ATTR_TOXY, toPos); } } else if (writeJunctions) { os.writeAttr(SUMO_ATTR_TOJUNCTION, to->getToJunction()->getID()); } else { os.writeAttr(SUMO_ATTR_TO, to->getID()); } } if (getParameter().via.size() > 0) { std::vector<std::string> viaOut; SumoXMLAttr viaAttr = (writeGeoTrip ? (GeoConvHelper::getFinal().usingGeoProjection() ? SUMO_ATTR_VIALONLAT : SUMO_ATTR_VIAXY) : (writeJunctions ? SUMO_ATTR_VIAJUNCTIONS : SUMO_ATTR_VIA)); for (const std::string& viaID : getParameter().via) { const ROEdge* viaEdge = RONet::getInstance()->getEdge(viaID); if (viaEdge->isTazConnector()) { if (viaEdge->getPredecessors().size() == 0) { continue; } // XXX used edge that was used in route viaEdge = viaEdge->getPredecessors().front(); } assert(viaEdge != nullptr); if (writeGeoTrip) { Position viaPos = viaEdge->getLanes()[0]->getShape().positionAtOffset2D(viaEdge->getLanes()[0]->getShape().length2D() / 2); if (GeoConvHelper::getFinal().usingGeoProjection()) { GeoConvHelper::getFinal().cartesian2geo(viaPos); viaOut.push_back(toString(viaPos, gPrecisionGeo)); } else { viaOut.push_back(toString(viaPos, gPrecision)); } } else if (writeJunctions) { viaOut.push_back(viaEdge->getToJunction()->getID()); } else { viaOut.push_back(viaEdge->getID()); } } os.writeAttr(viaAttr, viaOut); } } else { myRoute->writeXMLDefinition(os, this, asAlternatives, options.getBool("exit-times")); } for (std::vector<SUMOVehicleParameter::Stop>::const_iterator stop = getParameter().stops.begin(); stop != getParameter().stops.end(); ++stop) { stop->write(os); } getParameter().writeParams(os); os.closeTag(); } /****************************************************************************/
42.672956
170
0.551805
uruzahe
1d9b2651d10954b39298ed68ee204fdbfeef52cd
283
hpp
C++
include/GraFX/api/basic_observers/basic/AutosubscribableObserver.hpp
VladimirSuvorov1996/GraFX
60f543c5283976a624f8dd460dbf515f2d06df5e
[ "MIT" ]
null
null
null
include/GraFX/api/basic_observers/basic/AutosubscribableObserver.hpp
VladimirSuvorov1996/GraFX
60f543c5283976a624f8dd460dbf515f2d06df5e
[ "MIT" ]
null
null
null
include/GraFX/api/basic_observers/basic/AutosubscribableObserver.hpp
VladimirSuvorov1996/GraFX
60f543c5283976a624f8dd460dbf515f2d06df5e
[ "MIT" ]
null
null
null
#pragma once #include "EventObserver.hpp" namespace graFX::input { template<typename R, typename...As> class AutosubscribableObserver : public EventObserver<R, As...>{ public: AutosubscribableObserver() { EventObserver<R, As...>::base_t::enabled(true); } }; }
23.583333
51
0.681979
VladimirSuvorov1996
1d9ce0d0d99350c923c6778271c5a0622021d9bb
316
cpp
C++
Camp_1-2562/Proble 60/35_MaxSub.cpp
MasterIceZ/POSN_BUU
56e176fb843d7ddcee0cf4acf2bb141576c260cf
[ "MIT" ]
null
null
null
Camp_1-2562/Proble 60/35_MaxSub.cpp
MasterIceZ/POSN_BUU
56e176fb843d7ddcee0cf4acf2bb141576c260cf
[ "MIT" ]
null
null
null
Camp_1-2562/Proble 60/35_MaxSub.cpp
MasterIceZ/POSN_BUU
56e176fb843d7ddcee0cf4acf2bb141576c260cf
[ "MIT" ]
null
null
null
#include<bits/stdc++.h> using namespace std; int main () { int n,i,st=1,ansst=1,ansen,Max = -1e9,num,sum=0; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d",&num); sum+=num; if(sum> Max) Max = sum,ansst = st,ansen=i; if(sum<0) sum = 0,st = i+1; } printf("%d %d\n%d\n",ansst,ansen,Max); return 0; }
17.555556
49
0.550633
MasterIceZ
1d9ffce04a5c8cd36a1db332d58abdbc415a35c2
3,340
hpp
C++
src/base/parameter/RealVar.hpp
saichikine/GMAT
80bde040e12946a61dae90d9fc3538f16df34190
[ "Apache-2.0" ]
null
null
null
src/base/parameter/RealVar.hpp
saichikine/GMAT
80bde040e12946a61dae90d9fc3538f16df34190
[ "Apache-2.0" ]
null
null
null
src/base/parameter/RealVar.hpp
saichikine/GMAT
80bde040e12946a61dae90d9fc3538f16df34190
[ "Apache-2.0" ]
1
2021-12-05T05:40:15.000Z
2021-12-05T05:40:15.000Z
//$Id$ //------------------------------------------------------------------------------ // RealVar //------------------------------------------------------------------------------ // GMAT: General Mission Analysis Tool // // Copyright (c) 2002 - 2018 United States Government as represented by the // Administrator of the National Aeronautics and Space Administration. // All Other Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // You may not use this file except in compliance with the License. // You may obtain a copy of the License at: // http://www.apache.org/licenses/LICENSE-2.0. // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either // express or implied. See the License for the specific language // governing permissions and limitations under the License. // // Developed jointly by NASA/GSFC and Thinking Systems, Inc. under contract // number S-67573-G // // Author: Linda Jun // Created: 2004/01/08 // /** * Declares base class of parameters returning Real. */ //------------------------------------------------------------------------------ #ifndef RealVar_hpp #define RealVar_hpp #include "gmatdefs.hpp" #include "Parameter.hpp" class GMAT_API RealVar : public Parameter { public: RealVar(const std::string &name = "", const std::string &valStr = "", const std::string &typeStr = "RealVar", GmatParam::ParameterKey key = GmatParam::USER_PARAM, GmatBase *obj = NULL, const std::string &desc = "", const std::string &unit = "", GmatParam::DepObject depObj = GmatParam::NO_DEP, UnsignedInt ownerType = Gmat::UNKNOWN_OBJECT, bool isTimeParam = false, bool isSettable = false, bool isPlottable = true, bool isReportable = true, UnsignedInt ownedObjType = Gmat::UNKNOWN_OBJECT); RealVar(const RealVar &copy); RealVar& operator= (const RealVar& right); virtual ~RealVar(); bool operator==(const RealVar &right) const; bool operator!=(const RealVar &right) const; // methods inherited from Parameter virtual bool Initialize(); virtual std::string ToString(); virtual Real GetReal() const; virtual void SetReal(Real val); virtual Integer GetParameterID(const std::string &str) const; virtual Real GetRealParameter(const Integer id) const; virtual Real GetRealParameter(const std::string &label) const; virtual Real SetRealParameter(const Integer id, const Real value); virtual Real SetRealParameter(const std::string &label, const Real value); virtual bool SetStringParameter(const Integer id, const std::string &value); virtual bool SetStringParameter(const std::string &label, const std::string &value); protected: enum { VALUE = ParameterParamCount, RealVarParamCount }; static const Gmat::ParameterType PARAMETER_TYPE[RealVarParamCount - ParameterParamCount]; static const std::string PARAMETER_TEXT[RealVarParamCount - ParameterParamCount]; bool mValueSet; bool mIsNumber; Real mRealValue; private: }; #endif // RealVar_hpp
34.43299
80
0.637126
saichikine
1da04d8e1d02ce608af36d7b8aedeb726c1f3a28
6,103
cpp
C++
src/CVPRTestSpeed.cpp
warp1337/nmpt
0a6ea8140f9053c5cff19375ce179427f8d24fe3
[ "BSD-3-Clause" ]
5
2017-03-01T15:57:50.000Z
2022-01-18T08:47:46.000Z
src/CVPRTestSpeed.cpp
warp1337/nmpt
0a6ea8140f9053c5cff19375ce179427f8d24fe3
[ "BSD-3-Clause" ]
null
null
null
src/CVPRTestSpeed.cpp
warp1337/nmpt
0a6ea8140f9053c5cff19375ce179427f8d24fe3
[ "BSD-3-Clause" ]
1
2020-05-08T04:58:59.000Z
2020-05-08T04:58:59.000Z
/** * \ingroup ExamplesGroup * \page cvprspeed_page CVPRTestSpeed * \brief Reproduce the speed results from Butko and Movellan, CVPR 09 on your * own machine. * * CVPRTestSpeed * * To Run: <br> * (1) Uncompress and Expand the included GENKI R2009a dataset. Make sure the * GENKI-R2009a folder is in the data directory: <br> * <tt> \>\> tar -xzvf data/GENKI-R2009a.tgz -C data/<br> </tt> *<br> * (2) Run the program.<br> * <tt> \>\> bin/CVPRTestSpeed.</tt> * * \b Description: * * This example program is contained in "CVPRTestSpeed.cpp". Following the * proecdure in Butko and Movellan, CVPR 2009, it calculates the speed and * accuracy of plain Viola-Jones search, and of MIPOMDP-wrapped Viola-Jones * search on the GENKI-SZSL subset of the GENKI data set. The results are * computed using 7-Fold cross-validation. The included Multionomial observation * models (data/MIPOMDPData-21x21-4Scales-Holdout[0-6].txt) were compted using * 3000/3500 of the GENKI-SZSL images. Each file has a different 500 images held * out. This program evaluates each image using the model that was created when * this image was held out -- i.e. it was not used to fit the model parameters. * * After each image is searched, several statistics of performance for the * current image are printed, separated by commas: * * \li MIPOMDP Search Time * \li VJ Search Time * \li MIPOMDP Distance from Most Likely Face Location to True Face Location * \li VJ Distance from Most Likely Face Location to True Face Location * \li Image Width * \li Image Height * \li Estimated Probability that Face is really at Face Location * \li Posterior Belief Distribution Negative Entropy. * * Then, statistics of average performance are printed. * * MIPOMDP is an extension of the IPOMDP Infomax Model of Eye-movment in Butko * and Movellan, 2008; Najemnik and Geisler, 2005 (see \ref bib_sec). * **/ using namespace std; #include "ImageDataSet.h" #include "MIPOMDP.h" #include "BlockTimer.h" #include <stdio.h> #include <iostream> #include <string> #include <opencv2/opencv.hpp> int main(int argc, char** argv) { const char files[] = "data/GENKI-SZSL_files.txt"; const char labels[] = "data/GENKI-R2009a/Subsets/GENKI-SZSL/GENKI-SZSL_labels.txt"; CvSize gridSize = cvSize(21,21); int numScales =4; ImageDataSet* train = ImageDataSet::loadFromFile(files, labels); cout << "Loaded dataset of " << train->getNumEntries() << " files, with "; cout << train->numLabelsPerImage() << " labels. " << endl; BlockTimer timer; double totalSearchTime=0, totalSearchGridErr=0, totalHiResTime=0; double totalHiResGridErr=0; int numImages = 0; long long numPixels = 0; for (int i = 0; i < 7; i++) { ImageDataSet* test = train->split(0, 499); char pomdpfile[5000]; snprintf(pomdpfile, 5000, "data/MIPOMDPData-%dx%d-%dScales-HoldoutSet%d.txt", gridSize.width, gridSize.height, numScales, i); MIPOMDP* pomdp = MIPOMDP::loadFromFile(pomdpfile); pomdp->setGeneratePreview(0); cout << "Holdout Set " << i << "; Loaded File " << pomdpfile << endl; for (int j = 0; j < test->getNumEntries(); j++) { double stopconf = 0.125; string imageFile = test->getFileName(j); vector<double> imageLabels = test->getFileLabels(j); CvPoint faceLocation = cvPoint(imageLabels[0], imageLabels[1]); IplImage* current_frame = cvLoadImage(imageFile.c_str(), CV_LOAD_IMAGE_GRAYSCALE ); pomdp->changeInputImageSize(cvSize(current_frame->width, current_frame->height)); CvPoint faceGridLocation = pomdp->gridPointForPixel(faceLocation); timer.blockStart(1); CvPoint searchPoint = pomdp->searchFrameUntilConfident(current_frame , stopconf); timer.blockStop(1); double searchProb = pomdp->getProb(); double searchRew = pomdp->getReward(); CvPoint searchGridPoint = pomdp->gridPointForPixel(searchPoint); pomdp->resetPrior(); timer.blockStart(2); CvPoint hiresPoint = pomdp->searchHighResImage(current_frame); timer.blockStop(2); CvPoint hiresGridPoint = pomdp->gridPointForPixel(hiresPoint); pomdp->resetPrior(); double distGridSearch = sqrt((searchGridPoint.x-faceGridLocation.x)* (searchGridPoint.x-faceGridLocation.x)+ (searchGridPoint.y-faceGridLocation.y)* (searchGridPoint.y-faceGridLocation.y) ); double distGridHires = sqrt((hiresGridPoint.x-faceGridLocation.x)* (hiresGridPoint.x-faceGridLocation.x)+ (hiresGridPoint.y-faceGridLocation.y)* (hiresGridPoint.y-faceGridLocation.y)); double searchTime = timer.getTotTime(1); double hiresTime = timer.getTotTime(2); totalSearchTime = totalSearchTime+searchTime; totalSearchGridErr = totalSearchGridErr+distGridSearch; totalHiResTime = totalHiResTime+hiresTime; totalHiResGridErr = totalHiResGridErr+distGridHires; numImages++; numPixels = numPixels + current_frame->width*current_frame->height; cout << searchTime << ", " << hiresTime << ", " << distGridSearch ; cout << ", " << distGridHires << ", " << current_frame->width ; cout << ", " << current_frame->height << ", " << searchProb << ", "; cout << searchRew << endl; cout << "Mean MIPOMDP Search Time: " ; cout << totalSearchTime / numImages << " Seconds" << endl; cout << "Mean VJ Search Time : " ; cout << totalHiResTime / numImages << " Seconds" << endl; cout << "Mean MIPOMDP Search Rate: " ; cout << totalSearchTime*1000000/numPixels <<" ms / 1000 px" << endl; cout << "Mean VJ Search Rate : " ; cout << totalHiResTime*1000000/numPixels << " ms / 1000 px" << endl; cout << "Mean MIPOMDP Grid Error : " ; cout << totalSearchGridErr / numImages << endl; cout << "Mean VJ Grid Error : " ; cout << totalHiResGridErr / numImages << endl; cvReleaseImage(&current_frame); timer.blockReset(1); timer.blockReset(2); } delete(test); delete(pomdp); } }
36.54491
85
0.676389
warp1337
1da274dff69789834dc0d773bd2b2bf74920fbd2
5,868
cc
C++
src/grin/CommonGrin.cc
jheleniak/btcpool
28ad61f60d529c203db2b58379d851ba20697eae
[ "MIT" ]
null
null
null
src/grin/CommonGrin.cc
jheleniak/btcpool
28ad61f60d529c203db2b58379d851ba20697eae
[ "MIT" ]
null
null
null
src/grin/CommonGrin.cc
jheleniak/btcpool
28ad61f60d529c203db2b58379d851ba20697eae
[ "MIT" ]
1
2020-03-25T13:53:33.000Z
2020-03-25T13:53:33.000Z
/* The MIT License (MIT) Copyright (c) [2016] [BTC.COM] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "CommonGrin.h" #include "cuckoo/cuckaroo.h" #include "cuckoo/cuckarood.h" #include "cuckoo/cuckaroom.h" #include "cuckoo/cuckatoo.h" #include "cuckoo/siphash.h" #include "libblake2/blake2.h" #include <boost/multiprecision/cpp_int.hpp> #include <limits> #include <Utils.h> static const uint8_t BASE_EDGE_BITS = 24; static const uint8_t DEFAULT_MIN_EDGE_BITS = 31; static const uint8_t SECOND_POW_EDGE_BITS = 29; static const uint64_t MAX_DIFFICUTY = std::numeric_limits<uint64_t>::max(); static const uint64_t BLOCK_TIME_SEC = 60; static const uint64_t HOUR_HEIGHT = 3600 / BLOCK_TIME_SEC; static const uint64_t DAY_HEIGHT = 24 * HOUR_HEIGHT; static const uint64_t WEEK_HEIGHT = 7 * DAY_HEIGHT; static const uint64_t YEAR_HEIGHT = 52 * WEEK_HEIGHT; static const uint64_t GRIN_BASE = 1000000000; static const uint64_t REWARD = BLOCK_TIME_SEC * GRIN_BASE; static uint64_t PowDifficultyGrinScaled(uint64_t hash, uint32_t secondaryScaling) { boost::multiprecision::uint128_t x = secondaryScaling; x <<= 64; x /= hash; return x > MAX_DIFFICUTY ? MAX_DIFFICUTY : static_cast<uint64_t>(x); } // verify that edges are ascending and form a cycle in header-generated graph bool VerifyPowGrinPrimary( const std::vector<uint64_t> &edges, siphash_keys &keys, uint32_t edgeBits) { return verify_cuckatoo(edges, keys, edgeBits); } // verify that edges are ascending and form a cycle in header-generated graph bool VerifyPowGrinSecondary( const std::vector<uint64_t> &edges, siphash_keys &keys, uint32_t edgeBits, uint16_t version) { switch (version) { case 3: return verify_cuckaroom(edges, keys, edgeBits); case 2: return verify_cuckarood(edges, keys, edgeBits); default: return verify_cuckaroo(edges, keys, edgeBits); } } bool VerifyPowGrin( const PreProofGrin &preProof, uint32_t edgeBits, const std::vector<uint64_t> &proofs) { if (edgeBits != SECOND_POW_EDGE_BITS && edgeBits < DEFAULT_MIN_EDGE_BITS) return false; siphash_keys siphashKeys; char preProofKeys[32]; blake2b( preProofKeys, sizeof(preProofKeys), &preProof, sizeof(preProof), 0, 0); siphashKeys.setkeys(preProofKeys); return edgeBits == SECOND_POW_EDGE_BITS ? VerifyPowGrinSecondary( proofs, siphashKeys, edgeBits, preProof.prePow.version.value()) : VerifyPowGrinPrimary(proofs, siphashKeys, edgeBits); } uint256 PowHashGrin(uint32_t edgeBits, const std::vector<uint64_t> &proofs) { // Compress the proofs to a bit vector std::vector<uint8_t> proofBits((proofs.size() * edgeBits + 7) / 8, 0); uint64_t edgeMask = (static_cast<uint64_t>(1) << edgeBits) - 1; size_t i = 0; for (uint64_t proof : proofs) { proof &= edgeMask; for (uint32_t j = 0; j < edgeBits; ++j) { if (0x1 & (proof >> j)) { uint32_t position = i * edgeBits + j; proofBits[position / 8] |= (1 << (position % 8)); } } ++i; } // Generate the blake2b hash uint256 hash; blake2b(hash.begin(), sizeof(hash), proofBits.data(), proofBits.size(), 0, 0); return hash; } uint32_t GraphWeightGrin(uint64_t height, uint32_t edgeBits) { uint64_t xprEdgeBits = edgeBits; auto bitsOverMin = edgeBits <= DEFAULT_MIN_EDGE_BITS ? 0 : edgeBits - DEFAULT_MIN_EDGE_BITS; auto expiryHeight = (1 << bitsOverMin) * YEAR_HEIGHT; if (edgeBits < 32 && height >= expiryHeight) { auto weeks = 1 + (height - expiryHeight) / WEEK_HEIGHT; xprEdgeBits = xprEdgeBits > weeks ? xprEdgeBits - weeks : 0; } return ((2 << (edgeBits - BASE_EDGE_BITS)) * xprEdgeBits); } uint32_t PowScalingGrin(uint64_t height, uint32_t edgeBits, uint32_t secondaryScaling) { return edgeBits == SECOND_POW_EDGE_BITS ? secondaryScaling : GraphWeightGrin(height, edgeBits); } uint64_t PowDifficultyGrin( uint64_t height, uint32_t edgeBits, uint32_t secondaryScaling, const std::vector<uint64_t> &proofs) { // Compress the proofs to a bit vector std::vector<uint8_t> proofBits((proofs.size() * edgeBits + 7) / 8, 0); uint64_t edgeMask = (static_cast<uint64_t>(1) << edgeBits) - 1; size_t i = 0; for (uint64_t proof : proofs) { proof &= edgeMask; for (uint32_t j = 0; j < edgeBits; ++j) { if (0x1 & (proof >> j)) { uint32_t position = i * edgeBits + j; proofBits[position / 8] |= (1 << (position % 8)); } } ++i; } // Generate the blake2b hash boost::endian::big_uint64_buf_t hash[4]; blake2b(hash, sizeof(hash), proofBits.data(), proofBits.size(), 0, 0); // Scale the difficulty return PowDifficultyGrinScaled( hash[0].value(), PowScalingGrin(height, edgeBits, secondaryScaling)); } uint64_t GetBlockRewardGrin(uint64_t height) { return REWARD; }
33.724138
80
0.712849
jheleniak
1da505713dbef44cd67d486a606fb3c7f5efc994
1,651
cpp
C++
tcp_client.cpp
devmentality/bachelors_thesis
11fcd78b2be9b6d50474950cac497a5b2c7ee3dd
[ "MIT" ]
null
null
null
tcp_client.cpp
devmentality/bachelors_thesis
11fcd78b2be9b6d50474950cac497a5b2c7ee3dd
[ "MIT" ]
null
null
null
tcp_client.cpp
devmentality/bachelors_thesis
11fcd78b2be9b6d50474950cac497a5b2c7ee3dd
[ "MIT" ]
null
null
null
#include "tcp_client.h" #include <iostream> #include <string> #include <map> #include <vector> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #include <cstring> #include <netdb.h> #include "version_vector.h" #include "ron/op.hpp" #include "ron/ron-streams.hpp" #include "socket_io.h" using namespace std; using namespace ron; int Connect(const string& server_ip, int server_port) { struct hostent* host = gethostbyname(server_ip.c_str()); sockaddr_in server_address; bzero((char*)&server_address, sizeof(server_address)); server_address.sin_family = AF_INET; server_address.sin_addr.s_addr = inet_addr(inet_ntoa(*(struct in_addr*)*host->h_addr_list)); server_address.sin_port = htons(server_port); int client_socket = socket(AF_INET, SOCK_STREAM, 0); int status = connect(client_socket, (sockaddr*) &server_address, sizeof(server_address)); if(status < 0) { cout<< "Error connecting to socket"<< endl; return -1; } return client_socket; } void SendCmd(int socket, const string& cmd) { send(socket, cmd.c_str(), cmd.length() + 1, 0); } int64_t FetchOndx(int socket, uint64_t replica_id) { send(socket, &replica_id, sizeof replica_id, 0); int64_t ondx; recv(socket, &ondx, sizeof ondx, 0); return ondx; } void SendOndx(int socket, int64_t ondx) { send(socket, &ondx, sizeof ondx, 0); } void PushChanges( int socket, const map<uint64_t, Version>& version_vector, const vector<Op>& patch ) { SendVersionVector(socket, version_vector); SendPatch(socket, patch); }
23.253521
93
0.684434
devmentality
1da5484cabf0e878b96f6ab521247f08f4227fbe
567,866
cpp
C++
src/main_10300.cpp
RedBrumbler/BeatSaber-Quest-Codegen
73dda50b5a3e51f10d86b766dcaa24b0c6226e25
[ "Unlicense" ]
null
null
null
src/main_10300.cpp
RedBrumbler/BeatSaber-Quest-Codegen
73dda50b5a3e51f10d86b766dcaa24b0c6226e25
[ "Unlicense" ]
null
null
null
src/main_10300.cpp
RedBrumbler/BeatSaber-Quest-Codegen
73dda50b5a3e51f10d86b766dcaa24b0c6226e25
[ "Unlicense" ]
null
null
null
// Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ProBuilder.Poly2Tri.TriangulationUtil #include "UnityEngine/ProBuilder/Poly2Tri/TriangulationUtil.hpp" // Including type: UnityEngine.ProBuilder.Poly2Tri.TriangulationPoint #include "UnityEngine/ProBuilder/Poly2Tri/TriangulationPoint.hpp" // Including type: UnityEngine.ProBuilder.Poly2Tri.Orientation #include "UnityEngine/ProBuilder/Poly2Tri/Orientation.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public System.Double EPSILON double UnityEngine::ProBuilder::Poly2Tri::TriangulationUtil::_get_EPSILON() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::TriangulationUtil::_get_EPSILON"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<double>("UnityEngine.ProBuilder.Poly2Tri", "TriangulationUtil", "EPSILON")); } // Autogenerated static field setter // Set static field: static public System.Double EPSILON void UnityEngine::ProBuilder::Poly2Tri::TriangulationUtil::_set_EPSILON(double value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::TriangulationUtil::_set_EPSILON"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ProBuilder.Poly2Tri", "TriangulationUtil", "EPSILON", value)); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.TriangulationUtil..cctor void UnityEngine::ProBuilder::Poly2Tri::TriangulationUtil::_cctor() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::TriangulationUtil::.cctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ProBuilder.Poly2Tri", "TriangulationUtil", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.TriangulationUtil.SmartIncircle bool UnityEngine::ProBuilder::Poly2Tri::TriangulationUtil::SmartIncircle(::UnityEngine::ProBuilder::Poly2Tri::TriangulationPoint* pa, ::UnityEngine::ProBuilder::Poly2Tri::TriangulationPoint* pb, ::UnityEngine::ProBuilder::Poly2Tri::TriangulationPoint* pc, ::UnityEngine::ProBuilder::Poly2Tri::TriangulationPoint* pd) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::TriangulationUtil::SmartIncircle"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ProBuilder.Poly2Tri", "TriangulationUtil", "SmartIncircle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(pa), ::il2cpp_utils::ExtractType(pb), ::il2cpp_utils::ExtractType(pc), ::il2cpp_utils::ExtractType(pd)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, pa, pb, pc, pd); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.TriangulationUtil.InScanArea bool UnityEngine::ProBuilder::Poly2Tri::TriangulationUtil::InScanArea(::UnityEngine::ProBuilder::Poly2Tri::TriangulationPoint* pa, ::UnityEngine::ProBuilder::Poly2Tri::TriangulationPoint* pb, ::UnityEngine::ProBuilder::Poly2Tri::TriangulationPoint* pc, ::UnityEngine::ProBuilder::Poly2Tri::TriangulationPoint* pd) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::TriangulationUtil::InScanArea"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ProBuilder.Poly2Tri", "TriangulationUtil", "InScanArea", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(pa), ::il2cpp_utils::ExtractType(pb), ::il2cpp_utils::ExtractType(pc), ::il2cpp_utils::ExtractType(pd)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, pa, pb, pc, pd); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.TriangulationUtil.Orient2d ::UnityEngine::ProBuilder::Poly2Tri::Orientation UnityEngine::ProBuilder::Poly2Tri::TriangulationUtil::Orient2d(::UnityEngine::ProBuilder::Poly2Tri::TriangulationPoint* pa, ::UnityEngine::ProBuilder::Poly2Tri::TriangulationPoint* pb, ::UnityEngine::ProBuilder::Poly2Tri::TriangulationPoint* pc) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::TriangulationUtil::Orient2d"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ProBuilder.Poly2Tri", "TriangulationUtil", "Orient2d", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(pa), ::il2cpp_utils::ExtractType(pb), ::il2cpp_utils::ExtractType(pc)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ProBuilder::Poly2Tri::Orientation, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, pa, pb, pc); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3 #include "UnityEngine/ProBuilder/Poly2Tri/FixedBitArray3.hpp" // Including type: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3/UnityEngine.ProBuilder.Poly2Tri.<Enumerate>d__10 #include "UnityEngine/ProBuilder/Poly2Tri/FixedBitArray3_-Enumerate-d__10.hpp" // Including type: System.Collections.Generic.IEnumerator`1 #include "System/Collections/Generic/IEnumerator_1.hpp" // Including type: System.Collections.IEnumerator #include "System/Collections/IEnumerator.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.Boolean _0 bool& UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::dyn__0() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::dyn__0"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_0"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _1 bool& UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::dyn__1() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::dyn__1"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_1"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean _2 bool& UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::dyn__2() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::dyn__2"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_2"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3.get_Item bool UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::get_Item(int index) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::get_Item"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(index)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, index); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3.set_Item void UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::set_Item(int index, bool value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::set_Item"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "set_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(index), ::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, index, value); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3.Clear void UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::Clear() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::Clear"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "Clear", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3.Enumerate ::System::Collections::Generic::IEnumerable_1<bool>* UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::Enumerate() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::Enumerate"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "Enumerate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::IEnumerable_1<bool>*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3.GetEnumerator ::System::Collections::Generic::IEnumerator_1<bool>* UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::IEnumerator_1<bool>*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3.System.Collections.IEnumerable.GetEnumerator ::System::Collections::IEnumerator* UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::System_Collections_IEnumerable_GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::System.Collections.IEnumerable.GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "System.Collections.IEnumerable.GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Collections::IEnumerator*, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3/UnityEngine.ProBuilder.Poly2Tri.<Enumerate>d__10 #include "UnityEngine/ProBuilder/Poly2Tri/FixedBitArray3_-Enumerate-d__10.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Int32 <>1__state int& UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::dyn_$$1__state() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::dyn_$$1__state"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>1__state"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean <>2__current bool& UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::dyn_$$2__current() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::dyn_$$2__current"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>2__current"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 <>l__initialThreadId int& UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::dyn_$$l__initialThreadId() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::dyn_$$l__initialThreadId"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>l__initialThreadId"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3 <>4__this ::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3& UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::dyn_$$4__this() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::dyn_$$4__this"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset; return *reinterpret_cast<::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3 <>3__<>4__this ::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3& UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::dyn_$$3__$$4__this() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::dyn_$$3__$$4__this"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>3__<>4__this"))->offset; return *reinterpret_cast<::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 <i>5__2 int& UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::dyn_$i$5__2() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::dyn_$i$5__2"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<i>5__2"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3/UnityEngine.ProBuilder.Poly2Tri.<Enumerate>d__10.System.Collections.Generic.IEnumerator<System.Boolean>.get_Current bool UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::System_Collections_Generic_IEnumerator$System_Boolean$_get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::System.Collections.Generic.IEnumerator<System.Boolean>.get_Current"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerator<System.Boolean>.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3/UnityEngine.ProBuilder.Poly2Tri.<Enumerate>d__10.System.Collections.IEnumerator.get_Current ::Il2CppObject* UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::System_Collections_IEnumerator_get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::System.Collections.IEnumerator.get_Current"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3/UnityEngine.ProBuilder.Poly2Tri.<Enumerate>d__10.System.IDisposable.Dispose void UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::System_IDisposable_Dispose() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::System.IDisposable.Dispose"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.IDisposable.Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3/UnityEngine.ProBuilder.Poly2Tri.<Enumerate>d__10.MoveNext bool UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::MoveNext() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::MoveNext"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3/UnityEngine.ProBuilder.Poly2Tri.<Enumerate>d__10.System.Collections.IEnumerator.Reset void UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::System_Collections_IEnumerator_Reset() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::System.Collections.IEnumerator.Reset"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3/UnityEngine.ProBuilder.Poly2Tri.<Enumerate>d__10.System.Collections.Generic.IEnumerable<System.Boolean>.GetEnumerator ::System::Collections::Generic::IEnumerator_1<bool>* UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::System_Collections_Generic_IEnumerable$System_Boolean$_GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::System.Collections.Generic.IEnumerable<System.Boolean>.GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerable<System.Boolean>.GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::IEnumerator_1<bool>*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ProBuilder.Poly2Tri.FixedBitArray3/UnityEngine.ProBuilder.Poly2Tri.<Enumerate>d__10.System.Collections.IEnumerable.GetEnumerator ::System::Collections::IEnumerator* UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::System_Collections_IEnumerable_GetEnumerator() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ProBuilder::Poly2Tri::FixedBitArray3::$Enumerate$d__10::System.Collections.IEnumerable.GetEnumerator"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerable.GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Collections::IEnumerator*, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: MonoBehaviourCallbackHooks #include "GlobalNamespace/MonoBehaviourCallbackHooks.hpp" // Including type: System.Action`1 #include "System/Action_1.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: System.Action`1<System.Single> m_OnUpdateDelegate ::System::Action_1<float>*& GlobalNamespace::MonoBehaviourCallbackHooks::dyn_m_OnUpdateDelegate() { static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MonoBehaviourCallbackHooks::dyn_m_OnUpdateDelegate"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_OnUpdateDelegate"))->offset; return *reinterpret_cast<::System::Action_1<float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: MonoBehaviourCallbackHooks.add_OnUpdateDelegate void GlobalNamespace::MonoBehaviourCallbackHooks::add_OnUpdateDelegate(::System::Action_1<float>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MonoBehaviourCallbackHooks::add_OnUpdateDelegate"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_OnUpdateDelegate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: MonoBehaviourCallbackHooks.remove_OnUpdateDelegate void GlobalNamespace::MonoBehaviourCallbackHooks::remove_OnUpdateDelegate(::System::Action_1<float>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MonoBehaviourCallbackHooks::remove_OnUpdateDelegate"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_OnUpdateDelegate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: MonoBehaviourCallbackHooks.Update void GlobalNamespace::MonoBehaviourCallbackHooks::Update() { static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MonoBehaviourCallbackHooks::Update"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: MonoBehaviourCallbackHooks.GetGameObjectName ::StringW GlobalNamespace::MonoBehaviourCallbackHooks::GetGameObjectName() { static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MonoBehaviourCallbackHooks::GetGameObjectName"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetGameObjectName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceManager #include "UnityEngine/ResourceManagement/ResourceManager.hpp" // Including type: System.Action`1 #include "System/Action_1.hpp" // Including type: UnityEngine.Networking.CertificateHandler #include "UnityEngine/Networking/CertificateHandler.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.CompletedOperation`1 #include "UnityEngine/ResourceManagement/ResourceManager_CompletedOperation_1.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.InstanceOperation #include "UnityEngine/ResourceManagement/ResourceManager_InstanceOperation.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.<>c__DisplayClass83_0`1 #include "UnityEngine/ResourceManagement/ResourceManager_--c__DisplayClass83_0_1.hpp" // Including type: System.Func`2 #include "System/Func_2.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" // Including type: ListWithEvents`1 #include "GlobalNamespace/ListWithEvents_1.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.IResourceProvider #include "UnityEngine/ResourceManagement/ResourceProviders/IResourceProvider.hpp" // Including type: UnityEngine.ResourceManagement.Util.IAllocationStrategy #include "UnityEngine/ResourceManagement/Util/IAllocationStrategy.hpp" // Including type: UnityEngine.ResourceManagement.IUpdateReceiver #include "UnityEngine/ResourceManagement/IUpdateReceiver.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: System.Collections.Generic.Dictionary`2 #include "System/Collections/Generic/Dictionary_2.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation #include "UnityEngine/ResourceManagement/AsyncOperations/IAsyncOperation.hpp" // Including type: System.Collections.Generic.HashSet`1 #include "System/Collections/Generic/HashSet_1.hpp" // Including type: DelegateList`1 #include "GlobalNamespace/DelegateList_1.hpp" // Including type: System.Action`4 #include "System/Action_4.hpp" // Including type: System.Type #include "System/Type.hpp" // Including type: System.Action`2 #include "System/Action_2.hpp" // Including type: System.Exception #include "System/Exception.hpp" // Including type: System.Collections.Generic.IList`1 #include "System/Collections/Generic/IList_1.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1 #include "UnityEngine/ResourceManagement/AsyncOperations/AsyncOperationBase_1.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation #include "UnityEngine/ResourceManagement/AsyncOperations/GroupOperation.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.ISceneProvider #include "UnityEngine/ResourceManagement/ResourceProviders/ISceneProvider.hpp" // Including type: UnityEngine.SceneManagement.LoadSceneMode #include "UnityEngine/SceneManagement/LoadSceneMode.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.IInstanceProvider #include "UnityEngine/ResourceManagement/ResourceProviders/IInstanceProvider.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters #include "UnityEngine/ResourceManagement/ResourceProviders/InstantiationParameters.hpp" // Including type: UnityEngine.SceneManagement.Scene #include "UnityEngine/SceneManagement/Scene.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static private System.Action`2<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle,System.Exception> <ExceptionHandler>k__BackingField ::System::Action_2<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, ::System::Exception*>* UnityEngine::ResourceManagement::ResourceManager::_get_$ExceptionHandler$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::_get_$ExceptionHandler$k__BackingField"); return THROW_UNLESS((il2cpp_utils::GetFieldValue<::System::Action_2<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, ::System::Exception*>*>("UnityEngine.ResourceManagement", "ResourceManager", "<ExceptionHandler>k__BackingField"))); } // Autogenerated static field setter // Set static field: static private System.Action`2<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle,System.Exception> <ExceptionHandler>k__BackingField void UnityEngine::ResourceManagement::ResourceManager::_set_$ExceptionHandler$k__BackingField(::System::Action_2<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, ::System::Exception*>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::_set_$ExceptionHandler$k__BackingField"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement", "ResourceManager", "<ExceptionHandler>k__BackingField", value)); } // Autogenerated static field getter // Get static field: static private System.Int32 s_GroupOperationTypeHash int UnityEngine::ResourceManagement::ResourceManager::_get_s_GroupOperationTypeHash() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::_get_s_GroupOperationTypeHash"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("UnityEngine.ResourceManagement", "ResourceManager", "s_GroupOperationTypeHash")); } // Autogenerated static field setter // Set static field: static private System.Int32 s_GroupOperationTypeHash void UnityEngine::ResourceManagement::ResourceManager::_set_s_GroupOperationTypeHash(int value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::_set_s_GroupOperationTypeHash"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement", "ResourceManager", "s_GroupOperationTypeHash", value)); } // Autogenerated static field getter // Get static field: static private System.Int32 s_InstanceOperationTypeHash int UnityEngine::ResourceManagement::ResourceManager::_get_s_InstanceOperationTypeHash() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::_get_s_InstanceOperationTypeHash"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("UnityEngine.ResourceManagement", "ResourceManager", "s_InstanceOperationTypeHash")); } // Autogenerated static field setter // Set static field: static private System.Int32 s_InstanceOperationTypeHash void UnityEngine::ResourceManagement::ResourceManager::_set_s_InstanceOperationTypeHash(int value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::_set_s_InstanceOperationTypeHash"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement", "ResourceManager", "s_InstanceOperationTypeHash", value)); } // Autogenerated instance field getter // Get instance field: System.Boolean postProfilerEvents bool& UnityEngine::ResourceManagement::ResourceManager::dyn_postProfilerEvents() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_postProfilerEvents"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "postProfilerEvents"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Func`2<UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation,System.String> <InternalIdTransformFunc>k__BackingField ::System::Func_2<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*, ::StringW>*& UnityEngine::ResourceManagement::ResourceManager::dyn_$InternalIdTransformFunc$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_$InternalIdTransformFunc$k__BackingField"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<InternalIdTransformFunc>k__BackingField"))->offset; return *reinterpret_cast<::System::Func_2<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*, ::StringW>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: System.Boolean CallbackHooksEnabled bool& UnityEngine::ResourceManagement::ResourceManager::dyn_CallbackHooksEnabled() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_CallbackHooksEnabled"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "CallbackHooksEnabled"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private ListWithEvents`1<UnityEngine.ResourceManagement.ResourceProviders.IResourceProvider> m_ResourceProviders ::GlobalNamespace::ListWithEvents_1<::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider*>*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_ResourceProviders() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_ResourceProviders"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ResourceProviders"))->offset; return *reinterpret_cast<::GlobalNamespace::ListWithEvents_1<::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.Util.IAllocationStrategy m_allocator ::UnityEngine::ResourceManagement::Util::IAllocationStrategy*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_allocator() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_allocator"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_allocator"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::Util::IAllocationStrategy**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private ListWithEvents`1<UnityEngine.ResourceManagement.IUpdateReceiver> m_UpdateReceivers ::GlobalNamespace::ListWithEvents_1<::UnityEngine::ResourceManagement::IUpdateReceiver*>*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_UpdateReceivers() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_UpdateReceivers"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_UpdateReceivers"))->offset; return *reinterpret_cast<::GlobalNamespace::ListWithEvents_1<::UnityEngine::ResourceManagement::IUpdateReceiver*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.List`1<UnityEngine.ResourceManagement.IUpdateReceiver> m_UpdateReceiversToRemove ::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::IUpdateReceiver*>*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_UpdateReceiversToRemove() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_UpdateReceiversToRemove"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_UpdateReceiversToRemove"))->offset; return *reinterpret_cast<::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::IUpdateReceiver*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean m_UpdatingReceivers bool& UnityEngine::ResourceManagement::ResourceManager::dyn_m_UpdatingReceivers() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_UpdatingReceivers"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_UpdatingReceivers"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.Dictionary`2<System.Int32,UnityEngine.ResourceManagement.ResourceProviders.IResourceProvider> m_providerMap ::System::Collections::Generic::Dictionary_2<int, ::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider*>*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_providerMap() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_providerMap"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_providerMap"))->offset; return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<int, ::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.Dictionary`2<System.Int32,UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation> m_AssetOperationCache ::System::Collections::Generic::Dictionary_2<int, ::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation*>*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_AssetOperationCache() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_AssetOperationCache"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_AssetOperationCache"))->offset; return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<int, ::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.HashSet`1<UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.InstanceOperation> m_TrackedInstanceOperations ::System::Collections::Generic::HashSet_1<::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation*>*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_TrackedInstanceOperations() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_TrackedInstanceOperations"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_TrackedInstanceOperations"))->offset; return *reinterpret_cast<::System::Collections::Generic::HashSet_1<::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private DelegateList`1<System.Single> m_UpdateCallbacks ::GlobalNamespace::DelegateList_1<float>*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_UpdateCallbacks() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_UpdateCallbacks"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_UpdateCallbacks"))->offset; return *reinterpret_cast<::GlobalNamespace::DelegateList_1<float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.List`1<UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation> m_DeferredCompleteCallbacks ::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation*>*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_DeferredCompleteCallbacks() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_DeferredCompleteCallbacks"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_DeferredCompleteCallbacks"))->offset; return *reinterpret_cast<::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Action`4<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle,UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType,System.Int32,System.Object> m_obsoleteDiagnosticsHandler ::System::Action_4<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, ::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType, int, ::Il2CppObject*>*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_obsoleteDiagnosticsHandler() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_obsoleteDiagnosticsHandler"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_obsoleteDiagnosticsHandler"))->offset; return *reinterpret_cast<::System::Action_4<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, ::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType, int, ::Il2CppObject*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Action`1<UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventContext> m_diagnosticsHandler ::System::Action_1<::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext>*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_diagnosticsHandler() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_diagnosticsHandler"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_diagnosticsHandler"))->offset; return *reinterpret_cast<::System::Action_1<::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Action`1<UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation> m_ReleaseOpNonCached ::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation*>*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_ReleaseOpNonCached() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_ReleaseOpNonCached"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ReleaseOpNonCached"))->offset; return *reinterpret_cast<::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Action`1<UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation> m_ReleaseOpCached ::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation*>*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_ReleaseOpCached() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_ReleaseOpCached"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ReleaseOpCached"))->offset; return *reinterpret_cast<::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Action`1<UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation> m_ReleaseInstanceOp ::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation*>*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_ReleaseInstanceOp() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_ReleaseInstanceOp"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ReleaseInstanceOp"))->offset; return *reinterpret_cast<::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.Networking.CertificateHandler <CertificateHandlerInstance>k__BackingField ::UnityEngine::Networking::CertificateHandler*& UnityEngine::ResourceManagement::ResourceManager::dyn_$CertificateHandlerInstance$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_$CertificateHandlerInstance$k__BackingField"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<CertificateHandlerInstance>k__BackingField"))->offset; return *reinterpret_cast<::UnityEngine::Networking::CertificateHandler**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean m_RegisteredForCallbacks bool& UnityEngine::ResourceManagement::ResourceManager::dyn_m_RegisteredForCallbacks() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_RegisteredForCallbacks"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_RegisteredForCallbacks"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.Dictionary`2<System.Type,System.Type> m_ProviderOperationTypeCache ::System::Collections::Generic::Dictionary_2<::System::Type*, ::System::Type*>*& UnityEngine::ResourceManagement::ResourceManager::dyn_m_ProviderOperationTypeCache() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::dyn_m_ProviderOperationTypeCache"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ProviderOperationTypeCache"))->offset; return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<::System::Type*, ::System::Type*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.get_ExceptionHandler ::System::Action_2<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, ::System::Exception*>* UnityEngine::ResourceManagement::ResourceManager::get_ExceptionHandler() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::get_ExceptionHandler"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement", "ResourceManager", "get_ExceptionHandler", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Action_2<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, ::System::Exception*>*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.set_ExceptionHandler void UnityEngine::ResourceManagement::ResourceManager::set_ExceptionHandler(::System::Action_2<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, ::System::Exception*>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::set_ExceptionHandler"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement", "ResourceManager", "set_ExceptionHandler", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.get_InternalIdTransformFunc ::System::Func_2<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*, ::StringW>* UnityEngine::ResourceManagement::ResourceManager::get_InternalIdTransformFunc() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::get_InternalIdTransformFunc"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_InternalIdTransformFunc", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Func_2<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*, ::StringW>*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.set_InternalIdTransformFunc void UnityEngine::ResourceManagement::ResourceManager::set_InternalIdTransformFunc(::System::Func_2<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*, ::StringW>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::set_InternalIdTransformFunc"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_InternalIdTransformFunc", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.get_OperationCacheCount int UnityEngine::ResourceManagement::ResourceManager::get_OperationCacheCount() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::get_OperationCacheCount"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_OperationCacheCount", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.get_InstanceOperationCount int UnityEngine::ResourceManagement::ResourceManager::get_InstanceOperationCount() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::get_InstanceOperationCount"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_InstanceOperationCount", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.get_Allocator ::UnityEngine::ResourceManagement::Util::IAllocationStrategy* UnityEngine::ResourceManagement::ResourceManager::get_Allocator() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::get_Allocator"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Allocator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::Util::IAllocationStrategy*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.set_Allocator void UnityEngine::ResourceManagement::ResourceManager::set_Allocator(::UnityEngine::ResourceManagement::Util::IAllocationStrategy* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::set_Allocator"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Allocator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.get_ResourceProviders ::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider*>* UnityEngine::ResourceManagement::ResourceManager::get_ResourceProviders() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::get_ResourceProviders"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ResourceProviders", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider*>*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.get_CertificateHandlerInstance ::UnityEngine::Networking::CertificateHandler* UnityEngine::ResourceManagement::ResourceManager::get_CertificateHandlerInstance() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::get_CertificateHandlerInstance"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_CertificateHandlerInstance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Networking::CertificateHandler*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.set_CertificateHandlerInstance void UnityEngine::ResourceManagement::ResourceManager::set_CertificateHandlerInstance(::UnityEngine::Networking::CertificateHandler* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::set_CertificateHandlerInstance"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_CertificateHandlerInstance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager..cctor void UnityEngine::ResourceManagement::ResourceManager::_cctor() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::.cctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement", "ResourceManager", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.TransformInternalId ::StringW UnityEngine::ResourceManagement::ResourceManager::TransformInternalId(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::TransformInternalId"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "TransformInternalId", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(location)}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method, location); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.AddUpdateReceiver void UnityEngine::ResourceManagement::ResourceManager::AddUpdateReceiver(::UnityEngine::ResourceManagement::IUpdateReceiver* receiver) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::AddUpdateReceiver"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AddUpdateReceiver", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(receiver)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, receiver); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.RemoveUpdateReciever void UnityEngine::ResourceManagement::ResourceManager::RemoveUpdateReciever(::UnityEngine::ResourceManagement::IUpdateReceiver* receiver) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::RemoveUpdateReciever"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "RemoveUpdateReciever", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(receiver)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, receiver); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.OnObjectAdded void UnityEngine::ResourceManagement::ResourceManager::OnObjectAdded(::Il2CppObject* obj) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::OnObjectAdded"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnObjectAdded", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, obj); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.OnObjectRemoved void UnityEngine::ResourceManagement::ResourceManager::OnObjectRemoved(::Il2CppObject* obj) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::OnObjectRemoved"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnObjectRemoved", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, obj); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.RegisterForCallbacks void UnityEngine::ResourceManagement::ResourceManager::RegisterForCallbacks() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::RegisterForCallbacks"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "RegisterForCallbacks", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.ClearDiagnosticsCallback void UnityEngine::ResourceManagement::ResourceManager::ClearDiagnosticsCallback() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::ClearDiagnosticsCallback"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ClearDiagnosticsCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.ClearDiagnosticCallbacks void UnityEngine::ResourceManagement::ResourceManager::ClearDiagnosticCallbacks() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::ClearDiagnosticCallbacks"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ClearDiagnosticCallbacks", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.UnregisterDiagnosticCallback void UnityEngine::ResourceManagement::ResourceManager::UnregisterDiagnosticCallback(::System::Action_1<::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext>* func) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::UnregisterDiagnosticCallback"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UnregisterDiagnosticCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(func)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, func); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.RegisterDiagnosticCallback void UnityEngine::ResourceManagement::ResourceManager::RegisterDiagnosticCallback(::System::Action_4<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, ::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType, int, ::Il2CppObject*>* func) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::RegisterDiagnosticCallback"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "RegisterDiagnosticCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(func)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, func); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.RegisterDiagnosticCallback void UnityEngine::ResourceManagement::ResourceManager::RegisterDiagnosticCallback(::System::Action_1<::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext>* func) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::RegisterDiagnosticCallback"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "RegisterDiagnosticCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(func)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, func); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.PostDiagnosticEvent void UnityEngine::ResourceManagement::ResourceManager::PostDiagnosticEvent(::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext context) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::PostDiagnosticEvent"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "PostDiagnosticEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(context)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, context); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.GetResourceProvider ::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider* UnityEngine::ResourceManagement::ResourceManager::GetResourceProvider(::System::Type* t, ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::GetResourceProvider"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetResourceProvider", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(location)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider*, false>(this, ___internal__method, t, location); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.GetDefaultTypeForLocation ::System::Type* UnityEngine::ResourceManagement::ResourceManager::GetDefaultTypeForLocation(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* loc) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::GetDefaultTypeForLocation"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDefaultTypeForLocation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(loc)}))); return ::il2cpp_utils::RunMethodRethrow<::System::Type*, false>(this, ___internal__method, loc); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.CalculateLocationsHash int UnityEngine::ResourceManagement::ResourceManager::CalculateLocationsHash(::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*>* locations, ::System::Type* t) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::CalculateLocationsHash"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CalculateLocationsHash", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(locations), ::il2cpp_utils::ExtractType(t)}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method, locations, t); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.ProvideResource ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle UnityEngine::ResourceManagement::ResourceManager::ProvideResource(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, ::System::Type* desiredType, bool releaseDependenciesOnFailure) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::ProvideResource"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ProvideResource", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(desiredType), ::il2cpp_utils::ExtractType(releaseDependenciesOnFailure)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, false>(this, ___internal__method, location, desiredType, releaseDependenciesOnFailure); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.StartOperation ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle UnityEngine::ResourceManagement::ResourceManager::StartOperation(::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation* operation, ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle dependency) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::StartOperation"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "StartOperation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(operation), ::il2cpp_utils::ExtractType(dependency)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, false>(this, ___internal__method, operation, dependency); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.OnInstanceOperationDestroy void UnityEngine::ResourceManagement::ResourceManager::OnInstanceOperationDestroy(::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation* o) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::OnInstanceOperationDestroy"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnInstanceOperationDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(o)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, o); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.OnOperationDestroyNonCached void UnityEngine::ResourceManagement::ResourceManager::OnOperationDestroyNonCached(::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation* o) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::OnOperationDestroyNonCached"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnOperationDestroyNonCached", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(o)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, o); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.OnOperationDestroyCached void UnityEngine::ResourceManagement::ResourceManager::OnOperationDestroyCached(::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation* o) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::OnOperationDestroyCached"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnOperationDestroyCached", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(o)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, o); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.AddOperationToCache void UnityEngine::ResourceManagement::ResourceManager::AddOperationToCache(int hash, ::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation* operation) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::AddOperationToCache"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AddOperationToCache", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hash), ::il2cpp_utils::ExtractType(operation)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, hash, operation); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.RemoveOperationFromCache bool UnityEngine::ResourceManagement::ResourceManager::RemoveOperationFromCache(int hash) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::RemoveOperationFromCache"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "RemoveOperationFromCache", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hash)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, hash); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.IsOperationCached bool UnityEngine::ResourceManagement::ResourceManager::IsOperationCached(int hash) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::IsOperationCached"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IsOperationCached", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hash)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, hash); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.CachedOperationCount int UnityEngine::ResourceManagement::ResourceManager::CachedOperationCount() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::CachedOperationCount"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CachedOperationCount", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.Release void UnityEngine::ResourceManagement::ResourceManager::Release(::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle handle) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::Release"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Release", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(handle)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, handle); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.Acquire void UnityEngine::ResourceManagement::ResourceManager::Acquire(::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle handle) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::Acquire"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Acquire", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(handle)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, handle); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.AcquireGroupOpFromCache ::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation* UnityEngine::ResourceManagement::ResourceManager::AcquireGroupOpFromCache(int hash) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::AcquireGroupOpFromCache"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AcquireGroupOpFromCache", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hash)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation*, false>(this, ___internal__method, hash); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.CreateGenericGroupOperation ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>*> UnityEngine::ResourceManagement::ResourceManager::CreateGenericGroupOperation(::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* operations, bool releasedCachedOpOnComplete) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::CreateGenericGroupOperation"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CreateGenericGroupOperation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(operations), ::il2cpp_utils::ExtractType(releasedCachedOpOnComplete)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>*>, false>(this, ___internal__method, operations, releasedCachedOpOnComplete); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.ProvideResourceGroupCached ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>*> UnityEngine::ResourceManagement::ResourceManager::ProvideResourceGroupCached(::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*>* locations, int groupHash, ::System::Type* desiredType, ::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* callback, bool releaseDependenciesOnFailure) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::ProvideResourceGroupCached"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ProvideResourceGroupCached", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(locations), ::il2cpp_utils::ExtractType(groupHash), ::il2cpp_utils::ExtractType(desiredType), ::il2cpp_utils::ExtractType(callback), ::il2cpp_utils::ExtractType(releaseDependenciesOnFailure)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>*>, false>(this, ___internal__method, locations, groupHash, desiredType, callback, releaseDependenciesOnFailure); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.ProvideScene ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance> UnityEngine::ResourceManagement::ResourceManager::ProvideScene(::UnityEngine::ResourceManagement::ResourceProviders::ISceneProvider* sceneProvider, ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, ::UnityEngine::SceneManagement::LoadSceneMode loadMode, bool activateOnLoad, int priority) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::ProvideScene"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ProvideScene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(sceneProvider), ::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(loadMode), ::il2cpp_utils::ExtractType(activateOnLoad), ::il2cpp_utils::ExtractType(priority)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance>, false>(this, ___internal__method, sceneProvider, location, loadMode, activateOnLoad, priority); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.ReleaseScene ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance> UnityEngine::ResourceManagement::ResourceManager::ReleaseScene(::UnityEngine::ResourceManagement::ResourceProviders::ISceneProvider* sceneProvider, ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance> sceneLoadHandle) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::ReleaseScene"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReleaseScene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(sceneProvider), ::il2cpp_utils::ExtractType(sceneLoadHandle)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance>, false>(this, ___internal__method, sceneProvider, sceneLoadHandle); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.ProvideInstance ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::GameObject*> UnityEngine::ResourceManagement::ResourceManager::ProvideInstance(::UnityEngine::ResourceManagement::ResourceProviders::IInstanceProvider* provider, ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, ::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters instantiateParameters) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::ProvideInstance"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ProvideInstance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(provider), ::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(instantiateParameters)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::GameObject*>, false>(this, ___internal__method, provider, location, instantiateParameters); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.CleanupSceneInstances void UnityEngine::ResourceManagement::ResourceManager::CleanupSceneInstances(::UnityEngine::SceneManagement::Scene scene) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::CleanupSceneInstances"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CleanupSceneInstances", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(scene)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, scene); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.ExecuteDeferredCallbacks void UnityEngine::ResourceManagement::ResourceManager::ExecuteDeferredCallbacks() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::ExecuteDeferredCallbacks"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ExecuteDeferredCallbacks", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.RegisterForDeferredCallback void UnityEngine::ResourceManagement::ResourceManager::RegisterForDeferredCallback(::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation* op, bool incrementRefCount) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::RegisterForDeferredCallback"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "RegisterForDeferredCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(op), ::il2cpp_utils::ExtractType(incrementRefCount)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, op, incrementRefCount); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.Update void UnityEngine::ResourceManagement::ResourceManager::Update(float unscaledDeltaTime) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::Update"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(unscaledDeltaTime)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, unscaledDeltaTime); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.Dispose void UnityEngine::ResourceManagement::ResourceManager::Dispose() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::Dispose"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager.<.ctor>b__45_0 void UnityEngine::ResourceManagement::ResourceManager::$_ctor$b__45_0(::UnityEngine::ResourceManagement::IUpdateReceiver* x) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::<.ctor>b__45_0"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<.ctor>b__45_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(x)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, x); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType #include "UnityEngine/ResourceManagement/ResourceManager.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType AsyncOperationFail ::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_get_AsyncOperationFail() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_get_AsyncOperationFail"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType>("UnityEngine.ResourceManagement", "ResourceManager/DiagnosticEventType", "AsyncOperationFail")); } // Autogenerated static field setter // Set static field: static public UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType AsyncOperationFail void UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_set_AsyncOperationFail(::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_set_AsyncOperationFail"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement", "ResourceManager/DiagnosticEventType", "AsyncOperationFail", value)); } // Autogenerated static field getter // Get static field: static public UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType AsyncOperationCreate ::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_get_AsyncOperationCreate() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_get_AsyncOperationCreate"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType>("UnityEngine.ResourceManagement", "ResourceManager/DiagnosticEventType", "AsyncOperationCreate")); } // Autogenerated static field setter // Set static field: static public UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType AsyncOperationCreate void UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_set_AsyncOperationCreate(::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_set_AsyncOperationCreate"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement", "ResourceManager/DiagnosticEventType", "AsyncOperationCreate", value)); } // Autogenerated static field getter // Get static field: static public UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType AsyncOperationPercentComplete ::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_get_AsyncOperationPercentComplete() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_get_AsyncOperationPercentComplete"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType>("UnityEngine.ResourceManagement", "ResourceManager/DiagnosticEventType", "AsyncOperationPercentComplete")); } // Autogenerated static field setter // Set static field: static public UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType AsyncOperationPercentComplete void UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_set_AsyncOperationPercentComplete(::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_set_AsyncOperationPercentComplete"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement", "ResourceManager/DiagnosticEventType", "AsyncOperationPercentComplete", value)); } // Autogenerated static field getter // Get static field: static public UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType AsyncOperationComplete ::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_get_AsyncOperationComplete() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_get_AsyncOperationComplete"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType>("UnityEngine.ResourceManagement", "ResourceManager/DiagnosticEventType", "AsyncOperationComplete")); } // Autogenerated static field setter // Set static field: static public UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType AsyncOperationComplete void UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_set_AsyncOperationComplete(::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_set_AsyncOperationComplete"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement", "ResourceManager/DiagnosticEventType", "AsyncOperationComplete", value)); } // Autogenerated static field getter // Get static field: static public UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType AsyncOperationReferenceCount ::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_get_AsyncOperationReferenceCount() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_get_AsyncOperationReferenceCount"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType>("UnityEngine.ResourceManagement", "ResourceManager/DiagnosticEventType", "AsyncOperationReferenceCount")); } // Autogenerated static field setter // Set static field: static public UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType AsyncOperationReferenceCount void UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_set_AsyncOperationReferenceCount(::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_set_AsyncOperationReferenceCount"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement", "ResourceManager/DiagnosticEventType", "AsyncOperationReferenceCount", value)); } // Autogenerated static field getter // Get static field: static public UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType AsyncOperationDestroy ::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_get_AsyncOperationDestroy() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_get_AsyncOperationDestroy"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType>("UnityEngine.ResourceManagement", "ResourceManager/DiagnosticEventType", "AsyncOperationDestroy")); } // Autogenerated static field setter // Set static field: static public UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType AsyncOperationDestroy void UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_set_AsyncOperationDestroy(::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::_set_AsyncOperationDestroy"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement", "ResourceManager/DiagnosticEventType", "AsyncOperationDestroy", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventContext #include "UnityEngine/ResourceManagement/ResourceManager.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private readonly UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle <OperationHandle>k__BackingField ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle& UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::dyn_$OperationHandle$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::dyn_$OperationHandle$k__BackingField"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<OperationHandle>k__BackingField"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private readonly UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventType <Type>k__BackingField ::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType& UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::dyn_$Type$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::dyn_$Type$k__BackingField"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<Type>k__BackingField"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private readonly System.Int32 <EventValue>k__BackingField int& UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::dyn_$EventValue$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::dyn_$EventValue$k__BackingField"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<EventValue>k__BackingField"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private readonly UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation <Location>k__BackingField ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*& UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::dyn_$Location$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::dyn_$Location$k__BackingField"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<Location>k__BackingField"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private readonly System.Object <Context>k__BackingField ::Il2CppObject*& UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::dyn_$Context$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::dyn_$Context$k__BackingField"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<Context>k__BackingField"))->offset; return *reinterpret_cast<::Il2CppObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private readonly System.String <Error>k__BackingField ::StringW& UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::dyn_$Error$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::dyn_$Error$k__BackingField"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<Error>k__BackingField"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventContext.get_OperationHandle ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::get_OperationHandle() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::get_OperationHandle"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_OperationHandle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventContext.get_Type ::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::get_Type() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::get_Type"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Type", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventContext.get_EventValue int UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::get_EventValue() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::get_EventValue"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_EventValue", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventContext.get_Location ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::get_Location() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::get_Location"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Location", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventContext.get_Context ::Il2CppObject* UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::get_Context() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::get_Context"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Context", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventContext.get_Error ::StringW UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::get_Error() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::get_Error"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Error", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.DiagnosticEventContext..ctor UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::DiagnosticEventContext(::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle op, ::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventType type, int eventValue, ::StringW error, ::Il2CppObject* context) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::DiagnosticEventContext::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(op), ::il2cpp_utils::ExtractType(type), ::il2cpp_utils::ExtractType(eventValue), ::il2cpp_utils::ExtractType(error), ::il2cpp_utils::ExtractType(context)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, op, type, eventValue, error, context); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.InstanceOperation #include "UnityEngine/ResourceManagement/ResourceManager_InstanceOperation.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.IInstanceProvider #include "UnityEngine/ResourceManagement/ResourceProviders/IInstanceProvider.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.DownloadStatus #include "UnityEngine/ResourceManagement/AsyncOperations/DownloadStatus.hpp" // Including type: System.Collections.Generic.HashSet`1 #include "System/Collections/Generic/HashSet_1.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.GameObject> m_dependency ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::GameObject*>& UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::dyn_m_dependency() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::dyn_m_dependency"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_dependency"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::GameObject*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters m_instantiationParams ::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters& UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::dyn_m_instantiationParams() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::dyn_m_instantiationParams"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_instantiationParams"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.ResourceProviders.IInstanceProvider m_instanceProvider ::UnityEngine::ResourceManagement::ResourceProviders::IInstanceProvider*& UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::dyn_m_instanceProvider() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::dyn_m_instanceProvider"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_instanceProvider"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceProviders::IInstanceProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.GameObject m_instance ::UnityEngine::GameObject*& UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::dyn_m_instance() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::dyn_m_instance"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_instance"))->offset; return *reinterpret_cast<::UnityEngine::GameObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.SceneManagement.Scene m_scene ::UnityEngine::SceneManagement::Scene& UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::dyn_m_scene() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::dyn_m_scene"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_scene"))->offset; return *reinterpret_cast<::UnityEngine::SceneManagement::Scene*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.InstanceOperation.Init void UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::Init(::UnityEngine::ResourceManagement::ResourceManager* rm, ::UnityEngine::ResourceManagement::ResourceProviders::IInstanceProvider* instanceProvider, ::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters instantiationParams, ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::GameObject*> dependency) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::Init"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Init", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rm), ::il2cpp_utils::ExtractType(instanceProvider), ::il2cpp_utils::ExtractType(instantiationParams), ::il2cpp_utils::ExtractType(dependency)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, rm, instanceProvider, instantiationParams, dependency); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.InstanceOperation.InstanceScene ::UnityEngine::SceneManagement::Scene UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::InstanceScene() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::InstanceScene"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InstanceScene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::SceneManagement::Scene, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.InstanceOperation.get_DebugName ::StringW UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::get_DebugName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::get_DebugName"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_DebugName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.InstanceOperation.get_Progress float UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::get_Progress() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::get_Progress"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Progress", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.InstanceOperation.GetDownloadStatus ::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::GetDownloadStatus(::System::Collections::Generic::HashSet_1<::Il2CppObject*>* visited) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::GetDownloadStatus"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDownloadStatus", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(visited)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus, false>(this, ___internal__method, visited); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.InstanceOperation.GetDependencies void UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::GetDependencies(::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* deps) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::GetDependencies"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDependencies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(deps)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, deps); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.InstanceOperation.Destroy void UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::Destroy() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::Destroy"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Destroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.InstanceOperation.InvokeWaitForCompletion bool UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::InvokeWaitForCompletion() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::InvokeWaitForCompletion"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InvokeWaitForCompletion", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceManager/UnityEngine.ResourceManagement.InstanceOperation.Execute void UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::Execute() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceManager::InstanceOperation::Execute"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Execute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.IUpdateReceiver #include "UnityEngine/ResourceManagement/IUpdateReceiver.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.IUpdateReceiver.Update void UnityEngine::ResourceManagement::IUpdateReceiver::Update(float unscaledDeltaTime) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::IUpdateReceiver::Update"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(unscaledDeltaTime)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, unscaledDeltaTime); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.WebRequestQueueOperation #include "UnityEngine/ResourceManagement/WebRequestQueueOperation.hpp" // Including type: UnityEngine.Networking.UnityWebRequestAsyncOperation #include "UnityEngine/Networking/UnityWebRequestAsyncOperation.hpp" // Including type: System.Action`1 #include "System/Action_1.hpp" // Including type: UnityEngine.Networking.UnityWebRequest #include "UnityEngine/Networking/UnityWebRequest.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public UnityEngine.Networking.UnityWebRequestAsyncOperation Result ::UnityEngine::Networking::UnityWebRequestAsyncOperation*& UnityEngine::ResourceManagement::WebRequestQueueOperation::dyn_Result() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueueOperation::dyn_Result"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "Result"))->offset; return *reinterpret_cast<::UnityEngine::Networking::UnityWebRequestAsyncOperation**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Action`1<UnityEngine.Networking.UnityWebRequestAsyncOperation> OnComplete ::System::Action_1<::UnityEngine::Networking::UnityWebRequestAsyncOperation*>*& UnityEngine::ResourceManagement::WebRequestQueueOperation::dyn_OnComplete() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueueOperation::dyn_OnComplete"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "OnComplete"))->offset; return *reinterpret_cast<::System::Action_1<::UnityEngine::Networking::UnityWebRequestAsyncOperation*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: UnityEngine.Networking.UnityWebRequest m_WebRequest ::UnityEngine::Networking::UnityWebRequest*& UnityEngine::ResourceManagement::WebRequestQueueOperation::dyn_m_WebRequest() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueueOperation::dyn_m_WebRequest"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_WebRequest"))->offset; return *reinterpret_cast<::UnityEngine::Networking::UnityWebRequest**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.WebRequestQueueOperation.get_IsDone bool UnityEngine::ResourceManagement::WebRequestQueueOperation::get_IsDone() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueueOperation::get_IsDone"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsDone", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.WebRequestQueueOperation.Complete void UnityEngine::ResourceManagement::WebRequestQueueOperation::Complete(::UnityEngine::Networking::UnityWebRequestAsyncOperation* asyncOp) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueueOperation::Complete"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Complete", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(asyncOp)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, asyncOp); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.WebRequestQueue #include "UnityEngine/ResourceManagement/WebRequestQueue.hpp" // Including type: System.Collections.Generic.Queue`1 #include "System/Collections/Generic/Queue_1.hpp" // Including type: UnityEngine.ResourceManagement.WebRequestQueueOperation #include "UnityEngine/ResourceManagement/WebRequestQueueOperation.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: UnityEngine.Networking.UnityWebRequestAsyncOperation #include "UnityEngine/Networking/UnityWebRequestAsyncOperation.hpp" // Including type: UnityEngine.Networking.UnityWebRequest #include "UnityEngine/Networking/UnityWebRequest.hpp" // Including type: UnityEngine.AsyncOperation #include "UnityEngine/AsyncOperation.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static System.Int32 s_MaxRequest int UnityEngine::ResourceManagement::WebRequestQueue::_get_s_MaxRequest() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueue::_get_s_MaxRequest"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("UnityEngine.ResourceManagement", "WebRequestQueue", "s_MaxRequest")); } // Autogenerated static field setter // Set static field: static System.Int32 s_MaxRequest void UnityEngine::ResourceManagement::WebRequestQueue::_set_s_MaxRequest(int value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueue::_set_s_MaxRequest"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement", "WebRequestQueue", "s_MaxRequest", value)); } // Autogenerated static field getter // Get static field: static System.Collections.Generic.Queue`1<UnityEngine.ResourceManagement.WebRequestQueueOperation> s_QueuedOperations ::System::Collections::Generic::Queue_1<::UnityEngine::ResourceManagement::WebRequestQueueOperation*>* UnityEngine::ResourceManagement::WebRequestQueue::_get_s_QueuedOperations() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueue::_get_s_QueuedOperations"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::System::Collections::Generic::Queue_1<::UnityEngine::ResourceManagement::WebRequestQueueOperation*>*>("UnityEngine.ResourceManagement", "WebRequestQueue", "s_QueuedOperations")); } // Autogenerated static field setter // Set static field: static System.Collections.Generic.Queue`1<UnityEngine.ResourceManagement.WebRequestQueueOperation> s_QueuedOperations void UnityEngine::ResourceManagement::WebRequestQueue::_set_s_QueuedOperations(::System::Collections::Generic::Queue_1<::UnityEngine::ResourceManagement::WebRequestQueueOperation*>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueue::_set_s_QueuedOperations"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement", "WebRequestQueue", "s_QueuedOperations", value)); } // Autogenerated static field getter // Get static field: static System.Collections.Generic.List`1<UnityEngine.Networking.UnityWebRequestAsyncOperation> s_ActiveRequests ::System::Collections::Generic::List_1<::UnityEngine::Networking::UnityWebRequestAsyncOperation*>* UnityEngine::ResourceManagement::WebRequestQueue::_get_s_ActiveRequests() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueue::_get_s_ActiveRequests"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::System::Collections::Generic::List_1<::UnityEngine::Networking::UnityWebRequestAsyncOperation*>*>("UnityEngine.ResourceManagement", "WebRequestQueue", "s_ActiveRequests")); } // Autogenerated static field setter // Set static field: static System.Collections.Generic.List`1<UnityEngine.Networking.UnityWebRequestAsyncOperation> s_ActiveRequests void UnityEngine::ResourceManagement::WebRequestQueue::_set_s_ActiveRequests(::System::Collections::Generic::List_1<::UnityEngine::Networking::UnityWebRequestAsyncOperation*>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueue::_set_s_ActiveRequests"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement", "WebRequestQueue", "s_ActiveRequests", value)); } // Autogenerated method: UnityEngine.ResourceManagement.WebRequestQueue.get_ShouldQueueNextRequest bool UnityEngine::ResourceManagement::WebRequestQueue::get_ShouldQueueNextRequest() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueue::get_ShouldQueueNextRequest"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement", "WebRequestQueue", "get_ShouldQueueNextRequest", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.WebRequestQueue..cctor void UnityEngine::ResourceManagement::WebRequestQueue::_cctor() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueue::.cctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement", "WebRequestQueue", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.WebRequestQueue.SetMaxConcurrentRequests void UnityEngine::ResourceManagement::WebRequestQueue::SetMaxConcurrentRequests(int maxRequests) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueue::SetMaxConcurrentRequests"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement", "WebRequestQueue", "SetMaxConcurrentRequests", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(maxRequests)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, maxRequests); } // Autogenerated method: UnityEngine.ResourceManagement.WebRequestQueue.QueueRequest ::UnityEngine::ResourceManagement::WebRequestQueueOperation* UnityEngine::ResourceManagement::WebRequestQueue::QueueRequest(::UnityEngine::Networking::UnityWebRequest* request) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueue::QueueRequest"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement", "WebRequestQueue", "QueueRequest", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(request)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::WebRequestQueueOperation*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, request); } // Autogenerated method: UnityEngine.ResourceManagement.WebRequestQueue.OnWebAsyncOpComplete void UnityEngine::ResourceManagement::WebRequestQueue::OnWebAsyncOpComplete(::UnityEngine::AsyncOperation* operation) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::WebRequestQueue::OnWebAsyncOpComplete"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement", "WebRequestQueue", "OnWebAsyncOpComplete", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(operation)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, operation); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.Exceptions.ResourceManagerException #include "UnityEngine/ResourceManagement/Exceptions/ResourceManagerException.hpp" // Including type: System.Runtime.Serialization.SerializationInfo #include "System/Runtime/Serialization/SerializationInfo.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.Exceptions.UnknownResourceProviderException #include "UnityEngine/ResourceManagement/Exceptions/UnknownResourceProviderException.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" // Including type: System.Runtime.Serialization.SerializationInfo #include "System/Runtime/Serialization/SerializationInfo.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation <Location>k__BackingField ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*& UnityEngine::ResourceManagement::Exceptions::UnknownResourceProviderException::dyn_$Location$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Exceptions::UnknownResourceProviderException::dyn_$Location$k__BackingField"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<Location>k__BackingField"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.Exceptions.UnknownResourceProviderException.get_Location ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* UnityEngine::ResourceManagement::Exceptions::UnknownResourceProviderException::get_Location() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Exceptions::UnknownResourceProviderException::get_Location"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Location", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Exceptions.UnknownResourceProviderException.set_Location void UnityEngine::ResourceManagement::Exceptions::UnknownResourceProviderException::set_Location(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Exceptions::UnknownResourceProviderException::set_Location"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Location", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.Exceptions.UnknownResourceProviderException.get_Message ::StringW UnityEngine::ResourceManagement::Exceptions::UnknownResourceProviderException::get_Message() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Exceptions::UnknownResourceProviderException::get_Message"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Message", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Exceptions.UnknownResourceProviderException.ToString ::StringW UnityEngine::ResourceManagement::Exceptions::UnknownResourceProviderException::ToString() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Exceptions::UnknownResourceProviderException::ToString"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.Util.DelayedActionManager #include "UnityEngine/ResourceManagement/Util/DelayedActionManager.hpp" // Including type: System.Collections.Generic.LinkedList`1 #include "System/Collections/Generic/LinkedList_1.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: System.Collections.Generic.Stack`1 #include "System/Collections/Generic/Stack_1.hpp" // Including type: System.Collections.Generic.LinkedListNode`1 #include "System/Collections/Generic/LinkedListNode_1.hpp" // Including type: System.Delegate #include "System/Delegate.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.List`1<UnityEngine.ResourceManagement.Util.DelayedActionManager/UnityEngine.ResourceManagement.Util.DelegateInfo>[] m_Actions ::ArrayW<::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo>*>& UnityEngine::ResourceManagement::Util::DelayedActionManager::dyn_m_Actions() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::dyn_m_Actions"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Actions"))->offset; return *reinterpret_cast<::ArrayW<::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo>*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.LinkedList`1<UnityEngine.ResourceManagement.Util.DelayedActionManager/UnityEngine.ResourceManagement.Util.DelegateInfo> m_DelayedActions ::System::Collections::Generic::LinkedList_1<::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo>*& UnityEngine::ResourceManagement::Util::DelayedActionManager::dyn_m_DelayedActions() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::dyn_m_DelayedActions"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_DelayedActions"))->offset; return *reinterpret_cast<::System::Collections::Generic::LinkedList_1<::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.Stack`1<System.Collections.Generic.LinkedListNode`1<UnityEngine.ResourceManagement.Util.DelayedActionManager/UnityEngine.ResourceManagement.Util.DelegateInfo>> m_NodeCache ::System::Collections::Generic::Stack_1<::System::Collections::Generic::LinkedListNode_1<::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo>*>*& UnityEngine::ResourceManagement::Util::DelayedActionManager::dyn_m_NodeCache() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::dyn_m_NodeCache"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_NodeCache"))->offset; return *reinterpret_cast<::System::Collections::Generic::Stack_1<::System::Collections::Generic::LinkedListNode_1<::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo>*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_CollectionIndex int& UnityEngine::ResourceManagement::Util::DelayedActionManager::dyn_m_CollectionIndex() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::dyn_m_CollectionIndex"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_CollectionIndex"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean m_DestroyOnCompletion bool& UnityEngine::ResourceManagement::Util::DelayedActionManager::dyn_m_DestroyOnCompletion() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::dyn_m_DestroyOnCompletion"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_DestroyOnCompletion"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager.get_IsActive bool UnityEngine::ResourceManagement::Util::DelayedActionManager::get_IsActive() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::get_IsActive"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Util", "DelayedActionManager", "get_IsActive", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager.GetNode ::System::Collections::Generic::LinkedListNode_1<::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo>* UnityEngine::ResourceManagement::Util::DelayedActionManager::GetNode(ByRef<::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo> del) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::GetNode"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetNode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(del)}))); return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::LinkedListNode_1<::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo>*, false>(this, ___internal__method, byref(del)); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager.Clear void UnityEngine::ResourceManagement::Util::DelayedActionManager::Clear() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::Clear"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Util", "DelayedActionManager", "Clear", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager.DestroyWhenComplete void UnityEngine::ResourceManagement::Util::DelayedActionManager::DestroyWhenComplete() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::DestroyWhenComplete"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "DestroyWhenComplete", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager.AddAction void UnityEngine::ResourceManagement::Util::DelayedActionManager::AddAction(::System::Delegate* action, float delay, ::ArrayW<::Il2CppObject*> parameters) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::AddAction"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Util", "DelayedActionManager", "AddAction", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(action), ::il2cpp_utils::ExtractType(delay), ::il2cpp_utils::ExtractType(parameters)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, action, delay, parameters); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager.AddActionInternal void UnityEngine::ResourceManagement::Util::DelayedActionManager::AddActionInternal(::System::Delegate* action, float delay, ::ArrayW<::Il2CppObject*> parameters) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::AddActionInternal"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AddActionInternal", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(action), ::il2cpp_utils::ExtractType(delay), ::il2cpp_utils::ExtractType(parameters)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, action, delay, parameters); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager.Wait bool UnityEngine::ResourceManagement::Util::DelayedActionManager::Wait(float timeout, float timeAdvanceAmount) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::Wait"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Util", "DelayedActionManager", "Wait", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(timeout), ::il2cpp_utils::ExtractType(timeAdvanceAmount)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, timeout, timeAdvanceAmount); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager.LateUpdate void UnityEngine::ResourceManagement::Util::DelayedActionManager::LateUpdate() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::LateUpdate"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "LateUpdate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager.InternalLateUpdate void UnityEngine::ResourceManagement::Util::DelayedActionManager::InternalLateUpdate(float t) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::InternalLateUpdate"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InternalLateUpdate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, t); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager.OnApplicationQuit void UnityEngine::ResourceManagement::Util::DelayedActionManager::OnApplicationQuit() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::OnApplicationQuit"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnApplicationQuit", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.Util.DelayedActionManager/UnityEngine.ResourceManagement.Util.DelegateInfo #include "UnityEngine/ResourceManagement/Util/DelayedActionManager.hpp" // Including type: System.Delegate #include "System/Delegate.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static private System.Int32 s_Id int UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::_get_s_Id() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::_get_s_Id"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("UnityEngine.ResourceManagement.Util", "DelayedActionManager/DelegateInfo", "s_Id")); } // Autogenerated static field setter // Set static field: static private System.Int32 s_Id void UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::_set_s_Id(int value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::_set_s_Id"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.Util", "DelayedActionManager/DelegateInfo", "s_Id", value)); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_Id int& UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::dyn_m_Id() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::dyn_m_Id"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Id"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Delegate m_Delegate ::System::Delegate*& UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::dyn_m_Delegate() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::dyn_m_Delegate"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Delegate"))->offset; return *reinterpret_cast<::System::Delegate**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Object[] m_Target ::ArrayW<::Il2CppObject*>& UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::dyn_m_Target() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::dyn_m_Target"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Target"))->offset; return *reinterpret_cast<::ArrayW<::Il2CppObject*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Single <InvocationTime>k__BackingField float& UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::dyn_$InvocationTime$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::dyn_$InvocationTime$k__BackingField"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<InvocationTime>k__BackingField"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager/UnityEngine.ResourceManagement.Util.DelegateInfo.get_InvocationTime float UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::get_InvocationTime() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::get_InvocationTime"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_InvocationTime", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager/UnityEngine.ResourceManagement.Util.DelegateInfo.set_InvocationTime void UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::set_InvocationTime(float value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::set_InvocationTime"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "set_InvocationTime", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager/UnityEngine.ResourceManagement.Util.DelegateInfo..ctor UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::DelegateInfo(::System::Delegate* d, float invocationTime, ::ArrayW<::Il2CppObject*> p) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(d), ::il2cpp_utils::ExtractType(invocationTime), ::il2cpp_utils::ExtractType(p)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, d, invocationTime, p); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager/UnityEngine.ResourceManagement.Util.DelegateInfo.Invoke void UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::Invoke() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::Invoke"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "Invoke", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DelayedActionManager/UnityEngine.ResourceManagement.Util.DelegateInfo.ToString ::StringW UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::ToString() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DelayedActionManager::DelegateInfo::ToString"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "ToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.Util.IInitializableObject #include "UnityEngine/ResourceManagement/Util/IInitializableObject.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1 #include "UnityEngine/ResourceManagement/AsyncOperations/AsyncOperationHandle_1.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager #include "UnityEngine/ResourceManagement/ResourceManager.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.Util.IInitializableObject.Initialize bool UnityEngine::ResourceManagement::Util::IInitializableObject::Initialize(::StringW id, ::StringW data) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::IInitializableObject::Initialize"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Initialize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(id), ::il2cpp_utils::ExtractType(data)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, id, data); } // Autogenerated method: UnityEngine.ResourceManagement.Util.IInitializableObject.InitializeAsync ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<bool> UnityEngine::ResourceManagement::Util::IInitializableObject::InitializeAsync(::UnityEngine::ResourceManagement::ResourceManager* rm, ::StringW id, ::StringW data) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::IInitializableObject::InitializeAsync"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InitializeAsync", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rm), ::il2cpp_utils::ExtractType(id), ::il2cpp_utils::ExtractType(data)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<bool>, false>(this, ___internal__method, rm, id, data); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.Util.IObjectInitializationDataProvider #include "UnityEngine/ResourceManagement/Util/IObjectInitializationDataProvider.hpp" // Including type: UnityEngine.ResourceManagement.Util.ObjectInitializationData #include "UnityEngine/ResourceManagement/Util/ObjectInitializationData.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.Util.IObjectInitializationDataProvider.get_Name ::StringW UnityEngine::ResourceManagement::Util::IObjectInitializationDataProvider::get_Name() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::IObjectInitializationDataProvider::get_Name"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Name", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.IObjectInitializationDataProvider.CreateObjectInitializationData ::UnityEngine::ResourceManagement::Util::ObjectInitializationData UnityEngine::ResourceManagement::Util::IObjectInitializationDataProvider::CreateObjectInitializationData() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::IObjectInitializationDataProvider::CreateObjectInitializationData"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CreateObjectInitializationData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::Util::ObjectInitializationData, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.Util.IAllocationStrategy #include "UnityEngine/ResourceManagement/Util/IAllocationStrategy.hpp" // Including type: System.Type #include "System/Type.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.Util.IAllocationStrategy.New ::Il2CppObject* UnityEngine::ResourceManagement::Util::IAllocationStrategy::New(::System::Type* type, int typeHash) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::IAllocationStrategy::New"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "New", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(type), ::il2cpp_utils::ExtractType(typeHash)}))); return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method, type, typeHash); } // Autogenerated method: UnityEngine.ResourceManagement.Util.IAllocationStrategy.Release void UnityEngine::ResourceManagement::Util::IAllocationStrategy::Release(int typeHash, ::Il2CppObject* obj) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::IAllocationStrategy::Release"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Release", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(typeHash), ::il2cpp_utils::ExtractType(obj)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, typeHash, obj); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.Util.DefaultAllocationStrategy #include "UnityEngine/ResourceManagement/Util/DefaultAllocationStrategy.hpp" // Including type: System.Type #include "System/Type.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.Util.DefaultAllocationStrategy.New ::Il2CppObject* UnityEngine::ResourceManagement::Util::DefaultAllocationStrategy::New(::System::Type* type, int typeHash) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DefaultAllocationStrategy::New"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "New", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(type), ::il2cpp_utils::ExtractType(typeHash)}))); return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method, type, typeHash); } // Autogenerated method: UnityEngine.ResourceManagement.Util.DefaultAllocationStrategy.Release void UnityEngine::ResourceManagement::Util::DefaultAllocationStrategy::Release(int typeHash, ::Il2CppObject* obj) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::DefaultAllocationStrategy::Release"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Release", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(typeHash), ::il2cpp_utils::ExtractType(obj)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, typeHash, obj); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.Util.LRUCacheAllocationStrategy #include "UnityEngine/ResourceManagement/Util/LRUCacheAllocationStrategy.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: System.Collections.Generic.Dictionary`2 #include "System/Collections/Generic/Dictionary_2.hpp" // Including type: System.Type #include "System/Type.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Int32 m_poolMaxSize int& UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::dyn_m_poolMaxSize() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::dyn_m_poolMaxSize"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_poolMaxSize"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_poolInitialCapacity int& UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::dyn_m_poolInitialCapacity() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::dyn_m_poolInitialCapacity"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_poolInitialCapacity"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_poolCacheMaxSize int& UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::dyn_m_poolCacheMaxSize() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::dyn_m_poolCacheMaxSize"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_poolCacheMaxSize"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.List`1<System.Collections.Generic.List`1<System.Object>> m_poolCache ::System::Collections::Generic::List_1<::System::Collections::Generic::List_1<::Il2CppObject*>*>*& UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::dyn_m_poolCache() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::dyn_m_poolCache"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_poolCache"))->offset; return *reinterpret_cast<::System::Collections::Generic::List_1<::System::Collections::Generic::List_1<::Il2CppObject*>*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.Dictionary`2<System.Int32,System.Collections.Generic.List`1<System.Object>> m_cache ::System::Collections::Generic::Dictionary_2<int, ::System::Collections::Generic::List_1<::Il2CppObject*>*>*& UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::dyn_m_cache() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::dyn_m_cache"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_cache"))->offset; return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<int, ::System::Collections::Generic::List_1<::Il2CppObject*>*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.Util.LRUCacheAllocationStrategy.GetPool ::System::Collections::Generic::List_1<::Il2CppObject*>* UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::GetPool() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::GetPool"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetPool", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::List_1<::Il2CppObject*>*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.LRUCacheAllocationStrategy.ReleasePool void UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::ReleasePool(::System::Collections::Generic::List_1<::Il2CppObject*>* pool) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::ReleasePool"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReleasePool", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(pool)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, pool); } // Autogenerated method: UnityEngine.ResourceManagement.Util.LRUCacheAllocationStrategy.New ::Il2CppObject* UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::New(::System::Type* type, int typeHash) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::New"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "New", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(type), ::il2cpp_utils::ExtractType(typeHash)}))); return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method, type, typeHash); } // Autogenerated method: UnityEngine.ResourceManagement.Util.LRUCacheAllocationStrategy.Release void UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::Release(int typeHash, ::Il2CppObject* obj) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::LRUCacheAllocationStrategy::Release"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Release", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(typeHash), ::il2cpp_utils::ExtractType(obj)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, typeHash, obj); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.Util.SerializedTypeRestrictionAttribute #include "UnityEngine/ResourceManagement/Util/SerializedTypeRestrictionAttribute.hpp" // Including type: System.Type #include "System/Type.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.Type type ::System::Type*& UnityEngine::ResourceManagement::Util::SerializedTypeRestrictionAttribute::dyn_type() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::SerializedTypeRestrictionAttribute::dyn_type"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "type"))->offset; return *reinterpret_cast<::System::Type**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.Util.SerializedType #include "UnityEngine/ResourceManagement/Util/SerializedType.hpp" // Including type: System.Type #include "System/Type.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.String m_AssemblyName ::StringW& UnityEngine::ResourceManagement::Util::SerializedType::dyn_m_AssemblyName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::SerializedType::dyn_m_AssemblyName"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_AssemblyName"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.String m_ClassName ::StringW& UnityEngine::ResourceManagement::Util::SerializedType::dyn_m_ClassName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::SerializedType::dyn_m_ClassName"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ClassName"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Type m_CachedType ::System::Type*& UnityEngine::ResourceManagement::Util::SerializedType::dyn_m_CachedType() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::SerializedType::dyn_m_CachedType"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_CachedType"))->offset; return *reinterpret_cast<::System::Type**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean <ValueChanged>k__BackingField bool& UnityEngine::ResourceManagement::Util::SerializedType::dyn_$ValueChanged$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::SerializedType::dyn_$ValueChanged$k__BackingField"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<ValueChanged>k__BackingField"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.Util.SerializedType.get_AssemblyName ::StringW UnityEngine::ResourceManagement::Util::SerializedType::get_AssemblyName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::SerializedType::get_AssemblyName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_AssemblyName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.SerializedType.get_ClassName ::StringW UnityEngine::ResourceManagement::Util::SerializedType::get_ClassName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::SerializedType::get_ClassName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_ClassName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.SerializedType.get_Value ::System::Type* UnityEngine::ResourceManagement::Util::SerializedType::get_Value() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::SerializedType::get_Value"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Value", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Type*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.SerializedType.set_Value void UnityEngine::ResourceManagement::Util::SerializedType::set_Value(::System::Type* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::SerializedType::set_Value"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "set_Value", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.Util.SerializedType.get_ValueChanged bool UnityEngine::ResourceManagement::Util::SerializedType::get_ValueChanged() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::SerializedType::get_ValueChanged"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_ValueChanged", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.SerializedType.set_ValueChanged void UnityEngine::ResourceManagement::Util::SerializedType::set_ValueChanged(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::SerializedType::set_ValueChanged"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "set_ValueChanged", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.Util.SerializedType.ToString ::StringW UnityEngine::ResourceManagement::Util::SerializedType::ToString() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::SerializedType::ToString"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "ToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.Util.ObjectInitializationData #include "UnityEngine/ResourceManagement/Util/ObjectInitializationData.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle #include "UnityEngine/ResourceManagement/AsyncOperations/AsyncOperationHandle.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager #include "UnityEngine/ResourceManagement/ResourceManager.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.String m_Id ::StringW& UnityEngine::ResourceManagement::Util::ObjectInitializationData::dyn_m_Id() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::ObjectInitializationData::dyn_m_Id"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Id"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.Util.SerializedType m_ObjectType ::UnityEngine::ResourceManagement::Util::SerializedType& UnityEngine::ResourceManagement::Util::ObjectInitializationData::dyn_m_ObjectType() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::ObjectInitializationData::dyn_m_ObjectType"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ObjectType"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::Util::SerializedType*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.String m_Data ::StringW& UnityEngine::ResourceManagement::Util::ObjectInitializationData::dyn_m_Data() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::ObjectInitializationData::dyn_m_Data"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Data"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.Util.ObjectInitializationData.get_Id ::StringW UnityEngine::ResourceManagement::Util::ObjectInitializationData::get_Id() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::ObjectInitializationData::get_Id"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Id", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.ObjectInitializationData.get_ObjectType ::UnityEngine::ResourceManagement::Util::SerializedType UnityEngine::ResourceManagement::Util::ObjectInitializationData::get_ObjectType() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::ObjectInitializationData::get_ObjectType"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_ObjectType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::Util::SerializedType, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.ObjectInitializationData.get_Data ::StringW UnityEngine::ResourceManagement::Util::ObjectInitializationData::get_Data() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::ObjectInitializationData::get_Data"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Data", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Util.ObjectInitializationData.GetAsyncInitHandle ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle UnityEngine::ResourceManagement::Util::ObjectInitializationData::GetAsyncInitHandle(::UnityEngine::ResourceManagement::ResourceManager* rm, ::StringW idOverride) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::ObjectInitializationData::GetAsyncInitHandle"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "GetAsyncInitHandle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rm), ::il2cpp_utils::ExtractType(idOverride)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, false>(this, ___internal__method, rm, idOverride); } // Autogenerated method: UnityEngine.ResourceManagement.Util.ObjectInitializationData.ToString ::StringW UnityEngine::ResourceManagement::Util::ObjectInitializationData::ToString() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::ObjectInitializationData::ToString"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "ToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.Util.ResourceManagerConfig #include "UnityEngine/ResourceManagement/Util/ResourceManagerConfig.hpp" // Including type: System.Array #include "System/Array.hpp" // Including type: System.Type #include "System/Type.hpp" // Including type: UnityEngine.Object #include "UnityEngine/Object.hpp" // Including type: System.Collections.IList #include "System/Collections/IList.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.Util.ResourceManagerConfig.ExtractKeyAndSubKey bool UnityEngine::ResourceManagement::Util::ResourceManagerConfig::ExtractKeyAndSubKey(::Il2CppObject* keyObj, ByRef<::StringW> mainKey, ByRef<::StringW> subKey) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::ResourceManagerConfig::ExtractKeyAndSubKey"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Util", "ResourceManagerConfig", "ExtractKeyAndSubKey", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(keyObj), ::il2cpp_utils::ExtractIndependentType<::StringW&>(), ::il2cpp_utils::ExtractIndependentType<::StringW&>()}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, keyObj, byref(mainKey), byref(subKey)); } // Autogenerated method: UnityEngine.ResourceManagement.Util.ResourceManagerConfig.IsPathRemote bool UnityEngine::ResourceManagement::Util::ResourceManagerConfig::IsPathRemote(::StringW path) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::ResourceManagerConfig::IsPathRemote"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Util", "ResourceManagerConfig", "IsPathRemote", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(path)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, path); } // Autogenerated method: UnityEngine.ResourceManagement.Util.ResourceManagerConfig.ShouldPathUseWebRequest bool UnityEngine::ResourceManagement::Util::ResourceManagerConfig::ShouldPathUseWebRequest(::StringW path) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::ResourceManagerConfig::ShouldPathUseWebRequest"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Util", "ResourceManagerConfig", "ShouldPathUseWebRequest", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(path)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, path); } // Autogenerated method: UnityEngine.ResourceManagement.Util.ResourceManagerConfig.CreateArrayResult ::System::Array* UnityEngine::ResourceManagement::Util::ResourceManagerConfig::CreateArrayResult(::System::Type* type, ::ArrayW<::UnityEngine::Object*> allAssets) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::ResourceManagerConfig::CreateArrayResult"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Util", "ResourceManagerConfig", "CreateArrayResult", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(type), ::il2cpp_utils::ExtractType(allAssets)}))); return ::il2cpp_utils::RunMethodRethrow<::System::Array*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, type, allAssets); } // Autogenerated method: UnityEngine.ResourceManagement.Util.ResourceManagerConfig.CreateListResult ::System::Collections::IList* UnityEngine::ResourceManagement::Util::ResourceManagerConfig::CreateListResult(::System::Type* type, ::ArrayW<::UnityEngine::Object*> allAssets) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Util::ResourceManagerConfig::CreateListResult"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Util", "ResourceManagerConfig", "CreateListResult", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(type), ::il2cpp_utils::ExtractType(allAssets)}))); return ::il2cpp_utils::RunMethodRethrow<::System::Collections::IList*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, type, allAssets); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.IAssetBundleResource #include "UnityEngine/ResourceManagement/ResourceProviders/IAssetBundleResource.hpp" // Including type: UnityEngine.AssetBundle #include "UnityEngine/AssetBundle.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.IAssetBundleResource.GetAssetBundle ::UnityEngine::AssetBundle* UnityEngine::ResourceManagement::ResourceProviders::IAssetBundleResource::GetAssetBundle() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::IAssetBundleResource::GetAssetBundle"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetAssetBundle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::AssetBundle*, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions #include "UnityEngine/ResourceManagement/ResourceProviders/AssetBundleRequestOptions.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager #include "UnityEngine/ResourceManagement/ResourceManager.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.String m_Hash ::StringW& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_Hash() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_Hash"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Hash"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.UInt32 m_Crc uint& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_Crc() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_Crc"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Crc"))->offset; return *reinterpret_cast<uint*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_Timeout int& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_Timeout() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_Timeout"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Timeout"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean m_ChunkedTransfer bool& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_ChunkedTransfer() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_ChunkedTransfer"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ChunkedTransfer"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_RedirectLimit int& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_RedirectLimit() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_RedirectLimit"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_RedirectLimit"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_RetryCount int& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_RetryCount() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_RetryCount"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_RetryCount"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.String m_BundleName ::StringW& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_BundleName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_BundleName"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_BundleName"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int64 m_BundleSize int64_t& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_BundleSize() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_BundleSize"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_BundleSize"))->offset; return *reinterpret_cast<int64_t*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean m_UseCrcForCachedBundles bool& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_UseCrcForCachedBundles() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_UseCrcForCachedBundles"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_UseCrcForCachedBundles"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean m_ClearOtherCachedVersionsWhenLoaded bool& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_ClearOtherCachedVersionsWhenLoaded() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::dyn_m_ClearOtherCachedVersionsWhenLoaded"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ClearOtherCachedVersionsWhenLoaded"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.get_Hash ::StringW UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_Hash() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_Hash"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Hash", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.set_Hash void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_Hash(::StringW value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_Hash"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Hash", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.get_Crc uint UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_Crc() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_Crc"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Crc", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<uint, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.set_Crc void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_Crc(uint value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_Crc"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Crc", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.get_Timeout int UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_Timeout() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_Timeout"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Timeout", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.set_Timeout void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_Timeout(int value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_Timeout"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Timeout", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.get_ChunkedTransfer bool UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_ChunkedTransfer() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_ChunkedTransfer"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ChunkedTransfer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.set_ChunkedTransfer void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_ChunkedTransfer(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_ChunkedTransfer"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_ChunkedTransfer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.get_RedirectLimit int UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_RedirectLimit() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_RedirectLimit"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_RedirectLimit", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.set_RedirectLimit void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_RedirectLimit(int value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_RedirectLimit"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_RedirectLimit", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.get_RetryCount int UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_RetryCount() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_RetryCount"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_RetryCount", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.set_RetryCount void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_RetryCount(int value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_RetryCount"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_RetryCount", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.get_BundleName ::StringW UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_BundleName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_BundleName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_BundleName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.set_BundleName void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_BundleName(::StringW value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_BundleName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_BundleName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.get_BundleSize int64_t UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_BundleSize() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_BundleSize"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_BundleSize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int64_t, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.set_BundleSize void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_BundleSize(int64_t value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_BundleSize"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_BundleSize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.get_UseCrcForCachedBundle bool UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_UseCrcForCachedBundle() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_UseCrcForCachedBundle"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_UseCrcForCachedBundle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.set_UseCrcForCachedBundle void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_UseCrcForCachedBundle(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_UseCrcForCachedBundle"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_UseCrcForCachedBundle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.get_ClearOtherCachedVersionsWhenLoaded bool UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_ClearOtherCachedVersionsWhenLoaded() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::get_ClearOtherCachedVersionsWhenLoaded"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ClearOtherCachedVersionsWhenLoaded", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.set_ClearOtherCachedVersionsWhenLoaded void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_ClearOtherCachedVersionsWhenLoaded(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::set_ClearOtherCachedVersionsWhenLoaded"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_ClearOtherCachedVersionsWhenLoaded", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions.ComputeSize int64_t UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::ComputeSize(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, ::UnityEngine::ResourceManagement::ResourceManager* resourceManager) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions::ComputeSize"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ComputeSize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(resourceManager)}))); return ::il2cpp_utils::RunMethodRethrow<int64_t, false>(this, ___internal__method, location, resourceManager); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource #include "UnityEngine/ResourceManagement/ResourceProviders/AssetBundleResource.hpp" // Including type: UnityEngine.AssetBundle #include "UnityEngine/AssetBundle.hpp" // Including type: UnityEngine.Networking.DownloadHandlerAssetBundle #include "UnityEngine/Networking/DownloadHandlerAssetBundle.hpp" // Including type: UnityEngine.AsyncOperation #include "UnityEngine/AsyncOperation.hpp" // Including type: UnityEngine.ResourceManagement.WebRequestQueueOperation #include "UnityEngine/ResourceManagement/WebRequestQueueOperation.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions #include "UnityEngine/ResourceManagement/ResourceProviders/AssetBundleRequestOptions.hpp" // Including type: UnityEngine.Networking.UnityWebRequest #include "UnityEngine/Networking/UnityWebRequest.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" // Including type: UnityEngine.Networking.UnityWebRequestAsyncOperation #include "UnityEngine/Networking/UnityWebRequestAsyncOperation.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private UnityEngine.AssetBundle m_AssetBundle ::UnityEngine::AssetBundle*& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_AssetBundle() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_AssetBundle"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_AssetBundle"))->offset; return *reinterpret_cast<::UnityEngine::AssetBundle**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.Networking.DownloadHandlerAssetBundle m_downloadHandler ::UnityEngine::Networking::DownloadHandlerAssetBundle*& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_downloadHandler() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_downloadHandler"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_downloadHandler"))->offset; return *reinterpret_cast<::UnityEngine::Networking::DownloadHandlerAssetBundle**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.AsyncOperation m_RequestOperation ::UnityEngine::AsyncOperation*& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_RequestOperation() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_RequestOperation"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_RequestOperation"))->offset; return *reinterpret_cast<::UnityEngine::AsyncOperation**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.WebRequestQueueOperation m_WebRequestQueueOperation ::UnityEngine::ResourceManagement::WebRequestQueueOperation*& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_WebRequestQueueOperation() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_WebRequestQueueOperation"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_WebRequestQueueOperation"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::WebRequestQueueOperation**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle m_ProvideHandle ::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_ProvideHandle() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_ProvideHandle"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ProvideHandle"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions m_Options ::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions*& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_Options() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_Options"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Options"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleRequestOptions**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_Retries int& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_Retries() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_Retries"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Retries"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int64 m_BytesToDownload int64_t& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_BytesToDownload() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_BytesToDownload"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_BytesToDownload"))->offset; return *reinterpret_cast<int64_t*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int64 m_DownloadedBytes int64_t& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_DownloadedBytes() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_DownloadedBytes"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_DownloadedBytes"))->offset; return *reinterpret_cast<int64_t*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean m_Completed bool& UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_Completed() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::dyn_m_Completed"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Completed"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource.CreateWebRequest ::UnityEngine::Networking::UnityWebRequest* UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::CreateWebRequest(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* loc) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::CreateWebRequest"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CreateWebRequest", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(loc)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Networking::UnityWebRequest*, false>(this, ___internal__method, loc); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource.PercentComplete float UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::PercentComplete() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::PercentComplete"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "PercentComplete", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource.GetDownloadStatus ::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::GetDownloadStatus() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::GetDownloadStatus"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDownloadStatus", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource.GetAssetBundle ::UnityEngine::AssetBundle* UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::GetAssetBundle() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::GetAssetBundle"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetAssetBundle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::AssetBundle*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource.Start void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::Start(::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle provideHandle) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::Start"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(provideHandle)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, provideHandle); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource.WaitForCompletionHandler bool UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::WaitForCompletionHandler() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::WaitForCompletionHandler"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WaitForCompletionHandler", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource.BeginOperation void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::BeginOperation() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::BeginOperation"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "BeginOperation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource.LocalRequestOperationCompleted void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::LocalRequestOperationCompleted(::UnityEngine::AsyncOperation* op) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::LocalRequestOperationCompleted"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "LocalRequestOperationCompleted", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(op)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, op); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource.WebRequestOperationCompleted void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::WebRequestOperationCompleted(::UnityEngine::AsyncOperation* op) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::WebRequestOperationCompleted"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WebRequestOperationCompleted", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(op)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, op); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource.Unload void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::Unload() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::Unload"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Unload", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource.<BeginOperation>b__16_0 void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::$BeginOperation$b__16_0(::UnityEngine::Networking::UnityWebRequestAsyncOperation* asyncOp) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleResource::<BeginOperation>b__16_0"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<BeginOperation>b__16_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(asyncOp)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, asyncOp); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider #include "UnityEngine/ResourceManagement/ResourceProviders/AssetBundleProvider.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle #include "UnityEngine/ResourceManagement/ResourceProviders/ProvideHandle.hpp" // Including type: System.Type #include "System/Type.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider.Provide void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleProvider::Provide(::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle providerInterface) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleProvider::Provide"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Provide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(providerInterface)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, providerInterface); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider.GetDefaultType ::System::Type* UnityEngine::ResourceManagement::ResourceProviders::AssetBundleProvider::GetDefaultType(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleProvider::GetDefaultType"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDefaultType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(location)}))); return ::il2cpp_utils::RunMethodRethrow<::System::Type*, false>(this, ___internal__method, location); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider.Release void UnityEngine::ResourceManagement::ResourceProviders::AssetBundleProvider::Release(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, ::Il2CppObject* asset) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AssetBundleProvider::Release"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Release", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(asset)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, location, asset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.AtlasSpriteProvider #include "UnityEngine/ResourceManagement/ResourceProviders/AtlasSpriteProvider.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle #include "UnityEngine/ResourceManagement/ResourceProviders/ProvideHandle.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.AtlasSpriteProvider.Provide void UnityEngine::ResourceManagement::ResourceProviders::AtlasSpriteProvider::Provide(::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle providerInterface) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::AtlasSpriteProvider::Provide"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Provide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(providerInterface)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, providerInterface); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider #include "UnityEngine/ResourceManagement/ResourceProviders/BundledAssetProvider.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp #include "UnityEngine/ResourceManagement/ResourceProviders/BundledAssetProvider_InternalOp.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle #include "UnityEngine/ResourceManagement/ResourceProviders/ProvideHandle.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider.Provide void UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::Provide(::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle provideHandle) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::Provide"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Provide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(provideHandle)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, provideHandle); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp #include "UnityEngine/ResourceManagement/ResourceProviders/BundledAssetProvider_InternalOp.hpp" // Including type: UnityEngine.AssetBundleRequest #include "UnityEngine/AssetBundleRequest.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.IAssetBundleResource #include "UnityEngine/ResourceManagement/ResourceProviders/IAssetBundleResource.hpp" // Including type: System.Collections.Generic.IList`1 #include "System/Collections/Generic/IList_1.hpp" // Including type: UnityEngine.AsyncOperation #include "UnityEngine/AsyncOperation.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private UnityEngine.AssetBundleRequest m_RequestOperation ::UnityEngine::AssetBundleRequest*& UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::dyn_m_RequestOperation() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::dyn_m_RequestOperation"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_RequestOperation"))->offset; return *reinterpret_cast<::UnityEngine::AssetBundleRequest**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle m_ProvideHandle ::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle& UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::dyn_m_ProvideHandle() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::dyn_m_ProvideHandle"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ProvideHandle"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.String subObjectName ::StringW& UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::dyn_subObjectName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::dyn_subObjectName"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "subObjectName"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp.LoadBundleFromDependecies ::UnityEngine::ResourceManagement::ResourceProviders::IAssetBundleResource* UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::LoadBundleFromDependecies(::System::Collections::Generic::IList_1<::Il2CppObject*>* results) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::LoadBundleFromDependecies"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.ResourceProviders", "BundledAssetProvider/InternalOp", "LoadBundleFromDependecies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(results)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::ResourceProviders::IAssetBundleResource*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, results); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp.Start void UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::Start(::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle provideHandle) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::Start"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(provideHandle)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, provideHandle); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp.WaitForCompletionHandler bool UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::WaitForCompletionHandler() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::WaitForCompletionHandler"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WaitForCompletionHandler", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp.ActionComplete void UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::ActionComplete(::UnityEngine::AsyncOperation* obj) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::ActionComplete"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ActionComplete", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, obj); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.BundledAssetProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp.ProgressCallback float UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::ProgressCallback() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::BundledAssetProvider::InternalOp::ProgressCallback"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ProgressCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters #include "UnityEngine/ResourceManagement/ResourceProviders/InstantiationParameters.hpp" // Including type: UnityEngine.Transform #include "UnityEngine/Transform.hpp" // Including type: UnityEngine.Object #include "UnityEngine/Object.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private UnityEngine.Vector3 m_Position ::UnityEngine::Vector3& UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::dyn_m_Position() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::dyn_m_Position"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Position"))->offset; return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.Quaternion m_Rotation ::UnityEngine::Quaternion& UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::dyn_m_Rotation() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::dyn_m_Rotation"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Rotation"))->offset; return *reinterpret_cast<::UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.Transform m_Parent ::UnityEngine::Transform*& UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::dyn_m_Parent() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::dyn_m_Parent"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Parent"))->offset; return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean m_InstantiateInWorldPosition bool& UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::dyn_m_InstantiateInWorldPosition() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::dyn_m_InstantiateInWorldPosition"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_InstantiateInWorldPosition"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean m_SetPositionRotation bool& UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::dyn_m_SetPositionRotation() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::dyn_m_SetPositionRotation"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_SetPositionRotation"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters.get_Position ::UnityEngine::Vector3 UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::get_Position() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::get_Position"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Position", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Vector3, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters.get_Rotation ::UnityEngine::Quaternion UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::get_Rotation() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::get_Rotation"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Rotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Quaternion, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters.get_Parent ::UnityEngine::Transform* UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::get_Parent() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::get_Parent"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Parent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Transform*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters.get_InstantiateInWorldPosition bool UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::get_InstantiateInWorldPosition() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::get_InstantiateInWorldPosition"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_InstantiateInWorldPosition", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters.get_SetPositionRotation bool UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::get_SetPositionRotation() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::get_SetPositionRotation"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_SetPositionRotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters..ctor UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::InstantiationParameters(::UnityEngine::Transform* parent, bool instantiateInWorldSpace) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(parent), ::il2cpp_utils::ExtractType(instantiateInWorldSpace)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, parent, instantiateInWorldSpace); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters..ctor UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::InstantiationParameters(::UnityEngine::Vector3 position, ::UnityEngine::Quaternion rotation, ::UnityEngine::Transform* parent) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(position), ::il2cpp_utils::ExtractType(rotation), ::il2cpp_utils::ExtractType(parent)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, position, rotation, parent); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.IInstanceProvider #include "UnityEngine/ResourceManagement/ResourceProviders/IInstanceProvider.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager #include "UnityEngine/ResourceManagement/ResourceManager.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1 #include "UnityEngine/ResourceManagement/AsyncOperations/AsyncOperationHandle_1.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters #include "UnityEngine/ResourceManagement/ResourceProviders/InstantiationParameters.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.IInstanceProvider.ProvideInstance ::UnityEngine::GameObject* UnityEngine::ResourceManagement::ResourceProviders::IInstanceProvider::ProvideInstance(::UnityEngine::ResourceManagement::ResourceManager* resourceManager, ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::GameObject*> prefabHandle, ::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters instantiateParameters) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::IInstanceProvider::ProvideInstance"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ProvideInstance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(resourceManager), ::il2cpp_utils::ExtractType(prefabHandle), ::il2cpp_utils::ExtractType(instantiateParameters)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::GameObject*, false>(this, ___internal__method, resourceManager, prefabHandle, instantiateParameters); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.IInstanceProvider.ReleaseInstance void UnityEngine::ResourceManagement::ResourceProviders::IInstanceProvider::ReleaseInstance(::UnityEngine::ResourceManagement::ResourceManager* resourceManager, ::UnityEngine::GameObject* instance) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::IInstanceProvider::ReleaseInstance"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReleaseInstance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(resourceManager), ::il2cpp_utils::ExtractType(instance)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, resourceManager, instance); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.ProviderBehaviourFlags #include "UnityEngine/ResourceManagement/ResourceProviders/ProviderBehaviourFlags.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public UnityEngine.ResourceManagement.ResourceProviders.ProviderBehaviourFlags None ::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags::_get_None() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags::_get_None"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags>("UnityEngine.ResourceManagement.ResourceProviders", "ProviderBehaviourFlags", "None")); } // Autogenerated static field setter // Set static field: static public UnityEngine.ResourceManagement.ResourceProviders.ProviderBehaviourFlags None void UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags::_set_None(::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags::_set_None"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.ResourceProviders", "ProviderBehaviourFlags", "None", value)); } // Autogenerated static field getter // Get static field: static public UnityEngine.ResourceManagement.ResourceProviders.ProviderBehaviourFlags CanProvideWithFailedDependencies ::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags::_get_CanProvideWithFailedDependencies() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags::_get_CanProvideWithFailedDependencies"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags>("UnityEngine.ResourceManagement.ResourceProviders", "ProviderBehaviourFlags", "CanProvideWithFailedDependencies")); } // Autogenerated static field setter // Set static field: static public UnityEngine.ResourceManagement.ResourceProviders.ProviderBehaviourFlags CanProvideWithFailedDependencies void UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags::_set_CanProvideWithFailedDependencies(::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags::_set_CanProvideWithFailedDependencies"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.ResourceProviders", "ProviderBehaviourFlags", "CanProvideWithFailedDependencies", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle #include "UnityEngine/ResourceManagement/ResourceProviders/ProvideHandle.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.IGenericProviderOperation #include "UnityEngine/ResourceManagement/AsyncOperations/IGenericProviderOperation.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager #include "UnityEngine/ResourceManagement/ResourceManager.hpp" // Including type: System.Type #include "System/Type.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" // Including type: System.Collections.Generic.IList`1 #include "System/Collections/Generic/IList_1.hpp" // Including type: System.Func`1 #include "System/Func_1.hpp" // Including type: System.Exception #include "System/Exception.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Int32 m_Version int& UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::dyn_m_Version() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::dyn_m_Version"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Version"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.AsyncOperations.IGenericProviderOperation m_InternalOp ::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation*& UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::dyn_m_InternalOp() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::dyn_m_InternalOp"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_InternalOp"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.ResourceManager m_ResourceManager ::UnityEngine::ResourceManagement::ResourceManager*& UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::dyn_m_ResourceManager() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::dyn_m_ResourceManager"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ResourceManager"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle.get_InternalOp ::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation* UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::get_InternalOp() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::get_InternalOp"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_InternalOp", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle.get_ResourceManager ::UnityEngine::ResourceManagement::ResourceManager* UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::get_ResourceManager() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::get_ResourceManager"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_ResourceManager", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::ResourceManager*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle.get_Type ::System::Type* UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::get_Type() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::get_Type"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Type", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Type*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle.get_Location ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::get_Location() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::get_Location"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Location", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle.get_DependencyCount int UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::get_DependencyCount() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::get_DependencyCount"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_DependencyCount", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle..ctor UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::ProvideHandle(::UnityEngine::ResourceManagement::ResourceManager* rm, ::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation* op) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rm), ::il2cpp_utils::ExtractType(op)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, rm, op); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle.GetDependencies void UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::GetDependencies(::System::Collections::Generic::IList_1<::Il2CppObject*>* list) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::GetDependencies"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "GetDependencies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(list)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, list); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle.SetProgressCallback void UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::SetProgressCallback(::System::Func_1<float>* callback) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::SetProgressCallback"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "SetProgressCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(callback)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, callback); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle.SetDownloadProgressCallbacks void UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::SetDownloadProgressCallbacks(::System::Func_1<::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus>* callback) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::SetDownloadProgressCallbacks"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "SetDownloadProgressCallbacks", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(callback)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, callback); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle.SetWaitForCompletionCallback void UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::SetWaitForCompletionCallback(::System::Func_1<bool>* callback) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle::SetWaitForCompletionCallback"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "SetWaitForCompletionCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(callback)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, callback); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceProviders.IResourceProvider #include "UnityEngine/ResourceManagement/ResourceProviders/IResourceProvider.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.ProviderBehaviourFlags #include "UnityEngine/ResourceManagement/ResourceProviders/ProviderBehaviourFlags.hpp" // Including type: System.Type #include "System/Type.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle #include "UnityEngine/ResourceManagement/ResourceProviders/ProvideHandle.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.IResourceProvider.get_ProviderId ::StringW UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider::get_ProviderId() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider::get_ProviderId"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ProviderId", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.IResourceProvider.get_BehaviourFlags ::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider::get_BehaviourFlags() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider::get_BehaviourFlags"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_BehaviourFlags", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.IResourceProvider.GetDefaultType ::System::Type* UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider::GetDefaultType(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider::GetDefaultType"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDefaultType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(location)}))); return ::il2cpp_utils::RunMethodRethrow<::System::Type*, false>(this, ___internal__method, location); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.IResourceProvider.CanProvide bool UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider::CanProvide(::System::Type* type, ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider::CanProvide"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CanProvide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(type), ::il2cpp_utils::ExtractType(location)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, type, location); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.IResourceProvider.Provide void UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider::Provide(::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle provideHandle) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider::Provide"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Provide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(provideHandle)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, provideHandle); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.IResourceProvider.Release void UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider::Release(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, ::Il2CppObject* asset) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider::Release"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Release", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(asset)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, location, asset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceProviders.SceneInstance #include "UnityEngine/ResourceManagement/ResourceProviders/SceneInstance.hpp" // Including type: UnityEngine.AsyncOperation #include "UnityEngine/AsyncOperation.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private UnityEngine.SceneManagement.Scene m_Scene ::UnityEngine::SceneManagement::Scene& UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::dyn_m_Scene() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::dyn_m_Scene"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Scene"))->offset; return *reinterpret_cast<::UnityEngine::SceneManagement::Scene*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: UnityEngine.AsyncOperation m_Operation ::UnityEngine::AsyncOperation*& UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::dyn_m_Operation() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::dyn_m_Operation"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Operation"))->offset; return *reinterpret_cast<::UnityEngine::AsyncOperation**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneInstance.get_Scene ::UnityEngine::SceneManagement::Scene UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::get_Scene() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::get_Scene"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Scene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::SceneManagement::Scene, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneInstance.set_Scene void UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::set_Scene(::UnityEngine::SceneManagement::Scene value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::set_Scene"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "set_Scene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneInstance.Activate void UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::Activate() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::Activate"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "Activate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneInstance.ActivateAsync ::UnityEngine::AsyncOperation* UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::ActivateAsync() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::ActivateAsync"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "ActivateAsync", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::AsyncOperation*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneInstance.GetHashCode int UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::GetHashCode() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::GetHashCode"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneInstance.Equals bool UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::Equals(::Il2CppObject* obj) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance::Equals"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "Equals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, obj); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.ISceneProvider #include "UnityEngine/ResourceManagement/ResourceProviders/ISceneProvider.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1 #include "UnityEngine/ResourceManagement/AsyncOperations/AsyncOperationHandle_1.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager #include "UnityEngine/ResourceManagement/ResourceManager.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" // Including type: UnityEngine.SceneManagement.LoadSceneMode #include "UnityEngine/SceneManagement/LoadSceneMode.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ISceneProvider.ProvideScene ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance> UnityEngine::ResourceManagement::ResourceProviders::ISceneProvider::ProvideScene(::UnityEngine::ResourceManagement::ResourceManager* resourceManager, ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, ::UnityEngine::SceneManagement::LoadSceneMode loadMode, bool activateOnLoad, int priority) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ISceneProvider::ProvideScene"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ProvideScene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(resourceManager), ::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(loadMode), ::il2cpp_utils::ExtractType(activateOnLoad), ::il2cpp_utils::ExtractType(priority)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance>, false>(this, ___internal__method, resourceManager, location, loadMode, activateOnLoad, priority); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ISceneProvider.ReleaseScene ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance> UnityEngine::ResourceManagement::ResourceProviders::ISceneProvider::ReleaseScene(::UnityEngine::ResourceManagement::ResourceManager* resourceManager, ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance> sceneLoadHandle) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ISceneProvider::ReleaseScene"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReleaseScene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(resourceManager), ::il2cpp_utils::ExtractType(sceneLoadHandle)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance>, false>(this, ___internal__method, resourceManager, sceneLoadHandle); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider #include "UnityEngine/ResourceManagement/ResourceProviders/InstanceProvider.hpp" // Including type: System.Collections.Generic.Dictionary`2 #include "System/Collections/Generic/Dictionary_2.hpp" // Including type: UnityEngine.GameObject #include "UnityEngine/GameObject.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager #include "UnityEngine/ResourceManagement/ResourceManager.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters #include "UnityEngine/ResourceManagement/ResourceProviders/InstantiationParameters.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.Dictionary`2<UnityEngine.GameObject,UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.GameObject>> m_InstanceObjectToPrefabHandle ::System::Collections::Generic::Dictionary_2<::UnityEngine::GameObject*, ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::GameObject*>>*& UnityEngine::ResourceManagement::ResourceProviders::InstanceProvider::dyn_m_InstanceObjectToPrefabHandle() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstanceProvider::dyn_m_InstanceObjectToPrefabHandle"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_InstanceObjectToPrefabHandle"))->offset; return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<::UnityEngine::GameObject*, ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::GameObject*>>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider.ProvideInstance ::UnityEngine::GameObject* UnityEngine::ResourceManagement::ResourceProviders::InstanceProvider::ProvideInstance(::UnityEngine::ResourceManagement::ResourceManager* resourceManager, ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::GameObject*> prefabHandle, ::UnityEngine::ResourceManagement::ResourceProviders::InstantiationParameters instantiateParameters) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstanceProvider::ProvideInstance"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ProvideInstance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(resourceManager), ::il2cpp_utils::ExtractType(prefabHandle), ::il2cpp_utils::ExtractType(instantiateParameters)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::GameObject*, false>(this, ___internal__method, resourceManager, prefabHandle, instantiateParameters); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.InstanceProvider.ReleaseInstance void UnityEngine::ResourceManagement::ResourceProviders::InstanceProvider::ReleaseInstance(::UnityEngine::ResourceManagement::ResourceManager* resourceManager, ::UnityEngine::GameObject* instance) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::InstanceProvider::ReleaseInstance"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReleaseInstance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(resourceManager), ::il2cpp_utils::ExtractType(instance)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, resourceManager, instance); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceProviders.JsonAssetProvider #include "UnityEngine/ResourceManagement/ResourceProviders/JsonAssetProvider.hpp" // Including type: System.Type #include "System/Type.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.JsonAssetProvider.Convert ::Il2CppObject* UnityEngine::ResourceManagement::ResourceProviders::JsonAssetProvider::Convert(::System::Type* type, ::StringW text) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::JsonAssetProvider::Convert"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Convert", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(type), ::il2cpp_utils::ExtractType(text)}))); return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method, type, text); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider #include "UnityEngine/ResourceManagement/ResourceProviders/LegacyResourcesProvider.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp #include "UnityEngine/ResourceManagement/ResourceProviders/LegacyResourcesProvider_InternalOp.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle #include "UnityEngine/ResourceManagement/ResourceProviders/ProvideHandle.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider.Provide void UnityEngine::ResourceManagement::ResourceProviders::LegacyResourcesProvider::Provide(::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle pi) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::LegacyResourcesProvider::Provide"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Provide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(pi)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, pi); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider.Release void UnityEngine::ResourceManagement::ResourceProviders::LegacyResourcesProvider::Release(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, ::Il2CppObject* asset) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::LegacyResourcesProvider::Release"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Release", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(asset)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, location, asset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp #include "UnityEngine/ResourceManagement/ResourceProviders/LegacyResourcesProvider_InternalOp.hpp" // Including type: UnityEngine.AsyncOperation #include "UnityEngine/AsyncOperation.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private UnityEngine.AsyncOperation m_RequestOperation ::UnityEngine::AsyncOperation*& UnityEngine::ResourceManagement::ResourceProviders::LegacyResourcesProvider::InternalOp::dyn_m_RequestOperation() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::LegacyResourcesProvider::InternalOp::dyn_m_RequestOperation"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_RequestOperation"))->offset; return *reinterpret_cast<::UnityEngine::AsyncOperation**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle m_ProvideHandle ::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle& UnityEngine::ResourceManagement::ResourceProviders::LegacyResourcesProvider::InternalOp::dyn_m_ProvideHandle() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::LegacyResourcesProvider::InternalOp::dyn_m_ProvideHandle"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ProvideHandle"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp.Start void UnityEngine::ResourceManagement::ResourceProviders::LegacyResourcesProvider::InternalOp::Start(::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle provideHandle) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::LegacyResourcesProvider::InternalOp::Start"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(provideHandle)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, provideHandle); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp.AsyncOperationCompleted void UnityEngine::ResourceManagement::ResourceProviders::LegacyResourcesProvider::InternalOp::AsyncOperationCompleted(::UnityEngine::AsyncOperation* op) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::LegacyResourcesProvider::InternalOp::AsyncOperationCompleted"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AsyncOperationCompleted", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(op)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, op); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.LegacyResourcesProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp.PercentComplete float UnityEngine::ResourceManagement::ResourceProviders::LegacyResourcesProvider::InternalOp::PercentComplete() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::LegacyResourcesProvider::InternalOp::PercentComplete"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "PercentComplete", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase #include "UnityEngine/ResourceManagement/ResourceProviders/ResourceProviderBase.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase/UnityEngine.ResourceManagement.ResourceProviders.BaseInitAsyncOp #include "UnityEngine/ResourceManagement/ResourceProviders/ResourceProviderBase_BaseInitAsyncOp.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase/UnityEngine.ResourceManagement.ResourceProviders.<>c__DisplayClass10_0 #include "UnityEngine/ResourceManagement/ResourceProviders/ResourceProviderBase_--c__DisplayClass10_0.hpp" // Including type: System.Type #include "System/Type.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle #include "UnityEngine/ResourceManagement/ResourceProviders/ProvideHandle.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1 #include "UnityEngine/ResourceManagement/AsyncOperations/AsyncOperationHandle_1.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager #include "UnityEngine/ResourceManagement/ResourceManager.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: protected System.String m_ProviderId ::StringW& UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::dyn_m_ProviderId() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::dyn_m_ProviderId"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ProviderId"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: protected UnityEngine.ResourceManagement.ResourceProviders.ProviderBehaviourFlags m_BehaviourFlags ::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags& UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::dyn_m_BehaviourFlags() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::dyn_m_BehaviourFlags"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_BehaviourFlags"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase.get_ProviderId ::StringW UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::get_ProviderId() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::get_ProviderId"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ProviderId", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase.UnityEngine.ResourceManagement.ResourceProviders.IResourceProvider.get_BehaviourFlags ::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::UnityEngine_ResourceManagement_ResourceProviders_IResourceProvider_get_BehaviourFlags() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::UnityEngine.ResourceManagement.ResourceProviders.IResourceProvider.get_BehaviourFlags"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UnityEngine.ResourceManagement.ResourceProviders.IResourceProvider.get_BehaviourFlags", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::ResourceProviders::ProviderBehaviourFlags, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase.Initialize bool UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::Initialize(::StringW id, ::StringW data) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::Initialize"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Initialize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(id), ::il2cpp_utils::ExtractType(data)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, id, data); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase.CanProvide bool UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::CanProvide(::System::Type* t, ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::CanProvide"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CanProvide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(location)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, t, location); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase.Release void UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::Release(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, ::Il2CppObject* obj) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::Release"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Release", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(obj)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, location, obj); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase.GetDefaultType ::System::Type* UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::GetDefaultType(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::GetDefaultType"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDefaultType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(location)}))); return ::il2cpp_utils::RunMethodRethrow<::System::Type*, false>(this, ___internal__method, location); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase.Provide void UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::Provide(::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle provideHandle) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::Provide"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Provide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(provideHandle)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, provideHandle); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase.InitializeAsync ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<bool> UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::InitializeAsync(::UnityEngine::ResourceManagement::ResourceManager* rm, ::StringW id, ::StringW data) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::InitializeAsync"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InitializeAsync", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rm), ::il2cpp_utils::ExtractType(id), ::il2cpp_utils::ExtractType(data)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<bool>, false>(this, ___internal__method, rm, id, data); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase.ToString ::StringW UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::ToString() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::ToString"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase/UnityEngine.ResourceManagement.ResourceProviders.BaseInitAsyncOp #include "UnityEngine/ResourceManagement/ResourceProviders/ResourceProviderBase_BaseInitAsyncOp.hpp" // Including type: System.Func`1 #include "System/Func_1.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Func`1<System.Boolean> m_CallBack ::System::Func_1<bool>*& UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::BaseInitAsyncOp::dyn_m_CallBack() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::BaseInitAsyncOp::dyn_m_CallBack"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_CallBack"))->offset; return *reinterpret_cast<::System::Func_1<bool>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase/UnityEngine.ResourceManagement.ResourceProviders.BaseInitAsyncOp.Init void UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::BaseInitAsyncOp::Init(::System::Func_1<bool>* callback) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::BaseInitAsyncOp::Init"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Init", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(callback)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, callback); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase/UnityEngine.ResourceManagement.ResourceProviders.BaseInitAsyncOp.InvokeWaitForCompletion bool UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::BaseInitAsyncOp::InvokeWaitForCompletion() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::BaseInitAsyncOp::InvokeWaitForCompletion"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InvokeWaitForCompletion", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase/UnityEngine.ResourceManagement.ResourceProviders.BaseInitAsyncOp.Execute void UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::BaseInitAsyncOp::Execute() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::BaseInitAsyncOp::Execute"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Execute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase/UnityEngine.ResourceManagement.ResourceProviders.<>c__DisplayClass10_0 #include "UnityEngine/ResourceManagement/ResourceProviders/ResourceProviderBase_--c__DisplayClass10_0.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase <>4__this ::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase*& UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::$$c__DisplayClass10_0::dyn_$$4__this() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::$$c__DisplayClass10_0::dyn_$$4__this"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String id ::StringW& UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::$$c__DisplayClass10_0::dyn_id() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::$$c__DisplayClass10_0::dyn_id"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "id"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.String data ::StringW& UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::$$c__DisplayClass10_0::dyn_data() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::$$c__DisplayClass10_0::dyn_data"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "data"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ResourceProviderBase/UnityEngine.ResourceManagement.ResourceProviders.<>c__DisplayClass10_0.<InitializeAsync>b__0 bool UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::$$c__DisplayClass10_0::$InitializeAsync$b__0() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ResourceProviderBase::$$c__DisplayClass10_0::<InitializeAsync>b__0"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<InitializeAsync>b__0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.ProviderLoadRequestOptions #include "UnityEngine/ResourceManagement/ResourceProviders/ProviderLoadRequestOptions.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Boolean m_IgnoreFailures bool& UnityEngine::ResourceManagement::ResourceProviders::ProviderLoadRequestOptions::dyn_m_IgnoreFailures() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProviderLoadRequestOptions::dyn_m_IgnoreFailures"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_IgnoreFailures"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ProviderLoadRequestOptions.get_IgnoreFailures bool UnityEngine::ResourceManagement::ResourceProviders::ProviderLoadRequestOptions::get_IgnoreFailures() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProviderLoadRequestOptions::get_IgnoreFailures"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IgnoreFailures", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.ProviderLoadRequestOptions.set_IgnoreFailures void UnityEngine::ResourceManagement::ResourceProviders::ProviderLoadRequestOptions::set_IgnoreFailures(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::ProviderLoadRequestOptions::set_IgnoreFailures"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_IgnoreFailures", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider #include "UnityEngine/ResourceManagement/ResourceProviders/SceneProvider.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.SceneOp #include "UnityEngine/ResourceManagement/ResourceProviders/SceneProvider_SceneOp.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.UnloadSceneOp #include "UnityEngine/ResourceManagement/ResourceProviders/SceneProvider_UnloadSceneOp.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1 #include "UnityEngine/ResourceManagement/AsyncOperations/AsyncOperationHandle_1.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager #include "UnityEngine/ResourceManagement/ResourceManager.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" // Including type: UnityEngine.SceneManagement.LoadSceneMode #include "UnityEngine/SceneManagement/LoadSceneMode.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider.ProvideScene ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance> UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::ProvideScene(::UnityEngine::ResourceManagement::ResourceManager* resourceManager, ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, ::UnityEngine::SceneManagement::LoadSceneMode loadMode, bool activateOnLoad, int priority) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::ProvideScene"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ProvideScene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(resourceManager), ::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(loadMode), ::il2cpp_utils::ExtractType(activateOnLoad), ::il2cpp_utils::ExtractType(priority)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance>, false>(this, ___internal__method, resourceManager, location, loadMode, activateOnLoad, priority); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider.ReleaseScene ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance> UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::ReleaseScene(::UnityEngine::ResourceManagement::ResourceManager* resourceManager, ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance> sceneLoadHandle) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::ReleaseScene"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReleaseScene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(resourceManager), ::il2cpp_utils::ExtractType(sceneLoadHandle)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance>, false>(this, ___internal__method, resourceManager, sceneLoadHandle); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.SceneOp #include "UnityEngine/ResourceManagement/ResourceProviders/SceneProvider_SceneOp.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" // Including type: System.Collections.Generic.IList`1 #include "System/Collections/Generic/IList_1.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager #include "UnityEngine/ResourceManagement/ResourceManager.hpp" // Including type: UnityEngine.AsyncOperation #include "UnityEngine/AsyncOperation.hpp" // Including type: System.Collections.Generic.HashSet`1 #include "System/Collections/Generic/HashSet_1.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Boolean m_ActivateOnLoad bool& UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::dyn_m_ActivateOnLoad() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::dyn_m_ActivateOnLoad"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ActivateOnLoad"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.ResourceProviders.SceneInstance m_Inst ::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance& UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::dyn_m_Inst() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::dyn_m_Inst"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Inst"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation m_Location ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*& UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::dyn_m_Location() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::dyn_m_Location"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Location"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.SceneManagement.LoadSceneMode m_LoadMode ::UnityEngine::SceneManagement::LoadSceneMode& UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::dyn_m_LoadMode() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::dyn_m_LoadMode"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_LoadMode"))->offset; return *reinterpret_cast<::UnityEngine::SceneManagement::LoadSceneMode*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_Priority int& UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::dyn_m_Priority() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::dyn_m_Priority"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Priority"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<System.Collections.Generic.IList`1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle>> m_DepOp ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>*>& UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::dyn_m_DepOp() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::dyn_m_DepOp"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_DepOp"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.ResourceManager m_ResourceManager ::UnityEngine::ResourceManagement::ResourceManager*& UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::dyn_m_ResourceManager() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::dyn_m_ResourceManager"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ResourceManager"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.SceneOp.Init void UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::Init(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, ::UnityEngine::SceneManagement::LoadSceneMode loadMode, bool activateOnLoad, int priority, ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>*> depOp) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::Init"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Init", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(loadMode), ::il2cpp_utils::ExtractType(activateOnLoad), ::il2cpp_utils::ExtractType(priority), ::il2cpp_utils::ExtractType(depOp)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, location, loadMode, activateOnLoad, priority, depOp); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.SceneOp.InternalLoadScene ::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::InternalLoadScene(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, bool loadingFromBundle, ::UnityEngine::SceneManagement::LoadSceneMode loadMode, bool activateOnLoad, int priority) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::InternalLoadScene"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InternalLoadScene", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(loadingFromBundle), ::il2cpp_utils::ExtractType(loadMode), ::il2cpp_utils::ExtractType(activateOnLoad), ::il2cpp_utils::ExtractType(priority)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance, false>(this, ___internal__method, location, loadingFromBundle, loadMode, activateOnLoad, priority); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.SceneOp.InternalLoad ::UnityEngine::AsyncOperation* UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::InternalLoad(::StringW path, bool loadingFromBundle, ::UnityEngine::SceneManagement::LoadSceneMode mode) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::InternalLoad"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InternalLoad", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(path), ::il2cpp_utils::ExtractType(loadingFromBundle), ::il2cpp_utils::ExtractType(mode)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::AsyncOperation*, false>(this, ___internal__method, path, loadingFromBundle, mode); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.SceneOp.UnityEngine.ResourceManagement.IUpdateReceiver.Update void UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::UnityEngine_ResourceManagement_IUpdateReceiver_Update(float unscaledDeltaTime) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::UnityEngine.ResourceManagement.IUpdateReceiver.Update"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UnityEngine.ResourceManagement.IUpdateReceiver.Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(unscaledDeltaTime)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, unscaledDeltaTime); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.SceneOp.get_DebugName ::StringW UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::get_DebugName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::get_DebugName"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_DebugName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.SceneOp.get_Progress float UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::get_Progress() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::get_Progress"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Progress", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.SceneOp.GetDownloadStatus ::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::GetDownloadStatus(::System::Collections::Generic::HashSet_1<::Il2CppObject*>* visited) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::GetDownloadStatus"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDownloadStatus", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(visited)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus, false>(this, ___internal__method, visited); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.SceneOp.InvokeWaitForCompletion bool UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::InvokeWaitForCompletion() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::InvokeWaitForCompletion"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InvokeWaitForCompletion", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.SceneOp.GetDependencies void UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::GetDependencies(::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* deps) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::GetDependencies"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDependencies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(deps)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, deps); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.SceneOp.Execute void UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::Execute() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::Execute"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Execute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.SceneOp.Destroy void UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::Destroy() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::SceneOp::Destroy"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Destroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.UnloadSceneOp #include "UnityEngine/ResourceManagement/ResourceProviders/SceneProvider_UnloadSceneOp.hpp" // Including type: UnityEngine.AsyncOperation #include "UnityEngine/AsyncOperation.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.ResourceProviders.SceneInstance m_Instance ::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance& UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::dyn_m_Instance() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::dyn_m_Instance"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Instance"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.ResourceManagement.ResourceProviders.SceneInstance> m_sceneLoadHandle ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance>& UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::dyn_m_sceneLoadHandle() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::dyn_m_sceneLoadHandle"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_sceneLoadHandle"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.UnloadSceneOp.Init void UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::Init(::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::UnityEngine::ResourceManagement::ResourceProviders::SceneInstance> sceneLoadHandle) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::Init"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Init", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(sceneLoadHandle)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, sceneLoadHandle); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.UnloadSceneOp.UnloadSceneCompleted void UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::UnloadSceneCompleted(::UnityEngine::AsyncOperation* obj) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::UnloadSceneCompleted"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UnloadSceneCompleted", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, obj); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.UnloadSceneOp.UnloadSceneCompletedNoRelease void UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::UnloadSceneCompletedNoRelease(::UnityEngine::AsyncOperation* obj) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::UnloadSceneCompletedNoRelease"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UnloadSceneCompletedNoRelease", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, obj); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.UnloadSceneOp.get_Progress float UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::get_Progress() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::get_Progress"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Progress", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.UnloadSceneOp.Execute void UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::Execute() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::Execute"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Execute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.SceneProvider/UnityEngine.ResourceManagement.ResourceProviders.UnloadSceneOp.InvokeWaitForCompletion bool UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::InvokeWaitForCompletion() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::SceneProvider::UnloadSceneOp::InvokeWaitForCompletion"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InvokeWaitForCompletion", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider #include "UnityEngine/ResourceManagement/ResourceProviders/TextDataProvider.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp #include "UnityEngine/ResourceManagement/ResourceProviders/TextDataProvider_InternalOp.hpp" // Including type: System.Type #include "System/Type.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle #include "UnityEngine/ResourceManagement/ResourceProviders/ProvideHandle.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Boolean <IgnoreFailures>k__BackingField bool& UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::dyn_$IgnoreFailures$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::dyn_$IgnoreFailures$k__BackingField"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<IgnoreFailures>k__BackingField"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider.get_IgnoreFailures bool UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::get_IgnoreFailures() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::get_IgnoreFailures"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IgnoreFailures", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider.set_IgnoreFailures void UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::set_IgnoreFailures(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::set_IgnoreFailures"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_IgnoreFailures", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider.Convert ::Il2CppObject* UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::Convert(::System::Type* type, ::StringW text) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::Convert"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Convert", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(type), ::il2cpp_utils::ExtractType(text)}))); return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method, type, text); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider.Provide void UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::Provide(::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle provideHandle) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::Provide"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Provide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(provideHandle)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, provideHandle); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp #include "UnityEngine/ResourceManagement/ResourceProviders/TextDataProvider_InternalOp.hpp" // Including type: UnityEngine.Networking.UnityWebRequestAsyncOperation #include "UnityEngine/Networking/UnityWebRequestAsyncOperation.hpp" // Including type: UnityEngine.ResourceManagement.WebRequestQueueOperation #include "UnityEngine/ResourceManagement/WebRequestQueueOperation.hpp" // Including type: UnityEngine.AsyncOperation #include "UnityEngine/AsyncOperation.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider m_Provider ::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider*& UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::dyn_m_Provider() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::dyn_m_Provider"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Provider"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.Networking.UnityWebRequestAsyncOperation m_RequestOperation ::UnityEngine::Networking::UnityWebRequestAsyncOperation*& UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::dyn_m_RequestOperation() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::dyn_m_RequestOperation"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_RequestOperation"))->offset; return *reinterpret_cast<::UnityEngine::Networking::UnityWebRequestAsyncOperation**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.WebRequestQueueOperation m_RequestQueueOperation ::UnityEngine::ResourceManagement::WebRequestQueueOperation*& UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::dyn_m_RequestQueueOperation() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::dyn_m_RequestQueueOperation"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_RequestQueueOperation"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::WebRequestQueueOperation**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle m_PI ::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle& UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::dyn_m_PI() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::dyn_m_PI"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_PI"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean m_IgnoreFailures bool& UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::dyn_m_IgnoreFailures() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::dyn_m_IgnoreFailures"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_IgnoreFailures"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean m_Complete bool& UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::dyn_m_Complete() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::dyn_m_Complete"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Complete"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp.GetPercentComplete float UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::GetPercentComplete() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::GetPercentComplete"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetPercentComplete", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp.Start void UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::Start(::UnityEngine::ResourceManagement::ResourceProviders::ProvideHandle provideHandle, ::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider* rawProvider, bool ignoreFailures) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::Start"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(provideHandle), ::il2cpp_utils::ExtractType(rawProvider), ::il2cpp_utils::ExtractType(ignoreFailures)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, provideHandle, rawProvider, ignoreFailures); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp.WaitForCompletionHandler bool UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::WaitForCompletionHandler() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::WaitForCompletionHandler"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WaitForCompletionHandler", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp.RequestOperation_completed void UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::RequestOperation_completed(::UnityEngine::AsyncOperation* op) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::RequestOperation_completed"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "RequestOperation_completed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(op)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, op); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp.ConvertText ::Il2CppObject* UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::ConvertText(::StringW text) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::ConvertText"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ConvertText", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text)}))); return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method, text); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider/UnityEngine.ResourceManagement.ResourceProviders.InternalOp.<Start>b__7_0 void UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::$Start$b__7_0(::UnityEngine::Networking::UnityWebRequestAsyncOperation* asyncOperation) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceProviders::TextDataProvider::InternalOp::<Start>b__7_0"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<Start>b__7_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(asyncOperation)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, asyncOperation); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.ResourceLocations.ILocationSizeData #include "UnityEngine/ResourceManagement/ResourceLocations/ILocationSizeData.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager #include "UnityEngine/ResourceManagement/ResourceManager.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.ILocationSizeData.ComputeSize int64_t UnityEngine::ResourceManagement::ResourceLocations::ILocationSizeData::ComputeSize(::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, ::UnityEngine::ResourceManagement::ResourceManager* resourceManager) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ILocationSizeData::ComputeSize"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ComputeSize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(resourceManager)}))); return ::il2cpp_utils::RunMethodRethrow<int64_t, false>(this, ___internal__method, location, resourceManager); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" // Including type: System.Collections.Generic.IList`1 #include "System/Collections/Generic/IList_1.hpp" // Including type: System.Type #include "System/Type.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation.get_InternalId ::StringW UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_InternalId() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_InternalId"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_InternalId", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation.get_ProviderId ::StringW UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_ProviderId() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_ProviderId"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ProviderId", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation.get_Dependencies ::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*>* UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_Dependencies() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_Dependencies"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Dependencies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*>*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation.get_DependencyHashCode int UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_DependencyHashCode() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_DependencyHashCode"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_DependencyHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation.get_HasDependencies bool UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_HasDependencies() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_HasDependencies"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_HasDependencies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation.get_Data ::Il2CppObject* UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_Data() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_Data"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Data", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation.get_PrimaryKey ::StringW UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_PrimaryKey() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_PrimaryKey"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_PrimaryKey", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation.get_ResourceType ::System::Type* UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_ResourceType() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::get_ResourceType"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ResourceType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Type*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation.Hash int UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::Hash(::System::Type* resultType) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation::Hash"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Hash", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(resultType)}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method, resultType); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.ResourceLocations.ResourceLocationBase #include "UnityEngine/ResourceManagement/ResourceLocations/ResourceLocationBase.hpp" // Including type: System.Type #include "System/Type.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: System.Collections.Generic.IList`1 #include "System/Collections/Generic/IList_1.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.String m_Name ::StringW& UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_Name() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_Name"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Name"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.String m_Id ::StringW& UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_Id() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_Id"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Id"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.String m_ProviderId ::StringW& UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_ProviderId() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_ProviderId"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ProviderId"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Object m_Data ::Il2CppObject*& UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_Data() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_Data"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Data"))->offset; return *reinterpret_cast<::Il2CppObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_DependencyHashCode int& UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_DependencyHashCode() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_DependencyHashCode"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_DependencyHashCode"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_HashCode int& UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_HashCode() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_HashCode"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_HashCode"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Type m_Type ::System::Type*& UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_Type() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_Type"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Type"))->offset; return *reinterpret_cast<::System::Type**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.List`1<UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation> m_Dependencies ::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*>*& UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_Dependencies() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_Dependencies"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Dependencies"))->offset; return *reinterpret_cast<::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.String m_PrimaryKey ::StringW& UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_PrimaryKey() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::dyn_m_PrimaryKey"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_PrimaryKey"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.ResourceLocationBase.get_InternalId ::StringW UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_InternalId() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_InternalId"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_InternalId", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.ResourceLocationBase.get_ProviderId ::StringW UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_ProviderId() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_ProviderId"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ProviderId", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.ResourceLocationBase.get_Dependencies ::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*>* UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_Dependencies() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_Dependencies"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Dependencies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*>*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.ResourceLocationBase.get_HasDependencies bool UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_HasDependencies() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_HasDependencies"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_HasDependencies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.ResourceLocationBase.get_Data ::Il2CppObject* UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_Data() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_Data"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Data", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.ResourceLocationBase.set_Data void UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::set_Data(::Il2CppObject* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::set_Data"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Data", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.ResourceLocationBase.get_PrimaryKey ::StringW UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_PrimaryKey() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_PrimaryKey"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_PrimaryKey", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.ResourceLocationBase.set_PrimaryKey void UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::set_PrimaryKey(::StringW value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::set_PrimaryKey"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_PrimaryKey", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.ResourceLocationBase.get_DependencyHashCode int UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_DependencyHashCode() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_DependencyHashCode"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_DependencyHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.ResourceLocationBase.get_ResourceType ::System::Type* UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_ResourceType() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::get_ResourceType"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ResourceType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Type*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.ResourceLocationBase.Hash int UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::Hash(::System::Type* t) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::Hash"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Hash", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t)}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method, t); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.ResourceLocationBase.ComputeDependencyHash void UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::ComputeDependencyHash() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::ComputeDependencyHash"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ComputeDependencyHash", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.ResourceLocations.ResourceLocationBase.ToString ::StringW UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::ToString() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::ResourceLocations::ResourceLocationBase::ToString"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent #include "UnityEngine/ResourceManagement/Diagnostics/DiagnosticEvent.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.String m_Graph ::StringW& UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::dyn_m_Graph() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::dyn_m_Graph"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Graph"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32[] m_Dependencies ::ArrayW<int>& UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::dyn_m_Dependencies() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::dyn_m_Dependencies"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Dependencies"))->offset; return *reinterpret_cast<::ArrayW<int>*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_ObjectId int& UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::dyn_m_ObjectId() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::dyn_m_ObjectId"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ObjectId"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.String m_DisplayName ::StringW& UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::dyn_m_DisplayName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::dyn_m_DisplayName"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_DisplayName"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_Stream int& UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::dyn_m_Stream() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::dyn_m_Stream"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Stream"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_Frame int& UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::dyn_m_Frame() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::dyn_m_Frame"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Frame"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_Value int& UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::dyn_m_Value() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::dyn_m_Value"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Value"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent.get_Graph ::StringW UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::get_Graph() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::get_Graph"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Graph", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent.get_ObjectId int UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::get_ObjectId() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::get_ObjectId"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_ObjectId", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent.get_DisplayName ::StringW UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::get_DisplayName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::get_DisplayName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_DisplayName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent.get_Dependencies ::ArrayW<int> UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::get_Dependencies() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::get_Dependencies"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Dependencies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::ArrayW<int>, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent.get_Stream int UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::get_Stream() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::get_Stream"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Stream", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent.get_Frame int UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::get_Frame() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::get_Frame"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Frame", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent.get_Value int UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::get_Value() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::get_Value"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Value", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent..ctor UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::DiagnosticEvent(::StringW graph, ::StringW name, int id, int stream, int frame, int value, ::ArrayW<int> deps) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(graph), ::il2cpp_utils::ExtractType(name), ::il2cpp_utils::ExtractType(id), ::il2cpp_utils::ExtractType(stream), ::il2cpp_utils::ExtractType(frame), ::il2cpp_utils::ExtractType(value), ::il2cpp_utils::ExtractType(deps)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, graph, name, id, stream, frame, value, deps); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent.Serialize ::ArrayW<uint8_t> UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::Serialize() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::Serialize"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "Serialize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::ArrayW<uint8_t>, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent.Deserialize ::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::Deserialize(::ArrayW<uint8_t> data) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent::Deserialize"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEvent", "Deserialize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, data); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton #include "UnityEngine/ResourceManagement/Diagnostics/DiagnosticEventCollectorSingleton.hpp" // Including type: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton/UnityEngine.ResourceManagement.Diagnostics.<>c #include "UnityEngine/ResourceManagement/Diagnostics/DiagnosticEventCollectorSingleton_--c.hpp" // Including type: System.Collections.Generic.Dictionary`2 #include "System/Collections/Generic/Dictionary_2.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: DelegateList`1 #include "GlobalNamespace/DelegateList_1.hpp" // Including type: System.Action`1 #include "System/Action_1.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static private System.Guid s_editorConnectionGuid ::System::Guid UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::_get_s_editorConnectionGuid() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::_get_s_editorConnectionGuid"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::System::Guid>("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollectorSingleton", "s_editorConnectionGuid")); } // Autogenerated static field setter // Set static field: static private System.Guid s_editorConnectionGuid void UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::_set_s_editorConnectionGuid(::System::Guid value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::_set_s_editorConnectionGuid"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollectorSingleton", "s_editorConnectionGuid", value)); } // Autogenerated instance field getter // Get instance field: System.Collections.Generic.Dictionary`2<System.Int32,UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent> m_CreatedEvents ::System::Collections::Generic::Dictionary_2<int, ::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent>*& UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::dyn_m_CreatedEvents() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::dyn_m_CreatedEvents"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_CreatedEvents"))->offset; return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<int, ::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: System.Collections.Generic.List`1<UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent> m_UnhandledEvents ::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent>*& UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::dyn_m_UnhandledEvents() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::dyn_m_UnhandledEvents"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_UnhandledEvents"))->offset; return *reinterpret_cast<::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: DelegateList`1<UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent> s_EventHandlers ::GlobalNamespace::DelegateList_1<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent>*& UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::dyn_s_EventHandlers() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::dyn_s_EventHandlers"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "s_EventHandlers"))->offset; return *reinterpret_cast<::GlobalNamespace::DelegateList_1<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Single m_lastTickSent float& UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::dyn_m_lastTickSent() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::dyn_m_lastTickSent"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_lastTickSent"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_lastFrame int& UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::dyn_m_lastFrame() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::dyn_m_lastFrame"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_lastFrame"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Single fpsAvg float& UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::dyn_fpsAvg() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::dyn_fpsAvg"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "fpsAvg"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton.get_PlayerConnectionGuid ::System::Guid UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::get_PlayerConnectionGuid() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::get_PlayerConnectionGuid"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollectorSingleton", "get_PlayerConnectionGuid", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Guid, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton.RegisterEventHandler bool UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::RegisterEventHandler(::System::Action_1<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent>* handler, bool _register, bool create) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::RegisterEventHandler"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollectorSingleton", "RegisterEventHandler", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(handler), ::il2cpp_utils::ExtractType(_register), ::il2cpp_utils::ExtractType(create)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, handler, _register, create); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton.RegisterEventHandler void UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::RegisterEventHandler(::System::Action_1<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent>* handler) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::RegisterEventHandler"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "RegisterEventHandler", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(handler)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, handler); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton.UnregisterEventHandler void UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::UnregisterEventHandler(::System::Action_1<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent>* handler) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::UnregisterEventHandler"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UnregisterEventHandler", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(handler)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, handler); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton.PostEvent void UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::PostEvent(::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent diagnosticEvent) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::PostEvent"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "PostEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(diagnosticEvent)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, diagnosticEvent); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton.Update void UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::Update() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::Update"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton.GetGameObjectName ::StringW UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::GetGameObjectName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::GetGameObjectName"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetGameObjectName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton.Awake void UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::Awake() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::Awake"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Awake", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton/UnityEngine.ResourceManagement.Diagnostics.<>c #include "UnityEngine/ResourceManagement/Diagnostics/DiagnosticEventCollectorSingleton_--c.hpp" // Including type: System.Func`2 #include "System/Func_2.hpp" // Including type: System.Action`1 #include "System/Action_1.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public readonly UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton/UnityEngine.ResourceManagement.Diagnostics.<>c <>9 ::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c* UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::_get_$$9() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::_get_$$9"); return THROW_UNLESS((il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c*>("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollectorSingleton/<>c", "<>9"))); } // Autogenerated static field setter // Set static field: static public readonly UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton/UnityEngine.ResourceManagement.Diagnostics.<>c <>9 void UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::_set_$$9(::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::_set_$$9"); THROW_UNLESS((il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollectorSingleton/<>c", "<>9", value))); } // Autogenerated static field getter // Get static field: static public System.Func`2<UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent,System.Int32> <>9__8_0 ::System::Func_2<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent, int>* UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::_get_$$9__8_0() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::_get_$$9__8_0"); return THROW_UNLESS((il2cpp_utils::GetFieldValue<::System::Func_2<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent, int>*>("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollectorSingleton/<>c", "<>9__8_0"))); } // Autogenerated static field setter // Set static field: static public System.Func`2<UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent,System.Int32> <>9__8_0 void UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::_set_$$9__8_0(::System::Func_2<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent, int>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::_set_$$9__8_0"); THROW_UNLESS((il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollectorSingleton/<>c", "<>9__8_0", value))); } // Autogenerated static field getter // Get static field: static public System.Action`1<UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent> <>9__11_0 ::System::Action_1<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent>* UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::_get_$$9__11_0() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::_get_$$9__11_0"); return THROW_UNLESS((il2cpp_utils::GetFieldValue<::System::Action_1<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent>*>("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollectorSingleton/<>c", "<>9__11_0"))); } // Autogenerated static field setter // Set static field: static public System.Action`1<UnityEngine.ResourceManagement.Diagnostics.DiagnosticEvent> <>9__11_0 void UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::_set_$$9__11_0(::System::Action_1<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::_set_$$9__11_0"); THROW_UNLESS((il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollectorSingleton/<>c", "<>9__11_0", value))); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton/UnityEngine.ResourceManagement.Diagnostics.<>c..cctor void UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::_cctor() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::.cctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollectorSingleton/<>c", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton/UnityEngine.ResourceManagement.Diagnostics.<>c.<RegisterEventHandler>b__8_0 int UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::$RegisterEventHandler$b__8_0(::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent evt) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::<RegisterEventHandler>b__8_0"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<RegisterEventHandler>b__8_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(evt)}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method, evt); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollectorSingleton/UnityEngine.ResourceManagement.Diagnostics.<>c.<Awake>b__11_0 void UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::$Awake$b__11_0(::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent diagnosticEvent) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollectorSingleton::$$c::<Awake>b__11_0"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<Awake>b__11_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(diagnosticEvent)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, diagnosticEvent); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollector #include "UnityEngine/ResourceManagement/Diagnostics/DiagnosticEventCollector.hpp" // Including type: System.Guid #include "System/Guid.hpp" // Including type: System.Action`1 #include "System/Action_1.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static private UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollector s_Collector ::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector* UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector::_get_s_Collector() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector::_get_s_Collector"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector*>("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollector", "s_Collector")); } // Autogenerated static field setter // Set static field: static private UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollector s_Collector void UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector::_set_s_Collector(::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector::_set_s_Collector"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollector", "s_Collector", value)); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollector.get_PlayerConnectionGuid ::System::Guid UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector::get_PlayerConnectionGuid() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector::get_PlayerConnectionGuid"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollector", "get_PlayerConnectionGuid", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Guid, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollector.FindOrCreateGlobalInstance ::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector* UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector::FindOrCreateGlobalInstance() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector::FindOrCreateGlobalInstance"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollector", "FindOrCreateGlobalInstance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollector.RegisterEventHandler bool UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector::RegisterEventHandler(::System::Action_1<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent>* handler, bool _register, bool create) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector::RegisterEventHandler"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("UnityEngine.ResourceManagement.Diagnostics", "DiagnosticEventCollector", "RegisterEventHandler", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(handler), ::il2cpp_utils::ExtractType(_register), ::il2cpp_utils::ExtractType(create)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, handler, _register, create); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollector.UnregisterEventHandler void UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector::UnregisterEventHandler(::System::Action_1<::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent>* handler) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector::UnregisterEventHandler"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UnregisterEventHandler", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(handler)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, handler); } // Autogenerated method: UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollector.PostEvent void UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector::PostEvent(::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEvent diagnosticEvent) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::Diagnostics::DiagnosticEventCollector::PostEvent"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "PostEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(diagnosticEvent)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, diagnosticEvent); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.AsyncOperations.ICachable #include "UnityEngine/ResourceManagement/AsyncOperations/ICachable.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.ICachable.get_Hash int UnityEngine::ResourceManagement::AsyncOperations::ICachable::get_Hash() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::ICachable::get_Hash"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Hash", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.ICachable.set_Hash void UnityEngine::ResourceManagement::AsyncOperations::ICachable::set_Hash(int value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::ICachable::set_Hash"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Hash", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation #include "UnityEngine/ResourceManagement/AsyncOperations/IAsyncOperation.hpp" // Including type: System.Type #include "System/Type.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationStatus #include "UnityEngine/ResourceManagement/AsyncOperations/AsyncOperationStatus.hpp" // Including type: System.Exception #include "System/Exception.hpp" // Including type: System.Action`1 #include "System/Action_1.hpp" // Including type: System.Threading.Tasks.Task`1 #include "System/Threading/Tasks/Task_1.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.DownloadStatus #include "UnityEngine/ResourceManagement/AsyncOperations/DownloadStatus.hpp" // Including type: System.Collections.Generic.HashSet`1 #include "System/Collections/Generic/HashSet_1.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager #include "UnityEngine/ResourceManagement/ResourceManager.hpp" // Including type: DelegateList`1 #include "GlobalNamespace/DelegateList_1.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.get_ResultType ::System::Type* UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_ResultType() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_ResultType"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ResultType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Type*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.get_Version int UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_Version() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_Version"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Version", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.get_DebugName ::StringW UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_DebugName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_DebugName"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_DebugName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.get_ReferenceCount int UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_ReferenceCount() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_ReferenceCount"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ReferenceCount", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.get_PercentComplete float UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_PercentComplete() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_PercentComplete"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_PercentComplete", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.get_Status ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_Status() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_Status"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Status", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.get_OperationException ::System::Exception* UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_OperationException() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_OperationException"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_OperationException", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Exception*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.get_IsDone bool UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_IsDone() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_IsDone"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsDone", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.set_OnDestroy void UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::set_OnDestroy(::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation*>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::set_OnDestroy"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.get_IsRunning bool UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_IsRunning() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_IsRunning"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsRunning", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.get_Task ::System::Threading::Tasks::Task_1<::Il2CppObject*>* UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_Task() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_Task"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Task", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Threading::Tasks::Task_1<::Il2CppObject*>*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.get_Handle ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_Handle() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::get_Handle"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Handle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.add_CompletedTypeless void UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::add_CompletedTypeless(::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::add_CompletedTypeless"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_CompletedTypeless", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.remove_CompletedTypeless void UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::remove_CompletedTypeless(::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::remove_CompletedTypeless"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_CompletedTypeless", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.add_Destroyed void UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::add_Destroyed(::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::add_Destroyed"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_Destroyed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.remove_Destroyed void UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::remove_Destroyed(::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::remove_Destroyed"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_Destroyed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.GetResultAsObject ::Il2CppObject* UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::GetResultAsObject() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::GetResultAsObject"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetResultAsObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.DecrementReferenceCount void UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::DecrementReferenceCount() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::DecrementReferenceCount"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "DecrementReferenceCount", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.IncrementReferenceCount void UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::IncrementReferenceCount() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::IncrementReferenceCount"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IncrementReferenceCount", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.GetDownloadStatus ::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::GetDownloadStatus(::System::Collections::Generic::HashSet_1<::Il2CppObject*>* visited) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::GetDownloadStatus"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDownloadStatus", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(visited)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus, false>(this, ___internal__method, visited); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.GetDependencies void UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::GetDependencies(::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* deps) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::GetDependencies"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDependencies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(deps)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, deps); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.InvokeCompletionEvent void UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::InvokeCompletionEvent() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::InvokeCompletionEvent"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InvokeCompletionEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.Start void UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::Start(::UnityEngine::ResourceManagement::ResourceManager* rm, ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle dependency, ::GlobalNamespace::DelegateList_1<float>* updateCallbacks) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::Start"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rm), ::il2cpp_utils::ExtractType(dependency), ::il2cpp_utils::ExtractType(updateCallbacks)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, rm, dependency, updateCallbacks); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation.WaitForCompletion void UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::WaitForCompletion() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation::WaitForCompletion"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "WaitForCompletion", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle #include "UnityEngine/ResourceManagement/AsyncOperations/AsyncOperationHandle.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation #include "UnityEngine/ResourceManagement/AsyncOperations/IAsyncOperation.hpp" // Including type: System.Exception #include "System/Exception.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationStatus #include "UnityEngine/ResourceManagement/AsyncOperations/AsyncOperationStatus.hpp" // Including type: System.Threading.Tasks.Task`1 #include "System/Threading/Tasks/Task_1.hpp" // Including type: System.Action`1 #include "System/Action_1.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.DownloadStatus #include "UnityEngine/ResourceManagement/AsyncOperations/DownloadStatus.hpp" // Including type: System.Collections.Generic.HashSet`1 #include "System/Collections/Generic/HashSet_1.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: UnityEngine.ResourceManagement.AsyncOperations.IAsyncOperation m_InternalOp ::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation*& UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::dyn_m_InternalOp() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::dyn_m_InternalOp"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_InternalOp"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_Version int& UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::dyn_m_Version() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::dyn_m_Version"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Version"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.String m_LocationName ::StringW& UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::dyn_m_LocationName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::dyn_m_LocationName"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_LocationName"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_LocationName ::StringW UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_LocationName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_LocationName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_LocationName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.set_LocationName void UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::set_LocationName(::StringW value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::set_LocationName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "set_LocationName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_DebugName ::StringW UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_DebugName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_DebugName"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_DebugName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_InternalOp ::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation* UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_InternalOp() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_InternalOp"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_InternalOp", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_IsDone bool UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_IsDone() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_IsDone"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_IsDone", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_OperationException ::System::Exception* UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_OperationException() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_OperationException"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_OperationException", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Exception*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_PercentComplete float UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_PercentComplete() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_PercentComplete"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_PercentComplete", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_ReferenceCount int UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_ReferenceCount() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_ReferenceCount"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_ReferenceCount", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_Result ::Il2CppObject* UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_Result() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_Result"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Result", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_Status ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_Status() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_Status"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Status", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.get_Task ::System::Threading::Tasks::Task_1<::Il2CppObject*>* UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_Task() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::get_Task"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Task", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Threading::Tasks::Task_1<::Il2CppObject*>*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.System.Collections.IEnumerator.get_Current ::Il2CppObject* UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::System_Collections_IEnumerator_get_Current() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::System.Collections.IEnumerator.get_Current"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "System.Collections.IEnumerator.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.add_Completed void UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::add_Completed(::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::add_Completed"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "add_Completed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.remove_Completed void UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::remove_Completed(::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::remove_Completed"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "remove_Completed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.add_Destroyed void UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::add_Destroyed(::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::add_Destroyed"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "add_Destroyed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.remove_Destroyed void UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::remove_Destroyed(::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::remove_Destroyed"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "remove_Destroyed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle..ctor UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::AsyncOperationHandle(::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation* op) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(op)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, op); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle..ctor UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::AsyncOperationHandle(::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation* op, int version) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(op), ::il2cpp_utils::ExtractType(version)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, op, version); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle..ctor UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::AsyncOperationHandle(::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation* op, ::StringW locationName) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(op), ::il2cpp_utils::ExtractType(locationName)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, op, locationName); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle..ctor // ABORTED elsewhere. UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::AsyncOperationHandle(::UnityEngine::ResourceManagement::AsyncOperations::IAsyncOperation* op, int version, ::StringW locationName) // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.Acquire ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::Acquire() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::Acquire"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "Acquire", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.Equals bool UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::Equals(::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle other) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::Equals"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "Equals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(other)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, other); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.GetDependencies void UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::GetDependencies(::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* deps) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::GetDependencies"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "GetDependencies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(deps)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, deps); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.IsValid bool UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::IsValid() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::IsValid"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "IsValid", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.GetDownloadStatus ::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::GetDownloadStatus() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::GetDownloadStatus"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "GetDownloadStatus", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.InternalGetDownloadStatus ::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::InternalGetDownloadStatus(::System::Collections::Generic::HashSet_1<::Il2CppObject*>* visited) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::InternalGetDownloadStatus"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "InternalGetDownloadStatus", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(visited)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus, false>(this, ___internal__method, visited); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.Release void UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::Release() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::Release"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "Release", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.System.Collections.IEnumerator.MoveNext bool UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::System_Collections_IEnumerator_MoveNext() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::System.Collections.IEnumerator.MoveNext"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "System.Collections.IEnumerator.MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.System.Collections.IEnumerator.Reset void UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::System_Collections_IEnumerator_Reset() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::System.Collections.IEnumerator.Reset"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "System.Collections.IEnumerator.Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.WaitForCompletion ::Il2CppObject* UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::WaitForCompletion() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::WaitForCompletion"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "WaitForCompletion", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.GetHashCode int UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::GetHashCode() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle::GetHashCode"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationStatus #include "UnityEngine/ResourceManagement/AsyncOperations/AsyncOperationStatus.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationStatus None ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus::_get_None() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus::_get_None"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus>("UnityEngine.ResourceManagement.AsyncOperations", "AsyncOperationStatus", "None")); } // Autogenerated static field setter // Set static field: static public UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationStatus None void UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus::_set_None(::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus::_set_None"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.AsyncOperations", "AsyncOperationStatus", "None", value)); } // Autogenerated static field getter // Get static field: static public UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationStatus Succeeded ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus::_get_Succeeded() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus::_get_Succeeded"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus>("UnityEngine.ResourceManagement.AsyncOperations", "AsyncOperationStatus", "Succeeded")); } // Autogenerated static field setter // Set static field: static public UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationStatus Succeeded void UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus::_set_Succeeded(::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus::_set_Succeeded"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.AsyncOperations", "AsyncOperationStatus", "Succeeded", value)); } // Autogenerated static field getter // Get static field: static public UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationStatus Failed ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus::_get_Failed() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus::_get_Failed"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus>("UnityEngine.ResourceManagement.AsyncOperations", "AsyncOperationStatus", "Failed")); } // Autogenerated static field setter // Set static field: static public UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationStatus Failed void UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus::_set_Failed(::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus::_set_Failed"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.AsyncOperations", "AsyncOperationStatus", "Failed", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationStatus::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.AsyncOperations.DownloadStatus #include "UnityEngine/ResourceManagement/AsyncOperations/DownloadStatus.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.Int64 TotalBytes int64_t& UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus::dyn_TotalBytes() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus::dyn_TotalBytes"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "TotalBytes"))->offset; return *reinterpret_cast<int64_t*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int64 DownloadedBytes int64_t& UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus::dyn_DownloadedBytes() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus::dyn_DownloadedBytes"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "DownloadedBytes"))->offset; return *reinterpret_cast<int64_t*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean IsDone bool& UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus::dyn_IsDone() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus::dyn_IsDone"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "IsDone"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.DownloadStatus.get_Percent float UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus::get_Percent() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus::get_Percent"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_Percent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation #include "UnityEngine/ResourceManagement/AsyncOperations/GroupOperation.hpp" // Including type: System.Collections.Generic.HashSet`1 #include "System/Collections/Generic/HashSet_1.hpp" // Including type: System.Collections.Generic.IList`1 #include "System/Collections/Generic/IList_1.hpp" // Including type: System.Action`1 #include "System/Action_1.hpp" // Including type: System.Collections.Generic.List`1 #include "System/Collections/Generic/List_1.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.DownloadStatus #include "UnityEngine/ResourceManagement/AsyncOperations/DownloadStatus.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static private System.Int32 k_MaxDisplayedLocationLength int UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::_get_k_MaxDisplayedLocationLength() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::_get_k_MaxDisplayedLocationLength"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("UnityEngine.ResourceManagement.AsyncOperations", "GroupOperation", "k_MaxDisplayedLocationLength")); } // Autogenerated static field setter // Set static field: static private System.Int32 k_MaxDisplayedLocationLength void UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::_set_k_MaxDisplayedLocationLength(int value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::_set_k_MaxDisplayedLocationLength"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.AsyncOperations", "GroupOperation", "k_MaxDisplayedLocationLength", value)); } // Autogenerated instance field getter // Get instance field: private System.Action`1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle> m_InternalOnComplete ::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>*& UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::dyn_m_InternalOnComplete() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::dyn_m_InternalOnComplete"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_InternalOnComplete"))->offset; return *reinterpret_cast<::System::Action_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 m_LoadedCount int& UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::dyn_m_LoadedCount() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::dyn_m_LoadedCount"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_LoadedCount"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.ResourceManagement.AsyncOperations.GroupOperation/UnityEngine.ResourceManagement.AsyncOperations.GroupOperationSettings m_Settings ::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings& UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::dyn_m_Settings() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::dyn_m_Settings"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Settings"))->offset; return *reinterpret_cast<::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.String debugName ::StringW& UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::dyn_debugName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::dyn_debugName"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "debugName"))->offset; return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Int32 <UnityEngine.ResourceManagement.AsyncOperations.ICachable.Hash>k__BackingField int& UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::dyn_$UnityEngine_ResourceManagement_AsyncOperations_ICachable_Hash$k__BackingField() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::dyn_$UnityEngine_ResourceManagement_AsyncOperations_ICachable_Hash$k__BackingField"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<UnityEngine.ResourceManagement.AsyncOperations.ICachable.Hash>k__BackingField"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.HashSet`1<System.String> m_CachedDependencyLocations ::System::Collections::Generic::HashSet_1<::StringW>*& UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::dyn_m_CachedDependencyLocations() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::dyn_m_CachedDependencyLocations"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_CachedDependencyLocations"))->offset; return *reinterpret_cast<::System::Collections::Generic::HashSet_1<::StringW>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.UnityEngine.ResourceManagement.AsyncOperations.ICachable.get_Hash int UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::UnityEngine_ResourceManagement_AsyncOperations_ICachable_get_Hash() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::UnityEngine.ResourceManagement.AsyncOperations.ICachable.get_Hash"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UnityEngine.ResourceManagement.AsyncOperations.ICachable.get_Hash", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.UnityEngine.ResourceManagement.AsyncOperations.ICachable.set_Hash void UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::UnityEngine_ResourceManagement_AsyncOperations_ICachable_set_Hash(int value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::UnityEngine.ResourceManagement.AsyncOperations.ICachable.set_Hash"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UnityEngine.ResourceManagement.AsyncOperations.ICachable.set_Hash", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.GetDependentOps ::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GetDependentOps() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GetDependentOps"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDependentOps", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.DependenciesAreUnchanged bool UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::DependenciesAreUnchanged(::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* deps) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::DependenciesAreUnchanged"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "DependenciesAreUnchanged", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(deps)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, deps); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.CompleteIfDependenciesComplete void UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::CompleteIfDependenciesComplete() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::CompleteIfDependenciesComplete"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CompleteIfDependenciesComplete", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.Init void UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::Init(::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* operations, bool releaseDependenciesOnFailure, bool allowFailedDependencies) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::Init"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Init", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(operations), ::il2cpp_utils::ExtractType(releaseDependenciesOnFailure), ::il2cpp_utils::ExtractType(allowFailedDependencies)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, operations, releaseDependenciesOnFailure, allowFailedDependencies); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.Init void UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::Init(::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* operations, ::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings settings) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::Init"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Init", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(operations), ::il2cpp_utils::ExtractType(settings)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, operations, settings); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.OnOperationCompleted void UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::OnOperationCompleted(::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle op) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::OnOperationCompleted"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnOperationCompleted", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(op)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, op); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.get_DebugName ::StringW UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::get_DebugName() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::get_DebugName"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_DebugName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.get_Progress float UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::get_Progress() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::get_Progress"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Progress", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.InvokeWaitForCompletion bool UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::InvokeWaitForCompletion() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::InvokeWaitForCompletion"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InvokeWaitForCompletion", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.GetDependencies void UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GetDependencies(::System::Collections::Generic::List_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>* deps) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GetDependencies"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDependencies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(deps)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, deps); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.ReleaseDependencies void UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::ReleaseDependencies() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::ReleaseDependencies"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReleaseDependencies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.GetDownloadStatus ::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GetDownloadStatus(::System::Collections::Generic::HashSet_1<::Il2CppObject*>* visited) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GetDownloadStatus"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDownloadStatus", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(visited)}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus, false>(this, ___internal__method, visited); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.Execute void UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::Execute() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::Execute"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Execute", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation.Destroy void UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::Destroy() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::Destroy"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Destroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: UnityEngine.ResourceManagement.AsyncOperations.GroupOperation/UnityEngine.ResourceManagement.AsyncOperations.GroupOperationSettings #include "UnityEngine/ResourceManagement/AsyncOperations/GroupOperation.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public UnityEngine.ResourceManagement.AsyncOperations.GroupOperation/UnityEngine.ResourceManagement.AsyncOperations.GroupOperationSettings None ::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings::_get_None() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings::_get_None"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings>("UnityEngine.ResourceManagement.AsyncOperations", "GroupOperation/GroupOperationSettings", "None")); } // Autogenerated static field setter // Set static field: static public UnityEngine.ResourceManagement.AsyncOperations.GroupOperation/UnityEngine.ResourceManagement.AsyncOperations.GroupOperationSettings None void UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings::_set_None(::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings::_set_None"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.AsyncOperations", "GroupOperation/GroupOperationSettings", "None", value)); } // Autogenerated static field getter // Get static field: static public UnityEngine.ResourceManagement.AsyncOperations.GroupOperation/UnityEngine.ResourceManagement.AsyncOperations.GroupOperationSettings ReleaseDependenciesOnFailure ::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings::_get_ReleaseDependenciesOnFailure() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings::_get_ReleaseDependenciesOnFailure"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings>("UnityEngine.ResourceManagement.AsyncOperations", "GroupOperation/GroupOperationSettings", "ReleaseDependenciesOnFailure")); } // Autogenerated static field setter // Set static field: static public UnityEngine.ResourceManagement.AsyncOperations.GroupOperation/UnityEngine.ResourceManagement.AsyncOperations.GroupOperationSettings ReleaseDependenciesOnFailure void UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings::_set_ReleaseDependenciesOnFailure(::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings::_set_ReleaseDependenciesOnFailure"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.AsyncOperations", "GroupOperation/GroupOperationSettings", "ReleaseDependenciesOnFailure", value)); } // Autogenerated static field getter // Get static field: static public UnityEngine.ResourceManagement.AsyncOperations.GroupOperation/UnityEngine.ResourceManagement.AsyncOperations.GroupOperationSettings AllowFailedDependencies ::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings::_get_AllowFailedDependencies() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings::_get_AllowFailedDependencies"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings>("UnityEngine.ResourceManagement.AsyncOperations", "GroupOperation/GroupOperationSettings", "AllowFailedDependencies")); } // Autogenerated static field setter // Set static field: static public UnityEngine.ResourceManagement.AsyncOperations.GroupOperation/UnityEngine.ResourceManagement.AsyncOperations.GroupOperationSettings AllowFailedDependencies void UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings::_set_AllowFailedDependencies(::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings value) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings::_set_AllowFailedDependencies"); THROW_UNLESS(il2cpp_utils::SetFieldValue("UnityEngine.ResourceManagement.AsyncOperations", "GroupOperation/GroupOperationSettings", "AllowFailedDependencies", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::GroupOperation::GroupOperationSettings::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.ResourceManagement.AsyncOperations.IGenericProviderOperation #include "UnityEngine/ResourceManagement/AsyncOperations/IGenericProviderOperation.hpp" // Including type: UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation #include "UnityEngine/ResourceManagement/ResourceLocations/IResourceLocation.hpp" // Including type: System.Type #include "System/Type.hpp" // Including type: UnityEngine.ResourceManagement.ResourceManager #include "UnityEngine/ResourceManagement/ResourceManager.hpp" // Including type: UnityEngine.ResourceManagement.ResourceProviders.IResourceProvider #include "UnityEngine/ResourceManagement/ResourceProviders/IResourceProvider.hpp" // Including type: UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1 #include "UnityEngine/ResourceManagement/AsyncOperations/AsyncOperationHandle_1.hpp" // Including type: System.Collections.Generic.IList`1 #include "System/Collections/Generic/IList_1.hpp" // Including type: System.Func`1 #include "System/Func_1.hpp" // Including type: System.Exception #include "System/Exception.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IGenericProviderOperation.get_ProvideHandleVersion int UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::get_ProvideHandleVersion() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::get_ProvideHandleVersion"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ProvideHandleVersion", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IGenericProviderOperation.get_Location ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::get_Location() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::get_Location"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Location", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IGenericProviderOperation.get_DependencyCount int UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::get_DependencyCount() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::get_DependencyCount"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_DependencyCount", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IGenericProviderOperation.get_RequestedType ::System::Type* UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::get_RequestedType() { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::get_RequestedType"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_RequestedType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::System::Type*, false>(this, ___internal__method); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IGenericProviderOperation.Init void UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::Init(::UnityEngine::ResourceManagement::ResourceManager* rm, ::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider* provider, ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>*> depOp) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::Init"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Init", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rm), ::il2cpp_utils::ExtractType(provider), ::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(depOp)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, rm, provider, location, depOp); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IGenericProviderOperation.Init void UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::Init(::UnityEngine::ResourceManagement::ResourceManager* rm, ::UnityEngine::ResourceManagement::ResourceProviders::IResourceProvider* provider, ::UnityEngine::ResourceManagement::ResourceLocations::IResourceLocation* location, ::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle_1<::System::Collections::Generic::IList_1<::UnityEngine::ResourceManagement::AsyncOperations::AsyncOperationHandle>*> depOp, bool releaseDependenciesOnFailure) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::Init"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Init", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rm), ::il2cpp_utils::ExtractType(provider), ::il2cpp_utils::ExtractType(location), ::il2cpp_utils::ExtractType(depOp), ::il2cpp_utils::ExtractType(releaseDependenciesOnFailure)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, rm, provider, location, depOp, releaseDependenciesOnFailure); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IGenericProviderOperation.GetDependencies void UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::GetDependencies(::System::Collections::Generic::IList_1<::Il2CppObject*>* dstList) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::GetDependencies"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetDependencies", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(dstList)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, dstList); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IGenericProviderOperation.SetProgressCallback void UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::SetProgressCallback(::System::Func_1<float>* callback) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::SetProgressCallback"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetProgressCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(callback)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, callback); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IGenericProviderOperation.SetDownloadProgressCallback void UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::SetDownloadProgressCallback(::System::Func_1<::UnityEngine::ResourceManagement::AsyncOperations::DownloadStatus>* callback) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::SetDownloadProgressCallback"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetDownloadProgressCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(callback)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, callback); } // Autogenerated method: UnityEngine.ResourceManagement.AsyncOperations.IGenericProviderOperation.SetWaitForCompletionCallback void UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::SetWaitForCompletionCallback(::System::Func_1<bool>* callback) { static auto ___internal__logger = ::Logger::get().WithContext("::UnityEngine::ResourceManagement::AsyncOperations::IGenericProviderOperation::SetWaitForCompletionCallback"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetWaitForCompletionCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(callback)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, callback); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: TMPro.FastAction #include "TMPro/FastAction.hpp" // Including type: System.Collections.Generic.LinkedList`1 #include "System/Collections/Generic/LinkedList_1.hpp" // Including type: System.Action #include "System/Action.hpp" // Including type: System.Collections.Generic.Dictionary`2 #include "System/Collections/Generic/Dictionary_2.hpp" // Including type: System.Collections.Generic.LinkedListNode`1 #include "System/Collections/Generic/LinkedListNode_1.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.LinkedList`1<System.Action> delegates ::System::Collections::Generic::LinkedList_1<::System::Action*>*& TMPro::FastAction::dyn_delegates() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::FastAction::dyn_delegates"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "delegates"))->offset; return *reinterpret_cast<::System::Collections::Generic::LinkedList_1<::System::Action*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.Dictionary`2<System.Action,System.Collections.Generic.LinkedListNode`1<System.Action>> lookup ::System::Collections::Generic::Dictionary_2<::System::Action*, ::System::Collections::Generic::LinkedListNode_1<::System::Action*>*>*& TMPro::FastAction::dyn_lookup() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::FastAction::dyn_lookup"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "lookup"))->offset; return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<::System::Action*, ::System::Collections::Generic::LinkedListNode_1<::System::Action*>*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: TMPro.FastAction.Add void TMPro::FastAction::Add(::System::Action* rhs) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::FastAction::Add"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Add", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rhs)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, rhs); } // Autogenerated method: TMPro.FastAction.Remove void TMPro::FastAction::Remove(::System::Action* rhs) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::FastAction::Remove"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Remove", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rhs)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, rhs); } // Autogenerated method: TMPro.FastAction.Call void TMPro::FastAction::Call() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::FastAction::Call"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Call", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: TMPro.MaterialReferenceManager #include "TMPro/MaterialReferenceManager.hpp" // Including type: System.Collections.Generic.Dictionary`2 #include "System/Collections/Generic/Dictionary_2.hpp" // Including type: UnityEngine.Material #include "UnityEngine/Material.hpp" // Including type: TMPro.TMP_FontAsset #include "TMPro/TMP_FontAsset.hpp" // Including type: TMPro.TMP_SpriteAsset #include "TMPro/TMP_SpriteAsset.hpp" // Including type: TMPro.TMP_ColorGradient #include "TMPro/TMP_ColorGradient.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static private TMPro.MaterialReferenceManager s_Instance ::TMPro::MaterialReferenceManager* TMPro::MaterialReferenceManager::_get_s_Instance() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::_get_s_Instance"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::TMPro::MaterialReferenceManager*>("TMPro", "MaterialReferenceManager", "s_Instance")); } // Autogenerated static field setter // Set static field: static private TMPro.MaterialReferenceManager s_Instance void TMPro::MaterialReferenceManager::_set_s_Instance(::TMPro::MaterialReferenceManager* value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::_set_s_Instance"); THROW_UNLESS(il2cpp_utils::SetFieldValue("TMPro", "MaterialReferenceManager", "s_Instance", value)); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.Dictionary`2<System.Int32,UnityEngine.Material> m_FontMaterialReferenceLookup ::System::Collections::Generic::Dictionary_2<int, ::UnityEngine::Material*>*& TMPro::MaterialReferenceManager::dyn_m_FontMaterialReferenceLookup() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::dyn_m_FontMaterialReferenceLookup"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_FontMaterialReferenceLookup"))->offset; return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<int, ::UnityEngine::Material*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.Dictionary`2<System.Int32,TMPro.TMP_FontAsset> m_FontAssetReferenceLookup ::System::Collections::Generic::Dictionary_2<int, ::TMPro::TMP_FontAsset*>*& TMPro::MaterialReferenceManager::dyn_m_FontAssetReferenceLookup() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::dyn_m_FontAssetReferenceLookup"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_FontAssetReferenceLookup"))->offset; return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<int, ::TMPro::TMP_FontAsset*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.Dictionary`2<System.Int32,TMPro.TMP_SpriteAsset> m_SpriteAssetReferenceLookup ::System::Collections::Generic::Dictionary_2<int, ::TMPro::TMP_SpriteAsset*>*& TMPro::MaterialReferenceManager::dyn_m_SpriteAssetReferenceLookup() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::dyn_m_SpriteAssetReferenceLookup"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_SpriteAssetReferenceLookup"))->offset; return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<int, ::TMPro::TMP_SpriteAsset*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Collections.Generic.Dictionary`2<System.Int32,TMPro.TMP_ColorGradient> m_ColorGradientReferenceLookup ::System::Collections::Generic::Dictionary_2<int, ::TMPro::TMP_ColorGradient*>*& TMPro::MaterialReferenceManager::dyn_m_ColorGradientReferenceLookup() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::dyn_m_ColorGradientReferenceLookup"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ColorGradientReferenceLookup"))->offset; return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<int, ::TMPro::TMP_ColorGradient*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: TMPro.MaterialReferenceManager.get_instance ::TMPro::MaterialReferenceManager* TMPro::MaterialReferenceManager::get_instance() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::get_instance"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("TMPro", "MaterialReferenceManager", "get_instance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::TMPro::MaterialReferenceManager*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated method: TMPro.MaterialReferenceManager.AddFontAsset void TMPro::MaterialReferenceManager::AddFontAsset(::TMPro::TMP_FontAsset* fontAsset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::AddFontAsset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("TMPro", "MaterialReferenceManager", "AddFontAsset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(fontAsset)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, fontAsset); } // Autogenerated method: TMPro.MaterialReferenceManager.AddFontAssetInternal void TMPro::MaterialReferenceManager::AddFontAssetInternal(::TMPro::TMP_FontAsset* fontAsset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::AddFontAssetInternal"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AddFontAssetInternal", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(fontAsset)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, fontAsset); } // Autogenerated method: TMPro.MaterialReferenceManager.AddSpriteAsset void TMPro::MaterialReferenceManager::AddSpriteAsset(::TMPro::TMP_SpriteAsset* spriteAsset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::AddSpriteAsset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("TMPro", "MaterialReferenceManager", "AddSpriteAsset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(spriteAsset)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, spriteAsset); } // Autogenerated method: TMPro.MaterialReferenceManager.AddSpriteAssetInternal void TMPro::MaterialReferenceManager::AddSpriteAssetInternal(::TMPro::TMP_SpriteAsset* spriteAsset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::AddSpriteAssetInternal"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AddSpriteAssetInternal", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(spriteAsset)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, spriteAsset); } // Autogenerated method: TMPro.MaterialReferenceManager.AddSpriteAsset void TMPro::MaterialReferenceManager::AddSpriteAsset(int hashCode, ::TMPro::TMP_SpriteAsset* spriteAsset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::AddSpriteAsset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("TMPro", "MaterialReferenceManager", "AddSpriteAsset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hashCode), ::il2cpp_utils::ExtractType(spriteAsset)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, hashCode, spriteAsset); } // Autogenerated method: TMPro.MaterialReferenceManager.AddSpriteAssetInternal void TMPro::MaterialReferenceManager::AddSpriteAssetInternal(int hashCode, ::TMPro::TMP_SpriteAsset* spriteAsset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::AddSpriteAssetInternal"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AddSpriteAssetInternal", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hashCode), ::il2cpp_utils::ExtractType(spriteAsset)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, hashCode, spriteAsset); } // Autogenerated method: TMPro.MaterialReferenceManager.AddFontMaterial void TMPro::MaterialReferenceManager::AddFontMaterial(int hashCode, ::UnityEngine::Material* material) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::AddFontMaterial"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("TMPro", "MaterialReferenceManager", "AddFontMaterial", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hashCode), ::il2cpp_utils::ExtractType(material)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, hashCode, material); } // Autogenerated method: TMPro.MaterialReferenceManager.AddFontMaterialInternal void TMPro::MaterialReferenceManager::AddFontMaterialInternal(int hashCode, ::UnityEngine::Material* material) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::AddFontMaterialInternal"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AddFontMaterialInternal", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hashCode), ::il2cpp_utils::ExtractType(material)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, hashCode, material); } // Autogenerated method: TMPro.MaterialReferenceManager.AddColorGradientPreset void TMPro::MaterialReferenceManager::AddColorGradientPreset(int hashCode, ::TMPro::TMP_ColorGradient* spriteAsset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::AddColorGradientPreset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("TMPro", "MaterialReferenceManager", "AddColorGradientPreset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hashCode), ::il2cpp_utils::ExtractType(spriteAsset)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, hashCode, spriteAsset); } // Autogenerated method: TMPro.MaterialReferenceManager.AddColorGradientPreset_Internal void TMPro::MaterialReferenceManager::AddColorGradientPreset_Internal(int hashCode, ::TMPro::TMP_ColorGradient* spriteAsset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::AddColorGradientPreset_Internal"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AddColorGradientPreset_Internal", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hashCode), ::il2cpp_utils::ExtractType(spriteAsset)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, hashCode, spriteAsset); } // Autogenerated method: TMPro.MaterialReferenceManager.Contains bool TMPro::MaterialReferenceManager::Contains(::TMPro::TMP_FontAsset* font) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::Contains"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Contains", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(font)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, font); } // Autogenerated method: TMPro.MaterialReferenceManager.Contains bool TMPro::MaterialReferenceManager::Contains(::TMPro::TMP_SpriteAsset* sprite) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::Contains"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Contains", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(sprite)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, sprite); } // Autogenerated method: TMPro.MaterialReferenceManager.TryGetFontAsset bool TMPro::MaterialReferenceManager::TryGetFontAsset(int hashCode, ByRef<::TMPro::TMP_FontAsset*> fontAsset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::TryGetFontAsset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("TMPro", "MaterialReferenceManager", "TryGetFontAsset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hashCode), ::il2cpp_utils::ExtractIndependentType<::TMPro::TMP_FontAsset*&>()}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, hashCode, byref(fontAsset)); } // Autogenerated method: TMPro.MaterialReferenceManager.TryGetFontAssetInternal bool TMPro::MaterialReferenceManager::TryGetFontAssetInternal(int hashCode, ByRef<::TMPro::TMP_FontAsset*> fontAsset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::TryGetFontAssetInternal"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "TryGetFontAssetInternal", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hashCode), ::il2cpp_utils::ExtractIndependentType<::TMPro::TMP_FontAsset*&>()}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, hashCode, byref(fontAsset)); } // Autogenerated method: TMPro.MaterialReferenceManager.TryGetSpriteAsset bool TMPro::MaterialReferenceManager::TryGetSpriteAsset(int hashCode, ByRef<::TMPro::TMP_SpriteAsset*> spriteAsset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::TryGetSpriteAsset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("TMPro", "MaterialReferenceManager", "TryGetSpriteAsset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hashCode), ::il2cpp_utils::ExtractIndependentType<::TMPro::TMP_SpriteAsset*&>()}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, hashCode, byref(spriteAsset)); } // Autogenerated method: TMPro.MaterialReferenceManager.TryGetSpriteAssetInternal bool TMPro::MaterialReferenceManager::TryGetSpriteAssetInternal(int hashCode, ByRef<::TMPro::TMP_SpriteAsset*> spriteAsset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::TryGetSpriteAssetInternal"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "TryGetSpriteAssetInternal", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hashCode), ::il2cpp_utils::ExtractIndependentType<::TMPro::TMP_SpriteAsset*&>()}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, hashCode, byref(spriteAsset)); } // Autogenerated method: TMPro.MaterialReferenceManager.TryGetColorGradientPreset bool TMPro::MaterialReferenceManager::TryGetColorGradientPreset(int hashCode, ByRef<::TMPro::TMP_ColorGradient*> gradientPreset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::TryGetColorGradientPreset"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("TMPro", "MaterialReferenceManager", "TryGetColorGradientPreset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hashCode), ::il2cpp_utils::ExtractIndependentType<::TMPro::TMP_ColorGradient*&>()}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, hashCode, byref(gradientPreset)); } // Autogenerated method: TMPro.MaterialReferenceManager.TryGetColorGradientPresetInternal bool TMPro::MaterialReferenceManager::TryGetColorGradientPresetInternal(int hashCode, ByRef<::TMPro::TMP_ColorGradient*> gradientPreset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::TryGetColorGradientPresetInternal"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "TryGetColorGradientPresetInternal", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hashCode), ::il2cpp_utils::ExtractIndependentType<::TMPro::TMP_ColorGradient*&>()}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, hashCode, byref(gradientPreset)); } // Autogenerated method: TMPro.MaterialReferenceManager.TryGetMaterial bool TMPro::MaterialReferenceManager::TryGetMaterial(int hashCode, ByRef<::UnityEngine::Material*> material) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::TryGetMaterial"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("TMPro", "MaterialReferenceManager", "TryGetMaterial", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hashCode), ::il2cpp_utils::ExtractIndependentType<::UnityEngine::Material*&>()}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, hashCode, byref(material)); } // Autogenerated method: TMPro.MaterialReferenceManager.TryGetMaterialInternal bool TMPro::MaterialReferenceManager::TryGetMaterialInternal(int hashCode, ByRef<::UnityEngine::Material*> material) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReferenceManager::TryGetMaterialInternal"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "TryGetMaterialInternal", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(hashCode), ::il2cpp_utils::ExtractIndependentType<::UnityEngine::Material*&>()}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, hashCode, byref(material)); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: TMPro.MaterialReference #include "TMPro/MaterialReference.hpp" // Including type: TMPro.TMP_FontAsset #include "TMPro/TMP_FontAsset.hpp" // Including type: TMPro.TMP_SpriteAsset #include "TMPro/TMP_SpriteAsset.hpp" // Including type: UnityEngine.Material #include "UnityEngine/Material.hpp" // Including type: System.Collections.Generic.Dictionary`2 #include "System/Collections/Generic/Dictionary_2.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.Int32 index int& TMPro::MaterialReference::dyn_index() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReference::dyn_index"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "index"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public TMPro.TMP_FontAsset fontAsset ::TMPro::TMP_FontAsset*& TMPro::MaterialReference::dyn_fontAsset() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReference::dyn_fontAsset"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "fontAsset"))->offset; return *reinterpret_cast<::TMPro::TMP_FontAsset**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public TMPro.TMP_SpriteAsset spriteAsset ::TMPro::TMP_SpriteAsset*& TMPro::MaterialReference::dyn_spriteAsset() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReference::dyn_spriteAsset"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "spriteAsset"))->offset; return *reinterpret_cast<::TMPro::TMP_SpriteAsset**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Material material ::UnityEngine::Material*& TMPro::MaterialReference::dyn_material() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReference::dyn_material"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "material"))->offset; return *reinterpret_cast<::UnityEngine::Material**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean isDefaultMaterial bool& TMPro::MaterialReference::dyn_isDefaultMaterial() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReference::dyn_isDefaultMaterial"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "isDefaultMaterial"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Boolean isFallbackMaterial bool& TMPro::MaterialReference::dyn_isFallbackMaterial() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReference::dyn_isFallbackMaterial"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "isFallbackMaterial"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Material fallbackMaterial ::UnityEngine::Material*& TMPro::MaterialReference::dyn_fallbackMaterial() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReference::dyn_fallbackMaterial"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "fallbackMaterial"))->offset; return *reinterpret_cast<::UnityEngine::Material**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Single padding float& TMPro::MaterialReference::dyn_padding() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReference::dyn_padding"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "padding"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 referenceCount int& TMPro::MaterialReference::dyn_referenceCount() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReference::dyn_referenceCount"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "referenceCount"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: TMPro.MaterialReference..ctor TMPro::MaterialReference::MaterialReference(int index, ::TMPro::TMP_FontAsset* fontAsset, ::TMPro::TMP_SpriteAsset* spriteAsset, ::UnityEngine::Material* material, float padding) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReference::.ctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, ".ctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(index), ::il2cpp_utils::ExtractType(fontAsset), ::il2cpp_utils::ExtractType(spriteAsset), ::il2cpp_utils::ExtractType(material), ::il2cpp_utils::ExtractType(padding)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, index, fontAsset, spriteAsset, material, padding); } // Autogenerated method: TMPro.MaterialReference.Contains bool TMPro::MaterialReference::Contains(::ArrayW<::TMPro::MaterialReference> materialReferences, ::TMPro::TMP_FontAsset* fontAsset) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReference::Contains"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("TMPro", "MaterialReference", "Contains", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(materialReferences), ::il2cpp_utils::ExtractType(fontAsset)}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, materialReferences, fontAsset); } // Autogenerated method: TMPro.MaterialReference.AddMaterialReference int TMPro::MaterialReference::AddMaterialReference(::UnityEngine::Material* material, ::TMPro::TMP_FontAsset* fontAsset, ::ArrayW<::TMPro::MaterialReference> materialReferences, ::System::Collections::Generic::Dictionary_2<int, int>* materialReferenceIndexLookup) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReference::AddMaterialReference"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("TMPro", "MaterialReference", "AddMaterialReference", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(material), ::il2cpp_utils::ExtractType(fontAsset), ::il2cpp_utils::ExtractType(materialReferences), ::il2cpp_utils::ExtractType(materialReferenceIndexLookup)}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, material, fontAsset, materialReferences, materialReferenceIndexLookup); } // Autogenerated method: TMPro.MaterialReference.AddMaterialReference int TMPro::MaterialReference::AddMaterialReference(::UnityEngine::Material* material, ::TMPro::TMP_SpriteAsset* spriteAsset, ::ArrayW<::TMPro::MaterialReference> materialReferences, ::System::Collections::Generic::Dictionary_2<int, int>* materialReferenceIndexLookup) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::MaterialReference::AddMaterialReference"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("TMPro", "MaterialReference", "AddMaterialReference", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(material), ::il2cpp_utils::ExtractType(spriteAsset), ::il2cpp_utils::ExtractType(materialReferences), ::il2cpp_utils::ExtractType(materialReferenceIndexLookup)}))); return ::il2cpp_utils::RunMethodRethrow<int, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, material, spriteAsset, materialReferences, materialReferenceIndexLookup); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: TMPro.TMP_Asset #include "TMPro/TMP_Asset.hpp" // Including type: UnityEngine.Material #include "UnityEngine/Material.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: public System.Int32 hashCode int& TMPro::TMP_Asset::dyn_hashCode() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::TMP_Asset::dyn_hashCode"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "hashCode"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Material material ::UnityEngine::Material*& TMPro::TMP_Asset::dyn_material() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::TMP_Asset::dyn_material"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "material"))->offset; return *reinterpret_cast<::UnityEngine::Material**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public System.Int32 materialHashCode int& TMPro::TMP_Asset::dyn_materialHashCode() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::TMP_Asset::dyn_materialHashCode"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "materialHashCode"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: TMPro.TMP_Character #include "TMPro/TMP_Character.hpp" // Including type: UnityEngine.TextCore.Glyph #include "UnityEngine/TextCore/Glyph.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: TMPro.ColorMode #include "TMPro/ColorMode.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public TMPro.ColorMode Single ::TMPro::ColorMode TMPro::ColorMode::_get_Single() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorMode::_get_Single"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::TMPro::ColorMode>("TMPro", "ColorMode", "Single")); } // Autogenerated static field setter // Set static field: static public TMPro.ColorMode Single void TMPro::ColorMode::_set_Single(::TMPro::ColorMode value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorMode::_set_Single"); THROW_UNLESS(il2cpp_utils::SetFieldValue("TMPro", "ColorMode", "Single", value)); } // Autogenerated static field getter // Get static field: static public TMPro.ColorMode HorizontalGradient ::TMPro::ColorMode TMPro::ColorMode::_get_HorizontalGradient() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorMode::_get_HorizontalGradient"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::TMPro::ColorMode>("TMPro", "ColorMode", "HorizontalGradient")); } // Autogenerated static field setter // Set static field: static public TMPro.ColorMode HorizontalGradient void TMPro::ColorMode::_set_HorizontalGradient(::TMPro::ColorMode value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorMode::_set_HorizontalGradient"); THROW_UNLESS(il2cpp_utils::SetFieldValue("TMPro", "ColorMode", "HorizontalGradient", value)); } // Autogenerated static field getter // Get static field: static public TMPro.ColorMode VerticalGradient ::TMPro::ColorMode TMPro::ColorMode::_get_VerticalGradient() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorMode::_get_VerticalGradient"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::TMPro::ColorMode>("TMPro", "ColorMode", "VerticalGradient")); } // Autogenerated static field setter // Set static field: static public TMPro.ColorMode VerticalGradient void TMPro::ColorMode::_set_VerticalGradient(::TMPro::ColorMode value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorMode::_set_VerticalGradient"); THROW_UNLESS(il2cpp_utils::SetFieldValue("TMPro", "ColorMode", "VerticalGradient", value)); } // Autogenerated static field getter // Get static field: static public TMPro.ColorMode FourCornersGradient ::TMPro::ColorMode TMPro::ColorMode::_get_FourCornersGradient() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorMode::_get_FourCornersGradient"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::TMPro::ColorMode>("TMPro", "ColorMode", "FourCornersGradient")); } // Autogenerated static field setter // Set static field: static public TMPro.ColorMode FourCornersGradient void TMPro::ColorMode::_set_FourCornersGradient(::TMPro::ColorMode value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorMode::_set_FourCornersGradient"); THROW_UNLESS(il2cpp_utils::SetFieldValue("TMPro", "ColorMode", "FourCornersGradient", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& TMPro::ColorMode::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorMode::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: TMPro.TMP_ColorGradient #include "TMPro/TMP_ColorGradient.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static private TMPro.ColorMode k_DefaultColorMode ::TMPro::ColorMode TMPro::TMP_ColorGradient::_get_k_DefaultColorMode() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::TMP_ColorGradient::_get_k_DefaultColorMode"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::TMPro::ColorMode>("TMPro", "TMP_ColorGradient", "k_DefaultColorMode")); } // Autogenerated static field setter // Set static field: static private TMPro.ColorMode k_DefaultColorMode void TMPro::TMP_ColorGradient::_set_k_DefaultColorMode(::TMPro::ColorMode value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::TMP_ColorGradient::_set_k_DefaultColorMode"); THROW_UNLESS(il2cpp_utils::SetFieldValue("TMPro", "TMP_ColorGradient", "k_DefaultColorMode", value)); } // Autogenerated static field getter // Get static field: static private readonly UnityEngine.Color k_DefaultColor ::UnityEngine::Color TMPro::TMP_ColorGradient::_get_k_DefaultColor() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::TMP_ColorGradient::_get_k_DefaultColor"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::UnityEngine::Color>("TMPro", "TMP_ColorGradient", "k_DefaultColor")); } // Autogenerated static field setter // Set static field: static private readonly UnityEngine.Color k_DefaultColor void TMPro::TMP_ColorGradient::_set_k_DefaultColor(::UnityEngine::Color value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::TMP_ColorGradient::_set_k_DefaultColor"); THROW_UNLESS(il2cpp_utils::SetFieldValue("TMPro", "TMP_ColorGradient", "k_DefaultColor", value)); } // Autogenerated instance field getter // Get instance field: public TMPro.ColorMode colorMode ::TMPro::ColorMode& TMPro::TMP_ColorGradient::dyn_colorMode() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::TMP_ColorGradient::dyn_colorMode"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "colorMode"))->offset; return *reinterpret_cast<::TMPro::ColorMode*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Color topLeft ::UnityEngine::Color& TMPro::TMP_ColorGradient::dyn_topLeft() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::TMP_ColorGradient::dyn_topLeft"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "topLeft"))->offset; return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Color topRight ::UnityEngine::Color& TMPro::TMP_ColorGradient::dyn_topRight() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::TMP_ColorGradient::dyn_topRight"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "topRight"))->offset; return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Color bottomLeft ::UnityEngine::Color& TMPro::TMP_ColorGradient::dyn_bottomLeft() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::TMP_ColorGradient::dyn_bottomLeft"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "bottomLeft"))->offset; return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: public UnityEngine.Color bottomRight ::UnityEngine::Color& TMPro::TMP_ColorGradient::dyn_bottomRight() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::TMP_ColorGradient::dyn_bottomRight"); auto ___internal__instance = this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "bottomRight"))->offset; return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: TMPro.TMP_ColorGradient..cctor void TMPro::TMP_ColorGradient::_cctor() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::TMP_ColorGradient::.cctor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("TMPro", "TMP_ColorGradient", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); ::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: TMPro.ITweenValue #include "TMPro/ITweenValue.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated method: TMPro.ITweenValue.get_ignoreTimeScale bool TMPro::ITweenValue::get_ignoreTimeScale() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ITweenValue::get_ignoreTimeScale"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ignoreTimeScale", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: TMPro.ITweenValue.get_duration float TMPro::ITweenValue::get_duration() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ITweenValue::get_duration"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_duration", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated method: TMPro.ITweenValue.TweenValue void TMPro::ITweenValue::TweenValue(float floatPercentage) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ITweenValue::TweenValue"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "TweenValue", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(floatPercentage)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, floatPercentage); } // Autogenerated method: TMPro.ITweenValue.ValidTarget bool TMPro::ITweenValue::ValidTarget() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ITweenValue::ValidTarget"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ValidTarget", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: TMPro.ColorTween #include "TMPro/ColorTween.hpp" // Including type: TMPro.ColorTween/TMPro.ColorTweenCallback #include "TMPro/ColorTween_ColorTweenCallback.hpp" // Including type: UnityEngine.Events.UnityAction`1 #include "UnityEngine/Events/UnityAction_1.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated instance field getter // Get instance field: private TMPro.ColorTween/TMPro.ColorTweenCallback m_Target ::TMPro::ColorTween::ColorTweenCallback*& TMPro::ColorTween::dyn_m_Target() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::dyn_m_Target"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Target"))->offset; return *reinterpret_cast<::TMPro::ColorTween::ColorTweenCallback**>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.Color m_StartColor ::UnityEngine::Color& TMPro::ColorTween::dyn_m_StartColor() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::dyn_m_StartColor"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_StartColor"))->offset; return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private UnityEngine.Color m_TargetColor ::UnityEngine::Color& TMPro::ColorTween::dyn_m_TargetColor() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::dyn_m_TargetColor"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_TargetColor"))->offset; return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private TMPro.ColorTween/TMPro.ColorTweenMode m_TweenMode ::TMPro::ColorTween::ColorTweenMode& TMPro::ColorTween::dyn_m_TweenMode() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::dyn_m_TweenMode"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_TweenMode"))->offset; return *reinterpret_cast<::TMPro::ColorTween::ColorTweenMode*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Single m_Duration float& TMPro::ColorTween::dyn_m_Duration() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::dyn_m_Duration"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Duration"))->offset; return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated instance field getter // Get instance field: private System.Boolean m_IgnoreTimeScale bool& TMPro::ColorTween::dyn_m_IgnoreTimeScale() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::dyn_m_IgnoreTimeScale"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_IgnoreTimeScale"))->offset; return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated method: TMPro.ColorTween.get_startColor ::UnityEngine::Color TMPro::ColorTween::get_startColor() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::get_startColor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_startColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Color, false>(this, ___internal__method); } // Autogenerated method: TMPro.ColorTween.set_startColor void TMPro::ColorTween::set_startColor(::UnityEngine::Color value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::set_startColor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "set_startColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: TMPro.ColorTween.get_targetColor ::UnityEngine::Color TMPro::ColorTween::get_targetColor() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::get_targetColor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_targetColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Color, false>(this, ___internal__method); } // Autogenerated method: TMPro.ColorTween.set_targetColor void TMPro::ColorTween::set_targetColor(::UnityEngine::Color value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::set_targetColor"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "set_targetColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: TMPro.ColorTween.get_tweenMode ::TMPro::ColorTween::ColorTweenMode TMPro::ColorTween::get_tweenMode() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::get_tweenMode"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_tweenMode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<::TMPro::ColorTween::ColorTweenMode, false>(this, ___internal__method); } // Autogenerated method: TMPro.ColorTween.set_tweenMode void TMPro::ColorTween::set_tweenMode(::TMPro::ColorTween::ColorTweenMode value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::set_tweenMode"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "set_tweenMode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: TMPro.ColorTween.get_duration float TMPro::ColorTween::get_duration() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::get_duration"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_duration", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated method: TMPro.ColorTween.set_duration void TMPro::ColorTween::set_duration(float value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::set_duration"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "set_duration", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: TMPro.ColorTween.get_ignoreTimeScale bool TMPro::ColorTween::get_ignoreTimeScale() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::get_ignoreTimeScale"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "get_ignoreTimeScale", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: TMPro.ColorTween.set_ignoreTimeScale void TMPro::ColorTween::set_ignoreTimeScale(bool value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::set_ignoreTimeScale"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "set_ignoreTimeScale", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value); } // Autogenerated method: TMPro.ColorTween.TweenValue void TMPro::ColorTween::TweenValue(float floatPercentage) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::TweenValue"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "TweenValue", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(floatPercentage)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, floatPercentage); } // Autogenerated method: TMPro.ColorTween.AddOnChangedCallback void TMPro::ColorTween::AddOnChangedCallback(::UnityEngine::Events::UnityAction_1<::UnityEngine::Color>* callback) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::AddOnChangedCallback"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "AddOnChangedCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(callback)}))); ::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, callback); } // Autogenerated method: TMPro.ColorTween.GetIgnoreTimescale bool TMPro::ColorTween::GetIgnoreTimescale() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::GetIgnoreTimescale"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "GetIgnoreTimescale", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated method: TMPro.ColorTween.GetDuration float TMPro::ColorTween::GetDuration() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::GetDuration"); static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "GetDuration", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method); } // Autogenerated method: TMPro.ColorTween.ValidTarget bool TMPro::ColorTween::ValidTarget() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::ValidTarget"); auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "ValidTarget", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{}))); return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: TMPro.ColorTween/TMPro.ColorTweenMode #include "TMPro/ColorTween.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes // Autogenerated static field getter // Get static field: static public TMPro.ColorTween/TMPro.ColorTweenMode All ::TMPro::ColorTween::ColorTweenMode TMPro::ColorTween::ColorTweenMode::_get_All() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::ColorTweenMode::_get_All"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::TMPro::ColorTween::ColorTweenMode>("TMPro", "ColorTween/ColorTweenMode", "All")); } // Autogenerated static field setter // Set static field: static public TMPro.ColorTween/TMPro.ColorTweenMode All void TMPro::ColorTween::ColorTweenMode::_set_All(::TMPro::ColorTween::ColorTweenMode value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::ColorTweenMode::_set_All"); THROW_UNLESS(il2cpp_utils::SetFieldValue("TMPro", "ColorTween/ColorTweenMode", "All", value)); } // Autogenerated static field getter // Get static field: static public TMPro.ColorTween/TMPro.ColorTweenMode RGB ::TMPro::ColorTween::ColorTweenMode TMPro::ColorTween::ColorTweenMode::_get_RGB() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::ColorTweenMode::_get_RGB"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::TMPro::ColorTween::ColorTweenMode>("TMPro", "ColorTween/ColorTweenMode", "RGB")); } // Autogenerated static field setter // Set static field: static public TMPro.ColorTween/TMPro.ColorTweenMode RGB void TMPro::ColorTween::ColorTweenMode::_set_RGB(::TMPro::ColorTween::ColorTweenMode value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::ColorTweenMode::_set_RGB"); THROW_UNLESS(il2cpp_utils::SetFieldValue("TMPro", "ColorTween/ColorTweenMode", "RGB", value)); } // Autogenerated static field getter // Get static field: static public TMPro.ColorTween/TMPro.ColorTweenMode Alpha ::TMPro::ColorTween::ColorTweenMode TMPro::ColorTween::ColorTweenMode::_get_Alpha() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::ColorTweenMode::_get_Alpha"); return THROW_UNLESS(il2cpp_utils::GetFieldValue<::TMPro::ColorTween::ColorTweenMode>("TMPro", "ColorTween/ColorTweenMode", "Alpha")); } // Autogenerated static field setter // Set static field: static public TMPro.ColorTween/TMPro.ColorTweenMode Alpha void TMPro::ColorTween::ColorTweenMode::_set_Alpha(::TMPro::ColorTween::ColorTweenMode value) { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::ColorTweenMode::_set_Alpha"); THROW_UNLESS(il2cpp_utils::SetFieldValue("TMPro", "ColorTween/ColorTweenMode", "Alpha", value)); } // Autogenerated instance field getter // Get instance field: public System.Int32 value__ int& TMPro::ColorTween::ColorTweenMode::dyn_value__() { static auto ___internal__logger = ::Logger::get().WithContext("::TMPro::ColorTween::ColorTweenMode::dyn_value__"); auto ___internal__instance = *this; static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset; return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset); } // Autogenerated from CppSourceCreator // Created by Sc2ad // ========================================================================= // Begin includes // Including type: TMPro.ColorTween/TMPro.ColorTweenCallback #include "TMPro/ColorTween_ColorTweenCallback.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/utils.h" // Completed includes
96.428256
578
0.805653
RedBrumbler
1da54baee266483de8763dbbe42ff1a4d2ec766a
1,538
hpp
C++
src/connection_types/socket_connection.hpp
Felix-Rm/iac
59bfc7e859d4cc0b923c75dd34316ae2fafd9097
[ "BSD-2-Clause" ]
null
null
null
src/connection_types/socket_connection.hpp
Felix-Rm/iac
59bfc7e859d4cc0b923c75dd34316ae2fafd9097
[ "BSD-2-Clause" ]
null
null
null
src/connection_types/socket_connection.hpp
Felix-Rm/iac
59bfc7e859d4cc0b923c75dd34316ae2fafd9097
[ "BSD-2-Clause" ]
null
null
null
#pragma once #ifndef ARDUINO # include <arpa/inet.h> # include <netinet/in.h> # include <sys/fcntl.h> # include <sys/ioctl.h> # include <sys/socket.h> # include <unistd.h> # include <csignal> # include <cstdio> # include <cstdlib> # include "../std_provider/string.hpp" # include "connection.hpp" namespace iac { class SocketConnection : public Connection { public: SocketConnection(const char* ip, int port); size_t read(void* buffer, size_t size) override; size_t write(const void* buffer, size_t size) override; bool flush() override; bool clear() override; size_t available() override; explicit operator bool() const { return m_good; }; protected: const char* m_ip = nullptr; int m_port = 0; in_addr_t m_addr = INADDR_ANY; int m_rw_fd = -1; bool m_good = true; }; class SocketClientConnection : public SocketConnection { public: SocketClientConnection(const char* ip, int port); bool open() override; bool close() override; void printBuffer(int cols = 4); private: sockaddr_in m_address{}; static constexpr unsigned s_connect_timeout = 100000; }; class SocketServerConnection : public SocketConnection { public: SocketServerConnection(const char* ip, int port); bool open() override; bool close() override; void printBuffer(int cols = 4); private: int m_server_fd{-1}; sockaddr_in m_server_address{}, m_client_address{}; }; } // namespace iac #endif
19.468354
59
0.662549
Felix-Rm
1da8c18fa83b6061ebfdfe6059e2f5e0590af07a
7,456
cpp
C++
compiler/luci/service/src/GraphBlock.test.cpp
wateret/ONE_private
9789c52633e665d2e10273d88d6f7970faa8aee9
[ "Apache-2.0" ]
null
null
null
compiler/luci/service/src/GraphBlock.test.cpp
wateret/ONE_private
9789c52633e665d2e10273d88d6f7970faa8aee9
[ "Apache-2.0" ]
null
null
null
compiler/luci/service/src/GraphBlock.test.cpp
wateret/ONE_private
9789c52633e665d2e10273d88d6f7970faa8aee9
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "GraphBlock.h" #include "Check.h" #include <loco.h> #include <memory> // TODO Change all Canonical nodes to Circle nodes namespace { template <luci::FeatureLayout T> loco::Permutation<loco::Domain::Feature> perm(); template <> loco::Permutation<loco::Domain::Feature> perm<luci::FeatureLayout::NHWC>() { // Make NHWC permutation for encoder and decoder loco::Permutation<loco::Domain::Feature> NHWC; NHWC.axis(loco::FeatureAxis::Count) = 0; NHWC.axis(loco::FeatureAxis::Height) = 1; NHWC.axis(loco::FeatureAxis::Width) = 2; NHWC.axis(loco::FeatureAxis::Depth) = 3; return NHWC; } template <luci::FilterLayout T> loco::Permutation<loco::Domain::Filter> perm(); template <> loco::Permutation<loco::Domain::Filter> perm<luci::FilterLayout::HWIO>() { loco::Permutation<loco::Domain::Filter> HWIO; // a.k.a., HWCN HWIO.axis(loco::FilterAxis::Height) = 0; HWIO.axis(loco::FilterAxis::Width) = 1; HWIO.axis(loco::FilterAxis::Depth) = 2; HWIO.axis(loco::FilterAxis::Count) = 3; return HWIO; } template <> loco::Permutation<loco::Domain::Filter> perm<luci::FilterLayout::OHWI>() { // Make NHWC permutation for encoder and decoder loco::Permutation<loco::Domain::Filter> OHWI; // a.k.a., NHWC OHWI.axis(loco::FilterAxis::Count) = 0; OHWI.axis(loco::FilterAxis::Height) = 1; OHWI.axis(loco::FilterAxis::Width) = 2; OHWI.axis(loco::FilterAxis::Depth) = 3; return OHWI; } template <luci::DepthwiseFilterLayout T> loco::Permutation<loco::Domain::DepthwiseFilter> perm(); template <> loco::Permutation<loco::Domain::DepthwiseFilter> perm<luci::DepthwiseFilterLayout::HWCM>() { loco::Permutation<loco::Domain::DepthwiseFilter> HWCM; HWCM.axis(loco::DepthwiseFilterAxis::Height) = 0; HWCM.axis(loco::DepthwiseFilterAxis::Width) = 1; HWCM.axis(loco::DepthwiseFilterAxis::Depth) = 2; HWCM.axis(loco::DepthwiseFilterAxis::Multiplier) = 3; return HWCM; } template <luci::MatrixLayout T> loco::Permutation<loco::Domain::Matrix> perm(); template <> loco::Permutation<loco::Domain::Matrix> perm<luci::MatrixLayout::HW>() { loco::Permutation<loco::Domain::Matrix> HW; HW.axis(loco::MatrixAxis::Height) = 0; HW.axis(loco::MatrixAxis::Width) = 1; return HW; } template <> loco::Permutation<loco::Domain::Matrix> perm<luci::MatrixLayout::WH>() { loco::Permutation<loco::Domain::Matrix> WH; WH.axis(loco::MatrixAxis::Height) = 1; WH.axis(loco::MatrixAxis::Width) = 0; return WH; } } // namespace namespace luci { template <FeatureLayout T> loco::FeatureEncode *make_feature_encode(loco::Node *input_for_encode) { LUCI_ASSERT(input_for_encode != nullptr, "input should not be nullptr"); loco::Graph *g = input_for_encode->graph(); auto encoder = std::make_unique<loco::PermutingEncoder<loco::Domain::Feature>>(); encoder->perm(perm<T>()); auto enc = g->nodes()->create<loco::FeatureEncode>(); enc->input(input_for_encode); enc->encoder(std::move(encoder)); return enc; } template <FeatureLayout T> loco::FeatureDecode *make_feature_decode(loco::Node *input_for_decode) { LUCI_ASSERT(input_for_decode != nullptr, "input should not be nullptr"); loco::Graph *g = input_for_decode->graph(); auto decoder = std::make_unique<loco::PermutingDecoder<loco::Domain::Feature>>(); decoder->perm(perm<T>()); auto dec = g->nodes()->create<loco::FeatureDecode>(); dec->input(input_for_decode); dec->decoder(std::move(decoder)); return dec; } template <FilterLayout T> loco::FilterEncode *make_filter_encode(loco::Node *input_for_encode) { LUCI_ASSERT(input_for_encode != nullptr, "filter should not be nullptr"); loco::Graph *g = input_for_encode->graph(); auto encoder = std::make_unique<loco::PermutingEncoder<loco::Domain::Filter>>(); encoder->perm(perm<T>()); auto enc = g->nodes()->create<loco::FilterEncode>(); enc->input(input_for_encode); enc->encoder(std::move(encoder)); return enc; } template <FilterLayout T> loco::FilterDecode *make_filter_decode(loco::Node *input_for_decode) { LUCI_ASSERT(input_for_decode != nullptr, "filter should not be nullptr"); loco::Graph *g = input_for_decode->graph(); auto decoder = std::make_unique<loco::PermutingDecoder<loco::Domain::Filter>>(); decoder->perm(perm<T>()); auto dec = g->nodes()->create<loco::FilterDecode>(); dec->input(input_for_decode); dec->decoder(std::move(decoder)); return dec; } template <DepthwiseFilterLayout T> loco::DepthwiseFilterDecode *make_dw_filter_decode(loco::Node *input_for_decode) { LUCI_ASSERT(input_for_decode != nullptr, "filter should not be nullptr"); loco::Graph *g = input_for_decode->graph(); auto decoder = std::make_unique<loco::PermutingDecoder<loco::Domain::DepthwiseFilter>>(); decoder->perm(perm<T>()); auto dec = g->nodes()->create<loco::DepthwiseFilterDecode>(); dec->input(input_for_decode); dec->decoder(std::move(decoder)); return dec; } template <MatrixLayout T> loco::MatrixEncode *make_matrix_encode(loco::Node *input_for_encode) { LUCI_ASSERT(input_for_encode != nullptr, "input should not be nullptr"); loco::Graph *g = input_for_encode->graph(); auto encoder = std::make_unique<loco::PermutingEncoder<loco::Domain::Matrix>>(); encoder->perm(perm<T>()); auto enc = g->nodes()->create<loco::MatrixEncode>(); enc->input(input_for_encode); enc->encoder(std::move(encoder)); return enc; } template <MatrixLayout T> loco::MatrixDecode *make_matrix_decode(loco::Node *input_for_decode) { LUCI_ASSERT(input_for_decode != nullptr, "input should not be nullptr"); loco::Graph *g = input_for_decode->graph(); auto decoder = std::make_unique<loco::PermutingDecoder<loco::Domain::Matrix>>(); decoder->perm(perm<T>()); auto dec = g->nodes()->create<loco::MatrixDecode>(); dec->input(input_for_decode); dec->decoder(std::move(decoder)); return dec; } // template instantiation template loco::FeatureEncode * make_feature_encode<FeatureLayout::NHWC>(loco::Node *input_for_encode); template loco::FeatureDecode * make_feature_decode<FeatureLayout::NHWC>(loco::Node *input_for_encode); template loco::FilterEncode *make_filter_encode<FilterLayout::HWIO>(loco::Node *input_for_encode); template loco::FilterDecode *make_filter_decode<FilterLayout::OHWI>(loco::Node *input_for_decode); template loco::DepthwiseFilterDecode * make_dw_filter_decode<DepthwiseFilterLayout::HWCM>(loco::Node *input_for_decode); template loco::MatrixEncode *make_matrix_encode<MatrixLayout::HW>(loco::Node *input_for_encode); template loco::MatrixEncode *make_matrix_encode<MatrixLayout::WH>(loco::Node *input_for_encode); template loco::MatrixDecode *make_matrix_decode<MatrixLayout::HW>(loco::Node *input_for_decode); template loco::MatrixDecode *make_matrix_decode<MatrixLayout::WH>(loco::Node *input_for_decode); } // namespace luci
30.186235
98
0.725992
wateret
1db186488106b897f8da6df052c0a78a226a6b32
282
cpp
C++
bootloader/Disk/IDE/ATADevice.cpp
supercomputer7/nahmanboot2
6b4ed2db89394ef2e8d878df98a988e205a63ee6
[ "MIT" ]
3
2019-10-15T22:22:51.000Z
2019-11-29T10:39:28.000Z
bootloader/Disk/IDE/ATADevice.cpp
supercomputer7/nahmanboot2
6b4ed2db89394ef2e8d878df98a988e205a63ee6
[ "MIT" ]
null
null
null
bootloader/Disk/IDE/ATADevice.cpp
supercomputer7/nahmanboot2
6b4ed2db89394ef2e8d878df98a988e205a63ee6
[ "MIT" ]
null
null
null
#include <Disk/IDE/ATADevice.h> ATADevice::ATADevice(IDEController* controller,uint8_t port) : StorageDevice(controller,port) { this->transfer_mode = DefaultTransferMode; this->command_set = ATACommandSet; } uint16_t ATADevice::get_hardware_protocol() { return IDEATA; }
28.2
93
0.769504
supercomputer7
1db462dae1fb0729c9ed227bdd52f3bd84a163ba
793
hh
C++
pnmc/mc/classic/classic.hh
ahamez/pnmc
cee5f2e01edc2130278ebfc13f0f859230d65680
[ "BSD-2-Clause" ]
5
2015-02-05T20:56:20.000Z
2022-01-29T01:20:24.000Z
pnmc/mc/classic/classic.hh
ahamez/pnmc
cee5f2e01edc2130278ebfc13f0f859230d65680
[ "BSD-2-Clause" ]
null
null
null
pnmc/mc/classic/classic.hh
ahamez/pnmc
cee5f2e01edc2130278ebfc13f0f859230d65680
[ "BSD-2-Clause" ]
null
null
null
/// @file /// @copyright The code is licensed under the BSD License /// <http://opensource.org/licenses/BSD-2-Clause>, /// Copyright (c) 2013-2015 Alexandre Hamez. /// @author Alexandre Hamez #pragma once #include "conf/configuration.hh" #include "mc/mc_impl.hh" namespace pnmc { namespace mc { namespace classic { /*------------------------------------------------------------------------------------------------*/ struct classic : public mc_impl { conf::configuration conf; classic(conf::configuration c) : conf(std::move(c)) {} void operator()(const pn::net& net, const properties::formulae&) override; }; /*------------------------------------------------------------------------------------------------*/ }}} // namespace pnmc::mc::classic
24.78125
100
0.493064
ahamez
1db64e09e3c30a39480db9c8bbe73721e490e358
35
hpp
C++
src/boost_range_pointer.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
10
2018-03-17T00:58:42.000Z
2021-07-06T02:48:49.000Z
src/boost_range_pointer.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
2
2021-03-26T15:17:35.000Z
2021-05-20T23:55:08.000Z
src/boost_range_pointer.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
4
2019-05-28T21:06:37.000Z
2021-07-06T03:06:52.000Z
#include <boost/range/pointer.hpp>
17.5
34
0.771429
miathedev
1db98fdb3d8fba7fe7ffd6ce5db5f83ae1f7fe20
8,151
cpp
C++
src/lexical/lexical.cpp
MisakaCenter/SimpleCompiler
aafb13c6c6b2f20c19757ec8b04231746a298f55
[ "MIT" ]
24
2020-09-26T13:20:23.000Z
2022-03-09T18:56:58.000Z
src/lexical/lexical.cpp
MRNIU/Compiler
746106625ea6fba34f36bd04ac7f6394d82166a8
[ "MIT" ]
2
2020-07-19T23:35:02.000Z
2021-09-27T16:43:40.000Z
src/lexical/lexical.cpp
MRNIU/Compiler
746106625ea6fba34f36bd04ac7f6394d82166a8
[ "MIT" ]
11
2020-06-07T04:57:57.000Z
2021-08-03T08:00:48.000Z
// This file is a part of Simple-XX/SimpleCompiler // (https://github.com/Simple-XX/SimpleCompiler). // // lexical.cpp for Simple-XX/SimpleCompiler. #include "iostream" #include "string" #include "lexical.h" using namespace std; Keywords Lexer::keywords; Lexer::Lexer(Scanner &sc) : scanner(sc) { ch = ' '; token = NULL; return; } Lexer::~Lexer() { if (token != NULL) { delete token; } return; } bool Lexer::scan(char need) { ch = scanner.scan(); if (need) { if (ch != need) return false; ch = scanner.scan(); return true; } return true; } void Lexer::blank() { Token *t = NULL; // 跳过空字符 do { scan(); } while (COND_BLANK); token = t; return; } void Lexer::identifier() { Token *t = NULL; // 标识符 while (COND_IDENTIFIER) { string name = ""; do { // 记录字符 name.push_back(ch); scan(); } while (COND_IDENTIFIER || (ch >= '0' && ch <= '9')); // 判断是不是关键字 Tag tag = keywords.get_tag(name); // 如果不是,则为标识符 if (tag == ID) { t = new Id(name); } // 如果是 else { t = new Token(tag); } } token = t; return; } void Lexer::number() { Token *t = NULL; int val = 0; // 十进制数 do { // 计算数字 val = val * 10 + ch - '0'; } while (scan(), (ch >= '0' && ch <= '9')); t = new Num(val); token = t; return; } void Lexer::character() { Token *t = NULL; do { // 过滤掉第一个单引号 if (ch == '\'') { continue; } // 文件结束或换行 else if ((ch == '\n') || (ch == EOF) ) { t = new Token(ERR); error->set_err_no(ERR); error->display_err(); break; } // 转义字符 else if (ch == '\\') { scan(); if (ch == 'n') { t = new Char('\n'); } else if (ch == 't') { t = new Char('\t'); } else if (ch == '0') { t = new Char('\0'); } else if (ch == '\'') { t = new Char('\''); } else if (ch == '\\') { t = new Char('\\'); } else if ((ch == EOF) || (ch == '\n')) { t = new Token(ERR); error->set_err_no(ERR); error->display_err(); break; } // 其它的不转义 else { t = new Char(ch); } } // 一般情况 else { t = new Char(ch); } } while (scan('\'') == false); token = t; return; } void Lexer::str() { Token *t = NULL; string s = ""; do { // 过滤掉第一个双引号 if (ch == '"') { continue; } // 直接结束 else if ((ch == '\n') || (ch == EOF)) { t = new Token(ERR); error->set_err_no(ERR); error->display_err(); break; } // 转义字符 if (ch == '\\') { scan(); if (ch == 'n') { s.push_back('\n'); } else if (ch == 't') { s.push_back('\t'); } else if (ch == '0') { s.push_back('\0'); } else if (ch == '"') { s.push_back('"'); } else if (ch == '\\') { s.push_back('\\'); } else if (ch == '\n') { ; } else if (ch == EOF) { t = new Token(ERR); error->set_err_no(ERR); error->display_err(); break; } // 其它的不转义 else { s.push_back(ch); } } // 一般情况 else { s.push_back(ch); } } while (scan('"') == false); // 最终字符串 if (t == NULL) { t = new Str(s); } token = t; return; } void Lexer::separator() { Token *t = NULL; switch (ch) { case '(': t = new Token(LPAREN); break; case ')': t = new Token(RPAREN); break; case '{': t = new Token(LBRACE); break; case '}': t = new Token(RBRACE); break; case '[': t = new Token(LBRACKET); break; case ']': t = new Token(RBRACKET); break; case ',': t = new Token(COMMA); break; case ':': t = new Token(COLON); break; case ';': t = new Token(SEMICON); break; default: t = new Token(ERR); // 错误的词法记号 } scan(); token = t; return; } void Lexer::operation() { Token *t = NULL; switch (ch) { case '=': t = new Token(scan('=') ? EQU : ASSIGN); break; case '+': t = new Token(ADD); scan(); break; case '-': t = new Token(SUB); scan(); break; case '*': t = new Token(MUL); scan(); break; case '/': scan(); // 单行注释 if (ch == '/') { while (ch != '\n' && ch != EOF) scan(); } // 多行注释 else if (ch == '*') { while (scan(EOF) == false) { if (ch == '*') { if (scan('/')) break; } } // 没有闭合 if (ch == EOF) { cout << "多行注释未正常结束" << endl; } } // 否则为除号 else t = new Token(DIV); break; case '%': t = new Token(MOD); scan(); break; case '|': t = new Token(scan('|') ? OR : ORBIT); break; case '&': t = new Token(scan('&') ? AND : ANDBIT); break; case '^': t = new Token(EORBIT); scan(); break; case '!': t = new Token(scan('=') ? NEQU : NOT); break; case '>': t = new Token(scan('=') ? GE : GT); break; case '<': t = new Token(scan('=') ? LE : LT); break; // 除此以外是错误的 default: t = new Token(ERR); error->set_err_no(ERR); error->display_err(); scan(); } token = t; return; } Token *Lexer::lexing() { // 字符不为空且没有出错时 while ((is_done() == false)) { if (COND_BLANK) blank(); else if (COND_IDENTIFIER) identifier(); else if (COND_NUMBER) { number(); } else if (ch == '\'') { character(); } else if (ch == '"') { this->str(); } else if (COND_SEPARATOR) { separator(); } else if (COND_OPERATION) { operation(); } else { token = new Token(ERR); error->set_err_no(ERR); error->display_err(); return token; } // 更新 token 内容 if (token != NULL && token->tag != ERR) { return token; } } token = new Token(END); return token; } bool Lexer::is_done() const { return scanner.is_done() || (error->get_err_no() < 0); }
23.090652
63
0.330266
MisakaCenter
1dbaf0f021069a31137ec35db0a3d12bf546b1fe
7,538
cpp
C++
far/tracer.cpp
andrastantos/FarManager
1df1cd0f964c1e2fcde5ff108c2756b5ad5f71b7
[ "BSD-3-Clause" ]
null
null
null
far/tracer.cpp
andrastantos/FarManager
1df1cd0f964c1e2fcde5ff108c2756b5ad5f71b7
[ "BSD-3-Clause" ]
null
null
null
far/tracer.cpp
andrastantos/FarManager
1df1cd0f964c1e2fcde5ff108c2756b5ad5f71b7
[ "BSD-3-Clause" ]
null
null
null
/* tracer.cpp */ /* Copyright © 2016 Far Group All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "tracer.hpp" #include "imports.hpp" #include "farexcpt.hpp" #include "encoding.hpp" #include "pathmix.hpp" #include "platform.fs.hpp" #include "format.hpp" static auto GetBackTrace(const exception_context& Context) { std::vector<const void*> Result; // StackWalk64() may modify context record passed to it, so we will use a copy. auto ContextRecord = *Context.pointers()->ContextRecord; STACKFRAME64 StackFrame{}; #if defined(_WIN64) const DWORD MachineType = IMAGE_FILE_MACHINE_AMD64; StackFrame.AddrPC.Offset = ContextRecord.Rip; StackFrame.AddrFrame.Offset = ContextRecord.Rbp; StackFrame.AddrStack.Offset = ContextRecord.Rsp; #else const DWORD MachineType = IMAGE_FILE_MACHINE_I386; StackFrame.AddrPC.Offset = ContextRecord.Eip; StackFrame.AddrFrame.Offset = ContextRecord.Ebp; StackFrame.AddrStack.Offset = ContextRecord.Esp; #endif StackFrame.AddrPC.Mode = AddrModeFlat; StackFrame.AddrFrame.Mode = AddrModeFlat; StackFrame.AddrStack.Mode = AddrModeFlat; while (imports.StackWalk64(MachineType, GetCurrentProcess(), Context.thread_handle(), &StackFrame, &ContextRecord, nullptr, nullptr, nullptr, nullptr)) { Result.emplace_back(reinterpret_cast<const void*>(StackFrame.AddrPC.Offset)); } return Result; } static void GetSymbols(const std::vector<const void*>& BackTrace, const std::function<void(string&&, string&&, string&&)>& Consumer) { const auto Process = GetCurrentProcess(); const auto MaxNameLen = MAX_SYM_NAME; block_ptr<SYMBOL_INFO> Symbol(sizeof(SYMBOL_INFO) + MaxNameLen + 1); Symbol->SizeOfStruct = sizeof(SYMBOL_INFO); Symbol->MaxNameLen = MaxNameLen; imports.SymSetOptions(SYMOPT_LOAD_LINES | SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_INCLUDE_32BIT_MODULES); IMAGEHLP_MODULEW64 Module{ static_cast<DWORD>(aligned_size(offsetof(IMAGEHLP_MODULEW64, LoadedImageName), 8)) }; // use the pre-07-Jun-2002 struct size, aligned to 8 IMAGEHLP_LINE64 Line{ sizeof(Line) }; DWORD Displacement; const auto MaxAddressSize = format(L"{0:0X}", reinterpret_cast<uintptr_t>(*std::max_element(ALL_CONST_RANGE(BackTrace)))).size(); for (const auto i: BackTrace) { const auto Address = reinterpret_cast<DWORD_PTR>(i); const auto GotName = imports.SymFromAddr(Process, Address, nullptr, Symbol.get()) != FALSE; const auto GotModule = imports.SymGetModuleInfoW64(Process, Address, &Module) != FALSE; const auto GotSource = imports.SymGetLineFromAddr64(Process, Address, &Displacement, &Line) != FALSE; Consumer(format(L"0x{0:0{1}X}", Address, MaxAddressSize), format(L"{0}!{1}", GotModule? PointToName(Module.ImageName) : L""sv, GotName? encoding::ansi::get_chars(Symbol->Name) : L""s), GotSource? format(L"{0}:{1}", encoding::ansi::get_chars(Line.FileName), Line.LineNumber) : L""s); } } static auto GetSymbols(const std::vector<const void*>& BackTrace) { std::vector<string> Result; GetSymbols(BackTrace, [&](string&& Address, string&& Name, string&& Source) { if (!Name.empty()) append(Address, L' ', Name); if (!Source.empty()) append(Address, L" ("sv, Source, L')'); Result.emplace_back(std::move(Address)); }); return Result; } tracer* StaticInstance; static LONG WINAPI StackLogger(EXCEPTION_POINTERS *xp) { if (IsCppException(xp)) { // 0 indicates rethrow if (xp->ExceptionRecord->ExceptionInformation[1]) { if (StaticInstance) StaticInstance->store(ToPtr(xp->ExceptionRecord->ExceptionInformation[1]), xp); } } return EXCEPTION_CONTINUE_SEARCH; } tracer::veh_handler::veh_handler(PVECTORED_EXCEPTION_HANDLER Handler): m_Handler(imports.AddVectoredExceptionHandler(TRUE, Handler)) { } tracer::veh_handler::~veh_handler() { imports.RemoveVectoredExceptionHandler(m_Handler); } tracer::tracer(): m_Handler(StackLogger) { assert(!StaticInstance); string Path; if (os::fs::GetModuleFileName(nullptr, nullptr, Path)) { CutToParent(Path); m_SymbolSearchPath = encoding::ansi::get_bytes(Path); } StaticInstance = this; } tracer::~tracer() { assert(StaticInstance); StaticInstance = nullptr; } void tracer::store(const void* CppObject, const EXCEPTION_POINTERS* ExceptionInfo) { SCOPED_ACTION(os::critical_section_lock)(m_CS); if (m_CppMap.size() > 2048) { // We can't store them forever m_CppMap.clear(); } m_CppMap.emplace(CppObject, std::make_unique<exception_context>(ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo)); } std::unique_ptr<exception_context> tracer::get_context(const void* CppObject) { SCOPED_ACTION(os::critical_section_lock)(m_CS); auto Iterator = m_CppMap.find(CppObject); if (Iterator == m_CppMap.end()) return nullptr; auto Result = std::move(Iterator->second); m_CppMap.erase(Iterator); return Result; } std::unique_ptr<exception_context> tracer::get_exception_context(const void* CppObject) { return StaticInstance? StaticInstance->get_context(CppObject) : nullptr; } class with_symbols { public: NONCOPYABLE(with_symbols); with_symbols() { if (StaticInstance) StaticInstance->SymInitialise(); } ~with_symbols() { if (StaticInstance) StaticInstance->SymCleanup(); } }; std::vector<string> tracer::get(const void* CppObject) { const auto Context = StaticInstance? StaticInstance->get_context(CppObject) : nullptr; if (!Context) return {}; SCOPED_ACTION(with_symbols); return GetSymbols(GetBackTrace(*Context)); } std::vector<string> tracer::get(const exception_context& Context) { SCOPED_ACTION(with_symbols); return GetSymbols(GetBackTrace(Context)); } void tracer::get_one(const void* Ptr, string& Address, string& Name, string& Source) { SCOPED_ACTION(with_symbols); GetSymbols({Ptr}, [&](string&& StrAddress, string&& StrName, string&& StrSource) { Address = std::move(StrAddress); Name = std::move(StrName); Source = std::move(StrSource); }); } bool tracer::SymInitialise() { if (!m_SymInitialised) { m_SymInitialised = imports.SymInitialize(GetCurrentProcess(), EmptyToNull(m_SymbolSearchPath.c_str()), TRUE) != FALSE; } return m_SymInitialised; } void tracer::SymCleanup() { if (m_SymInitialised) { m_SymInitialised = !imports.SymCleanup(GetCurrentProcess()); } }
29.794466
166
0.756699
andrastantos
1dbb5b8f8b57ce06e2ba2cc701913588f7d58790
2,510
cpp
C++
src/Main.cpp
Joco223/LogicGateSimulator
78bdb72886a5b2908a073a168a141471aed636d8
[ "MIT" ]
null
null
null
src/Main.cpp
Joco223/LogicGateSimulator
78bdb72886a5b2908a073a168a141471aed636d8
[ "MIT" ]
null
null
null
src/Main.cpp
Joco223/LogicGateSimulator
78bdb72886a5b2908a073a168a141471aed636d8
[ "MIT" ]
null
null
null
#define SDL_MAIN_HANDLED #include "Simple2D.h" #include "Simple2D_Sprite.h" #include "Simple2D_Text.h" #include "Sandbox.h" #include "Camera.h" #include "GUI_Controller.h" #include "Chip.h" #include "Asset_loader.h" #include <iostream> #include <string> #include <optional> #include <functional> constexpr int width = 1600; constexpr int height = 900; constexpr Simple2D::Colour window_colour = {50, 50, 50, 255}; void placeholder() {} int main() { Simple2D::Context ctx(width, height, "LGS"); ctx.set_window_colour(window_colour); ctx.set_blending_mode(Simple2D::S2D_BLENDING_ALPHA); ctx.set_aa_mode(Simple2D::S2D_AA_LINEAR); Simple2D::Text_context text_ctx("assets/Cascadia.ttf"); Sandbox sandbox; GUI_Controller gui_controller = GUI_Controller(ctx, width, height); gui_controller.init_menu_bar(ctx, text_ctx); Asset_loader asset_loader; asset_loader.load_chips(ctx, "assets/chips/", gui_controller); asset_loader.load_logic_gates(ctx, "assets/logic_gates/", gui_controller); Camera camera = Camera(); int rel_x = 0; int rel_y = 0; int curr_mouse_x = 0; int curr_mouse_y = 0; while(!ctx.check_exit()) { ctx.clear(); rel_x = 0; rel_y = 0; std::optional<Simple2D::mouse_motion_e> mouse_motion_event = ctx.check_mouse_motion(); while(mouse_motion_event) { rel_x += mouse_motion_event->rel_x; rel_y -= mouse_motion_event->rel_y; curr_mouse_x = mouse_motion_event->x; curr_mouse_y = mouse_motion_event->y; gui_controller.handle_mouse_move(*mouse_motion_event); mouse_motion_event = ctx.check_mouse_motion(); } std::optional<Simple2D::mouse_button_e> mouse_button_event = ctx.check_mouse_button(); if(mouse_button_event) { camera.update_position(*mouse_button_event); gui_controller.handle_mouse_click(camera.get_pos_x(), camera.get_pos_y(), ctx, *mouse_button_event, sandbox); } std::optional<Simple2D::mouse_wheel_e> mouse_wheel_event = ctx.check_mouse_wheel(); if(mouse_wheel_event) { gui_controller.handle_mouse_scroll(*mouse_wheel_event, curr_mouse_x, curr_mouse_y); } std::optional<Simple2D::keyboard_e> keyboard_event = ctx.check_keyboard(); while(keyboard_event) { gui_controller.handle_keyboard(*keyboard_event); keyboard_event = ctx.check_keyboard(); } gui_controller.handle_events(ctx); camera.move_camera(rel_x, rel_y); sandbox.draw(camera.get_pos_x(), camera.get_pos_y(), ctx); gui_controller.draw_gui(ctx, text_ctx); ctx.draw(); } return 0; }
26.702128
112
0.741036
Joco223
1dbcf0e090976b6dd2c43c7613c9529903d8e7d2
4,827
cpp
C++
external/globjects-0.5.0/source/globjects/source/Buffer.cpp
steppobeck/rgbd-recon
171a8336c8e3ba52a1b187b73544338fdd3c9285
[ "MIT" ]
18
2016-09-03T05:12:25.000Z
2022-02-23T15:52:33.000Z
external/globjects-0.5.0/source/globjects/source/Buffer.cpp
3d-scan/rgbd-recon
c4a5614eaa55dd93c74da70d6fb3d813d74f2903
[ "MIT" ]
1
2016-05-04T09:06:29.000Z
2016-05-04T09:06:29.000Z
external/globjects-0.5.0/source/globjects/source/Buffer.cpp
3d-scan/rgbd-recon
c4a5614eaa55dd93c74da70d6fb3d813d74f2903
[ "MIT" ]
7
2016-04-20T13:58:50.000Z
2018-07-09T15:47:26.000Z
#include <globjects/Buffer.h> #include <cassert> #include <glbinding/gl/functions.h> #include <glbinding/gl/enum.h> #include <globjects/globjects.h> #include <globjects/ObjectVisitor.h> #include "registry/ImplementationRegistry.h" #include "Resource.h" #include "implementations/BufferImplementation_Legacy.h" using namespace gl; namespace { const globjects::AbstractBufferImplementation & implementation() { return globjects::ImplementationRegistry::current().bufferImplementation(); } } namespace globjects { void Buffer::hintBindlessImplementation(BindlessImplementation impl) { ImplementationRegistry::current().initialize(impl); } void Buffer::setWorkingTarget(GLenum target) { BufferImplementation_Legacy::s_workingTarget = target; } Buffer::Buffer() : Buffer(new BufferResource) { } Buffer::Buffer(IDResource * resource) : Object(resource) { } Buffer * Buffer::fromId(const GLuint id) { return new Buffer(new ExternalResource(id)); } Buffer::~Buffer() { } void Buffer::accept(ObjectVisitor& visitor) { visitor.visitBuffer(this); } void Buffer::bind(const GLenum target) const { glBindBuffer(target, id()); } void Buffer::unbind(const GLenum target) { glBindBuffer(target, 0); } void Buffer::unbind(const GLenum target, const GLuint index) { glBindBufferBase(target, index, 0); } const void * Buffer::map() const { return static_cast<const void*>(implementation().map(this, GL_READ_ONLY)); } void* Buffer::map(const GLenum access) { return implementation().map(this, access); } void* Buffer::mapRange(const GLintptr offset, const GLsizeiptr length, const BufferAccessMask access) { return implementation().mapRange(this, offset, length, access); } bool Buffer::unmap() const { return implementation().unmap(this); } void Buffer::flushMappedRange(const GLintptr offset, const GLsizeiptr length) { implementation().flushMappedRange(this, offset, length); } void Buffer::setData(const GLsizeiptr size, const GLvoid * data, const GLenum usage) { implementation().setData(this, size, data, usage); } void Buffer::setSubData(const GLintptr offset, const GLsizeiptr size, const GLvoid * data) { implementation().setSubData(this, offset, size, data); } void Buffer::setStorage(const GLsizeiptr size, const GLvoid * data, const BufferStorageMask flags) { implementation().setStorage(this, size, data, flags); } GLint Buffer::getParameter(const GLenum pname) const { return implementation().getParameter(this, pname); } GLint64 Buffer::getParameter64(const GLenum pname) const { return implementation().getParameter64(this, pname); } void Buffer::bindBase(const GLenum target, const GLuint index) const { glBindBufferBase(target, index, id()); } void Buffer::bindRange(const GLenum target, const GLuint index, const GLintptr offset, const GLsizeiptr size) const { glBindBufferRange(target, index, id(), offset, size); } void Buffer::copySubData(Buffer * buffer, const GLintptr readOffset, const GLintptr writeOffset, const GLsizeiptr size) const { assert(buffer != nullptr); implementation().copySubData(this, buffer, readOffset, writeOffset, size); } void Buffer::copySubData(Buffer * buffer, const GLsizeiptr size) const { copySubData(buffer, 0, 0, size); } void Buffer::copyData(Buffer * buffer, const GLsizeiptr size, const GLenum usage) const { assert(buffer != nullptr); buffer->setData(static_cast<GLsizei>(size), nullptr, usage); copySubData(buffer, 0, 0, size); } void Buffer::clearData(const GLenum internalformat, const GLenum format, const GLenum type, const void * data) { implementation().clearData(this, internalformat, format, type, data); } void Buffer::clearSubData(const GLenum internalformat, const GLintptr offset, const GLsizeiptr size, const GLenum format, const GLenum type, const void * data) { implementation().clearSubData(this, internalformat, offset, size, format, type, data); } const void * Buffer::getPointer() const { return getPointer(GL_BUFFER_MAP_POINTER); } void * Buffer::getPointer() { return getPointer(GL_BUFFER_MAP_POINTER); } const void * Buffer::getPointer(const GLenum pname) const { return implementation().getPointer(this, pname); } void * Buffer::getPointer(const GLenum pname) { return implementation().getPointer(this, pname); } void Buffer::getSubData(const GLintptr offset, const GLsizeiptr size, void * data) const { implementation().getBufferSubData(this, offset, size, data); } void Buffer::invalidateData() const { implementation().invalidateData(this); } void Buffer::invalidateSubData(const GLintptr offset, const GLsizeiptr length) const { implementation().invalidateSubData(this, offset, length); } GLenum Buffer::objectType() const { return GL_BUFFER; } } // namespace globjects
22.556075
159
0.743526
steppobeck
1dbe33122c6f57ab4b5641d23e26673155b0e28f
2,090
hpp
C++
Branch/Sensors/LaneDetectionMT/armadillo/include/armadillo_bits/spop_var_bones.hpp
Tsinghua-OpenICV/OpenICV
37bf88122414d0c766491460248f61fa1a9fd78c
[ "MIT" ]
12
2019-12-17T08:17:51.000Z
2021-12-14T03:13:10.000Z
Branch/Sensors/LaneDetectionMT/armadillo/include/armadillo_bits/spop_var_bones.hpp
Tsinghua-OpenICV/OpenICV
37bf88122414d0c766491460248f61fa1a9fd78c
[ "MIT" ]
null
null
null
Branch/Sensors/LaneDetectionMT/armadillo/include/armadillo_bits/spop_var_bones.hpp
Tsinghua-OpenICV/OpenICV
37bf88122414d0c766491460248f61fa1a9fd78c
[ "MIT" ]
7
2019-12-17T08:17:54.000Z
2022-02-21T15:53:57.000Z
// Copyright (C) 2012 Ryan Curtin // Copyright (C) 2012 Conrad Sanderson // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. //! \addtogroup spop_var //! @{ //! Class for finding variance values of a sparse matrix class spop_var { public: template<typename T1> inline static void apply(SpMat<typename T1::pod_type>& out, const mtSpOp<typename T1::pod_type, T1, spop_var>& in); template<typename T1> inline static void apply_noalias(SpMat<typename T1::pod_type>& out, const SpProxy<T1>& p, const uword norm_type, const uword dim); // Calculate variance of a sparse vector, where we can directly use the memory. template<typename T1> inline static typename T1::pod_type var_vec(const T1& X, const uword norm_type = 0); // Calculate the variance directly. Because this is for sparse matrices, we // specify both the number of elements in the array (the length of the array) // as well as the actual number of elements when zeros are included. template<typename eT> inline static eT direct_var(const eT* const X, const uword length, const uword N, const uword norm_type = 0); // For complex numbers. template<typename T> inline static T direct_var(const std::complex<T>* const X, const uword length, const uword N, const uword norm_type = 0); // Calculate the variance using iterators, for non-complex numbers. template<typename T1, typename eT> inline static eT iterator_var(T1& it, const T1& end, const uword n_zero, const uword norm_type, const eT junk1, const typename arma_not_cx<eT>::result* junk2 = 0); // Calculate the variance using iterators, for complex numbers. template<typename T1, typename eT> inline static typename get_pod_type<eT>::result iterator_var(T1& it, const T1& end, const uword n_zero, const uword norm_type, const eT junk1, const typename arma_cx_only<eT>::result* junk2 = 0); }; //! @}
38.703704
198
0.711962
Tsinghua-OpenICV
1dc0243aad3e3515f84aed1f4ddcfd73663abba7
848
cpp
C++
libraries/RelaisSwitch/RelaisSwitch.cpp
naice/arduino
c63763bc532df3ab446e9b6ce48aa127962c8b42
[ "MIT" ]
null
null
null
libraries/RelaisSwitch/RelaisSwitch.cpp
naice/arduino
c63763bc532df3ab446e9b6ce48aa127962c8b42
[ "MIT" ]
null
null
null
libraries/RelaisSwitch/RelaisSwitch.cpp
naice/arduino
c63763bc532df3ab446e9b6ce48aa127962c8b42
[ "MIT" ]
null
null
null
/* Name: RelaisSwitch.cpp Created: 10/6/2019 12:16:27 PM Author: Jens Marchewka */ #include "RelaisSwitch.h" RelaisSwitch::RelaisSwitch(unsigned int pin, bool defaultState, bool isDigital) { _currentState = defaultState; _isDigital = isDigital; _pin = pin; pinMode(_pin, OUTPUT); if (_currentState) Off(); else On(); } RelaisSwitch::~RelaisSwitch() { } bool RelaisSwitch::Toggle() { if (_currentState) Off(); else On(); return GetState(); } bool RelaisSwitch::GetState() { return _currentState; } void RelaisSwitch::On() { if (_isDigital) digitalWrite(_pin, HIGH); else analogWrite(_pin, HIGH); _currentState = true; } void RelaisSwitch::Off() { if (_isDigital) digitalWrite(_pin, LOW); else analogWrite(_pin, LOW); _currentState = false; }
14.62069
80
0.643868
naice
1dc1d5421cc00d6d799d8539294efd21790ee77b
1,126
cpp
C++
Dataset/Leetcode/train/4/331.cpp
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
Dataset/Leetcode/train/4/331.cpp
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
Dataset/Leetcode/train/4/331.cpp
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
class Solution { public: double XXX(vector<int>& nums1, vector<int>& nums2) { int n = nums1.size(), m = nums2.size(); if(!n && !m) return 0.0; int pos = (n + m - 1) >> 1; int l = max(0, pos - m), r = min(pos, n); while(l < r){ int mid = (l + r) >> 1; if(nums1[mid] < nums2[pos - mid - 1]) l = mid + 1; else r = mid; } if((n + m) & 1) { if(l >= n) return nums2[pos - l]; if(pos - l >= m) return nums1[l]; if(nums1[l] < nums2[pos - l]) return nums1[l]; return nums2[pos - l]; }else{ if(l >= n) return 0.5 * (nums2[pos - l] + nums2[pos - l + 1]); if(pos - l >= m) return 0.5 * (nums1[l] + nums1[l + 1]); if(pos - l + 1 < m && nums1[l] > nums2[pos - l + 1]) return 0.5 * (nums2[pos - l] + nums2[pos - l + 1]); else if(l + 1 < n && nums2[pos - l] > nums1[l + 1]) return 0.5 * (nums1[l] + nums1[l + 1]); else return 0.5 * (nums1[l] + nums2[pos - l]); } } };
36.322581
74
0.396092
kkcookies99
1dc28b05071c82fef4f3556987d03c1edd93db89
2,586
cpp
C++
cpp_CS225/daily-exercise/day29-deleteNode/potd-q29/main.cpp
Rothdyt/codes-for-courses
a2dfea516ebc7cabef31a5169533b6da352e7ccb
[ "MIT" ]
4
2018-09-23T00:00:13.000Z
2018-11-02T22:56:35.000Z
cpp_CS225/daily-exercise/day29-deleteNode/potd-q29/main.cpp
Rothdyt/codes-for-courses
a2dfea516ebc7cabef31a5169533b6da352e7ccb
[ "MIT" ]
null
null
null
cpp_CS225/daily-exercise/day29-deleteNode/potd-q29/main.cpp
Rothdyt/codes-for-courses
a2dfea516ebc7cabef31a5169533b6da352e7ccb
[ "MIT" ]
null
null
null
#include "TreeNode.h" #include <iostream> using namespace std; int main() { /* * Example 1: Deleting a leaf node * key = 14 * 9 * / \ * 5 12 * /\ / \ * 2 7 10 14 * * After deleteNode(14): * 9 * / \ * 5 12 * /\ / * 2 7 10 * * Example 2: Deleting a node which has only * one child. * 9 * / \ * 5 12 * / \ / * 2 7 10 * * After deleteNode(12): * 9 * / \ * 5 10 * / \ * 2 7 * * Example 3: Deleting a node with 2 children * After deleteNode(5): * Method 1 (IOS) * 9 * / \ * 7 10 * / * 2 * * Method 2 (IOP) * 9 * / \ * 2 10 * \ * 7 */ // TreeNode *root = new TreeNode(4); // root->left_ = new TreeNode(3); // root->right_ = new TreeNode(6); // root->left_->left_ = new TreeNode(2); // root->left_->left_->left_ = new TreeNode(1); // root->right_->right_ = new TreeNode(7); // root->right_->left_ = new TreeNode(5); TreeNode *root = new TreeNode(4); root->left_ = new TreeNode(2); root->right_ = new TreeNode(6); root->left_->left_ = new TreeNode(1); root->left_->right_ = new TreeNode(3); root->right_->right_ = new TreeNode(7); root->right_->left_ = new TreeNode(5); // TreeNode *root = new TreeNode(6); // root->left_ = new TreeNode(4); // root->left_->left_ = new TreeNode(2); // root->left_->right_ = new TreeNode(5); // root->left_->left_->right_ = new TreeNode(3); // root->left_->left_->left_ = new TreeNode(1); // root->right_ = new TreeNode(7); // cout << "Before deleting a leaf: " << endl; // inorderPrint(root); // cout << endl; // root = deleteNode(root, 14); // cout << "After deleting a leaf: " << endl; // inorderPrint(root); // cout << endl; // cout << "Before deleting a node with 1 child: " << endl; // inorderPrint(root); // cout << endl; // root = deleteNode(root, 12); // cout << "After deleting a node with 1 child: " << endl; // inorderPrint(root); // cout << endl; // cout << "Before deleting a node with 2 child: " << endl; // inorderPrint(root); // cout << endl; root = deleteNode(root, 4); // cout << "After deleting a node with 2 child: " << endl; // inorderPrint(root); // cout << endl; // cout << "Before deleting a node with 2 child: " << endl; // inorderPrint(root); // cout << endl; // root = deleteNode(root, 9); // cout << "After deleting a node with 2 child: " << endl; // inorderPrint(root); // cout << endl; deleteTree(root); return 0; }
22.884956
61
0.530549
Rothdyt
1dc576bf48afa274ca9f7b7f6b4c0f01740a7fb7
514
hpp
C++
src/AHardware/Registers/STM32F411/portslist.hpp
alexeysp11/Stm32Project
34e07644848e886a26d051d9d107f276ec1c7426
[ "MIT" ]
22
2019-09-07T22:38:01.000Z
2022-01-31T21:35:55.000Z
src/AHardware/Registers/STM32F411/portslist.hpp
alexeysp11/Stm32Project
34e07644848e886a26d051d9d107f276ec1c7426
[ "MIT" ]
null
null
null
src/AHardware/Registers/STM32F411/portslist.hpp
alexeysp11/Stm32Project
34e07644848e886a26d051d9d107f276ec1c7426
[ "MIT" ]
9
2019-09-22T11:26:24.000Z
2022-03-21T10:53:15.000Z
// // Created by Sergey on 28.10.2019. // #ifndef REGISTERS_PORTSLIST_HPP #define REGISTERS_PORTSLIST_HPP #include "susudefs.hpp" //for TypeList #include "gpioaregisters.hpp" // for GPIOA #include "gpiobregisters.hpp" // for GPIOB #include "gpiocregisters.hpp" // for GPIOC #include "gpiodregisters.hpp" // for GPIOD #include "gpioeregisters.hpp" // for GPIOE #include "gpiohregisters.hpp" // for GPIOH using PortsList = TypesList<GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOH> ; #endif //REGISTERS_PORTSLIST_HPP
25.7
71
0.749027
alexeysp11
1dc8046ca08e2ceb0b900c43badd205434e45c55
23,310
cpp
C++
oneflow/core/graph/boxing/collective_boxing_sub_task_graph_builder.cpp
basicv8vc/oneflow
2a0480b3f4ff42a59fcae945a3b3bb2d208e37a3
[ "Apache-2.0" ]
1
2020-10-13T03:03:40.000Z
2020-10-13T03:03:40.000Z
oneflow/core/graph/boxing/collective_boxing_sub_task_graph_builder.cpp
basicv8vc/oneflow
2a0480b3f4ff42a59fcae945a3b3bb2d208e37a3
[ "Apache-2.0" ]
null
null
null
oneflow/core/graph/boxing/collective_boxing_sub_task_graph_builder.cpp
basicv8vc/oneflow
2a0480b3f4ff42a59fcae945a3b3bb2d208e37a3
[ "Apache-2.0" ]
null
null
null
/* Copyright 2020 The OneFlow Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "oneflow/core/framework/to_string.h" #include "oneflow/core/graph/boxing/chain_sub_task_graph_builder.h" #include "oneflow/core/graph/boxing/collective_boxing_sub_task_graph_builder.h" #include "oneflow/core/graph/boxing/sub_task_graph_builder_util.h" #include "oneflow/core/graph/collective_boxing_task_node.h" #include "oneflow/core/graph/slice_boxing_task_node.h" namespace oneflow { using namespace boxing::collective; namespace { void NcclInitCollectiveNode(CollectiveBoxingGenericTaskNode* node, const ParallelDesc& parallel_desc, int64_t parallel_id, const std::string& name, const LogicalBlobId& lbi, const BlobDesc& logical_blob_desc, OpType op_type, int64_t root) { OperatorConf op_conf; op_conf.set_name(name); op_conf.set_device_tag(CHECK_JUST(DeviceTag4DeviceType(DeviceType::kGPU))); CollectiveBoxingGenericOpConf* conf = op_conf.mutable_collective_boxing_generic_conf(); *conf->mutable_lbi() = lbi; RankDesc* rank_desc = conf->mutable_rank_desc(); OpDesc* op_desc = rank_desc->mutable_op_desc(); op_desc->set_name(name); op_desc->set_op_type(op_type); if (op_type == OpType::kOpTypeAllReduce || op_type == OpType::kOpTypeReduceScatter || op_type == OpType::kOpTypeReduce) { op_desc->set_reduce_method(ReduceMethod::kReduceMethodSum); } op_desc->set_data_type(logical_blob_desc.data_type()); logical_blob_desc.shape().ToProto(op_desc->mutable_shape()); op_desc->set_num_ranks(parallel_desc.parallel_num()); if (op_type == OpType::kOpTypeBroadcast || op_type == OpType::kOpTypeReduce) { CHECK_GE(root, 0); CHECK_LT(root, parallel_desc.parallel_num()); op_desc->set_root(root); } else { CHECK_EQ(root, -1); } op_desc->set_backend(Backend::kBackendNCCL); rank_desc->set_rank(parallel_id); const int64_t machine_id = parallel_desc.MachineIdForParallelId(parallel_id); const int64_t device_id = parallel_desc.DeviceIdForParallelId(parallel_id); const int64_t thrd_id = Global<IDMgr>::Get()->GetGpuNcclThrdId(device_id); node->Init(machine_id, thrd_id, NewAreaId(), op_conf); } int64_t FindRootParallelId(const ParallelDesc& multi_device, const ParallelDesc& sole_device) { CHECK_EQ(sole_device.parallel_num(), 1); const int64_t root_machine_id = sole_device.MachineIdForParallelId(0); const int64_t root_device_id = sole_device.DeviceIdForParallelId(0); int64_t root_parallel_id = -1; FOR_RANGE(int64_t, i, 0, multi_device.parallel_num()) { if (multi_device.MachineIdForParallelId(i) == root_machine_id && multi_device.DeviceIdForParallelId(i) == root_device_id) { root_parallel_id = i; break; } } return root_parallel_id; } bool IsSourceTimeShape(const Shape& shape) { return shape.elem_cnt() == GlobalJobDesc().TotalBatchNum() * GlobalJobDesc().NumOfPiecesInBatch(); } class NcclCollectiveBoxingAllReduceSubTskGphBuilder final : public SubTskGphBuilder { public: OF_DISALLOW_COPY_AND_MOVE(NcclCollectiveBoxingAllReduceSubTskGphBuilder); NcclCollectiveBoxingAllReduceSubTskGphBuilder() = default; ~NcclCollectiveBoxingAllReduceSubTskGphBuilder() override = default; Maybe<SubTskGphBuilderStatus> Build(SubTskGphBuilderCtx* ctx, const std::vector<CompTaskNode*>& sorted_src_comp_tasks, const std::vector<CompTaskNode*>& sorted_dst_comp_tasks, const ParallelDesc& src_parallel_desc, const ParallelDesc& dst_parallel_desc, const LogicalBlobId& lbi, const BlobDesc& logical_blob_desc, const SbpParallel& src_sbp_parallel, const SbpParallel& dst_sbp_parallel) const override { if (dst_parallel_desc.Equals(src_parallel_desc) && !SubTskGphBuilderUtil::BlobHasDynamicShape(logical_blob_desc) && dst_parallel_desc.device_type() == DeviceType::kGPU && dst_parallel_desc.parallel_num() > 1 && SubTskGphBuilderUtil::IsBoxingP2B(src_sbp_parallel, dst_sbp_parallel)) { const std::string op_name = "System-Boxing-NcclCollectiveBoxingAllReduce-" + NewUniqueId(); FOR_RANGE(int64_t, i, 0, src_parallel_desc.parallel_num()) { CompTaskNode* src_node = sorted_src_comp_tasks.at(i); CompTaskNode* dst_node = sorted_dst_comp_tasks.at(i); auto* collective_node = ctx->task_graph()->NewNode<CollectiveBoxingGenericTaskNode>(); NcclInitCollectiveNode(collective_node, src_parallel_desc, i, op_name, lbi, logical_blob_desc, OpType::kOpTypeAllReduce, -1); Connect<TaskNode>(src_node, ctx->task_graph()->NewEdge(), collective_node); Connect<TaskNode>(collective_node, ctx->task_graph()->NewEdge(), dst_node); } return TRY(BuildSubTskGphBuilderStatus( sorted_src_comp_tasks.front(), sorted_dst_comp_tasks.front(), src_parallel_desc, dst_parallel_desc, src_sbp_parallel, dst_sbp_parallel, lbi, logical_blob_desc, "NcclCollectiveBoxingAllReduceSubTskGphBuilder", "")); } else { return Error::BoxingNotSupportedError(); } } }; class NcclCollectiveBoxingReduceScatterSubTskGphBuilder final : public SubTskGphBuilder { public: OF_DISALLOW_COPY_AND_MOVE(NcclCollectiveBoxingReduceScatterSubTskGphBuilder); NcclCollectiveBoxingReduceScatterSubTskGphBuilder() = default; ~NcclCollectiveBoxingReduceScatterSubTskGphBuilder() override = default; Maybe<SubTskGphBuilderStatus> Build(SubTskGphBuilderCtx* ctx, const std::vector<CompTaskNode*>& sorted_src_comp_tasks, const std::vector<CompTaskNode*>& sorted_dst_comp_tasks, const ParallelDesc& src_parallel_desc, const ParallelDesc& dst_parallel_desc, const LogicalBlobId& lbi, const BlobDesc& logical_blob_desc, const SbpParallel& src_sbp_parallel, const SbpParallel& dst_sbp_parallel) const override { if (dst_parallel_desc.Equals(src_parallel_desc) && !SubTskGphBuilderUtil::BlobHasDynamicShape(logical_blob_desc) && dst_parallel_desc.device_type() == DeviceType::kGPU && dst_parallel_desc.parallel_num() > 1 && logical_blob_desc.shape().At(0) % dst_parallel_desc.parallel_num() == 0 && SubTskGphBuilderUtil::IsBoxingP2S(src_sbp_parallel, dst_sbp_parallel) && dst_sbp_parallel.split_parallel().axis() == 0) { const std::string op_name = "System-Boxing-NcclCollectiveBoxingReduceScatter-" + NewUniqueId(); FOR_RANGE(int64_t, i, 0, src_parallel_desc.parallel_num()) { CompTaskNode* src_node = sorted_src_comp_tasks.at(i); CompTaskNode* dst_node = sorted_dst_comp_tasks.at(i); auto* collective_node = ctx->task_graph()->NewNode<CollectiveBoxingGenericTaskNode>(); NcclInitCollectiveNode(collective_node, src_parallel_desc, i, op_name, lbi, logical_blob_desc, OpType::kOpTypeReduceScatter, -1); Connect<TaskNode>(src_node, ctx->task_graph()->NewEdge(), collective_node); Connect<TaskNode>(collective_node, ctx->task_graph()->NewEdge(), dst_node); } return TRY(BuildSubTskGphBuilderStatus( sorted_src_comp_tasks.front(), sorted_dst_comp_tasks.front(), src_parallel_desc, dst_parallel_desc, src_sbp_parallel, dst_sbp_parallel, lbi, logical_blob_desc, "NcclCollectiveBoxingReduceScatterSubTskGphBuilder", "")); } else { return Error::BoxingNotSupportedError(); } } }; class NcclCollectiveBoxingAllGatherSubTskGphBuilder final : public SubTskGphBuilder { public: OF_DISALLOW_COPY_AND_MOVE(NcclCollectiveBoxingAllGatherSubTskGphBuilder); NcclCollectiveBoxingAllGatherSubTskGphBuilder() = default; ~NcclCollectiveBoxingAllGatherSubTskGphBuilder() override = default; Maybe<SubTskGphBuilderStatus> Build(SubTskGphBuilderCtx* ctx, const std::vector<CompTaskNode*>& sorted_src_comp_tasks, const std::vector<CompTaskNode*>& sorted_dst_comp_tasks, const ParallelDesc& src_parallel_desc, const ParallelDesc& dst_parallel_desc, const LogicalBlobId& lbi, const BlobDesc& logical_blob_desc, const SbpParallel& src_sbp_parallel, const SbpParallel& dst_sbp_parallel) const override { if (dst_parallel_desc.EqualsIgnoringDeviceType(src_parallel_desc) && !SubTskGphBuilderUtil::BlobHasDynamicShape(logical_blob_desc) && SubTskGphBuilderUtil::IsDeviceTypeCPUOrGPU(src_parallel_desc) && dst_parallel_desc.device_type() == DeviceType::kGPU && dst_parallel_desc.parallel_num() > 1 && logical_blob_desc.shape().At(0) % dst_parallel_desc.parallel_num() == 0 && SubTskGphBuilderUtil::IsBoxingS2B(src_sbp_parallel, dst_sbp_parallel) && src_sbp_parallel.split_parallel().axis() == 0) { const std::string op_name = "System-Boxing-NcclCollectiveBoxingAllGather-" + NewUniqueId(); FOR_RANGE(int64_t, i, 0, src_parallel_desc.parallel_num()) { CompTaskNode* src_comp_task = sorted_src_comp_tasks.at(i); CompTaskNode* dst_node = sorted_dst_comp_tasks.at(i); TaskNode* src_node = ctx->GetProxyNode(src_comp_task, src_comp_task->MemZoneId121(), dst_node->machine_id(), dst_node->MemZoneId121()); auto* collective_node = ctx->task_graph()->NewNode<CollectiveBoxingGenericTaskNode>(); NcclInitCollectiveNode(collective_node, dst_parallel_desc, i, op_name, lbi, logical_blob_desc, OpType::kOpTypeAllGather, -1); Connect<TaskNode>(src_node, ctx->task_graph()->NewEdge(), collective_node); Connect<TaskNode>(collective_node, ctx->task_graph()->NewEdge(), dst_node); } return TRY(BuildSubTskGphBuilderStatus( sorted_src_comp_tasks.front(), sorted_dst_comp_tasks.front(), src_parallel_desc, dst_parallel_desc, src_sbp_parallel, dst_sbp_parallel, lbi, logical_blob_desc, "NcclCollectiveBoxingReduceScatterSubTskGphBuilder", "")); } else { return Error::BoxingNotSupportedError(); } } }; class NcclCollectiveBoxingReduceSubTskGphBuilder final : public SubTskGphBuilder { public: OF_DISALLOW_COPY_AND_MOVE(NcclCollectiveBoxingReduceSubTskGphBuilder); NcclCollectiveBoxingReduceSubTskGphBuilder() = default; ~NcclCollectiveBoxingReduceSubTskGphBuilder() override = default; Maybe<SubTskGphBuilderStatus> Build(SubTskGphBuilderCtx* ctx, const std::vector<CompTaskNode*>& sorted_src_comp_tasks, const std::vector<CompTaskNode*>& sorted_dst_comp_tasks, const ParallelDesc& src_parallel_desc, const ParallelDesc& dst_parallel_desc, const LogicalBlobId& lbi, const BlobDesc& logical_blob_desc, const SbpParallel& src_sbp_parallel, const SbpParallel& dst_sbp_parallel) const override { if (src_parallel_desc.parallel_num() > 1 && dst_parallel_desc.parallel_num() == 1 && src_parallel_desc.device_type() == DeviceType::kGPU && dst_parallel_desc.device_type() == DeviceType::kGPU && !SubTskGphBuilderUtil::BlobHasDynamicShape(logical_blob_desc) && src_sbp_parallel.has_partial_sum_parallel()) { const int64_t root_parallel_id = FindRootParallelId(src_parallel_desc, dst_parallel_desc); if (root_parallel_id == -1) { return Error::BoxingNotSupportedError(); } const std::string op_name = "System-Boxing-NcclCollectiveBoxingReduce-" + NewUniqueId(); FOR_RANGE(int64_t, i, 0, src_parallel_desc.parallel_num()) { CompTaskNode* src_node = sorted_src_comp_tasks.at(i); auto* collective_node = ctx->task_graph()->NewNode<CollectiveBoxingGenericTaskNode>(); NcclInitCollectiveNode(collective_node, src_parallel_desc, i, op_name, lbi, logical_blob_desc, OpType::kOpTypeReduce, root_parallel_id); Connect<TaskNode>(src_node, ctx->task_graph()->NewEdge(), collective_node); CompTaskNode* dst_node = sorted_dst_comp_tasks.front(); if (i == root_parallel_id) { Connect<TaskNode>(collective_node, ctx->task_graph()->NewEdge(), dst_node); } else { collective_node->BuildCtrlRegstDesc(dst_node); Connect<TaskNode>(collective_node, ctx->task_graph()->NewEdge(), dst_node); } } return TRY(BuildSubTskGphBuilderStatus( sorted_src_comp_tasks.front(), sorted_dst_comp_tasks.front(), src_parallel_desc, dst_parallel_desc, src_sbp_parallel, dst_sbp_parallel, lbi, logical_blob_desc, "NcclCollectiveBoxingReduceScatterSubTskGphBuilder", "")); } else { return Error::BoxingNotSupportedError(); } } }; class CollectiveBoxingScatterThenNcclAllGatherSubTskGphBuilder final : public SubTskGphBuilder { public: OF_DISALLOW_COPY_AND_MOVE(CollectiveBoxingScatterThenNcclAllGatherSubTskGphBuilder); CollectiveBoxingScatterThenNcclAllGatherSubTskGphBuilder() = default; ~CollectiveBoxingScatterThenNcclAllGatherSubTskGphBuilder() override = default; Maybe<SubTskGphBuilderStatus> Build(SubTskGphBuilderCtx* ctx, const std::vector<CompTaskNode*>& sorted_src_comp_tasks, const std::vector<CompTaskNode*>& sorted_dst_comp_tasks, const ParallelDesc& src_parallel_desc, const ParallelDesc& dst_parallel_desc, const LogicalBlobId& lbi, const BlobDesc& logical_blob_desc, const SbpParallel& src_sbp_parallel, const SbpParallel& dst_sbp_parallel) const override { if (src_parallel_desc.parallel_num() == 1 && dst_parallel_desc.parallel_num() > 1 && src_parallel_desc.device_type() == DeviceType::kCPU && dst_parallel_desc.device_type() == DeviceType::kGPU && !SubTskGphBuilderUtil::BlobHasDynamicShape(logical_blob_desc) && logical_blob_desc.shape().elem_cnt() >= 1024 && dst_sbp_parallel.has_broadcast_parallel() // a potential optimization: flat the blob and then relax this requirement && logical_blob_desc.shape().At(0) % dst_parallel_desc.parallel_num() == 0) { const TensorSliceView in_slice = SubTskGphBuilderUtil::GetBroadcastTensorSliceView(logical_blob_desc); SbpParallel split_sbp_parallel; split_sbp_parallel.mutable_split_parallel()->set_axis(0); std::vector<TensorSliceView> out_slices = SubTskGphBuilderUtil::GetTensorSliceView( dst_parallel_desc.parallel_num(), split_sbp_parallel, logical_blob_desc); const std::string op_name = "System-Boxing-NcclCollectiveBoxingAllGather-" + NewUniqueId(); FOR_RANGE(int64_t, out_id, 0, dst_parallel_desc.parallel_num()) { const TensorSliceView& out_slice = out_slices.at(out_id); CompTaskNode* dst_node = sorted_dst_comp_tasks.at(out_id); CompTaskNode* src_node = SubTskGphBuilderUtil::FindNearestNode(sorted_src_comp_tasks, dst_node); SliceBoxingTaskNode* slice_node = ctx->task_graph()->NewNode<SliceBoxingTaskNode>(); // slice on cpu const auto src_machine_id = src_parallel_desc.MachineIdForParallelId(0); slice_node->Init(lbi, out_slice, kSliceBoxingTaskModeCopy, src_machine_id, Global<IDMgr>::Get()->PickCpuThrdIdEvenly(src_machine_id)); slice_node->ConnectToSrcNodeWithSlice(src_node, ctx->task_graph()->NewEdge(), in_slice); // copy to dst gpu TaskNode* slice_node_proxy = ctx->GetProxyNode(slice_node, slice_node->MemZoneId121(), dst_node->machine_id(), dst_node->MemZoneId121()); // allgather auto* collective_node = ctx->task_graph()->NewNode<CollectiveBoxingGenericTaskNode>(); NcclInitCollectiveNode(collective_node, dst_parallel_desc, out_id, op_name, lbi, logical_blob_desc, OpType::kOpTypeAllGather, -1); Connect<TaskNode>(slice_node_proxy, ctx->task_graph()->NewEdge(), collective_node); Connect<TaskNode>(collective_node, ctx->task_graph()->NewEdge(), dst_node); } return TRY(BuildSubTskGphBuilderStatus( sorted_src_comp_tasks.front(), sorted_dst_comp_tasks.front(), src_parallel_desc, dst_parallel_desc, src_sbp_parallel, dst_sbp_parallel, lbi, logical_blob_desc, "NcclCollectiveBoxingReduceScatterSubTskGphBuilder", "")); } else { return Error::BoxingNotSupportedError(); } }; }; class NcclCollectiveBoxingBroadcastSubTskGphBuilder final : public SubTskGphBuilder { public: OF_DISALLOW_COPY_AND_MOVE(NcclCollectiveBoxingBroadcastSubTskGphBuilder); NcclCollectiveBoxingBroadcastSubTskGphBuilder() = default; ~NcclCollectiveBoxingBroadcastSubTskGphBuilder() override = default; Maybe<SubTskGphBuilderStatus> Build(SubTskGphBuilderCtx* ctx, const std::vector<CompTaskNode*>& sorted_src_comp_tasks, const std::vector<CompTaskNode*>& sorted_dst_comp_tasks, const ParallelDesc& src_parallel_desc, const ParallelDesc& dst_parallel_desc, const LogicalBlobId& lbi, const BlobDesc& logical_blob_desc, const SbpParallel& src_sbp_parallel, const SbpParallel& dst_sbp_parallel) const override { if (src_parallel_desc.parallel_num() == 1 && dst_parallel_desc.parallel_num() > 1 && (src_parallel_desc.device_type() == DeviceType::kGPU || (src_parallel_desc.device_type() == DeviceType::kCPU && logical_blob_desc.shape().elem_cnt() >= 1024)) && dst_parallel_desc.device_type() == DeviceType::kGPU && !SubTskGphBuilderUtil::BlobHasDynamicShape(logical_blob_desc) && dst_sbp_parallel.has_broadcast_parallel()) { TaskNode* gpu_src_node = nullptr; int64_t root_parallel_id = -1; if (src_parallel_desc.device_type() == DeviceType::kCPU) { auto* cpu_src_node = sorted_src_comp_tasks.front(); root_parallel_id = SubTskGphBuilderUtil::FindNearestNodeIndex(sorted_dst_comp_tasks, cpu_src_node); auto* nearest_dst_node = sorted_dst_comp_tasks.at(root_parallel_id); gpu_src_node = ctx->GetProxyNode(cpu_src_node, cpu_src_node->MemZoneId121(), nearest_dst_node->machine_id(), nearest_dst_node->MemZoneId121()); } else if (src_parallel_desc.device_type() == DeviceType::kGPU) { root_parallel_id = FindRootParallelId(dst_parallel_desc, src_parallel_desc); gpu_src_node = sorted_src_comp_tasks.front(); } else { return Error::BoxingNotSupportedError(); } if (root_parallel_id == -1) { return Error::BoxingNotSupportedError(); } const std::string op_name = "System-Boxing-NcclCollectiveBoxingBroadcast-" + NewUniqueId(); FOR_RANGE(int64_t, i, 0, dst_parallel_desc.parallel_num()) { CompTaskNode* dst_node = sorted_dst_comp_tasks.at(i); auto* collective_node = ctx->task_graph()->NewNode<CollectiveBoxingGenericTaskNode>(); NcclInitCollectiveNode(collective_node, dst_parallel_desc, i, op_name, lbi, logical_blob_desc, OpType::kOpTypeBroadcast, root_parallel_id); if (i == root_parallel_id) { Connect<TaskNode>(gpu_src_node, ctx->task_graph()->NewEdge(), collective_node); } else { gpu_src_node->BuildCtrlRegstDesc(collective_node); Connect<TaskNode>(gpu_src_node, ctx->task_graph()->NewEdge(), collective_node); } Connect<TaskNode>(collective_node, ctx->task_graph()->NewEdge(), dst_node); } return TRY(BuildSubTskGphBuilderStatus( sorted_src_comp_tasks.front(), sorted_dst_comp_tasks.front(), src_parallel_desc, dst_parallel_desc, src_sbp_parallel, dst_sbp_parallel, lbi, logical_blob_desc, "NcclCollectiveBoxingReduceScatterSubTskGphBuilder", "")); } else { return Error::BoxingNotSupportedError(); } } }; } // namespace CollectiveBoxingSubTskGphBuilder::CollectiveBoxingSubTskGphBuilder() { std::vector<std::shared_ptr<SubTskGphBuilder>> builders; builders.emplace_back(new NcclCollectiveBoxingAllReduceSubTskGphBuilder()); builders.emplace_back(new NcclCollectiveBoxingReduceScatterSubTskGphBuilder()); builders.emplace_back(new NcclCollectiveBoxingAllGatherSubTskGphBuilder()); builders.emplace_back(new NcclCollectiveBoxingReduceSubTskGphBuilder()); builders.emplace_back(new CollectiveBoxingScatterThenNcclAllGatherSubTskGphBuilder()); builders.emplace_back(new NcclCollectiveBoxingBroadcastSubTskGphBuilder()); chain_builder_.reset(new ChainSubTskGphBuilder(builders)); } Maybe<SubTskGphBuilderStatus> CollectiveBoxingSubTskGphBuilder::Build( SubTskGphBuilderCtx* ctx, const std::vector<CompTaskNode*>& sorted_src_comp_tasks, const std::vector<CompTaskNode*>& sorted_dst_comp_tasks, const ParallelDesc& src_parallel_desc, const ParallelDesc& dst_parallel_desc, const LogicalBlobId& lbi, const BlobDesc& logical_blob_desc, const SbpParallel& src_sbp_parallel, const SbpParallel& dst_sbp_parallel) const { if (!GlobalJobDesc().Bool("__is_user_function__")) { return Error::BoxingNotSupportedError(); } if (!IsSourceTimeShape(*sorted_src_comp_tasks.front()->logical_node()->out_blob_time_shape())) { return Error::BoxingNotSupportedError(); } return chain_builder_->Build(ctx, sorted_src_comp_tasks, sorted_dst_comp_tasks, src_parallel_desc, dst_parallel_desc, lbi, logical_blob_desc, src_sbp_parallel, dst_sbp_parallel); } } // namespace oneflow
57.132353
100
0.691334
basicv8vc
1dcdce8e8177bd2864ce93cc65604a6fd5f39ca3
9,315
cc
C++
ash/app_list/app_list_color_provider_impl.cc
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
1
2021-11-16T13:10:29.000Z
2021-11-16T13:10:29.000Z
ash/app_list/app_list_color_provider_impl.cc
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
ash/app_list/app_list_color_provider_impl.cc
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ash/app_list/app_list_color_provider_impl.h" #include "ash/constants/ash_features.h" #include "ash/public/cpp/style/color_provider.h" #include "ash/shell.h" #include "ash/style/ash_color_provider.h" #include "ash/style/default_colors.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" namespace ash { namespace { // Helper to check if tablet mode is enabled. bool IsTabletModeEnabled() { return Shell::Get()->tablet_mode_controller() && Shell::Get()->tablet_mode_controller()->InTabletMode(); } } // namespace AppListColorProviderImpl::AppListColorProviderImpl() : ash_color_provider_(AshColorProvider::Get()), is_dark_light_mode_enabled_(features::IsDarkLightModeEnabled()), is_productivity_launcher_enabled_( features::IsProductivityLauncherEnabled()), is_background_blur_enabled_(features::IsBackgroundBlurEnabled()) {} AppListColorProviderImpl::~AppListColorProviderImpl() = default; SkColor AppListColorProviderImpl::GetExpandArrowIconBaseColor() const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetContentLayerColor( AshColorProvider::ContentLayerType::kButtonIconColor); } return SK_ColorWHITE; // default_color } SkColor AppListColorProviderImpl::GetExpandArrowIconBackgroundColor() const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetControlsLayerColor( AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive); } return SkColorSetARGB(0xF, 0xFF, 0xFF, 0xFF); // default_color } SkColor AppListColorProviderImpl::GetAppListBackgroundColor( bool is_tablet_mode, SkColor default_color) const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetShieldLayerColor( is_tablet_mode ? AshColorProvider::ShieldLayerType::kShield40 : AshColorProvider::ShieldLayerType::kShield80); } return default_color; } SkColor AppListColorProviderImpl::GetSearchBoxBackgroundColor() const { if (ShouldUseDarkLightColors()) { if (IsTabletModeEnabled()) { return ash_color_provider_->GetBaseLayerColor( is_background_blur_enabled_ ? AshColorProvider::BaseLayerType::kTransparent80 : AshColorProvider::BaseLayerType::kTransparent95); } else { return ash_color_provider_->GetControlsLayerColor( AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive); } } return SK_ColorWHITE; // default_color } SkColor AppListColorProviderImpl::GetSearchBoxCardBackgroundColor() const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetBaseLayerColor( is_background_blur_enabled_ ? AshColorProvider::BaseLayerType::kTransparent80 : AshColorProvider::BaseLayerType::kTransparent95); } return SK_ColorWHITE; // default_color } SkColor AppListColorProviderImpl::GetSearchBoxTextColor( SkColor default_color) const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetContentLayerColor( AshColorProvider::ContentLayerType::kTextColorPrimary); } return default_color; } SkColor AppListColorProviderImpl::GetSearchBoxSecondaryTextColor( SkColor default_color) const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetContentLayerColor( AshColorProvider::ContentLayerType::kTextColorSecondary); } return default_color; } SkColor AppListColorProviderImpl::GetSuggestionChipBackgroundColor() const { if (ShouldUseDarkLightColors()) { if (IsTabletModeEnabled()) { return ash_color_provider_->GetBaseLayerColor( AshColorProvider::BaseLayerType::kTransparent80); } else { return ash_color_provider_->GetControlsLayerColor( AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive); } } return SkColorSetA(gfx::kGoogleGrey100, 0x14); // default_color } SkColor AppListColorProviderImpl::GetSuggestionChipTextColor() const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetContentLayerColor( AshColorProvider::ContentLayerType::kTextColorPrimary); } return gfx::kGoogleGrey100; // default_color } SkColor AppListColorProviderImpl::GetAppListItemTextColor( bool is_in_folder) const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetContentLayerColor( ColorProvider::ContentLayerType::kTextColorPrimary); } return is_in_folder ? SK_ColorBLACK : SK_ColorWHITE; } SkColor AppListColorProviderImpl::GetPageSwitcherButtonColor( bool is_root_app_grid_page_switcher) const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetContentLayerColor( ColorProvider::ContentLayerType::kButtonIconColor); } // default_color return is_root_app_grid_page_switcher ? SkColorSetARGB(255, 232, 234, 237) : SkColorSetA(SK_ColorBLACK, 138); } SkColor AppListColorProviderImpl::GetSearchBoxIconColor( SkColor default_color) const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetContentLayerColor( ColorProvider::ContentLayerType::kButtonIconColor); } return default_color; } SkColor AppListColorProviderImpl::GetFolderBackgroundColor() const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetBaseLayerColor( ColorProvider::BaseLayerType::kTransparent80); } return SK_ColorWHITE; } SkColor AppListColorProviderImpl::GetFolderBubbleColor() const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetControlsLayerColor( ColorProvider::ControlsLayerType::kControlBackgroundColorInactive); } return SkColorSetA(gfx::kGoogleGrey100, 0x7A); } SkColor AppListColorProviderImpl::GetFolderTitleTextColor() const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetContentLayerColor( ColorProvider::ContentLayerType::kTextColorPrimary); } return gfx::kGoogleGrey700; } SkColor AppListColorProviderImpl::GetFolderHintTextColor() const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetContentLayerColor( ColorProvider::ContentLayerType::kTextColorSecondary); } return gfx::kGoogleGrey600; } SkColor AppListColorProviderImpl::GetFolderNameBorderColor(bool active) const { if (!active) return SK_ColorTRANSPARENT; return ash_color_provider_->GetControlsLayerColor( AshColorProvider::ControlsLayerType::kFocusRingColor); } SkColor AppListColorProviderImpl::GetFolderNameSelectionColor() const { return ash_color_provider_->GetControlsLayerColor( AshColorProvider::ControlsLayerType::kFocusAuraColor); } SkColor AppListColorProviderImpl::GetContentsBackgroundColor() const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetControlsLayerColor( ColorProvider::ControlsLayerType::kControlBackgroundColorInactive); } return SkColorSetRGB(0xF2, 0xF2, 0xF2); // default_color } SkColor AppListColorProviderImpl::GetGridBackgroundCardActiveColor() const { const SkColor background_color = GetGridBackgroundCardInactiveColor(); return SkColorSetA( background_color, SkColorGetA(background_color) + 255 * (1.0f + AshColorProvider::Get() ->GetInkDropBaseColorAndOpacity(background_color) .second)); } SkColor AppListColorProviderImpl::GetGridBackgroundCardInactiveColor() const { return AshColorProvider::Get()->GetControlsLayerColor( AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive); } SkColor AppListColorProviderImpl::GetSeparatorColor() const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetContentLayerColor( ColorProvider::ContentLayerType::kSeparatorColor); } return SkColorSetA(gfx::kGoogleGrey900, 0x24); // default_color } SkColor AppListColorProviderImpl::GetFocusRingColor() const { if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetControlsLayerColor( ColorProvider::ControlsLayerType::kFocusRingColor); } return gfx::kGoogleBlue600; // default_color } SkColor AppListColorProviderImpl::GetInkDropBaseColor(SkColor bg_color) const { return ash_color_provider_->GetInkDropBaseColorAndOpacity(bg_color).first; } float AppListColorProviderImpl::GetInkDropOpacity(SkColor bg_color) const { return ash_color_provider_->GetInkDropBaseColorAndOpacity(bg_color).second; } SkColor AppListColorProviderImpl::GetSearchResultViewHighlightColor() const { // Use highlight colors when Dark Light mode is enabled. if (ShouldUseDarkLightColors()) { return ash_color_provider_->GetContentLayerColor( AshColorProvider::ContentLayerType::kHighlightColorHover); } // Use inkdrop colors by default. return SkColorSetA(GetInkDropBaseColor(GetSearchBoxBackgroundColor()), GetInkDropOpacity(GetSearchBoxBackgroundColor()) * 255); } bool AppListColorProviderImpl::ShouldUseDarkLightColors() const { return is_dark_light_mode_enabled_ || is_productivity_launcher_enabled_; } } // namespace ash
35.418251
80
0.76672
zealoussnow
1dcf5d1e86209f5c463b9c4bf8f376a41a430ad4
2,386
cc
C++
art/Framework/Principal/ProcessTag.cc
drbenmorgan/fnal-art
31b8a5c76af364bbbfd8960bc2039b4f3cd47ae3
[ "BSD-3-Clause" ]
null
null
null
art/Framework/Principal/ProcessTag.cc
drbenmorgan/fnal-art
31b8a5c76af364bbbfd8960bc2039b4f3cd47ae3
[ "BSD-3-Clause" ]
null
null
null
art/Framework/Principal/ProcessTag.cc
drbenmorgan/fnal-art
31b8a5c76af364bbbfd8960bc2039b4f3cd47ae3
[ "BSD-3-Clause" ]
2
2020-09-26T01:37:11.000Z
2021-05-03T13:02:24.000Z
#include "art/Framework/Principal/ProcessTag.h" #include "art/Persistency/Provenance/ModuleDescription.h" using namespace std::string_literals; namespace { std::string const current_process_lit{"current_process"}; std::string const input_source_lit{"input_source"}; auto allowed_search_policy(std::string const& specified_name, std::string const& current_process_name) { using allowed_search = art::ProcessTag::allowed_search; // If user specifies the literal "current_process" or a name that // matches the current process name, then only current-process // searching is allowed. if (specified_name == current_process_lit || specified_name == current_process_name) { return allowed_search::current_process; } // If user specifies the literal "input_source" or a non-empty // process name (that does not correspond to the current process, // which is handled above), then only input-source searching is // allowed. if (specified_name == input_source_lit || !specified_name.empty()) { return allowed_search::input_source; } // Default to searching all processes return allowed_search::all_processes; } std::string process_name(std::string const& specified_name, std::string const& current_process_name) { if (specified_name == current_process_lit) { return current_process_name; } else if (specified_name == input_source_lit) { return {}; } return specified_name; } } art::ProcessTag::ProcessTag() = default; art::ProcessTag::ProcessTag(std::string const& specified_name) : name_{specified_name} {} art::ProcessTag::ProcessTag(std::string const& specified_name, std::string const& current_process_name) : search_{allowed_search_policy(specified_name, current_process_name)} , name_{process_name(specified_name, current_process_name)} {} bool art::ProcessTag::input_source_search_allowed() const { using allowed_search = ProcessTag::allowed_search; return search_ == allowed_search::all_processes || search_ == allowed_search::input_source; } bool art::ProcessTag::current_process_search_allowed() const { using allowed_search = ProcessTag::allowed_search; return search_ == allowed_search::all_processes || search_ == allowed_search::current_process; }
31.813333
72
0.719195
drbenmorgan
1b8efa7675d18b6880c0accafd7002abd79f228a
1,304
cxx
C++
test/epoch_allocator.cxx
cychan-lbnl/devastator
a23bb21f9da5841fa2036edc68f3a89a2241831b
[ "BSD-3-Clause-LBNL" ]
1
2022-03-16T08:11:02.000Z
2022-03-16T08:11:02.000Z
test/epoch_allocator.cxx
cychan-lbnl/devastator
a23bb21f9da5841fa2036edc68f3a89a2241831b
[ "BSD-3-Clause-LBNL" ]
null
null
null
test/epoch_allocator.cxx
cychan-lbnl/devastator
a23bb21f9da5841fa2036edc68f3a89a2241831b
[ "BSD-3-Clause-LBNL" ]
null
null
null
#include <devastator/diagnostic.hxx> #include <devastator/threads/epoch_allocator.hxx> #include <random> #include <map> #include <deque> #include <vector> using namespace std; template<int epochs> void test() { deva::threads::epoch_allocator<epochs> ma; ma.init(nullptr, 1<<20); map<uintptr_t, uintptr_t> liveset; deque<vector<uintptr_t>> live_at(epochs); default_random_engine rng(0); for(int e=0; e < 10000; e++) { int q = rng() % 10; for(int m=0; m < q; m++) { size_t sz = 1 + (rng() % 256); uintptr_t p = reinterpret_cast<uintptr_t>(ma.allocate(sz, 1)); auto bef = liveset.lower_bound(p); auto aft = liveset.lower_bound(p + sz); DEVA_ASSERT_ALWAYS(bef == aft, "p="<<p<<" "<<p+sz<<" bef="<<bef->first<<' '<<bef->first+bef->second<<" aft="<<aft->first); if(bef != liveset.begin()) { --bef; DEVA_ASSERT_ALWAYS(bef->first + bef->second <= p); } live_at.back().push_back(p); liveset[p] = sz; } ma.bump_epoch(); for(uintptr_t p: live_at[0]) { DEVA_ASSERT_ALWAYS(liveset.count(p)); liveset.erase(p); } live_at.pop_front(); live_at.push_back({}); } } int main() { test<2>(); test<3>(); test<4>(); test<5>(); std::cout<<"SUCCESS\n"; return 0; }
22.877193
128
0.585123
cychan-lbnl
1b8ff835b8d5dd033dc69a3c0fffc3c20fd65f39
1,631
cpp
C++
getMathML/Modules/XML/XMLNodeList.cpp
TanWei/getMathML
b6fbef24aaa5e80229cce42823f7595f1fe78ddf
[ "MIT" ]
null
null
null
getMathML/Modules/XML/XMLNodeList.cpp
TanWei/getMathML
b6fbef24aaa5e80229cce42823f7595f1fe78ddf
[ "MIT" ]
null
null
null
getMathML/Modules/XML/XMLNodeList.cpp
TanWei/getMathML
b6fbef24aaa5e80229cce42823f7595f1fe78ddf
[ "MIT" ]
null
null
null
// XMLNodeList.cpp: implementation of the CXMLNodeList class. //CXMLNodeList: Node List read-only collection ////////////////////////////////////////////////////////////////////// #include "XML.h" #include "TFuncCalls.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CXMLNodeList::CXMLNodeList(const MSXML2::IXMLDOMNodeListPtr& ptr) :m_ptrList(ptr) { } CXMLNodeList::~CXMLNodeList() { } CXMLNode CXMLNodeList::operator[](unsigned long ulIndex)const { ValidateState(); return CXMLNode(TCallMemberFunc1( m_ptrList.GetInterfacePtr(),&MSXML2::IXMLDOMNodeList::Getitem,ulIndex)); } unsigned long CXMLNodeList::GetLength() const { ValidateState(); long lLength = TCallMemberFunc0( m_ptrList.GetInterfacePtr(),&MSXML2::IXMLDOMNodeList::Getlength); return ((lLength<0) ? 0 : lLength); } CXMLNode CXMLNodeList::NextNode() const { ValidateState(); return CXMLNode(TCallMemberFunc0( m_ptrList.GetInterfacePtr(),&MSXML2::IXMLDOMNodeList::nextNode)); } void CXMLNodeList::Reset() const { ValidateState(); TCallMemberFunc0(m_ptrList.GetInterfacePtr(), &MSXML2::IXMLDOMNodeList::reset); } MSXML2::IXMLDOMNodeListPtr CXMLNodeList::GetListPtr() const { return m_ptrList; } CXMLNodeList::operator MSXML2::IXMLDOMNodeListPtr()const { return m_ptrList; } CXMLNodeList::operator bool()const { return m_ptrList.operator bool(); } void CXMLNodeList::ValidateState() const { if(! m_ptrList.operator bool()) { throw CXMLError( L"CXMLNodeList::ValidateState() NULL Pointer Detected"); } }
21.181818
74
0.659718
TanWei
1b90e91ef9a796654807084a0577c3ab2330c503
351
cpp
C++
CodeChef/SQUIDRULE/solution.cpp
afifabroory/CompetitiveProgramming
231883eeab5abbd84005e80c5065dd02fd8430ef
[ "Unlicense" ]
null
null
null
CodeChef/SQUIDRULE/solution.cpp
afifabroory/CompetitiveProgramming
231883eeab5abbd84005e80c5065dd02fd8430ef
[ "Unlicense" ]
null
null
null
CodeChef/SQUIDRULE/solution.cpp
afifabroory/CompetitiveProgramming
231883eeab5abbd84005e80c5065dd02fd8430ef
[ "Unlicense" ]
null
null
null
#include <bits/stdc++.h> #define FOR(a, b) for (int i = a; i < b; i++) using namespace std; int main() { unsigned short t; cin >> t; unsigned int n, a, ans, small; while (t--) { cin >> n; ans = 0; small = INT_MAX; FOR(0, n) { cin >> a; ans += a; if (a < small) small = a; } cout << ans-small << '\n'; } return 0; }
12.535714
45
0.495726
afifabroory
1b9187d6f7c6d1eb160239d56cbe3e86f444586d
5,235
cc
C++
src/win32/tip/tip_private_context.cc
google-admin/mozc
d0efe11cc6232c4e99371c19d2e02303ba889233
[ "BSD-3-Clause" ]
1,144
2015-04-23T16:18:45.000Z
2022-03-29T19:37:33.000Z
src/win32/tip/tip_private_context.cc
google-admin/mozc
d0efe11cc6232c4e99371c19d2e02303ba889233
[ "BSD-3-Clause" ]
291
2015-05-04T07:53:37.000Z
2022-03-22T00:09:05.000Z
src/win32/tip/tip_private_context.cc
google-admin/mozc
d0efe11cc6232c4e99371c19d2e02303ba889233
[ "BSD-3-Clause" ]
301
2015-05-03T00:07:18.000Z
2022-03-21T10:48:29.000Z
// Copyright 2010-2021, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "win32/tip/tip_private_context.h" #include <msctf.h> #include <memory> #include "base/win_util.h" #include "client/client_interface.h" #include "protocol/commands.pb.h" #include "session/key_info_util.h" #include "win32/base/config_snapshot.h" #include "win32/base/deleter.h" #include "win32/base/input_state.h" #include "win32/base/keyboard.h" #include "win32/base/surrogate_pair_observer.h" #include "win32/tip/tip_text_service.h" #include "win32/tip/tip_ui_element_manager.h" namespace mozc { namespace win32 { namespace tsf { using ::mozc::client::ClientFactory; using ::mozc::client::ClientInterface; using ::mozc::commands::Capability; using ::mozc::commands::Output; class TipPrivateContext::InternalState { public: InternalState(DWORD text_edit_sink_cookie, DWORD text_layout_sink_cookie) : client_(ClientFactory::NewClient()), text_edit_sink_cookie_(text_edit_sink_cookie), text_layout_sink_cookie_(text_layout_sink_cookie) {} std::unique_ptr<client::ClientInterface> client_; SurrogatePairObserver surrogate_pair_observer_; commands::Output last_output_; VirtualKey last_down_key_; InputBehavior input_behavior_; TipUiElementManager ui_element_manager_; VKBackBasedDeleter deleter_; const DWORD text_edit_sink_cookie_; const DWORD text_layout_sink_cookie_; }; TipPrivateContext::TipPrivateContext(DWORD text_edit_sink_cookie, DWORD text_layout_sink_cookie) : state_( new InternalState(text_edit_sink_cookie, text_layout_sink_cookie)) { EnsureInitialized(); } TipPrivateContext::~TipPrivateContext() {} ClientInterface *TipPrivateContext::GetClient() { return state_->client_.get(); } void TipPrivateContext::EnsureInitialized() { if (!state_->input_behavior_.initialized) { state_->client_->Reset(); Capability capability; capability.set_text_deletion(Capability::DELETE_PRECEDING_TEXT); state_->client_->set_client_capability(capability); } // Try to reflect the current config to the IME behavior. ConfigSnapshot::Info snapshot; if (ConfigSnapshot::Get(state_->client_.get(), &snapshot)) { auto *behavior = &state_->input_behavior_; behavior->prefer_kana_input = snapshot.use_kana_input; behavior->use_romaji_key_to_toggle_input_style = snapshot.use_keyboard_to_change_preedit_method; behavior->use_mode_indicator = snapshot.use_mode_indicator; behavior->direct_mode_keys = snapshot.direct_mode_keys; behavior->initialized = true; } } SurrogatePairObserver *TipPrivateContext::GetSurrogatePairObserver() { return &state_->surrogate_pair_observer_; } TipUiElementManager *TipPrivateContext::GetUiElementManager() { return &state_->ui_element_manager_; } VKBackBasedDeleter *TipPrivateContext::GetDeleter() { return &state_->deleter_; } const Output &TipPrivateContext::last_output() const { return state_->last_output_; } Output *TipPrivateContext::mutable_last_output() { return &state_->last_output_; } const VirtualKey &TipPrivateContext::last_down_key() const { return state_->last_down_key_; } VirtualKey *TipPrivateContext::mutable_last_down_key() { return &state_->last_down_key_; } const InputBehavior &TipPrivateContext::input_behavior() const { return state_->input_behavior_; } InputBehavior *TipPrivateContext::mutable_input_behavior() { return &state_->input_behavior_; } DWORD TipPrivateContext::text_edit_sink_cookie() const { return state_->text_edit_sink_cookie_; } DWORD TipPrivateContext::text_layout_sink_cookie() const { return state_->text_layout_sink_cookie_; } } // namespace tsf } // namespace win32 } // namespace mozc
33.343949
78
0.771156
google-admin
1b94c0655e8ad85184622e31dc69fea7482847f5
41,848
cpp
C++
src/editor/EditorWindow.cpp
FuRuYa7/Koder
73171109f5ed93ea45351019ff3c03c99dd9de5c
[ "MIT" ]
31
2015-03-12T23:23:48.000Z
2021-12-05T17:23:14.000Z
src/editor/EditorWindow.cpp
FuRuYa7/Koder
73171109f5ed93ea45351019ff3c03c99dd9de5c
[ "MIT" ]
137
2017-01-03T02:40:00.000Z
2022-01-19T12:36:57.000Z
src/editor/EditorWindow.cpp
FuRuYa7/Koder
73171109f5ed93ea45351019ff3c03c99dd9de5c
[ "MIT" ]
21
2017-01-03T02:20:00.000Z
2022-03-11T06:19:59.000Z
/* * Copyright 2014-2019 Kacper Kasper <kacperkasper@gmail.com> * All rights reserved. Distributed under the terms of the MIT license. */ #include "EditorWindow.h" #include <string> #include <Alert.h> #include <Application.h> #include <Bitmap.h> #include <Button.h> #include <Catalog.h> #include <Entry.h> #include <FilePanel.h> #include <GroupLayout.h> #include <LayoutBuilder.h> #include <MenuBar.h> #include <MimeType.h> #include <NodeMonitor.h> #include <ObjectList.h> #include <Path.h> #include <PopUpMenu.h> #include <Roster.h> #include <String.h> #include <StringFormat.h> #include <ToolBar.h> #include <kernel/fs_attr.h> #include "App.h" #include "AppPreferencesWindow.h" #include "BookmarksWindow.h" #include "Editor.h" #include "Editorconfig.h" #include "File.h" #include "FindReplaceHandler.h" #include "FindWindow.h" #include "GoToLineWindow.h" #include "Languages.h" #include "Preferences.h" #include "ScintillaUtils.h" #include "StatusView.h" #include "Styler.h" #include "ToolBar.h" #include "Utils.h" #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "EditorWindow" using namespace Scintilla::Properties; const float kWindowStagger = 17.0f; Preferences* EditorWindow::fPreferences = nullptr; namespace { enum { INCREMENTAL_SEARCH_CHAR = 'incs', INCREMENTAL_SEARCH_BACKSPACE = 'incb', INCREMENTAL_SEARCH_CANCEL = 'ince', INCREMENTAL_SEARCH_COMMIT = 'incc' }; } EditorWindow::EditorWindow(bool stagger) : BWindow(fPreferences->fWindowRect, gAppName, B_DOCUMENT_WINDOW, 0), fIncrementalSearchTerm(""), fIncrementalSearchFilter(new BMessageFilter(B_KEY_DOWN, _IncrementalSearchFilter)) { fActivatedGuard = false; fModifiedOutside = false; fModified = false; fReadOnly = false; fOnQuitReplyToMessage = nullptr; fGoToLineWindow = nullptr; fBookmarksWindow = nullptr; fOpenedFilePath = nullptr; fOpenedFileMimeType.SetTo("text/plain"); fCurrentLanguage = "text"; BMessage openMessage(B_REFS_RECEIVED); openMessage.AddPointer("window", this); BMessenger* windowMessenger = new BMessenger(this); fOpenPanel = new BFilePanel(B_OPEN_PANEL, windowMessenger); fOpenPanel->SetMessage(&openMessage); fSavePanel = new BFilePanel(B_SAVE_PANEL, windowMessenger, nullptr, 0, false); fMainMenu = new BMenuBar("MainMenu"); BLayoutBuilder::Menu<>(fMainMenu) .AddMenu(B_TRANSLATE("File")) .AddItem(B_TRANSLATE("New"), MAINMENU_FILE_NEW, 'N') .AddSeparator() .AddItem(B_TRANSLATE("Open" B_UTF8_ELLIPSIS), MAINMENU_FILE_OPEN, 'O') .AddItem(B_TRANSLATE("Reload"), MAINMENU_FILE_RELOAD) .AddItem(B_TRANSLATE("Save"), MAINMENU_FILE_SAVE, 'S') .AddItem(B_TRANSLATE("Save as" B_UTF8_ELLIPSIS), MAINMENU_FILE_SAVEAS) .AddSeparator() .AddItem(B_TRANSLATE("Open partner file"), MAINMENU_FILE_OPEN_CORRESPONDING, 'O', B_OPTION_KEY) .AddSeparator() .AddItem(B_TRANSLATE("Close"), B_QUIT_REQUESTED, 'W') .AddItem(B_TRANSLATE("Quit"), MAINMENU_FILE_QUIT, 'Q') .End() .AddMenu(B_TRANSLATE("Edit")) .AddItem(B_TRANSLATE("Undo"), B_UNDO, 'Z') .AddItem(B_TRANSLATE("Redo"), B_REDO, 'Y') .AddSeparator() .AddItem(B_TRANSLATE("Cut"), B_CUT, 'X') .AddItem(B_TRANSLATE("Copy"), B_COPY, 'C') .AddItem(B_TRANSLATE("Paste"), B_PASTE, 'V') .AddSeparator() .AddItem(B_TRANSLATE("Select all"), B_SELECT_ALL, 'A') .AddSeparator() .AddItem(B_TRANSLATE("Comment line"), EDIT_COMMENTLINE, '/') .AddItem(B_TRANSLATE("Comment block"), EDIT_COMMENTBLOCK, '/', B_SHIFT_KEY) .AddSeparator() .AddItem(B_TRANSLATE("Trim trailing whitespace"), MAINMENU_EDIT_TRIMWS) .AddSeparator() .AddMenu(B_TRANSLATE("Line endings")) .AddItem(B_TRANSLATE("Unix format"), MAINMENU_EDIT_CONVERTEOLS_UNIX) .AddItem(B_TRANSLATE("Windows format"), MAINMENU_EDIT_CONVERTEOLS_WINDOWS) .AddItem(B_TRANSLATE("Old Mac format"), MAINMENU_EDIT_CONVERTEOLS_MAC) .End() .AddSeparator() //.AddItem(B_TRANSLATE("File preferences" B_UTF8_ELLIPSIS), MAINMENU_EDIT_FILE_PREFERENCES) .AddItem(B_TRANSLATE("Koder preferences" B_UTF8_ELLIPSIS), MAINMENU_EDIT_APP_PREFERENCES) .End() .AddMenu(B_TRANSLATE("View")) .AddMenu(B_TRANSLATE("Special symbols")) .AddItem(B_TRANSLATE("Show white space"), MAINMENU_VIEW_SPECIAL_WHITESPACE) .AddItem(B_TRANSLATE("Show line endings"), MAINMENU_VIEW_SPECIAL_EOL) .End() .AddItem(B_TRANSLATE("Show toolbar"), MAINMENU_VIEW_TOOLBAR) .AddItem(B_TRANSLATE("Wrap lines"), MAINMENU_VIEW_WRAPLINES) .End() .AddMenu(B_TRANSLATE("Search")) .AddItem(B_TRANSLATE("Find/Replace" B_UTF8_ELLIPSIS), MAINMENU_SEARCH_FINDREPLACE, 'F') .AddItem(B_TRANSLATE("Find next"), MAINMENU_SEARCH_FINDNEXT, 'G') .AddItem(B_TRANSLATE("Find selection"), MAINMENU_SEARCH_FINDSELECTION, 'H') .AddItem(B_TRANSLATE("Replace and find"), MAINMENU_SEARCH_REPLACEANDFIND, 'T') .AddItem(B_TRANSLATE("Incremental search"), MAINMENU_SEARCH_INCREMENTAL, 'I') .AddSeparator() .AddItem(B_TRANSLATE("Bookmarks"), MAINMENU_SEARCH_BOOKMARKS) .AddItem(B_TRANSLATE("Toggle bookmark"), MAINMENU_SEARCH_TOGGLEBOOKMARK, 'B') .AddItem(B_TRANSLATE("Next bookmark"), MAINMENU_SEARCH_NEXTBOOKMARK, 'N', B_CONTROL_KEY) .AddItem(B_TRANSLATE("Previous bookmark"), MAINMENU_SEARCH_PREVBOOKMARK, 'P', B_CONTROL_KEY) .AddSeparator() .AddItem(B_TRANSLATE("Go to line" B_UTF8_ELLIPSIS), MAINMENU_SEARCH_GOTOLINE, ',') .End() .AddMenu(B_TRANSLATE("Language")) .AddItem("Dummy", MAINMENU_LANGUAGE) .End() .AddMenu(B_TRANSLATE("Help")) .AddItem(B_TRANSLATE("About" B_UTF8_ELLIPSIS), B_ABOUT_REQUESTED) .End(); // When changing this shortcut remember to update one in StatusView as well AddShortcut('T', B_COMMAND_KEY | B_OPTION_KEY, new BMessage((uint32) OPEN_TERMINAL)); fLanguageMenu = fMainMenu->FindItem(MAINMENU_LANGUAGE)->Menu(); _PopulateLanguageMenu(); fContextMenu = new BPopUpMenu("ContextMenu", false, false); BLayoutBuilder::Menu<>(fContextMenu) .AddItem(B_TRANSLATE("Undo"), B_UNDO, 'Z') .AddItem(B_TRANSLATE("Redo"), B_REDO, 'Y') .AddSeparator() .AddItem(B_TRANSLATE("Cut"), B_CUT, 'X') .AddItem(B_TRANSLATE("Copy"), B_COPY, 'C') .AddItem(B_TRANSLATE("Paste"), B_PASTE, 'V') .AddSeparator() .AddItem(B_TRANSLATE("Select all"), B_SELECT_ALL, 'A') .AddSeparator() .AddItem(B_TRANSLATE("Comment line"), EDIT_COMMENTLINE, '/') .AddItem(B_TRANSLATE("Comment block"), EDIT_COMMENTBLOCK, '/', B_SHIFT_KEY); fContextMenu->SetTargetForItems(*windowMessenger); fEditor = new Editor(); Languages::LoadExternalLexers(fEditor); fToolbar = new ToolBar(this); fToolbar->AddAction(MAINMENU_FILE_OPEN, B_TRANSLATE("Open" B_UTF8_ELLIPSIS), "open"); fToolbar->AddAction(MAINMENU_FILE_RELOAD, B_TRANSLATE("Reload"), "reload"); fToolbar->SetActionEnabled(MAINMENU_FILE_RELOAD, false); fToolbar->AddAction(MAINMENU_FILE_SAVE, B_TRANSLATE("Save"), "save"); fToolbar->SetActionEnabled(MAINMENU_FILE_SAVE, false); fToolbar->AddAction(MAINMENU_FILE_SAVEAS, B_TRANSLATE("Save as" B_UTF8_ELLIPSIS), "save as"); fToolbar->AddSeparator(); fToolbar->AddAction(B_UNDO, B_TRANSLATE("Undo"), "undo"); fToolbar->SetActionEnabled(B_UNDO, false); fToolbar->AddAction(B_REDO, B_TRANSLATE("Redo"), "redo"); fToolbar->SetActionEnabled(B_REDO, false); fToolbar->AddSeparator(); fToolbar->AddAction(TOOLBAR_SPECIAL_SYMBOLS, B_TRANSLATE("Special symbols"), "whitespace", true); fToolbar->AddSeparator(); fToolbar->AddAction(MAINMENU_SEARCH_BOOKMARKS, B_TRANSLATE("Bookmarks"), "bookmarks"); fToolbar->AddAction(MAINMENU_SEARCH_PREVBOOKMARK, B_TRANSLATE("Previous bookmark"), "bookmark prev"); fToolbar->AddAction(MAINMENU_SEARCH_NEXTBOOKMARK, B_TRANSLATE("Next bookmark"), "bookmark next"); fToolbar->AddSeparator(); fToolbar->AddAction(MAINMENU_EDIT_APP_PREFERENCES, B_TRANSLATE("Koder preferences" B_UTF8_ELLIPSIS), "preferences"); fToolbar->AddAction(MAINMENU_SEARCH_FINDREPLACE, B_TRANSLATE("Find/Replace" B_UTF8_ELLIPSIS), "find"); fToolbar->AddGlue(); BGroupLayout *layout = new BGroupLayout(B_VERTICAL, 0); SetLayout(layout); layout->AddView(fMainMenu); layout->AddView(fToolbar); layout->AddView(fEditor); layout->SetInsets(0, 0, -1, -1); SetKeyMenuBar(fMainMenu); fEditor->SendMessage(SCI_GRABFOCUS); fFindReplaceHandler = new FindReplaceHandler(fEditor, this); AddHandler(fFindReplaceHandler); _SyncWithPreferences(); fEditor->SendMessage(SCI_SETSCROLLWIDTH, fEditor->Bounds().Width()); fEditor->SendMessage(SCI_SETSCROLLWIDTHTRACKING, true, 0); fEditor->SendMessage(SCI_SETSAVEPOINT, 0, 0); BFont font; font.SetFamilyAndStyle(fPreferences->fFontFamily.c_str(), nullptr); font.SetSize(fPreferences->fFontSize); BFont *fontPtr = (fPreferences->fUseCustomFont ? &font : nullptr); Styler::ApplyGlobal(fEditor, fPreferences->fStyle.c_str(), fontPtr); RefreshTitle(); if(stagger == true) { MoveBy(kWindowStagger, kWindowStagger); } } EditorWindow::~EditorWindow() { delete fFindReplaceHandler; RemoveCommonFilter(fIncrementalSearchFilter.get()); } void EditorWindow::New() { BMessage message(WINDOW_NEW); message.AddPointer("window", this); be_app->PostMessage(&message); } /** * Sets up monitoring, checks for permissions, opens and reads the file, resets * the save point and undo buffer, sets the caret on position when it was * closed, sets the langugage, adds the file to recent documents, refreshes the * window title and syncs the preferences. */ void EditorWindow::OpenFile(const entry_ref* ref, Sci_Position line, Sci_Position column) { fEditor->SetReadOnly(false); // let us load new file if(fOpenedFilePath != nullptr) { // stop watching previously opened file BEntry open(fOpenedFilePath->Path()); File::Monitor(&open, false, this); } BEntry entry(ref); uint32 openMode = B_READ_ONLY; if(!entry.Exists()) { // TODO: alert/phantom mode? openMode |= B_CREATE_FILE; } File file(&entry, openMode); file.Monitor(true, this); file.GetModificationTime(&fOpenedFileModificationTime); fModifiedOutside = false; fEditor->SetText(file.Read().data()); fEditor->SendMessage(SCI_SETSAVEPOINT); fEditor->SendMessage(SCI_EMPTYUNDOBUFFER); Sci_Position gotoPos = file.ReadCaretPosition(); if(line != -1) { gotoPos = fEditor->SendMessage(SCI_POSITIONFROMLINE, line - 1); if(column != -1) { gotoPos += column; } } fEditor->SendMessage(SCI_GOTOPOS, gotoPos, 0); fEditor->SetBookmarks(file.ReadBookmarks()); fOpenedFileMimeType.SetTo(file.ReadMimeType().c_str()); char name[B_FILE_NAME_LENGTH]; entry.GetName(name); _SetLanguageByFilename(name); fReadOnly = !File::CanWrite(&file); fEditor->SetReadOnly(fReadOnly); fEditor->SetRef(*ref); be_roster->AddToRecentDocuments(ref, gAppMime); if(fOpenedFilePath == nullptr) fOpenedFilePath = new BPath(&entry); else fOpenedFilePath->SetTo(&entry); RefreshTitle(); // load .editorconfig and apply settings _SyncWithPreferences(); } void EditorWindow::RefreshTitle() { BString title; if(fModified == true) title << "*"; if(fOpenedFilePath != nullptr) if(fPreferences->fFullPathInTitle == true) { title << fOpenedFilePath->Path(); } else { title << fOpenedFilePath->Leaf(); } else { title << B_TRANSLATE("Untitled"); } if(fReadOnly) { title << " " << B_TRANSLATE("[read-only]"); } SetTitle(title); } void EditorWindow::SaveFile(entry_ref* ref) { if(ref == nullptr) return; std::string path(BPath(ref).Path()); if(fOpenedFilePath != nullptr) { // stop watching currently open file, in case it is different from ref BEntry open(fOpenedFilePath->Path()); File::Monitor(&open, false, this); } BackupFileGuard backupGuard(path.c_str(), this); // TODO error checking File file(path.c_str(), B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); if(file.InitCheck() == B_PERMISSION_DENIED) { OKAlert(B_TRANSLATE("Access denied"), B_TRANSLATE("You don't have " "sufficient permissions to edit this file."), B_STOP_ALERT); return; } file.Monitor(false, this); if(fFilePreferences.fTrimTrailingWhitespace.value_or( fPreferences->fTrimTrailingWhitespaceOnSave) == true) { fEditor->TrimTrailingWhitespace(); } if(fPreferences->fAppendNLAtTheEndIfNotPresent) { fEditor->AppendNLAtTheEndIfNotPresent(); } std::vector<char> buffer(fEditor->TextLength() + 1); fEditor->GetText(0, buffer.size(), buffer.data()); file.Write(buffer); fEditor->SendMessage(SCI_SETSAVEPOINT); file.WriteMimeType(fOpenedFileMimeType.Type()); file.Monitor(true, this); file.GetModificationTime(&fOpenedFileModificationTime); fModifiedOutside = false; if(fOpenedFilePath != nullptr) { delete fOpenedFilePath; } fOpenedFilePath = new BPath(path.c_str()); RefreshTitle(); backupGuard.SaveSuccessful(); } bool EditorWindow::QuitRequested() { bool close = true; if(fModified == true) { int32 result = _ShowModifiedAlert(); switch(result) { case ModifiedAlertResult::CANCEL: close = false; break; case ModifiedAlertResult::SAVE: _Save(); case ModifiedAlertResult::DISCARD: close = true; break; } } if(close == true) { if(fOpenedFilePath != nullptr) { File file(fOpenedFilePath->Path(), B_READ_ONLY); file.WriteCaretPosition(fEditor->SendMessage(SCI_GETCURRENTPOS)); file.WriteBookmarks(fEditor->Bookmarks()); } if(fGoToLineWindow != nullptr) { fGoToLineWindow->LockLooper(); fGoToLineWindow->Quit(); } delete fOpenPanel; delete fSavePanel; if(fOnQuitReplyToMessage != nullptr) fOnQuitReplyToMessage->SendReply(B_OK); BMessage closing(WINDOW_CLOSE); closing.AddPointer("window", this); be_app->PostMessage(&closing); } return close; } void EditorWindow::MessageReceived(BMessage* message) { if(message->WasDropped()) { message->what = B_REFS_RECEIVED; } if(message->IsReply()) { switch(message->what) { case FindReplaceHandler::FIND: { bool found = message->GetBool("found", true); if(found == false) { OKAlert(B_TRANSLATE("Searching finished"), B_TRANSLATE("Reached the end of the target. " "No results found.")); } } break; case FindReplaceHandler::REPLACEALL: { int32 replaced = message->GetInt32("replaced", 0); BString alertMessage; static BStringFormat format(B_TRANSLATE("Replaced " "{0, plural, one{# occurence} other{# occurences}}.")); format.Format(alertMessage, replaced); OKAlert(B_TRANSLATE("Replacement finished"), alertMessage); } break; } } switch(message->what) { case INCREMENTAL_SEARCH_CHAR: { const char* character = message->GetString("character", ""); fIncrementalSearchTerm.append(character); fEditor->IncrementalSearch(fIncrementalSearchTerm); } break; case INCREMENTAL_SEARCH_BACKSPACE: { if(!fIncrementalSearchTerm.empty()) { fIncrementalSearchTerm.pop_back(); fEditor->IncrementalSearch(fIncrementalSearchTerm); } } break; case INCREMENTAL_SEARCH_CANCEL: { fEditor->IncrementalSearchCancel(); fIncrementalSearchTerm = ""; RemoveCommonFilter(fIncrementalSearchFilter.get()); } break; case INCREMENTAL_SEARCH_COMMIT: { fEditor->IncrementalSearchCommit(fIncrementalSearchTerm); fIncrementalSearchTerm = ""; RemoveCommonFilter(fIncrementalSearchFilter.get()); } break; case SAVE_FILE: { _Save(); message->SendReply((uint32) B_OK); // TODO: error handling } break; case MAINMENU_FILE_NEW: New(); break; case MAINMENU_FILE_OPEN: { if(fOpenedFilePath != nullptr) { BPath parent(*fOpenedFilePath); parent.GetParent(&parent); fOpenPanel->SetPanelDirectory(parent.Path()); } fOpenPanel->Show(); } break; case MAINMENU_FILE_RELOAD: { BAlert* alert = new BAlert(B_TRANSLATE("Unsaved changes"), B_TRANSLATE("Your changes will be lost."), B_TRANSLATE("Cancel"), B_TRANSLATE("Reload"), nullptr, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_STOP_ALERT); alert->SetShortcut(0, B_ESCAPE); int32 result = alert->Go(); switch(result) { case 0: break; case 1: _ReloadFile(); break; } } break; case MAINMENU_FILE_SAVE: { if(fModified == true) { if(fReadOnly == true) { // TODO: alert } else { _Save(); } } } break; case MAINMENU_FILE_SAVEAS: { if(fOpenedFilePath != nullptr) { BPath parent(*fOpenedFilePath); parent.GetParent(&parent); fSavePanel->SetPanelDirectory(parent.Path()); } fSavePanel->Show(); } break; case MAINMENU_FILE_OPEN_CORRESPONDING: { if(fOpenedFilePath != nullptr) { _OpenCorrespondingFile(*fOpenedFilePath, fCurrentLanguage); } } break; case MAINMENU_FILE_QUIT: { be_app->PostMessage(B_QUIT_REQUESTED); } break; case EDIT_COMMENTLINE: { fEditor->CommentLine(fEditor->Get<Selection>()); } break; case EDIT_COMMENTBLOCK: { fEditor->CommentBlock(fEditor->Get<Selection>()); } break; case MAINMENU_EDIT_CONVERTEOLS_UNIX: { fEditor->SendMessage(SCI_CONVERTEOLS, SC_EOL_LF, 0); fEditor->SendMessage(SCI_SETEOLMODE, SC_EOL_LF, 0); } break; case MAINMENU_EDIT_CONVERTEOLS_WINDOWS: { fEditor->SendMessage(SCI_CONVERTEOLS, SC_EOL_CRLF, 0); fEditor->SendMessage(SCI_SETEOLMODE, SC_EOL_CRLF, 0); } break; case MAINMENU_EDIT_CONVERTEOLS_MAC: { fEditor->SendMessage(SCI_CONVERTEOLS, SC_EOL_CR, 0); fEditor->SendMessage(SCI_SETEOLMODE, SC_EOL_CR, 0); } break; case MAINMENU_EDIT_TRIMWS: { fEditor->TrimTrailingWhitespace(); } break; case MAINMENU_EDIT_APP_PREFERENCES: { be_app->PostMessage(message); } break; case MAINMENU_SEARCH_FINDREPLACE: { std::string selection = fEditor->SelectionText(); if(!selection.empty()) message->AddString("selection", selection.c_str()); be_app->PostMessage(message); } break; case MAINMENU_SEARCH_FINDNEXT: { fEditor->FindNext(); } break; case MAINMENU_SEARCH_FINDSELECTION: { fEditor->FindSelection(); } break; case MAINMENU_SEARCH_REPLACEANDFIND: { fEditor->ReplaceAndFind(); } break; case MAINMENU_SEARCH_INCREMENTAL: { RemoveCommonFilter(fIncrementalSearchFilter.get()); AddCommonFilter(fIncrementalSearchFilter.get()); } break; case MAINMENU_SEARCH_BOOKMARKS: { if(fBookmarksWindow == nullptr) { fBookmarksWindow = new BookmarksWindow(this, fEditor->BookmarksWithText()); } fBookmarksWindow->Show(); fBookmarksWindow->Activate(); } break; case MAINMENU_SEARCH_TOGGLEBOOKMARK: { Sci_Position pos = fEditor->SendMessage(SCI_GETCURRENTPOS); int64 line = fEditor->SendMessage(SCI_LINEFROMPOSITION, pos); bool added = fEditor->ToggleBookmark(line); BMessage notice = fEditor->BookmarksWithText(); SendNotices(added ? BOOKMARK_ADDED : BOOKMARK_REMOVED, &notice); } break; case BOOKMARK_REMOVED: { int32 line = message->GetInt32("line", -1); if(line != -1) { fEditor->ToggleBookmark(line); BMessage notice = fEditor->BookmarksWithText(); SendNotices(BOOKMARK_REMOVED, &notice); } } break; case MAINMENU_SEARCH_NEXTBOOKMARK: { fEditor->GoToNextBookmark(); } break; case MAINMENU_SEARCH_PREVBOOKMARK: { fEditor->GoToPreviousBookmark(); } break; case MAINMENU_SEARCH_GOTOLINE: { if(fGoToLineWindow == nullptr) { fGoToLineWindow = new GoToLineWindow(this); } fGoToLineWindow->ShowCentered(Frame()); } break; case MAINMENU_VIEW_SPECIAL_WHITESPACE: { fPreferences->fWhiteSpaceVisible = !fPreferences->fWhiteSpaceVisible; fMainMenu->FindItem(message->what)->SetMarked(fPreferences->fWhiteSpaceVisible); fEditor->SendMessage(SCI_SETVIEWWS, fPreferences->fWhiteSpaceVisible, 0); bool pressed = fPreferences->fWhiteSpaceVisible && fPreferences->fEOLVisible; fToolbar->SetActionPressed(TOOLBAR_SPECIAL_SYMBOLS, pressed); } break; case MAINMENU_VIEW_SPECIAL_EOL: { fPreferences->fEOLVisible = !fPreferences->fEOLVisible; fMainMenu->FindItem(message->what)->SetMarked(fPreferences->fEOLVisible); fEditor->SendMessage(SCI_SETVIEWEOL, fPreferences->fEOLVisible, 0); bool pressed = fPreferences->fWhiteSpaceVisible && fPreferences->fEOLVisible; fToolbar->SetActionPressed(TOOLBAR_SPECIAL_SYMBOLS, pressed); } break; case MAINMENU_VIEW_TOOLBAR: { fPreferences->fToolbar = !fPreferences->fToolbar; fMainMenu->FindItem(message->what)->SetMarked(fPreferences->fToolbar); if(fPreferences->fToolbar == true) fToolbar->Show(); else fToolbar->Hide(); } break; case MAINMENU_VIEW_WRAPLINES: { fPreferences->fWrapLines = !fPreferences->fWrapLines; fMainMenu->FindItem(message->what)->SetMarked(fPreferences->fWrapLines); fEditor->SendMessage(SCI_SETWRAPMODE, fPreferences->fWrapLines ? SC_WRAP_WORD : SC_WRAP_NONE, 0); } break; case MAINMENU_LANGUAGE: { _SetLanguage(message->GetString("lang", "text")); } break; case TOOLBAR_SPECIAL_SYMBOLS: { bool pressed = fPreferences->fWhiteSpaceVisible && fPreferences->fEOLVisible; if(pressed == true) { fPreferences->fWhiteSpaceVisible = false; fPreferences->fEOLVisible = false; } else { fPreferences->fWhiteSpaceVisible = true; fPreferences->fEOLVisible = true; } fMainMenu->FindItem(MAINMENU_VIEW_SPECIAL_WHITESPACE)->SetMarked(fPreferences->fWhiteSpaceVisible); fMainMenu->FindItem(MAINMENU_VIEW_SPECIAL_EOL)->SetMarked(fPreferences->fEOLVisible); fEditor->SendMessage(SCI_SETVIEWWS, fPreferences->fWhiteSpaceVisible, 0); fEditor->SendMessage(SCI_SETVIEWEOL, fPreferences->fEOLVisible, 0); fToolbar->SetActionPressed(TOOLBAR_SPECIAL_SYMBOLS, !pressed); } break; case B_SAVE_REQUESTED: { entry_ref ref; if(message->FindRef("directory", &ref) == B_OK) { BString name; message->FindString("name", &name); BPath path(&ref); path.Append(name); BEntry entry(path.Path()); entry.GetRef(&ref); SaveFile(&ref); } } break; case B_CUT: { fEditor->SendMessage(SCI_CUT, 0, 0); _SyncEditMenus(); } break; case B_COPY: { fEditor->SendMessage(SCI_COPY, 0, 0); } break; case B_PASTE: { fEditor->SendMessage(SCI_PASTE, 0, 0); _SyncEditMenus(); } break; case B_SELECT_ALL: { fEditor->SendMessage(SCI_SELECTALL, 0, 0); } break; case B_UNDO: { fEditor->SendMessage(SCI_UNDO, 0, 0); _SyncEditMenus(); } break; case B_REDO: { fEditor->SendMessage(SCI_REDO, 0, 0); _SyncEditMenus(); } break; case EDITOR_SAVEPOINT_LEFT: { OnSavePoint(true); } break; case EDITOR_SAVEPOINT_REACHED: { OnSavePoint(false); } break; case EDITOR_UPDATEUI: { _SyncEditMenus(); } break; case EDITOR_CONTEXT_MENU: { BPoint where; if(message->FindPoint("where", &where) == B_OK) { where = ConvertToScreen(where); fContextMenu->Go(where, true, true); } } break; case EDITOR_MODIFIED: { BMessage notice = fEditor->BookmarksWithText(); SendNotices(BOOKMARKS_INVALIDATED, &notice); }; case B_ABOUT_REQUESTED: be_app->PostMessage(message); break; case B_REFS_RECEIVED: { entry_ref ref; if(message->FindRef("refs", &ref) == B_OK) { if(fOpenedFilePath == nullptr && fModified == false && !fPreferences->fAlwaysOpenInNewWindow) { OpenFile(&ref); } else { message->AddPointer("window", this); be_app->PostMessage(message); } } } break; case B_NODE_MONITOR: { int32 opcode = message->GetInt32("opcode", 0); if(opcode == B_STAT_CHANGED) { BEntry entry; if(fOpenedFilePath != nullptr) { entry.SetTo(fOpenedFilePath->Path()); time_t mt; entry.GetModificationTime(&mt); if(mt > fOpenedFileModificationTime) { fModifiedOutside = true; fOpenedFileModificationTime = mt; } fReadOnly = !File::CanWrite(&entry); fEditor->SetReadOnly(fReadOnly); } RefreshTitle(); // Notification about this is sent when window is activated } else if(opcode == B_ENTRY_MOVED) { entry_ref ref; const char* name; message->FindInt32("device", &ref.device); message->FindInt64("to directory", &ref.directory); message->FindString("name", &name); ref.set_name(name); _ReloadFile(&ref); } else if(opcode == B_ENTRY_REMOVED) { // Do not delete fOpenedFilePath here. // git removes the file when changing branches. Losing the path // because of that is not useful. // Ideally, if the file still exists and was not modified we // would just reload it, but there is a timing issue and this // can fail (load an "empty" file). _ReloadAlert(B_TRANSLATE("File removed"), B_TRANSLATE("The file has been removed. What to do?")); } } break; case B_OBSERVER_NOTICE_CHANGE: { int32 what = message->GetInt32("be:observe_change_what", 0); if(what == APP_PREFERENCES_CHANGED) { _SyncWithPreferences(); } } break; case GTLW_GO: { int32 line; if(message->FindInt32("line", &line) == B_OK) { fEditor->SendMessage(SCI_ENSUREVISIBLEENFORCEPOLICY, line - 1, 0); fEditor->SendMessage(SCI_GOTOLINE, line - 1, 0); } } break; case BOOKMARKS_WINDOW_QUITTING: { fBookmarksWindow = nullptr; } break; // FIXME: this looked better in my head... case FINDWINDOW_FIND: { message->what = FindReplaceHandler::FIND; PostMessage(message, fFindReplaceHandler, this); } break; case FINDWINDOW_REPLACE: { message->what = FindReplaceHandler::REPLACE; PostMessage(message, fFindReplaceHandler, this); } break; case FINDWINDOW_REPLACEALL: { message->what = FindReplaceHandler::REPLACEALL; PostMessage(message, fFindReplaceHandler, this); } break; case FINDWINDOW_REPLACEFIND: { message->what = FindReplaceHandler::REPLACEFIND; PostMessage(message, fFindReplaceHandler, this); } break; case OPEN_TERMINAL: { if(fOpenedFilePath != nullptr) { BPath directory; fOpenedFilePath->GetParent(&directory); _OpenTerminal(directory.Path()); } } break; default: BWindow::MessageReceived(message); break; } } void EditorWindow::WindowActivated(bool active) { if(active == true) { if(fActivatedGuard == false) { // Ensure that caret will be visible after opening file in a new // window GOTOPOS in OpenFile does not do that, because in that time // Scintilla view does not have proper dimensions, and the control // cannot calculate scroll position correctly. // After the window is activated for the first time, we are sure // layouting has been completed. fEditor->SendMessage(SCI_SCROLLCARET); // We can safely assume that caret is at the bottom at this point, // so scroll further down. int linesOnScreen = fEditor->SendMessage(SCI_LINESONSCREEN); fEditor->SendMessage(SCI_LINESCROLL, 0, linesOnScreen - 8); // ...if that assumption is not correct, make sure the caret // is in the view. fEditor->SendMessage(SCI_SCROLLCARET); fActivatedGuard = true; } BMessage message(ACTIVE_WINDOW_CHANGED); message.AddPointer("window", this); be_app->PostMessage(&message); if(fModifiedOutside == true) { _ReloadAlert(B_TRANSLATE("File modified"), B_TRANSLATE( "The file has been modified by another application. " "What to do?")); fModifiedOutside = false; } } } void EditorWindow::FrameMoved(BPoint origin) { fPreferences->fWindowRect.OffsetTo(origin); } void EditorWindow::Show() { BWindow::Show(); if(LockLooper()) { _SyncWithPreferences(); UnlockLooper(); } } const char* EditorWindow::OpenedFilePath() { if(fOpenedFilePath != nullptr) return fOpenedFilePath->Path(); return "Untitled"; } /* static */ void EditorWindow::SetPreferences(Preferences* preferences) { fPreferences = preferences; } void EditorWindow::SetOnQuitReplyToMessage(BMessage* message) { fOnQuitReplyToMessage = message; } void EditorWindow::_PopulateLanguageMenu() { // Clear the menu first int32 count = fLanguageMenu->CountItems(); fLanguageMenu->RemoveItems(0, count, true); Languages::SortAlphabetically(); char submenuName[] = "\0"; BObjectList<BMenu> menus; for(int32 i = 0; i < Languages::GetCount(); ++i) { std::string lang = Languages::GetLanguage(i); std::string name = Languages::GetMenuItemName(lang); BMessage *msg = new BMessage(MAINMENU_LANGUAGE); msg->AddString("lang", lang.c_str()); BMenuItem *menuItem = new BMenuItem(name.c_str(), msg); if(fPreferences->fCompactLangMenu == true) { if(submenuName[0] != name[0]) { submenuName[0] = name[0]; BMenu *submenu = new BMenu(submenuName); menus.AddItem(submenu); } menus.LastItem()->AddItem(menuItem); } else { fLanguageMenu->AddItem(menuItem); } } if(fPreferences->fCompactLangMenu == true) { int32 menusCount = menus.CountItems(); for(int32 i = 0; i < menusCount; i++) { if(menus.ItemAt(i)->CountItems() > 1) { fLanguageMenu->AddItem(menus.ItemAt(i)); } else { fLanguageMenu->AddItem(menus.ItemAt(i)->RemoveItem((int32) 0)); } } } } void EditorWindow::_ReloadFile(entry_ref* ref) { if(fOpenedFilePath == nullptr) return; if(ref == nullptr) { // reload file from current location entry_ref e; BEntry entry(fOpenedFilePath->Path()); entry.GetRef(&e); OpenFile(&e); } else { // file has been moved BEntry entry(ref); char name[B_FILE_NAME_LENGTH]; entry.GetName(name); _SetLanguageByFilename(name); fOpenedFilePath->SetTo(&entry); RefreshTitle(); } } void EditorWindow::_SetLanguage(std::string lang) { fCurrentLanguage = lang; const auto mapping = Languages::ApplyLanguage(fEditor, lang.c_str()); BFont font; font.SetFamilyAndStyle(fPreferences->fFontFamily.c_str(), nullptr); font.SetSize(fPreferences->fFontSize); BFont *fontPtr = (fPreferences->fUseCustomFont ? &font : nullptr); Styler::ApplyGlobal(fEditor, fPreferences->fStyle.c_str(), fontPtr); Styler::ApplyLanguage(fEditor, mapping); fEditor->SetType(Languages::GetMenuItemName(lang)); fMainMenu->FindItem(EDIT_COMMENTLINE)->SetEnabled(fEditor->CanCommentLine()); fMainMenu->FindItem(EDIT_COMMENTBLOCK)->SetEnabled(fEditor->CanCommentBlock()); fMainMenu->FindItem(MAINMENU_FILE_OPEN_CORRESPONDING)->SetEnabled(lang == "c" || lang == "cpp"); fContextMenu->FindItem(EDIT_COMMENTLINE)->SetEnabled(fEditor->CanCommentLine()); fContextMenu->FindItem(EDIT_COMMENTBLOCK)->SetEnabled(fEditor->CanCommentBlock()); // folding margin state can change depending on the language used fEditor->SetFoldMarginEnabled(fPreferences->fFoldMargin); } void EditorWindow::_SetLanguageByFilename(const char* filename) { std::string lang; // try to match whole filename first, this is needed for e.g. CMake bool found = Languages::GetLanguageForExtension(filename, lang); if(found == false) { const std::string extension = GetFileExtension(filename); if(!extension.empty()) Languages::GetLanguageForExtension(extension.c_str(), lang); } _SetLanguage(lang); } void EditorWindow::_OpenCorrespondingFile(const BPath &file, const std::string lang) { if(lang != "c" && lang != "cpp") return; const std::vector<std::string> extensionsToTryC{"h", "hh", "hxx", "hpp"}; const std::vector<std::string> extensionsToTryH{"c", "cc", "cxx", "cpp"}; const std::vector<std::string>* extensionsToTry = &extensionsToTryC; if(GetFileExtension(file.Leaf())[0] == 'h') { extensionsToTry = &extensionsToTryH; } BPath parent; if(file.GetParent(&parent) == B_OK) { const BDirectory parentDir(parent.Path()); const std::string filename = GetFileName(file.Leaf()); for(auto &ext : *extensionsToTry) { BEntry fileToTry(&parentDir, (filename + '.' + ext).c_str()); if(fileToTry.Exists()) { BMessage openFile(B_REFS_RECEIVED); entry_ref ref; if(fileToTry.GetRef(&ref) == B_OK) { openFile.AddRef("refs", &ref); openFile.AddPointer("window", this); be_app->PostMessage(&openFile); return; } } } OKAlert(B_TRANSLATE("Open partner file"), B_TRANSLATE("Partner file not found."), B_STOP_ALERT); } } void EditorWindow::_LoadEditorconfig() { if(fOpenedFilePath == nullptr) return; BPath editorconfig; if(Editorconfig::Find(fOpenedFilePath, &editorconfig)) { BMessage allProps; if(Editorconfig::Parse(editorconfig.Path(), &allProps)) { BMessage props; Editorconfig::MatchFilename(fOpenedFilePath->Path(), &allProps, &props); char* name; uint32 type; int32 count; for(int32 i = 0; props.GetInfo(B_STRING_TYPE, i, &name, &type, &count) == B_OK; i++) { BString propName(name); BString value; props.FindString(propName, &value); propName.ToLower(); if(propName == "end_of_line") { value.ToLower(); uint8 eolMode = SC_EOL_LF; if(value == "lf") eolMode = SC_EOL_LF; else if(value == "cr") eolMode = SC_EOL_CR; else if(value == "crlf") eolMode = SC_EOL_CRLF; fFilePreferences.fEOLMode = std::make_optional(eolMode); } else if(propName == "tab_width") { uint8 tabWidth = std::stoi(value.String()); fFilePreferences.fTabWidth = std::make_optional(tabWidth); } else if(propName == "indent_style") { value.ToLower(); bool tabsToSpaces = (value == "space"); fFilePreferences.fTabsToSpaces = std::make_optional(tabsToSpaces); } else if(propName == "indent_size") { if(value.ToLower() == "tab") fFilePreferences.fIndentWidth = fFilePreferences.fTabWidth; else { uint8 indentWidth = std::stoi(value.String()); fFilePreferences.fIndentWidth = std::make_optional(indentWidth); } } else if(propName == "trim_trailing_whitespace") { bool trim = (value.ToLower() == "true"); fFilePreferences.fTrimTrailingWhitespace = std::make_optional(trim); } } } } } void EditorWindow::_SyncWithPreferences() { if(fPreferences != nullptr) { if(fPreferences->fUseEditorconfig) { _LoadEditorconfig(); } else { // reset file preferences so they aren't picked up later fFilePreferences.fTabWidth.reset(); fFilePreferences.fIndentWidth.reset(); fFilePreferences.fTabsToSpaces.reset(); fFilePreferences.fTrimTrailingWhitespace.reset(); fFilePreferences.fEOLMode.reset(); } bool pressed = fPreferences->fWhiteSpaceVisible && fPreferences->fEOLVisible; fToolbar->SetActionPressed(TOOLBAR_SPECIAL_SYMBOLS, pressed); fMainMenu->FindItem(MAINMENU_VIEW_SPECIAL_WHITESPACE)->SetMarked(fPreferences->fWhiteSpaceVisible); fMainMenu->FindItem(MAINMENU_VIEW_SPECIAL_EOL)->SetMarked(fPreferences->fEOLVisible); fMainMenu->FindItem(MAINMENU_VIEW_TOOLBAR)->SetMarked(fPreferences->fToolbar); fMainMenu->FindItem(MAINMENU_VIEW_WRAPLINES)->SetMarked(fPreferences->fWrapLines); // reapply styles _SetLanguage(fCurrentLanguage); fEditor->SendMessage(SCI_SETVIEWEOL, fPreferences->fEOLVisible, 0); fEditor->SendMessage(SCI_SETVIEWWS, fPreferences->fWhiteSpaceVisible, 0); fEditor->SendMessage(SCI_SETTABWIDTH, fFilePreferences.fTabWidth.value_or(fPreferences->fTabWidth), 0); fEditor->SendMessage(SCI_SETUSETABS, !fFilePreferences.fTabsToSpaces.value_or(fPreferences->fTabsToSpaces), 0); fEditor->SendMessage(SCI_SETINDENT, fFilePreferences.fIndentWidth.value_or(0), 0); fEditor->SendMessage(SCI_SETCARETLINEVISIBLE, fPreferences->fLineHighlighting, 0); fEditor->SendMessage(SCI_SETCARETLINEVISIBLEALWAYS, true, 0); fEditor->SendMessage(SCI_SETCARETLINEFRAME, fPreferences->fLineHighlightingMode ? 2 : 0); if(fFilePreferences.fEOLMode) { fEditor->SendMessage(SCI_SETEOLMODE, fFilePreferences.fEOLMode.value_or(SC_EOL_LF), 0); } if(fPreferences->fLineLimitShow == true) { fEditor->SendMessage(SCI_SETEDGEMODE, fPreferences->fLineLimitMode, 0); fEditor->SendMessage(SCI_SETEDGECOLUMN, fPreferences->fLineLimitColumn, 0); } else { fEditor->SendMessage(SCI_SETEDGEMODE, 0, 0); } if(fPreferences->fIndentGuidesShow == true) { fEditor->SendMessage(SCI_SETINDENTATIONGUIDES, fPreferences->fIndentGuidesMode, 0); } else { fEditor->SendMessage(SCI_SETINDENTATIONGUIDES, 0, 0); } if(fPreferences->fWrapLines == true) { fEditor->SendMessage(SCI_SETWRAPMODE, SC_WRAP_WORD, 0); } else { fEditor->SendMessage(SCI_SETWRAPMODE, SC_WRAP_NONE, 0); } fEditor->SetNumberMarginEnabled(fPreferences->fLineNumbers); fEditor->SetFoldMarginEnabled(fPreferences->fFoldMargin); fEditor->SetBookmarkMarginEnabled(fPreferences->fBookmarkMargin); fEditor->SetBracesHighlightingEnabled( fPreferences->fBracesHighlighting); fEditor->SetTrailingWSHighlightingEnabled( fPreferences->fHighlightTrailingWhitespace); fEditor->UpdateLineNumberWidth(); if(!IsHidden()) { if(fPreferences->fToolbar == true) while(fToolbar->IsHidden()) fToolbar->Show(); else while(!fToolbar->IsHidden()) fToolbar->Hide(); } float baseSize = std::round(be_plain_font->Size() / 6.0f) * 4.0f; // 12 = 8.0f, 18 = 12.0f, 24 = 16.0f fToolbar->ChangeIconSize(baseSize * fPreferences->fToolbarIconSizeMultiplier); // TODO Do this only if it has changed RefreshTitle(); // TODO Do this only if language menu preference has changed _PopulateLanguageMenu(); } } void EditorWindow::_SyncEditMenus() { bool canUndo = fEditor->SendMessage(SCI_CANUNDO, 0, 0); bool canRedo = fEditor->SendMessage(SCI_CANREDO, 0, 0); bool canPaste = fEditor->SendMessage(SCI_CANPASTE, 0, 0); bool selectionEmpty = fEditor->SendMessage(SCI_GETSELECTIONEMPTY, 0, 0); fMainMenu->FindItem(B_UNDO)->SetEnabled(canUndo); fMainMenu->FindItem(B_REDO)->SetEnabled(canRedo); fMainMenu->FindItem(B_PASTE)->SetEnabled(canPaste); fMainMenu->FindItem(B_CUT)->SetEnabled(!selectionEmpty); fMainMenu->FindItem(B_COPY)->SetEnabled(!selectionEmpty); fContextMenu->FindItem(B_UNDO)->SetEnabled(canUndo); fContextMenu->FindItem(B_REDO)->SetEnabled(canRedo); fContextMenu->FindItem(B_PASTE)->SetEnabled(canPaste); fContextMenu->FindItem(B_CUT)->SetEnabled(!selectionEmpty); fContextMenu->FindItem(B_COPY)->SetEnabled(!selectionEmpty); fToolbar->SetActionEnabled(B_UNDO, canUndo); fToolbar->SetActionEnabled(B_REDO, canRedo); if(fEditor->CanCommentBlock()) { fMainMenu->FindItem(EDIT_COMMENTBLOCK)->SetEnabled(!selectionEmpty); fContextMenu->FindItem(EDIT_COMMENTBLOCK)->SetEnabled(!selectionEmpty); } } int32 EditorWindow::_ShowModifiedAlert() { const char* alertText; const char* button0 = B_TRANSLATE("Cancel"); const char* button1 = B_TRANSLATE("Discard"); const char* button2 = nullptr; if(fReadOnly == true) { alertText = B_TRANSLATE("The file contains unsaved changes, but is read-only. What to do?"); //button2 = B_TRANSLATE("Save as" B_UTF8_ELLIPSIS); // FIXME: Race condition when opening file } else { alertText = B_TRANSLATE("The file contains unsaved changes. What to do?"); button2 = B_TRANSLATE("Save"); } BAlert* modifiedAlert = new BAlert(B_TRANSLATE("Unsaved changes"), alertText, button0, button1, button2, B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_STOP_ALERT); modifiedAlert->SetShortcut(0, B_ESCAPE); return modifiedAlert->Go(); } void EditorWindow::_ReloadAlert(const char* title, const char* message) { // TODO: clarify in the alert that Reloading will recreate the file if it // doesn't exist anymore, and that some SCMs remove files on checkout // reload opened file BAlert* alert = new BAlert(title, message, B_TRANSLATE("Reload"), B_TRANSLATE("Do nothing"), nullptr, B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_INFO_ALERT); alert->SetShortcut(1, B_ESCAPE); int result = alert->Go(); if(result == 0) { _ReloadFile(); } else { PostMessage(EDITOR_SAVEPOINT_LEFT); } } void EditorWindow::_Save() { if(fOpenedFilePath == nullptr || fReadOnly == true) fSavePanel->Show(); else { BEntry entry(fOpenedFilePath->Path()); entry_ref ref; entry.GetRef(&ref); SaveFile(&ref); } // block until user has chosen location while(fSavePanel->IsShowing()) UpdateIfNeeded(); } /** * Launches Terminal with current working directory set to path. * Uses Tracker add-on to do that, because it's easier (Terminal doesn't accept * paths as arguments). * Taken from Tracker. */ void EditorWindow::_OpenTerminal(const char* path) { const char* terminalAddonSignature = "application/x-vnd.Haiku-OpenTerminal"; entry_ref addonRef, directoryRef; be_roster->FindApp(terminalAddonSignature, &addonRef); BEntry(path).GetRef(&directoryRef); image_id addonImage = load_add_on(BPath(&addonRef).Path()); if (addonImage >= 0) { void (*processRefsFn)(entry_ref, BMessage*, void*); status_t result = get_image_symbol(addonImage, "process_refs", 2, (void**) &processRefsFn); if (result >= 0) { // call add-on code (*processRefsFn)(directoryRef, new BMessage(), NULL); } else { OKAlert(B_TRANSLATE("Open Terminal"), B_TRANSLATE("Could not " "launch Open Terminal Tracker add-on."), B_STOP_ALERT); } unload_add_on(addonImage); } else { OKAlert(B_TRANSLATE("Open Terminal"), B_TRANSLATE("Could not find " "Open Terminal Tracker add-on."), B_STOP_ALERT); } } /** * left parameter specifies whether savepoint was left or reached. */ void EditorWindow::OnSavePoint(bool left) { fModified = left; RefreshTitle(); fMainMenu->FindItem(MAINMENU_FILE_RELOAD)->SetEnabled(fModified); fMainMenu->FindItem(MAINMENU_FILE_SAVE)->SetEnabled(fModified); fToolbar->SetActionEnabled(MAINMENU_FILE_RELOAD, fModified); fToolbar->SetActionEnabled(MAINMENU_FILE_SAVE, fModified); } filter_result EditorWindow::_IncrementalSearchFilter(BMessage* message, BHandler** target, BMessageFilter* messageFilter) { if(message->what == B_KEY_DOWN) { BLooper *looper = messageFilter->Looper(); const char* bytes; message->FindString("bytes", &bytes); if(bytes[0] == B_RETURN) { looper->PostMessage(INCREMENTAL_SEARCH_COMMIT); } else if(bytes[0] == B_ESCAPE) { looper->PostMessage(INCREMENTAL_SEARCH_CANCEL); } else if(bytes[0] == B_BACKSPACE) { looper->PostMessage(INCREMENTAL_SEARCH_BACKSPACE); } else { BMessage msg(INCREMENTAL_SEARCH_CHAR); msg.AddString("character", &bytes[0]); messageFilter->Looper()->PostMessage(&msg); } return B_SKIP_MESSAGE; } return B_DISPATCH_MESSAGE; }
30.590643
102
0.723619
FuRuYa7
1b99e0fa5b0be12ef6ba12727c6cc2652f9b9e06
28,188
cpp
C++
src/postgres/backend/executor/execUtils.cpp
jessesleeping/my_peloton
a19426cfe34a04692a11008eaffc9c3c9b49abc4
[ "Apache-2.0" ]
6
2017-04-28T00:38:52.000Z
2018-11-06T07:06:49.000Z
src/postgres/backend/executor/execUtils.cpp
jessesleeping/my_peloton
a19426cfe34a04692a11008eaffc9c3c9b49abc4
[ "Apache-2.0" ]
57
2016-03-19T22:27:55.000Z
2017-07-08T00:41:51.000Z
src/postgres/backend/executor/execUtils.cpp
eric-haibin-lin/pelotondb
904d6bbd041a0498ee0e034d4f9f9f27086c3cab
[ "Apache-2.0" ]
4
2016-07-17T20:44:56.000Z
2018-06-27T01:01:36.000Z
/*------------------------------------------------------------------------- * * execUtils.c * miscellaneous executor utility routines * * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION * src/backend/executor/execUtils.c * *------------------------------------------------------------------------- */ /* * INTERFACE ROUTINES * CreateExecutorState Create/delete executor working state * FreeExecutorState * CreateExprContext * CreateStandaloneExprContext * FreeExprContext * ReScanExprContext * * ExecAssignExprContext Common code for plan node init routines. * ExecAssignResultType * etc * * ExecOpenScanRelation Common code for scan node init routines. * ExecCloseScanRelation * * RegisterExprContextCallback Register function shutdown callback * UnregisterExprContextCallback Deregister function shutdown callback * * NOTES * This file has traditionally been the place to stick misc. * executor support stuff that doesn't really go anyplace else. */ #include "postgres.h" #include "access/relscan.h" #include "access/transam.h" #include "executor/executor.h" #include "nodes/nodeFuncs.h" #include "parser/parsetree.h" #include "utils/memutils.h" #include "utils/rel.h" static bool get_last_attnums(Node *node, ProjectionInfo *projInfo); static void ShutdownExprContext(ExprContext *econtext, bool isCommit); /* ---------------------------------------------------------------- * Executor state and memory management functions * ---------------------------------------------------------------- */ /* ---------------- * CreateExecutorState * * Create and initialize an EState node, which is the root of * working storage for an entire Executor invocation. * * Principally, this creates the per-query memory context that will be * used to hold all working data that lives till the end of the query. * Note that the per-query context will become a child of the caller's * CurrentMemoryContext. * ---------------- */ EState * CreateExecutorState(void) { EState *estate; MemoryContext qcontext; MemoryContext oldcontext; /* * Create the per-query context for this Executor run. */ // TODO: Peloton Changes qcontext = AllocSetContextCreate(CurrentMemoryContext, "ExecutorState", ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE); /* * Make the EState node within the per-query context. This way, we don't * need a separate pfree() operation for it at shutdown. */ oldcontext = MemoryContextSwitchTo(qcontext); estate = makeNode(EState); /* * Initialize all fields of the Executor State structure */ estate->es_direction = ForwardScanDirection; estate->es_snapshot = InvalidSnapshot; /* caller must initialize this */ estate->es_crosscheck_snapshot = InvalidSnapshot; /* no crosscheck */ estate->es_range_table = NIL; estate->es_plannedstmt = NULL; estate->es_junkFilter = NULL; estate->es_output_cid = (CommandId) 0; estate->es_result_relations = NULL; estate->es_num_result_relations = 0; estate->es_result_relation_info = NULL; estate->es_trig_target_relations = NIL; estate->es_trig_tuple_slot = NULL; estate->es_trig_oldtup_slot = NULL; estate->es_trig_newtup_slot = NULL; estate->es_param_list_info = NULL; estate->es_param_exec_vals = NULL; estate->es_query_cxt = qcontext; estate->es_tupleTable = NIL; estate->es_rowMarks = NIL; estate->es_processed = 0; estate->es_lastoid = InvalidOid; estate->es_top_eflags = 0; estate->es_instrument = 0; estate->es_finished = false; estate->es_exprcontexts = NIL; estate->es_subplanstates = NIL; estate->es_auxmodifytables = NIL; estate->es_per_tuple_exprcontext = NULL; estate->es_epqTuple = NULL; estate->es_epqTupleSet = NULL; estate->es_epqScanDone = NULL; /* * Return the executor state structure */ MemoryContextSwitchTo(oldcontext); return estate; } /* ---------------- * FreeExecutorState * * Release an EState along with all remaining working storage. * * Note: this is not responsible for releasing non-memory resources, * such as open relations or buffer pins. But it will shut down any * still-active ExprContexts within the EState. That is sufficient * cleanup for situations where the EState has only been used for expression * evaluation, and not to run a complete Plan. * * This can be called in any memory context ... so long as it's not one * of the ones to be freed. * ---------------- */ void FreeExecutorState(EState *estate) { /* * Shut down and free any remaining ExprContexts. We do this explicitly * to ensure that any remaining shutdown callbacks get called (since they * might need to release resources that aren't simply memory within the * per-query memory context). */ while (estate->es_exprcontexts) { /* * XXX: seems there ought to be a faster way to implement this than * repeated list_delete(), no? */ FreeExprContext((ExprContext *) linitial(estate->es_exprcontexts), true); /* FreeExprContext removed the list link for us */ } /* * Free the per-query memory context, thereby releasing all working * memory, including the EState node itself. */ MemoryContextDelete(estate->es_query_cxt); } /* ---------------- * CreateExprContext * * Create a context for expression evaluation within an EState. * * An executor run may require multiple ExprContexts (we usually make one * for each Plan node, and a separate one for per-output-tuple processing * such as constraint checking). Each ExprContext has its own "per-tuple" * memory context. * * Note we make no assumption about the caller's memory context. * ---------------- */ ExprContext * CreateExprContext(EState *estate) { ExprContext *econtext; MemoryContext oldcontext; /* Create the ExprContext node within the per-query memory context */ oldcontext = MemoryContextSwitchTo(estate->es_query_cxt); econtext = makeNode(ExprContext); /* Initialize fields of ExprContext */ econtext->ecxt_scantuple = NULL; econtext->ecxt_innertuple = NULL; econtext->ecxt_outertuple = NULL; econtext->ecxt_per_query_memory = estate->es_query_cxt; /* * Create working memory for expression evaluation in this context. */ econtext->ecxt_per_tuple_memory = AllocSetContextCreate(estate->es_query_cxt, "ExprContext", ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE); econtext->ecxt_param_exec_vals = estate->es_param_exec_vals; econtext->ecxt_param_list_info = estate->es_param_list_info; econtext->ecxt_aggvalues = NULL; econtext->ecxt_aggnulls = NULL; econtext->caseValue_datum = (Datum) 0; econtext->caseValue_isNull = true; econtext->domainValue_datum = (Datum) 0; econtext->domainValue_isNull = true; econtext->ecxt_estate = estate; econtext->ecxt_callbacks = NULL; /* * Link the ExprContext into the EState to ensure it is shut down when the * EState is freed. Because we use lcons(), shutdowns will occur in * reverse order of creation, which may not be essential but can't hurt. */ estate->es_exprcontexts = lcons(econtext, estate->es_exprcontexts); MemoryContextSwitchTo(oldcontext); return econtext; } /* ---------------- * CreateStandaloneExprContext * * Create a context for standalone expression evaluation. * * An ExprContext made this way can be used for evaluation of expressions * that contain no Params, subplans, or Var references (it might work to * put tuple references into the scantuple field, but it seems unwise). * * The ExprContext struct is allocated in the caller's current memory * context, which also becomes its "per query" context. * * It is caller's responsibility to free the ExprContext when done, * or at least ensure that any shutdown callbacks have been called * (ReScanExprContext() is suitable). Otherwise, non-memory resources * might be leaked. * ---------------- */ ExprContext * CreateStandaloneExprContext(void) { ExprContext *econtext; /* Create the ExprContext node within the caller's memory context */ econtext = makeNode(ExprContext); /* Initialize fields of ExprContext */ econtext->ecxt_scantuple = NULL; econtext->ecxt_innertuple = NULL; econtext->ecxt_outertuple = NULL; econtext->ecxt_per_query_memory = CurrentMemoryContext; /* * Create working memory for expression evaluation in this context. */ econtext->ecxt_per_tuple_memory = AllocSetContextCreate(CurrentMemoryContext, "ExprContext", ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE); econtext->ecxt_param_exec_vals = NULL; econtext->ecxt_param_list_info = NULL; econtext->ecxt_aggvalues = NULL; econtext->ecxt_aggnulls = NULL; econtext->caseValue_datum = (Datum) 0; econtext->caseValue_isNull = true; econtext->domainValue_datum = (Datum) 0; econtext->domainValue_isNull = true; econtext->ecxt_estate = NULL; econtext->ecxt_callbacks = NULL; return econtext; } /* ---------------- * FreeExprContext * * Free an expression context, including calling any remaining * shutdown callbacks. * * Since we free the temporary context used for expression evaluation, * any previously computed pass-by-reference expression result will go away! * * If isCommit is false, we are being called in error cleanup, and should * not call callbacks but only release memory. (It might be better to call * the callbacks and pass the isCommit flag to them, but that would require * more invasive code changes than currently seems justified.) * * Note we make no assumption about the caller's memory context. * ---------------- */ void FreeExprContext(ExprContext *econtext, bool isCommit) { EState *estate; /* Call any registered callbacks */ ShutdownExprContext(econtext, isCommit); /* And clean up the memory used */ MemoryContextDelete(econtext->ecxt_per_tuple_memory); /* Unlink self from owning EState, if any */ estate = econtext->ecxt_estate; if (estate) estate->es_exprcontexts = list_delete_ptr(estate->es_exprcontexts, econtext); /* And delete the ExprContext node */ pfree(econtext); } /* * ReScanExprContext * * Reset an expression context in preparation for a rescan of its * plan node. This requires calling any registered shutdown callbacks, * since any partially complete set-returning-functions must be canceled. * * Note we make no assumption about the caller's memory context. */ void ReScanExprContext(ExprContext *econtext) { /* Call any registered callbacks */ ShutdownExprContext(econtext, true); /* And clean up the memory used */ MemoryContextReset(econtext->ecxt_per_tuple_memory); } /* * Build a per-output-tuple ExprContext for an EState. * * This is normally invoked via GetPerTupleExprContext() macro, * not directly. */ ExprContext * MakePerTupleExprContext(EState *estate) { if (estate->es_per_tuple_exprcontext == NULL) estate->es_per_tuple_exprcontext = CreateExprContext(estate); return estate->es_per_tuple_exprcontext; } /* ---------------------------------------------------------------- * miscellaneous node-init support functions * * Note: all of these are expected to be called with CurrentMemoryContext * equal to the per-query memory context. * ---------------------------------------------------------------- */ /* ---------------- * ExecAssignExprContext * * This initializes the ps_ExprContext field. It is only necessary * to do this for nodes which use ExecQual or ExecProject * because those routines require an econtext. Other nodes that * don't have to evaluate expressions don't need to do this. * ---------------- */ void ExecAssignExprContext(EState *estate, PlanState *planstate) { planstate->ps_ExprContext = CreateExprContext(estate); } /* ---------------- * ExecAssignResultType * ---------------- */ void ExecAssignResultType(PlanState *planstate, TupleDesc tupDesc) { TupleTableSlot *slot = planstate->ps_ResultTupleSlot; ExecSetSlotDescriptor(slot, tupDesc); } /* ---------------- * ExecAssignResultTypeFromTL * ---------------- */ void ExecAssignResultTypeFromTL(PlanState *planstate) { bool hasoid; TupleDesc tupDesc; if (ExecContextForcesOids(planstate, &hasoid)) { /* context forces OID choice; hasoid is now set correctly */ } else { /* given free choice, don't leave space for OIDs in result tuples */ hasoid = false; } /* * ExecTypeFromTL needs the parse-time representation of the tlist, not a * list of ExprStates. This is good because some plan nodes don't bother * to set up planstate->targetlist ... */ tupDesc = ExecTypeFromTL(planstate->plan->targetlist, hasoid); ExecAssignResultType(planstate, tupDesc); } /* ---------------- * ExecGetResultType * ---------------- */ TupleDesc ExecGetResultType(PlanState *planstate) { TupleTableSlot *slot = planstate->ps_ResultTupleSlot; return slot->tts_tupleDescriptor; } /* ---------------- * ExecBuildProjectionInfo * * Build a ProjectionInfo node for evaluating the given tlist in the given * econtext, and storing the result into the tuple slot. (Caller must have * ensured that tuple slot has a descriptor matching the tlist!) Note that * the given tlist should be a list of ExprState nodes, not Expr nodes. * * inputDesc can be NULL, but if it is not, we check to see whether simple * Vars in the tlist match the descriptor. It is important to provide * inputDesc for relation-scan plan nodes, as a cross check that the relation * hasn't been changed since the plan was made. At higher levels of a plan, * there is no need to recheck. * ---------------- */ ProjectionInfo * ExecBuildProjectionInfo(List *targetList, ExprContext *econtext, TupleTableSlot *slot, TupleDesc inputDesc) { ProjectionInfo *projInfo = makeNode(ProjectionInfo); int len = ExecTargetListLength(targetList); int *workspace; int *varSlotOffsets; int *varNumbers; int *varOutputCols; List *exprlist; int numSimpleVars; bool directMap; ListCell *tl; projInfo->pi_exprContext = econtext; projInfo->pi_slot = slot; /* since these are all int arrays, we need do just one palloc */ workspace = (int *) palloc(len * 3 * sizeof(int)); projInfo->pi_varSlotOffsets = varSlotOffsets = workspace; projInfo->pi_varNumbers = varNumbers = workspace + len; projInfo->pi_varOutputCols = varOutputCols = workspace + len * 2; projInfo->pi_lastInnerVar = 0; projInfo->pi_lastOuterVar = 0; projInfo->pi_lastScanVar = 0; /* * We separate the target list elements into simple Var references and * expressions which require the full ExecTargetList machinery. To be a * simple Var, a Var has to be a user attribute and not mismatch the * inputDesc. (Note: if there is a type mismatch then ExecEvalScalarVar * will probably throw an error at runtime, but we leave that to it.) */ exprlist = NIL; numSimpleVars = 0; directMap = true; foreach(tl, targetList) { GenericExprState *gstate = (GenericExprState *) lfirst(tl); Var *variable = (Var *) gstate->arg->expr; bool isSimpleVar = false; if (variable != NULL && IsA(variable, Var) && variable->varattno > 0) { if (!inputDesc) isSimpleVar = true; /* can't check type, assume OK */ else if (variable->varattno <= inputDesc->natts) { Form_pg_attribute attr; attr = inputDesc->attrs[variable->varattno - 1]; if (!attr->attisdropped && variable->vartype == attr->atttypid) isSimpleVar = true; } } if (isSimpleVar) { TargetEntry *tle = (TargetEntry *) gstate->xprstate.expr; AttrNumber attnum = variable->varattno; varNumbers[numSimpleVars] = attnum; varOutputCols[numSimpleVars] = tle->resno; if (tle->resno != numSimpleVars + 1) directMap = false; switch (variable->varno) { case INNER_VAR: varSlotOffsets[numSimpleVars] = offsetof(ExprContext, ecxt_innertuple); if (projInfo->pi_lastInnerVar < attnum) projInfo->pi_lastInnerVar = attnum; break; case OUTER_VAR: varSlotOffsets[numSimpleVars] = offsetof(ExprContext, ecxt_outertuple); if (projInfo->pi_lastOuterVar < attnum) projInfo->pi_lastOuterVar = attnum; break; /* INDEX_VAR is handled by default case */ default: varSlotOffsets[numSimpleVars] = offsetof(ExprContext, ecxt_scantuple); if (projInfo->pi_lastScanVar < attnum) projInfo->pi_lastScanVar = attnum; break; } numSimpleVars++; } else { /* Not a simple variable, add it to generic targetlist */ exprlist = lappend(exprlist, gstate); /* Examine expr to include contained Vars in lastXXXVar counts */ get_last_attnums((Node *) variable, projInfo); } } projInfo->pi_targetlist = exprlist; projInfo->pi_numSimpleVars = numSimpleVars; projInfo->pi_directMap = directMap; if (exprlist == NIL) projInfo->pi_itemIsDone = NULL; /* not needed */ else projInfo->pi_itemIsDone = (ExprDoneCond *) palloc(len * sizeof(ExprDoneCond)); return projInfo; } /* * get_last_attnums: expression walker for ExecBuildProjectionInfo * * Update the lastXXXVar counts to be at least as large as the largest * attribute numbers found in the expression */ static bool get_last_attnums(Node *node, ProjectionInfo *projInfo) { if (node == NULL) return false; if (IsA(node, Var)) { Var *variable = (Var *) node; AttrNumber attnum = variable->varattno; switch (variable->varno) { case INNER_VAR: if (projInfo->pi_lastInnerVar < attnum) projInfo->pi_lastInnerVar = attnum; break; case OUTER_VAR: if (projInfo->pi_lastOuterVar < attnum) projInfo->pi_lastOuterVar = attnum; break; /* INDEX_VAR is handled by default case */ default: if (projInfo->pi_lastScanVar < attnum) projInfo->pi_lastScanVar = attnum; break; } return false; } /* * Don't examine the arguments or filters of Aggrefs or WindowFuncs, * because those do not represent expressions to be evaluated within the * overall targetlist's econtext. GroupingFunc arguments are never * evaluated at all. */ if (IsA(node, Aggref) || IsA(node, GroupingFunc)) return false; if (IsA(node, WindowFunc)) return false; return expression_tree_walker(node, reinterpret_cast<expression_tree_walker_fptr>(get_last_attnums), (void *) projInfo); } /* ---------------- * ExecAssignProjectionInfo * * forms the projection information from the node's targetlist * * Notes for inputDesc are same as for ExecBuildProjectionInfo: supply it * for a relation-scan node, can pass NULL for upper-level nodes * ---------------- */ void ExecAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc) { planstate->ps_ProjInfo = ExecBuildProjectionInfo(planstate->targetlist, planstate->ps_ExprContext, planstate->ps_ResultTupleSlot, inputDesc); } /* ---------------- * ExecFreeExprContext * * A plan node's ExprContext should be freed explicitly during executor * shutdown because there may be shutdown callbacks to call. (Other resources * made by the above routines, such as projection info, don't need to be freed * explicitly because they're just memory in the per-query memory context.) * * However ... there is no particular need to do it during ExecEndNode, * because FreeExecutorState will free any remaining ExprContexts within * the EState. Letting FreeExecutorState do it allows the ExprContexts to * be freed in reverse order of creation, rather than order of creation as * will happen if we delete them here, which saves O(N^2) work in the list * cleanup inside FreeExprContext. * ---------------- */ void ExecFreeExprContext(PlanState *planstate) { /* * Per above discussion, don't actually delete the ExprContext. We do * unlink it from the plan node, though. */ planstate->ps_ExprContext = NULL; } /* ---------------------------------------------------------------- * the following scan type support functions are for * those nodes which are stubborn and return tuples in * their Scan tuple slot instead of their Result tuple * slot.. luck fur us, these nodes do not do projections * so we don't have to worry about getting the ProjectionInfo * right for them... -cim 6/3/91 * ---------------------------------------------------------------- */ /* ---------------- * ExecGetScanType * ---------------- */ TupleDesc ExecGetScanType(ScanState *scanstate) { TupleTableSlot *slot = scanstate->ss_ScanTupleSlot; return slot->tts_tupleDescriptor; } /* ---------------- * ExecAssignScanType * ---------------- */ void ExecAssignScanType(ScanState *scanstate, TupleDesc tupDesc) { TupleTableSlot *slot = scanstate->ss_ScanTupleSlot; ExecSetSlotDescriptor(slot, tupDesc); } /* ---------------- * ExecAssignScanTypeFromOuterPlan * ---------------- */ void ExecAssignScanTypeFromOuterPlan(ScanState *scanstate) { PlanState *outerPlan; TupleDesc tupDesc; outerPlan = outerPlanState(scanstate); tupDesc = ExecGetResultType(outerPlan); ExecAssignScanType(scanstate, tupDesc); } /* ---------------------------------------------------------------- * Scan node support * ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- * ExecRelationIsTargetRelation * * Detect whether a relation (identified by rangetable index) * is one of the target relations of the query. * ---------------------------------------------------------------- */ bool ExecRelationIsTargetRelation(EState *estate, Index scanrelid) { ResultRelInfo *resultRelInfos; int i; resultRelInfos = estate->es_result_relations; for (i = 0; i < estate->es_num_result_relations; i++) { if (resultRelInfos[i].ri_RangeTableIndex == scanrelid) return true; } return false; } /* ---------------------------------------------------------------- * ExecOpenScanRelation * * Open the heap relation to be scanned by a base-level scan plan node. * This should be called during the node's ExecInit routine. * * By default, this acquires AccessShareLock on the relation. However, * if the relation was already locked by InitPlan, we don't need to acquire * any additional lock. This saves trips to the shared lock manager. * ---------------------------------------------------------------- */ Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags) { Relation rel; Oid reloid; LOCKMODE lockmode; /* * Determine the lock type we need. First, scan to see if target relation * is a result relation. If not, check if it's a FOR UPDATE/FOR SHARE * relation. In either of those cases, we got the lock already. */ lockmode = AccessShareLock; if (ExecRelationIsTargetRelation(estate, scanrelid)) lockmode = NoLock; else { /* Keep this check in sync with InitPlan! */ ExecRowMark *erm = ExecFindRowMark(estate, scanrelid, true); if (erm != NULL && erm->relation != NULL) lockmode = NoLock; } /* Open the relation and acquire lock as needed */ reloid = getrelid(scanrelid, estate->es_range_table); rel = heap_open(reloid, lockmode); /* * Complain if we're attempting a scan of an unscannable relation, except * when the query won't actually be run. This is a slightly klugy place * to do this, perhaps, but there is no better place. */ if ((eflags & (EXEC_FLAG_EXPLAIN_ONLY | EXEC_FLAG_WITH_NO_DATA)) == 0 && !RelationIsScannable(rel)) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("materialized view \"%s\" has not been populated", RelationGetRelationName(rel)), errhint("Use the REFRESH MATERIALIZED VIEW command."))); return rel; } /* ---------------------------------------------------------------- * ExecCloseScanRelation * * Close the heap relation scanned by a base-level scan plan node. * This should be called during the node's ExecEnd routine. * * Currently, we do not release the lock acquired by ExecOpenScanRelation. * This lock should be held till end of transaction. (There is a faction * that considers this too much locking, however.) * * If we did want to release the lock, we'd have to repeat the logic in * ExecOpenScanRelation in order to figure out what to release. * ---------------------------------------------------------------- */ void ExecCloseScanRelation(Relation scanrel) { heap_close(scanrel, NoLock); } /* * UpdateChangedParamSet * Add changed parameters to a plan node's chgParam set */ void UpdateChangedParamSet(PlanState *node, Bitmapset *newchg) { Bitmapset *parmset; /* * The plan node only depends on params listed in its allParam set. Don't * include anything else into its chgParam set. */ parmset = bms_intersect(node->plan->allParam, newchg); /* * Keep node->chgParam == NULL if there's not actually any members; this * allows the simplest possible tests in executor node files. */ if (!bms_is_empty(parmset)) node->chgParam = bms_join(node->chgParam, parmset); else bms_free(parmset); } /* * Register a shutdown callback in an ExprContext. * * Shutdown callbacks will be called (in reverse order of registration) * when the ExprContext is deleted or rescanned. This provides a hook * for functions called in the context to do any cleanup needed --- it's * particularly useful for functions returning sets. Note that the * callback will *not* be called in the event that execution is aborted * by an error. */ void RegisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, Datum arg) { ExprContext_CB *ecxt_callback; /* Save the info in appropriate memory context */ ecxt_callback = (ExprContext_CB *) MemoryContextAlloc(econtext->ecxt_per_query_memory, sizeof(ExprContext_CB)); ecxt_callback->function = function; ecxt_callback->arg = arg; /* link to front of list for appropriate execution order */ ecxt_callback->next = econtext->ecxt_callbacks; econtext->ecxt_callbacks = ecxt_callback; } /* * Deregister a shutdown callback in an ExprContext. * * Any list entries matching the function and arg will be removed. * This can be used if it's no longer necessary to call the callback. */ void UnregisterExprContextCallback(ExprContext *econtext, ExprContextCallbackFunction function, Datum arg) { ExprContext_CB **prev_callback; ExprContext_CB *ecxt_callback; prev_callback = &econtext->ecxt_callbacks; while ((ecxt_callback = *prev_callback) != NULL) { if (ecxt_callback->function == function && ecxt_callback->arg == arg) { *prev_callback = ecxt_callback->next; pfree(ecxt_callback); } else prev_callback = &ecxt_callback->next; } } /* * Call all the shutdown callbacks registered in an ExprContext. * * The callback list is emptied (important in case this is only a rescan * reset, and not deletion of the ExprContext). * * If isCommit is false, just clean the callback list but don't call 'em. * (See comment for FreeExprContext.) */ static void ShutdownExprContext(ExprContext *econtext, bool isCommit) { ExprContext_CB *ecxt_callback; MemoryContext oldcontext; /* Fast path in normal case where there's nothing to do. */ if (econtext->ecxt_callbacks == NULL) return; /* * Call the callbacks in econtext's per-tuple context. This ensures that * any memory they might leak will get cleaned up. */ oldcontext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory); /* * Call each callback function in reverse registration order. */ while ((ecxt_callback = econtext->ecxt_callbacks) != NULL) { econtext->ecxt_callbacks = ecxt_callback->next; if (isCommit) (*ecxt_callback->function) (ecxt_callback->arg); pfree(ecxt_callback); } MemoryContextSwitchTo(oldcontext); }
28.822086
101
0.68632
jessesleeping
1b9d2da7448406d4eea814bc5dd1483dbcfe8464
1,228
cpp
C++
src/projections/collg.cpp
paulyc/PROJ
a087780e69c8a9e80b2cac1afff7ca62160f8bd0
[ "MIT" ]
57
2020-02-08T17:52:17.000Z
2021-10-14T03:45:09.000Z
src/projections/collg.cpp
paulyc/PROJ
a087780e69c8a9e80b2cac1afff7ca62160f8bd0
[ "MIT" ]
47
2020-02-12T16:41:40.000Z
2021-09-28T22:27:56.000Z
src/projections/collg.cpp
paulyc/PROJ
a087780e69c8a9e80b2cac1afff7ca62160f8bd0
[ "MIT" ]
8
2020-03-17T11:18:07.000Z
2021-10-14T03:45:15.000Z
#define PJ_LIB__ #include <math.h> #include "proj.h" #include "proj_internal.h" PROJ_HEAD(collg, "Collignon") "\n\tPCyl, Sph"; #define FXC 1.12837916709551257390 #define FYC 1.77245385090551602729 #define ONEEPS 1.0000001 static PJ_XY collg_s_forward (PJ_LP lp, PJ *P) { /* Spheroidal, forward */ PJ_XY xy = {0.0,0.0}; (void) P; xy.y = 1. - sin(lp.phi); if (xy.y <= 0.) xy.y = 0.; else xy.y = sqrt(xy.y); xy.x = FXC * lp.lam * xy.y; xy.y = FYC * (1. - xy.y); return (xy); } static PJ_LP collg_s_inverse (PJ_XY xy, PJ *P) { /* Spheroidal, inverse */ PJ_LP lp = {0.0,0.0}; lp.phi = xy.y / FYC - 1.; lp.phi = 1. - lp.phi * lp.phi; if (fabs(lp.phi) < 1.) lp.phi = asin(lp.phi); else if (fabs(lp.phi) > ONEEPS) { proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION); return lp; } else { lp.phi = lp.phi < 0. ? -M_HALFPI : M_HALFPI; } lp.lam = 1. - sin(lp.phi); if (lp.lam <= 0.) lp.lam = 0.; else lp.lam = xy.x / (FXC * sqrt(lp.lam)); return (lp); } PJ *PROJECTION(collg) { P->es = 0.0; P->inv = collg_s_inverse; P->fwd = collg_s_forward; return P; }
21.54386
84
0.533388
paulyc
1b9e4e4bac7a166866d730a520a8f98dc3b84767
2,439
cpp
C++
timus/1008.cpp
y-wan/OJ
5dea140dbaaec98e440ad4b1c10fa5072f1ceea7
[ "MIT" ]
null
null
null
timus/1008.cpp
y-wan/OJ
5dea140dbaaec98e440ad4b1c10fa5072f1ceea7
[ "MIT" ]
null
null
null
timus/1008.cpp
y-wan/OJ
5dea140dbaaec98e440ad4b1c10fa5072f1ceea7
[ "MIT" ]
null
null
null
#include <iostream> #include <string> #include <sstream> #include <queue> using namespace std; bool a[11][11], v[11][11]; queue<pair<int, int> > q; int cnt, n; void print_rtlb(int x, int y) { if (x < 10 && a[x + 1][y] && !v[x + 1][y]) { cout << 'R'; v[x + 1][y] = true; q.push(make_pair(x + 1, y)); } if (y < 10 && a[x][y + 1] && !v[x][y + 1]) { cout << 'T'; v[x][y + 1] = true; q.push(make_pair(x, y + 1)); } if (x > 1 && a[x - 1][y] && !v[x - 1][y]) { cout << 'L'; v[x - 1][y] = true; q.push(make_pair(x - 1, y)); } if (y > 1 && a[x][y - 1] && !v[x][y - 1]) { cout << 'B'; v[x][y - 1] = true; q.push(make_pair(x, y - 1)); } if (++cnt < n) cout << ",\n"; else cout << ".\n"; if (!q.empty()) { x = q.front().first, y = q.front().second; q.pop(); print_rtlb(x, y); } } void print_digit() { for (int i = 1; i < 11; ++i) for (int j = 1; j < 11; ++j) if (a[i][j]) cout << i << ' ' << j << endl; } int main() { //freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); string s; getline(cin, s); stringstream ss(s); if (s.find(' ') == string::npos) { int x0, y0, x, y; ss >> n; cin >> x0 >> y0; a[x0][y0] = true; for (int i = 1; i < n; ++i) { cin >> x >> y; a[x][y] = true; } cout << x0 << ' ' << y0 << endl; v[x0][y0] = true; print_rtlb(x0, y0); } else { int x, y, len; ss >> x >> y; a[x][y] = true; ++n; q.push(make_pair(x, y)); do { cin >> s; len = s.size(); x = q.front().first, y = q.front().second; q.pop(); for (int i = 0; i < len - 1; ++i) { switch (s[i]) { case 'R': a[x + 1][y] = true; q.push(make_pair(x + 1, y)); ++n; break; case 'T': a[x][y + 1] = true; q.push(make_pair(x, y + 1)); ++n; break; case 'L': a[x - 1][y] = true; q.push(make_pair(x - 1, y)); ++n; break; case 'B': a[x][y - 1] = true; q.push(make_pair(x, y - 1)); ++n; break; default: break; } } } while (s[len - 1] != '.'); cout << n << endl; print_digit(); } return 0; }
26.802198
86
0.369824
y-wan
1ba01883fca0c3ebc67ab5bc80b8e2da31aa2209
5,466
cpp
C++
CA-source/serial_linux.cpp
dimtass/stm32mp1-rpmsg-test
8e6e92b30cf5a5851fecb9df322d125675685734
[ "MIT" ]
null
null
null
CA-source/serial_linux.cpp
dimtass/stm32mp1-rpmsg-test
8e6e92b30cf5a5851fecb9df322d125675685734
[ "MIT" ]
null
null
null
CA-source/serial_linux.cpp
dimtass/stm32mp1-rpmsg-test
8e6e92b30cf5a5851fecb9df322d125675685734
[ "MIT" ]
null
null
null
#include <sys/ioctl.h> #include <cstdio> #include <cstdlib> #include <cstdint> #include <unistd.h> #include <cstring> #include <errno.h> #include <fcntl.h> #include <time.h> #include <signal.h> #include <string> #include "log.h" #include "serial_linux.h" Serial::Serial(std::string port, int baudrate) : m_port(port), m_baudrate(baudrate) { m_fd = -1; m_connected = 0; } Serial::~Serial() { disconnect(); } Serial::en_com_port_ret Serial::connect() { return(open_port(m_port.c_str(), m_baudrate, &m_oldopts)); } Serial::en_com_port_ret Serial::disconnect() { en_com_port_ret resp = RET_ERR_CLOSE; tcsetattr(m_fd, TCSANOW, &m_oldopts); int err = close(m_fd); if (!err) { resp = RET_OK; } m_connected = 0; return(resp); } size_t Serial::send(const uint8_t * buffer, size_t len) { return(write(m_fd, buffer, len)); } size_t Serial::receive_tm(uint8_t * buffer, size_t len, int timeout) { struct termios opts; tcgetattr(m_fd, &opts); opts.c_cc[VTIME] = timeout; opts.c_cc[VMIN] = 0; // tcflush(m_fd, TCIFLUSH); // tcsetattr(m_fd, TCSANOW, &opts); // ioctl(m_fd, TCIFLUSH, 0); return(read(m_fd, buffer, len)); } size_t Serial::receive_tm_count(uint8_t * buffer, size_t len, int timeout, int bytes) { if (bytes > 0xff) { size_t bytes_remain = bytes; size_t bytes_received = 0; size_t rd_count = 0; struct termios opts; tcgetattr(m_fd, &opts); opts.c_cc[VTIME] = timeout; opts.c_cc[VMIN] = 0; ioctl(m_fd, TCIFLUSH, 0); tcflush(m_fd, TCIFLUSH); tcsetattr(m_fd, TCSANOW, &opts); while (bytes_remain) { rd_count = read(m_fd, &buffer[bytes_received], len); bytes_received += rd_count; L_(ldebug) << "Received: " << bytes_received << "/" << bytes; bytes_remain -= rd_count; L_(ldebug) << "Remain: " << bytes_remain; } return(bytes_received); } else return(receive_tm(buffer, len, timeout)); } size_t Serial::receive(uint8_t * buffer, size_t len) { return(read(m_fd, buffer, len)); }; Serial::en_com_port_ret Serial::open_port(const char *device, int baudrate, struct termios *oldopts) { int unix_speed; struct termios opts; m_connected = 0; unix_speed = baudrate_to_unix(baudrate); if (unix_speed < 0) { return RET_ERR_UNKNOWN_BAUD; } m_fd = open(device, O_RDWR | O_NOCTTY | O_NDELAY | O_EXCL); if (m_fd < 0) { L_(ldebug) << "tty: " << device << ", baud: " << baudrate; return RET_ERR_OPEN; } ioctl(m_fd, TIOCEXCL); // no delay fcntl(m_fd, F_SETFL, 0); /* get previous options */ tcgetattr(m_fd, &opts); /* Save previous options */ memcpy(oldopts, &opts, sizeof(struct termios)); /* Set 8,N,1 */ opts.c_cflag &= ~CSIZE; opts.c_cflag &= ~CSTOPB; opts.c_cflag &= ~CRTSCTS; opts.c_cflag &= ~~(PARENB | PARODD); /* disable parity */ opts.c_cflag |= CLOCAL | CREAD | CS8; opts.c_iflag = IGNPAR; opts.c_iflag &= ~(IXON | IXOFF | IXANY);/* disable xon/xoff ctrl */ opts.c_oflag = 0; opts.c_lflag = 0; opts.c_cc[VTIME] = 10; opts.c_cc[VMIN] = 0; cfsetispeed(&opts, unix_speed); cfsetospeed(&opts, unix_speed); tcflush(m_fd, TCIFLUSH); if (tcsetattr(m_fd, TCSANOW, &opts) != 0) { return RET_ERR_SET_OPTS; } m_connected = 1; return RET_OK; } uint8_t Serial::connected(void) { return(m_connected); } int Serial::baudrate_to_unix(int speed) { int unix_speed; switch (speed) { case 50: unix_speed = B50; break; case 75: unix_speed = B75; break; case 110: unix_speed = B110; break; case 134: unix_speed = B134; break; case 150: unix_speed = B150; break; case 300: unix_speed = B300; break; case 600: unix_speed = B600; break; case 1200: unix_speed = B1200; break; case 1800: unix_speed = B1800; break; case 2400: unix_speed = B2400; break; case 4800: unix_speed = B4800; break; case 9600: unix_speed = B9600; break; case 19200: unix_speed = B19200; break; case 38400: unix_speed = B38400; break; case 57600: unix_speed = B57600; break; case 115200: unix_speed = B115200; break; case 230400: unix_speed = B230400; break; case 460800: unix_speed = B460800; break; case 500000: unix_speed = B500000; break; case 576000: unix_speed = B576000; break; case 921600: unix_speed = B921600; break; case 1000000: unix_speed = B1000000; break; case 1152000: unix_speed = B1152000; break; case 1500000: unix_speed = B1500000; break; case 2000000: unix_speed = B2000000; break; case 2500000: unix_speed = B2500000; break; case 3000000: unix_speed = B3000000; break; case 3500000: unix_speed = B3500000; break; case 4000000: unix_speed = B4000000; break; default: unix_speed = -1; break; } return unix_speed; } void Serial::msleep(int ms) { struct timespec ts; ts.tv_sec = ms / 1000; ts.tv_nsec = (ms % 1000) * 1000000; nanosleep(&ts, NULL); }
26.15311
101
0.590011
dimtass
1ba2d80232f33fd9ab0f5f4c3bee4e401a3fa164
8,540
cpp
C++
src/Tools/ImagePolygonize/ImagePolygonize.cpp
irov/Mengine
b76e9f8037325dd826d4f2f17893ac2b236edad8
[ "MIT" ]
39
2016-04-21T03:25:26.000Z
2022-01-19T14:16:38.000Z
src/Tools/ImagePolygonize/ImagePolygonize.cpp
irov/Mengine
b76e9f8037325dd826d4f2f17893ac2b236edad8
[ "MIT" ]
23
2016-06-28T13:03:17.000Z
2022-02-02T10:11:54.000Z
src/Tools/ImagePolygonize/ImagePolygonize.cpp
irov/Mengine
b76e9f8037325dd826d4f2f17893ac2b236edad8
[ "MIT" ]
14
2016-06-22T20:45:37.000Z
2021-07-05T12:25:19.000Z
#include "ToolUtils/ToolUtils.h" #include "Config/Config.h" #include "pugixml.hpp" #include <vector> #include <string> #include <sstream> ////////////////////////////////////////////////////////////////////////// int APIENTRY wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR lpCmdLine, int nShowCmd ) { MENGINE_UNUSED( hInstance ); MENGINE_UNUSED( hPrevInstance ); MENGINE_UNUSED( nShowCmd ); std::wstring texturepacker_path = parse_kwds( lpCmdLine, L"--texturepacker", std::wstring() ); std::wstring in_path = parse_kwds( lpCmdLine, L"--in_path", std::wstring() ); std::wstring result_path = parse_kwds( lpCmdLine, L"--result_path", std::wstring() ); uint32_t offset_x = parse_kwds( lpCmdLine, L"--offset_x", 0U ); uint32_t offset_y = parse_kwds( lpCmdLine, L"--offset_y", 0U ); float width = parse_kwds( lpCmdLine, L"--width", -1.f ); float height = parse_kwds( lpCmdLine, L"--height", -1.f ); uint32_t tolerance = parse_kwds( lpCmdLine, L"--tolerance", 200U ); if( texturepacker_path.empty() == true ) { message_error( "not found 'texturepacker' param" ); return 0; } if( in_path.empty() == true ) { message_error( "not found 'image' param" ); return 0; } std::wstring system_cmd; system_cmd += L" --shape-padding 0 "; system_cmd += L" --border-padding 0 "; system_cmd += L" --padding 0 "; system_cmd += L" --disable-rotation "; system_cmd += L" --extrude 0 "; system_cmd += L" --trim-mode Polygon "; system_cmd += L" --trim-threshold 0 "; system_cmd += L" --tracer-tolerance "; system_cmd += L" --max-width 8192 "; system_cmd += L" --max-height 8192 "; system_cmd += L" --max-size 8192 "; std::wstringstream ss; ss << tolerance; system_cmd += ss.str(); system_cmd += L" "; WCHAR ImagePathCanonicalizeQuote[MAX_PATH]; ForcePathQuoteSpaces( ImagePathCanonicalizeQuote, in_path ); system_cmd += ImagePathCanonicalizeQuote; WCHAR tempPath[MAX_PATH]; GetTempPath( MAX_PATH, tempPath ); WCHAR outCanonicalize[MAX_PATH]; PathCombine( outCanonicalize, tempPath, L"aemovie_temp_texturepacker_sheet.xml" ); //PathCanonicalize( outCanonicalize, L"%TEMP%/temp_texturepacker_sheet.xml" ); //PathUnquoteSpaces( outCanonicalize ); system_cmd += L" --data "; system_cmd += outCanonicalize; system_cmd += L" --format xml "; system_cmd += L" --quiet "; STARTUPINFO lpStartupInfo; ZeroMemory( &lpStartupInfo, sizeof( STARTUPINFOW ) ); lpStartupInfo.cb = sizeof( lpStartupInfo ); PROCESS_INFORMATION lpProcessInformation; ZeroMemory( &lpProcessInformation, sizeof( PROCESS_INFORMATION ) ); WCHAR lpCommandLine[32768]; wcscpy_s( lpCommandLine, system_cmd.c_str() ); WCHAR TexturePathCanonicalizeQuote[MAX_PATH]; ForcePathQuoteSpaces( TexturePathCanonicalizeQuote, texturepacker_path ); PathUnquoteSpaces( TexturePathCanonicalizeQuote ); if( CreateProcess( TexturePathCanonicalizeQuote , lpCommandLine , NULL , NULL , FALSE , CREATE_NO_WINDOW , NULL , NULL , &lpStartupInfo , &lpProcessInformation ) == FALSE ) { message_error( "invalid CreateProcess %ls %ls" , TexturePathCanonicalizeQuote , lpCommandLine ); return 0; } CloseHandle( lpProcessInformation.hThread ); WaitForSingleObject( lpProcessInformation.hProcess, INFINITE ); DWORD exit_code; GetExitCodeProcess( lpProcessInformation.hProcess, &exit_code ); CloseHandle( lpProcessInformation.hProcess ); if( exit_code != 0 ) { message_error( "invalid Process %ls exit_code %d" , TexturePathCanonicalizeQuote , exit_code ); return 0; } FILE * f = _wfopen( outCanonicalize, L"rb" ); if( f == NULL ) { message_error( "invalid _wfopen %ls" , outCanonicalize ); return 0; } fseek( f, 0, SEEK_END ); int f_size = ftell( f ); rewind( f ); std::vector<char> v_buffer( f_size ); char * mf_buffer = &v_buffer[0]; fread( mf_buffer, 1, f_size, f ); fclose( f ); pugi::xml_document doc; pugi::xml_parse_result result = doc.load_buffer( mf_buffer, f_size ); pugi::xml_node xml_sprite = doc.first_element_by_path( "TextureAtlas/sprite" ); pugi::xml_attribute xml_sprite_x = xml_sprite.attribute( "x" ); pugi::xml_attribute xml_sprite_y = xml_sprite.attribute( "y" ); pugi::xml_attribute xml_sprite_w = xml_sprite.attribute( "w" ); pugi::xml_attribute xml_sprite_h = xml_sprite.attribute( "h" ); pugi::xml_attribute xml_sprite_oX = xml_sprite.attribute( "oX" ); pugi::xml_attribute xml_sprite_oY = xml_sprite.attribute( "oY" ); pugi::xml_attribute xml_sprite_oW = xml_sprite.attribute( "oW" ); pugi::xml_attribute xml_sprite_oH = xml_sprite.attribute( "oH" ); uint32_t x = xml_sprite_x.as_uint(); uint32_t y = xml_sprite_y.as_uint(); uint32_t w = xml_sprite_w.as_uint(); uint32_t h = xml_sprite_h.as_uint(); uint32_t oX = xml_sprite_oX.as_uint(); uint32_t oY = xml_sprite_oY.as_uint(); uint32_t oW = xml_sprite_oW.as_uint(); uint32_t oH = xml_sprite_oH.as_uint(); //TODO MENGINE_UNUSED( oW ); MENGINE_UNUSED( oH ); pugi::xml_node xml_vertices = doc.first_element_by_path( "TextureAtlas/sprite/vertices" ); const char * vertices = xml_vertices.child_value(); std::stringstream ss_vertices( vertices ); std::vector<float> positions; for( ;; ) { int32_t pos_x; int32_t pos_y; if( ss_vertices >> pos_x && ss_vertices >> pos_y ) { pos_x -= x; pos_y -= y; pos_x += offset_x; pos_y += offset_y; float xf = (float)pos_x; float yf = (float)pos_y; positions.push_back( xf ); positions.push_back( yf ); } else { break; } } pugi::xml_node xml_verticesUV = doc.first_element_by_path( "TextureAtlas/sprite/verticesUV" ); const char * verticesUV = xml_verticesUV.child_value(); if( width < 0.f ) { width = (float)w; } if( height < 0.f ) { height = (float)h; } std::stringstream ss_verticesUV( verticesUV ); std::vector<float> uvs; for( ;; ) { uint32_t uv_x; uint32_t uv_y; if( ss_verticesUV >> uv_x && ss_verticesUV >> uv_y ) { uv_x -= x; uv_y -= y; uv_x += oX; uv_y += oY; float xf = (float)uv_x / (float)width; float yf = (float)uv_y / (float)height; uvs.push_back( xf ); uvs.push_back( yf ); } else { break; } } pugi::xml_node xml_triangles = doc.first_element_by_path( "TextureAtlas/sprite/triangles" ); const char * triangles = xml_triangles.child_value(); std::stringstream ss_triangles( triangles ); std::vector<uint16_t> indices; for( ;; ) { uint16_t index; if( ss_triangles >> index ) { indices.push_back( index ); } else { break; } } uint32_t vertex_count = (uint32_t)positions.size() / 2; uint32_t index_count = (uint32_t)indices.size(); WCHAR infoCanonicalizeQuote[MAX_PATH]; ForcePathQuoteSpaces( infoCanonicalizeQuote, result_path.c_str() ); PathUnquoteSpaces( infoCanonicalizeQuote ); FILE * f_result; errno_t err = _wfopen_s( &f_result, infoCanonicalizeQuote, L"wt" ); if( err != 0 ) { message_error( "invalid _wfopen %ls err %d" , infoCanonicalizeQuote , err ); return 0; } fprintf_s( f_result, "%u\n", vertex_count ); fprintf_s( f_result, "%u\n", index_count ); fprintf_s( f_result, "" ); for( float v : positions ) { fprintf_s( f_result, " %12f", v ); } fprintf_s( f_result, "\n" ); fprintf_s( f_result, "" ); for( float v : uvs ) { fprintf_s( f_result, " %12f", v ); } fprintf_s( f_result, "\n" ); fprintf_s( f_result, "" ); for( uint16_t v : indices ) { fprintf_s( f_result, " %u", v ); } fprintf_s( f_result, "\n" ); fclose( f_result ); return 0; }
26.276923
100
0.600468
irov
1ba5b0848e1117fc5a6059de0d1752ace8e2f181
8,204
cpp
C++
Plugins/PLVolumeRenderer/src/ClipPosition/ShaderFunctionClipPositionVolumeTexture.cpp
ktotheoz/pixellight
43a661e762034054b47766d7e38d94baf22d2038
[ "MIT" ]
83
2015-01-08T15:06:14.000Z
2021-07-20T17:07:00.000Z
Plugins/PLVolumeRenderer/src/ClipPosition/ShaderFunctionClipPositionVolumeTexture.cpp
PixelLightFoundation/pixellight
43a661e762034054b47766d7e38d94baf22d2038
[ "MIT" ]
19
2018-08-24T08:10:13.000Z
2018-11-29T06:39:08.000Z
Plugins/PLVolumeRenderer/src/ClipPosition/ShaderFunctionClipPositionVolumeTexture.cpp
ktotheoz/pixellight
43a661e762034054b47766d7e38d94baf22d2038
[ "MIT" ]
40
2015-02-25T18:24:34.000Z
2021-03-06T09:01:48.000Z
/*********************************************************\ * File: ShaderFunctionClipPositionVolumeTexture.cpp * * * Copyright (C) 2002-2013 The PixelLight Team (http://www.pixellight.org/) * * This file is part of PixelLight. * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software * and associated documentation files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \*********************************************************/ //[-------------------------------------------------------] //[ Includes ] //[-------------------------------------------------------] #include <PLRenderer/Renderer/Renderer.h> #include <PLRenderer/Renderer/ProgramWrapper.h> #include <PLRenderer/Renderer/TextureBuffer3D.h> #include <PLScene/Visibility/VisNode.h> #include <PLVolume/Volume.h> #include <PLVolume/Scene/SNClipVolumeTexture.h> #include "PLVolumeRenderer/SRPVolume.h" #include "PLVolumeRenderer/ClipPosition/ShaderFunctionClipPositionVolumeTexture.h" //[-------------------------------------------------------] //[ Namespace ] //[-------------------------------------------------------] using namespace PLCore; using namespace PLMath; using namespace PLRenderer; using namespace PLScene; namespace PLVolumeRenderer { //[-------------------------------------------------------] //[ RTTI interface ] //[-------------------------------------------------------] pl_implement_class(ShaderFunctionClipPositionVolumeTexture) //[-------------------------------------------------------] //[ Public functions ] //[-------------------------------------------------------] /** * @brief * Default constructor */ ShaderFunctionClipPositionVolumeTexture::ShaderFunctionClipPositionVolumeTexture() { } /** * @brief * Destructor */ ShaderFunctionClipPositionVolumeTexture::~ShaderFunctionClipPositionVolumeTexture() { } /** * @brief * Sets the clip volume texture parameters */ void ShaderFunctionClipPositionVolumeTexture::SetVolumeTexture(Program &cProgram, const VisNode &cVolumeVisNode, const VisNode &cVolumeTextureVisNode, int nIndex) { // Get used renderer instance Renderer &cRenderer = cProgram.GetRenderer(); // Get simplified GPU program wrapper interface ProgramWrapper &cProgramWrapper = static_cast<ProgramWrapper&>(cProgram); // Get the clip volume texture scene node PLVolume::SNClipVolumeTexture *pSNClipVolumeTexture = static_cast<PLVolume::SNClipVolumeTexture*>(cVolumeTextureVisNode.GetSceneNode()); if (!pSNClipVolumeTexture) return; // Early escape, there's no sense in continuing // Get the volume resource PLVolume::Volume *pVolume = pSNClipVolumeTexture->GetVolume(); if (!pVolume) return; // Early escape, there's no sense in continuing // Get the renderer texture buffer holding the 3D voxel data PLRenderer::TextureBuffer *pVolumeTextureBuffer = pVolume->GetVolumeTextureBuffer(cRenderer); if (!pVolumeTextureBuffer || pVolumeTextureBuffer->GetType() != PLRenderer::Resource::TypeTextureBuffer3D) return; // Early escape, there's no sense in continuing we only support 3D textures // Calculate the volume space to clip volume texture space matrix // Volume space to view space Matrix4x4 mVolumeSpaceToClipVolumeTextureSpace = cVolumeVisNode.GetWorldViewMatrix(); // View space to clip volume texture space mVolumeSpaceToClipVolumeTextureSpace = cVolumeTextureVisNode.GetWorldViewMatrix().GetInverted()*mVolumeSpaceToClipVolumeTextureSpace; // Set the volume space to clip volume texture space matrix cProgramWrapper.Set((nIndex < 0) ? "VolumeSpaceToClipVolumeTextureSpace_x_" : (String("VolumeSpaceToCliVvolumeTextureSpace_") + nIndex + '_'), mVolumeSpaceToClipVolumeTextureSpace); // Set invert clipping cProgramWrapper.Set((nIndex < 0) ? "InvertClipping_x_" : (String("InvertClipping_") + nIndex + '_'), (cVolumeTextureVisNode.GetSceneNode()->GetFlags() & PLVolume::SNClip::InvertClipping) != 0); { // Set clip volume texture map const int nTextureUnit = cProgramWrapper.Set((nIndex < 0) ? "ClipVolumeTexture_x_" : (String("ClipVolumeTexture_") + nIndex + '_'), pVolumeTextureBuffer); if (nTextureUnit >= 0) { // Setup texture addressing by using clamp // -> Clamp: Last valid value is reused for out-of-bound access // -> "stretched color" instead of color being set to border color which is black by default cRenderer.SetSamplerState(nTextureUnit, Sampler::AddressU, TextureAddressing::Clamp); cRenderer.SetSamplerState(nTextureUnit, Sampler::AddressV, TextureAddressing::Clamp); cRenderer.SetSamplerState(nTextureUnit, Sampler::AddressW, TextureAddressing::Clamp); // No need to perform any texture filtering in here cRenderer.SetSamplerState(nTextureUnit, Sampler::MagFilter, TextureFiltering::None); cRenderer.SetSamplerState(nTextureUnit, Sampler::MinFilter, TextureFiltering::None); cRenderer.SetSamplerState(nTextureUnit, Sampler::MipFilter, TextureFiltering::None); } } // Set clip threshold, everything above will be clipped cProgramWrapper.Set((nIndex < 0) ? "ClipThreshold_x_" : (String("ClipThreshold_") + nIndex + '_'), pSNClipVolumeTexture->ClipThreshold.Get()); } //[-------------------------------------------------------] //[ Public virtual ShaderFunctionClipPosition functions ] //[-------------------------------------------------------] void ShaderFunctionClipPositionVolumeTexture::SetVolumeTextures(Program &cProgram, const VisNode &cVolumeVisNode, const Array<const VisNode*> &lstClipVolumeTextures) { // None-template version // We only know a single clip volume texture, ignore the rest if (lstClipVolumeTextures.GetNumOfElements()) SetVolumeTexture(cProgram, cVolumeVisNode, *lstClipVolumeTextures[0], -1); } //[-------------------------------------------------------] //[ Public virtual ShaderFunction functions ] //[-------------------------------------------------------] String ShaderFunctionClipPositionVolumeTexture::GetSourceCode(const String &sShaderLanguage, ESourceCodeType nSourceCodeType) { // Check requested shader language if (sShaderLanguage == GLSL) { #include "VolumeTexture_GLSL.h" // Return the requested source code switch (nSourceCodeType) { case FragmentShaderBody: return sSourceCode_Fragment; case FragmentShaderTemplate: return sSourceCode_Fragment_Template; case VertexShaderHeader: case VertexShaderBody: case VertexShaderTemplate: case FragmentShaderHeader: // Nothing to do in here break; } } else if (sShaderLanguage == Cg) { #include "VolumeTexture_Cg.h" // Return the requested source code switch (nSourceCodeType) { case FragmentShaderBody: return sSourceCode_Fragment; case FragmentShaderTemplate: return sSourceCode_Fragment_Template; case VertexShaderHeader: case VertexShaderBody: case VertexShaderTemplate: case FragmentShaderHeader: // Nothing to do in here break; } } // Error! return ""; } //[-------------------------------------------------------] //[ Namespace ] //[-------------------------------------------------------] } // PLVolumeRenderer
41.02
194
0.661141
ktotheoz
1ba5d57d5b0151da2290bb7370698ca12d15ec09
14,827
hpp
C++
src/cpu/jit_avx512_common_conv_kernel.hpp
scale-snu/mkldnn-bn-restructuring
97fdb4f17119008baf452f1cbee5b91b6a366d79
[ "Apache-2.0" ]
1
2021-09-14T08:09:29.000Z
2021-09-14T08:09:29.000Z
src/cpu/jit_avx512_common_conv_kernel.hpp
scale-snu/mkldnn-bn-restructuring
97fdb4f17119008baf452f1cbee5b91b6a366d79
[ "Apache-2.0" ]
null
null
null
src/cpu/jit_avx512_common_conv_kernel.hpp
scale-snu/mkldnn-bn-restructuring
97fdb4f17119008baf452f1cbee5b91b6a366d79
[ "Apache-2.0" ]
null
null
null
/******************************************************************************* * Copyright 2016-2017 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ #ifndef JIT_AVX512_COMMON_CONV_KERNEL_F32_HPP #define JIT_AVX512_COMMON_CONV_KERNEL_F32_HPP #include "c_types_map.hpp" #include "cpu_memory.hpp" #include "jit_generator.hpp" #include "jit_primitive_conf.hpp" namespace mkldnn { namespace impl { namespace cpu { struct jit_avx512_common_conv_fwd_kernel : public jit_generator { jit_avx512_common_conv_fwd_kernel(jit_conv_conf_t ajcp, const primitive_attr_t &attr) : jcp(ajcp), attr_(attr) { generate(); jit_ker = (void (*)(jit_conv_call_s *))getCode(); } static bool post_ops_ok(jit_conv_conf_t &jcp, const primitive_attr_t &attr); static status_t init_conf(jit_conv_conf_t &jcp, const convolution_desc_t &cd, cpu_memory_t::pd_t &src_pd, cpu_memory_t::pd_t &weights_pd, cpu_memory_t::pd_t &dst_pd, cpu_memory_t::pd_t &bias_pd, const primitive_attr_t &attr, bool with_relu = false, float relu_negative_slope = 0.); jit_conv_conf_t jcp; const primitive_attr_t &attr_; void (*jit_ker)(jit_conv_call_s *); private: using reg64_t = const Xbyak::Reg64; enum { typesize = sizeof(float), ker_reg_base_idx = 28, }; reg64_t param = abi_param1; // We rearrange registers without conflicts for BatchNorm fusion. reg64_t reg_inp = r9; reg64_t reg_inp_tmp = r12; reg64_t reg_ker = r9; reg64_t reg_ker_tmp = r12; reg64_t reg_out = r10; reg64_t reg_inp_prf = r11; reg64_t reg_ker_prf = r12; reg64_t reg_out_prf = r13; reg64_t aux_reg_inp = r14; reg64_t aux_reg_ker = r15; reg64_t aux_reg_inp_prf = rsi; reg64_t aux_reg_ker_prf = rdx; reg64_t reg_channel = rsi; reg64_t reg_bias = rdx; reg64_t reg_kj = rax; reg64_t reg_relu_ns = rax; reg64_t reg_oi = rbx; reg64_t reg_kh = abi_not_param1; reg64_t reg_tmp = rbp; reg64_t reg_ic_loop = rdx; reg64_t reg_inp_loop = rsi; reg64_t reg_init_flag = r13; reg64_t reg_bias_ptr = param; reg64_t aux_reg_ic = r12; reg64_t reg_binp = rax; reg64_t reg_bout = r11; reg64_t aux1_reg_inp = rbx; reg64_t aux_reg_out = abi_not_param1; int stack_space_needed = 112; int ker = 0; int norm_flags = 16; int inp = 32; int prev_var = 48; int prev_src = 64; int scale_shift = 80; int oh_second_flags = 96; reg64_t reg_norm_flags_tmp = r12; reg64_t reg_norm_flags = r8; reg64_t reg_oh_second_flags_tmp = r12; reg64_t reg_oh_second_flags = r9; using mask_t = const Xbyak::Opmask; mask_t vmask = k7; reg64_t reg_prev_mean_tmp = r12; reg64_t reg_prev_var_tmp = r12; reg64_t reg_prev_src = r9; reg64_t aux_reg_prev_src = r8; reg64_t reg_prev_src_tmp = r12; reg64_t reg_scale_shift_tmp = r12; inline Xbyak::Zmm zmm_ker(int i_ic) { assert(i_ic < 4); return Xbyak::Zmm(ker_reg_base_idx + i_ic); } inline Xbyak::Zmm zmm_out(int i_ur, int i_oc) { int idx = i_ur + i_oc * jcp.ur_w; assert(idx < ker_reg_base_idx); return Xbyak::Zmm(idx); } Xbyak::Reg64 imm_addr64 = r15; Xbyak::Xmm xmm_relu_ns = Xbyak::Xmm(30); Xbyak::Zmm zmm_relu_ns = Xbyak::Zmm(30); Xbyak::Zmm zmm_zero = Xbyak::Zmm(31); Xbyak::Zmm vone = Xbyak::Zmm(20); Xbyak::Zmm veps = Xbyak::Zmm(21); Xbyak::Zmm z = Xbyak::Zmm(22); Xbyak::Zmm zmm_zero2 = Xbyak::Zmm(23); Xbyak::Zmm zmean = Xbyak::Zmm(24); Xbyak::Zmm zsqrtvar = Xbyak::Zmm(25); Xbyak::Zmm zgamma = Xbyak::Zmm(26); Xbyak::Zmm zbeta = Xbyak::Zmm(27); int chan_data_offt; inline void prepare_output(int ur_w); inline void store_output(int ur_w); inline void compute_loop_fma(int ur_w, int pad_l, int pad_r); inline void compute_loop_fma_OC_FIRST(int ur_w, int pad_l, int pad_r); inline void compute_loop_4vnni(int ur_w, int pad_l, int pad_r); inline void compute_loop_4fma(int ur_w, int pad_l, int pad_r); inline void compute_loop_4fma_1st(int ur_w, int pad_l, int pad_r); inline void compute_loop(int ur_w, int pad_l, int pad_r); void generate(); inline void vadd(Xbyak::Zmm zmm, reg64_t reg, int offset) { if (jcp.ver == ver_4vnni) vpaddd(zmm, zmm, EVEX_compress_addr(reg, offset)); else vaddps(zmm, zmm, EVEX_compress_addr(reg, offset)); } inline void vcmp(Xbyak::Opmask kmask, Xbyak::Zmm zmm_src1, Xbyak::Zmm zmm_src2, const unsigned char cmp) { if (jcp.ver == ver_4vnni) vpcmpd(kmask, zmm_src1, zmm_src2, cmp); else vcmpps(kmask, zmm_src1, zmm_src2, cmp); } inline void vmul(Xbyak::Zmm zmm_dst, Xbyak::Opmask kmask, Xbyak::Zmm zmm_src1, Xbyak::Zmm zmm_src2) { if (jcp.ver == ver_4vnni) vpmulld(zmm_dst | kmask, zmm_src1, zmm_src2); else vmulps(zmm_dst | kmask, zmm_src1, zmm_src2); } inline int get_output_offset(int oi, int n_oc_block) { return jcp.typesize_out * (n_oc_block * jcp.oh * jcp.ow + oi) * jcp.oc_block; } inline int get_input_offset(int ki, int ic, int oi, int pad_l) { int scale = (jcp.ver == ver_4vnni) ? 2 : 1; int iw_str = !jcp.is_1stconv ? jcp.ic_block : 1; int ic_str = !jcp.is_1stconv ? 1 : jcp.iw * jcp.ih; return jcp.typesize_in * ((ki + oi * jcp.stride_w - pad_l) * iw_str + scale * ic * ic_str); } inline int get_kernel_offset(int ki,int ic,int n_oc_block,int ker_number) { int scale = (jcp.ver == ver_4vnni) ? 2 : 1; return jcp.typesize_in * jcp.oc_block * (n_oc_block * jcp.nb_ic * jcp.ic_block * jcp.kh * jcp.kw + (ic + ker_number) * scale + ki * jcp.ic_block); } inline int get_ow_start(int ki, int pad_l) { return nstl::max(0, (pad_l - ki + jcp.stride_w - 1) / jcp.stride_w); } inline int get_ow_end(int ur_w, int ki, int pad_r) { return ur_w - nstl::max(0, (ki + pad_r - (jcp.kw - 1) + jcp.stride_w - 1) / jcp.stride_w); } }; struct jit_avx512_common_conv_bwd_data_kernel_f32: public jit_generator { jit_avx512_common_conv_bwd_data_kernel_f32(jit_conv_conf_t ajcp): jcp(ajcp) { generate(); jit_ker = (void (*)(jit_conv_call_s *))getCode(); } static status_t init_conf(jit_conv_conf_t &jcp, const convolution_desc_t &cd, const memory_desc_wrapper &diff_src_d, const memory_desc_wrapper &weights_d, const memory_desc_wrapper &diff_dst_d); jit_conv_conf_t jcp; void (*jit_ker)(jit_conv_call_s *); private: using reg64_t = const Xbyak::Reg64; enum { typesize = sizeof(float), ker_reg_base_idx = 28, }; // We rearrange registers without conflicts for BatchNorm fusion. reg64_t param = abi_param1; reg64_t reg_dst_tmp = r8; reg64_t reg_dst = r9; reg64_t reg_ker_tmp = r8; reg64_t reg_ker = r9; reg64_t reg_src = r10; reg64_t reg_dst_prf_tmp = r8; reg64_t reg_dst_prf = r9; reg64_t reg_ker_prf_tmp = r8; reg64_t reg_ker_prf = r9; reg64_t reg_src_prf = r13; reg64_t aux_reg_dst = r14; reg64_t aux_reg_ker = r15; reg64_t aux_reg_dst_prf = rsi; reg64_t aux_reg_ker_prf = rdx; reg64_t reg_kj = rax; reg64_t reg_oi = rbx; reg64_t reg_kh = abi_not_param1; reg64_t reg_channel_tmp = r8; reg64_t reg_channel = r9; reg64_t reg_tmp = rbp; reg64_t reg_flag_oc_last_tmp = r8; reg64_t reg_flag_oc_last = r9; reg64_t reg_flag_last_tmp = r8; reg64_t reg_flag_last = r9; reg64_t reg_coff_tmp = r8; reg64_t reg_coff = rsi; reg64_t reg_rbuf1_tmp = r8; reg64_t reg_rbuf1 = r11; reg64_t reg_rbuf2_tmp = r8; reg64_t reg_rbuf2 = r12; reg64_t reg_bn_src_tmp = r8; reg64_t reg_bn_src = r9; reg64_t reg_relu_src_tmp = r8; reg64_t reg_relu_src = r9; reg64_t reg_mean_tmp = r8; reg64_t reg_mean = r9; reg64_t reg_rbuf1_base_tmp = r8; reg64_t reg_rbuf1_base = r15; reg64_t reg_rbuf2_base_tmp = r8; reg64_t reg_rbuf2_base = r13; reg64_t reg_diff_gamma_tmp = r8; reg64_t reg_diff_gamma = rbx; reg64_t reg_diff_beta_tmp = r8; reg64_t reg_diff_beta = r10; reg64_t reg_coff_max_tmp = r8; reg64_t reg_coff_max = rdx; reg64_t reg_nthr_tmp = r8; reg64_t reg_nthr = r12; reg64_t reg_ithr_tmp = r8; reg64_t reg_ithr = rbp; reg64_t reg_chan_size_tmp = r8; reg64_t reg_chan_size = r15; reg64_t reg_var_tmp = r8; reg64_t reg_var = r8; reg64_t reg_base_coff_tmp = r8; reg64_t reg_base_coff = rbp; reg64_t reg_barrier_tmp = r8; reg64_t reg_barrier = rax; reg64_t reg_roff = r14; reg64_t reg_ctr = rsi; reg64_t reg_one_tmp =r8; reg64_t reg_eps_tmp =r8; int flag_oc_last = 0; int coff = 16; int rbuf1 = 32; int rbuf2 = 48; int bn_src = 64; int relu_src = 80; int mean = 96; int dst = 112; int ker = 128; int dst_prf = 144; int ker_prf = 160; int channel = 172; int rbuf1_base = 192; int rbuf2_base = 208; int diff_gamma = 224; int diff_beta = 240; int coff_max = 256; int nthr = 272; int ithr = 288; int chan_size = 304; int var = 320; int base_coff = 336; int barrier = 352; int roff = 368; int ctr = 338; int one = 400; int eps = 416; int flag_last = 432; int stack_space_needed = 448; Xbyak::Zmm zbn_src = Xbyak::Zmm(21); Xbyak::Zmm zrelu_src = Xbyak::Zmm(22); Xbyak::Zmm zmean = Xbyak::Zmm(23); Xbyak::Zmm zd_beta = Xbyak::Zmm(24); Xbyak::Zmm zd_gamma = Xbyak::Zmm(25); Xbyak::Zmm ztmp = Xbyak::Zmm(26); Xbyak::Zmm zmm_zero = Xbyak::Zmm(27); Xbyak::Zmm vone = Xbyak::Zmm(25); Xbyak::Zmm veps = Xbyak::Zmm(26); Xbyak::Zmm zsqrtvar = Xbyak::Zmm(27); using mask_t = const Xbyak::Opmask; mask_t vmask = k7; inline Xbyak::Zmm zmm_ker(int i_ic) { assert(i_ic < 4); return Xbyak::Zmm(ker_reg_base_idx + i_ic); } inline Xbyak::Zmm zmm_out(int i_ur, int i_oc) { int idx = i_ur + i_oc * jcp.ur_w; assert(idx < ker_reg_base_idx); return Xbyak::Zmm(idx); } inline void vadd(Xbyak::Zmm zmm, reg64_t reg, int offset) { if (jcp.ver == ver_4vnni) vpaddd(zmm, zmm, EVEX_compress_addr(reg, offset)); else vaddps(zmm, zmm, EVEX_compress_addr(reg, offset)); } inline void prepare_output(int ur_w); inline void store_output(int ur_w); inline void compute_loop_4fma(int ur_w, int l_overflow, int r_overflow); inline void compute_loop_4vnni(int ur_w, int l_overflow, int r_overflow); inline void compute_loop_fma(int ur_w, int l_overflow, int r_overflow); inline void compute_loop(int ur_w, int l_overflow, int r_overflow); void generate(); inline int get_iw_start(int ki, int l_overflow) { int r_pad = jcp.stride_w * (jcp.ow - 1) + jcp.kw - jcp.iw - jcp.l_pad; int k_max = jcp.kw - 1 - (jcp.iw - 1 + r_pad) % jcp.stride_w - l_overflow * jcp.stride_w; int res = ki - k_max; while (res < 0) res += jcp.stride_w; return res; } inline int get_iw_end(int ur_w, int ki, int r_overflow) { if (ur_w == jcp.ur_w_tail) { int r_pad = nstl::min(0, jcp.stride_w * (jcp.ow - 1) + jcp.kw - jcp.iw - jcp.l_pad); ur_w += r_pad; } int k_min = (ur_w - 1 + jcp.l_pad) % jcp.stride_w + r_overflow * jcp.stride_w; int res = k_min - ki; while (res < 0) res += jcp.stride_w; return ur_w - res; } }; struct jit_avx512_common_conv_bwd_weights_kernel_f32 : public jit_generator { jit_avx512_common_conv_bwd_weights_kernel_f32(jit_conv_conf_t ajcp) : jcp(ajcp) { generate(); jit_ker = (void (*)(jit_conv_call_s *))getCode(); } static status_t init_conf(jit_conv_conf_t &jcp, const convolution_desc_t &cd, cpu_memory_t::pd_t &src_pd, cpu_memory_t::pd_t &diff_weights_pd, cpu_memory_t::pd_t &diff_bias_pd, cpu_memory_t::pd_t &diff_dst_pd); jit_conv_conf_t jcp; void (*jit_ker)(jit_conv_call_s *); private: using reg64_t = const Xbyak::Reg64; enum {typesize = sizeof(float)}; static const int max_ur_w; reg64_t param = abi_param1; reg64_t reg_input = rax; reg64_t reg_kernel = rdx; reg64_t reg_output = rsi; reg64_t b_ic = abi_not_param1; reg64_t kj = r8; reg64_t reg_kh = r9; reg64_t reg_ur_w_trips = r10; reg64_t reg_oj = r15; reg64_t reg_ih_count = rbx; reg64_t reg_tmp = r14; inline void maybe_zero_kernel(); inline void compute_oh_step_unroll_ow_icblock(int ic_block_step, int max_ur_w); inline void oh_step_comeback_pointers(); inline void compute_oh_step_unroll_ow(int ic_block_step, int max_ur_w); inline void compute_ic_block_step(int ur_w, int pad_l, int pad_r, int ic_block_step, int input_offset, int kernel_offset, int output_offset, bool input_wraparound = false); inline void compute_ic_block_step_fma(int ur_w, int pad_l, int pad_r, int ic_block_step, int input_offset, int kernel_offset, int output_offset, bool input_wraparound); inline void compute_ic_block_step_4fma(int ur_w, int pad_l, int pad_r, int ic_block_step, int input_offset, int kernel_offset, int output_offset, bool input_wraparound); inline void compute_oh_step_common(int ic_block_step, int max_ur_w); inline void compute_oh_step_disp(); inline void compute_oh_loop_common(); inline bool compute_full_spat_loop(); inline bool flat_4ops_compute(); inline void compute_loop(); void generate(); }; } } } #endif
30.697723
80
0.636811
scale-snu
1ba78291d259f1cc831ed6a2cabdb63975f30d21
1,329
cpp
C++
Source/XsollaWebBrowser/Private/XsollaWebBrowserModule.cpp
xsolla/store-ue4-sdk
e25440e9d0b82663929ee7f49807e9b6bb09606b
[ "Apache-2.0" ]
14
2019-08-28T19:49:07.000Z
2021-12-04T14:34:18.000Z
Source/XsollaWebBrowser/Private/XsollaWebBrowserModule.cpp
xsolla/inventory-ue4-sdk
bbe8fbc7384c0c34992145329a4dbd61aa3ae362
[ "Apache-2.0" ]
34
2019-08-17T08:23:18.000Z
2021-12-08T08:25:14.000Z
Source/XsollaWebBrowser/Private/XsollaWebBrowserModule.cpp
xsolla/store-ue4-sdk
e25440e9d0b82663929ee7f49807e9b6bb09606b
[ "Apache-2.0" ]
12
2019-09-25T15:14:58.000Z
2022-03-21T09:27:58.000Z
// Copyright 2021 Xsolla Inc. All Rights Reserved. #include "XsollaWebBrowserModule.h" #include "XsollaWebBrowserAssetManager.h" #include "IWebBrowserSingleton.h" #include "Materials/Material.h" #include "Modules/ModuleManager.h" #include "WebBrowserModule.h" const FName FXsollaWebBrowserModule::ModuleName = "XsollaWebBrowser"; void FXsollaWebBrowserModule::StartupModule() { if (WebBrowserAssetMgr == nullptr) { WebBrowserAssetMgr = NewObject<UXsollaWebBrowserAssetManager>((UObject*)GetTransientPackage(), NAME_None, RF_Transient | RF_Public); WebBrowserAssetMgr->LoadDefaultMaterials(); FWebBrowserInitSettings WebBrowserInitSettings; WebBrowserInitSettings.ProductVersion = TEXT("Mozilla/5.0 (Linux; Android 10; Redmi Note 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"); IWebBrowserModule::Get().CustomInitialize(WebBrowserInitSettings); IWebBrowserSingleton* WebBrowserSingleton = IWebBrowserModule::Get().GetSingleton(); if (WebBrowserSingleton) { WebBrowserSingleton->SetDefaultMaterial(WebBrowserAssetMgr->GetDefaultMaterial()); WebBrowserSingleton->SetDefaultTranslucentMaterial(WebBrowserAssetMgr->GetDefaultTranslucentMaterial()); } } } void FXsollaWebBrowserModule::ShutdownModule() { } IMPLEMENT_MODULE(FXsollaWebBrowserModule, XsollaWebBrowser);
34.076923
169
0.808126
xsolla
1ba82d595eb3f402ab79c250719d172cc84101b0
3,696
cpp
C++
csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/InferenceTestCapi.cpp
wintersteiger/onnxruntime
071a0c2522dd2af2b1936d608ef7182be6cfa883
[ "MIT" ]
2
2019-11-18T14:04:42.000Z
2019-12-04T12:49:01.000Z
csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/InferenceTestCapi.cpp
wintersteiger/onnxruntime
071a0c2522dd2af2b1936d608ef7182be6cfa883
[ "MIT" ]
null
null
null
csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/InferenceTestCapi.cpp
wintersteiger/onnxruntime
071a0c2522dd2af2b1936d608ef7182be6cfa883
[ "MIT" ]
null
null
null
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // #include "CppUnitTest.h" #include <assert.h> #include <onnxruntime_c_api.h> wchar_t* GetWideString(const char* c) { const size_t cSize = strlen(c) + 1; wchar_t* wc = new wchar_t[cSize]; mbstowcs(wc, c, cSize); return wc; } #define ORT_ABORT_ON_ERROR(expr) \ { \ OrtStatus* onnx_status = (expr); \ if (onnx_status != NULL) { \ const char* msg = OrtGetErrorMessage(onnx_status); \ fprintf(stderr, "%s\n", msg); \ OrtReleaseStatus(onnx_status); \ wchar_t* wmsg = GetWideString(msg); \ Assert::Fail(L"Failed on ORT_ABORT_ON_ERROR"); \ free(wmsg); \ } \ } using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace UnitTest1 { TEST_CLASS(UnitTest1) { public: int run_inference(OrtSession* session) { size_t input_height = 224; size_t input_width = 224; float* model_input = (float *) malloc (sizeof (float) * 224 * 224 * 3); size_t model_input_ele_count = 224 * 224 * 3; // initialize to values between 0.0 and 1.0 for (unsigned int i = 0; i < model_input_ele_count; i++) model_input[i] = (float)i / (float)(model_input_ele_count + 1); OrtMemoryInfo* allocator_info; ORT_ABORT_ON_ERROR(OrtCreateCpuAllocatorInfo(OrtArenaAllocator, OrtMemTypeDefault, &allocator_info)); const size_t input_shape[] = { 1, 3, 224, 224 }; const size_t input_shape_len = sizeof(input_shape) / sizeof(input_shape[0]); const size_t model_input_len = model_input_ele_count * sizeof(float); OrtValue* input_tensor = NULL; ORT_ABORT_ON_ERROR(OrtCreateTensorWithDataAsOrtValue(allocator_info, model_input, model_input_len, input_shape, input_shape_len, ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT, &input_tensor)); assert(input_tensor != NULL); assert(OrtIsTensor(input_tensor)); OrtReleaseMemoryInfo(allocator_info); const char* input_names[] = { "data_0" }; const char* output_names[] = { "softmaxout_1" }; OrtValue* output_tensor = NULL; ORT_ABORT_ON_ERROR(OrtRun(session, NULL, input_names, (const OrtValue* const*)&input_tensor, 1, output_names, 1, &output_tensor)); assert(output_tensor != NULL); assert(OrtIsTensor(output_tensor)); OrtReleaseValue(output_tensor); OrtReleaseValue(input_tensor); free(model_input); return 0; } int test() { const wchar_t * model_path = L"squeezenet.onnx"; OrtEnv* env; ORT_ABORT_ON_ERROR(OrtCreateEnv(ORT_LOGGING_LEVEL_WARNING, "test", &env)); OrtSessionOptions* session_option = OrtCreateSessionOptions(); OrtSession* session; OrtSetSessionThreadPoolSize(session_option, 1); ORT_ABORT_ON_ERROR(OrtCreateSession(env, model_path, session_option, &session)); OrtReleaseSessionOptions(session_option); int result = run_inference(session); OrtReleaseSession(session); OrtReleaseEnv(env); } TEST_METHOD(TestMethod1) { int res = test(); Assert::AreEqual(res, 0); } }; }
38.905263
194
0.578193
wintersteiger
1bb0420d83c9a197f73a2c82680ab0a844eeac6c
437
cpp
C++
TRB_BME280.cpp
trombik/TRB_BME280
0b55deb8196aea46801551f97c3f6b9162dfa434
[ "ISC" ]
null
null
null
TRB_BME280.cpp
trombik/TRB_BME280
0b55deb8196aea46801551f97c3f6b9162dfa434
[ "ISC" ]
5
2018-07-14T16:16:25.000Z
2018-07-15T04:56:32.000Z
TRB_BME280.cpp
trombik/TRB_BME280
0b55deb8196aea46801551f97c3f6b9162dfa434
[ "ISC" ]
null
null
null
#if !defined(_TRB_BME280_cpp) #define _TRB_BME280_cpp #if defined(TRB_BME280_I2C_WIRE) #include "TRB_BME280_I2C_Wire.cpp" #elif defined(TRB_BME280_I2C_BRZO) #include "TRB_BME280_I2C_brzo.c" #elif defined(TRB_BME280_I2C_LIB_I2C) #include "TRB_BME280_I2C_LIB_I2C.cpp" #elif defined(TRB_BME280_I2C_TYNYWIREM) #include "TRB_BME280_I2C_TYNYWIREM.cpp" #else #error I2C library is not chosen #endif #include "TRB_BME280_common.c" #endif
19
39
0.819222
trombik
1bb074f0f7d7bfd0afe1681a757ae4faac316760
3,941
cxx
C++
private/windows/opengl/scrsave/common/util.cxx
King0987654/windows2000
01f9c2e62c4289194e33244aade34b7d19e7c9b8
[ "MIT" ]
11
2017-09-02T11:27:08.000Z
2022-01-02T15:25:24.000Z
private/windows/opengl/scrsave/common/util.cxx
King0987654/windows2000
01f9c2e62c4289194e33244aade34b7d19e7c9b8
[ "MIT" ]
null
null
null
private/windows/opengl/scrsave/common/util.cxx
King0987654/windows2000
01f9c2e62c4289194e33244aade34b7d19e7c9b8
[ "MIT" ]
14
2019-01-16T01:01:23.000Z
2022-02-20T15:54:27.000Z
/******************************Module*Header*******************************\ * Module Name: util.cxx * * Misc. utility functions * * Copyright (c) 1996 Microsoft Corporation * \**************************************************************************/ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <windows.h> #include <sys/timeb.h> #include <GL/gl.h> #include <sys/types.h> #include <sys/timeb.h> #include <time.h> #include <math.h> #include "ssintrnl.hxx" #include "util.hxx" /******************************Public*Routine******************************\ * SS_TIME class * \**************************************************************************/ void SS_TIME::Update() { struct _timeb time; _ftime( &time ); seconds = time.time + time.millitm/1000.0; } void SS_TIME::Zero() { seconds = 0.0; } double SS_TIME::Seconds() { return seconds; } SS_TIME SS_TIME::operator+( SS_TIME addTime ) { return( *this += addTime ); } SS_TIME SS_TIME::operator-( SS_TIME subTime ) { return( *this -= subTime ); } SS_TIME SS_TIME::operator+=( SS_TIME addTime ) { seconds += addTime.seconds; return *this; } SS_TIME SS_TIME::operator-=( SS_TIME subTime ) { seconds -= subTime.seconds; return *this; } /******************************Public*Routine******************************\ * SS_TIMER class * \**************************************************************************/ void SS_TIMER::Start() { startTime.Update(); } SS_TIME SS_TIMER::Stop() { elapsed.Update(); return elapsed - startTime; } void SS_TIMER::Reset() { elapsed.Zero(); } SS_TIME SS_TIMER::ElapsedTime() { elapsed.Update(); return elapsed - startTime; } /******************************Public*Routine******************************\ * ss_Rand * * Generates integer random number 0..(max-1) * \**************************************************************************/ int ss_iRand( int max ) { return (int) ( max * ( ((float)rand()) / ((float)(RAND_MAX+1)) ) ); } /******************************Public*Routine******************************\ * ss_Rand2 * * Generates integer random number min..max * \**************************************************************************/ int ss_iRand2( int min, int max ) { if( min == max ) return min; else if( max < min ) { int temp = min; min = max; max = temp; } return min + (int) ( (max-min+1) * ( ((float)rand()) / ((float)(RAND_MAX+1)) ) ); } /******************************Public*Routine******************************\ * ss_fRand * * Generates float random number min...max * \**************************************************************************/ FLOAT ss_fRand( FLOAT min, FLOAT max ) { FLOAT diff; diff = max - min; return min + ( diff * ( ((float)rand()) / ((float)(RAND_MAX)) ) ); } /******************************Public*Routine******************************\ * ss_RandInit * * Initializes the randomizer * \**************************************************************************/ void ss_RandInit( void ) { struct _timeb time; _ftime( &time ); srand( time.millitm ); for( int i = 0; i < 10; i ++ ) rand(); } #if DBG /******************************Public*Routine******************************\ * DbgPrint * * Formatted string output to the debugger. * * History: * 26-Jan-1996 -by- Gilman Wong [gilmanw] * Wrote it. \**************************************************************************/ ULONG DbgPrint(PCH DebugMessage, ...) { va_list ap; char buffer[256]; va_start(ap, DebugMessage); vsprintf(buffer, DebugMessage, ap); OutputDebugStringA(buffer); va_end(ap); return(0); } #endif
19.606965
86
0.415377
King0987654
1bb316e4bfdca896d8d9918defda16f893cd2b55
3,023
cpp
C++
REDSI_1160929_1161573/boost_1_67_0/libs/math/example/policy_eg_4.cpp
Wultyc/ISEP_1718_2A2S_REDSI_TrabalhoGrupo
eb0f7ef64e188fe871f47c2ef9cdef36d8a66bc8
[ "MIT" ]
198
2015-01-13T05:47:18.000Z
2022-03-09T04:46:46.000Z
libs/boost/libs/math/example/policy_eg_4.cpp
flingone/frameworks_base_cmds_remoted
4509d9f0468137ed7fd8d100179160d167e7d943
[ "Apache-2.0" ]
9
2015-01-28T16:33:19.000Z
2020-04-12T23:03:28.000Z
libs/boost/libs/math/example/policy_eg_4.cpp
flingone/frameworks_base_cmds_remoted
4509d9f0468137ed7fd8d100179160d167e7d943
[ "Apache-2.0" ]
139
2015-01-15T20:09:31.000Z
2022-01-31T15:21:16.000Z
// Copyright John Maddock 2007. // Copyright Paul A. Bristow 2010 // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // Note that this file contains quickbook mark-up as well as code // and comments, don't change any of the special comment mark-ups! #include <iostream> using std::cout; using std::endl; #include <cerrno> // for ::errno //[policy_eg_4 /*` Suppose we want `C::foo()` to behave in a C-compatible way and set `::errno` on error rather than throwing any exceptions. We'll begin by including the needed header for our function: */ #include <boost/math/special_functions.hpp> //using boost::math::tgamma; // Not needed because using C::tgamma. /*` Open up the "C" namespace that we'll use for our functions, and define the policy type we want: in this case a C-style one that sets ::errno and returns a standard value, rather than throwing exceptions. Any policies we don't specify here will inherit the defaults. */ namespace C { // To hold our C-style policy. //using namespace boost::math::policies; or explicitly: using boost::math::policies::policy; using boost::math::policies::domain_error; using boost::math::policies::pole_error; using boost::math::policies::overflow_error; using boost::math::policies::evaluation_error; using boost::math::policies::errno_on_error; typedef policy< domain_error<errno_on_error>, pole_error<errno_on_error>, overflow_error<errno_on_error>, evaluation_error<errno_on_error> > c_policy; /*` All we need do now is invoke the BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS macro passing our policy type c_policy as the single argument: */ BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(c_policy) } // close namespace C /*` We now have a set of forwarding functions defined in namespace C that all look something like this: `` template <class RealType> inline typename boost::math::tools::promote_args<RT>::type tgamma(RT z) { return boost::math::tgamma(z, c_policy()); } `` So that when we call `C::tgamma(z)`, we really end up calling `boost::math::tgamma(z, C::c_policy())`: */ int main() { errno = 0; cout << "Result of tgamma(30000) is: " << C::tgamma(30000) << endl; // Note using C::tgamma cout << "errno = " << errno << endl; // errno = 34 cout << "Result of tgamma(-10) is: " << C::tgamma(-10) << endl; cout << "errno = " << errno << endl; // errno = 33, overwriting previous value of 34. } /*` Which outputs: [pre Result of C::tgamma(30000) is: 1.#INF errno = 34 Result of C::tgamma(-10) is: 1.#QNAN errno = 33 ] This mechanism is particularly useful when we want to define a project-wide policy, and don't want to modify the Boost source, or to set project wide build macros (possibly fragile and easy to forget). */ //] //[/policy_eg_4]
27.990741
89
0.683427
Wultyc
1bb70a7e6bccea9f5e2e401a1ecc9c9d92f17777
831
cp
C++
examples/trivial.cp
wxzh/CP
6ae36c7929cecc40a9ae15eed991ea1ddf7e8fe1
[ "BSD-3-Clause" ]
11
2021-07-02T10:58:45.000Z
2022-02-10T02:36:17.000Z
examples/trivial.cp
wxzh/CP
6ae36c7929cecc40a9ae15eed991ea1ddf7e8fe1
[ "BSD-3-Clause" ]
null
null
null
examples/trivial.cp
wxzh/CP
6ae36c7929cecc40a9ae15eed991ea1ddf7e8fe1
[ "BSD-3-Clause" ]
null
null
null
--> "((4 + 3) - 3) = 4" -- Examples in "The Expression Problem, Trivially!" type IEval = {eval : Int}; lit (x : Int) = trait [self : IEval] => { eval = x }; add (e1 : IEval) (e2 : IEval) = trait => { eval = e1.eval + e2.eval }; sub (e1 : IEval) (e2 : IEval) = trait => { eval = e1.eval - e2.eval }; type IPrint = IEval & { print : String }; litP (x : Int) = trait [self : IPrint] inherits lit x => { print = x.toString }; addP (e1 : IPrint) (e2 : IPrint) = trait [self : IPrint] inherits add e1 e2 => { print = "(" ++ e1.print ++ " + " ++ e2.print ++ ")" }; subP (e1 : IPrint) (e2 : IPrint) = trait [self : IPrint] inherits sub e1 e2 => { print = "(" ++ e1.print ++ " - " ++ e2.print ++ ")" }; l1 = new litP 4; l2 = new litP 3; l3 = new addP l1 l2; e = new subP l3 l2; e.print ++ " = " ++ e.eval.toString
20.775
80
0.527076
wxzh
1bb7a55d6313e0c9489914f8a35527f5a8a2c13d
1,126
cpp
C++
Backends/src/frontends/CaptnGeneral_1_0.cpp
sebhoof/gambit_1.5
f9a3f788e3331067c555ae1a030420e903c6fdcd
[ "Unlicense" ]
2
2020-09-08T20:05:27.000Z
2021-04-26T07:57:56.000Z
Backends/src/frontends/CaptnGeneral_1_0.cpp
sebhoof/gambit_1.5
f9a3f788e3331067c555ae1a030420e903c6fdcd
[ "Unlicense" ]
9
2020-10-19T09:56:17.000Z
2021-05-28T06:12:03.000Z
Backends/src/frontends/CaptnGeneral_1_0.cpp
patscott/gambit_1.4
a50537419918089effc207e8b206489a5cfd2258
[ "Unlicense" ]
5
2020-09-08T02:23:34.000Z
2021-03-23T08:48:04.000Z
// GAMBIT: Global and Modular BSM Inference Tool // ********************************************* /// \file /// /// Frontend for Capt'n General 1.0 backend /// /// ********************************************* /// /// Authors (add name and date if you modify): /// /// Aaron Vincent /// 25/09/2017 /// ********************************************* #include "gambit/Backends/frontend_macros.hpp" #include "gambit/Backends/frontends/CaptnGeneral_1_0.hpp" // Capgen Initialisation function (definition) BE_INI_FUNCTION { double rho0 = *Param["rho0"]*(*Dep::RD_fraction); double v0 = *Param["v0"]; double vsun = *Param["vrot"]; double vesc = *Param["vesc"]; const int clen = 300; char solarmodel[clen]; Utils::strcpy2f(solarmodel, clen, runOptions->getValueOrDef<str>(backendDir + "/solarmodels/struct_b16_agss09_nohead.dat", "solarmodel")); // //Capgen checks whether the arrays are already allocated, so it's fine to do this at point-level captn_init(solarmodel[0],rho0,vsun,v0,vesc); } END_BE_INI_FUNCTION
30.432432
128
0.556838
sebhoof
1bb94a4cbd40142becfef75ba634c24b9daa8d6f
11,244
hpp
C++
include/termox/widget/size_policy.hpp
a-n-t-h-o-n-y/MCurses
c9184a0fefbdc4eb9a044f815ee2270e6b8f202c
[ "MIT" ]
284
2017-11-07T10:06:48.000Z
2021-01-12T15:32:51.000Z
include/termox/widget/size_policy.hpp
a-n-t-h-o-n-y/MCurses
c9184a0fefbdc4eb9a044f815ee2270e6b8f202c
[ "MIT" ]
38
2018-01-14T12:34:54.000Z
2020-09-26T15:32:43.000Z
include/termox/widget/size_policy.hpp
a-n-t-h-o-n-y/MCurses
c9184a0fefbdc4eb9a044f815ee2270e6b8f202c
[ "MIT" ]
31
2017-11-30T11:22:21.000Z
2020-11-03T05:27:47.000Z
#ifndef TERMOX_WIDGET_SIZE_POLICY_HPP #define TERMOX_WIDGET_SIZE_POLICY_HPP #include <limits> #include <utility> #include <signals_light/signal.hpp> namespace ox { /// Defines how a Layout should resize a Widget in one length Dimension. class Size_policy { private: struct Data { int hint = 0; int min = 0; int max = maximum_max; double stretch = 1.; bool can_ignore_min = true; } data_; public: /// Emitted on any changes to the Size_policy. sl::Signal<void()> policy_updated; /// Largest possible value for max(). static auto constexpr maximum_max = std::numeric_limits<decltype(data_.max)>::max(); public: explicit Size_policy(int hint = 0, int min = 0, int max = maximum_max, double stretch = 1., bool can_ignore_min = true); /// Does not copy the Signal, so no slots are connected on copy init. Size_policy(Size_policy const& x); /// Does not move the Signal, so no slots are connected on move init. Size_policy(Size_policy&& x); /// Specifically does not copy the Signal, so Widget is still notified. auto operator=(Size_policy const& x) -> Size_policy&; /// Specifically does not copy the Signal, so Widget is still notified. auto operator=(Size_policy&& x) -> Size_policy&; friend auto operator==(Size_policy const& a, Size_policy const& b) -> bool; friend auto operator!=(Size_policy const& a, Size_policy const& b) -> bool; public: /// Set the size hint, used as the initial value in calculations. void hint(int value); /// Return the size hint currently being used. [[nodiscard]] auto hint() const -> int; /// Set the minimum length that the owning Widget should be. void min(int value); /// Return the minimum length currently set. [[nodiscard]] auto min() const -> int; /// Set the maximum length/height that the owning Widget can be. void max(int value); /// Return the maximum length currently set. [[nodiscard]] auto max() const -> int; /// Set the stretch value, used to divide up space between sibling Widgets. /** A ratio of stretch over siblings' stretch sum is used to give space. */ void stretch(double value); /// Return the stretch value currently being used. [[nodiscard]] auto stretch() const -> double; /// Set if min can be ignored for the last displayed widget in a layout. void can_ignore_min(bool enable); /// Return if min can be ignored for the last displayed widget in a layout. [[nodiscard]] auto can_ignore_min() const -> bool; public: /* _Helper Methods_ */ /// Fixed: \p hint is the only acceptable size. [[nodiscard]] static auto fixed(int hint) -> Size_policy; /// Minimum: \p hint is the minimum acceptable size, may be larger. [[nodiscard]] static auto minimum(int hint) -> Size_policy; /// Maximum: \p hint is the maximum acceptable size, may be smaller. [[nodiscard]] static auto maximum(int hint) -> Size_policy; /// Preferred: \p hint is preferred, though it can be any size. [[nodiscard]] static auto preferred(int hint) -> Size_policy; /// Expanding: \p hint is preferred, but it will expand to use extra space. [[nodiscard]] static auto expanding(int hint) -> Size_policy; /// Minimum Expanding: \p hint is minimum, it will expand into unused space. [[nodiscard]] static auto minimum_expanding(int hint) -> Size_policy; /// Ignored: Stretch is the only consideration. [[nodiscard]] static auto ignored() -> Size_policy; }; /// Wrapper type to set the height Size_policy at construction. template <int Hint, typename Widget_t> struct Fixed_height : Widget_t { template <typename... Args> explicit Fixed_height(Args&&... args) : Widget_t{std::forward<Args>(args)...} { this->height_policy = Size_policy::fixed(Hint); } explicit Fixed_height(typename Widget_t::Parameters parameters) : Widget_t{std::move(parameters)} { this->height_policy = Size_policy::fixed(Hint); } }; /// Wrapper type to set the width Size_policy at construction. template <int Hint, typename Widget_t> struct Fixed_width : Widget_t { template <typename... Args> explicit Fixed_width(Args&&... args) : Widget_t{std::forward<Args>(args)...} { this->width_policy = Size_policy::fixed(Hint); } explicit Fixed_width(typename Widget_t::Parameters parameters) : Widget_t{std::move(parameters)} { this->width_policy = Size_policy::fixed(Hint); } }; /// Wrapper type to set the height Size_policy at construction. template <int Hint, typename Widget_t> struct Minimum_height : Widget_t { template <typename... Args> explicit Minimum_height(Args&&... args) : Widget_t{std::forward<Args>(args)...} { this->height_policy = Size_policy::minimum(Hint); } explicit Minimum_height(typename Widget_t::Parameters parameters) : Widget_t{std::move(parameters)} { this->height_policy = Size_policy::minimum(Hint); } }; /// Wrapper type to set the width Size_policy at construction. template <int Hint, typename Widget_t> struct Minimum_width : Widget_t { template <typename... Args> explicit Minimum_width(Args&&... args) : Widget_t{std::forward<Args>(args)...} { this->width_policy = Size_policy::minimum(Hint); } explicit Minimum_width(typename Widget_t::Parameters parameters) : Widget_t{std::move(parameters)} { this->width_policy = Size_policy::minimum(Hint); } }; /// Wrapper type to set the height Size_policy at construction. template <int Hint, typename Widget_t> struct Maximum_height : Widget_t { template <typename... Args> explicit Maximum_height(Args&&... args) : Widget_t{std::forward<Args>(args)...} { this->height_policy = Size_policy::maximum(Hint); } explicit Maximum_height(typename Widget_t::Parameters parameters) : Widget_t{std::move(parameters)} { this->height_policy = Size_policy::maximum(Hint); } }; /// Wrapper type to set the width Size_policy at construction. template <int Hint, typename Widget_t> struct Maximum_width : Widget_t { template <typename... Args> explicit Maximum_width(Args&&... args) : Widget_t{std::forward<Args>(args)...} { this->width_policy = Size_policy::maximum(Hint); } explicit Maximum_width(typename Widget_t::Parameters parameters) : Widget_t{std::move(parameters)} { this->width_policy = Size_policy::maximum(Hint); } }; /// Wrapper type to set the height Size_policy at construction. template <int Hint, typename Widget_t> struct Preferred_height : Widget_t { template <typename... Args> explicit Preferred_height(Args&&... args) : Widget_t{std::forward<Args>(args)...} { this->height_policy = Size_policy::preferred(Hint); } explicit Preferred_height(typename Widget_t::Parameters parameters) : Widget_t{std::move(parameters)} { this->height_policy = Size_policy::preferred(Hint); } }; /// Wrapper type to set the width Size_policy at construction. template <int Hint, typename Widget_t> struct Preferred_width : Widget_t { template <typename... Args> explicit Preferred_width(Args&&... args) : Widget_t{std::forward<Args>(args)...} { this->width_policy = Size_policy::preferred(Hint); } explicit Preferred_width(typename Widget_t::Parameters parameters) : Widget_t{std::move(parameters)} { this->width_policy = Size_policy::preferred(Hint); } }; /// Wrapper type to set the height Size_policy at construction. template <int Hint, typename Widget_t> struct Expanding_height : Widget_t { template <typename... Args> explicit Expanding_height(Args&&... args) : Widget_t{std::forward<Args>(args)...} { this->height_policy = Size_policy::expanding(Hint); } explicit Expanding_height(typename Widget_t::Parameters parameters) : Widget_t{std::move(parameters)} { this->height_policy = Size_policy::expanding(Hint); } }; /// Wrapper type to set the width Size_policy at construction. template <int Hint, typename Widget_t> struct Expanding_width : Widget_t { template <typename... Args> explicit Expanding_width(Args&&... args) : Widget_t{std::forward<Args>(args)...} { this->width_policy = Size_policy::expanding(Hint); } explicit Expanding_width(typename Widget_t::Parameters parameters) : Widget_t{std::move(parameters)} { this->width_policy = Size_policy::expanding(Hint); } }; /// Wrapper type to set the height Size_policy at construction. template <int Hint, typename Widget_t> struct Minimum_expanding_height : Widget_t { template <typename... Args> explicit Minimum_expanding_height(Args&&... args) : Widget_t{std::forward<Args>(args)...} { this->height_policy = Size_policy::minimum_expanding(Hint); } explicit Minimum_expanding_height(typename Widget_t::Parameters parameters) : Widget_t{std::move(parameters)} { this->height_policy = Size_policy::minimum_expanding(Hint); } }; /// Wrapper type to set the width Size_policy at construction. template <int Hint, typename Widget_t> struct Minimum_expanding_width : Widget_t { template <typename... Args> explicit Minimum_expanding_width(Args&&... args) : Widget_t{std::forward<Args>(args)...} { this->width_policy = Size_policy::minimum_expanding(Hint); } explicit Minimum_expanding_width(typename Widget_t::Parameters parameters) : Widget_t{std::move(parameters)} { this->width_policy = Size_policy::minimum_expanding(Hint); } }; /// Wrapper type to set the height Size_policy at construction. template <typename Widget_t> struct Ignored_height : Widget_t { template <typename... Args> explicit Ignored_height(Args&&... args) : Widget_t{std::forward<Args>(args)...} { this->height_policy = Size_policy::ignored(); } explicit Ignored_height(typename Widget_t::Parameters parameters) : Widget_t{std::move(parameters)} { this->height_policy = Size_policy::ignored(); } }; /// Wrapper type to set the width Size_policy at construction. template <typename Widget_t> struct Ignored_width : Widget_t { template <typename... Args> explicit Ignored_width(Args&&... args) : Widget_t{std::forward<Args>(args)...} { this->width_policy = Size_policy::ignored(); } explicit Ignored_width(typename Widget_t::Parameters parameters) : Widget_t{std::move(parameters)} { this->width_policy = Size_policy::ignored(); } }; /// Return true if all members make sense in relation to eachother. [[nodiscard]] auto is_valid(Size_policy const& p) -> bool; } // namespace ox #endif // TERMOX_WIDGET_SIZE_POLICY_HPP
32.217765
80
0.661864
a-n-t-h-o-n-y
1bb99b1e04b0d005b50d84b310cc0de09776e3ba
744
hpp
C++
meta/include/mgs/meta/concepts/semiregular.hpp
theodelrieu/mgs
965a95e3d539447cc482e915f9c44b3439168a4e
[ "BSL-1.0" ]
24
2020-07-01T13:45:50.000Z
2021-11-04T19:54:47.000Z
meta/include/mgs/meta/concepts/semiregular.hpp
theodelrieu/mgs
965a95e3d539447cc482e915f9c44b3439168a4e
[ "BSL-1.0" ]
null
null
null
meta/include/mgs/meta/concepts/semiregular.hpp
theodelrieu/mgs
965a95e3d539447cc482e915f9c44b3439168a4e
[ "BSL-1.0" ]
null
null
null
#pragma once #include <tuple> #include <type_traits> #include <mgs/meta/concepts/copyable.hpp> #include <mgs/meta/concepts/default_constructible.hpp> namespace mgs { namespace meta { template <typename T> struct is_semiregular { using requirements = std::tuple<is_copyable<T>, is_default_constructible<T>>; static constexpr auto const value = is_copyable<T>::value && is_default_constructible<T>::value; static constexpr int trigger_static_asserts() { static_assert(value, "T does not model meta::semiregular"); return 1; } }; template <typename T> constexpr auto is_semiregular_v = is_semiregular<T>::value; template <typename T, typename = std::enable_if_t<is_semiregular<T>::value>> using semiregular = T; } }
21.257143
79
0.744624
theodelrieu
1bba70f94cfbb166a50928784bf4bc3496e367a0
2,333
cpp
C++
Phoenix3D/PX2Core/PX2Timestamp.cpp
PheonixFoundation/Phoenix3D
bfb2e3757bf61ac461aeeda9216bf8c8fdf76d99
[ "BSL-1.0" ]
36
2016-04-24T01:40:38.000Z
2022-01-18T07:32:26.000Z
Phoenix3D/PX2Core/PX2Timestamp.cpp
PheonixFoundation/Phoenix3D
bfb2e3757bf61ac461aeeda9216bf8c8fdf76d99
[ "BSL-1.0" ]
null
null
null
Phoenix3D/PX2Core/PX2Timestamp.cpp
PheonixFoundation/Phoenix3D
bfb2e3757bf61ac461aeeda9216bf8c8fdf76d99
[ "BSL-1.0" ]
16
2016-06-13T08:43:51.000Z
2020-09-15T13:25:58.000Z
// PX2Timestamp.cpp #include "PX2Timestamp.hpp" using namespace PX2; #if defined(_WIN32) || defined(WIN32) #include <Windows.h> #endif #ifdef __APPLE__ #include <sys/time.h> #else #include <sys/timeb.h> #endif //---------------------------------------------------------------------------- Timestamp::Timestamp() : mTimeVal(0) { Update(); } //---------------------------------------------------------------------------- Timestamp::Timestamp(TimeVal tv) { mTimeVal = tv; } //---------------------------------------------------------------------------- Timestamp::Timestamp(const Timestamp& other) { mTimeVal = other.mTimeVal; } //---------------------------------------------------------------------------- Timestamp::~Timestamp() { } //---------------------------------------------------------------------------- Timestamp& Timestamp::operator = (const Timestamp& other) { mTimeVal = other.mTimeVal; return *this; } //---------------------------------------------------------------------------- Timestamp& Timestamp::operator = (TimeVal tv) { mTimeVal = tv; return *this; } //---------------------------------------------------------------------------- void Timestamp::Swap(Timestamp& timestamp) { std::swap(mTimeVal, timestamp.mTimeVal); } //---------------------------------------------------------------------------- Timestamp Timestamp::FromEpochTime(std::time_t t) { return Timestamp(TimeVal(t)*Resolution()); } //---------------------------------------------------------------------------- Timestamp Timestamp::FromUtcTime(UtcTimeVal val) { val -= (TimeDiff(0x01b21dd2) << 32) + 0x13814000; val /= 10; return Timestamp(val); } //---------------------------------------------------------------------------- void Timestamp::Update() { #if defined(_WIN32) || defined(WIN32) FILETIME ft; GetSystemTimeAsFileTime(&ft); ULARGE_INTEGER epoch; // UNIX epoch (1970-01-01 00:00:00) expressed in Windows NT FILETIME epoch.LowPart = 0xD53E8000; epoch.HighPart = 0x019DB1DE; ULARGE_INTEGER ts; ts.LowPart = ft.dwLowDateTime; ts.HighPart = ft.dwHighDateTime; ts.QuadPart -= epoch.QuadPart; mTimeVal = ts.QuadPart/10; #else struct timeval tv; gettimeofday(&tv, 0); mTimeVal = TimeVal(tv.tv_sec)*Resolution() + tv.tv_usec; #endif } //----------------------------------------------------------------------------
26.511364
91
0.453065
PheonixFoundation
1bbd1d5d95c5bbba22e7d93da6ee521f7a4fe11c
27,909
cpp
C++
src/blend2d/opentype/otkern.cpp
JouriM66/blend2d
3f3134c8e3ce78594a9f1c7b3c116cc10f773e4b
[ "Zlib" ]
null
null
null
src/blend2d/opentype/otkern.cpp
JouriM66/blend2d
3f3134c8e3ce78594a9f1c7b3c116cc10f773e4b
[ "Zlib" ]
null
null
null
src/blend2d/opentype/otkern.cpp
JouriM66/blend2d
3f3134c8e3ce78594a9f1c7b3c116cc10f773e4b
[ "Zlib" ]
null
null
null
// This file is part of Blend2D project <https://blend2d.com> // // See blend2d.h or LICENSE.md for license and copyright information // SPDX-License-Identifier: Zlib #include "../api-build_p.h" #include "../font_p.h" #include "../trace_p.h" #include "../opentype/otface_p.h" #include "../opentype/otkern_p.h" #include "../support/algorithm_p.h" #include "../support/memops_p.h" #include "../support/ptrops_p.h" namespace BLOpenType { namespace KernImpl { // OpenType::KernImpl - Tracing // ============================ #if defined(BL_TRACE_OT_ALL) || defined(BL_TRACE_OT_KERN) #define Trace BLDebugTrace #else #define Trace BLDummyTrace #endif // OpenType::KernImpl - Lookup Tables // ================================== static const uint8_t minKernSubTableSize[4] = { uint8_t(sizeof(KernTable::Format0)), uint8_t(sizeof(KernTable::Format1)), uint8_t(sizeof(KernTable::Format2) + 6 + 2), // Includes class table and a single kerning value. uint8_t(sizeof(KernTable::Format3)) }; // OpenType::KernImpl - Match // ========================== struct KernMatch { uint32_t combined; BL_INLINE KernMatch(uint32_t combined) noexcept : combined(combined) {} }; static BL_INLINE bool operator==(const KernTable::Pair& a, const KernMatch& b) noexcept { return a.combined() == b.combined; } static BL_INLINE bool operator<=(const KernTable::Pair& a, const KernMatch& b) noexcept { return a.combined() <= b.combined; } // OpenType::KernImpl - Utilities // ============================== // Used to define a range of unsorted kerning pairs. struct UnsortedRange { BL_INLINE void reset(uint32_t start_, uint32_t end_) noexcept { this->start = start_; this->end = end_; } uint32_t start; uint32_t end; }; // Checks whether the pairs in `pairArray` are sorted and can be b-searched. The last `start` arguments // specifies the start index from which the check should start as this is required by some utilities here. static size_t checkKernPairs(const KernTable::Pair* pairArray, size_t pairCount, size_t start) noexcept { if (start >= pairCount) return pairCount; size_t i; uint32_t prev = pairArray[start].combined(); for (i = start; i < pairCount; i++) { uint32_t pair = pairArray[i].combined(); // We must use `prev > pair`, because some fonts have kerning pairs duplicated for no reason (the same // values repeated). This doesn't violate the binary search requirements so we are okay with it. if (BL_UNLIKELY(prev > pair)) break; prev = pair; } return i; } // Finds ranges of sorted pairs that can be used and creates ranges of unsorted pairs that will be merged into a // single (synthesized) range of pairs. This function is only called if the kerning data in 'kern' is not sorted, // and thus has to be fixed. static BLResult fixUnsortedKernPairs(KernCollection& collection, const KernTable::Format0* fmtData, uint32_t dataOffset, uint32_t pairCount, size_t currentIndex, uint32_t groupFlags, Trace trace) noexcept { typedef KernTable::Pair Pair; enum : uint32_t { kMaxGroups = 8, // Maximum number of sub-ranges of sorted pairs. kMinPairCount = 32 // Minimum number of pairs in a sub-range. }; size_t rangeStart = 0; size_t unsortedStart = 0; size_t threshold = blMax<size_t>((pairCount - rangeStart) / kMaxGroups, kMinPairCount); // Small ranges that are unsorted will be copied into a single one and then sorted. // Number of ranges must be `kMaxGroups + 1` to consider also a last trailing range. UnsortedRange unsortedRanges[kMaxGroups + 1]; size_t unsortedCount = 0; size_t unsortedPairSum = 0; BL_PROPAGATE(collection.groups.reserve(collection.groups.size() + kMaxGroups + 1)); for (;;) { size_t rangeLength = (currentIndex - rangeStart); if (rangeLength >= threshold) { if (rangeStart != unsortedStart) { BL_ASSERT(unsortedCount < BL_ARRAY_SIZE(unsortedRanges)); unsortedRanges[unsortedCount].reset(uint32_t(unsortedStart), uint32_t(rangeStart)); unsortedPairSum += rangeStart - unsortedStart; unsortedCount++; } unsortedStart = currentIndex; uint32_t subOffset = uint32_t(dataOffset + rangeStart * sizeof(Pair)); // Cannot fail as we reserved enough. trace.warn("Adding Sorted Range [%zu:%zu]\n", rangeStart, currentIndex); collection.groups.append(KernGroup::makeReferenced(0, groupFlags, subOffset, uint32_t(rangeLength))); } rangeStart = currentIndex; if (currentIndex == pairCount) break; currentIndex = checkKernPairs(fmtData->pairArray(), pairCount, currentIndex); } // Trailing unsorted range. if (unsortedStart != pairCount) { BL_ASSERT(unsortedCount < BL_ARRAY_SIZE(unsortedRanges)); unsortedRanges[unsortedCount].reset(uint32_t(unsortedStart), uint32_t(rangeStart)); unsortedPairSum += pairCount - unsortedStart; unsortedCount++; } if (unsortedPairSum) { Pair* synthesizedPairs = static_cast<Pair*>(malloc(unsortedPairSum * sizeof(Pair))); if (BL_UNLIKELY(!synthesizedPairs)) return blSetError(BL_ERROR_OUT_OF_MEMORY); size_t synthesizedIndex = 0; for (size_t i = 0; i < unsortedCount; i++) { UnsortedRange& r = unsortedRanges[i]; size_t rangeLength = (r.end - r.start); trace.warn("Adding Synthesized Range [%zu:%zu]\n", size_t(r.start), size_t(r.end)); memcpy(synthesizedPairs + synthesizedIndex, fmtData->pairArray() + r.start, rangeLength * sizeof(Pair)); synthesizedIndex += rangeLength; } BL_ASSERT(synthesizedIndex == unsortedPairSum); BLAlgorithm::quickSort(synthesizedPairs, unsortedPairSum, [](const Pair& a, const Pair& b) noexcept -> int { uint32_t aCombined = a.combined(); uint32_t bCombined = b.combined(); return aCombined < bCombined ? -1 : aCombined > bCombined ? 1 : 0; }); // Cannot fail as we reserved enough. collection.groups.append(KernGroup::makeSynthesized(0, groupFlags, synthesizedPairs, uint32_t(unsortedPairSum))); } return BL_SUCCESS; } static BL_INLINE size_t findKernPair(const KernTable::Pair* pairs, size_t count, uint32_t pair) noexcept { return BLAlgorithm::binarySearch(pairs, count, KernMatch(pair)); } // OpenType::KernImpl - Apply // ========================== static constexpr int32_t kKernMaskOverride = 0x0; static constexpr int32_t kKernMaskMinimum = 0x1; static constexpr int32_t kKernMaskCombine = -1; // Calculates the mask required by `combineKernValue()` from coverage `flags`. static BL_INLINE int32_t maskFromKernGroupFlags(uint32_t flags) noexcept { if (flags & KernGroup::kFlagOverride) return kKernMaskOverride; else if (flags & KernGroup::kFlagMinimum) return kKernMaskMinimum; else return kKernMaskCombine; } // There are several options of combining the kerning value with the previous one. The most common is simply adding // these two together, but there are also minimum and override (aka replace) functions that we handle here. static BL_INLINE int32_t combineKernValue(int32_t origVal, int32_t newVal, int32_t mask) noexcept { if (mask == kKernMaskMinimum) return blMin<int32_t>(origVal, newVal); // Handles 'minimum' function. else return (origVal & mask) + newVal; // Handles both 'add' and 'override' functions. } // Kern SubTable Format 0 - Ordered list of kerning pairs. static BL_INLINE int32_t applyKernFormat0(const OTFaceImpl* faceI, const void* dataPtr, size_t dataSize, uint32_t* glyphData, BLGlyphPlacement* placementData, size_t count, int32_t mask) noexcept { blUnused(faceI); // Format0's `dataPtr` is not a pointer to the start of the table, instead it points to kerning pairs that are // either references to the original font data or synthesized in case that the data was wrong or not sorted. const KernTable::Pair* pairData = static_cast<const KernTable::Pair*>(dataPtr); size_t pairCount = dataSize; int32_t allCombined = 0; uint32_t pair = glyphData[0] << 16; for (size_t i = 1; i < count; i++, pair <<= 16) { pair |= glyphData[i]; size_t index = findKernPair(pairData, pairCount, pair); if (index == SIZE_MAX) continue; int32_t value = pairData[index].value(); int32_t combined = combineKernValue(placementData[i].placement.x, value, mask); placementData[i].placement.x = combined; allCombined |= combined; } return allCombined; } // Kern SubTable Format 2 - Simple NxM array of kerning values. static BL_INLINE int32_t applyKernFormat2(const OTFaceImpl* faceI, const void* dataPtr, size_t dataSize, uint32_t* glyphData, BLGlyphPlacement* placementData, size_t count, int32_t mask) noexcept { typedef KernTable::Format2 Format2; typedef Format2::ClassTable ClassTable; const Format2* subTable = BLPtrOps::offset<const Format2>(dataPtr, faceI->kern.headerSize); uint32_t leftClassTableOffset = subTable->leftClassTable(); uint32_t rightClassTableOffset = subTable->rightClassTable(); if (BL_UNLIKELY(blMax(leftClassTableOffset, rightClassTableOffset) > dataSize - sizeof(ClassTable))) return 0; const ClassTable* leftClassTable = BLPtrOps::offset<const ClassTable>(dataPtr, leftClassTableOffset); const ClassTable* rightClassTable = BLPtrOps::offset<const ClassTable>(dataPtr, rightClassTableOffset); uint32_t leftGlyphCount = leftClassTable->glyphCount(); uint32_t rightGlyphCount = rightClassTable->glyphCount(); uint32_t leftTableEnd = leftClassTableOffset + 4u + leftGlyphCount * 2u; uint32_t rightTableEnd = rightClassTableOffset + 4u + rightGlyphCount * 2u; if (BL_UNLIKELY(blMax(leftTableEnd, rightTableEnd) > dataSize)) return 0; uint32_t leftFirstGlyph = leftClassTable->firstGlyph(); uint32_t rightFirstGlyph = rightClassTable->firstGlyph(); int32_t allCombined = 0; uint32_t leftGlyph = glyphData[0]; uint32_t rightGlyph = 0; for (size_t i = 1; i < count; i++, leftGlyph = rightGlyph) { rightGlyph = glyphData[i]; uint32_t leftIndex = leftGlyph - leftFirstGlyph; uint32_t rightIndex = rightGlyph - rightFirstGlyph; if ((leftIndex >= leftGlyphCount) | (rightIndex >= rightGlyphCount)) continue; uint32_t leftClass = leftClassTable->offsetArray()[leftIndex].value(); uint32_t rightClass = rightClassTable->offsetArray()[rightIndex].value(); // Cannot overflow as both components are unsigned 16-bit integers. uint32_t valueOffset = leftClass + rightClass; if (leftClass * rightClass == 0 || valueOffset > dataSize - 2u) continue; int32_t value = BLPtrOps::offset<const FWord>(dataPtr, valueOffset)->value(); int32_t combined = combineKernValue(placementData[i].placement.x, value, mask); placementData[i].placement.x = combined; allCombined |= combined; } return allCombined; } // Kern SubTable Format 3 - Simple NxM array of kerning indexes. static BL_INLINE int32_t applyKernFormat3(const OTFaceImpl* faceI, const void* dataPtr, size_t dataSize, uint32_t* glyphData, BLGlyphPlacement* placementData, size_t count, int32_t mask) noexcept { typedef KernTable::Format3 Format3; const Format3* subTable = BLPtrOps::offset<const Format3>(dataPtr, faceI->kern.headerSize); uint32_t glyphCount = subTable->glyphCount(); uint32_t kernValueCount = subTable->kernValueCount(); uint32_t leftClassCount = subTable->leftClassCount(); uint32_t rightClassCount = subTable->rightClassCount(); uint32_t requiredSize = faceI->kern.headerSize + uint32_t(sizeof(Format3)) + kernValueCount * 2u + glyphCount * 2u + leftClassCount * rightClassCount; if (BL_UNLIKELY(requiredSize < dataSize)) return 0; const FWord* valueTable = BLPtrOps::offset<const FWord>(subTable, sizeof(Format3)); const UInt8* classTable = BLPtrOps::offset<const UInt8>(valueTable, kernValueCount * 2u); const UInt8* indexTable = classTable + glyphCount * 2u; int32_t allCombined = 0; uint32_t leftGlyph = glyphData[0]; uint32_t rightGlyph = 0; for (size_t i = 1; i < count; i++, leftGlyph = rightGlyph) { rightGlyph = glyphData[i]; if (blMax(leftGlyph, rightGlyph) >= glyphCount) continue; uint32_t leftClass = classTable[leftGlyph].value(); uint32_t rightClass = classTable[glyphCount + rightGlyph].value(); if ((leftClass >= leftClassCount) | (rightClass >= rightClassCount)) continue; uint32_t valueIndex = indexTable[leftClass * rightClassCount + rightClass].value(); if (valueIndex >= kernValueCount) continue; int32_t value = valueTable[valueIndex].value(); int32_t combined = combineKernValue(placementData[i].placement.x, value, mask); placementData[i].placement.x = combined; allCombined |= combined; } return allCombined; } // Applies the data calculated by applyKernFormatN. static BL_INLINE void finishKern(const OTFaceImpl* faceI, uint32_t* glyphData, BLGlyphPlacement* placementData, size_t count) noexcept { blUnused(faceI, glyphData); for (size_t i = 1; i < count; i++) { placementData[i - 1].advance += placementData[i].placement; placementData[i].placement.reset(); } } static BLResult BL_CDECL applyKern(const BLFontFaceImpl* faceI_, uint32_t* glyphData, BLGlyphPlacement* placementData, size_t count) noexcept { const OTFaceImpl* faceI = static_cast<const OTFaceImpl*>(faceI_); if (count < 2) return BL_SUCCESS; const void* basePtr = faceI->kern.table.data; const KernCollection& collection = faceI->kern.collection[0]; const KernGroup* kernGroups = collection.groups.data(); size_t groupCount = collection.groups.size(); int32_t allCombined = 0; for (size_t groupIndex = 0; groupIndex < groupCount; groupIndex++) { const KernGroup& kernGroup = kernGroups[groupIndex]; const void* dataPtr = kernGroup.calcDataPtr(basePtr); size_t dataSize = kernGroup.dataSize; uint32_t format = kernGroup.format; int32_t mask = maskFromKernGroupFlags(kernGroup.flags); switch (format) { case 0: allCombined |= applyKernFormat0(faceI, dataPtr, dataSize, glyphData, placementData, count, mask); break; case 2: allCombined |= applyKernFormat2(faceI, dataPtr, dataSize, glyphData, placementData, count, mask); break; case 3: allCombined |= applyKernFormat3(faceI, dataPtr, dataSize, glyphData, placementData, count, mask); break; } } // Only finish kerning if we actually did something, if no kerning pair was found or all kerning pairs were // zero then there is nothing to do. if (allCombined) finishKern(faceI, glyphData, placementData, count); return BL_SUCCESS; } // OpenType::KernImpl - Init // ========================= BLResult init(OTFaceImpl* faceI, const BLFontData* fontData) noexcept { typedef KernTable::WinGroupHeader WinGroupHeader; typedef KernTable::MacGroupHeader MacGroupHeader; BLFontTableT<KernTable> kern; if (!fontData->queryTable(faceI->faceInfo.faceIndex, &kern, BL_MAKE_TAG('k', 'e', 'r', 'n'))) return BL_SUCCESS; Trace trace; trace.info("BLOpenType::Init 'kern' [Size=%zu]\n", kern.size); trace.indent(); if (BL_UNLIKELY(!blFontTableFitsT<KernTable>(kern))) { trace.warn("Table is too small\n"); faceI->faceInfo.diagFlags |= BL_FONT_FACE_DIAG_WRONG_KERN_DATA; return BL_SUCCESS; } const uint8_t* dataPtr = kern.data; const uint8_t* dataEnd = dataPtr + kern.size; // Kern Header // ----------- // Detect the header format. Windows header uses 16-bit field describing the version of the table and only defines // version 0. Apple uses a different header format which uses a 32-bit version number (`F16x16`). Luckily we can // distinguish between these two easily. uint32_t majorVersion = BLMemOps::readU16uBE(dataPtr); uint32_t headerType = 0xFFu; uint32_t headerSize = 0; uint32_t groupCount = 0; if (majorVersion == 0) { headerType = KernData::kHeaderWindows; headerSize = uint32_t(sizeof(WinGroupHeader)); groupCount = BLMemOps::readU16uBE(dataPtr + 2u); trace.info("Version: 0 (WINDOWS)\n"); trace.info("GroupCount: %u\n", groupCount); // Not forbidden by the spec, just ignore the table if true. if (!groupCount) { trace.warn("No kerning pairs defined\n"); return BL_SUCCESS; } dataPtr += 4; } else if (majorVersion == 1) { uint32_t minorVersion = BLMemOps::readU16uBE(dataPtr + 2u); trace.info("Version: 1 (MAC)\n"); if (minorVersion != 0) { trace.warn("Invalid minor version (%u)\n", minorVersion); faceI->faceInfo.diagFlags |= BL_FONT_FACE_DIAG_WRONG_KERN_DATA; return BL_SUCCESS; } // Minimum mac header is 8 bytes. We have to check this explicitly as the minimum size of "any" header is 4 bytes, // so make sure we won't read beyond. if (kern.size < 8u) { trace.warn("InvalidSize: %zu\n", size_t(kern.size)); faceI->faceInfo.diagFlags |= BL_FONT_FACE_DIAG_WRONG_KERN_DATA; return BL_SUCCESS; } headerType = KernData::kHeaderMac; headerSize = uint32_t(sizeof(MacGroupHeader)); groupCount = BLMemOps::readU32uBE(dataPtr + 4u); trace.info("GroupCount: %u\n", groupCount); // Not forbidden by the spec, just ignore the table if true. if (!groupCount) { trace.warn("No kerning pairs defined\n"); return BL_SUCCESS; } dataPtr += 8; } else { trace.info("Version: %u (UNKNOWN)\n", majorVersion); // No other major version is defined by OpenType. Since KERN table has been superseded by "GPOS" table there will // never be any other version. trace.fail("Invalid version"); faceI->faceInfo.diagFlags |= BL_FONT_FACE_DIAG_WRONG_KERN_DATA; return BL_SUCCESS; } faceI->kern.headerType = uint8_t(headerType); faceI->kern.headerSize = uint8_t(headerSize); // Kern Groups // ----------- uint32_t groupIndex = 0; do { size_t remainingSize = (size_t)(dataEnd - dataPtr); if (BL_UNLIKELY(remainingSize < headerSize)) { trace.warn("No more data for group #%u\n", groupIndex); break; } uint32_t length = 0; uint32_t format = 0; uint32_t coverage = 0; trace.info("Group #%u\n", groupIndex); trace.indent(); if (headerType == KernData::kHeaderWindows) { const WinGroupHeader* group = reinterpret_cast<const WinGroupHeader*>(dataPtr); format = group->format(); length = group->length(); // Some fonts having only one group have an incorrect length set to the same value as the as the whole 'kern' // table. Detect it and fix it. if (length == kern.size && groupCount == 1) { length = uint32_t(remainingSize); trace.warn("Group length is same as the table length, fixed to %u\n", length); } // The last sub-table can have truncated length to 16 bits even when it needs more to represent all kerning // pairs. This is not covered by the specification, but it's a common practice. if (length != remainingSize && groupIndex == groupCount - 1) { trace.warn("Fixing reported length from %u to %zu\n", length, remainingSize); length = uint32_t(remainingSize); } // Not interested in undefined flags. coverage = group->coverage() & ~WinGroupHeader::kCoverageReservedBits; } else { const MacGroupHeader* group = reinterpret_cast<const MacGroupHeader*>(dataPtr); format = group->format(); length = group->length(); // Translate coverate flags from MAC format to Windows format that we prefer. uint32_t macCoverage = group->coverage(); if ((macCoverage & MacGroupHeader::kCoverageVertical ) == 0) coverage |= WinGroupHeader::kCoverageHorizontal; if ((macCoverage & MacGroupHeader::kCoverageCrossStream) != 0) coverage |= WinGroupHeader::kCoverageCrossStream; } if (length < headerSize) { trace.fail("Group length too small [Length=%u RemainingSize=%zu]\n", length, remainingSize); faceI->faceInfo.diagFlags |= BL_FONT_FACE_DIAG_WRONG_KERN_DATA; return BL_SUCCESS; } if (length > remainingSize) { trace.fail("Group length exceeds the remaining space [Length=%u RemainingSize=%zu]\n", length, remainingSize); faceI->faceInfo.diagFlags |= BL_FONT_FACE_DIAG_WRONG_KERN_DATA; return BL_SUCCESS; } // Move to the beginning of the content of the group. dataPtr += headerSize; // It's easier to calculate everything without the header (as its size is variable), so make `length` raw data size // that we will store in KernData. length -= headerSize; remainingSize -= headerSize; // Even on 64-bit machine this cannot overflow as a table length in SFNT header is stored as UInt32. uint32_t offset = (uint32_t)(size_t)(dataPtr - kern.data); uint32_t orientation = (coverage & WinGroupHeader::kCoverageHorizontal) ? BL_ORIENTATION_HORIZONTAL : BL_ORIENTATION_VERTICAL; uint32_t groupFlags = coverage & (KernGroup::kFlagMinimum | KernGroup::kFlagCrossStream | KernGroup::kFlagOverride); trace.info("Format: %u%s\n", format, format > 3 ? " (UNKNOWN)" : ""); trace.info("Coverage: %u\n", coverage); trace.info("Orientation: %s\n", orientation == BL_ORIENTATION_HORIZONTAL ? "Horizontal" : "Vertical"); if (format < BL_ARRAY_SIZE(minKernSubTableSize) && length >= minKernSubTableSize[format]) { KernCollection& collection = faceI->kern.collection[orientation]; switch (format) { // Kern SubTable Format 0 - Ordered list of kerning pairs. case 0: { const KernTable::Format0* fmtData = reinterpret_cast<const KernTable::Format0*>(dataPtr); uint32_t pairCount = fmtData->pairCount(); trace.info("PairCount=%zu\n", pairCount); if (pairCount == 0) break; uint32_t pairDataOffset = offset + 8; uint32_t pairDataSize = pairCount * uint32_t(sizeof(KernTable::Pair)) + uint32_t(sizeof(KernTable::Format0)); if (BL_UNLIKELY(pairDataSize > length)) { uint32_t fixedPairCount = (length - uint32_t(sizeof(KernTable::Format0))) / 6; trace.warn("Fixing the number of pairs from [%u] to [%u] to match the remaining size [%u]\n", pairCount, fixedPairCount, length); faceI->faceInfo.diagFlags |= BL_FONT_FACE_DIAG_FIXED_KERN_DATA; pairCount = fixedPairCount; } // Check whether the pairs are sorted. const KernTable::Pair* pairData = fmtData->pairArray(); size_t unsortedIndex = checkKernPairs(pairData, pairCount, 0); if (unsortedIndex != pairCount) { trace.warn("Pair #%zu violates ordering constraint (kerning pairs are not sorted)\n", unsortedIndex); BLResult result = fixUnsortedKernPairs(collection, fmtData, pairDataOffset, pairCount, unsortedIndex, groupFlags, trace); if (result != BL_SUCCESS) { trace.fail("Cannot allocate data for synthesized kerning pairs\n"); return result; } faceI->faceInfo.diagFlags |= BL_FONT_FACE_DIAG_FIXED_KERN_DATA; break; } else { BLResult result = collection.groups.append(KernGroup::makeReferenced(0, groupFlags, pairDataOffset, uint32_t(pairCount))); if (result != BL_SUCCESS) { trace.fail("Cannot allocate data for referenced kerning pairs\n"); return result; } } break; } // Kern SubTable Format 2 - Simple NxM array of kerning values. case 2: { const void* subTable = static_cast<const uint8_t*>(dataPtr) - headerSize; size_t subTableSize = length + headerSize; const KernTable::Format2* fmtData = reinterpret_cast<const KernTable::Format2*>(dataPtr); uint32_t leftClassTableOffset = fmtData->leftClassTable(); uint32_t rightClassTableOffset = fmtData->rightClassTable(); uint32_t kerningArrayOffset = fmtData->kerningArray(); if (leftClassTableOffset > subTableSize - 6u) { trace.warn("Invalid offset [%u] of left ClassTable\n", unsigned(leftClassTableOffset)); break; } if (rightClassTableOffset > subTableSize - 6u) { trace.warn("Invalid offset [%u] of right ClassTable\n", unsigned(rightClassTableOffset)); break; } if (kerningArrayOffset > subTableSize - 2u) { trace.warn("Invalid offset [%u] of KerningArray\n", unsigned(kerningArrayOffset)); break; } const KernTable::Format2::ClassTable* leftClassTable = BLPtrOps::offset<const KernTable::Format2::ClassTable>(subTable, leftClassTableOffset); const KernTable::Format2::ClassTable* rightClassTable = BLPtrOps::offset<const KernTable::Format2::ClassTable>(subTable, rightClassTableOffset); uint32_t leftGlyphCount = leftClassTable->glyphCount(); uint32_t rightGlyphCount = rightClassTable->glyphCount(); uint32_t leftTableSize = leftClassTableOffset + 4u + leftGlyphCount * 2u; uint32_t rightTableSize = rightClassTableOffset + 4u + rightGlyphCount * 2u; if (leftTableSize > subTableSize) { trace.warn("Left ClassTable's GlyphCount [%u] overflows table size by [%zu] bytes\n", unsigned(leftGlyphCount), size_t(leftTableSize - subTableSize)); break; } if (rightTableSize > subTableSize) { trace.warn("Right ClassTable's GlyphCount [%u] overflows table size by [%zu] bytes\n", unsigned(rightGlyphCount), size_t(rightTableSize - subTableSize)); break; } BLResult result = collection.groups.append(KernGroup::makeReferenced(format, groupFlags, offset - headerSize, uint32_t(subTableSize))); if (result != BL_SUCCESS) { trace.fail("Cannot allocate data for a referenced kerning group of format #%u\n", unsigned(format)); return result; } break; } // Kern SubTable Format 3 - Simple NxM array of kerning indexes. case 3: { size_t subTableSize = length + headerSize; const KernTable::Format3* fmtData = reinterpret_cast<const KernTable::Format3*>(dataPtr); uint32_t glyphCount = fmtData->glyphCount(); uint32_t kernValueCount = fmtData->kernValueCount(); uint32_t leftClassCount = fmtData->leftClassCount(); uint32_t rightClassCount = fmtData->rightClassCount(); uint32_t requiredSize = faceI->kern.headerSize + uint32_t(sizeof(KernTable::Format3)) + kernValueCount * 2u + glyphCount * 2u + leftClassCount * rightClassCount; if (BL_UNLIKELY(requiredSize > subTableSize)) { trace.warn("Kerning table data overflows the table size by [%zu] bytes\n", size_t(requiredSize - subTableSize)); break; } BLResult result = collection.groups.append(KernGroup::makeReferenced(format, groupFlags, offset - headerSize, uint32_t(subTableSize))); if (result != BL_SUCCESS) { trace.fail("Cannot allocate data for a referenced kerning group of format #%u\n", unsigned(format)); return result; } break; } default: faceI->faceInfo.diagFlags |= BL_FONT_FACE_DIAG_WRONG_KERN_DATA; break; } } else { trace.warn("Skipping subtable\n"); } trace.deindent(); dataPtr += length; } while (++groupIndex < groupCount); if (!faceI->kern.collection[BL_ORIENTATION_HORIZONTAL].empty()) { faceI->kern.table = kern; faceI->kern.collection[BL_ORIENTATION_HORIZONTAL].groups.shrink(); faceI->faceInfo.faceFlags |= BL_FONT_FACE_FLAG_HORIZONTAL_KERNING; faceI->featureTags.append(BL_MAKE_TAG('k', 'e', 'r', 'n')); faceI->funcs.applyKern = applyKern; } return BL_SUCCESS; } } // {KernImpl} } // {BLOpenType}
39.143058
206
0.68924
JouriM66
1bbd809ee611e01edbe1295f0f4754ea82585d00
22,392
cpp
C++
util/noise/fast_noise_2.cpp
Gamerfiend/godot_voxel
89762f43764f45d7a1e703ef9e4e750ecc0b0e88
[ "MIT" ]
null
null
null
util/noise/fast_noise_2.cpp
Gamerfiend/godot_voxel
89762f43764f45d7a1e703ef9e4e750ecc0b0e88
[ "MIT" ]
null
null
null
util/noise/fast_noise_2.cpp
Gamerfiend/godot_voxel
89762f43764f45d7a1e703ef9e4e750ecc0b0e88
[ "MIT" ]
1
2021-11-09T14:18:03.000Z
2021-11-09T14:18:03.000Z
#include "fast_noise_2.h" #include "../math/funcs.h" #include <core/io/image.h> using namespace zylann; FastNoise2::FastNoise2() { // Setup default update_generator(); } void FastNoise2::set_encoded_node_tree(String data) { if (data != _last_set_encoded_node_tree) { _last_set_encoded_node_tree = data; emit_changed(); } } bool FastNoise2::is_valid() const { return _generator.get() != nullptr; } String FastNoise2::get_encoded_node_tree() const { // There is no way to get back an encoded node tree from `FastNoise::SmartNode<>` return _last_set_encoded_node_tree; } FastNoise2::SIMDLevel FastNoise2::get_simd_level() const { ERR_FAIL_COND_V(!is_valid(), SIMD_NULL); return SIMDLevel(_generator->GetSIMDLevel()); } String FastNoise2::get_simd_level_name(SIMDLevel level) { switch (level) { case SIMD_NULL: return "Null"; case SIMD_SCALAR: return "Scalar"; case SIMD_SSE: return "SSE"; case SIMD_SSE2: return "SSE2"; case SIMD_SSE3: return "SSE3"; case SIMD_SSE41: return "SSE41"; case SIMD_SSE42: return "SSE42"; case SIMD_AVX: return "AVX"; case SIMD_AVX2: return "AVX2"; case SIMD_AVX512: return "AVX512"; case SIMD_NEON: return "NEON"; default: ERR_PRINT(String("Unknown SIMD level {0}").format(varray(level))); return "Error"; } } void FastNoise2::set_seed(int seed) { if (_seed == seed) { return; } _seed = seed; emit_changed(); } int FastNoise2::get_seed() const { return _seed; } void FastNoise2::set_noise_type(NoiseType type) { if (_noise_type == type) { return; } _noise_type = type; emit_changed(); } FastNoise2::NoiseType FastNoise2::get_noise_type() const { return _noise_type; } void FastNoise2::set_period(float p) { if (p < 0.0001f) { p = 0.0001f; } if (_period == p) { return; } _period = p; emit_changed(); } float FastNoise2::get_period() const { return _period; } void FastNoise2::set_fractal_octaves(int octaves) { ERR_FAIL_COND(octaves <= 0); if (octaves > MAX_OCTAVES) { octaves = MAX_OCTAVES; } if (_fractal_octaves == octaves) { return; } _fractal_octaves = octaves; emit_changed(); } void FastNoise2::set_fractal_type(FractalType type) { if (_fractal_type == type) { return; } _fractal_type = type; emit_changed(); } FastNoise2::FractalType FastNoise2::get_fractal_type() const { return _fractal_type; } int FastNoise2::get_fractal_octaves() const { return _fractal_octaves; } void FastNoise2::set_fractal_lacunarity(float lacunarity) { if (_fractal_lacunarity == lacunarity) { return; } _fractal_lacunarity = lacunarity; emit_changed(); } float FastNoise2::get_fractal_lacunarity() const { return _fractal_lacunarity; } void FastNoise2::set_fractal_gain(float gain) { if (_fractal_gain == gain) { return; } _fractal_gain = gain; emit_changed(); } float FastNoise2::get_fractal_gain() const { return _fractal_gain; } void FastNoise2::set_fractal_ping_pong_strength(float s) { if (_fractal_ping_pong_strength == s) { return; } _fractal_ping_pong_strength = s; emit_changed(); } float FastNoise2::get_fractal_ping_pong_strength() const { return _fractal_ping_pong_strength; } void FastNoise2::set_terrace_enabled(bool enable) { if (enable == _terrace_enabled) { return; } _terrace_enabled = enable; emit_changed(); } bool FastNoise2::is_terrace_enabled() const { return _terrace_enabled; } void FastNoise2::set_terrace_multiplier(float m) { const float clamped_multiplier = math::max(m, 0.f); if (clamped_multiplier == _terrace_multiplier) { return; } _terrace_multiplier = clamped_multiplier; emit_changed(); } float FastNoise2::get_terrace_multiplier() const { return _terrace_multiplier; } void FastNoise2::set_terrace_smoothness(float s) { const float clamped_smoothness = math::max(s, 0.f); if (_terrace_smoothness == clamped_smoothness) { return; } _terrace_smoothness = clamped_smoothness; emit_changed(); } float FastNoise2::get_terrace_smoothness() const { return _terrace_smoothness; } void FastNoise2::set_remap_enabled(bool enabled) { if (enabled != _remap_enabled) { _remap_enabled = enabled; emit_changed(); } } bool FastNoise2::is_remap_enabled() const { return _remap_enabled; } void FastNoise2::set_remap_input_min(float min_value) { if (min_value != _remap_src_min) { _remap_src_min = min_value; emit_changed(); } } float FastNoise2::get_remap_input_min() const { return _remap_src_min; } void FastNoise2::set_remap_input_max(float max_value) { if (max_value != _remap_src_max) { _remap_src_max = max_value; emit_changed(); } } float FastNoise2::get_remap_input_max() const { return _remap_src_max; } void FastNoise2::set_remap_output_min(float min_value) { if (min_value != _remap_dst_min) { _remap_dst_min = min_value; emit_changed(); } } float FastNoise2::get_remap_output_min() const { return _remap_dst_min; } void FastNoise2::set_remap_output_max(float max_value) { if (max_value != _remap_dst_max) { _remap_dst_max = max_value; emit_changed(); } } float FastNoise2::get_remap_output_max() const { return _remap_dst_max; } void FastNoise2::set_cellular_distance_function(CellularDistanceFunction cdf) { if (cdf == _cellular_distance_function) { return; } _cellular_distance_function = cdf; emit_changed(); } FastNoise2::CellularDistanceFunction FastNoise2::get_cellular_distance_function() const { return _cellular_distance_function; } void FastNoise2::set_cellular_return_type(CellularReturnType rt) { if (_cellular_return_type == rt) { return; } _cellular_return_type = rt; emit_changed(); } FastNoise2::CellularReturnType FastNoise2::get_cellular_return_type() const { return _cellular_return_type; } void FastNoise2::set_cellular_jitter(float jitter) { jitter = math::clamp(jitter, 0.f, 1.f); if (_cellular_jitter == jitter) { return; } _cellular_jitter = jitter; emit_changed(); } float FastNoise2::get_cellular_jitter() const { return _cellular_jitter; } float FastNoise2::get_noise_2d_single(Vector2 pos) const { ERR_FAIL_COND_V(!is_valid(), 0.0); return _generator->GenSingle2D(pos.x, pos.y, _seed); } float FastNoise2::get_noise_3d_single(Vector3 pos) const { ERR_FAIL_COND_V(!is_valid(), 0.0); return _generator->GenSingle3D(pos.x, pos.y, pos.z, _seed); } void FastNoise2::get_noise_2d_series(Span<const float> src_x, Span<const float> src_y, Span<float> dst) const { ERR_FAIL_COND(!is_valid()); ERR_FAIL_COND(src_x.size() != src_y.size() || src_x.size() != dst.size()); _generator->GenPositionArray2D(dst.data(), dst.size(), src_x.data(), src_y.data(), 0, 0, _seed); } void FastNoise2::get_noise_3d_series( Span<const float> src_x, Span<const float> src_y, Span<const float> src_z, Span<float> dst) const { ERR_FAIL_COND(!is_valid()); ERR_FAIL_COND(src_x.size() != src_y.size() || src_x.size() != src_z.size() || src_x.size() != dst.size()); _generator->GenPositionArray3D(dst.data(), dst.size(), src_x.data(), src_y.data(), src_z.data(), 0, 0, 0, _seed); } void FastNoise2::get_noise_2d_grid(Vector2 origin, Vector2i size, Span<float> dst) const { ERR_FAIL_COND(!is_valid()); ERR_FAIL_COND(size.x < 0 || size.y < 0); ERR_FAIL_COND(dst.size() != size.x * size.y); _generator->GenUniformGrid2D(dst.data(), origin.x, origin.y, size.x, size.y, 1.f, _seed); } void FastNoise2::get_noise_3d_grid(Vector3 origin, Vector3i size, Span<float> dst) const { ERR_FAIL_COND(!is_valid()); ERR_FAIL_COND(!math::is_valid_size(size)); ERR_FAIL_COND(dst.size() != size.x * size.y * size.z); _generator->GenUniformGrid3D(dst.data(), origin.x, origin.y, origin.z, size.x, size.y, size.z, 1.f, _seed); } void FastNoise2::get_noise_2d_grid_tileable(Vector2i size, Span<float> dst) const { ERR_FAIL_COND(!is_valid()); ERR_FAIL_COND(size.x < 0 || size.y < 0); ERR_FAIL_COND(dst.size() != size.x * size.y); _generator->GenTileable2D(dst.data(), size.x, size.y, 1.f, _seed); } void FastNoise2::generate_image(Ref<Image> image, bool tileable) const { ERR_FAIL_COND(!is_valid()); ERR_FAIL_COND(image.is_null()); std::vector<float> buffer; buffer.resize(image->get_width() * image->get_height()); if (tileable) { get_noise_2d_grid_tileable(Vector2i(image->get_width(), image->get_height()), to_span(buffer)); } else { get_noise_2d_grid(Vector2(), Vector2i(image->get_width(), image->get_height()), to_span(buffer)); } unsigned int i = 0; for (int y = 0; y < image->get_height(); ++y) { for (int x = 0; x < image->get_width(); ++x) { #ifdef DEBUG_ENABLED CRASH_COND(i >= buffer.size()); #endif // Assuming -1..1 output. Some noise types can have different range though. const float n = buffer[i] * 0.5f + 0.5f; ++i; image->set_pixel(x, y, Color(n, n, n)); } } } void FastNoise2::update_generator() { if (_noise_type == TYPE_ENCODED_NODE_TREE) { CharString cs = _last_set_encoded_node_tree.utf8(); _generator = FastNoise::NewFromEncodedNodeTree(cs.get_data()); ERR_FAIL_COND(!is_valid()); // TODO Maybe apply period modifier here? // NoiseTool assumes we scale input coordinates so typical noise made in there has period 1... return; } FastNoise::SmartNode<FastNoise::Generator> noise_node; switch (_noise_type) { case TYPE_OPEN_SIMPLEX_2: noise_node = FastNoise::New<FastNoise::OpenSimplex2>(); break; case TYPE_SIMPLEX: noise_node = FastNoise::New<FastNoise::Simplex>(); break; case TYPE_PERLIN: noise_node = FastNoise::New<FastNoise::Perlin>(); break; case TYPE_VALUE: noise_node = FastNoise::New<FastNoise::Value>(); break; case TYPE_CELLULAR: { FastNoise::SmartNode<FastNoise::CellularDistance> cd = FastNoise::New<FastNoise::CellularDistance>(); cd->SetDistanceFunction(FastNoise::DistanceFunction(_cellular_distance_function)); cd->SetReturnType(FastNoise::CellularDistance::ReturnType(_cellular_return_type)); cd->SetJitterModifier(_cellular_jitter); noise_node = cd; } break; default: ERR_PRINT(String("Unknown noise type {0}").format(varray(_noise_type))); return; } ERR_FAIL_COND(noise_node.get() == nullptr); FastNoise::SmartNode<> generator_node = noise_node; if (_period != 1.f) { FastNoise::SmartNode<FastNoise::DomainScale> scale_node = FastNoise::New<FastNoise::DomainScale>(); scale_node->SetScale(1.f / _period); scale_node->SetSource(generator_node); generator_node = scale_node; } FastNoise::SmartNode<FastNoise::Fractal<>> fractal_node; switch (_fractal_type) { case FRACTAL_NONE: break; case FRACTAL_FBM: fractal_node = FastNoise::New<FastNoise::FractalFBm>(); break; case FRACTAL_PING_PONG: { FastNoise::SmartNode<FastNoise::FractalPingPong> pp_node = FastNoise::New<FastNoise::FractalPingPong>(); pp_node->SetPingPongStrength(_fractal_ping_pong_strength); fractal_node = pp_node; } break; case FRACTAL_RIDGED: fractal_node = FastNoise::New<FastNoise::FractalRidged>(); break; default: ERR_PRINT(String("Unknown fractal type {0}").format(varray(_fractal_type))); return; } if (fractal_node) { fractal_node->SetGain(_fractal_gain); fractal_node->SetLacunarity(_fractal_lacunarity); fractal_node->SetOctaveCount(_fractal_octaves); //fractal_node->SetWeightedStrength(_fractal_weighted_strength); fractal_node->SetSource(generator_node); generator_node = fractal_node; } if (_terrace_enabled) { FastNoise::SmartNode<FastNoise::Terrace> terrace_node = FastNoise::New<FastNoise::Terrace>(); terrace_node->SetMultiplier(_terrace_multiplier); terrace_node->SetSmoothness(_terrace_smoothness); terrace_node->SetSource(generator_node); generator_node = terrace_node; } if (_remap_enabled) { FastNoise::SmartNode<FastNoise::Remap> remap_node = FastNoise::New<FastNoise::Remap>(); remap_node->SetRemap(_remap_src_min, _remap_src_max, _remap_dst_min, _remap_dst_max); remap_node->SetSource(generator_node); generator_node = remap_node; } ERR_FAIL_COND(generator_node.get() == nullptr); _generator = generator_node; } zylann::math::Interval FastNoise2::get_estimated_output_range() const { // TODO Optimize: better range analysis on FastNoise2 // Most noises should have known bounds like FastNoiseLite, but the node-graph nature of this library // can make it difficult to calculate. Would be nice if the library could provide that out of the box. if (is_remap_enabled()) { return zylann::math::Interval(get_remap_output_min(), get_remap_output_max()); } else { return zylann::math::Interval(-1.f, 1.f); } } String FastNoise2::_b_get_simd_level_name(SIMDLevel level) { return get_simd_level_name(level); } void FastNoise2::_bind_methods() { ClassDB::bind_method(D_METHOD("set_noise_type", "type"), &FastNoise2::set_noise_type); ClassDB::bind_method(D_METHOD("get_noise_type"), &FastNoise2::get_noise_type); ClassDB::bind_method(D_METHOD("set_seed", "seed"), &FastNoise2::set_seed); ClassDB::bind_method(D_METHOD("get_seed"), &FastNoise2::get_seed); ClassDB::bind_method(D_METHOD("set_period", "period"), &FastNoise2::set_period); ClassDB::bind_method(D_METHOD("get_period"), &FastNoise2::get_period); // ClassDB::bind_method(D_METHOD("set_warp_noise", "gradient_noise"), &FastNoise2::set_warp_noise); // ClassDB::bind_method(D_METHOD("get_warp_noise"), &FastNoise2::get_warp_noise); ClassDB::bind_method(D_METHOD("set_fractal_type", "type"), &FastNoise2::set_fractal_type); ClassDB::bind_method(D_METHOD("get_fractal_type"), &FastNoise2::get_fractal_type); ClassDB::bind_method(D_METHOD("set_fractal_octaves", "octaves"), &FastNoise2::set_fractal_octaves); ClassDB::bind_method(D_METHOD("get_fractal_octaves"), &FastNoise2::get_fractal_octaves); ClassDB::bind_method(D_METHOD("set_fractal_lacunarity", "lacunarity"), &FastNoise2::set_fractal_lacunarity); ClassDB::bind_method(D_METHOD("get_fractal_lacunarity"), &FastNoise2::get_fractal_lacunarity); ClassDB::bind_method(D_METHOD("set_fractal_gain", "gain"), &FastNoise2::set_fractal_gain); ClassDB::bind_method(D_METHOD("get_fractal_gain"), &FastNoise2::get_fractal_gain); ClassDB::bind_method( D_METHOD("set_fractal_ping_pong_strength", "strength"), &FastNoise2::set_fractal_ping_pong_strength); ClassDB::bind_method(D_METHOD("get_fractal_ping_pong_strength"), &FastNoise2::get_fractal_ping_pong_strength); // ClassDB::bind_method( // D_METHOD("set_fractal_weighted_strength", "strength"), &FastNoise2::set_fractal_weighted_strength); // ClassDB::bind_method(D_METHOD("get_fractal_weighted_strength"), &FastNoise2::get_fractal_weighted_strength); ClassDB::bind_method(D_METHOD("set_cellular_distance_function", "cell_distance_func"), &FastNoise2::set_cellular_distance_function); ClassDB::bind_method(D_METHOD("get_cellular_distance_function"), &FastNoise2::get_cellular_distance_function); ClassDB::bind_method(D_METHOD("set_cellular_return_type", "return_type"), &FastNoise2::set_cellular_return_type); ClassDB::bind_method(D_METHOD("get_cellular_return_type"), &FastNoise2::get_cellular_return_type); ClassDB::bind_method(D_METHOD("set_cellular_jitter", "return_type"), &FastNoise2::set_cellular_jitter); ClassDB::bind_method(D_METHOD("get_cellular_jitter"), &FastNoise2::get_cellular_jitter); // ClassDB::bind_method(D_METHOD("set_rotation_type_3d", "type"), &FastNoiseLite::set_rotation_type_3d); // ClassDB::bind_method(D_METHOD("get_rotation_type_3d"), &FastNoiseLite::get_rotation_type_3d); ClassDB::bind_method(D_METHOD("set_terrace_enabled", "enabled"), &FastNoise2::set_terrace_enabled); ClassDB::bind_method(D_METHOD("is_terrace_enabled"), &FastNoise2::is_terrace_enabled); ClassDB::bind_method(D_METHOD("set_terrace_multiplier", "multiplier"), &FastNoise2::set_terrace_multiplier); ClassDB::bind_method(D_METHOD("get_terrace_multiplier"), &FastNoise2::get_terrace_multiplier); ClassDB::bind_method(D_METHOD("set_terrace_smoothness", "smoothness"), &FastNoise2::set_terrace_smoothness); ClassDB::bind_method(D_METHOD("get_terrace_smoothness"), &FastNoise2::get_terrace_smoothness); ClassDB::bind_method(D_METHOD("set_remap_enabled", "enabled"), &FastNoise2::set_remap_enabled); ClassDB::bind_method(D_METHOD("is_remap_enabled"), &FastNoise2::is_remap_enabled); ClassDB::bind_method(D_METHOD("set_remap_input_min", "min_value"), &FastNoise2::set_remap_input_min); ClassDB::bind_method(D_METHOD("get_remap_input_min"), &FastNoise2::get_remap_input_min); ClassDB::bind_method(D_METHOD("set_remap_input_max", "max_value"), &FastNoise2::set_remap_input_max); ClassDB::bind_method(D_METHOD("get_remap_input_max"), &FastNoise2::get_remap_input_max); ClassDB::bind_method(D_METHOD("set_remap_output_min", "min_value"), &FastNoise2::set_remap_output_min); ClassDB::bind_method(D_METHOD("get_remap_output_min"), &FastNoise2::get_remap_output_min); ClassDB::bind_method(D_METHOD("set_remap_output_max", "max_value"), &FastNoise2::set_remap_output_max); ClassDB::bind_method(D_METHOD("get_remap_output_max"), &FastNoise2::get_remap_output_max); ClassDB::bind_method(D_METHOD("set_encoded_node_tree", "code"), &FastNoise2::set_encoded_node_tree); ClassDB::bind_method(D_METHOD("get_encoded_node_tree"), &FastNoise2::get_encoded_node_tree); ClassDB::bind_method(D_METHOD("get_noise_2d_single", "pos"), &FastNoise2::get_noise_2d_single); ClassDB::bind_method(D_METHOD("get_noise_3d_single", "pos"), &FastNoise2::get_noise_3d_single); ClassDB::bind_method(D_METHOD("generate_image", "image", "tileable"), &FastNoise2::generate_image); ClassDB::bind_method(D_METHOD("get_simd_level_name", "level"), &FastNoise2::_b_get_simd_level_name); // ClassDB::bind_method(D_METHOD("_on_warp_noise_changed"), &FastNoiseLite::_on_warp_noise_changed); ADD_PROPERTY(PropertyInfo(Variant::INT, "noise_type", PROPERTY_HINT_ENUM, NOISE_TYPE_HINT_STRING), "set_noise_type", "get_noise_type"); ADD_PROPERTY(PropertyInfo(Variant::INT, "seed"), "set_seed", "get_seed"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "period", PROPERTY_HINT_RANGE, "0.0001,10000.0,0.1,exp"), "set_period", "get_period"); // ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "warp_noise", PROPERTY_HINT_RESOURCE_TYPE, "FastNoiseLiteGradient"), // "set_warp_noise", "get_warp_noise"); ADD_GROUP("Fractal", ""); ADD_PROPERTY(PropertyInfo(Variant::INT, "fractal_type", PROPERTY_HINT_ENUM, FRACTAL_TYPE_HINT_STRING), "set_fractal_type", "get_fractal_type"); ADD_PROPERTY(PropertyInfo(Variant::INT, "fractal_octaves", PROPERTY_HINT_RANGE, vformat("1,%d,1", MAX_OCTAVES)), "set_fractal_octaves", "get_fractal_octaves"); ADD_PROPERTY( PropertyInfo(Variant::FLOAT, "fractal_lacunarity"), "set_fractal_lacunarity", "get_fractal_lacunarity"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fractal_gain"), "set_fractal_gain", "get_fractal_gain"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fractal_ping_pong_strength"), "set_fractal_ping_pong_strength", "get_fractal_ping_pong_strength"); // ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "fractal_weighted_strength"), "set_fractal_weighted_strength", // "get_fractal_weighted_strength"); ADD_GROUP("Cellular", ""); ADD_PROPERTY(PropertyInfo(Variant::INT, "cellular_distance_function", PROPERTY_HINT_ENUM, CELLULAR_DISTANCE_FUNCTION_HINT_STRING), "set_cellular_distance_function", "get_cellular_distance_function"); ADD_PROPERTY( PropertyInfo(Variant::INT, "cellular_return_type", PROPERTY_HINT_ENUM, CELLULAR_RETURN_TYPE_HINT_STRING), "set_cellular_return_type", "get_cellular_return_type"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "cellular_jitter", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_cellular_jitter", "get_cellular_jitter"); ADD_GROUP("Terrace", ""); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "terrace_enabled"), "set_terrace_enabled", "is_terrace_enabled"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "terrace_multiplier", PROPERTY_HINT_RANGE, "0.0,100.0,0.1"), "set_terrace_multiplier", "get_terrace_multiplier"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "terrace_smoothness", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_terrace_smoothness", "get_terrace_smoothness"); ADD_GROUP("Remap", ""); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "remap_enabled"), "set_remap_enabled", "is_remap_enabled"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "remap_input_min"), "set_remap_input_min", "get_remap_input_min"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "remap_input_max"), "set_remap_input_max", "get_remap_input_max"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "remap_output_min"), "set_remap_output_min", "get_remap_output_min"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "remap_output_max"), "set_remap_output_max", "get_remap_output_max"); ADD_GROUP("Advanced", ""); ADD_PROPERTY(PropertyInfo(Variant::STRING, "encoded_node_tree"), "set_encoded_node_tree", "get_encoded_node_tree"); // ADD_PROPERTY( // PropertyInfo(Variant::INT, "rotation_type_3d", PROPERTY_HINT_ENUM, "None,ImproveXYPlanes,ImproveXZPlanes"), // "set_rotation_type_3d", "get_rotation_type_3d"); BIND_ENUM_CONSTANT(TYPE_OPEN_SIMPLEX_2); BIND_ENUM_CONSTANT(TYPE_SIMPLEX); BIND_ENUM_CONSTANT(TYPE_PERLIN); BIND_ENUM_CONSTANT(TYPE_VALUE); BIND_ENUM_CONSTANT(TYPE_CELLULAR); BIND_ENUM_CONSTANT(TYPE_ENCODED_NODE_TREE); BIND_ENUM_CONSTANT(FRACTAL_NONE); BIND_ENUM_CONSTANT(FRACTAL_FBM); BIND_ENUM_CONSTANT(FRACTAL_RIDGED); BIND_ENUM_CONSTANT(FRACTAL_PING_PONG); // BIND_ENUM_CONSTANT(ROTATION_3D_NONE); // BIND_ENUM_CONSTANT(ROTATION_3D_IMPROVE_XY_PLANES); // BIND_ENUM_CONSTANT(ROTATION_3D_IMPROVE_XZ_PLANES); BIND_ENUM_CONSTANT(CELLULAR_DISTANCE_EUCLIDEAN); BIND_ENUM_CONSTANT(CELLULAR_DISTANCE_EUCLIDEAN_SQ); BIND_ENUM_CONSTANT(CELLULAR_DISTANCE_MANHATTAN); BIND_ENUM_CONSTANT(CELLULAR_DISTANCE_HYBRID); BIND_ENUM_CONSTANT(CELLULAR_DISTANCE_MAX_AXIS); BIND_ENUM_CONSTANT(CELLULAR_RETURN_INDEX_0); BIND_ENUM_CONSTANT(CELLULAR_RETURN_INDEX_0_ADD_1); BIND_ENUM_CONSTANT(CELLULAR_RETURN_INDEX_0_SUB_1); BIND_ENUM_CONSTANT(CELLULAR_RETURN_INDEX_0_MUL_1); BIND_ENUM_CONSTANT(CELLULAR_RETURN_INDEX_0_DIV_1); BIND_ENUM_CONSTANT(SIMD_NULL); BIND_ENUM_CONSTANT(SIMD_SCALAR); BIND_ENUM_CONSTANT(SIMD_SSE); BIND_ENUM_CONSTANT(SIMD_SSE2); BIND_ENUM_CONSTANT(SIMD_SSE3); BIND_ENUM_CONSTANT(SIMD_SSSE3); BIND_ENUM_CONSTANT(SIMD_SSE41); BIND_ENUM_CONSTANT(SIMD_SSE42); BIND_ENUM_CONSTANT(SIMD_AVX); BIND_ENUM_CONSTANT(SIMD_AVX2); BIND_ENUM_CONSTANT(SIMD_AVX512); BIND_ENUM_CONSTANT(SIMD_NEON); }
33.222552
117
0.764871
Gamerfiend
1bbf8a4e3ddc740e942e10a781dd5e6371a7330e
2,276
cc
C++
cc/quads/io_surface_draw_quad.cc
pozdnyakov/chromium-crosswalk
0fb25c7278bf1d93e53a3b0bcb75aa8b99d4b26e
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
9
2018-09-21T05:36:12.000Z
2021-11-15T15:14:36.000Z
cc/quads/io_surface_draw_quad.cc
pozdnyakov/chromium-crosswalk
0fb25c7278bf1d93e53a3b0bcb75aa8b99d4b26e
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
cc/quads/io_surface_draw_quad.cc
pozdnyakov/chromium-crosswalk
0fb25c7278bf1d93e53a3b0bcb75aa8b99d4b26e
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
3
2018-11-28T14:54:13.000Z
2020-07-02T07:36:07.000Z
// Copyright 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "cc/quads/io_surface_draw_quad.h" #include "base/logging.h" namespace cc { IOSurfaceDrawQuad::IOSurfaceDrawQuad() : io_surface_resource_id(0), orientation(FLIPPED) { } scoped_ptr<IOSurfaceDrawQuad> IOSurfaceDrawQuad::Create() { return make_scoped_ptr(new IOSurfaceDrawQuad); } void IOSurfaceDrawQuad::SetNew(const SharedQuadState* shared_quad_state, gfx::Rect rect, gfx::Rect opaque_rect, gfx::Size io_surface_size, unsigned io_surface_resource_id, Orientation orientation) { gfx::Rect visible_rect = rect; bool needs_blending = false; DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect, opaque_rect, visible_rect, needs_blending); this->io_surface_size = io_surface_size; this->io_surface_resource_id = io_surface_resource_id; this->orientation = orientation; } void IOSurfaceDrawQuad::SetAll(const SharedQuadState* shared_quad_state, gfx::Rect rect, gfx::Rect opaque_rect, gfx::Rect visible_rect, bool needs_blending, gfx::Size io_surface_size, unsigned io_surface_resource_id, Orientation orientation) { DrawQuad::SetAll(shared_quad_state, DrawQuad::IO_SURFACE_CONTENT, rect, opaque_rect, visible_rect, needs_blending); this->io_surface_size = io_surface_size; this->io_surface_resource_id = io_surface_resource_id; this->orientation = orientation; } void IOSurfaceDrawQuad::IterateResources( const ResourceIteratorCallback& callback) { io_surface_resource_id = callback.Run(io_surface_resource_id); } const IOSurfaceDrawQuad* IOSurfaceDrawQuad::MaterialCast( const DrawQuad* quad) { DCHECK(quad->material == DrawQuad::IO_SURFACE_CONTENT); return static_cast<const IOSurfaceDrawQuad*>(quad); } } // namespace cc
36.709677
73
0.650264
pozdnyakov
1bc097ef83d76d4b76626737468d423ebd91873d
4,823
cpp
C++
modules/tachyon/TachyonRenderer.cpp
mathstuf/ospray
5c34884317b5bb84346e4e1e2e2bf8c7f50d307c
[ "Apache-2.0" ]
1
2016-05-24T19:27:01.000Z
2016-05-24T19:27:01.000Z
modules/tachyon/TachyonRenderer.cpp
mathstuf/ospray
5c34884317b5bb84346e4e1e2e2bf8c7f50d307c
[ "Apache-2.0" ]
null
null
null
modules/tachyon/TachyonRenderer.cpp
mathstuf/ospray
5c34884317b5bb84346e4e1e2e2bf8c7f50d307c
[ "Apache-2.0" ]
null
null
null
// ======================================================================== // // Copyright 2009-2016 Intel Corporation // // // // Licensed under the Apache License, Version 2.0 (the "License"); // // you may not use this file except in compliance with the License. // // You may obtain a copy of the License at // // // // http://www.apache.org/licenses/LICENSE-2.0 // // // // Unless required by applicable law or agreed to in writing, software // // distributed under the License is distributed on an "AS IS" BASIS, // // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // // See the License for the specific language governing permissions and // // limitations under the License. // // ======================================================================== // #undef NDEBUG // ospray #include "TachyonRenderer.h" #include "ospray/camera/PerspectiveCamera.h" #include "common/Data.h" // tachyon #include "Model.h" // ispc imports #include "TachyonRenderer_ispc.h" namespace ospray { TachyonRenderer::TachyonRenderer() { this->ispcEquivalent = ispc::TachyonRenderer_create(this); } void TachyonRenderer::commit() { Renderer::commit(); model = (Model *)getParamObject("world",NULL); model = (Model *)getParamObject("model",model); doShadows = getParam1i("do_shadows",0); float lightScale = getParam1f("lightScale",1.f); textureData = (Data*)(model ? model->getParamObject("textureArray",NULL) : NULL); if (!textureData) throw std::runtime_error("#osp:tachyon::renderer: no texture data specified"); pointLightData = (Data*)(model ? model->getParamObject("pointLights",NULL) : NULL); pointLightArray = pointLightData ? pointLightData->data : NULL; numPointLights = pointLightData ? pointLightData->size()/sizeof(ospray::tachyon::PointLight) : 0; dirLightData = (Data*)(model ? model->getParamObject("dirLights",NULL) : NULL); dirLightArray = dirLightData ? dirLightData->data : NULL; numDirLights = dirLightData ? dirLightData->size()/sizeof(ospray::tachyon::DirLight) : 0; bool doShadows = getParam1i("do_shadows",0); camera = (Camera *)getParamObject("camera",NULL); ispc::TachyonRenderer_set(getIE(), model?model->getIE():NULL, camera?camera->getIE():NULL, textureData?textureData->data:NULL, pointLightArray,numPointLights, dirLightArray,numDirLights, doShadows, lightScale); } // TileRenderer::RenderJob *TachyonRenderer::createRenderJob(FrameBuffer *fb) // { // /*! iw - actually, shoudl do all this parsing in 'commit', not in createrenderjob */ // RenderTask *frame = new RenderTask; // // should actually do that in 'commit', not ever frame ... // Model *model = (Model *)getParamObject("world",NULL); // model = (Model *)getParamObject("model",model); // if (!model) // throw std::runtime_error("#osp:tachyon::renderer: no model specified"); // frame->world = model; // frame->doShadows = getParam1i("do_shadows",0); // frame->textureData = (Data*)model->getParamObject("textureArray",NULL); // if (!frame->textureData) // throw std::runtime_error("#osp:tachyon::renderer: no texture data specified"); // frame->pointLightData = (Data*)model->getParamObject("pointLights",NULL); // frame->pointLightArray // = frame->pointLightData // ? frame->pointLightData->data // : NULL; // frame->numPointLights // = frame->pointLightData // ? frame->pointLightData->size()/sizeof(ospray::tachyon::PointLight) // : 0; // frame->dirLightData = (Data*)model->getParamObject("dirLights",NULL); // frame->dirLightArray // = frame->dirLightData // ? frame->dirLightData->data // : NULL; // frame->numDirLights // = frame->dirLightData // ? frame->dirLightData->size()/sizeof(ospray::tachyon::DirLight) // : 0; // frame->camera = (Camera *)getParamObject("camera",NULL); // return frame; // } OSP_REGISTER_RENDERER(TachyonRenderer,tachyon); extern "C" void ospray_init_module_tachyon() { printf("Loaded plugin 'pathtracer' ...\n"); } };
35.725926
91
0.556085
mathstuf
1bc10caf75014212e9aad3c5f8126174a952eda0
11,365
cpp
C++
CppProject5_3D/CppProject5/src/input/InputController.cpp
Damoy/Tower3D
a6f1ec9fd5e7c26ade5528828cc576f5ed45394a
[ "MIT" ]
1
2019-08-25T03:04:35.000Z
2019-08-25T03:04:35.000Z
CppProject5_3D/CppProject5/src/input/InputController.cpp
Damoy/Tower3D
a6f1ec9fd5e7c26ade5528828cc576f5ed45394a
[ "MIT" ]
null
null
null
CppProject5_3D/CppProject5/src/input/InputController.cpp
Damoy/Tower3D
a6f1ec9fd5e7c26ade5528828cc576f5ed45394a
[ "MIT" ]
null
null
null
#include <iostream> #include "InputController.h" #include "renderEngine\WindowManager.h" #include "utils\checkers\Checker.h" #include "models\ModelBank.h" #include "input\MouseTransformer.h" #include "entities\towers\SampleTower.h" #include "entities\towers\IntelligentTower.h" #include "GLM\gtc\matrix_transform.hpp" // Static attributes initialisation GLFWwindow* InputController::window = nullptr; Player* InputController::mainPlayer = nullptr; Camera* InputController::playerCamera = nullptr; World* InputController::world = nullptr; Shop* InputController::shop = nullptr; glm::mat4 InputController::projectionMatrix = glm::mat4(); float InputController::mouseX = Configs::WIDTH / 2.0f; float InputController::mouseY = Configs::HEIGHT / 2.0f; float InputController::mouseDX = 0.0f; float InputController::mouseDY = 0.0f; float InputController::rotX = 0.0f; float InputController::rotY = 0.0f; bool InputController::mouseEntered = true; bool InputController::firstMouseHandling = true; unsigned short InputController::towerSelected = 0; void InputController::init(GLFWwindow* win, Player* player, World* wow, glm::mat4 proj) { Checker::assertNotNull(win, "Window unknown !"); Checker::assertNotNull(player, "Player unknown !"); Checker::assertNotNull(wow, "World unknown !"); Checker::assertNotNull(player->getCamera(), "Player camera unknown !"); window = win; mainPlayer = player; playerCamera = mainPlayer->getCamera(); world = wow; projectionMatrix = proj; shop = Shop::getInstance(); // Set the functions glfw will call glfwSetMouseButtonCallback(window, mouse_button_callback); glfwSetCursorPosCallback(window, mouse_position_callback); glfwSetCursorEnterCallback(window, mouse_entered_callback); } void InputController::checkInput(float dTime) { handleCameraMovement(dTime); handleCameraRotation(dTime); handlePlayerSelection(); handleClosingWindow(); } void InputController::checkEvents() { glfwPollEvents(); } void InputController::handleClosingWindow() { if (isPressed(GLFW_KEY_ESCAPE)) { WindowManager::closeWindow(); } } void InputController::mouse_button_callback(GLFWwindow* window, int button, int action, int mods) { // Left click try to create a tower if (isLeftMouseButtonPressed()) { Logs::println("Mouse left button."); createTower(); } // Middle click try to remove one if (isMiddleMouseButtonPressed()) { Logs::println("Mouse middle button."); deleteTower(); } if (isRightMouseButtonPressed()) { Logs::println("Mouse right button."); } } void InputController::createTower() { // get the curren tlevel Level* level = world->getCurrentLevel(); // GET THE MOUSE LEVEL COLLISION POINT glm::vec3 collisionPoint = MouseTransformer::getCollisionPointOnLevelMap(level, playerCamera, projectionMatrix); // if there is not, return if (MouseTransformer::isNull(collisionPoint)) return; // player needs to buy the tower before use if (mainPlayer->getCurrentMoney() <= 0) { Logs::println("Not enough money !"); return; } // position to select the tile Map* levelMap = level->getMap(); float x = collisionPoint.x; float y = collisionPoint.y + 1.0f; float z = collisionPoint.z; // check bounds float minX = level->getX(); float minY = level->getY(); float minZ = level->getZ(); float maxX = minX + level->getWidth(); float maxZ = minZ + level->getWidth(); // if out of bound return if (x < minX || x > maxX) return; if (z < minZ || z > maxZ) return; if (y < 1.0f) y = 1.0f; if (y > 1.0f) y = 1.0f; // get the tile at the position Tile* selected = levelMap->getTileAt(x, z); // is the tile already busy bool canSetEntity = !(selected->isBusy()); // the selected tile, tiled coordinates unsigned short srow = selected->getRow(); unsigned short scol = selected->getCol(); // if out of bounds return if (srow >= level->getMaxRows() - 1|| scol >= level->getMaxCols() - 1) return; Logs::print("Tile selected, row: ", true, false); Logs::printG(srow); Logs::print(", col: ", false, false); Logs::printG(scol); Logs::println(false, true); // if the tile is busy return if (!canSetEntity) { Logs::println("Tile busy."); return; } // tower position float ex = static_cast<float>(srow * Map::TILE_SIZE + Map::TILE_SIZE); float ez = static_cast<float>(scol * Map::TILE_SIZE + Map::TILE_SIZE); // get the current tower type selected GameMemory::TowerSelected selection = GameMemory::getTowerSelected(); // the player try to buy a tower in the shop and store into his inventory bool towerBought = shop->buyTower(selection, mainPlayer); // if he did not have enough money return if (!towerBought) return; Tower* newTower; // if the player tower stock is empty return unsigned int towerCount = mainPlayer->getTowersCount(selection); // does not have enough towers ! if (towerCount <= 0) { Logs::println("Player tower stock is empty, try to select another tower !"); return; } // generates a tower according to the current type selected // (type selection can be changed with C and V keywords) if (selection == GameMemory::SAMPLE) { newTower = new SampleTower(level, ex, y, ez); } else if (selection == GameMemory::INTELLIGENT) { newTower = new IntelligentTower(level, ex, y, ez); } else { newTower = new SampleTower(level, ex, y, ez); } // occupy the tile selected->setOccupier(newTower); // adding to game memory GameMemory::addToTowers(newTower->getModel(), newTower); // placing a tower diminutes the player storage mainPlayer->decTowerCount(selection); } void InputController::deleteTower() { Level* level = world->getCurrentLevel(); glm::vec3 collisionPoint = MouseTransformer::getCollisionPointOnLevelMap(level, playerCamera, projectionMatrix); if (MouseTransformer::isNull(collisionPoint)) return; Map* levelMap = level->getMap(); float x = collisionPoint.x; float y = collisionPoint.y + 1.0f; float z = collisionPoint.z; // check bounds float minX = level->getX(); float minY = level->getY(); float minZ = level->getZ(); float maxX = minX + level->getWidth(); float maxZ = minZ + level->getWidth(); if (x < minX || x > maxX) return; if (z < minZ || z > maxZ) return; if (y < 1.0f) y = 1.0f; if (y > 1.0f) y = 1.0f; Tile* selected = levelMap->getTileAt(x, z); bool busy = (selected->isBusy()); if (!busy) return; unsigned short srow = selected->getRow(); unsigned short scol = selected->getCol(); if (srow >= level->getMaxRows() - 1 || scol >= level->getMaxCols() - 1) return; Logs::print("Tile selected, row: ", true, false); Logs::printG(srow); Logs::print(", col: ", false, false); Logs::printG(scol); Logs::println(false, true); float ex = static_cast<float>(srow * Map::TILE_SIZE + Map::TILE_SIZE); float ez = static_cast<float>(scol * Map::TILE_SIZE + Map::TILE_SIZE); // get occupier Entity* occupier = selected->getOccupier(); // if the tile selected does not have tower on it, return if (occupier == nullptr) return; // free the occupied tile selected->setOccupier(nullptr); // check what was the tower's type SampleTower* sampleTow = dynamic_cast<SampleTower*>(occupier); IntelligentTower* intelligentTow = dynamic_cast<IntelligentTower*>(occupier); if (sampleTow != nullptr) { // recuperate the tower placing cost mainPlayer->incMoney(Configs::SAMPLE_TOWER_PRICE); Logs::print("Sample tower destroyed, gained ", true, false); Logs::printG(Configs::SAMPLE_TOWER_PRICE); Logs::println(" dollars.", false, true); // removing from game memory GameMemory::deleteTower(occupier->getModel(), occupier); //GameMemory::clearProjectiles(); } if (intelligentTow != nullptr) { mainPlayer->incMoney(Configs::INTELLIGENT_TOWER_PRICE); Logs::print("Intelligent tower destroyed, gained ", true, false); Logs::printG(Configs::INTELLIGENT_TOWER_PRICE); Logs::println(" dollars.", false, true); // removing from game memory GameMemory::deleteTower(occupier->getModel(), occupier); //GameMemory::clearProjectiles(); } } void InputController::mouse_position_callback(GLFWwindow* window, double xpos, double ypos) { float fxpos = static_cast<float>(xpos); float fypos = static_cast<float>(ypos); if (firstMouseHandling){ mouseX = fxpos; mouseY = fypos; firstMouseHandling = false; } float xOffset = fxpos - mouseX; // reversed since y-coords go from bottom to top float yOffset = mouseY - fypos; mouseX = fxpos; mouseY = fypos; if(isRightMouseButtonPressed()) playerCamera->processMouseMovement(xOffset, yOffset); } void InputController::mouse_entered_callback(GLFWwindow* window, int entered) { mouseEntered = entered != 0; } void InputController::update(float dTime) { checkInput(dTime); } bool InputController::isMouseButtonPressed(int button) { return glfwGetMouseButton(window, button) == GLFW_PRESS; } bool InputController::isLeftMouseButtonPressed() { return isMouseButtonPressed(GLFW_MOUSE_BUTTON_LEFT); } bool InputController::isRightMouseButtonPressed() { return isMouseButtonPressed(GLFW_MOUSE_BUTTON_RIGHT); } bool InputController::isMiddleMouseButtonPressed() { return isMouseButtonPressed(GLFW_MOUSE_BUTTON_MIDDLE); } void InputController::handleCameraMovement(float dTime) { // Handles the camera movement according to the input if (isKeyLeftPressed()) { playerCamera->processKeyboard(Camera::LEFT, dTime); } if (isKeyRightPressed()) { playerCamera->processKeyboard(Camera::RIGHT, dTime); } if (isKeyForwardPressed()) { playerCamera->processKeyboard(Camera::FORWARD, dTime); } if (isKeyBackwardPressed()) { playerCamera->processKeyboard(Camera::BACKWARD, dTime); } if (isKeyDownPressed()) { playerCamera->processKeyboard(Camera::DOWN, dTime); } if (isKeyUpPressed()) { playerCamera->processKeyboard(Camera::UP, dTime); } } void InputController::handleCameraRotation(float dTime) { // Rotates the camera if (InputController::isRightMouseButtonPressed()) { float rotX = getMouseRotX() * Configs::BASE_MOUSE_SENS; float rotY = getMouseRotY() * Configs::BASE_MOUSE_SENS; playerCamera->rotate(rotX, rotY); } } // Changes the camera tower selection void InputController::handlePlayerSelection() { if (isPressed(GLFW_KEY_C)){ towerSelected = 0; } if (isPressed(GLFW_KEY_V)) { towerSelected = 1; } GameMemory::setTowerSelected(towerSelected); } bool InputController::isPressed(int key) { return glfwGetKey(window, key) == GLFW_PRESS; } bool InputController::isKeyLeftPressed() { return isPressed(GLFW_KEY_LEFT) || isPressed(GLFW_KEY_Q) || isPressed(GLFW_KEY_A); } bool InputController::isKeyRightPressed() { return isPressed(GLFW_KEY_RIGHT) || isPressed(GLFW_KEY_D); } bool InputController::isKeyUpPressed() { return isPressed(GLFW_KEY_SPACE); } bool InputController::isKeyDownPressed() { return isPressed(GLFW_KEY_LEFT_CONTROL); } bool InputController::isKeyForwardPressed() { return isPressed(GLFW_KEY_UP) || isPressed(GLFW_KEY_W) || isPressed(GLFW_KEY_Z); } bool InputController::isKeyBackwardPressed() { return isPressed(GLFW_KEY_DOWN) || isPressed(GLFW_KEY_S); } // getters float InputController::getMouseDX() { return mouseDX; } float InputController::getMouseDY() { return mouseDY; } float InputController::getMouseRotX() { return rotX; } float InputController::getMouseRotY() { return rotY; } glm::vec2 InputController::getMousePosition() { return glm::vec2(mouseX, mouseY); }
27.855392
113
0.727673
Damoy
1bc2169b0fae36fcbf038021ccf31bd8e0caad24
1,338
cpp
C++
k-concatenation.cpp
sagar-sam/codechef-solutions
ea414d17435f0cfbc84b0c6b172ead0b22f32a23
[ "MIT" ]
null
null
null
k-concatenation.cpp
sagar-sam/codechef-solutions
ea414d17435f0cfbc84b0c6b172ead0b22f32a23
[ "MIT" ]
null
null
null
k-concatenation.cpp
sagar-sam/codechef-solutions
ea414d17435f0cfbc84b0c6b172ead0b22f32a23
[ "MIT" ]
null
null
null
#include <iostream> #include <vector> #include <limits.h> using namespace std; long long int maxSubArraySum(vector<long long int> a, int size) { long long int max_so = INT_MIN, max_here = 0; for (int i = 0; i < size; i++) { max_here = max_here + a[i]; if (max_so < max_here) max_so = max_here; if (max_here < 0) max_here = 0; } return max_so; } int main() { int t; scanf("%d",&t); while(t--) { int n,k; scanf("%d%d",&n,&k); vector<long long int> vec(n); long long int sum=0; for(int i=0;i<n;i++) { scanf("%lld",&vec[i]); sum+=vec[i]; } if(k==1) { long long int ans=maxSubArraySum(vec,n); printf("%lld\n",ans); continue; } for(int i=0;i<n;i++) { vec.push_back(vec[i]); } long long int ind=-1; long long int max_so = INT_MIN, max_here = 0; for (int i = 0; i < 2*n; i++) { max_here = max_here + vec[i]; if (max_so < max_here) { ind=i; max_so = max_here; } if (max_here < 0) max_here = 0; } // return max_so; // long long int sub=maxSubArraySum(vec,2*n); long long int ans=max_so; if(sum>0) { if(ind<n) ans=ans+(k-1)*sum; else if(ind>=n) ans=ans+(k-2)*sum; } printf("%lld\n",ans); } }
16.936709
63
0.508221
sagar-sam
1bc44872ad4dbb28db93baf55b78b9654d0d8727
1,502
cpp
C++
core/src/special/StubModule.cpp
azuki-monster/megamol
f5d75ae5630f9a71a7fbf81624bfd4f6b253c655
[ "BSD-3-Clause" ]
2
2020-10-16T10:15:37.000Z
2021-01-21T13:06:00.000Z
core/src/special/StubModule.cpp
azuki-monster/megamol
f5d75ae5630f9a71a7fbf81624bfd4f6b253c655
[ "BSD-3-Clause" ]
null
null
null
core/src/special/StubModule.cpp
azuki-monster/megamol
f5d75ae5630f9a71a7fbf81624bfd4f6b253c655
[ "BSD-3-Clause" ]
1
2021-01-28T01:19:54.000Z
2021-01-28T01:19:54.000Z
/* * StubModule.cpp * Copyright (C) 2017 by MegaMol Team * All rights reserved. Alle Rechte vorbehalten. */ #include "stdafx.h" #include "mmcore/special/StubModule.h" #include "mmcore/CoreInstance.h" #include "mmcore/factories/CallAutoDescription.h" using namespace megamol; using namespace megamol::core; special::StubModule::StubModule(void) : Module(), inSlot("inSlot", "Inbound call"), outSlot("outSlot", "Outbound call") { } special::StubModule::~StubModule(void) { this->Release(); } bool special::StubModule::create(void) { for (auto cd : this->GetCoreInstance()->GetCallDescriptionManager()) { this->inSlot.SetCompatibleCall(cd); for (unsigned int idx = 0; idx < cd->FunctionCount(); idx++) { this->outSlot.SetCallback(cd->ClassName(), cd->FunctionName(idx), &StubModule::stub); } } this->MakeSlotAvailable(&this->inSlot); this->MakeSlotAvailable(&this->outSlot); return true; } void special::StubModule::release(void) { } bool megamol::core::special::StubModule::stub(Call& c) { auto call = this->inSlot.CallAs<Call>(); for (auto cd : this->GetCoreInstance()->GetCallDescriptionManager()) { if (cd->IsDescribing(call)) { for (unsigned int idx = 0; idx < cd->FunctionCount(); idx++) { try { this->inSlot.Call(idx); } catch (...) { return false; } } } } return true; }
23.107692
97
0.607856
azuki-monster
1bc51b36950c7918cfff9697eee495fb74b61a24
3,672
cxx
C++
src/Cxx/Visualization/BillboardTextActor3D.cxx
cvandijck/VTKExamples
b6bb89414522afc1467be8a1f0089a37d0c16883
[ "Apache-2.0" ]
309
2017-05-21T09:07:19.000Z
2022-03-15T09:18:55.000Z
src/Cxx/Visualization/BillboardTextActor3D.cxx
yijianmingliu/VTKExamples
dc8aac47c4384f9a2de9facbdd1ab3249f62ec99
[ "Apache-2.0" ]
379
2017-05-21T09:06:43.000Z
2021-03-29T20:30:50.000Z
src/Cxx/Visualization/BillboardTextActor3D.cxx
yijianmingliu/VTKExamples
dc8aac47c4384f9a2de9facbdd1ab3249f62ec99
[ "Apache-2.0" ]
170
2017-05-17T14:47:41.000Z
2022-03-31T13:16:26.000Z
#include <vtkSmartPointer.h> #include <vtkPolyDataMapper.h> #include <vtkProperty.h> #include <vtkActor.h> #include <vtkRenderWindow.h> #include <vtkRenderer.h> #include <vtkRenderWindowInteractor.h> #include <vtkPolyData.h> #include <vtkSphereSource.h> #include <vtkBillboardTextActor3D.h> #include <vtkTextProperty.h> #include <vtkCallbackCommand.h> #include <vtkMath.h> #include <sstream> void ActorCallback( vtkObject* caller, long unsigned int vtkNotUsed(eventId), void* clientData, void* vtkNotUsed(callData) ) { vtkSmartPointer<vtkBillboardTextActor3D> textActor = static_cast<vtkBillboardTextActor3D *>(clientData); vtkSmartPointer<vtkActor> actor = static_cast<vtkActor *>(caller); std::ostringstream label; label << std::setprecision(3) << actor->GetPosition()[0] << ", " << actor->GetPosition()[1] << ", " << actor->GetPosition()[2] << std::endl; textActor->SetPosition(actor->GetPosition()); textActor->SetInput(label.str().c_str()); } int main(int, char *[]) { // For testing vtkMath::RandomSeed(8775070); // Create a sphere vtkSmartPointer<vtkSphereSource> sphereSource = vtkSmartPointer<vtkSphereSource>::New(); sphereSource->SetCenter ( 0.0, 0.0, 0.0 ); sphereSource->SetRadius ( 1.0 ); // Create an actor vtkSmartPointer<vtkPolyDataMapper> mapper2 = vtkSmartPointer<vtkPolyDataMapper>::New(); mapper2->SetInputConnection ( sphereSource->GetOutputPort() ); vtkSmartPointer<vtkActor> actor2 = vtkSmartPointer<vtkActor>::New(); actor2->SetMapper ( mapper2 ); actor2->SetPosition(0, 0, 0); actor2->GetProperty()->SetColor(1.0, .4, .4); // Create a renderer vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New(); renderer->SetBackground ( .6, .4, .2); renderer->AddActor ( actor2 ); // Create a render window vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New(); renderWindow->AddRenderer ( renderer ); // Create an interactor vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New(); renderWindowInteractor->SetRenderWindow ( renderWindow ); for (int i = 0; i < 10; ++i) { // Create a mapper vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); mapper->SetInputConnection ( sphereSource->GetOutputPort() ); // Create an actor vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New(); actor->SetMapper ( mapper ); actor->SetPosition(0, 0, 0); // Setup the text and add it to the renderer vtkSmartPointer<vtkBillboardTextActor3D> textActor = vtkSmartPointer<vtkBillboardTextActor3D>::New(); textActor->SetInput (""); textActor->SetPosition (actor->GetPosition()); textActor->GetTextProperty()->SetFontSize ( 12 ); textActor->GetTextProperty()->SetColor ( 1.0, 1.0, .4 ); textActor->GetTextProperty()->SetJustificationToCentered(); renderer->AddActor ( actor ); renderer->AddActor ( textActor ); vtkSmartPointer<vtkCallbackCommand> actorCallback = vtkSmartPointer<vtkCallbackCommand>::New(); actorCallback->SetCallback (ActorCallback); actorCallback->SetClientData(textActor); actor->AddObserver(vtkCommand::ModifiedEvent,actorCallback); actor->SetPosition(vtkMath::Random(-10.0, 10.0), vtkMath::Random(-10.0, 10.0), vtkMath::Random(-10.0, 10.0)); } renderWindow->Render(); renderWindowInteractor->Start(); return EXIT_SUCCESS; }
33.381818
70
0.688453
cvandijck
1bc56930af11b6dbcfa066e65d385182c33ea84a
8,253
cpp
C++
examples/main.cpp
mgienger/ESLib
aee404104c99b95e2070b632ff2d8210f5cc6941
[ "BSD-3-Clause" ]
6
2018-12-18T19:30:58.000Z
2021-03-11T15:52:14.000Z
examples/main.cpp
mgienger/ESLib
aee404104c99b95e2070b632ff2d8210f5cc6941
[ "BSD-3-Clause" ]
3
2019-03-29T21:11:28.000Z
2019-08-15T19:45:27.000Z
examples/main.cpp
mgienger/ESLib
aee404104c99b95e2070b632ff2d8210f5cc6941
[ "BSD-3-Clause" ]
2
2019-01-24T16:07:12.000Z
2020-07-15T18:39:33.000Z
/******************************************************************************* Copyright (c) 2017, Honda Research Institute Europe GmbH. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include "EventRegistry.h" #include "EventQueue.h" #include "EventSystem.h" #include "test_subscriptiononly.h" #include <iostream> using namespace std; void event1_handler1(const std::string& strArg) { cout << "event1_handler1 got " << strArg << endl; } void string_stealer(std::string&& strArg) { std::string stolen(std::move(strArg)); cout << "string_stealer got " << stolen << endl; cout << "=> Arg is now " << strArg << endl; } void event1_handler2(std::string strArg) { cout << "event1_handler2 got " << strArg << endl; } void event1_handler_temp(std::string strArg) { cout << "event1_handler_temp got " << strArg << endl; } void event2_handler1(int intArg) { cout << "event2_handler1 got " << intArg << endl; } struct Foo { void event2_handler2(int intArg) { cout << "event2_handler2 got " << intArg << endl; } void const_handler(int intArg) const { cout << "const_handler got " << intArg << endl; } void const_arg_handler(const std::string& strArg) { cout << "const_arg_handler got " << strArg << endl; } }; struct Parent { virtual ~Parent() = default; virtual void inherited_handler(int intArg) { cout << classname() << " got " << intArg << endl; } virtual const char* classname() const { return "Parent"; } void overloaded_handler(std::string strArg) { cout << "overloaded_handler(string) got " << strArg << endl; } void overloaded_handler(int intArg) { cout << "overloaded_handler(int) got " << intArg << endl; } }; struct Child : public Parent { virtual const char* classname() const { return "Child"; } }; void event3_handler1(int intArg, double doubleArg) { cout << "event3_handler1 got " << intArg << " and " << doubleArg << endl; } void const_pointer_handler(const char* str) { cout << "const_pointer_handler got " << str << endl; } void pointer_handler(char* str) { cout << "pointer_handler got " << str << endl; } bool returning_handler(int param) { cout << "returning_handler got " << param << endl; return true; } int main() { size_t nErrors = 0; // create event system ES::EventRegistry es; // register events auto event1 = es.registerEvent<std::string>("event1"); event1->addSubscriber(event1_handler1); event1->addSubscriber(string_stealer); event1->addSubscriber(event1_handler2); cout << event1->getHandlerCount() << endl; event1->call("A text"); // try getting handler list auto event1ref2 = es.getSubscribers<std::string>("event1"); event1ref2->call("A text 2"); auto event2 = es.registerEvent<int>("event2"); event2->addSubscriber(event2_handler1); Foo foo; event2->addSubscriber(&Foo::event2_handler2, &foo); event2->addSubscriber(&Foo::const_handler, const_cast<const Foo*>(&foo)); event1->addSubscriber(&Foo::const_arg_handler, &foo); auto event3 = es.registerEvent<int, double>("event3"); event3->addSubscriber(event3_handler1); event3->call(3, 3.5); // with return value event2->addSubscriber(returning_handler, ES::ignore_result); // event queue { ES::EventQueue queue; queue.enqueue<std::string>(event1, "Hello"); queue.enqueue(event2, 42); queue.enqueue<std::string>(event1, "World"); // fire them // queue.process(); cout << "=== First queued event ===" << endl; queue.processOne(); cout << "=== Second queued event ===" << endl; queue.processOne(); cout << "=== Third queued event ===" << endl; queue.processOne(); cout << "Has more events: " << boolalpha << queue.processOne() << endl; queue.enqueue<std::string>(event1, "Unhandled"); } // test subscriber handles ES::SubscriptionHandle handle = event1->addSubscriber(event1_handler_temp); event1->call("With temp"); cout << "Subscribed before release: " << boolalpha << handle.isSubscribed() << endl; release_subscription(handle); cout << "Subscribed after release: " << boolalpha << handle.isSubscribed() << endl; event1->call("Without temp"); // the same with subscription { ES::ScopedSubscription subs = event1->addSubscriber(event1_handler_temp); event1->call("With temp"); } event1->call("Without temp"); { // Test stuff with event system cout << endl; ES::EventSystem es; es.registerEvent<int>("TestEvent"); Parent parent; es.subscribe("TestEvent", &Parent::inherited_handler, &parent); es.subscribe<int>("TestEvent", &Parent::overloaded_handler, &parent); Child child; es.subscribe("TestEvent", &Parent::inherited_handler, &child); es.subscribe("TestEvent", event2_handler1); // test lambda with capture param es.subscribe("TestEvent", [child](int param){ cout << "Lambda capturing "<< child.classname() <<" got " << param << endl; }); // test constness es.registerEvent<std::string>("StrEvent"); try { es.subscribe("StrEvent", event1_handler1); } catch (std::exception& ex) { nErrors++; cout << "Error adding StrEvent handler: " << ex.what() << endl; } es.subscribe<std::string>("StrEvent", &Parent::overloaded_handler, &parent); es.publish<std::string>("StrEvent", "Test"); es.registerEvent<char*>("ConstEvent"); es.subscribe<char*>("ConstEvent", const_pointer_handler); es.subscribe("ConstEvent", pointer_handler); char nonConstChar[6] = "Hello"; es.publish("ConstEvent", nonConstChar); es.publish("TestEvent", 1); es.process(); // test processing single event es.publish("TestEvent", 1); es.publish<std::string>("StrEvent", "Str1"); es.publish("TestEvent", 2); es.publish<std::string>("StrEvent", "Str2"); es.processNamed("StrEvent"); es.process(); } // Test stuff with arg parsing cout << endl; size_t paramCount = event3->getParametersParser()->getParameterCount(); cout << "Param count: " << paramCount << endl; if (paramCount != 2) { nErrors++; } bool isInt = (event3->getParametersParser()->getParameterType(0) == ES::ParameterType::INT); cout << "Param #1 type is int: " << isInt << endl; if (!isInt) { nErrors++; } // test with parsed args event3->getParametersParser()->callEvent({"10", "2.5"}); auto event4 = es.registerEvent<bool>("event4"); event4->addSubscriber([](bool arg) {cout << "Boolean value: " << boolalpha << arg << endl;}); event4->getParametersParser()->callEvent({"True"}); event4->getParametersParser()->callEvent({"fAlSe"}); es.print(cout); cout << endl << "Test revealed " << nErrors << " errors" << endl; return 0; }
28.167235
95
0.662305
mgienger
1bc7f1a5e3bf3a4caff23f962427d01b0817adf6
458
hh
C++
src/common/geometry/hyperbolic/plane.hh
danieldeankon/hypertrace
d58a6ea28af45b875c477df4065667e9b4b88a49
[ "MIT" ]
null
null
null
src/common/geometry/hyperbolic/plane.hh
danieldeankon/hypertrace
d58a6ea28af45b875c477df4065667e9b4b88a49
[ "MIT" ]
null
null
null
src/common/geometry/hyperbolic/plane.hh
danieldeankon/hypertrace
d58a6ea28af45b875c477df4065667e9b4b88a49
[ "MIT" ]
null
null
null
#pragma once #include <algebra/quaternion.hh> #include <object.hh> #include <material.hh> #include "ray.hh" #define HYPLANE_TILING_NONE 0 #define HYPLANE_TILING_PENTAGONAL 1 #define HYPLANE_TILING_PENTASTAR 2 bool hyplane_hit( const Object *plane, ObjectHit *cache, PathInfo *path, HyRay ray ); void hyplane_bounce( const Object *plane, const ObjectHit *cache, quaternion *hit_dir, quaternion *normal, Material *material );
18.32
48
0.733624
danieldeankon
1bd25c3852049acdcb97cdcb38b4017d0ce139e3
1,863
cpp
C++
doc/examples/PropertyExtractor/BlockDiagonalizer.cpp
undisputed-seraphim/TBTK
45a0875a11da951f900b6fd5e0773ccdf8462915
[ "Apache-2.0" ]
96
2016-04-21T16:46:56.000Z
2022-01-15T21:40:25.000Z
doc/examples/PropertyExtractor/BlockDiagonalizer.cpp
undisputed-seraphim/TBTK
45a0875a11da951f900b6fd5e0773ccdf8462915
[ "Apache-2.0" ]
4
2016-10-19T16:56:20.000Z
2020-04-14T01:31:40.000Z
doc/examples/PropertyExtractor/BlockDiagonalizer.cpp
undisputed-seraphim/TBTK
45a0875a11da951f900b6fd5e0773ccdf8462915
[ "Apache-2.0" ]
19
2016-10-19T14:21:58.000Z
2021-04-15T13:52:09.000Z
#include "HeaderAndFooter.h" TBTK::DocumentationExamples::HeaderAndFooter headerAndFooter("BlockDiagonalizer"); //! [BlockDiagonalizer] #include "TBTK/Model.h" #include "TBTK/PropertyExtractor/BlockDiagonalizer.h" #include "TBTK/Range.h" #include "TBTK/Smooth.h" #include "TBTK/Solver/BlockDiagonalizer.h" #include "TBTK/Streams.h" #include "TBTK/TBTK.h" #include "TBTK/Visualization/MatPlotLib/Plotter.h" #include <complex> #include <cmath> using namespace std; using namespace TBTK; using namespace Visualization::MatPlotLib; int main(){ Initialize(); const int NUM_K_POINTS = 10000; double a = 1; Model model; Range K(0, 2*M_PI, NUM_K_POINTS); for(int k = 0; k < NUM_K_POINTS; k++) model << HoppingAmplitude(cos(K[k]*a), {k, 0}, {k, 1}) + HC; model.setChemicalPotential(-0.5); model.setTemperature(300); model.construct(); Solver::BlockDiagonalizer solver; solver.setModel(model); solver.run(); const double LOWER_BOUND = -5; const double UPPER_BOUND = 5; const int RESOLUTION = 200; PropertyExtractor::BlockDiagonalizer propertyExtractor; propertyExtractor.setSolver(solver); propertyExtractor.setEnergyWindow( LOWER_BOUND, UPPER_BOUND, RESOLUTION ); Plotter plotter; const double SMOOTHING_SIGMA = 0.01; const unsigned int SMOOTHING_WINDOW = 51; Property::DOS dos = propertyExtractor.calculateDOS(); dos = Smooth::gaussian(dos, SMOOTHING_SIGMA, SMOOTHING_WINDOW); Streams::out << dos << "\n"; plotter.plot(dos); plotter.save("figures/DOS.png"); Property::Density density = propertyExtractor.calculateDensity({ //All k-points, summing over the second subindex. {_a_, IDX_SUM_ALL} }); Streams::out << density << "\n"; plotter.clear(); plotter.setAxes({{0, {0, 2*M_PI}}}); plotter.plot({_a_, IDX_SUM_ALL}, density); plotter.setLabelX("k"); plotter.save("figures/Density.png"); } //! [BlockDiagonalizer]
25.875
82
0.7343
undisputed-seraphim
1bd265e68b13112210d9ff7960e5d4dd56674dd0
1,623
cpp
C++
codeforces/175b.plane-of-tanks-pro/175b.cpp
KayvanMazaheri/acm
aeb05074bc9b9c92f35b6a741183da09a08af85d
[ "MIT" ]
3
2018-01-19T14:09:23.000Z
2018-02-01T00:40:55.000Z
codeforces/175b.plane-of-tanks-pro/175b.cpp
KayvanMazaheri/acm
aeb05074bc9b9c92f35b6a741183da09a08af85d
[ "MIT" ]
null
null
null
codeforces/175b.plane-of-tanks-pro/175b.cpp
KayvanMazaheri/acm
aeb05074bc9b9c92f35b6a741183da09a08af85d
[ "MIT" ]
null
null
null
#include <iostream> #include <algorithm> #include <vector> #define X first #define Y second #define EPS ((double)1e-8) using namespace std; struct player { string name; int point; int better, not_worse; }; vector <player> vec; vector <pair <string, string> > result; int is_in_vec(string name) { for(int i=0; i<vec.size(); i++) if (vec[i].name == name) return i; return -1; } int main() { int n; cin >> n; for(int i=0; i<n; i++) { string name; int point; cin >> name >> point; if (is_in_vec(name) == -1) { player buff; buff.name = name; buff.point = point; buff.not_worse = 0; buff.better = 0; vec.push_back(buff); } else vec[is_in_vec(name)].point = max (point, vec[is_in_vec(name)].point); } n = vec.size(); for(int i=0; i<n; i++) for(int j=0; j<n; j++) ((vec[j].point > vec[i].point)? vec[i].better : vec[i].not_worse ) ++; for(int i=0; i<n; i++) { //swap(vec[i].not_worse, vec[i].better); pair <string, string> buff; buff.Y = vec[i].name ; if (50 * n < 100 * vec[i].better) buff.X = "noob"; else if ((50 * n <= 100 * vec[i].not_worse)&&(20 * n < 100 * vec[i].better)) buff.X = "random"; else if ((80 * n <= 100 * vec[i].not_worse)&&(10 * n < 100 * vec[i].better)) buff.X = "average"; else if ((90 * n <= 100 * vec[i].not_worse)&&(1 * n < 100 * vec[i].better)) buff.X = "hardcore"; else if (99 * n <= 100 * vec[i].not_worse) buff.X = "pro"; result.push_back(buff); } sort (result.begin(), result.end()); cout << n << endl; for(int i=0; i<n; i++) cout << result[i].Y << " " << result[i].X << endl; cout << endl; }
20.544304
78
0.566852
KayvanMazaheri