> ## 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.

# XLaunchRestartOnCrash

> XLaunchRestartOnCrash

# XLaunchRestartOnCrash

當目前執行中的遊戲執行個體因當機而異常終止時，自動重新啟動遊戲。

## 語法

```cpp theme={null}
HRESULT XLaunchRestartOnCrash(  
         const char* args,  
         uint32_t reserved  
)  
```

### 參數

*args*   \_In\_opt\_z\_\
類型：char\*

用來重新啟動遊戲的任何適用遊戲特定引數。

*reserved*   \_In\_\
類型：uint32\_t

保留。必須設定為 0。

### 傳回值

類型：HRESULT

HRESULT 成功或錯誤碼。

## 備註

與 [XLaunchNewGame](/zh-TW/reference/system/xgame/functions/xlaunchnewgame) 一樣，**XLaunchRestartOnCrash** 可保證同一時間只有一個遊戲可執行檔
在執行。決定偵測到當機時是否要啟動新可執行檔的內部狀態，
與目前遊戲執行個體的存留期相關聯。如果仍需要重新啟動行為，重新啟動的遊戲執行個體也必須再次呼叫
**XLaunchRestartOnCrash**。

<Note>如果遊戲呼叫 **XLaunchRestartOnCrash**，之後又呼叫</Note>
[XLaunchNewGame](/zh-TW/reference/system/xgame/functions/xlaunchnewgame)，並在新遊戲啟動之前當機，則會重新啟動呼叫端
遊戲，而不是透過 [XLaunchNewGame](/zh-TW/reference/system/xgame/functions/xlaunchnewgame) 指定的新啟動目標。

<Note>此 API 不適用於零售案例，如果在非開發套件的主機上叫用，</Note>
將會傳回 E\_NOTIMPL。

## 需求

**標頭：** XGame.h

**程式庫：** xgameruntime.lib

**支援的平台：** XBOX One 系列主機和 XBOX Series 主機

## 另請參閱

[XGame](/zh-TW/reference/system/xgame/xgame_members)


## Related topics

- [XGame](/zh-TW/reference/system/xgame/xgame_members.md)
- [適用於 GDK 的 Unity C# API 包裝函式](/zh-TW/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [crash_detected](/zh-TW/services/playfab/api-references/events/MultiplayerServers/crash-detected.md)
- [首頁 (Dev Home)](/zh-TW/tools/tools-console/devhome/devhome-home.md)
- [CrashDetectedEventPayload](/zh-TW/services/playfab/api-references/events/data-types/crashdetectedeventpayload.md)
