diff --git a/gm82core.gej b/gm82core.gej index 1642a92..23f7b1c 100644 --- a/gm82core.gej +++ b/gm82core.gej @@ -297,6 +297,17 @@ ], "returntype": 2 }, + { + "name": "filename_short", + "extname": "__gm82core_shortfn", + "calltype": 12, + "helpline": "filename_short(fname)", + "hidden": false, + "argtypes": [ + 1 + ], + "returntype": 1 + }, { "name": "file_get_timestamp", "extname": "", @@ -331,6 +342,24 @@ ], "returntype": 2 }, + { + "name": "get_battery_level", + "extname": "", + "calltype": 12, + "helpline": "get_battery_level()", + "hidden": false, + "argtypes": [], + "returntype": 2 + }, + { + "name": "get_battery_status", + "extname": "", + "calltype": 12, + "helpline": "get_battery_status()", + "hidden": false, + "argtypes": [], + "returntype": 2 + }, { "name": "get_delta", "extname": "hrt_delta", @@ -385,6 +414,32 @@ "argtypes": [], "returntype": 2 }, + { + "name": "inch", + "extname": "approach", + "calltype": 12, + "helpline": "", + "hidden": true, + "argtypes": [ + 2, + 2, + 2 + ], + "returntype": 2 + }, + { + "name": "inch_angle", + "extname": "approach_angle", + "calltype": 12, + "helpline": "", + "hidden": true, + "argtypes": [ + 2, + 2, + 2 + ], + "returntype": 2 + }, { "name": "in_range", "extname": "", @@ -503,6 +558,19 @@ ], "returntype": 2 }, + { + "name": "perlin_noise", + "extname": "", + "calltype": 12, + "helpline": "perlin_noise(x,y,z)", + "hidden": false, + "argtypes": [ + 2, + 2, + 2 + ], + "returntype": 2 + }, { "name": "pivot_pos_x", "extname": "", @@ -1051,45 +1119,6 @@ ], "returntype": 2 }, - { - "name": "__registry_write_dword", - "extname": "", - "calltype": 12, - "helpline": "", - "hidden": true, - "argtypes": [ - 1, - 1, - 2 - ], - "returntype": 2 - }, - { - "name": "inch", - "extname": "approach", - "calltype": 12, - "helpline": "", - "hidden": true, - "argtypes": [ - 2, - 2, - 2 - ], - "returntype": 2 - }, - { - "name": "inch_angle", - "extname": "approach_angle", - "calltype": 12, - "helpline": "", - "hidden": true, - "argtypes": [ - 2, - 2, - 2 - ], - "returntype": 2 - }, { "name": "__registry_read_sz", "extname": "", @@ -1103,28 +1132,17 @@ "returntype": 1 }, { - "name": "perlin_noise", + "name": "__registry_write_dword", "extname": "", "calltype": 12, - "helpline": "perlin_noise(x,y,z)", - "hidden": false, + "helpline": "", + "hidden": true, "argtypes": [ - 2, - 2, + 1, + 1, 2 ], "returntype": 2 - }, - { - "name": "filename_short", - "extname": "__gm82core_shortfn", - "calltype": 12, - "helpline": "filename_short(fname)", - "hidden": false, - "argtypes": [ - 1 - ], - "returntype": 1 } ], "constants": [] diff --git a/source/gm82core.h b/source/gm82core.h index 783bc04..b2a3e3d 100644 --- a/source/gm82core.h +++ b/source/gm82core.h @@ -17,6 +17,7 @@ #pragma comment(lib, "GDI32.lib") #pragma comment(lib, "comctl32.lib") #pragma comment(lib, "ntdll.lib") +#pragma comment(lib, "Kernel32.lib") #define GMREAL __declspec(dllexport) double __cdecl #define GMSTR __declspec(dllexport) char* __cdecl diff --git a/source/windows.c b/source/windows.c index 9debcc8..7a9f21b 100644 --- a/source/windows.c +++ b/source/windows.c @@ -383,3 +383,17 @@ GMREAL date_get_current_timezone() { return -timezone; } + +GMREAL get_battery_level() { + SYSTEM_POWER_STATUS status; + GetSystemPowerStatus(&status); + return status.BatteryLifePercent; +} + +GMREAL get_battery_status() { + SYSTEM_POWER_STATUS status; + GetSystemPowerStatus(&status); + if (status.BatteryFlag>=128) return 0; + if (status.ACLineStatus==1) return 2; + return 1; +} \ No newline at end of file