Skip to content

Commit f4cfcff

Browse files
authored
Merge pull request #25 from fa0311/develop-v4
v4.1
2 parents 36bd5c3 + ec6a3af commit f4cfcff

File tree

7 files changed

+105
-34
lines changed

7 files changed

+105
-34
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/build
22
/dist
3-
/DMMGamePlayerFastLauncher.spec
4-
/__pycache__
3+
/*.spec
4+
/__pycache__
5+
*.exe

DMMGamePlayerFastLauncher.py

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import hashlib
99
import sqlite3
1010
import os
11+
import time
1112

1213

1314
def gen_rand_hex():
@@ -55,6 +56,7 @@ def get_dpg5_config(dgp5_path):
5556
argpar.add_argument("product_id", default=None)
5657
argpar.add_argument("--game-path", default=False)
5758
argpar.add_argument("--login-force", action="store_true")
59+
argpar.add_argument("--skip-exception", action="store_true")
5860
arg = argpar.parse_args()
5961

6062
HEADERS = {
@@ -79,7 +81,7 @@ def get_dpg5_config(dgp5_path):
7981
"motherboard": gen_rand_hex(),
8082
"user_os": "win",
8183
}
82-
DGP5_PATH = os.environ["APPDATA"] + "/dmmgameplayer5/"
84+
DGP5_PATH = os.environ["APPDATA"] + "\\dmmgameplayer5\\"
8385

8486

8587
open("cookie.bytes", "a+")
@@ -92,9 +94,10 @@ def get_dpg5_config(dgp5_path):
9294
headers=HEADERS,
9395
)
9496
if session.cookies.get("login_session_id") == None:
95-
raise Exception(
96-
"ログインに失敗しました\nDMMGamePlayerでログインしていない時またはDMMGamePlayerが起動している時にこのエラーが発生する可能性があります"
97-
)
97+
if not arg.skip_exception:
98+
raise Exception(
99+
"ログインに失敗しました\nDMMGamePlayerでログインしていない時またはDMMGamePlayerが起動している時にこのエラーが発生する可能性があります"
100+
)
98101
contents = json.dumps(
99102
{
100103
"login_session_id": session.cookies.get("login_session_id"),
@@ -129,14 +132,18 @@ def get_dpg5_config(dgp5_path):
129132
game_path = path
130133
break
131134
else:
132-
raise Exception("ゲームのパスの検出に失敗しました")
135+
if not arg.skip_exception:
136+
raise Exception("ゲームのパスの検出に失敗しました")
133137
break
134138
else:
135-
raise Exception(
136-
"product_id が無効です\n"
137-
+ " ".join([contents["productId"] for contents in dpg5_config["contents"]])
138-
+ "から選択して下さい"
139-
)
139+
if not arg.skip_exception:
140+
raise Exception(
141+
"product_id が無効です\n"
142+
+ " ".join(
143+
[contents["productId"] for contents in dpg5_config["contents"]]
144+
)
145+
+ "から選択して下さい"
146+
)
140147

141148
response = requests.post(
142149
"https://apidgp-gameplayer.games.dmm.com/v5/launch/cl",
@@ -148,9 +155,16 @@ def get_dpg5_config(dgp5_path):
148155

149156
if response["result_code"] == 100:
150157
dmm_args = response["data"]["execute_args"].split(" ")
151-
print(dmm_args)
152-
subprocess.Popen([game_path, dmm_args[0], dmm_args[1]])
158+
start_time = time.time()
159+
process = subprocess.Popen(
160+
[game_path, dmm_args[0], dmm_args[1]], shell=True, stdout=subprocess.PIPE
161+
)
162+
for line in process.stdout:
163+
text = line.decode("utf-8").strip()
164+
if time.time() - start_time < 2 and not arg.skip_exception:
165+
raise Exception("ゲームが起動しませんでした。ゲームにアップデートがある可能性があります。")
153166
else:
154167
with open("cookie.bytes", "wb") as f:
155168
f.write(b"")
156-
raise Exception("起動にエラーが発生したため修復プログラムを実行しました\n" + json.dumps(response))
169+
if not arg.skip_exception:
170+
raise Exception("起動にエラーが発生したため修復プログラムを実行しました\n" + json.dumps(response))

DMMGamePlayerProductIdChecker.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import os
2+
import json
3+
import pandas as pd
4+
5+
DGP5_PATH = os.environ["APPDATA"] + "\\dmmgameplayer5\\"
6+
7+
with open(DGP5_PATH + "dmmgame.cnf", "r") as f:
8+
config = f.read()
9+
dpg5_config = json.loads(config)
10+
11+
table = [
12+
(contents["productId"], contents["detail"]["path"], contents["detail"]["version"])
13+
for contents in dpg5_config["contents"]
14+
]
15+
16+
df = pd.DataFrame(table, columns=["productId", "path", "version"])
17+
pd.set_option("display.unicode.east_asian_width", True)
18+
19+
print(df)
20+
print("終了するには何かキーを押してください")
21+
input()

README.md

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ DMM Game Player のゲームを高速かつセキュアに起動できるラン
1818
`%AppData%\DMMGamePlayerFastLauncher\DMMGamePlayerFastLauncher.exe umamusume`<br>
1919
`%AppData%\DMMGamePlayerFastLauncher\DMMGamePlayerFastLauncher.exe priconner`<br>
2020

21-
目的のゲームの**product_id**が分からない場合、**product_id**を適当なものにするとインストールしているゲームの**product_id**が一覧で表示されます<br>
22-
*%AppData%\DMMGamePlayerFastLauncher\sample* にサンプル用のショートカットを置いています<br>
21+
## product_idって?
22+
ゲームに割り当てられているidです<br>
23+
`%AppData%\DMMGamePlayerFastLauncher\tools` にある `DMMGamePlayerProductIdChecker.exe` を実行することで確認できます
24+
2325

2426
## 引数
2527
`DMMGamePlayerFastLauncher.exe <product_id>`
@@ -29,22 +31,26 @@ DMM Game Player のゲームを高速かつセキュアに起動できるラン
2931
| --help | -h | False | | bool |
3032
| --game-path | | False | ゲームのパス Falseにすると自動 | |
3133
| --login-force | | False | ログインを強制する | bool |
34+
| --skip-exception | | False | エラーをスキップ | bool |
3235

3336
## ヘルプ
3437

38+
### インストールするとき
3539
> **セットアップする際、WindowsによってPCが保護されましたと表示される**<br>
3640
> 詳細情報をクリックして実行をクリック<br>
3741
3842
> **WindowsDefenderがトロイの木馬判定を出す**<br>
39-
> このツールはトロイの木馬ではないので誤判定です
43+
> このツールはトロイの木馬ではないので誤判定です<br>
4044
> 不安が残るようであればプログラムのコードを公開しているのでビルドしてお使い下さい
4145
42-
> **ゲームのアイコンに寄せたい**<br>
43-
> ショートカットを右クリック→プロパティ→アイコンの変更→参照
46+
### 全てのゲームに起こる症状
4447

45-
> **このツールを使用するとDMMGamePlayerを起動する際に毎回ログインを求められるようになった**<br>
46-
> DMMGamePlayerのバグ(仕様?)です<br>
47-
> どうすることも出来ないので頻繁にDMMGamePlayerを起動する方にこのツールはオススメしません<br>
48+
> **「要求された操作には管理者特権が必要です」というエラーが出る**<br>
49+
> DMMGamePlayerが管理者権限でインストールされています<br>
50+
> DMMGamePlayerから管理者権限を外して下さい<br>
51+
> (このツールのv4.0以降このエラーは出ないと思いますが)
52+
53+
### 特定のゲームに起こる症状
4854

4955
> **「ゲームのパスの検出に失敗しました」というエラーが出る**<br>
5056
> **アンインストーラーなどの別のソフトが起動する**<br>
@@ -53,26 +59,37 @@ DMM Game Player のゲームを高速かつセキュアに起動できるラン
5359
例<br>
5460
`%AppData%\DMMGamePlayerFastLauncher\DMMGamePlayerFastLauncher.exe umamusume --game-path %UserProfile%/umamusume/umamusume.exe`<br>
5561
56-
> **エラーも何も出ずクリックしても起動しない**<br>
57-
> ゲームにアップデートがないか確認して下さい<br>
58-
> それでも解決しない場合は `--game-path <ゲームのパス>` を指定してください<br>
62+
> **「ゲームが起動しませんでした」というエラーが出る**<br>
63+
> `--game-path <ゲームのパス>` を指定してください<br>
5964
例<br>
6065
`%AppData%\DMMGamePlayerFastLauncher\DMMGamePlayerFastLauncher.exe umamusume --game-path %UserProfile%/umamusume/umamusume.exe`<br>
6166
62-
> **BlueStacksを利用しているゲームだとエラーが出る**<br>
63-
> 現在、BlueStacksを利用しているゲームは対応していません
67+
> **ゲームが起動しているのに「ゲームが起動しませんでした」というエラーが出る**<br>
68+
> `--skip-exception` を指定することでエラーをスキップ出来ますがオススメしません<br>
69+
> 別の解決方法を探すので発生するゲームがあれば報告して下さい<br>
70+
> 例<br>
71+
`%AppData%\DMMGamePlayerFastLauncher\DMMGamePlayerFastLauncher.exe umamusume --skip-exception`<br>
6472
65-
> **「ログインに失敗しました」というエラーが出る**<br>
66-
> DMMGamePlayerを起動してログインして下さい<br>
67-
> DMMGamePlayerを起動しているなら終了させて下さい<br>
73+
> **BlueStacksを利用しているゲームだとエラーが出る**<br>
74+
> 現在、BlueStacksを利用しているゲームは対応していません<br>
75+
> 対応する予定はないです
6876
6977
> **「要求された操作には管理者特権が必要です」というエラーが出る**<br>
70-
> DMMGamePlayerが管理者権限でインストールされています<br>
71-
> DMMGamePlayerから管理者権限を外して下さい<br>
78+
> ゲームが管理者権限でインストールされています<br>
79+
> ゲームから管理者権限を外して下さい<br>
7280
7381
> **「指定されたファイルが見つかりません」というエラーが出る**<br>
7482
> `--game-path` で指定したゲームのパスが間違っています<br>
7583
84+
### 何もしてないのに壊れた!!ってとき
85+
86+
> **「ログインに失敗しました」というエラーが出る**<br>
87+
> DMMGamePlayerを起動してログインして下さい<br>
88+
> DMMGamePlayerを起動しているなら終了させて下さい<br>
89+
90+
> **「ゲームが起動しませんでした」というエラーが出る**<br>
91+
> ゲームにアップデートがないか確認して下さい<br>
92+
7693
> **「起動にエラーが発生したため修復プログラムを実行しました」というエラーが出る**<br>
7794
> まれに表示される場合は正常な動作です<br>
7895
@@ -89,6 +106,18 @@ DMM Game Player のゲームを高速かつセキュアに起動できるラン
89106
> **その他のエラー**<br>
90107
> `%AppData%\DMMGamePlayerFastLauncher``cookie.bytes` を削除してみて下さい<br>
91108
109+
> **解決しない**<br>
110+
> ツールが対策された可能性があります<br>
111+
112+
### 不具合以外
113+
114+
> **ゲームのアイコンに寄せたい**<br>
115+
> ショートカットを右クリック→プロパティ→アイコンの変更→参照
116+
117+
> **このツールを使用するとDMMGamePlayerを起動する際に毎回ログインを求められるようになった**<br>
118+
> DMMGamePlayerのバグ(仕様?)です<br>
119+
> どうすることも出来ないので頻繁にDMMGamePlayerを起動する方にこのツールはオススメしません<br>
120+
92121
## 典拠
93122
[Lutwidse/priconner_launch.py](https://gist.github.com/Lutwidse/82d8e7a20c96296bc0318f1cb6bf26ee)
94123

build.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
black *.py
2+
pip freeze > requirements.txt
3+
pyinstaller DMMGamePlayerFastLauncher.py --onefile --noconsole
4+
pyinstaller DMMGamePlayerProductIdChecker.py --onefile
5+
Copy-Item -Path "C:\Project\Python\hack\DMMGamePlayerFastLauncher\dist\DMMGamePlayerProductIdChecker.exe" -Destination "C:\Project\Python\hack\DMMGamePlayerFastLauncher\windows\tools" -Force
6+
start "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "C:\Project\Python\hack\DMMGamePlayerFastLauncher\setup.iss"

requirements.txt

162 Bytes
Binary file not shown.

setup.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "DMMGamePlayerFastLauncher"
5-
#define MyAppVersion "4.0"
5+
#define MyAppVersion "4.1"
66
#define MyAppPublisher "yuki"
77
#define MyAppURL "https://github.com/fa0311/DMMGamePlayerFastLauncher"
88
#define MyAppExeName "DMMGamePlayerFastLauncher.exe"

0 commit comments

Comments
 (0)