Skip to content

Commit

Permalink
winxp compatibility; better readme
Browse files Browse the repository at this point in the history
  • Loading branch information
tomchen committed May 29, 2020
1 parent 5299f28 commit d51c7de
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 104 deletions.
166 changes: 83 additions & 83 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,61 +20,61 @@ mm6chupchangekey.exe 文件路径及名称 功能1 按键1 功能2 按键2 ...

其中,功能可以是以下之一(以下括号中是注释,请不要在命令行中输入括号和其中的内容):

* alwaysrun(是否总是奔跑)
* fliponexit(离开房屋时是否转身)
* forward(前进)
* back(后退)
* "turn left"(左转)
* "turn right"(右转)
* yell(呐喊)
* jump(跳跃)
* "toggle turnbase"(切换回合制/即时制)
* inspect(调查前方事物)
* "skip character"(切换到下一个队员)
* "cast quick spell"(施展备用魔法)
* attack(使用武器攻击)
* "fly up"(向上飞)
* "fly down"(向下飞)
* land(降落)
* `alwaysrun`(是否总是奔跑)
* `fliponexit`(离开房屋时是否转身)
* `forward`(前进)
* `back`(后退)
* `"turn left"`(左转)
* `"turn right"`(右转)
* `yell`(呐喊)
* `jump`(跳跃)
* `"toggle turnbase"`(切换回合制/即时制)
* `inspect`(调查前方事物)
* `"skip character"`(切换到下一个队员)
* `"cast quick spell"`(施展备用魔法)
* `attack`(使用武器攻击)
* `"fly up"`(向上飞)
* `"fly down"`(向下飞)
* `land`(降落)

(本工具暂无法改变仰视俯视平视、打开任务地图摘要休息魔法书等的键位)

对于alwaysrun和fliponexit,“按键”可以是1或0(即是或否);对于其他,按键可以是以下之一:

* backspace
* enter
* space
* "page up"
* "page down"
* end
* home
* left
* up
* right
* down
* insert
* delete
* 09
* az
* =
* ,
* -
* .
* /
* `
* \
* '
对于`alwaysrun``fliponexit`,“按键”可以是`1``0`(即是或否);对于其他,按键可以是以下之一:

* `backspace`
* `enter`
* `space`
* `"page up"`
* `"page down"`
* `end`
* `home`
* `left`
* `up`
* `right`
* `down`
* `insert`
* `delete`
* `0``9`
* `a``z`
* `=`
* `,`
* `-`
* `.`
* `/`
* `` ` ``
* `\`
* `'`

也可以使用(但不建议使用):

* f1 至 f12
* tab
* shift
* ctrl
* alt
* capslock
* `f1``f12`
* `tab`
* `shift`
* `ctrl`
* `alt`
* `capslock`

不区分大小写;有空格的请用英文双引号("")包裹起来
不区分大小写;有空格的请用英文双引号(`""`)包裹起来

## 范例

Expand All @@ -88,45 +88,45 @@ mm6chupchangekey.exe "mm6.exe" alwaysrun 1 fliponexit 0 forward w back s "turn l

* 总是奔跑:是(1)
* 离开房屋时转身:否(0)
* 前进、后退、左转、右转:WSAD
* 武器攻击:E
* (打开魔法书:C
* 施展备用魔法:CTRL+C或ALT+C
* 向上飞:F
* 向下飞:G
* 降落:V
(一个特殊的键位是:施展备用魔法的C键和打开魔法书冲突,所以打开魔法书还是C键,施展备用魔法变为CTRL+C或ALT+C
* 前进、后退、左转、右转:<kbd>W</kbd><kbd>S</kbd><kbd>A</kbd><kbd>D</kbd>
* 武器攻击:<kbd>E</kbd>
* (打开魔法书:<kbd>C</kbd>
* 施展备用魔法:<kbd>CTRL+C</kbd>或<kbd>ALT+C</kbd>
* 向上飞:<kbd>F</kbd>
* 向下飞:<kbd>G</kbd>
* 降落:<kbd>V</kbd>
(一个特殊的键位是:施展备用魔法的<kbd>C</kbd>键和打开魔法书冲突,所以打开魔法书还是<kbd>C</kbd>键,施展备用魔法变为<kbd>CTRL+C</kbd>或<kbd>ALT+C</kbd>

您也可以双击执行changekey.bat文件,它可以还原为中文完美升级版默认键位(总是奔跑,离开房屋时不转身,其他键位和原版一致)

或者,使用文本编辑器打开changekey.bat,修改成您想要的,保存,双击执行

## 附:魔法门6原版键位表

* ↑↓←→:前进、后退、左转、右转
* Shift + ↑↓:跑步移动
* Ctrl + ←→:侧移
* Page Down:仰视
* End:平视
* Delete:俯视
* Page Up:向上飞(当施展了空气魔法中的飞行奇术后)
* Home:降落(着陆)
* Insert:向下飞
* Enter:切换回合制/即时制
* 空格:调查前方事物(拾起地上的物品、打开箱子等)
* A:使用武器攻击(如敌人距离远,则使用弓箭)
* S:施展备用魔法(如无,则使用使用武器攻击)
* X:跳跃
* R:休息
* Z:打开队伍属性
* C:打开魔法书
* B:切换到下一个队员(跳过当前队员)
* 1、2、3、4:选中某队员(第二次按打开该队员的属性栏)
* 5、6:与雇佣的NPC谈话
* M:打开地图
* Q:打开当前任务
* N:打开自动摘要
* T:打开日历
* Y:呐喊(驱赶挡路的NPC)

原版不按Shift为行走状态,较慢,离开房屋时会转身。中文完美升级版开启了总是奔跑,离开房屋时不会转身,没有更改其他键位)
* <kbd>↑</kbd><kbd>↓</kbd><kbd>←</kbd><kbd>→</kbd>:前进、后退、左转、右转
* <kbd>Shift + ↑↓</kbd>:跑步移动
* <kbd>Ctrl + ←→</kbd>:侧移
* <kbd>Page Down</kbd>:仰视
* <kbd>End</kbd>:平视
* <kbd>Delete</kbd>:俯视
* <kbd>Page Up</kbd>:向上飞(当施展了空气魔法中的飞行奇术后)
* <kbd>Home</kbd>:降落(着陆)
* <kbd>Insert</kbd>:向下飞
* <kbd>Enter</kbd>:切换回合制/即时制
* <kbd>空格</kbd>:调查前方事物(拾起地上的物品、打开箱子等)
* <kbd>A</kbd>:使用武器攻击(如敌人距离远,则使用弓箭)
* <kbd>S</kbd>:施展备用魔法(如无,则使用使用武器攻击)
* <kbd>X</kbd>:跳跃
* <kbd>R</kbd>:休息
* <kbd>Z</kbd>:打开队伍属性
* <kbd>C</kbd>:打开魔法书
* <kbd>B</kbd>:切换到下一个队员(跳过当前队员)
* <kbd>1</kbd>、</kbd>2</kbd>、</kbd>3</kbd>、</kbd>4</kbd>:选中某队员(第二次按打开该队员的属性栏)
* <kbd>5</kbd>、</kbd>6</kbd>:与雇佣的NPC谈话
* <kbd>M</kbd>:打开地图
* <kbd>Q</kbd>:打开当前任务
* <kbd>N</kbd>:打开自动摘要
* <kbd>T</kbd>:打开日历
* <kbd>Y</kbd>:呐喊(驱赶挡路的NPC)

原版不按<kbd>Shift</kbd>为行走状态,较慢,离开房屋时会转身。中文完美升级版开启了总是奔跑,离开房屋时不会转身,没有更改其他键位)
50 changes: 33 additions & 17 deletions mm6chupchangekey/Source.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <stdio.h>
#include <stdlib.h>
//#include <stdio.h>
//#include <stdlib.h>
#include <Windows.h>
#include <string>
//#include <conio.h>
#include <algorithm>
#include <iterator>
//#include <conio.h>
//#include <iterator>
//#include <iostream>
#include <fstream>

typedef std::string string;

Expand Down Expand Up @@ -266,27 +266,43 @@ void wrongArgumentsAlert(void) {
printf("Wrong arguments.\nUsage: mm6chupchangekey.exe file function1 key1 function2 key2 ...");
}

bool copyFile(const char *SRC, const char* DEST) {
std::ifstream src(SRC, std::ios::binary);
std::ofstream dest(DEST, std::ios::binary);
dest << src.rdbuf();
return src && dest;
//bool copyFile(const char *SRC, const char* DEST) {
// std::ifstream src(SRC, std::ios::binary);
// std::ofstream dest(DEST, std::ios::binary);
// dest << src.rdbuf();
// return src && dest;
//}

wchar_t* s2ws(const string& s) {
int len;
int slength = (int)s.length() + 1;
len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0);
wchar_t* buf = new wchar_t[len];
MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, buf, len);
return buf;
}

string GetExePath() {
char buffer[MAX_PATH];
GetModuleFileNameA(NULL, buffer, MAX_PATH);
string f = string(buffer);
return f.substr(0, f.find_last_of("\\/"));
}



int main(int argc, char * argv[]) {

if (argc >= 3) {

int i;
string arg, content;

char backupExt[8] = ".backup";
char * backupPath;
backupPath = (char *)malloc(strlen(argv[1]) + strlen(backupExt) + 1);
backupPath[0] = '\0';
strcat(backupPath, argv[1]);
strcat(backupPath, backupExt);
copyFile(argv[1], backupPath);
string backupSuffix = ".backup";
string backupPath = argv[1] + backupSuffix;

string p = GetExePath();
CopyFile(s2ws(p + '\\' + argv[1]), s2ws(p + '\\' + backupPath), 0);

FILE * f;
f = fopen(argv[1], "r+b");
Expand Down
17 changes: 13 additions & 4 deletions mm6chupchangekey/mm6chupchangekey.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>mm6chupchangekey</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand All @@ -35,8 +36,8 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CLRSupport>true</CLRSupport>
<PlatformToolset>v140_xp</PlatformToolset>
<CLRSupport>false</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
Expand All @@ -49,8 +50,8 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CLRSupport>true</CLRSupport>
<PlatformToolset>v140_xp</PlatformToolset>
<CLRSupport>false</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
Expand Down Expand Up @@ -107,18 +108,26 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalOptions>/SUBSYSTEM:CONSOLE,"5.01" %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies />
<SubSystem>Console</SubSystem>
<MinimumRequiredVersion>5.01</MinimumRequiredVersion>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalOptions>/SUBSYSTEM:CONSOLE,"5.01" %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies />
<SubSystem>Console</SubSystem>
<MinimumRequiredVersion>5.01</MinimumRequiredVersion>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down

0 comments on commit d51c7de

Please sign in to comment.