You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
+ Partial support of Inganok's choices (with two variants).
+ Fix a great problem: there wasn't a possibility to add commands in many scripts of latter versions of codeXRScript.
Copy file name to clipboardExpand all lines: gscScriptCompAndDecompiler.py
+16-11Lines changed: 16 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,7 @@ class GscFile:
51
51
(0x05, 'i', 'JUMP'),
52
52
(0x0D, 'i', 'PAUSE'),
53
53
(0x0C, 'ii', 'CALL_SCRIPT'), #[имя скрипта без начальных нулей, ???]
54
+
(0x0E, 'hiiiiiiiiiiiiii', 'CHOICE'),
54
55
(0x14, 'ii', 'IMAGE_GET'),
55
56
(0x1A, '', 'IMAGE_SET'),
56
57
(0x1C, 'iii', 'BLEND_IMG'),
@@ -70,7 +71,6 @@ class GscFile:
70
71
(0x09, 'h', ''),
71
72
(0x0A, '', ''), #h в другом типе? Хм-м... #WAIT_FOR_CLICK?
72
73
(0x0B, '', ''),
73
-
(0x0E, 'hiiiiiiiiiiiiii', ''), #???
74
74
(0x0F, 'iiiiiiiiiiii', ''), #??? #Массив? Подправить число аргументов?
75
75
(0x10, 'i', ''),
76
76
(0x11, '', ''),
@@ -197,18 +197,21 @@ class GscFile:
197
197
(0x5800, 'hhh', ''),
198
198
(0x6800, 'hhh', ''),
199
199
(0x7800, 'hhh', ''),
200
+
(0x7A00, 'hhh', ''),
200
201
(0x8800, 'hhh', ''),
201
202
(0x8A00, 'hhh', ''),
202
203
(0x9800, 'hhh', ''),
203
204
(0x9810, 'hhh', ''), #!!!
204
205
(0x9A00, 'hhh', ''),
205
206
(0xA100, 'hhh', ''),
207
+
(0xA200, 'hhh', ''),
206
208
(0xA201, 'hhh', ''), #!!
207
209
(0xA400, 'hhh', ''),
208
210
(0xA500, 'hhh', ''),
209
211
(0xA600, 'hhh', ''),
210
212
(0xA800, 'hhh', ''),
211
213
(0xA810, 'hhh', ''), #!!!
214
+
(0xA900, 'hhh', ''),
212
215
(0xB400, 'hhh', ''),
213
216
(0xB800, 'hhh', ''),
214
217
(0xB900, 'hhh', ''),
@@ -223,18 +226,20 @@ class GscFile:
223
226
#(n)(1) - структура;
224
227
#(n)(2) - определение (может быть пустым).
225
228
226
-
ConnectedStringsLibrary= [[0x0F, [1]],
229
+
ConnectedStringsLibrary= [[0x0E, [7, 8]],
230
+
[0x0F, [1]],
227
231
[0x51, [-3, -2]],
228
232
[0x52, [-2]],
229
-
[0x79, [1]]]
233
+
[0x79, [1]]]#!!!
230
234
#Библиотека связанных со строками аргументов.
231
235
#(n)(0) - команда;
232
236
#(n)(1) - список связанных аргументов.
233
237
234
238
#Далее костыли по связанным со смещениям аргументам.
235
239
236
240
ConnectedOffsetsLibrary= [[0x03, [0]],
237
-
[0x05, [0]]]
241
+
[0x05, [0]],
242
+
[0xC8, [0]]]
238
243
Labels= []
239
244
#[0] - индекс метки, [1] - смещение метки.
240
245
@@ -568,7 +573,7 @@ def CompileTxtToGsc(self):
568
573
if (Lines[i] ==''):
569
574
i+=1
570
575
continue
571
-
if (Lines[i][0] =='<'): #Комментарии.
576
+
if (Lines[i][0] =='$'): #Комментарии.
572
577
i+=1
573
578
continue
574
579
if (Lines[i][0] =='@'): #Метки (забираются раньше).
@@ -586,7 +591,7 @@ def CompileTxtToGsc(self):
586
591
String=String+'^n'
587
592
i+=1
588
593
continue
589
-
if (Lines[i][0] =='<'): #Комментарии.
594
+
if (Lines[i][0] =='$'): #Комментарии.
590
595
i+=1
591
596
continue
592
597
if ((Lines[i][0] =='#') or (Lines[i][0] =='>') or (Lines[i][0] =='@')):
@@ -654,7 +659,7 @@ def CompileTxtToGsc(self):
654
659
String=String+'^n'
655
660
i+=1
656
661
continue
657
-
if (Lines[i][0] =='<'): #Комментарии.
662
+
if (Lines[i][0] =='$'): #Комментарии.
658
663
i+=1
659
664
continue
660
665
if ((Lines[i][0] =='#') or (Lines[i][0] =='>') or (Lines[i][0] =='@')):
@@ -950,14 +955,14 @@ def CommonHelp(self):
950
955
mb.showwarning("Common help", """This program was developed for correctly working with .gsc files of the engine codeX Rscript, which also called as Liar-soft Engine and raiL-soft Engine. The engine is rather simple much like it's formats, for example .gsc, with which through may be some problematic moments. Still the moments are ceasing by the specific decompile and compile. But the scheme can also cause problems it some situations.\n\nThis program allow you to:\n1. Rebuild .gsc-files from themselves so you can optimize them, for in many of .gsc-files there may be some trash elements. For example some number of zeros in the end. But this command is not garantee that all trash elements will be removed. This command also allow you to see .gsc-file's parametrs and unknown commands. It may be useful for code analysis.\2. .gsc to .txt decomple. It allow you to edit scripts as you like (with limitations of syntax, of course). For example, with this tool you can easily add new message.\n3. .txt to .gsc compile. This allow you to rebuild .gsc from decompiled and may be edited ealier code. It doesn't need an ealier .gsc to present for run.\n\nFor usage:\n1. Drag the .gsc script or .txt with decompiled data to the tool directory.\n2. Write the file name in the tool entry and push the "DEFINE".\n3. Use the commands below.""")
951
956
defCommandHelp(self):
952
957
if (self.Language=="RUS"):
953
-
mb.showwarning("Помощь по командам", """Увы, команд известно мало (но не их структур), а их аргументов ещё меньше. Что, впрочем, может измениться в будущем. Всякая известная команда в файле обозначена некоторой строкой.\n\nИтак, приведём базовые известные команды с аргументами:\n\n3 (0x03): JUMP_UNLESS.\nАргументы: [???]\n5 (0x05): JUMP.\nАргументы: [смещение от начала блока команд].\n13 (0x0D): PAUSE.\nАргументы: [время в секундах].\n20 (0x14): IMAGE_DEF.\nАргументы: [индекс картинки (из имени), ???].\n26 (0x1A): SCENE_SET.\nАргументы: [].\n28 (0x1C): BLEND_IMG.\nАргументы: [???, тип1, тип2].\n81 (0x51): MESSAGE.\nАргументы: [???, индекс гласа (из имени), ???, ???, -1, ???].\nВ самом .gsc вместо "-1" номер сообщения!\n200 (0xC8): READ_SCENARIO.\nАргументы: [???, ???, ???, ???, ???, ???, ???, ???, ???, ???, ???].\n255 (0xFF): SPRITE.\nАргументы: [режим, позиция, индекс картинки, ???, ???].\n13568 (0x3500): AND.\nАргументы: [???, ???, ???].\n18432 (0x4800): EQUALS.\nАргументы: [???, ???, ???].\n21504 (0x5400): GREATER_EQUALS.\nАргументы: [???, ???, ???].\n43520 (0xAA00): ADD.\nАргументы: [???, ???, ???].\n61696 (0xF100): ASSIGN.\nАргументы: [???, ???].""")
958
+
mb.showwarning("Помощь по командам", """Увы, команд известно мало (но не их структур), а их аргументов ещё меньше. Что, впрочем, может измениться в будущем. Всякая известная команда в файле обозначена некоторой строкой.\n\nИтак, приведём базовые известные команды с аргументами:\n\n3 (0x03): JUMP_UNLESS.\nАргументы: [метка].\n5 (0x05): JUMP.\nАргументы: [метка].\n12 (0x0C): CALL_SCRIPT.\nАргументы: [номер скрипта, ???]\n13 (0x0D): PAUSE.\nАргументы: [время в секундах].\n14 (0x0E): CHOICE.\nАргументы: [???, ???, ???, ???, ???, ???, ???, -1, -1, ???, ???, ???, ???, ???, ???].\n20 (0x14): IMAGE_GET.\nАргументы: [индекс картинки (из имени), ???].\n26 (0x1A): IMAGE_SET.\nАргументы: [].\n28 (0x1C): BLEND_IMG.\nАргументы: [???, тип1, тип2].\n30 (0x1E): IMAGE_DEF.\nАргументы: [???, ???, ???, ???, ???, ???].\n81 (0x51): MESSAGE.\nАргументы: [???, индекс гласа (из имени), ???, -1, -1, ???].\n82 (0x52): APPEND_MESSAGE.\nАргументы: [???, ???, ???, ???, -1, ???].\n121 (0x79): GET_DIRECTORY.\nАргументы: [???, -1].\n200 (0xC8): READ_SCENARIO.\nАргументы: [???, ???, ???, ???, ???, ???, ???, ???, ???, ???, ???].\n255 (0xFF): SPRITE.\nАргументы: [режим, позиция, индекс картинки, ???, ???].\n13568 (0x3500): AND.\nАргументы: [???, ???, ???].\n18432 (0x4800): EQUALS.\nАргументы: [???, ???, ???].\n21504 (0x5400): GREATER_EQUALS.\nАргументы: [???, ???, ???].\n43520 (0xAA00): ADD.\nАргументы: [???, ???, ???].\n61696 (0xF100): ASSIGN.\nАргументы: [???, ???].""")
954
959
else:
955
-
mb.showwarning("Command help", """Unfortunately, the number of known commands aren't big (but not of the structures). It may change it the future. All known commands are defined in decomilated file as a string.\n\nWell, let's show you a basic known commands with the arguments:\n\n3 (0x03): JUMP_UNLESS.\nArguments: [???]\n5 (0x05): JUMP.\nArguments: [offset from the beginning of command block].\n13 (0x0D): PAUSE.\nArguments: [time in seconds].\n20 (0x14): IMAGE_DEF.\nArguments: [image index (from the name), ???].\n26 (0x1A): SCENE_SET.\nArguments: [].\n28 (0x1C): BLEND_IMG.\nArguments: [???, type1, type2].\n81 (0x51): MESSAGE.\nArguments: [???, voice index (from the name), ???, ???, -1, ???].\nIn a .gsc itself is not a -1, but a message number.\n200 (0xC8): READ_SCENARIO.\nArguments: [???, ???, ???, ???, ???, ???, ???, ???, ???, ???, ???].\n255 (0xFF): SPRITE.\nArguments: [mode, position, image index, ???, ???].\n13568 (0x3500): AND.\nArguments: [???, ???, ???].\n18432 (0x4800): EQUALS.\nArguments: [???, ???, ???].\n21504 (0x5400): GREATER_EQUALS.\nArguments: [???, ???, ???].\n43520 (0xAA00): ADD.\nArguments: [???, ???, ???].\n61696 (0xF100): ASSIGN.\nArguments: [???, ???].""")
960
+
mb.showwarning("Command help", """Unfortunately, the number of known commands aren't big (but not of the structures). It may change it the future. All known commands are defined in decomilated file as a string.\n\nWell, let's show you a basic known commands with the arguments:\n\n3 (0x03): JUMP_UNLESS.\nArguments: [label]\n5 (0x05): JUMP.\nArguments: [label].\n12 (0x0C): CALL_SCRIPT.\nArguments: [script number, ???]0\n13 (0x0D): PAUSE.\nArguments: [time in seconds].\n14 (0x0E): CHOICE.\nArguments: [???, ???, ???, ???, ???, ???, ???, -1, -1, ???, ???, ???, ???, ???, ???].\n20 (0x14): IMAGE_GET.\nArguments: [image index (from the name), ???].\n26 (0x1A): IMAGE_SET.\nArguments: [].\n28 (0x1C): BLEND_IMG.\nArguments: [???, type1, type2].\n30 (0x1E): IMAGE_DEF.\nArguments: [???, ???, ???, ???, ???, ???].\n81 (0x51): MESSAGE.\nArguments: [???, voice index (from the name), ???, -1, -1, ???].\n82 (0x52): APPEND_MESSAGE.\nArguments: [???, ???, ???, ???, -1, ???].\n121 (0x79): GET_DIRECTORY.\nArguments: [???, -1].\n200 (0xC8): READ_SCENARIO.\nArguments: [???, ???, ???, ???, ???, ???, ???, ???, ???, ???, ???].\n255 (0xFF): SPRITE.\nArguments: [mode, position, image index, ???, ???].\n13568 (0x3500): AND.\nArguments: [???, ???, ???].\n18432 (0x4800): EQUALS.\nArguments: [???, ???, ???].\n21504 (0x5400): GREATER_EQUALS.\nArguments: [???, ???, ???].\n43520 (0xAA00): ADD.\nArguments: [???, ???, ???].\n61696 (0xF100): ASSIGN.\nArguments: [???, ???].""")
956
961
defSyntaxHelp(self):
957
962
if (self.Language=="RUS"):
958
-
mb.showwarning("Помощь по синтаксису", """Для тех, кто скрипты именно редактировать жаждет, сие крайне важно знать. Синтаксис в целом прост, но имеет ряд особенностей.\n\n|"<" в начале строки обозначает однострочный комментарий.\n"#" в начале строки есть определение команды.\n\n"[..., ..., ...]" есть форма описания аргументов функции (разделяются запятой) и следует сразу после определения команды.\n\nАргумент "-1" значит, что он связан с индексом следующей строки.\n\n">" обозначает строк начало.\nПосле сего идёт либо показатель изначального индекса строки, либо -1. -1 значит, что строка связанная. Связанные строки всегда следуют после задачи связанных аргументов.\nВАЖНО: ИНДЕКСЫ ПОСЛЕ ">" ОТОБРАЖАЮТ ЛИШЬ ИЗНАЧАЛЬНЫЕ ИНДЕКСЫ! ПРИ КОМПИЛЯЦИИ ИНДЕКС СТРОКИ БЕРЁТСЯ ЛИШЬ ИЗ НОМЕРА ">" В СКРИПТЕ!\nВАЖНО: НЕ ВСЕ СВЯЗНАННЫЕ ИНДЕКСЫ БЫЛИ НАЙДЕНЫ!""")
963
+
mb.showwarning("Помощь по синтаксису", """Для тех, кто скрипты именно редактировать жаждет, сие крайне важно знать. Синтаксис в целом прост, но имеет ряд особенностей.\n\n|"$" в начале строки обозначает однострочный комментарий.\n"#" в начале строки есть определение команды.\n\n"[..., ..., ...]" есть форма описания аргументов функции (разделяются запятой) и следует сразу после определения команды.\n\n"@" есть метка, на кою ссылаются некоторые команды.\n\nАргумент "-1" значит, что он связан с индексом следующей строки.\n\n">" обозначает строк начало.\nПосле сего идёт либо показатель изначального индекса строки, либо -1. -1 значит, что строка связанная. Связанные строки всегда следуют после задачи связанных аргументов.\nВАЖНО: ИНДЕКСЫ ПОСЛЕ ">" ОТОБРАЖАЮТ ЛИШЬ ИЗНАЧАЛЬНЫЕ ИНДЕКСЫ! ПРИ КОМПИЛЯЦИИ ИНДЕКС СТРОКИ БЕРЁТСЯ ЛИШЬ ИЗ НОМЕРА ">" В СКРИПТЕ!\nВАЖНО: НЕ ВСЕ СВЯЗНАННЫЕ ИНДЕКСЫ БЫЛИ НАЙДЕНЫ!""")
959
964
else:
960
-
mb.showwarning("Syntax help", """For those who desire for scripts to edit it's very important. The syntax is rather simple, but it have some specific moments.\n\n"<" is the string's beginning is for one-string comment.\n\n"#" in the string's beginning is for defination of command.\n\n"[..., ..., ...]" is for function argument's splitted with "," form. It goes strictly on the next line after the command defination.\n\nA "-1" argument means it connected with next string index.\n\n">" is for string beginning.\nAfter its goes mark of primar index of string or -1. If it's -1, the string is connected. Connected strings always goes after the defination of connected arguments.\nDO NOTE: INDEXES AFTER ">" SHOWS ONLY PRIMAR INDEXES! THEN COMPILE PROGRAM TAKE A STRING INDEX ONLY FROM THE NUMBER OF ">" IN SCRIPT!\nDO NOTE: NOT AN ALL OF CONNECTED INDEXES WAS FOUND!""")
965
+
mb.showwarning("Syntax help", """For those who desire for scripts to edit it's very important. The syntax is rather simple, but it have some specific moments.\n\n"$" is the string's beginning is for one-string comment.\n\n"#" in the string's beginning is for defination of command.\n\n"[..., ..., ...]" is for function argument's splitted with "," form. It goes strictly on the next line after the command defination.\n\n"@" is a label, to which some arguments are connecting.\n\nA "-1" argument means it connected with next string index.\n\n">" is for string beginning.\nAfter its goes mark of primar index of string or -1. If it's -1, the string is connected. Connected strings always goes after the defination of connected arguments.\nDO NOTE: INDEXES AFTER ">" SHOWS ONLY PRIMAR INDEXES! THEN COMPILE PROGRAM TAKE A STRING INDEX ONLY FROM THE NUMBER OF ">" IN SCRIPT!\nDO NOTE: NOT AN ALL OF CONNECTED INDEXES WAS FOUND!""")
0 commit comments