Skip to content

1.2.1 ‐ Patch Config

Z-H-Sun edited this page Jul 8, 2024 · 2 revisions

Features

  • Two options are available: One takes effect only during runtime (i.e., dynamic) and the other makes permanent changes (i.e., static)

    Patch Advantages Disadvantages
    Dynamic (Runtime) Can change the settings in the Config window anytime during the TSW game Will only take effect when this modifier app is running
    Static (Permanent) Once the patches are written into the executable, they will take effect even without the modifier app running Changing settings will still have to involve using this modifier app
  • Can choose which patches / enhancements to apply:

    • Show only one-turn battle animation:

      If you are focused on the strategic calculation for optimized routes, or if you are bored with the long waiting time for the battle events, you can try applying this patch.

      This will also solve the bug when the battle involves more than 2500 rounds; click here for detailed explanations...

      TSW has its own implementation of event interpreter, i.e., the serialized events (e.g., waiting, animations, coordinate change, map tile change, etc.) will be stored in the memory starting from address 0x48C74C. Each event is composed of 3 WORD integers, and the memory address range can only hold up to 2500 rounds of battle events including sound-effects and animations. When the battle round count is greater or equal to 2500, heap overflow will happen, and other important game variables in the memory down the road will be overwritten (e.g., player properties and coordinates starting from 0x4B8688 and even map data starting from 0x4B8934), leading to program corruption.

      Because the bug will be triggered only when the battle round count is no less than 2500, this will likely happen only during the 2nd round of game when you fight against Gateman A with a low ATK (In the 1st round, the bug will happen only if you fight the Archsorcerer (Great Magic Master) with an ATK of 311). It is therefore obvious that the bug can be circumvented if we show only 1-round battle animation with the patch here.

    • Fix 47F Magician A movement bug:

      Bug Description: Magician A on 47F will perform a magic attack and move back one step when the player approaches. However, in TSW, when Magician A is in the first row (or the last row), it will not move; when it is in the second row (or second to last row), it will not move back to the first row (or the last row); and when it is in the first column (or the last column), its horizontal movement will allow it to pass through the map boundary and "teleport" to the last column of the previous row (or the first column of the next row). This behavior has been confirmed to be not a feature, but rather a bug caused by wrongly programmed conditional statement.

    • Fix 45F Merchant bug in the backside tower:

      Bug Description: The Merchant on 45F can increase your HP by 2000 at the cost of 1000 GOLD. However, in the backside tower, where all HP, ATK, and DEF properties are inflated by 44 times (or other custom multiplication factor specified in the cheat console), the Merchant still foolishly sticks to the old standard and provides only a 2000-point HP increase (which is equivalent to 45 points in the backside tower).

    • Fix 50F Zeno status bug in the backside tower:

      Bug Description: In the 3rd (and above) round of the game, 50F Zeno's properties should be [8000/5000/1000] *44 (or other custom multiplication factor specified in the cheat console; same below). However, if any saving/loading operations are performed after you seal Zeno's magic power on 49F, its properties will be mistakenly multiplied by 44 again, resulting in exceptionally huge values. The origin of the bug is as follows: The operation to multiply all properties by 44 in the backside tower has already been implemented using temporary variables in, e.g., battle events; there is no need to additionally multiply the global variables by 44 redundantly. This bug occurred due to this redundancy in an initialization function called during the operations like saving/loading.

    • Increase the margins of the dialog window:

      Bug Description: In TSW, there is no margin space between the text and the textbox edges, causing the top half to be overcrowded while leaving the bottom half empty.

    • Display on-map damage: See 1.2.2 - Map Enhancement

    • Auto save snapshots: See 1.2.3 - Save / Load Data

    • Enhance BGM playback: See 1.2.4 - Background Music

  • The deleterious bug below will always be patched (upon startup of this modifier app for both dynamic and static patching operations)

    • Fix 49F Sorcerers show-up animation bug:

      Bug Description: When you have experienced a relatively long event before the appearance of the 49F Sorcerers (Magic Sergeants), there is a chance that an additional non-existent event will be triggered.

      Click here for more detailed explanations...

      For the discussions on TSW's own event interpreter, please refer to the detailed explanation of the "2500-round bug" in the Show only one-turn battle animation section above. The serialized event array stored in memory address 0x48C74C actually works like a "stack": First, the events that have not been executed yet will be executed in reverse order; in addition, for improved performance, the executed event arrays will never be cleared from memory (unless they are overwritten by a longer event array later), but rather, a pointer is used to mark the current execution position. This pointer is a DWORD integer at memory address 0x48C5AC, which increments by 1 when a new event sequence is pushed and decrements by 1 after the current event is executed and popped (that is why events are executed in reverse order). In a function related to the show-up animation of Sorcerers, when all events had been appended to memory address 0x48C74C, the author mistakenly added one extra increment to the pointer 0x48C5AC at the end. As a result, it may point to a leftover "ghost event" that has not been cleared before.

Usage

  • Dynamic Patch (as shown in the figure below):

    • When tswKai3 detects the start of the TSW game process, it will, by default, display the "Config (Dynamic)" dialog box first;

      • tswKai3 will, by default, automatically apply the items shown in the figure below;
      • If you want to change the default behavior, please refer to Advanced Options section;
    • During the game later on, you can press F8 at any time to show this "Config (Dynamic)" dialog box again.

  • Static Patch (as shown in the figure below; for its difference from Dynamic Patch, see the Features section):

    • Drag the TSW executable file to be modified (make sure it is not running) onto tswKai3.exe, and a "Config (Static)" dialog box will appear.

      • The relevant executables' filenames are listed below. If you are using the all-in-one package, these files are located in the TSW1.2r1 subfolder:

        TSW.exe - English (Original)

        TSW.EN.exe - English (Revised)

        TSW.CN.exe - Chinese

        TSW.CNJP.exe - Chinese (Retranslated)

      • Alternatively, you can run tswKai3.exe <path/of/TSW/exe> in CMD to achieve the same effect;

      • If the TSW executable file is located in a privileged directory (such as Program Files (x86)), you may need elevated level of permissions. Please follow the prompts in the app for further instructions.

    • Since the game has not started yet, the last three options (e.g., Display on-map damage) are not available in the "Config (Static)" dialog box.

  • In the Config dialog, you can use the mouse or keyboard to tick/untick the items. After setting an item, the input focus will automatically move to the next item.

    • Please refer to the Features section for each item's specific function;
    • If using the keyboard, you can use Tab or arrow keys to navigate through items; use Space to tick/untick the selected items;
    • The settings will be automatically saved. After finishing the settings, simply click on the X button of the window or press Enter/ESC key;
    • For Static Patch only, after finishing the settings, you can choose to open the patched program right away, to go hibernating, or to quit the modifier.
  • The meaning of an intermediate check state (i.e., the checkbox is neither empty nor with a solid check mark):

    • For the first 5 items (through Increase the margins of the dialog window):

      It indicates that in the current game, this feature is neither in its "original restored state" nor in a "fully patched state." Please refer to the prompts in the app for instructions.

    • For Display on-map damage:

      It indicates that enemy damage will only be shown on the map if you have obtained the Orb of Hero (See 1.2.2 - Map Enhancement).

    • For Enhance BGM playback:

      It indicates that the MP3 background music files cannot be found, so the BGM enhancement function cannot be activated. (See 1.2.4 - Background Music).

Troubleshooting

  • When the "Config (Dynamic)" dialog is shown, the TSW window will be temporarily disabled. After finishing the settings, close the Config dialog to return to the game.

    While you are configuring the settings, if you cannot find the "Config" dialog (which may be overlapped by the TSW game window), press F7 to bring it to the foreground.

  • If you encounter any problems, please follow the instructions provided by this modifier app. If the problem persists, please submit an issue here.

Advanced Options

Warning

Please read the General Guidelines for Advanced Options first. In particular, misconfiguration will cause uncontrolled or undefined behaviors of this app.

I have read the warning message above and choose to continue...

Below lists the relevant settings involved in this chapter. For the settings of other submodules, please refer to their own corresponding chapters.

  • Modify the hotkey to show the Config dialog to Ctrl+Alt+Enter (default 0 and 119, standing for F8): #CON_MODIFIER = 3; #CON_HOTKEY = VK_RETURN

  • Choose which patches to apply during startup:

    • By default, Showing only one-turn battle animation will be auto applied; uncomment this line to indicate restoring the TSW's original behavior (to show battle animation for every round): #$CONmodStatus[0] = false
    • By default, 47F Magician_A movement bug will be auto fixed; uncomment this line to indicate restoring the TSW's original behavior (to re-create the bug even if it is statically patched): #$CONmodStatus[1] = false
    • By default, 45F Merchant bug in the backside tower will be auto fixed; uncomment this line to indicate restoring the TSW's original behavior (to re-create the bug even if it is statically patched): #$CONmodStatus[2] = false
    • By default, 50F Zeno status bug in the backside tower will be auto fixed; uncomment this line to indicate restoring the TSW's original behavior (to re-create the bug even if it is statically patched): #$CONmodStatus[3] = false
    • By default, Increasing the margins of the dialog window will be auto applied; uncomment this line to indicate restoring the TSW's original behavior (to set zero margin): #$CONmodStatus[4] = false
    • For any of the item above, setting the value to nil means to neither patch nor restore. For example, uncommenting this line indicates that nothing will be performed upon startup (yet the static patches will still be grandfathered): #$CONmodStatus = [nil, nil, nil, nil, nil]
  • By default, the Config dialog will be displayed upon startup; uncomment this line to hide the dialog (Note: this is a separate setting and will not affect the auto patch above): #$CONonTSWstartup = false

Clone this wiki locally