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

# XLaunchNewGame

> XLaunchNewGame

# XLaunchNewGame

現在のゲームを終了し、割り当てられているリソースを解放し、新しいゲームを起動します。

## Syntax

```cpp theme={null}
void XLaunchNewGame(  
         const char* exePath,  
         const char* args,  
         XUserHandle defaultUser  
)  
```

### Parameters

*exePath*   \_In\_z\_\
型: char\*

起動する新しいゲームのパスとファイル名。このパスは、現在のディレクトリからの相対パスまたは絶対パスのいずれかです。呼び出し元の実行可能ファイルへのパスを知る必要があるゲームは、モジュール ハンドルに nullptr を指定して [GetModuleFileNameA](https://learn.microsoft.com/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamea) を呼び出すことができます。

*args*   \_In\_opt\_z\_\
型: char\*

新しいゲームを起動する際に適用可能な、ゲーム固有の引数。

*defaultUser*   \_In\_opt\_\
型: XUserHandle

新しいゲームを起動するユーザーのハンドル。値が指定されていない場合は、現在のユーザーが
指定されます。

### Return value

型: void

この関数は、ゲームの再起動ができない場合でも、値を返したり例外を発生させたりしません。

## Remarks

<Note>この関数は、タイム センシティブ スレッドから呼び出しても安全ではありません。詳細については、</Note>
[Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads) を参照してください。

この関数はゲームを再起動し、ゲームの現在のプロセスを終了して、新しいプロセスを使用してゲームを再起動します。ゲームは、ゲームが実行されている仮想マシンを
再起動することなく再起動されます。異なるデフォルト ユーザーと、ゲームを再起動するためのゲーム固有の引数を指定するオプションがあります。異なるデフォルト ユーザーを指定する方法の詳細については、[User
identity and XUser](/build/core-features/common/user/player-identity-xuser) を参照してください。

現在のプロセスは、関数が新しいゲームの起動中にエラーが発生した場合でも、常に終了します。たとえば、*exePath*、*args*、または *defaultUser* に指定された値が無効な場合でも、
関数は値を返さず、例外も発生させません。

<Note>この関数が呼び出されると、以前にマウントされたすべての DLC は</Note>
アンマウントされます。ただし、**XLaunchNewGame** のターゲットをホストする DLC は例外です。**G:**
ドライブは、新しく起動された EXE ではなく、引き続きベース パッケージのルートを指します。

<Note>**XLaunchNewGame** が呼び出された後、新しく起動されたゲームがサスペンド ハンドラーをセットアップする前にゲームがサスペンドされた場合、</Note>
ゲームは終了します。これは
非常に狭い時間ウィンドウであり、実際には非常にまれな事象になるはずです。

<Note>[XMemTransferMemory (NDA topic)](/reference/system/xmem/functions/xmemtransfermemory) を使用してシステムに転送されたメモリは保持されます。</Note>

## Requirements

**ヘッダー:** XGame.h

**ライブラリ:** xgameruntime.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体および XBOX Series 本体

## Conceptual documentation

* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)
* [Supporting Games-as-a-Service (GaaS)](/build/core-features/common/packaging/supporting-games-as-a-service)

## See also

[XGame](/reference/system/xgame/xgame_members)\
[User identity and XUser](/build/core-features/common/user/player-identity-xuser)\
[XLaunchUri](/reference/system/xlauncher/functions/xlaunchuri)


## Related topics

- [XLaunchRestartOnCrash](/ja-jp/reference/system/xgame/functions/xlaunchrestartoncrash.md)
- [ゲームの既定のユーザーの変更](/ja-jp/build/core-features/common/user/users-changing-default-user.md)
- [Games-as-a-Service (GaaS) のサポート](/ja-jp/build/core-features/common/packaging/supporting-games-as-a-service.md)
- [XGame](/ja-jp/reference/system/xgame/xgame_members.md)
- [ユーザーと入力デバイス](/ja-jp/build/core-features/common/user/users-input-devices.md)
