Zh/Installing and Debugging the Source Code: Difference between revisions
< Zh
Jump to navigation
Jump to search
No edit summary |
m (Multipage removal) |
||
(7 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{LanguageBar}} | ||
}} | |||
== | == Source SDK 2013 == | ||
见 {{L|Source SDK 2013}} | |||
=== | == 安装 == | ||
# 启动Source SDK选择 ''Create a Mod''. 见 {{L|Create a Mod}} 获得更多细节. | |||
# {{L|Compiler Choices|选择编译器}} | |||
# 完成!可以先选择{{L|Your First Entity|编写你的第一个实体}}来开始你的Mod制作。 | |||
在Linux上编译, 见 {{L|Compiling under Linux}}. 见 [https://github.com/ValveSoftware GitHub]来获得最新代码 | |||
== 调试 == | |||
'''调试''' 是一个人仔细检查程序内部工作的过程。它可以找到崩溃和其他错误的原因。 | |||
=== Windows === | |||
# 确保你是在 Debug 状态下工作,而并非是 Release. | |||
# 在解决方案浏览器 (Microsoft Visual C++,也可以是Visual Studio),右击可用的项目 (加粗的) 并选择 ''Properties''. 在Server或者Client上工作都没关系,但最好选择Client(HL2). | |||
# 在弹出的窗口中的左栏中选择 ''Debugging'' | |||
# 路径必须定位到使用的 SDK 版本. 例如 Source SDK 2013,单人模式模组的设置应该如下: | |||
Command: C:\Program Files (x86)\Steam\steamapps\common\Source SDK Base 2013 Singleplayer\hl2.exe | |||
Command Arguments: -allowdebug -dev -sw -condebug -console -toconsole -game "C:\My_Mod\source-sdk-2013\sp\game\mod_hl2" +map my_map | |||
Working Directory: C:\Program Files (x86)\Steam\steamapps\common\Source SDK Base 2013 Singleplayer\ | |||
# 在调试前你必须解包所有的游戏资源到你的模组文件夹或者SDK里 (不低于 2006 版). 不然会白屏, 粉色控制台或者别的BUG! 这很重要. 你需要着色器 (白屏bug) ,从 <code>Source SDK Base\vpks</code>里获取,然后是 <code>resources\</code> to <code>Source SDK Base\hl2\</code> (修复目录字段) 最后是 <code>Source SDK Base\platform</code> (粉色控制台), 不要忘记t <code>expressions\</code>, 否则NPC不会动他们的嘴唇,以及别的东西 像是模型,材质之类,不要尝试使用不同的起源引擎模型除了来自你的SDK的,不然会有BUG | |||
你任何时间都可以按下F5来调试. | |||
{{note| Visual Studio 2013 调试前可能会需要点击''' “生成——重新生成解决方案”'''}} | |||
{{note|"Command Arguments"所定位的mod文件目录最好是 '''“项目——属性——配置属性——Build Events——Post-Build Events”'''中命令行所设置的,}} | |||
{{note|在点击调试时可能会弹出一个警告窗口,显示“找不到或打开PDB文件”,勾选不再显示,然后点击“确定”即可}} | |||
=== Linux === | |||
(译者:没用过Linux,偷懒了 :D) | |||
# Use the environment variable <code>CFG=debug</code> when running the command you normally use to generate the makefiles with the {{L|Valve_Project_Creator|VPC}} script. (Run again with <code>CFG=release</code> to go back to producing release binaries.) | |||
# Make and Install | |||
# Open a terminal window and cd to the location of the executable you are running | |||
<!-- not needed, and bad? # Perform <code>export LD_LIBRARY_PATH=".:bin:$LD_LIBRARY_PATH"</code> --> | |||
# Perform <code>gdb srcds_linux</code> (or whatever the name is) | |||
# Perform <code>run <parameters></code> to start the program | |||
* On a crash ("segfault"), do <code>bt</code> ("backtrace") to see the callstack. | |||
* To break into the debugger, press {{key|Ctrl+C}}; to continue afterwards perform <code>cont</code>. | |||
* To set a breakpoint, do <code>break <function></code>. See <code>help breakpoint</code> for more details. | |||
* To print an expression, do <code>print <expr></code>. | |||
[[Category:Programming | |||
[[Category:Modding | [[Category:Programming]] | ||
[[Category:Modding]] |
Latest revision as of 07:36, 12 July 2024
Source SDK 2013
安装
- 启动Source SDK选择 Create a Mod. 见 Create a Mod 获得更多细节.
- 选择编译器
- 完成!可以先选择编写你的第一个实体 来开始你的Mod制作。
在Linux上编译, 见 Compiling under Linux . 见 GitHub来获得最新代码
调试
调试 是一个人仔细检查程序内部工作的过程。它可以找到崩溃和其他错误的原因。
Windows
- 确保你是在 Debug 状态下工作,而并非是 Release.
- 在解决方案浏览器 (Microsoft Visual C++,也可以是Visual Studio),右击可用的项目 (加粗的) 并选择 Properties. 在Server或者Client上工作都没关系,但最好选择Client(HL2).
- 在弹出的窗口中的左栏中选择 Debugging
- 路径必须定位到使用的 SDK 版本. 例如 Source SDK 2013,单人模式模组的设置应该如下:
Command: C:\Program Files (x86)\Steam\steamapps\common\Source SDK Base 2013 Singleplayer\hl2.exe Command Arguments: -allowdebug -dev -sw -condebug -console -toconsole -game "C:\My_Mod\source-sdk-2013\sp\game\mod_hl2" +map my_map Working Directory: C:\Program Files (x86)\Steam\steamapps\common\Source SDK Base 2013 Singleplayer\
- 在调试前你必须解包所有的游戏资源到你的模组文件夹或者SDK里 (不低于 2006 版). 不然会白屏, 粉色控制台或者别的BUG! 这很重要. 你需要着色器 (白屏bug) ,从
Source SDK Base\vpks
里获取,然后是resources\
toSource SDK Base\hl2\
(修复目录字段) 最后是Source SDK Base\platform
(粉色控制台), 不要忘记texpressions\
, 否则NPC不会动他们的嘴唇,以及别的东西 像是模型,材质之类,不要尝试使用不同的起源引擎模型除了来自你的SDK的,不然会有BUG
你任何时间都可以按下F5来调试.



Linux
(译者:没用过Linux,偷懒了 :D)
- Use the environment variable
CFG=debug
when running the command you normally use to generate the makefiles with the VPC script. (Run again withCFG=release
to go back to producing release binaries.) - Make and Install
- Open a terminal window and cd to the location of the executable you are running
- Perform
gdb srcds_linux
(or whatever the name is) - Perform
run <parameters>
to start the program
- On a crash ("segfault"), do
bt
("backtrace") to see the callstack. - To break into the debugger, press Ctrl+C; to continue afterwards perform
cont
. - To set a breakpoint, do
break <function>
. Seehelp breakpoint
for more details. - To print an expression, do
print <expr>
.