[Gold X] Two or three things about Lua debugging

About Jin X

Jin Yong Qun Xia X is a semi-instant and half-turn stand-alone chess game produced by the Hanjia Squirrel Studio. It was released in 2013.
The game story is adapted and created by fifteen novels written by Jin Yong. There are eight official versions of 0.1 ~ 0.7 and 1.0, and there are web version, Android version, ios version and mod editor version. At present, the latest version is Jin Yong Qun X1.1.0.6.
It is a pity that the game was terminated due to design infringement, and it was permanently suspended at version 1.1.0.6.

Foreword

I have always liked this game and have done some development work. Recently, I saw a breakpoint operation in the Mod exchange group. To be honest, I will not, but when asked, it is sinking into the sea. So in the end, I can only explore how to use the EmmyLua plug-in for breakpoint operations. After an afternoon of experimentation, I finally succeeded, but it seems to be different from the implementation method in the group? I hope everyone can break the technical barriers and communicate with each other.
Of course, one of the reasons why I did this was actually not wanting to admit that I was worse than them. It was also a comparison, but I have to admit that maybe I was stupid. But I believe that diligence can make up for it, so let's start the tutorial directly below.

Software preparation

  1. VS Code

    Microsoft officially announced the Visual Studio Code project at the Build Developer Conference on April 30, 2015: a cross-platform source code editor for Mac OS X, Windows, and Linux for writing modern web and cloud applications .
    The editor supports writing in multiple languages ​​and file formats. As of September 2019, the following 37 languages ​​or files have been supported: F #, HandleBars, Markdown, Python, Java, PHP, Haxe, Ruby, Sass, Rust, PowerShell , Groovy, R, Makefile, HTML, JSON, TypeScript, Batch, Visual Basic, Swift, Less, SQL, XML, Lua, Go, C ++, Ini, Razor, Clojure, C #, Objective-C, CSS, JavaScript, Perl, Coffee Script, Java, Dockerfile.

  2. EmmyLua plugin

    The Chinese made the plug-in EmmyLua based on the IntelliJ IDE, and now it also supports VsCode. This tutorial uses EmmyLua for Lua debugging.

File configuration

Regarding how to install VS Code, I wo n’t go into details here. Please download the EmmyLua plug-in directly in the expansion management of VsCode.
EmmyLua
Here we start our Golden X program first (of course the principle is the same, you debug other programs are also the same), do not load your own Mod first, just stay in the interface below.
Startup Gold X
Then we open our Lua working directory (F: \ Game \ [MOD Editor] Gold X 1.1.0.6 \ gamedata \ modcache 这里是你的Mod文件夹名字\\ lua) Please note that you must open the Lua folder and see where my arrow points It ’s LUA. Here we are half done! ! !
Lua folder opens
After opening, we first find the file we want to F9breakpoint, press the breakpoint on the corresponding line , this time is not enough, we also need a debugging mechanism, at this time directly press F5 to run or switch to the column that generates the run settings file. A configuration file. Here I chose to generate the configuration file first and then run it with F5.
Generate configuration file
After you click Finish, choose the EmmyLua Attach Debug
EmmyLua Attach Debug
default configuration in theory. Here is the code I generated by default.

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "emmylua_attach",
            "request": "attach",
            "name": "通过进程ID附加",
            "pid": 0
        }
    ]
}

Then we find the file that we need to breakpoint and hit the breakpoint, and then press F5directly to run, will let you choose the binding program, we choose [Jin X] that we just opened to perform the breakpoint operation.
Binder
My breakpoint was hit by the character's opening attribute selection, so it will be paused there at the end, you can try it yourself.
Breakpoint pictures

Published 6 original articles · won 7 · views 262

Guess you like

Origin blog.csdn.net/qq_19577209/article/details/105032562