@@ -248,7 +248,7 @@ bool call_va(lua_State* L, const char* func, const char* sig, ...)
248
248
249
249
int get_process_names (lua_State * L , char process_names [100 ][256 ], int * num_process_names )
250
250
{
251
- lua_getglobal (L , "state " );
251
+ lua_getglobal (L , "State " );
252
252
if (lua_istable (L , -1 )) {
253
253
lua_pushnil (L );
254
254
while (lua_next (L , -2 ) != 0 ) {
@@ -268,15 +268,15 @@ int get_process_names(lua_State* L, char process_names[100][256], int* num_proce
268
268
269
269
void startup (lua_State * L )
270
270
{
271
- call_va (L , "startup " , "" );
271
+ call_va (L , "Startup " , "" );
272
272
273
- lua_getglobal (L , "refreshRate " );
273
+ lua_getglobal (L , "RefreshRate " );
274
274
if (lua_isnumber (L , -1 )) {
275
275
refresh_rate = lua_tointeger (L , -1 );
276
276
}
277
277
lua_pop (L , 1 ); // Remove 'refreshRate' from the stack
278
278
279
- lua_getglobal (L , "mapsCacheCycles " );
279
+ lua_getglobal (L , "MapsCacheCycles " );
280
280
if (lua_isnumber (L , -1 )) {
281
281
maps_cache_cycles = lua_tointeger (L , -1 );
282
282
maps_cache_cycles_value = maps_cache_cycles ;
@@ -287,7 +287,7 @@ void startup(lua_State* L)
287
287
bool update (lua_State * L )
288
288
{
289
289
bool ret ;
290
- if (call_va (L , "update " , ">b" , & ret )) {
290
+ if (call_va (L , "Update " , ">b" , & ret )) {
291
291
lua_pop (L , 1 );
292
292
return ret ;
293
293
}
@@ -298,9 +298,9 @@ bool update(lua_State* L)
298
298
bool start (lua_State * L )
299
299
{
300
300
bool ret ;
301
- if (call_va (L , "start " , ">b" , & ret ) && ret ) {
301
+ if (call_va (L , "Start " , ">b" , & ret ) && ret ) {
302
302
atomic_store (& call_start , true);
303
- printf ("start : true\n" );
303
+ printf ("Start : true\n" );
304
304
lua_pop (L , 1 );
305
305
return true;
306
306
}
@@ -311,9 +311,9 @@ bool start(lua_State* L)
311
311
bool split (lua_State * L )
312
312
{
313
313
bool ret ;
314
- if (call_va (L , "split " , ">b" , & ret ) && ret ) {
314
+ if (call_va (L , "Split " , ">b" , & ret ) && ret ) {
315
315
atomic_store (& call_split , true);
316
- printf ("split : true\n" );
316
+ printf ("Split : true\n" );
317
317
lua_pop (L , 1 );
318
318
return true;
319
319
}
@@ -324,10 +324,10 @@ bool split(lua_State* L)
324
324
void is_loading (lua_State * L )
325
325
{
326
326
bool ret ;
327
- if (call_va (L , "isLoading " , ">b" , & ret )) {
327
+ if (call_va (L , "IsLoading " , ">b" , & ret )) {
328
328
if (ret != prev_is_loading ) {
329
329
atomic_store (& toggle_loading , true);
330
- printf ("isLoading : %s\n" , ret ? "true" : "false" );
330
+ printf ("IsLoading : %s\n" , ret ? "true" : "false" );
331
331
prev_is_loading = !prev_is_loading ;
332
332
}
333
333
}
@@ -337,9 +337,9 @@ void is_loading(lua_State* L)
337
337
bool reset (lua_State * L )
338
338
{
339
339
bool ret ;
340
- if (call_va (L , "reset " , ">b" , & ret ) && ret ) {
340
+ if (call_va (L , "Reset " , ">b" , & ret ) && ret ) {
341
341
atomic_store (& call_reset , true);
342
- printf ("reset : true\n" );
342
+ printf ("Reset : true\n" );
343
343
lua_pop (L , 1 );
344
344
return true;
345
345
}
@@ -349,10 +349,11 @@ bool reset(lua_State* L)
349
349
350
350
const char * version (lua_State * L )
351
351
{
352
- lua_getglobal (L , "version " );
352
+ lua_getglobal (L , "Version " );
353
353
if (lua_isstring (L , -1 )) {
354
354
const char * version = lua_tostring (L , -1 );
355
355
lua_pop (L , 1 );
356
+ printf ("Version: %s\n" , version );
356
357
return version ;
357
358
}
358
359
lua_pop (L , 1 );
@@ -392,16 +393,16 @@ void run_auto_splitter_cycle(
392
393
if (!atomic_load (& timer_started )) {
393
394
if (start_exists && start (L )) {
394
395
if (on_start_exists ) {
395
- call_va (L , "onStart " , "" );
396
+ call_va (L , "OnStart " , "" );
396
397
}
397
398
}
398
399
} else if (reset_exists && reset (L )) {
399
400
if (on_reset_exists ) {
400
- call_va (L , "onReset " , "" );
401
+ call_va (L , "OnReset " , "" );
401
402
}
402
403
} else if (split_exists && split (L )) {
403
404
if (on_split_exists ) {
404
- call_va (L , "onSplit " , "" );
405
+ call_va (L , "OnSplit " , "" );
405
406
}
406
407
}
407
408
@@ -444,16 +445,16 @@ void run_auto_splitter()
444
445
char current_file [PATH_MAX ];
445
446
strcpy (current_file , auto_splitter_file );
446
447
447
- bool start_exists = lua_function_exists (L , "start " );
448
- bool on_start_exists = lua_function_exists (L , "onStart " );
449
- bool split_exists = lua_function_exists (L , "split " );
450
- bool on_split_exists = lua_function_exists (L , "onSplit " );
451
- bool is_loading_exists = lua_function_exists (L , "isLoading " );
452
- bool startup_exists = lua_function_exists (L , "startup " );
453
- bool reset_exists = lua_function_exists (L , "reset " );
454
- bool on_reset_exists = lua_function_exists (L , "onReset " );
455
- bool update_exists = lua_function_exists (L , "update " );
456
- bool init_exists = lua_function_exists (L , "init " );
448
+ bool start_exists = lua_function_exists (L , "Start " );
449
+ bool on_start_exists = lua_function_exists (L , "OnStart " );
450
+ bool split_exists = lua_function_exists (L , "Split " );
451
+ bool on_split_exists = lua_function_exists (L , "OnSplit " );
452
+ bool is_loading_exists = lua_function_exists (L , "IsLoading " );
453
+ bool startup_exists = lua_function_exists (L , "Startup " );
454
+ bool reset_exists = lua_function_exists (L , "Reset " );
455
+ bool on_reset_exists = lua_function_exists (L , "OnReset " );
456
+ bool update_exists = lua_function_exists (L , "Update " );
457
+ bool init_exists = lua_function_exists (L , "Init " );
457
458
bool memory_map_exists = false;
458
459
459
460
if (startup_exists ) {
@@ -469,16 +470,13 @@ void run_auto_splitter()
469
470
if (get_process_names (L , process_names , & num_process_names )) {
470
471
if (find_process_id (process_names , num_process_names )) {
471
472
if (init_exists ) {
472
- call_va (L , "init " , "" );
473
+ call_va (L , "Init " , "" );
473
474
}
474
475
lua_newtable (L );
475
476
lua_setglobal (L , "old" );
476
477
lua_newtable (L );
477
478
lua_setglobal (L , "current" );
478
479
version_str = version (L );
479
- if (version_str ) {
480
- printf ("Version: %s\n" , version_str );
481
- }
482
480
memory_map_exists = store_memory_tables (L , version_str );
483
481
}
484
482
}
@@ -488,7 +486,7 @@ void run_auto_splitter()
488
486
clock_gettime (CLOCK_MONOTONIC , & clock_start );
489
487
490
488
if (!process_exists () && find_process_id (process_names , num_process_names ) && init_exists ) {
491
- call_va (L , "init " , "" );
489
+ call_va (L , "Init " , "" );
492
490
} else if (!atomic_load (& auto_splitter_enabled ) || strcmp (current_file , auto_splitter_file ) != 0 ) {
493
491
break ;
494
492
}
0 commit comments