-
Notifications
You must be signed in to change notification settings - Fork 2
/
gamemaker.cpp
509 lines (393 loc) · 13.7 KB
/
gamemaker.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
/*
MIT License
Copyright © 2020-2022 Samuel Venable
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "gamemaker.hpp"
#include "filesystem.hpp"
using std::string;
char *directory_get_current_working() {
static string result;
result = ngs::fs::directory_get_current_working();
return (char *)result.c_str();
}
double directory_set_current_working(char *dname) {
return ngs::fs::directory_set_current_working(dname);
}
char *directory_get_temporary_path() {
static string result;
result = ngs::fs::directory_get_temporary_path();
return (char *)result.c_str();
}
char *directory_get_desktop_path() {
static string result;
result = ngs::fs::directory_get_desktop_path();
return (char *)result.c_str();
}
char *directory_get_documents_path() {
static string result;
result = ngs::fs::directory_get_documents_path();
return (char *)result.c_str();
}
char *directory_get_downloads_path() {
static string result;
result = ngs::fs::directory_get_downloads_path();
return (char *)result.c_str();
}
char *directory_get_music_path() {
static string result;
result = ngs::fs::directory_get_music_path();
return (char *)result.c_str();
}
char *directory_get_pictures_path() {
static string result;
result = ngs::fs::directory_get_pictures_path();
return (char *)result.c_str();
}
char *directory_get_videos_path() {
static string result;
result = ngs::fs::directory_get_videos_path();
return (char *)result.c_str();
}
char *executable_get_directory() {
static string result;
result = ngs::fs::executable_get_directory();
return (char *)result.c_str();
}
char *executable_get_filename() {
static string result;
result = ngs::fs::executable_get_filename();
return (char *)result.c_str();
}
char *executable_get_pathname() {
static string result;
result = ngs::fs::executable_get_pathname();
return (char *)result.c_str();
}
double symlink_create(char *fname, char *newname) {
return ngs::fs::symlink_create(fname, newname);
}
double symlink_copy(char *fname, char *newname) {
return ngs::fs::symlink_copy(fname, newname);
}
double symlink_exists(char *fname) {
return ngs::fs::symlink_exists(fname);
}
double hardlink_create(char *fname, char *newname) {
return ngs::fs::hardlink_create(fname, newname);
}
double file_numblinks(char *fname) {
return (double)ngs::fs::file_numblinks(fname);
}
double file_bin_numblinks(double fd) {
return (double)ngs::fs::file_bin_numblinks((int)fd);
}
char *file_bin_hardlinks(double fd, char *dnames, double recursive) {
static string result;
result = ngs::fs::file_bin_hardlinks((int)fd, dnames, (bool)recursive);
return (char *)result.c_str();
}
char *filename_absolute(char *fname) {
static string result;
result = ngs::fs::filename_absolute(fname);
return (char *)result.c_str();
}
char *filename_canonical(char *fname) {
static string result;
result = ngs::fs::filename_canonical(fname);
return (char *)result.c_str();
}
double filename_equivalent(char *fname1, char *fname2) {
return ngs::fs::filename_equivalent(fname1, fname2);
}
double file_exists(char *fname) {
return ngs::fs::file_exists(fname);
}
double file_delete(char *fname) {
return ngs::fs::file_delete(fname);
}
double file_rename(char *oldname, char *newname) {
return ngs::fs::file_rename(oldname, newname);
}
double file_copy(char *fname, char *newname) {
return ngs::fs::file_copy(fname, newname);
}
double file_size(char *fname) {
return (double)ngs::fs::file_size(fname);
}
double directory_exists(char *dname) {
return ngs::fs::directory_exists(dname);
}
double directory_create(char *dname) {
return ngs::fs::directory_create(dname);
}
double directory_destroy(char *dname) {
return ngs::fs::directory_destroy(dname);
}
double directory_rename(char *oldname, char *newname) {
return ngs::fs::directory_rename(oldname, newname);
}
double directory_copy(char *dname, char *newname) {
return ngs::fs::directory_copy(dname, newname);
}
double directory_size(char *dname) {
return (double)ngs::fs::directory_size(dname);
}
double directory_contents_close() {
ngs::fs::directory_contents_close();
return 0;
}
double directory_contents_get_length() {
return ngs::fs::directory_contents_get_length();
}
double directory_contents_get_order() {
return ngs::fs::directory_contents_get_order();
}
double directory_contents_set_order(double order) {
ngs::fs::directory_contents_set_order((unsigned)order);
return 0;
}
double directory_contents_get_cntfiles() {
return ngs::fs::directory_contents_get_cntfiles();
}
double directory_contents_get_maxfiles() {
return ngs::fs::directory_contents_get_maxfiles();
}
double directory_contents_set_maxfiles(double order) {
ngs::fs::directory_contents_set_maxfiles((unsigned)order);
return 0;
}
char *directory_contents_first(char *dname, char *pattern, double includedirs, double recursive) {
static string result;
result = ngs::fs::directory_contents_first(dname, pattern, includedirs, recursive);
return (char *)result.c_str();
}
double directory_contents_first_async(char *dname, char *pattern, double includedirs, double recursive) {
ngs::fs::directory_contents_first_async(dname, pattern, includedirs, recursive);
return 0;
}
double directory_contents_get_completion_status() {
return ngs::fs::directory_contents_get_completion_status();
}
double directory_contents_set_completion_status(double complete) {
ngs::fs::directory_contents_set_completion_status((bool)complete);
return 0;
}
char *directory_contents_next() {
static string result;
result = ngs::fs::directory_contents_next();
return (char *)result.c_str();
}
char *environment_get_variable(char *name) {
static string result;
result = ngs::fs::environment_get_variable(name);
return (char *)result.c_str();
}
double environment_get_variable_exists(char *name) {
return ngs::fs::environment_get_variable_exists(name);
}
double environment_set_variable(char *name, char *value) {
return ngs::fs::environment_set_variable(name, value);
}
double environment_unset_variable(char *name) {
return ngs::fs::environment_unset_variable(name);
}
char *environment_expand_variables(char *str) {
static string result;
result = ngs::fs::environment_expand_variables(str);
return (char *)result.c_str();
}
double file_datetime_accessed_year(char *fname) {
return ngs::fs::file_datetime_accessed_year(fname);
}
double file_datetime_accessed_month(char *fname) {
return ngs::fs::file_datetime_accessed_month(fname);
}
double file_datetime_accessed_day(char *fname) {
return ngs::fs::file_datetime_accessed_day(fname);
}
double file_datetime_accessed_hour(char *fname) {
return ngs::fs::file_datetime_accessed_hour(fname);
}
double file_datetime_accessed_minute(char *fname) {
return ngs::fs::file_datetime_accessed_minute(fname);
}
double file_datetime_accessed_second(char *fname) {
return ngs::fs::file_datetime_accessed_second(fname);
}
double file_datetime_modified_year(char *fname) {
return ngs::fs::file_datetime_modified_year(fname);
}
double file_datetime_modified_month(char *fname) {
return ngs::fs::file_datetime_modified_month(fname);
}
double file_datetime_modified_day(char *fname) {
return ngs::fs::file_datetime_modified_day(fname);
}
double file_datetime_modified_hour(char *fname) {
return ngs::fs::file_datetime_modified_hour(fname);
}
double file_datetime_modified_minute(char *fname) {
return ngs::fs::file_datetime_modified_minute(fname);
}
double file_datetime_modified_second(char *fname) {
return ngs::fs::file_datetime_modified_second(fname);
}
double file_datetime_created_year(char *fname) {
return ngs::fs::file_datetime_created_year(fname);
}
double file_datetime_created_month(char *fname) {
return ngs::fs::file_datetime_created_month(fname);
}
double file_datetime_created_day(char *fname) {
return ngs::fs::file_datetime_created_day(fname);
}
double file_datetime_created_hour(char *fname) {
return ngs::fs::file_datetime_created_hour(fname);
}
double file_datetime_created_minute(char *fname) {
return ngs::fs::file_datetime_created_minute(fname);
}
double file_datetime_created_second(char *fname) {
return ngs::fs::file_datetime_created_second(fname);
}
double file_bin_datetime_accessed_year(double fd) {
return ngs::fs::file_bin_datetime_accessed_year((int)fd);
}
double file_bin_datetime_accessed_month(double fd) {
return ngs::fs::file_bin_datetime_accessed_month((int)fd);
}
double file_bin_datetime_accessed_day(double fd) {
return ngs::fs::file_bin_datetime_accessed_day((int)fd);
}
double file_bin_datetime_accessed_hour(double fd) {
return ngs::fs::file_bin_datetime_accessed_hour((int)fd);
}
double file_bin_datetime_accessed_minute(double fd) {
return ngs::fs::file_bin_datetime_accessed_minute((int)fd);
}
double file_bin_datetime_accessed_second(double fd) {
return ngs::fs::file_bin_datetime_accessed_second((int)fd);
}
double file_bin_datetime_modified_year(double fd) {
return ngs::fs::file_bin_datetime_modified_year((int)fd);
}
double file_bin_datetime_modified_month(double fd) {
return ngs::fs::file_bin_datetime_modified_month((int)fd);
}
double file_bin_datetime_modified_day(double fd) {
return ngs::fs::file_bin_datetime_modified_day((int)fd);
}
double file_bin_datetime_modified_hour(double fd) {
return ngs::fs::file_bin_datetime_modified_hour((int)fd);
}
double file_bin_datetime_modified_minute(double fd) {
return ngs::fs::file_bin_datetime_modified_minute((int)fd);
}
double file_bin_datetime_modified_second(double fd) {
return ngs::fs::file_bin_datetime_modified_second((int)fd);
}
double file_bin_datetime_created_year(double fd) {
return ngs::fs::file_bin_datetime_created_year((int)fd);
}
double file_bin_datetime_created_month(double fd) {
return ngs::fs::file_bin_datetime_created_month((int)fd);
}
double file_bin_datetime_created_day(double fd) {
return ngs::fs::file_bin_datetime_created_day((int)fd);
}
double file_bin_datetime_created_hour(double fd) {
return ngs::fs::file_bin_datetime_created_hour((int)fd);
}
double file_bin_datetime_created_minute(double fd) {
return ngs::fs::file_bin_datetime_created_minute((int)fd);
}
double file_bin_datetime_created_second(double fd) {
return ngs::fs::file_bin_datetime_created_second((int)fd);
}
double file_bin_open(char *fname, double mode) {
return ngs::fs::file_bin_open(fname, (int)mode);
}
double file_bin_rewrite(double fd) {
return ngs::fs::file_bin_rewrite((int)fd);
}
double file_bin_close(double fd) {
return ngs::fs::file_bin_close((int)fd);
}
double file_bin_size(double fd) {
return ngs::fs::file_bin_size((int)fd);
}
double file_bin_position(double fd) {
return ngs::fs::file_bin_position((int)fd);
}
double file_bin_seek(double fd, double pos) {
return ngs::fs::file_bin_seek((int)fd, (long)pos);
}
double file_bin_read_byte(double fd) {
return ngs::fs::file_bin_read_byte((int)fd);
}
double file_bin_write_byte(double fd, double byte) {
return ngs::fs::file_bin_write_byte((int)fd, (int)byte);
}
double file_text_open_read(char *fname) {
return ngs::fs::file_text_open_read(fname);
}
double file_text_open_write(char *fname) {
return ngs::fs::file_text_open_write(fname);
}
double file_text_open_append(char *fname) {
return ngs::fs::file_text_open_append(fname);
}
double file_text_write_real(double fd, double val) {
return ngs::fs::file_text_write_real((int)fd, val);
}
double file_text_write_string(double fd, char *str) {
return ngs::fs::file_text_write_string((int)fd, str);
}
double file_text_writeln(double fd) {
return ngs::fs::file_text_writeln((int)fd);
}
double file_text_eoln(double fd) {
return ngs::fs::file_text_eoln((int)fd);
}
double file_text_eof(double fd) {
return ngs::fs::file_text_eof((int)fd);
}
double file_text_read_real(double fd) {
return ngs::fs::file_text_read_real((int)fd);
}
char *file_text_read_string(double fd) {
static string result;
result = ngs::fs::file_text_read_string((int)fd);
return (char *)result.c_str();
}
char *file_text_readln(double fd) {
static string result;
result = ngs::fs::file_text_readln((int)fd);
return (char *)result.c_str();
}
char *file_text_read_all(double fd) {
static string result;
result = ngs::fs::file_text_read_all((int)fd);
return (char *)result.c_str();
}
double file_text_open_from_string(char *str) {
return ngs::fs::file_text_open_from_string(str);
}
double file_text_close(double fd) {
return ngs::fs::file_text_close((int)fd);
}