DR -> DR SDK #16
6
DR.py
6
DR.py
@ -8,6 +8,8 @@ import time
|
|||||||
import cProfile
|
import cProfile
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
from io import StringIO
|
||||||
|
|
||||||
# TODO 默认位置配置文件
|
# TODO 默认位置配置文件
|
||||||
# TODO 可自定义工作路径
|
# TODO 可自定义工作路径
|
||||||
|
|
||||||
@ -89,6 +91,10 @@ def main() -> None:
|
|||||||
print(error_format['error.unknown'])
|
print(error_format['error.unknown'])
|
||||||
print(error)
|
print(error)
|
||||||
crash.create_crash_report(error)
|
crash.create_crash_report(error)
|
||||||
|
cache_steam = StringIO()
|
||||||
|
crash.write_info_to_cache(cache_steam)
|
||||||
|
text = cache_steam.getvalue()
|
||||||
|
print(text)
|
||||||
else:
|
else:
|
||||||
crash.record_thread = False
|
crash.record_thread = False
|
||||||
print(crash.all_thread)
|
print(crash.all_thread)
|
||||||
|
@ -113,7 +113,7 @@ class _DR_runtime(Options):
|
|||||||
API_version: Version = Api_version # DR SDK API 版本
|
API_version: Version = Api_version # DR SDK API 版本
|
||||||
DR_long_version: int = long_version # DR SDK 内部协议版本 (不要问我为什么不用 Version,我也在考虑)
|
DR_long_version: int = long_version # DR SDK 内部协议版本 (不要问我为什么不用 Version,我也在考虑)
|
||||||
|
|
||||||
DR_Mod_List: List[Tuple[str, Version]] = [] # DR Mod 列表
|
DR_Mod_List: List[Tuple[str, Version]] = [] # DR Mod 列表 (name, version)
|
||||||
|
|
||||||
DR_Rust_version: Version = DR_rust_version # 后面要去掉的 DR_rs 版本
|
DR_Rust_version: Version = DR_rust_version # 后面要去掉的 DR_rs 版本
|
||||||
DR_Rust_get_version: Optional[Version] = None # 后面也要去掉的 DR_rs 版本
|
DR_Rust_get_version: Optional[Version] = None # 后面也要去掉的 DR_rs 版本
|
||||||
@ -177,6 +177,7 @@ class _DR_runtime(Options):
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
print(f'ImportError when loading mod {mod_path}')
|
print(f'ImportError when loading mod {mod_path}')
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
self.DR_Mod_List = [(mod, Version('0.0.0-unknown')) for mod in mods]
|
||||||
return mods
|
return mods
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ file_error = {FileNotFoundError: 'no {filetype} file was founded!:\n file name:
|
|||||||
|
|
||||||
|
|
||||||
def load_file(file_name: str,
|
def load_file(file_name: str,
|
||||||
stack: Union[str, list, dict] = None,
|
stack: Union[str, list, dict, None] = None,
|
||||||
raise_error: bool = True,
|
raise_error: bool = True,
|
||||||
encoding: str = 'utf-8') -> Union[dict, ElementTree.ElementTree]:
|
encoding: str = 'utf-8') -> Union[dict, ElementTree.ElementTree]:
|
||||||
f_type = file_name[file_name.rfind('.') + 1:] # 从最后一个.到末尾 (截取文件格式)
|
f_type = file_name[file_name.rfind('.') + 1:] # 从最后一个.到末尾 (截取文件格式)
|
||||||
|
@ -49,7 +49,10 @@
|
|||||||
- Add `mod_path: str` field
|
- Add `mod_path: str` field
|
||||||
- Add `DR_Mod_List: List[Tuple[str, Version]]` field
|
- Add `DR_Mod_List: List[Tuple[str, Version]]` field
|
||||||
- Add `load_mods() -> None` method
|
- Add `load_mods() -> None` method
|
||||||
- Add `find_mods -> List[str]` method
|
- Add `find_mods -> List[str]` method
|
||||||
|
- 现在游戏崩溃时会自动在 stdio 中输出崩溃日志 内容跟 crash report 中的基本相同
|
||||||
|
- Now when the game crashes, it will automatically output the crash log in stdio
|
||||||
|
- The content of the crash log is basically the same as the crash report
|
||||||
|
|
||||||
### Mod Loader
|
### Mod Loader
|
||||||
|
|
||||||
|
@ -102,6 +102,9 @@ class Version:
|
|||||||
version_str += '+' + str(self.build)
|
version_str += '+' + str(self.build)
|
||||||
return version_str
|
return version_str
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return 'Version({})'.format(self.__str__())
|
||||||
|
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
if index < len(self.component):
|
if index < len(self.component):
|
||||||
return self.component[index]
|
return self.component[index]
|
||||||
|
Loading…
Reference in New Issue
Block a user