> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MapFromPattern (XBOX One 系列)

> 使用以位元組陣列傳遞的預先定義模式來對應頁面。

# XGMemoryLayout::MapFromPattern 方法 (XBOX One 系列)

使用以位元組陣列傳遞的預先定義模式來對應頁面。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
HRESULT MapFromPattern(
         XGMemoryLayoutMapping *pMapping,
         UINT32 PageCount,
         const BYTE *pPattern,
         SIZE_T PatternSizeBytes,
         UINT32 MaxEsramPageCount
)  
```

<a id="ID4EG" />

### 參數

*pMapping*   \_Inout\_\
類型: XGMemoryLayoutMapping \*

更新後的對應結果，以指向 [XGMemoryLayoutMapping](/zh-TW/reference/graphics/xgmemory_NR/structs/xgmemorylayoutmapping) 結構的指標表示。

*PageCount*   \
類型: UINT32

用來建立此對應的頁面數目，包括 ESRAM 頁面和系統頁面。此計數會調整模式的長度和/或 ESRAM 使用量。如果模式不夠大，無法涵蓋整個對應，則會使用系統頁面填補至對應的結尾。

如果 *PageCount* 為 XG\_ALL\_REMAINING\_PAGES，則會以 [XGMemoryLayout::GetPageCountRemaining](/zh-TW/reference/graphics/xgmemory_NR/interfaces/XGMemoryLayout/methods/xgmemorylayout_getpagecountremaining) 取代作為 *PageCount*。

*pPattern*   \_In\_reads\_(PatternSizeBytes)\
類型: BYTE\*

預先定義的模式，以位元組陣列表示。

*PatternSizeBytes*   \
類型: SIZE\_T

預先定義模式的大小。

*MaxEsramPageCount*   \
類型: UINT32

用來建立對應的 ESRAM 頁面數目上限。此計數會調整模式的長度和/或 ESRAM 使用量。如果模式不夠大，無法涵蓋整個對應，則會使用系統頁面填補至對應的結尾。

如果 *MaxEsramPageCount* 為 XG\_ALL\_REMAINING\_PAGES，則會以 [XGMemoryLayout::GetFreeEsramPageCount](/zh-TW/reference/graphics/xgmemory_NR/interfaces/XGMemoryLayout/methods/xgmemorylayout_getfreeesrampagecount) 取代作為 *MaxEsramPageCount*。

<a id="ID4EP" />

### 傳回值

類型: HRESULT

S\_OK、E\_INVALIDARG 或 E\_OUTOFMEMORY。

<a id="remarks" />

## 備註

對應會以特定的頁面計數和 ESRAM 頁面計數上限建立。這些計數會調整模式的長度和/或 ESRAM 使用量。如果模式不夠大，無法涵蓋整個對應，則會使用系統頁面填補至對應的結尾。

<a id="requirements" />

## 需求

**標頭:** xgmemory.h

<a id="ID4E5C" />

**支援的平台:** XBOX One 系列

## 另請參閱

[XGMemoryLayout](/zh-TW/reference/graphics/xgmemory_NR/interfaces/XGMemoryLayout/xgmemorylayout)


## Related topics

- [Map](/zh-CN/reference/graphics/d3d12/interfaces/id3d12resource/methods/id3d12resource_map_public.md)
- [XMemMapPhysicalPages](/zh-CN/reference/system/xmem/functions/xmemmapphysicalpages.md)
- [ApuMapApuAddress](/zh-CN/reference/audio/apu/functions/apumapapuaddress.md)
- [ApuMapVirtualAddress](/zh-CN/reference/audio/apu/functions/apumapvirtualaddress.md)
- [XMemMapPhysicalPagesScatter](/zh-CN/reference/system/xmem/functions/xmemmapphysicalpagesscatter.md)
