Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "grayscreenshotlib.h"
- int file_handle, time, n_screen;
- void gsl_init(int n_screenshot)
- {
- unsigned short filename[] = {'\\','\\','c','r','d','0','\\','M','O','V','I','E','.','g','s','l',0};
- gsl_CreateFile(filename, 2048*n_screenshot);
- file_handle = gsl_OpenFile(filename, 2);
- n_screen = n_screenshot;
- time = 0;
- }
- void gsl_quit()
- {
- gsl_CloseFile(file_handle);
- n_screen = 0;
- }
- void gsl_screenshot(const unsigned char* light_buffer, const unsigned char* dark_buffer)
- {
- if(n_screen) {
- if(gsl_GetTicks()-time > 6) {
- time = gsl_GetTicks();
- gsl_WriteFile(file_handle, light_buffer, 1024);
- gsl_WriteFile(file_handle, dark_buffer, 1024);
- n_screen--;
- }
- }
- }
- /* syscalls */
- const int SysCallCode[] = {0xD201422B,0x60F20000,0x80010070};
- static int (*SysCall)( int R4, int R5, int R6, int R7, int FNo ) = (void*)&SysCallCode;
- static int gsl_CreateFile(const unsigned short *filename, int size) {
- return (int)((*SysCall)( (int)filename, 1, (int)&size, 0, 0x0434 ));
- }
- static int gsl_WriteFile(int handle, void* buffer, int size) {
- if (handle & 0xF000000) { return (int)((*SysCall)( handle, (int)buffer, size, 0, 0x0435 )); }
- else { return -1; }
- }
- static int gsl_OpenFile(const unsigned short *filename, int mode) {
- return (int)((*SysCall)( (int)filename, mode, 0, 0, 0x042C ));
- }
- static int gsl_CloseFile(int handle) {
- if (handle & 0xF000000) { return (int)((*SysCall)( handle, 0, 0, 0, 0x042D )); }
- else { return -1; }
- }
- static int gsl_GetTicks(void) {
- return (int)((*SysCall)( 0, 0, 0, 0, 0x003B ));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement