HLFX.Ru Forum Страницы (5): « 1 2 3 4 [5]
Показать все 65 сообщений этой темы на одной странице

HLFX.Ru Forum (https://hlfx.ru/forum/index.php)
- Half-Life SDK (https://hlfx.ru/forum/forumdisplay.php?forumid=8)
-- HLFX Hammer Editor (https://hlfx.ru/forum/showthread.php?threadid=3900)


Отправлено SourceSkyBoxer 10-10-2013 в 15:56:

Цитата:
This editor doesn't implement grid hack at all.

Why not?

Wait:

I have patch c++ file by Vluzacn on my computer.

I have tried to compile with Visual Studio 2008 Professional C++

It works fine and creates executable patch
C++ Source Code:
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <conio.h>
4
#include <string.h>
5
#include <windows.h>
6
 
7
typedef unsigned char byte;
8
 
9
void error (const char *s)
10
{
11
  printf ("Error: %s\nPress any key to quit", s);
12
  getch ();
13
  exit (1);
14
}
15
 
16
const unsigned int maxlen = 256;
17
typedef struct
18
{
19
  unsigned int pos;
20
  unsigned int len;
21
  byte data[maxlen];
22
}
23
part_t;
24
 
25
int match (byte *buffer, unsigned int length, const part_t *part)
26
{
27
  int i;
28
  for (i=0; part[i].len; i++)
29
  {
30
    if (length < part[i].pos + part[i].len)
31
      return false;
32
    if (memcmp (buffer + part[i].pos, part[i].data, part[i].len))
33
      return false;
34
  }
35
  return true;
36
}
37
 
38
int modify (byte *buffer, unsigned int length, const part_t *part)
39
{
40
  int i;
41
  for (i=0; part[i].len; i++)
42
  {
43
    if (length < part[i].pos + part[i].len)
44
      return false;
45
    memcpy (buffer + part[i].pos, part[i].data, part[i].len);
46
  }
47
  return true;
48
}
49
 
50
int main (int argc, char **argv)
51
{
52
  const part_t part_35_4096[] =
53
  {
54
    {0x215F9, 4, {0x00,0x00,0x80,0x45}}, // max (float)4096
55
    {0x21603, 4, {0x00,0x00,0x80,0xC5}}, // min (float)-4096
56
    {0x51CD9, 4, {0x10,0x27,0x00,0x00}}, // visibility (int)10000
57
    {0x3C4F1, 4, {0x00,0x00,0x00,0x3D}}, // min scale to reach (float)0.03125
58
    {0x3C514, 4, {0x00,0x00,0x80,0x43}}, // max scale to reach (float)256
59
    {0xB96E8, 8, {0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x40}}, // max scale (double)256
60
    {0xB96F0, 8, {0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0x3F}}, // min scale (double)0.03125
61
    {0,0}
62
  };
63
  const part_t part_35_30720[] =
64
  {
65
    {0x215F9, 4, {0x00,0x00,0x80,0x46}}, // max (float)16777216
66
    {0x21603, 4, {0x00,0x00,0x80,0xC6}}, // min (float)-16777216
67
    {0x51CD9, 4, {0x25,0x72,0x00,0x00}}, // visibility (int)20000
68
    {0x3C4F1, 4, {0x00,0x00,0x80,0x3C}}, // min scale to reach (float)0.015625
69
    {0x3C514, 4, {0x00,0x00,0x00,0x43}}, // max scale to reach (float)128
70
    {0xB96E8, 8, {0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40}}, // max scale (double)128
71
    {0xB96F0, 8, {0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x3F}}, // min scale (double)0.015625
72
    {0,0}
73
  };
74
  const part_t part_35_unknown[] =
75
  {
76
    {0xD4480, 16,"220\0mapversion\0"},
77
    {0,0}
78
  };
79
  const part_t part_34_4096[] =
80
  {
81
    {0x212C9, 4, {0x00,0x00,0x80,0x45}}, // max (float)4096
82
    {0x212D3, 4, {0x00,0x00,0x80,0xC5}}, // min (float)-4096
83
    {0x51959, 4, {0x10,0x27,0x00,0x00}}, // visibility (int)10000
84
    {0x3C231, 4, {0x00,0x00,0x00,0x3D}}, // min scale to reach (float)0.03125
85
    {0x3C254, 4, {0x00,0x00,0x80,0x43}}, // max scale to reach (float)256
86
    {0xB86E0, 8, {0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x40}}, // max scale (double)256
87
    {0xB86E8, 8, {0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0x3F}}, // min scale (double)0.03125
88
    {0,0}
89
  };
90
  const part_t part_34_30720[] =
91
  {
92
    {0x215F9, 4, {0x00,0x00,0x80,0x46}}, // max (float)16777216
93
    {0x21603, 4, {0x00,0x00,0x80,0xC6}}, // min (float)-16777216
94
    {0x51CD9, 4, {0x25,0x72,0x00,0x00}}, // visibility (int)20000
95
    {0x3C4F1, 4, {0x00,0x00,0x80,0x3C}}, // min scale to reach (float)0.015625
96
    {0x3C514, 4, {0x00,0x00,0x00,0x43}}, // max scale to reach (float)128
97
    {0xB96E8, 8, {0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40}}, // max scale (double)128
98
    {0xB96F0, 8, {0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x3F}}, // min scale (double)0.015625
99
    {0,0}
100
  };
101
  const part_t part_34_unknown[] =
102
  {
103
    {0xD3470, 16,"220\0mapversion\0"},
104
    {0,0}
105
  };
106
  char filename[MAX_PATH+1];
107
  if (argc > 1)
108
  {
109
    strncpy (filename, argv[1], MAX_PATH);
110
  }
111
  else
112
  {
113
    OPENFILENAME ofn;
114
    memset (&ofn, 0, sizeof(ofn));
115
    ofn.lStructSize = sizeof(ofn);
116
    ofn.lpstrFile = filename;
117
    strcpy (filename, "");
118
    ofn.nMaxFile = MAX_PATH;
119
    ofn.lpstrDefExt = "exe";
120
    ofn.lpstrFilter = "Executable(hammer.exe)\0*.exe\0All Files(*.*)\0*.*\0";
121
    ofn.nFilterIndex = 1;
122
    ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST;
123
    ofn.lpstrTitle = "Convert Valve Hammer Editor Executable";
124
    if (!GetSaveFileName (&ofn))
125
      error ("No file selected");
126
    printf ("%s\n", filename);
127
  }
128
  const part_t *type;
129
  unsigned int length;
130
  byte *buffer;
131
  {
132
    FILE *f;
133
    if (!(f = fopen (filename, "rb")))
134
      error ("Can not open file for read");
135
    fseek(f, 0, SEEK_END);
136
    length = ftell (f);
137
    fseek(f, 0, SEEK_SET);
138
    if (!(buffer = (byte *)malloc (length)))
139
      error ("No memory");
140
    if (fread (buffer, 1, length, f) != length)
141
      error ("Can not read file");
142
    if (match (buffer, length, part_35_4096))
143
    {
144
      type = part_35_4096;
145
      printf ("Detected version: Valve Hammer Editor 3.5 (normal)\n");
146
    }
147
    else if (match (buffer, length, part_35_30720))
148
    {
149
      type = part_35_30720;
150
      printf ("Detected version: Valve Hammer Editor 3.5 (already modified)\n");
151
    }
152
    else if (match (buffer, length, part_35_unknown))
153
    {
154
      type = part_35_unknown;
155
      printf ("Detected version: Valve Hammer Editor 3.5 (other)\n");
156
    }
157
    else if (match (buffer, length, part_34_4096))
158
    {
159
      type = part_34_4096;
160
      printf ("Detected version: Valve Hammer Editor 3.4 (normal)\n");
161
    }
162
    else if (match (buffer, length, part_34_30720))
163
    {
164
      type = part_34_30720;
165
      printf ("Detected version: Valve Hammer Editor 3.4 (already modified)\n");
166
    }
167
    else if (match (buffer, length, part_34_unknown))
168
    {
169
      type = part_34_unknown;
170
      printf ("Detected version: Valve Hammer Editor 3.5 (other)\n");
171
    }
172
    else
173
    {
174
      error ("Not hammer.exe from Valve Hammer Editor 3.4 or 3.5");
175
    }
176
    fclose (f);
177
  }
178
  {
179
    printf ("Press 1 to convert to normal version\nPress 2 to enlarge the range of grid\n");
180
    int key = getch ();
181
    if (key == '1')
182
    {
183
      if (type == part_35_4096 || type == part_35_30720 || type == part_35_unknown)
184
        type = part_35_4096;
185
      if (type == part_34_4096 || type == part_34_30720 || type == part_34_unknown)
186
        type = part_34_4096;
187
    }
188
    else if (key == '2')
189
    {
190
      if (type == part_35_4096 || type == part_35_30720 || type == part_35_unknown)
191
        type = part_35_30720;
192
      if (type == part_34_4096 || type == part_34_30720 || type == part_34_unknown)
193
        type = part_34_30720;
194
    }
195
    else
196
      error ("Invalid input");
197
  }
198
  {
199
    FILE *f;
200
    if (!(f = fopen (filename, "wb")))
201
      error ("Can not open file for write");
202
    modify (buffer, length, type);
203
    if (fwrite (buffer, 1, length, f) != length)
204
      error ("Can not write file");
205
    free (buffer);
206
    fclose (f);
207
  }
208
  printf ("Done\nPress any key to quit");
209
  getch ();
210
  return 0;
211
}


I don't know - how do i change hex binaries from "-/+4096" to "-/+30720"?
Look out thread: am-half-lifecreations Sven-Coop Forum and Cry of Fear Forum

__________________
Здравствуйте, хорошие люди, я
из Германии, и я прощаю тебя,
что я глухой. Я просто хочу,
чтобы писать по-английски.
Мне очень жаль. Я не могу
написать хороший русский
язык.


Отправлено Дядя Миша 10-10-2013 в 15:59:

SourceSkyBoxer Please do not use tag [ code ]. Use [ cpp ] instead.

__________________
My Projects: download page

F.A.Q по XashNT
Блог разработчика в телеграме

Цитата:

C:\DOCUME~1\C4C5~1\LOCALS~1\Temp\a33328if(72) : see declaration of 'size_t'


Отправлено SourceSkyBoxer 10-10-2013 в 16:04:

Цитата:
Дядя Миша писал:
SourceSkyBoxer Please do not use tag [ code ]. Use [ cpp ] instead.


Thank you.. i am sorry because i don't know about russian Language of your forum package. I need to switch Language English on your forum package and i understand better. Thanks

__________________
Здравствуйте, хорошие люди, я
из Германии, и я прощаю тебя,
что я глухой. Я просто хочу,
чтобы писать по-английски.
Мне очень жаль. Я не могу
написать хороший русский
язык.


Отправлено XaeroX 10-10-2013 в 16:45:

Цитата:
SourceSkyBoxer писал:
Why not?

Because there is an upcoming brand new editor that will fix all the problems, including tweakable grid size.

__________________

xaerox on Vivino


Отправлено SourceSkyBoxer 12-10-2013 в 10:52:

New girdhack by vluzacn now:

Can you map same nice place now.. But don't use out -/+32768!!!!! Thank you!

__________________
Здравствуйте, хорошие люди, я
из Германии, и я прощаю тебя,
что я глухой. Я просто хочу,
чтобы писать по-английски.
Мне очень жаль. Я не могу
написать хороший русский
язык.


Временная зона GMT. Текущее время 15:07. Страницы (5): « 1 2 3 4 [5]
Показать все 65 сообщений этой темы на одной странице

На основе vBulletin версии 2.3.0
Авторское право © Jelsoft Enterprises Limited 2000 - 2002.
Дизайн и программирование: Crystice Softworks © 2005 - 2024