@@ -40,6 +40,14 @@ local function patch_exe(file, patches)
40
40
end
41
41
end
42
42
43
+ local titleBox = table.concat ({
44
+ " +-----------------------------------------+" ,
45
+ " | gm8x_fix_lua v0.2 -- Feb 6th 2023 |" ,
46
+ " | https://github.com/Apis035/gm8x_fix_lua |" ,
47
+ " +-----------------------------------------+" ,
48
+ " " ,
49
+ }, " \n " )
50
+
43
51
local help = table.concat ({
44
52
" Usage: " .. arg [0 ] .. " file [options]" ,
45
53
" or drag the game file into the patcher." ,
@@ -63,7 +71,11 @@ local disabledPatch = {}
63
71
for i = 1 , # arg do
64
72
local arg = arg [i ]
65
73
66
- if arg == " -h" then print (help ) exit (1 )
74
+ if arg == " -h" then
75
+ print (titleBox )
76
+ print (help )
77
+ exit (1 )
78
+
67
79
elseif arg == " -s" then isSilent = true
68
80
elseif arg == " -nb" then makeBackup = false
69
81
elseif arg == " -nj" then disabledPatch [PatchType .JOY ] = true
@@ -77,20 +89,21 @@ for i=1, #arg do
77
89
else inputFile = arg end
78
90
end
79
91
80
- -- Disable print and prompt if silent mode is on
81
- if isSilent then
82
- print = function (...) end
83
- prompt = function (...) return true end
92
+ -- Show title if not in silent mode
93
+ if not isSilent or inputFile == nil then
94
+ print (titleBox )
84
95
end
85
96
86
97
-- Check if user disabled all patches
87
98
local isAllPatchesDisabled = true
99
+
88
100
for i = 1 , # PatchType do
89
101
if disabledPatch [i ] ~= true then
90
102
isAllPatchesDisabled = false
91
103
break
92
104
end
93
105
end
106
+
94
107
if isAllPatchesDisabled then
95
108
print " All patches is disabled, no operation will be performed."
96
109
exit (1 )
99
112
-- No file specified
100
113
if inputFile == nil then
101
114
print " Input file is not specified."
115
+ print " "
102
116
print (help )
103
117
exit (1 )
104
118
end
105
119
120
+ -- Disable print and prompt if silent mode is on
121
+ if isSilent then
122
+ print = function (...) end
123
+ prompt = function (...) return true end
124
+ end
125
+
106
126
-- | Reading input file |--------------------------------------------------------
107
127
108
- print (" Inspecting file %s..." , inputFile )
128
+ print (" Inspecting file %s...\n " , inputFile )
109
129
110
130
local file , err = io.open (inputFile , " r+b" )
111
131
@@ -163,6 +183,7 @@ if hasAppliedPatch then
163
183
end
164
184
end
165
185
end
186
+ print " "
166
187
167
188
-- List applicable patches
168
189
if canApplyPatch then
@@ -178,12 +199,13 @@ else
178
199
file :close ()
179
200
exit (1 )
180
201
end
202
+ print " "
181
203
182
204
-- | Applying patches |----------------------------------------------------------
183
205
184
206
-- Backup file
185
207
if makeBackup then
186
- print " Backup will be made before applying patches."
208
+ print " Backup will be made before applying patches.\n "
187
209
188
210
local backupName = inputFile .. ' .bak'
189
211
local backupFile = io.open (backupName , " rb" )
@@ -203,6 +225,7 @@ if makeBackup then
203
225
os.execute (" copy " .. inputFile .. " " .. backupName )
204
226
end
205
227
end
228
+ print " "
206
229
207
230
-- Begin applying patch
208
231
local joystickPatched = false
0 commit comments